@ssa-ui-kit/core 3.19.1 → 3.20.1

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 (86) hide show
  1. package/dist/components/AccordionGroup/Accordion.d.ts +3 -3
  2. package/dist/components/AccordionGroup/AccordionContent.d.ts +3 -3
  3. package/dist/components/AccordionGroup/AccordionGroup.d.ts +1 -1
  4. package/dist/components/AccordionGroup/AccordionTitle.d.ts +3 -3
  5. package/dist/components/AccordionGroup/types.d.ts +55 -5
  6. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  7. package/dist/components/Breadcrumbs/types.d.ts +11 -1
  8. package/dist/components/Button/Button.d.ts +6 -0
  9. package/dist/components/Button/fixtures.d.ts +11 -6
  10. package/dist/components/Button/styles.d.ts +10 -0
  11. package/dist/components/Button/types.d.ts +14 -0
  12. package/dist/components/ButtonGroup/ButtonGroup.d.ts +28 -1
  13. package/dist/components/ButtonGroup/ButtonGroupButton.d.ts +22 -0
  14. package/dist/components/ButtonGroup/ButtonGroupButtonBase.d.ts +23 -0
  15. package/dist/components/ButtonGroup/ButtonGroupContext.d.ts +9 -0
  16. package/dist/components/ButtonGroup/index.d.ts +2 -0
  17. package/dist/components/ButtonGroup/types.d.ts +92 -4
  18. package/dist/components/CardContent/CardContent.d.ts +9 -1
  19. package/dist/components/Checkbox/Checkbox.d.ts +1 -1
  20. package/dist/components/Checkbox/types.d.ts +29 -5
  21. package/dist/components/ColorPicker/ColorPicker.d.ts +1 -1
  22. package/dist/components/ColorPicker/types.d.ts +19 -5
  23. package/dist/components/Counter/Counter.d.ts +1 -1
  24. package/dist/components/Counter/types.d.ts +0 -5
  25. package/dist/components/Drawer/useDrawer.d.ts +27 -3
  26. package/dist/components/Dropdown/Dropdown.d.ts +1 -1
  27. package/dist/components/Dropdown/types.d.ts +4 -0
  28. package/dist/components/DropdownOption/DropdownOption.d.ts +17 -6
  29. package/dist/components/DropdownOptions/DropdownOptions.d.ts +1 -1
  30. package/dist/components/DropdownOptions/types.d.ts +8 -0
  31. package/dist/components/DropdownToggle/DropdownToggle.d.ts +2 -2
  32. package/dist/components/DropdownToggle/types.d.ts +24 -2
  33. package/dist/components/FileAttachment/FileAttachment.d.ts +1 -1
  34. package/dist/components/FileAttachment/types.d.ts +5 -0
  35. package/dist/components/FiltersMultiSelect/index.d.ts +1 -1
  36. package/dist/components/FiltersMultiSelect/useFiltersMultiSelect.d.ts +35 -3
  37. package/dist/components/IconButton/IconButton.d.ts +8 -1
  38. package/dist/components/IconButton/styles.d.ts +5 -1
  39. package/dist/components/IconButton/types.d.ts +20 -2
  40. package/dist/components/JsonSchemaForm/utils/selectWidget.d.ts +7 -1
  41. package/dist/components/Label/Label.d.ts +1 -1
  42. package/dist/components/Label/types.d.ts +5 -0
  43. package/dist/components/LargeTab/LargeTab.d.ts +1 -1
  44. package/dist/components/Link/Link.d.ts +24 -1
  45. package/dist/components/Link/Link.types.d.ts +14 -1
  46. package/dist/components/Link/index.d.ts +1 -0
  47. package/dist/components/Modal/Modal.d.ts +13 -5
  48. package/dist/components/Modal/types.d.ts +32 -4
  49. package/dist/components/ModalDialog/ModalDialog.d.ts +2 -2
  50. package/dist/components/ModalDialog/types.d.ts +10 -3
  51. package/dist/components/MultipleDropdown/types.d.ts +7 -0
  52. package/dist/components/MultipleDropdownOptions/MultipleDropdownOptions.d.ts +1 -1
  53. package/dist/components/MultipleDropdownOptions/types.d.ts +12 -0
  54. package/dist/components/Pagination/ArrowButton.d.ts +2 -2
  55. package/dist/components/Pagination/Pagination.d.ts +2 -2
  56. package/dist/components/Pagination/PaginationButtons.d.ts +2 -2
  57. package/dist/components/Pagination/types.d.ts +36 -0
  58. package/dist/components/Popover/types.d.ts +7 -0
  59. package/dist/components/ProgressBar/types.d.ts +18 -0
  60. package/dist/components/ProgressCircle/ProgressCircle.d.ts +1 -1
  61. package/dist/components/ProgressCircle/types.d.ts +10 -0
  62. package/dist/components/Radio/Radio.d.ts +1 -1
  63. package/dist/components/Radio/types.d.ts +13 -0
  64. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  65. package/dist/components/RadioGroup/types.d.ts +18 -1
  66. package/dist/components/Switch/Switch.d.ts +2 -2
  67. package/dist/components/Switch/types.d.ts +7 -0
  68. package/dist/components/Tab/Tab.d.ts +1 -1
  69. package/dist/components/TabBar/types.d.ts +8 -0
  70. package/dist/components/TableBody/TableBody.d.ts +1 -1
  71. package/dist/components/TableFilters/TableFiltersAccordionContent.d.ts +1 -1
  72. package/dist/components/TableFilters/types.d.ts +14 -0
  73. package/dist/components/TableRow/types.d.ts +8 -1
  74. package/dist/components/Tooltip/types.d.ts +21 -1
  75. package/dist/components/Typeahead/Typeahead.d.ts +2 -2
  76. package/dist/components/Typeahead/types.d.ts +26 -1
  77. package/dist/components/index.d.ts +1 -0
  78. package/dist/index.d.ts +1 -0
  79. package/dist/index.js +4274 -1628
  80. package/dist/index.mjs +61628 -0
  81. package/dist/test-utils/axe.d.ts +23 -0
  82. package/dist/tsbuildcache +1 -0
  83. package/dist/utils/deprecation.d.ts +135 -0
  84. package/dist/utils/detectDuplicateInstance.d.ts +27 -0
  85. package/dist/utils/environment.d.ts +27 -0
  86. package/package.json +10 -9
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Prop deprecation helpers.
3
+ *
4
+ * The library is converging on the DOM/MUI/Radix/Ant prop names (issue #656,
5
+ * Phase 2). Renames land as *additive aliases first*: the new prop is added,
6
+ * the old one keeps working, and a dev-only console warning points consumers at
7
+ * the replacement. The old prop is removed at the next major.
8
+ *
9
+ * Warnings are emitted at most once per component/prop pair per process so a
10
+ * component re-rendering in a list cannot flood the console.
11
+ */
12
+ /**
13
+ * Clears the once-per-pair warning cache.
14
+ *
15
+ * Only useful in tests, where several cases need to assert on the same warning.
16
+ *
17
+ * @internal
18
+ */
19
+ export declare const resetDeprecationWarnings: () => void;
20
+ /**
21
+ * Emits a deprecation notice for `component.deprecatedProp`, at most once.
22
+ *
23
+ * No-op in production builds.
24
+ */
25
+ export declare const warnDeprecatedProp: (component: string, deprecatedProp: string, replacementProp: string) => void;
26
+ export interface ResolveDeprecatedPropOptions<T> {
27
+ /** Component name, used in the warning message. */
28
+ component: string;
29
+ /** The supported prop name. */
30
+ prop: string;
31
+ /** Value of the supported prop. */
32
+ value: T | undefined;
33
+ /** The deprecated prop name. */
34
+ deprecatedProp: string;
35
+ /** Value of the deprecated prop. */
36
+ deprecatedValue: T | undefined;
37
+ }
38
+ /**
39
+ * Resolves a prop that is mid-rename: returns the new prop's value when it is
40
+ * defined, otherwise falls back to the deprecated one and warns in dev.
41
+ *
42
+ * Passing both is not an error — the new prop wins — but it still warns, since
43
+ * the deprecated prop was supplied.
44
+ */
45
+ export declare const resolveDeprecatedProp: <T>({ component, prop, value, deprecatedProp, deprecatedValue, }: ResolveDeprecatedPropOptions<T>) => T | undefined;
46
+ /**
47
+ * Shorthand for the camelCase-ARIA → native-ARIA renames (issue #656, chunk 3
48
+ * item 1).
49
+ *
50
+ * The library grew bespoke `ariaLabel` / `ariaLabelledby` / `ariaControls` props
51
+ * in parallel with components that simply accept the native attributes. The
52
+ * camelCase ones have to be forwarded by hand and are invisible to
53
+ * `eslint-plugin-jsx-a11y` and the axe gate, so native wins and the camelCase
54
+ * spelling becomes an alias.
55
+ *
56
+ * @example
57
+ * ```tsx
58
+ * const label = resolveAriaProp('Pagination', 'aria-label', ariaLabelNative, ariaLabel);
59
+ * ```
60
+ */
61
+ export declare const resolveAriaProp: (component: string, ariaProp: string, value: string | undefined, deprecatedValue: string | undefined) => string | undefined;
62
+ /**
63
+ * The open-state prop family, in the spellings the kit is converging on.
64
+ *
65
+ * @see resolveOpenState
66
+ */
67
+ export interface OpenStateProps {
68
+ open?: boolean;
69
+ defaultOpen?: boolean;
70
+ onOpenChange?: (open: boolean) => void;
71
+ }
72
+ /**
73
+ * The deprecated spellings the kit grew before {@link OpenStateProps}. Each
74
+ * component only ever used a subset; passing a key that a given component never
75
+ * had is harmless.
76
+ */
77
+ export interface DeprecatedOpenStateProps {
78
+ /** @deprecated Use `open`. */
79
+ opened?: boolean;
80
+ /** @deprecated Use `open`, or `defaultOpen` where it was never controlled. */
81
+ isOpen?: boolean;
82
+ /** @deprecated Use `open`, or `defaultOpen` where it was never controlled. */
83
+ isOpened?: boolean;
84
+ /** @deprecated Use `defaultOpen`. */
85
+ defaultOpened?: boolean;
86
+ /** @deprecated Use `defaultOpen`. */
87
+ initialOpen?: boolean;
88
+ /** @deprecated Use `onOpenChange`. */
89
+ onOpenedChange?: (open: boolean) => void;
90
+ }
91
+ export interface ResolvedOpenState {
92
+ open: boolean | undefined;
93
+ defaultOpen: boolean | undefined;
94
+ onOpenChange: ((open: boolean) => void) | undefined;
95
+ /** True when the *supported* or the *deprecated* controlled key was passed. */
96
+ isControlled: boolean;
97
+ }
98
+ /**
99
+ * Shorthand for the open-state renames (issue #656, chunk 3 item 2), which span
100
+ * `Drawer`, `Popover`, `Tooltip`, `Accordion`, `Modal`, `ModalDialog` and
101
+ * `FiltersMultiSelect` — six deprecated spellings between them.
102
+ *
103
+ * Resolves all three keys in one call and reports whether the component should
104
+ * consider itself controlled. Controlled-ness is keyed on the *presence* of a
105
+ * key rather than its value, for the reason `useControllableState` documents:
106
+ * `open={undefined}` has to keep meaning "controlled, currently closed".
107
+ *
108
+ * Pass the deprecated spellings this component actually had via
109
+ * `controlledAlias` / `defaultAlias` / `changeAlias` — anything omitted is not
110
+ * looked for, so a component cannot accidentally accept a spelling it never
111
+ * shipped.
112
+ *
113
+ * @example
114
+ * ```tsx
115
+ * const { open, defaultOpen, onOpenChange, isControlled } = resolveOpenState(
116
+ * 'Drawer',
117
+ * props,
118
+ * { controlledAlias: 'opened', defaultAlias: 'defaultOpened' },
119
+ * );
120
+ * ```
121
+ */
122
+ export declare const resolveOpenState: (component: string, props: OpenStateProps & DeprecatedOpenStateProps, aliases?: {
123
+ controlledAlias?: keyof DeprecatedOpenStateProps;
124
+ defaultAlias?: keyof DeprecatedOpenStateProps;
125
+ changeAlias?: keyof DeprecatedOpenStateProps;
126
+ }) => ResolvedOpenState;
127
+ /**
128
+ * Shorthand for the `isDisabled` → `disabled` rename, which spans 15 components.
129
+ *
130
+ * @example
131
+ * ```tsx
132
+ * const isControlDisabled = resolveDisabled('Button', disabled, isDisabled);
133
+ * ```
134
+ */
135
+ export declare const resolveDisabled: (component: string, disabled: boolean | undefined, isDisabled: boolean | undefined) => boolean | undefined;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Warns, in development, when more than one copy of `@ssa-ui-kit/core` is
3
+ * loaded into the same runtime.
4
+ *
5
+ * The package ships both a CommonJS and an ESM bundle (`exports.require` →
6
+ * `dist/index.js`, `exports.import` → `dist/index.mjs`). A dependency graph
7
+ * that reaches core *both* ways — a `require` from one dependency, an `import`
8
+ * from the app — loads both files, and each gets its own module scope. Every
9
+ * context the kit creates then exists twice: a `ThemeProvider` from one copy
10
+ * cannot be read by a `useTheme` from the other, a `PopoverTrigger` cannot find
11
+ * the `Popover` that wraps it, and so on.
12
+ *
13
+ * The symptoms are indirect and expensive to chase — "theme is undefined",
14
+ * "usePopoverContext must be used within a Popover" on markup that plainly is
15
+ * — so the point of this module is to name the cause once, up front. It is the
16
+ * same failure that made `useFormContext()` return null when core was
17
+ * CommonJS-only and Vite loaded react-hook-form as ESM; the fix shape is the
18
+ * same too, hence the `resolve.dedupe` hint.
19
+ *
20
+ * Fixing it means making the graph resolve to one copy: `resolve.dedupe` in
21
+ * Vite, `resolve.alias` in webpack, or removing the `npm link` / `file:` /
22
+ * workspace symlink that gave a linked package its own `node_modules`.
23
+ *
24
+ * No-op in production builds — the check costs a global read, but the message
25
+ * is only actionable to someone with the source in front of them.
26
+ */
27
+ export declare const detectDuplicateInstance: () => void;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Whether the kit's development-only diagnostics should run.
3
+ *
4
+ * Read at call time, not at module load, and deliberately *not* resolved when
5
+ * this package is bundled: `webpack.packages.base.js` sets
6
+ * `optimization.nodeEnv: false` so `process.env.NODE_ENV` survives into
7
+ * `dist/`, where the consumer's own bundler substitutes it for their build. A
8
+ * library that bakes in its own `mode` decides the question for everyone —
9
+ * which is how every deprecation warning in this package ended up compiling to
10
+ * `if (true) return;` in the published bundle, silently, while still firing in
11
+ * this repo's Jest runs.
12
+ *
13
+ * The expression must be a *bare* `process.env.NODE_ENV`, with nothing guarding
14
+ * it. Bundlers substitute that literal token sequence and nothing else: a
15
+ * `typeof process === 'undefined'` check in front of it is left untouched, so
16
+ * in a browser — where there is no `process` global — the guard returns `false`
17
+ * before the correctly-substituted value is ever reached, and every diagnostic
18
+ * goes dark for exactly the consumers they exist for. Same bug as the one
19
+ * above, entered from the other side.
20
+ *
21
+ * `try/catch` keeps the guarantee the guard was there for: a runtime that never
22
+ * defines `process` *and* whose bundler substituted nothing (a plain
23
+ * `<script type="module">`, a bare worker) throws a ReferenceError, which is
24
+ * caught here as silence rather than a crash. Erring toward silence is right —
25
+ * no diagnostic is worth crashing a consumer over.
26
+ */
27
+ export declare const isDevEnvironment: () => boolean;
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@ssa-ui-kit/core",
3
- "version": "3.19.1",
3
+ "version": "3.20.1",
4
4
  "main": "dist/index.js",
5
+ "module": "dist/index.mjs",
5
6
  "types": "dist/index.d.ts",
6
7
  "exports": {
7
8
  ".": {
8
9
  "types": "./dist/index.d.ts",
9
- "import": "./dist/index.js",
10
+ "import": "./dist/index.mjs",
10
11
  "require": "./dist/index.js",
11
12
  "default": "./dist/index.js"
12
13
  }
@@ -39,8 +40,8 @@
39
40
  "luxon": "3.5.0",
40
41
  "plotly.js": "3.0.0",
41
42
  "react-plotly.js": "2.6.0",
42
- "@ssa-ui-kit/hooks": "^3.19.1",
43
- "@ssa-ui-kit/utils": "^3.19.1"
43
+ "@ssa-ui-kit/hooks": "^3.20.1",
44
+ "@ssa-ui-kit/utils": "^3.20.1"
44
45
  },
45
46
  "devDependencies": {
46
47
  "@emotion/css": "11.13.5",
@@ -57,8 +58,7 @@
57
58
  "@rjsf/utils": "5.24.8",
58
59
  "@rjsf/validator-ajv8": "5.24.8",
59
60
  "@types/luxon": "3.4.2",
60
- "@types/react-plotly.js": "2.6.3",
61
- "@types/sass": "1.45.0"
61
+ "@types/react-plotly.js": "2.6.3"
62
62
  },
63
63
  "browserslist": [
64
64
  ">0.1%",
@@ -76,8 +76,8 @@
76
76
  "@nivo/treemap": "^0.99.0",
77
77
  "@rjsf/core": "^5.0.0",
78
78
  "@rjsf/utils": "^5.0.0",
79
- "react": "19.x",
80
- "react-dom": "19.x",
79
+ "react": ">=19",
80
+ "react-dom": ">=19",
81
81
  "react-hook-form": "^7.46.1",
82
82
  "react-router-dom": "6.x || 7.x"
83
83
  },
@@ -87,8 +87,9 @@
87
87
  }
88
88
  },
89
89
  "scripts": {
90
+ "clean": "node ../../scripts/clean.mjs",
90
91
  "test": "jest -i --no-cache",
91
- "build": "webpack --mode=production --node-env=production && tsc --build ./tsconfig.build.json && resolve-tspaths -p ./tsconfig.build.json",
92
+ "build": "node ../../scripts/clean.mjs && webpack --mode=production --node-env=production && tsc --build ./tsconfig.build.json && resolve-tspaths -p ./tsconfig.build.json",
92
93
  "build:watch": "webpack --mode=production --node-env=production --watch && tsc --build ./tsconfig.build.json && resolve-tspaths -p ./tsconfig.build.json",
93
94
  "sb:dev": "env storybook dev -p 6006",
94
95
  "sb:build": "env storybook build",