@scality/core-ui 0.202.0 → 0.204.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/.github/workflows/github-pages.yml +4 -4
  2. package/.github/workflows/post-release.yml +25 -12
  3. package/__mocks__/fileMock.js +1 -1
  4. package/__mocks__/styleMock.js +1 -1
  5. package/__mocks__/uuid.js +1 -5
  6. package/dist/components/drawer/Drawer.component.d.ts +17 -0
  7. package/dist/components/drawer/Drawer.component.d.ts.map +1 -0
  8. package/dist/components/drawer/Drawer.component.js +132 -0
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +1 -0
  12. package/dist/next.d.ts +1 -0
  13. package/dist/next.d.ts.map +1 -1
  14. package/dist/next.js +1 -0
  15. package/dist/style/theme.d.ts +1 -0
  16. package/dist/style/theme.d.ts.map +1 -1
  17. package/dist/style/theme.js +1 -0
  18. package/dist/utils.d.ts.map +1 -1
  19. package/dist/utils.js +11 -16
  20. package/global-setup.js +1 -1
  21. package/jest.config.js +1 -1
  22. package/package.json +13 -3
  23. package/src/lib/components/drawer/Drawer.component.test.tsx +108 -0
  24. package/src/lib/components/drawer/Drawer.component.tsx +207 -0
  25. package/src/lib/index.ts +1 -0
  26. package/src/lib/next.ts +1 -0
  27. package/src/lib/style/theme.ts +1 -0
  28. package/src/lib/utils.test.ts +15 -12
  29. package/src/lib/utils.ts +15 -17
  30. package/src/lib/valalint/README.md +50 -0
  31. package/src/lib/valalint/index.js +49 -0
  32. package/src/lib/valalint/rules/modal-button-forbidden-label.js +87 -0
  33. package/src/lib/valalint/rules/modal-button-forbidden-label.test.js +157 -0
  34. package/src/lib/valalint/rules/no-raw-number-in-jsx.js +64 -0
  35. package/src/lib/valalint/rules/no-raw-number-in-jsx.test.js +237 -0
  36. package/src/lib/valalint/rules/technical-sentence-case.js +93 -0
  37. package/src/lib/valalint/rules/technical-sentence-case.test.js +167 -0
  38. package/stories/drawer.stories.tsx +135 -0
@@ -6,14 +6,14 @@ on:
6
6
  jobs:
7
7
  deploy:
8
8
  runs-on: ubuntu-latest
9
+ permissions:
10
+ contents: write
9
11
  steps:
10
12
  - uses: actions/checkout@v4
11
13
  - uses: actions/setup-node@v4
12
14
  with:
13
15
  node-version: 20
14
- - run: |
15
- git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
16
- npm ci
17
- npm run storybook:deploy
16
+ - run: npm ci
17
+ - run: npm run storybook:deploy
18
18
  env:
19
19
  STORYBOOK_DISABLE_TELEMETRY: 1
@@ -7,27 +7,41 @@ on:
7
7
  jobs:
8
8
  bump-version:
9
9
  runs-on: ubuntu-latest
10
+ permissions:
11
+ contents: write
12
+ pull-requests: write
10
13
  steps:
11
- - uses: actions/checkout@v2
14
+ - uses: actions/checkout@v4
12
15
  - name: Install node
13
- uses: actions/setup-node@v2
16
+ uses: actions/setup-node@v4
14
17
  with:
15
18
  node-version: "16"
16
19
  - run: echo "nextVersion=$(npm version --no-git-tag minor)" >> $GITHUB_ENV
20
+ - name: Push version bump branch
21
+ run: |
22
+ git config user.name "github-actions[bot]"
23
+ git config user.email "github-actions[bot]@users.noreply.github.com"
24
+ git checkout -b feature/bump-core-ui-version-to-${{ env.nextVersion }}
25
+ git add package.json package-lock.json
26
+ git commit -m "Bump core-ui version to ${{ env.nextVersion }}"
27
+ git push origin feature/bump-core-ui-version-to-${{ env.nextVersion }}
17
28
  - name: Create Pull Request
18
- uses: peter-evans/create-pull-request@v3
29
+ uses: actions/github-script@v5
19
30
  id: cpr
20
31
  with:
21
- token: ${{ secrets.GIT_ACCESS_TOKEN }}
22
- branch: feature/bump-core-ui-version-to-${{ env.nextVersion }}
23
- commit-message: Bump core-ui version to ${{ env.nextVersion }}
24
- title: Bump core-ui version to ${{ env.nextVersion }}
25
- body: ""
26
- base: ${{ github.event.repository.default_branch }}
32
+ script: |
33
+ const pr = await github.rest.pulls.create({
34
+ owner: context.repo.owner,
35
+ repo: context.repo.repo,
36
+ head: `feature/bump-core-ui-version-to-${process.env.nextVersion}`,
37
+ base: context.payload.repository.default_branch,
38
+ title: `Bump core-ui version to ${process.env.nextVersion}`,
39
+ body: ''
40
+ });
41
+ core.setOutput('pull-request-number', String(pr.data.number));
27
42
  - uses: actions/github-script@v5
28
43
  if: ${{ steps.cpr.outputs.pull-request-number }}
29
44
  with:
30
- github-token: ${{secrets.GIT_ACCESS_TOKEN}}
31
45
  script: |
32
46
  github.rest.issues.createComment({
33
47
  issue_number: '${{ steps.cpr.outputs.pull-request-number }}',
@@ -38,7 +52,6 @@ jobs:
38
52
  - uses: actions/github-script@v5
39
53
  if: ${{ steps.cpr.outputs.pull-request-number }}
40
54
  with:
41
- github-token: ${{secrets.GIT_ACCESS_TOKEN}}
42
55
  script: |
43
56
  await github.rest.pulls.merge({
44
57
  owner: context.repo.owner,
@@ -60,6 +73,6 @@ jobs:
60
73
  with:
61
74
  node-version: "25"
62
75
  registry-url: "https://registry.npmjs.org"
63
- - run: npm install
76
+ - run: npm ci
64
77
  - run: npm run build
65
78
  - run: npm publish
@@ -1,2 +1,2 @@
1
1
  // https://jestjs.io/docs/en/webpack#handling-static-assets
2
- module.exports = "test-file-stub";
2
+ export default "test-file-stub";
@@ -1,2 +1,2 @@
1
1
  // https://jestjs.io/docs/en/webpack#handling-static-assets
2
- module.exports = {};
2
+ export default {};
package/__mocks__/uuid.js CHANGED
@@ -1,11 +1,7 @@
1
1
  // Mock uuid module for Jest tests
2
2
  let counter = 0;
3
3
 
4
- const v4 = () => {
4
+ export const v4 = () => {
5
5
  counter += 1;
6
6
  return `mock-uuid-${Math.random().toString(36)}-${counter}`;
7
7
  };
8
-
9
- module.exports = {
10
- v4,
11
- };
@@ -0,0 +1,17 @@
1
+ import { CSSProperties, type ReactNode } from 'react';
2
+ type DrawerPosition = 'left' | 'right' | 'top' | 'bottom';
3
+ type Props = {
4
+ isOpen: boolean;
5
+ close: () => void;
6
+ title: ReactNode;
7
+ position?: DrawerPosition;
8
+ size?: CSSProperties['width'];
9
+ footer?: ReactNode;
10
+ overlay?: boolean;
11
+ showCloseButton?: boolean;
12
+ children: ReactNode;
13
+ };
14
+ declare const Drawer: ({ isOpen, close, title, position, size, footer, overlay, showCloseButton, children, }: Props) => import("react").ReactPortal | null;
15
+ export { Drawer };
16
+ export type { DrawerPosition };
17
+ //# sourceMappingURL=Drawer.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Drawer.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/drawer/Drawer.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,SAAS,EAA6D,MAAM,OAAO,CAAC;AAUjH,KAAK,cAAc,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE1D,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,IAAI,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AA+EF,QAAA,MAAM,MAAM,GAAI,uFAUb,KAAK,uCA4FP,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC;AAClB,YAAY,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,132 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
3
+ import { createPortal } from 'react-dom';
4
+ import styled from 'styled-components';
5
+ import { spacing } from '../../spacing';
6
+ import { zIndex } from '../../style/theme';
7
+ import { getThemePropSelector } from '../../utils';
8
+ import { Button } from '../buttonv2/Buttonv2.component';
9
+ import { Icon } from '../icon/Icon.component';
10
+ import { Text } from '../text/Text.component';
11
+ const TRANSITION_DURATION = '250ms';
12
+ const DrawerBackdrop = styled.div `
13
+ position: fixed;
14
+ inset: 0;
15
+ z-index: ${zIndex.overlay};
16
+ background: ${({ $overlay }) => ($overlay ? 'rgba(0, 0, 0, 0.3)' : 'transparent')};
17
+ `;
18
+ function getTransform(position, isOpen) {
19
+ if (isOpen)
20
+ return 'translate3d(0, 0, 0)';
21
+ switch (position) {
22
+ case 'left':
23
+ return 'translate3d(-100%, 0, 0)';
24
+ case 'right':
25
+ return 'translate3d(100%, 0, 0)';
26
+ case 'top':
27
+ return 'translate3d(0, -100%, 0)';
28
+ case 'bottom':
29
+ return 'translate3d(0, 100%, 0)';
30
+ }
31
+ }
32
+ const DrawerPanel = styled.div `
33
+ position: fixed;
34
+ z-index: ${zIndex.drawer};
35
+ background-color: ${getThemePropSelector('backgroundLevel2')};
36
+ color: ${getThemePropSelector('textPrimary')};
37
+ display: flex;
38
+ flex-direction: column;
39
+ box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
40
+ transition: transform ${TRANSITION_DURATION} ease-in-out;
41
+ transform: ${({ $position, $isOpen }) => getTransform($position, $isOpen)};
42
+
43
+ ${({ $position, $size, theme }) => {
44
+ const borderSide = $position === 'left' ? 'right' : $position === 'right' ? 'left' : $position === 'top' ? 'bottom' : 'top';
45
+ const border = `border-${borderSide}: 1px solid ${theme.border};`;
46
+ switch ($position) {
47
+ case 'left':
48
+ return `top: 0; left: 0; bottom: 0; width: ${$size}; ${border}`;
49
+ case 'right':
50
+ return `top: 0; right: 0; bottom: 0; width: ${$size}; ${border}`;
51
+ case 'top':
52
+ return `top: 0; left: 0; right: 0; height: ${$size}; ${border}`;
53
+ case 'bottom':
54
+ return `bottom: 0; left: 0; right: 0; height: ${$size}; ${border}`;
55
+ }
56
+ }}
57
+ `;
58
+ const DrawerHeader = styled.div `
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: space-between;
62
+ padding: ${spacing.r16};
63
+ background-color: ${getThemePropSelector('backgroundLevel3')};
64
+ `;
65
+ const DrawerBody = styled.div `
66
+ flex: 1;
67
+ overflow-y: auto;
68
+ padding: ${spacing.r16};
69
+ background-color: ${getThemePropSelector('backgroundLevel4')};
70
+ `;
71
+ const DrawerFooter = styled.div `
72
+ padding: ${spacing.r16};
73
+ background-color: ${getThemePropSelector('backgroundLevel3')};
74
+ display: flex;
75
+ gap: ${spacing.r8};
76
+ justify-content: flex-end;
77
+ `;
78
+ const Drawer = ({ isOpen, close, title, position = 'left', size = '400px', footer, overlay = false, showCloseButton = true, children, }) => {
79
+ const drawerContainer = useRef(document.createElement('div'));
80
+ const panelRef = useRef(null);
81
+ const [mounted, setMounted] = useState(isOpen);
82
+ const [active, setActive] = useState(false);
83
+ useLayoutEffect(() => {
84
+ var _a;
85
+ const container = drawerContainer.current;
86
+ (_a = document.body) === null || _a === void 0 ? void 0 : _a.prepend(container);
87
+ return () => {
88
+ var _a;
89
+ (_a = document.body) === null || _a === void 0 ? void 0 : _a.removeChild(container);
90
+ };
91
+ }, []);
92
+ useEffect(() => {
93
+ if (isOpen) {
94
+ setMounted(true);
95
+ }
96
+ else {
97
+ setActive(false);
98
+ }
99
+ }, [isOpen]);
100
+ useEffect(() => {
101
+ if (mounted && isOpen) {
102
+ const frame = requestAnimationFrame(() => {
103
+ var _a;
104
+ setActive(true);
105
+ (_a = panelRef.current) === null || _a === void 0 ? void 0 : _a.focus();
106
+ });
107
+ return () => cancelAnimationFrame(frame);
108
+ }
109
+ }, [mounted, isOpen]);
110
+ const stableClose = useCallback(close, [close]);
111
+ useEffect(() => {
112
+ if (isOpen) {
113
+ const handleEsc = (event) => {
114
+ if (event.key === 'Escape') {
115
+ stableClose();
116
+ }
117
+ };
118
+ document.addEventListener('keydown', handleEsc);
119
+ return () => {
120
+ document.removeEventListener('keydown', handleEsc);
121
+ };
122
+ }
123
+ }, [isOpen, stableClose]);
124
+ const handleTransitionEnd = () => {
125
+ if (!isOpen)
126
+ setMounted(false);
127
+ };
128
+ if (!mounted)
129
+ return null;
130
+ return createPortal(_jsxs(_Fragment, { children: [_jsx(DrawerBackdrop, { "$overlay": overlay, onClick: stableClose }), _jsxs(DrawerPanel, { ref: panelRef, className: "sc-drawer", "$position": position, "$size": size, "$isOpen": active, role: "dialog", tabIndex: -1, "aria-modal": overlay ? 'true' : undefined, "aria-labelledby": "drawer_label", onTransitionEnd: handleTransitionEnd, children: [_jsxs(DrawerHeader, { className: "sc-drawer-header", children: [_jsx(Text, { variant: "Larger", id: "drawer_label", children: title }), showCloseButton && (_jsx(Button, { icon: _jsx(Icon, { name: "Close" }), onClick: stableClose, tooltip: { overlay: 'Close' }, "aria-label": "Close" }))] }), _jsx(DrawerBody, { className: "sc-drawer-body", children: children }), footer && (_jsx(DrawerFooter, { className: "sc-drawer-footer", children: footer }))] })] }), drawerContainer.current);
131
+ };
132
+ export { Drawer };
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export { Dropdown } from './components/dropdown/Dropdown.component';
5
5
  export { LOADER_SIZE, STATUS_CRITICAL, STATUS_WARNING, STATUS_SUCCESS, STATUS_HEALTHY, STATUS_INFO, STATUS_UNKNOWN, STATUS_NONE, } from './components/constants';
6
6
  export type { Status } from './components/constants';
7
7
  export { Layout } from './components/layout/Layout.component';
8
+ export { Drawer } from './components/drawer/Drawer.component';
8
9
  export { Loader } from './components/loader/Loader.component';
9
10
  export { Modal } from './components/modal/Modal.component';
10
11
  export { Navbar } from './components/navbar/Navbar.component';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAC1E,O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xD,OAAO,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,oDAAoD,CAAC;AACnF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ export { Checkbox } from './components/checkbox/Checkbox.component';
4
4
  export { Dropdown } from './components/dropdown/Dropdown.component';
5
5
  export { LOADER_SIZE, STATUS_CRITICAL, STATUS_WARNING, STATUS_SUCCESS, STATUS_HEALTHY, STATUS_INFO, STATUS_UNKNOWN, STATUS_NONE, } from './components/constants';
6
6
  export { Layout } from './components/layout/Layout.component';
7
+ export { Drawer } from './components/drawer/Drawer.component';
7
8
  export { Loader } from './components/loader/Loader.component';
8
9
  export { Modal } from './components/modal/Modal.component';
9
10
  export { Navbar } from './components/navbar/Navbar.component';
package/dist/next.d.ts CHANGED
@@ -11,6 +11,7 @@ export { CoreUiThemeProvider } from './components/coreuithemeprovider/CoreUiThem
11
11
  export { Box } from './components/box/Box';
12
12
  export { Input } from './components/inputv2/inputv2';
13
13
  export { Accordion } from './components/accordion/Accordion.component';
14
+ export { Drawer } from './components/drawer/Drawer.component';
14
15
  export { Editor } from './components/editor';
15
16
  export type { EditorProps } from './components/editor';
16
17
  export { Barchart, BarchartTooltip, LineTimeSerieChart, GlobalHealthBar, Sparkline, ChartLegend, ChartLegendWrapper, useChartId, useChartLegend, ChartTooltipContainer, ChartTooltipItem, ChartTooltipHeader, ChartTooltipItemsContainer, } from './components/charts';
@@ -1 +1 @@
1
- {"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../src/lib/next.ts"],"names":[],"mappings":"AAAA,OAAO,2CAA2C,CAAC;AACnD,OAAO,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAG/D,OAAO,EACL,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,wDAAwD,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAC3F,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO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O,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,EACL,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,SAAS,EACT,WAAW,EACX,kBAAkB,EAClB,UAAU,EACV,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACV,aAAa,EACb,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,KAAK,EACL,iBAAiB,EACjB,KAAK,EACL,SAAS,EACT,QAAQ,EACR,YAAY,GACb,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
package/dist/next.js CHANGED
@@ -12,6 +12,7 @@ export { CoreUiThemeProvider } from './components/coreuithemeprovider/CoreUiThem
12
12
  export { Box } from './components/box/Box';
13
13
  export { Input } from './components/inputv2/inputv2';
14
14
  export { Accordion } from './components/accordion/Accordion.component';
15
+ export { Drawer } from './components/drawer/Drawer.component';
15
16
  export { Editor } from './components/editor';
16
17
  // Export all chart components from the consolidated charts folder
17
18
  export { Barchart, BarchartTooltip, LineTimeSerieChart, GlobalHealthBar, Sparkline, ChartLegend, ChartLegendWrapper, useChartId, useChartLegend, ChartTooltipContainer, ChartTooltipItem, ChartTooltipHeader, ChartTooltipItemsContainer, } from './components/charts';
@@ -166,6 +166,7 @@ export declare const zIndex: {
166
166
  tooltip: number;
167
167
  notification: number;
168
168
  modal: number;
169
+ drawer: number;
169
170
  overlay: number;
170
171
  dropdown: number;
171
172
  nav: number;
@@ -1 +1 @@
1
- {"version":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EF,eAAO,MAAM,OAAO;;;;;;;;CAQnB,CAAC;AACF,eAAO,MAAM,MAAM;;;;;;;;;;;CAWlB,CAAC;AAEF,eAAO,MAAM,YAAY,SAAS,CAAC;AACnC,eAAO,MAAM,eAAe,aAAa,CAAC;AAE1C,eAAO,MAAM,iBAAiB,QAAe,CAAC;AAC9C,eAAO,MAAM,YAAY,QAAe,CAAC;AAGzC,eAAO,MAAM,wBAAwB,UAyBpC,CAAC"}
@@ -267,6 +267,7 @@ export const zIndex = {
267
267
  tooltip: 9990,
268
268
  notification: 9000,
269
269
  modal: 8500,
270
+ drawer: 8200,
270
271
  overlay: 8000,
271
272
  dropdown: 7000,
272
273
  nav: 500,
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/lib/utils.ts"],"names":[],"mappings":"AAYA;mCACmC;AACnC,eAAO,MAAM,oBAAoB,GAAI,QAAG,MAAM,UAAK,QAGlD,CAAC;AAEF;mCACmC;AACnC,eAAO,MAAM,uBAAuB,SAAU,UAAK,QAIlD,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,KAAG,MACjB,CAAC;AAErC,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,KAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAc5D,CAAC;AAmBF,eAAO,MAAM,eAAe,GAC1B,SAAS,MAAM,EACf,aAAa,MAAM,EACnB,aAAa,MAAM,KAClB,MAAM,GAAG,IASX,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,KAAG,MAahD,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,MAAM,EACb,UAAS,sBAA2B,KACnC,MAoBF,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/lib/utils.ts"],"names":[],"mappings":"AAcA;mCACmC;AACnC,eAAO,MAAM,oBAAoB,GAAI,QAAG,MAAM,UAAK,QAGlD,CAAC;AAEF;mCACmC;AACnC,eAAO,MAAM,uBAAuB,SAAU,UAAK,QAIlD,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,KAAG,MACjB,CAAC;AAErC,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,KAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAc5D,CAAC;AASF,eAAO,MAAM,eAAe,GAC1B,SAAS,MAAM,EACf,aAAa,MAAM,EACnB,aAAa,MAAM,KAClB,MAAM,GAAG,IAeX,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,KAAG,MAahD,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,MAAM,EACb,UAAS,sBAA2B,KACnC,MAoBF,CAAC"}
package/dist/utils.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { getLuminance } from 'polished';
1
2
  const RGB_HEX = /^#?(?:([\da-f]{3})[\da-f]?|([\da-f]{6})(?:[\da-f]{2})?)$/i;
2
3
  /** Ensure the consistency of colors between old and new colors */
3
4
  const variantMapping = {
@@ -37,25 +38,19 @@ export const hex2RGB = (str) => {
37
38
  }
38
39
  throw new Error('Invalid hex string provided');
39
40
  };
40
- // WCAG 2.0 relative luminance
41
- const relativeLuminance = (r, g, b) => {
42
- const [rs, gs, bs] = [r, g, b].map((c) => {
43
- const s = c / 255;
44
- return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
45
- });
46
- return 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
47
- };
48
41
  const wcagContrastRatio = (l1, l2) => (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
49
- const luminanceOf = (hex) => {
50
- const [r, g, b] = hex2RGB(hex);
51
- return relativeLuminance(r, g, b);
52
- };
42
+ // Minimum WCAG contrast ratio to consider a text color readable on a background.
43
+ // 3.0 corresponds to WCAG AA for large text — same threshold used by MUI.
44
+ const CONTRAST_THRESHOLD = 3;
53
45
  export const getContrastText = (bgColor, textPrimary, textReverse) => {
54
46
  try {
55
- const bgLum = luminanceOf(bgColor);
56
- const primaryContrast = wcagContrastRatio(luminanceOf(textPrimary), bgLum);
57
- const reverseContrast = wcagContrastRatio(luminanceOf(textReverse), bgLum);
58
- return reverseContrast > primaryContrast ? textReverse : textPrimary;
47
+ const bgLum = getLuminance(bgColor);
48
+ const primaryLum = getLuminance(textPrimary);
49
+ const reverseLum = getLuminance(textReverse);
50
+ const lighterText = primaryLum >= reverseLum ? textPrimary : textReverse;
51
+ const darkerText = primaryLum >= reverseLum ? textReverse : textPrimary;
52
+ const lighterContrast = wcagContrastRatio(primaryLum >= reverseLum ? primaryLum : reverseLum, bgLum);
53
+ return lighterContrast >= CONTRAST_THRESHOLD ? lighterText : darkerText;
59
54
  }
60
55
  catch {
61
56
  return null;
package/global-setup.js CHANGED
@@ -1,3 +1,3 @@
1
- module.exports = async () => {
1
+ export default async () => {
2
2
  process.env.TZ = 'UTC';
3
3
  };
package/jest.config.js CHANGED
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ export default {
2
2
  clearMocks: true,
3
3
  globalSetup: './global-setup.js',
4
4
  setupFilesAfterEnv: ['./setupTests.js'],
package/package.json CHANGED
@@ -1,12 +1,21 @@
1
1
  {
2
2
  "name": "@scality/core-ui",
3
- "version": "0.202.0",
3
+ "version": "0.204.0",
4
4
  "description": "Scality common React component library",
5
5
  "author": "Scality Engineering",
6
6
  "license": "SEE LICENSE IN LICENSE",
7
7
  "main": "dist/index.js",
8
+ "type": "module",
8
9
  "types": "dist/index.d.ts",
9
10
  "mainSrc": "src/lib/index.js",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.js",
14
+ "require": "./dist/index.js",
15
+ "types": "./dist/index.d.ts"
16
+ },
17
+ "./eslint-plugin": "./src/lib/valalint/index.js"
18
+ },
10
19
  "sideEffects": false,
11
20
  "peerDependencies": {
12
21
  "react": "^18.0.0 || ^19.0.0",
@@ -62,8 +71,8 @@
62
71
  "@types/styled-components": "^5.1.25",
63
72
  "@types/styled-system": "^5.1.15",
64
73
  "@types/uuid": "^10.0.0",
65
- "@typescript-eslint/eslint-plugin": "^6.12.0",
66
- "@typescript-eslint/parser": "^6.12.0",
74
+ "@typescript-eslint/eslint-plugin": "^8.56.1",
75
+ "@typescript-eslint/rule-tester": "^8.57.0",
67
76
  "copyfiles": "^2.4.1",
68
77
  "eslint": "^8.15.0",
69
78
  "eslint-config-react-app": "^7.0.1",
@@ -98,6 +107,7 @@
98
107
  "@js-temporal/polyfill": "^0.4.4",
99
108
  "@lezer/highlight": "^1.2.3",
100
109
  "@storybook/preview-api": "^8.3.6",
110
+ "@typescript-eslint/parser": "^8.56.1",
101
111
  "@uiw/react-codemirror": "^4.25.5",
102
112
  "codemirror-json-schema": "^0.8.1",
103
113
  "downshift": "^7.0.5",
@@ -0,0 +1,108 @@
1
+ import '@testing-library/jest-dom';
2
+ import { render, screen } from '@testing-library/react';
3
+ import userEvent from '@testing-library/user-event';
4
+ import React from 'react';
5
+ import { getWrapper } from '../../testUtils';
6
+ import { Drawer } from './Drawer.component';
7
+
8
+ describe('Drawer', () => {
9
+ const { Wrapper } = getWrapper();
10
+
11
+ it('should not be visible when closed', () => {
12
+ render(
13
+ <Wrapper>
14
+ <Drawer isOpen={false} close={jest.fn()} title="Test">
15
+ <p>Content</p>
16
+ </Drawer>
17
+ </Wrapper>,
18
+ );
19
+ expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
20
+ });
21
+
22
+ it('should display title and content when open', () => {
23
+ render(
24
+ <Wrapper>
25
+ <Drawer isOpen={true} close={jest.fn()} title="My Drawer">
26
+ <p>Some content</p>
27
+ </Drawer>
28
+ </Wrapper>,
29
+ );
30
+ expect(screen.getByText('My Drawer')).toBeVisible();
31
+ expect(screen.getByText('Some content')).toBeVisible();
32
+ });
33
+
34
+ it('should display footer when provided', () => {
35
+ render(
36
+ <Wrapper>
37
+ <Drawer
38
+ isOpen={true}
39
+ close={jest.fn()}
40
+ title="Test"
41
+ footer={<button type="button">Save</button>}
42
+ >
43
+ <p>Content</p>
44
+ </Drawer>
45
+ </Wrapper>,
46
+ );
47
+ expect(screen.getByRole('button', { name: 'Save' })).toBeVisible();
48
+ });
49
+
50
+ it('should close when clicking the close button', async () => {
51
+ const closeFn = jest.fn();
52
+ render(
53
+ <Wrapper>
54
+ <Drawer isOpen={true} close={closeFn} title="Test">
55
+ <p>Content</p>
56
+ </Drawer>
57
+ </Wrapper>,
58
+ );
59
+ await userEvent.click(screen.getByRole('button', { name: /close/i }));
60
+ expect(closeFn).toHaveBeenCalledTimes(1);
61
+ });
62
+
63
+ it('should close when pressing Escape', async () => {
64
+ const closeFn = jest.fn();
65
+ render(
66
+ <Wrapper>
67
+ <Drawer isOpen={true} close={closeFn} title="Test">
68
+ <p>Content</p>
69
+ </Drawer>
70
+ </Wrapper>,
71
+ );
72
+ await userEvent.keyboard('{Escape}');
73
+ expect(closeFn).toHaveBeenCalledTimes(1);
74
+ });
75
+
76
+ it('should close when clicking outside the drawer', async () => {
77
+ const closeFn = jest.fn();
78
+ render(
79
+ <Wrapper>
80
+ <Drawer isOpen={true} close={closeFn} title="Test" overlay={true}>
81
+ <p>Content</p>
82
+ </Drawer>
83
+ </Wrapper>,
84
+ );
85
+ const dialog = screen.getByRole('dialog');
86
+ const backdrop = dialog.previousElementSibling as HTMLElement;
87
+ await userEvent.click(backdrop);
88
+ expect(closeFn).toHaveBeenCalledTimes(1);
89
+ });
90
+
91
+ it('should hide close button when showCloseButton is false', () => {
92
+ render(
93
+ <Wrapper>
94
+ <Drawer
95
+ isOpen={true}
96
+ close={jest.fn()}
97
+ title="Test"
98
+ showCloseButton={false}
99
+ >
100
+ <p>Content</p>
101
+ </Drawer>
102
+ </Wrapper>,
103
+ );
104
+ expect(
105
+ screen.queryByRole('button', { name: /close/i }),
106
+ ).not.toBeInTheDocument();
107
+ });
108
+ });