Skip to content

Commit

Permalink
2.9.5 release
Browse files Browse the repository at this point in the history
  • Loading branch information
enact-bot committed Nov 19, 2024
2 parents bce3322 + e1e251a commit 91a08b8
Show file tree
Hide file tree
Showing 37 changed files with 1,053 additions and 820 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
dist: focal
dist: jammy
language: node_js
node_js:
- lts/*
- "21"
sudo: false
before_install:
- curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-4.4.gpg --dearmor
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

The following is a curated list of changes in the Enact sandstone module, newest changes on the top.

## [2.9.5] - 2024-11-19

### Added

- `sandstone/Icon` supported icon list, adding new icons `ai`, `alert01`, and `alert02`

### Fixed

- `sandstone/ContextualPopupDecorator` to update popup position properly when the screen orientation change
- `sandstone/Input` keypad layout when `type` prop is `number` or `passwordnumber` and the screen is in portrait mode or `popupType` prop is `overlay` and in large text mode

## [2.9.4] - 2024-10-29

### Fixed
Expand Down
26 changes: 26 additions & 0 deletions ContextualPopupDecorator/ContextualPopupDecorator.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global ResizeObserver */

/**
* A higher-order component to add a Sandstone styled popup to a component.
*
Expand Down Expand Up @@ -272,6 +274,7 @@ const Decorator = hoc(defaultConfig, (config, Wrapped) => {
activator: null
};

this.resizeObserver = null;
this.overflow = {};
this.adjustedDirection = this.props.direction;
this.id = this.generateId();
Expand All @@ -292,6 +295,12 @@ const Decorator = hoc(defaultConfig, (config, Wrapped) => {
on('keydown', this.handleKeyDown);
on('keyup', this.handleKeyUp);
}

if (typeof ResizeObserver === 'function') {
this.resizeObserver = new ResizeObserver(() => {
this.positionContextualPopup();
});
}
}

getSnapshotBeforeUpdate (prevProps, prevState) {
Expand Down Expand Up @@ -341,6 +350,11 @@ const Decorator = hoc(defaultConfig, (config, Wrapped) => {
off('keyup', this.handleKeyUp);
}
Spotlight.remove(this.state.containerId);

if (this.resizeObserver) {
this.resizeObserver.disconnect();
this.resizeObserver = null;
}
}

generateId = () => {
Expand Down Expand Up @@ -593,6 +607,18 @@ const Decorator = hoc(defaultConfig, (config, Wrapped) => {

getContainerNode = (node) => {
this.containerNode = node;

if (this.resizeObserver) {
if (node) {
// It is not easy to trigger changed position of activator,
// so we chose to observe the `div` element's size that has the real size below the root of floatLayer.
// This implementation is dependent on the current structure of FloatingLayer,
// so if the structure have changed, below code needs to be changed accordingly.
this.resizeObserver.observe(node?.parentElement?.parentElement);
} else {
this.resizeObserver.disconnect();
}
}
};

handle = handle.bind(this);
Expand Down
36 changes: 36 additions & 0 deletions ContextualPopupDecorator/tests/ContextualPopupDecorator-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,4 +505,40 @@ describe('ContextualPopupDecorator Specs', () => {
expect(scrimDivFirst).toHaveClass(expectedFirst);
expect(scrimDivSecond).toHaveClass(expectedSecond);
});

test('should create and observe with `ResizeObserver` when the popup opened and disconnect when the popup closed', () => {
const originalObserver = global.ResizeObserver;

const MockObserverInstance = {
observe: jest.fn(),
disconnect: jest.fn()
};
global.ResizeObserver = jest.fn().mockImplementation(() => MockObserverInstance);

const Root = FloatingLayerDecorator('div');
const {rerender} = render(
<Root>
<ContextualButton data-testid="contextualButton" open popupComponent={() => <div><Button>Button</Button></div>}>
Hello
</ContextualButton>
</Root>
);

const contextualButton = screen.getByTestId('contextualButton');

expect(contextualButton).toBeInTheDocument();
expect(MockObserverInstance.observe).toHaveBeenCalled();

rerender(
<Root>
<ContextualButton data-testid="contextualButton" popupComponent={() => <div><Button>Button</Button></div>}>
Hello
</ContextualButton>
</Root>
);

expect(MockObserverInstance.disconnect).toHaveBeenCalled();

global.ResizeObserver = originalObserver;
});
});
3 changes: 3 additions & 0 deletions Icon/Icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ const IconBase = kind({
* jumpforward10
* logout
* sketch
* ai
* alert01
* alert02
* ```
*
* @name iconList
Expand Down
5 changes: 4 additions & 1 deletion Icon/IconList.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,5 +251,8 @@ export default {
jumpbackward10 : 0x0F01B7, // jumpbackward_10
jumpforward10 : 0x0F01B8, // jumpforward_10
logout : 0x0F01B9, // logout
sketch : 0x0F01BA // sketch
sketch : 0x0F01BA, // sketch
ai : 0x0F01BB, // ai
alert01 : 0x0F01BC, // alert.01
alert02 : 0x0F01BD // alert.02
};
8 changes: 8 additions & 0 deletions Input/Input.module.less
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@
margin: @sand-portrait-input-fullscreen-keypad-margin;
width: @sand-portrait-input-fullscreen-keypad-width;
}

:global(.enact-orientation-portrait):global(.enact-text-large) & {
width: @sand-portrait-input-fullscreen-keypad-width-large;
}
}

.key {
Expand Down Expand Up @@ -228,6 +232,10 @@
.keypad {
margin: @sand-input-overlay-keypad-margin;
width: @sand-input-overlay-keypad-width;

:global(.enact-text-large) & {
width: @sand-input-overlay-keypad-width-large;
}
}

.buttonArea {
Expand Down
Binary file modified fonts/Sandstone_Icons.ttf
Binary file not shown.
90 changes: 45 additions & 45 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@enact/sandstone",
"version": "2.9.4",
"version": "2.9.5",
"description": "Large-screen/TV support library for Enact, containing a variety of UI components.",
"repository": {
"type": "git",
Expand Down Expand Up @@ -42,11 +42,11 @@
"extends": "enact-proxy/strict"
},
"dependencies": {
"@enact/core": "^4.9.3",
"@enact/i18n": "^4.9.3",
"@enact/spotlight": "^4.9.3",
"@enact/ui": "^4.9.3",
"@enact/webos": "^4.9.3",
"@enact/core": "^4.9.4",
"@enact/i18n": "^4.9.4",
"@enact/spotlight": "^4.9.4",
"@enact/ui": "^4.9.4",
"@enact/webos": "^4.9.4",
"classnames": "^2.5.1",
"invariant": "^2.2.4",
"prop-types": "^15.8.1",
Expand Down
8 changes: 4 additions & 4 deletions samples/event-logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
"theme": "sandstone"
},
"dependencies": {
"@enact/core": "^4.9.3",
"@enact/i18n": "^4.9.3",
"@enact/core": "^4.9.4",
"@enact/i18n": "^4.9.4",
"@enact/sandstone": "../../",
"@enact/spotlight": "^4.9.3",
"@enact/ui": "^4.9.3",
"@enact/spotlight": "^4.9.4",
"@enact/ui": "^4.9.4",
"ilib": "^14.20.0",
"prop-types": "^15.8.1",
"react": "^18.3.1",
Expand Down
Loading

0 comments on commit 91a08b8

Please sign in to comment.