@cloudwick/astral-ui 8.3.0 → 8.5.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 (59) hide show
  1. package/README.md +2 -2
  2. package/dist/components/adpIcon/adpIcon.d.ts +7 -2
  3. package/dist/components/button/button.d.ts +9 -7
  4. package/dist/components/card/card.d.ts +5 -0
  5. package/dist/components/card/cardVariants.d.ts +3 -0
  6. package/dist/components/dataTable/dataTable.d.ts +1 -137
  7. package/dist/components/dataTable/deriveConfiguredColumns.d.ts +7 -0
  8. package/dist/components/dataTable/index.d.ts +2 -2
  9. package/dist/components/dataTable/types.d.ts +135 -2
  10. package/dist/components/emptyState/emptyStateContent.d.ts +6 -0
  11. package/dist/components/modal/index.d.ts +1 -1
  12. package/dist/components/modal/modal.d.ts +29 -6
  13. package/dist/components/modal/modalContext.d.ts +22 -0
  14. package/dist/components/modal/modalTitle.d.ts +21 -0
  15. package/dist/components/modal/modalVariants.d.ts +18 -3
  16. package/dist/components/multiSelectTransfer/multiSelectTransferDropdown.d.ts +8 -6
  17. package/dist/components/multiSelectTransfer/multiSelectTransferModal.d.ts +4 -1
  18. package/dist/components/multiSelectTransfer/multiSelectTransferOptionRow.d.ts +5 -4
  19. package/dist/components/multiSelectTransfer/multiSelectTransferVariants.d.ts +18 -0
  20. package/dist/components/multiSelectTransfer/types.d.ts +16 -0
  21. package/dist/components/multiSelectTransfer/useMultiSelectTransferDropdownDraft.d.ts +34 -0
  22. package/dist/components/panel/panelContext.d.ts +7 -0
  23. package/dist/components/scrollbar/index.d.ts +2 -1
  24. package/dist/components/scrollbar/scrollbar.d.ts +1 -51
  25. package/dist/components/scrollbar/types.d.ts +52 -0
  26. package/dist/components/scrollbar/utils.d.ts +28 -0
  27. package/dist/components/select/selectComponents.d.ts +2 -3
  28. package/dist/components/select/selectKeyboard.d.ts +1 -1
  29. package/dist/components/select/types.d.ts +48 -9
  30. package/dist/components/select/useSelectComponents.d.ts +18 -0
  31. package/dist/components/select/useSelectDraft.d.ts +53 -0
  32. package/dist/components/select/useSelectOptionPool.d.ts +27 -0
  33. package/dist/components/select/utils.d.ts +9 -1
  34. package/dist/components/textField/textField.d.ts +5 -7
  35. package/dist/components/toggle/toggle.d.ts +1 -1
  36. package/dist/components/tooltip/tooltip.d.ts +8 -0
  37. package/dist/components/transferList/transferListItem.d.ts +6 -1
  38. package/dist/components/transferList/transferListPanel.d.ts +2 -58
  39. package/dist/components/transferList/types.d.ts +76 -1
  40. package/dist/components/transferList/useTransferList.d.ts +14 -5
  41. package/dist/components/transferList/useTransferListLimit.d.ts +24 -0
  42. package/dist/components/transferList/useTransferListPanelKeys.d.ts +7 -1
  43. package/dist/css/index.min.css +1 -1
  44. package/dist/hooks/index.d.ts +4 -0
  45. package/dist/hooks/useDeprecationWarning.d.ts +4 -0
  46. package/dist/hooks/useLiveAnnouncement.d.ts +13 -0
  47. package/dist/hooks/usePartRegistration.d.ts +10 -0
  48. package/dist/hooks/useSelectionLimit.d.ts +37 -0
  49. package/dist/index.cjs.js +4 -4
  50. package/dist/index.d.ts +1 -0
  51. package/dist/index.esm.js +5 -5
  52. package/dist/utils/devWarn.d.ts +8 -2
  53. package/dist/utils/elementUtils.d.ts +9 -0
  54. package/dist/utils/index.d.ts +1 -0
  55. package/dist/utils/optionText.d.ts +10 -0
  56. package/dist/utils/stringUtils/index.d.ts +2 -0
  57. package/dist/utils/stringUtils/optionToggled.d.ts +12 -0
  58. package/dist/utils/stringUtils/selectionLimitReached.d.ts +8 -0
  59. package/package.json +4 -3
@@ -1,5 +1,11 @@
1
1
  /**
2
- * Dev-only warning shim. The `typeof process` guard keeps unbundled ESM consumers safe — the Rollup
3
- * build has no `@rollup/plugin-replace`, so `process.env.NODE_ENV` is not substituted at build time.
2
+ * Whether `process.env.NODE_ENV` is anything other than `"production"`.
3
+ *
4
+ * The published build leaves `process.env.NODE_ENV` in place for the consumer's bundler to
5
+ * replace; bundlers substitute the whole expression and leave `process` itself undefined in the
6
+ * browser, so the expression is read directly rather than behind a `typeof process` check.
7
+ * Unbundled, reading it throws a `ReferenceError`, which is treated as production.
4
8
  */
9
+ export declare function isDevEnvironment(): boolean;
10
+ /** Logs `message` with `console.warn` unless `process.env.NODE_ENV` is `"production"`. */
5
11
  export declare function devWarn(message: string): void;
@@ -16,3 +16,12 @@ import React from "react";
16
16
  * and ref to it.
17
17
  */
18
18
  export declare const isSemanticTrigger: (ctaContent: React.ReactNode) => boolean;
19
+ /**
20
+ * Whether an element contains anything a screen reader reads from its content. Text counts unless it
21
+ * sits in an `aria-hidden` subtree or an SVG (such as an icon's `<title>`). With `countNamedElements`,
22
+ * a descendant with a role or a native control that is named by `aria-label`/`aria-labelledby`, or an
23
+ * `img` with `alt`, also counts.
24
+ */
25
+ export declare const hasExposedText: (element: Element, { countNamedElements }?: {
26
+ countNamedElements?: boolean | undefined;
27
+ }) => boolean;
@@ -10,3 +10,4 @@ export * from "./resolveLoadErrors";
10
10
  export * from "./resolveReloadControls";
11
11
  export * from "./fieldHelperText";
12
12
  export * from "./truncatedLabelReveal";
13
+ export * from "./optionText";
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from "react";
2
+ /**
3
+ * The plain text an option is known by when its label has to be spoken or shown as text (a tooltip,
4
+ * an announcement): a string `label`, else `searchValue`, else the stringified `value`.
5
+ */
6
+ export declare function getOptionText(option: {
7
+ label: ReactNode;
8
+ value: unknown;
9
+ searchValue?: string;
10
+ }): string;
@@ -3,3 +3,5 @@ export { readableFileSize } from "./fileSize";
3
3
  export { isRegexSafe } from "./isRegexSafe";
4
4
  export { joinIds } from "./joinIds";
5
5
  export { formatResultsAvailable } from "./resultsAvailable";
6
+ export { formatSelectionLimitReached } from "./selectionLimitReached";
7
+ export { formatOptionToggled } from "./optionToggled";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The status-region text for an option the user just ticked or unticked. Spoken because a toggle leaves
3
+ * focus where it was, and screen readers do not reliably announce an `aria-selected` change on the
4
+ * option `aria-activedescendant` points at.
5
+ * @param label - the option's plain text
6
+ * @param selected - whether the option is now selected
7
+ * @returns {string} - the announcement
8
+ * @example
9
+ * formatOptionToggled("Apple", true) // returns "Apple, selected"
10
+ * formatOptionToggled("Apple", false) // returns "Apple, not selected"
11
+ */
12
+ export declare function formatOptionToggled(label: string, selected: boolean): string;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The status-region text a multi-selection control announces once its selection limit is reached.
3
+ * @param max - the most options that may be selected
4
+ * @returns {string} - the announcement
5
+ * @example
6
+ * formatSelectionLimitReached(3) // returns "Selection limit of 3 reached"
7
+ */
8
+ export declare function formatSelectionLimitReached(max: number): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudwick/astral-ui",
3
- "version": "8.3.0",
3
+ "version": "8.5.0",
4
4
  "description": "UI Library for Cloudwick",
5
5
  "homepage": "https://www.astral-ui.amorphic.link/",
6
6
  "main": "./dist/index.cjs.js",
@@ -19,14 +19,15 @@
19
19
  "relink": "yarn build && yarn link",
20
20
  "storybook": "cross-env NODE_ENV=development storybook dev -p 6006",
21
21
  "build-storybook": "storybook build",
22
- "lint:js": "eslint \"src/**\"",
22
+ "lint:js": "eslint \"src/**\" \"scripts/*.{ts,js}\"",
23
23
  "lint:style": "stylelint \"src/**/*.{css,scss}\"",
24
24
  "lint": "yarn lint:js && yarn lint:style",
25
25
  "fix-lint": "eslint \"src/**\" --fix",
26
26
  "test": "BABEL_ENV=test jest src --passWithNoTests",
27
27
  "test-file": "BABEL_ENV=test jest --passWithNoTests",
28
28
  "build-scripts": "tsc -p scripts/tsconfig.json",
29
- "update-registry": "yarn build-scripts && node scripts/dist/generate-registry.js"
29
+ "update-registry": "yarn build-scripts && node scripts/dist/generate-registry.js",
30
+ "prepublishOnly": "yarn build"
30
31
  },
31
32
  "devDependencies": {
32
33
  "@babel/core": "^7.26.0",