@flipdish/ui-library 0.31.3 → 0.31.5

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 (176) hide show
  1. package/dist/components/molecules/CodeSnippet/index.cjs.map +1 -1
  2. package/dist/components/molecules/CodeSnippet/index.d.ts.map +1 -1
  3. package/dist/components/molecules/CodeSnippet/index.js.map +1 -1
  4. package/dist/components/molecules/Pagination/index.cjs.map +1 -1
  5. package/dist/components/molecules/Pagination/index.d.ts.map +1 -1
  6. package/dist/components/molecules/Pagination/index.js.map +1 -1
  7. package/dist/components/organisms/ApplicationHeader/index.cjs +4 -5
  8. package/dist/components/organisms/ApplicationHeader/index.cjs.map +1 -1
  9. package/dist/components/organisms/ApplicationHeader/index.d.ts +4 -5
  10. package/dist/components/organisms/ApplicationHeader/index.d.ts.map +1 -1
  11. package/dist/components/organisms/ApplicationHeader/index.js +4 -5
  12. package/dist/components/organisms/ApplicationHeader/index.js.map +1 -1
  13. package/dist/components/organisms/Charts/components/PieChart.cjs +2 -4
  14. package/dist/components/organisms/Charts/components/PieChart.cjs.map +1 -1
  15. package/dist/components/organisms/Charts/components/PieChart.d.ts +2 -4
  16. package/dist/components/organisms/Charts/components/PieChart.d.ts.map +1 -1
  17. package/dist/components/organisms/Charts/components/PieChart.js +2 -4
  18. package/dist/components/organisms/Charts/components/PieChart.js.map +1 -1
  19. package/dist/components/organisms/Charts/index.d.ts +0 -2
  20. package/dist/components/organisms/Charts/index.d.ts.map +1 -1
  21. package/dist/components/organisms/ColorPicker/index.cjs +3 -2
  22. package/dist/components/organisms/ColorPicker/index.cjs.map +1 -1
  23. package/dist/components/organisms/ColorPicker/index.d.ts +3 -2
  24. package/dist/components/organisms/ColorPicker/index.d.ts.map +1 -1
  25. package/dist/components/organisms/ColorPicker/index.js +3 -2
  26. package/dist/components/organisms/ColorPicker/index.js.map +1 -1
  27. package/dist/components/organisms/ImagePicker/index.cjs +3 -2
  28. package/dist/components/organisms/ImagePicker/index.cjs.map +1 -1
  29. package/dist/components/organisms/ImagePicker/index.d.ts +3 -2
  30. package/dist/components/organisms/ImagePicker/index.d.ts.map +1 -1
  31. package/dist/components/organisms/ImagePicker/index.js +3 -2
  32. package/dist/components/organisms/ImagePicker/index.js.map +1 -1
  33. package/dist/components/organisms/PageHeader/index.cjs +4 -6
  34. package/dist/components/organisms/PageHeader/index.cjs.map +1 -1
  35. package/dist/components/organisms/PageHeader/index.d.ts +4 -6
  36. package/dist/components/organisms/PageHeader/index.d.ts.map +1 -1
  37. package/dist/components/organisms/PageHeader/index.js +4 -6
  38. package/dist/components/organisms/PageHeader/index.js.map +1 -1
  39. package/dist/components/organisms/SidePanel/index.cjs +5 -7
  40. package/dist/components/organisms/SidePanel/index.cjs.map +1 -1
  41. package/dist/components/organisms/SidePanel/index.d.ts +5 -7
  42. package/dist/components/organisms/SidePanel/index.d.ts.map +1 -1
  43. package/dist/components/organisms/SidePanel/index.js +5 -7
  44. package/dist/components/organisms/SidePanel/index.js.map +1 -1
  45. package/dist/components/organisms/SidebarNavigation/components/SidebarMenuButton.cjs +7 -4
  46. package/dist/components/organisms/SidebarNavigation/components/SidebarMenuButton.cjs.map +1 -1
  47. package/dist/components/organisms/SidebarNavigation/components/SidebarMenuButton.d.ts +7 -4
  48. package/dist/components/organisms/SidebarNavigation/components/SidebarMenuButton.d.ts.map +1 -1
  49. package/dist/components/organisms/SidebarNavigation/components/SidebarMenuButton.js +7 -4
  50. package/dist/components/organisms/SidebarNavigation/components/SidebarMenuButton.js.map +1 -1
  51. package/dist/components/organisms/SidebarNavigation/index.cjs +4 -8
  52. package/dist/components/organisms/SidebarNavigation/index.cjs.map +1 -1
  53. package/dist/components/organisms/SidebarNavigation/index.d.ts +4 -8
  54. package/dist/components/organisms/SidebarNavigation/index.d.ts.map +1 -1
  55. package/dist/components/organisms/SidebarNavigation/index.js +4 -8
  56. package/dist/components/organisms/SidebarNavigation/index.js.map +1 -1
  57. package/dist/components/templates/AppShell/index.cjs +5 -7
  58. package/dist/components/templates/AppShell/index.cjs.map +1 -1
  59. package/dist/components/templates/AppShell/index.d.ts +5 -7
  60. package/dist/components/templates/AppShell/index.d.ts.map +1 -1
  61. package/dist/components/templates/AppShell/index.js +5 -7
  62. package/dist/components/templates/AppShell/index.js.map +1 -1
  63. package/dist/components/templates/NotFoundPage/index.cjs +3 -9
  64. package/dist/components/templates/NotFoundPage/index.cjs.map +1 -1
  65. package/dist/components/templates/NotFoundPage/index.d.ts +3 -9
  66. package/dist/components/templates/NotFoundPage/index.d.ts.map +1 -1
  67. package/dist/components/templates/NotFoundPage/index.js +3 -9
  68. package/dist/components/templates/NotFoundPage/index.js.map +1 -1
  69. package/dist/components/templates/PageLayout/index.cjs +5 -12
  70. package/dist/components/templates/PageLayout/index.cjs.map +1 -1
  71. package/dist/components/templates/PageLayout/index.d.ts +5 -12
  72. package/dist/components/templates/PageLayout/index.d.ts.map +1 -1
  73. package/dist/components/templates/PageLayout/index.js +5 -12
  74. package/dist/components/templates/PageLayout/index.js.map +1 -1
  75. package/dist/hooks/useBreakpoints/index.cjs +5 -5
  76. package/dist/hooks/useBreakpoints/index.d.ts +5 -5
  77. package/dist/hooks/useBreakpoints/index.js +5 -5
  78. package/dist/hooks/useClipboard/index.cjs +5 -2
  79. package/dist/hooks/useClipboard/index.cjs.map +1 -1
  80. package/dist/hooks/useClipboard/index.d.ts +5 -2
  81. package/dist/hooks/useClipboard/index.d.ts.map +1 -1
  82. package/dist/hooks/useClipboard/index.js +5 -2
  83. package/dist/hooks/useClipboard/index.js.map +1 -1
  84. package/dist/hooks/usePlatform/index.cjs +4 -5
  85. package/dist/hooks/usePlatform/index.cjs.map +1 -1
  86. package/dist/hooks/usePlatform/index.d.ts +4 -5
  87. package/dist/hooks/usePlatform/index.d.ts.map +1 -1
  88. package/dist/hooks/usePlatform/index.js +4 -5
  89. package/dist/hooks/usePlatform/index.js.map +1 -1
  90. package/dist/hooks/useResizeObserver/index.cjs +7 -2
  91. package/dist/hooks/useResizeObserver/index.cjs.map +1 -1
  92. package/dist/hooks/useResizeObserver/index.d.ts +7 -2
  93. package/dist/hooks/useResizeObserver/index.d.ts.map +1 -1
  94. package/dist/hooks/useResizeObserver/index.js +7 -2
  95. package/dist/hooks/useResizeObserver/index.js.map +1 -1
  96. package/dist/hooks/useSidePanel/index.cjs +7 -5
  97. package/dist/hooks/useSidePanel/index.cjs.map +1 -1
  98. package/dist/hooks/useSidePanel/index.d.ts +7 -5
  99. package/dist/hooks/useSidePanel/index.d.ts.map +1 -1
  100. package/dist/hooks/useSidePanel/index.js +7 -5
  101. package/dist/hooks/useSidePanel/index.js.map +1 -1
  102. package/dist/native/utilities/cx/index.d.ts +9 -9
  103. package/dist/native/utilities/cx/index.d.ts.map +1 -1
  104. package/dist/native/utilities/cx/index.js +9 -9
  105. package/dist/native/utilities/cx/index.js.map +1 -1
  106. package/dist/native/utilities/testIdUtils/index.d.ts +44 -10
  107. package/dist/native/utilities/testIdUtils/index.d.ts.map +1 -1
  108. package/dist/native/utilities/testIdUtils/index.js +44 -10
  109. package/dist/native/utilities/testIdUtils/index.js.map +1 -1
  110. package/dist/providers/ErrorBoundary/index.cjs +5 -7
  111. package/dist/providers/ErrorBoundary/index.cjs.map +1 -1
  112. package/dist/providers/ErrorBoundary/index.d.ts +4 -7
  113. package/dist/providers/ErrorBoundary/index.d.ts.map +1 -1
  114. package/dist/providers/ErrorBoundary/index.js +5 -7
  115. package/dist/providers/ErrorBoundary/index.js.map +1 -1
  116. package/dist/providers/RouteProvider/index.cjs +5 -1
  117. package/dist/providers/RouteProvider/index.cjs.map +1 -1
  118. package/dist/providers/RouteProvider/index.d.ts +5 -1
  119. package/dist/providers/RouteProvider/index.d.ts.map +1 -1
  120. package/dist/providers/RouteProvider/index.js +5 -1
  121. package/dist/providers/RouteProvider/index.js.map +1 -1
  122. package/dist/providers/ThemeProvider/index.cjs +11 -1
  123. package/dist/providers/ThemeProvider/index.cjs.map +1 -1
  124. package/dist/providers/ThemeProvider/index.d.ts +11 -1
  125. package/dist/providers/ThemeProvider/index.d.ts.map +1 -1
  126. package/dist/providers/ThemeProvider/index.js +11 -1
  127. package/dist/providers/ThemeProvider/index.js.map +1 -1
  128. package/dist/providers/UIProvider/index.cjs +5 -1
  129. package/dist/providers/UIProvider/index.cjs.map +1 -1
  130. package/dist/providers/UIProvider/index.d.ts +5 -1
  131. package/dist/providers/UIProvider/index.d.ts.map +1 -1
  132. package/dist/providers/UIProvider/index.js +5 -1
  133. package/dist/providers/UIProvider/index.js.map +1 -1
  134. package/dist/utilities/cssScopeUtils/index.cjs +6 -5
  135. package/dist/utilities/cssScopeUtils/index.cjs.map +1 -1
  136. package/dist/utilities/cssScopeUtils/index.d.ts +6 -5
  137. package/dist/utilities/cssScopeUtils/index.d.ts.map +1 -1
  138. package/dist/utilities/cssScopeUtils/index.js +6 -5
  139. package/dist/utilities/cssScopeUtils/index.js.map +1 -1
  140. package/dist/utilities/cx/index.cjs +9 -9
  141. package/dist/utilities/cx/index.cjs.map +1 -1
  142. package/dist/utilities/cx/index.d.ts +9 -9
  143. package/dist/utilities/cx/index.d.ts.map +1 -1
  144. package/dist/utilities/cx/index.js +9 -9
  145. package/dist/utilities/cx/index.js.map +1 -1
  146. package/dist/utilities/hrefUtils/index.cjs +10 -11
  147. package/dist/utilities/hrefUtils/index.cjs.map +1 -1
  148. package/dist/utilities/hrefUtils/index.d.ts +10 -11
  149. package/dist/utilities/hrefUtils/index.d.ts.map +1 -1
  150. package/dist/utilities/hrefUtils/index.js +10 -11
  151. package/dist/utilities/hrefUtils/index.js.map +1 -1
  152. package/dist/utilities/localStorageUtils/index.cjs +8 -5
  153. package/dist/utilities/localStorageUtils/index.cjs.map +1 -1
  154. package/dist/utilities/localStorageUtils/index.d.ts +8 -5
  155. package/dist/utilities/localStorageUtils/index.d.ts.map +1 -1
  156. package/dist/utilities/localStorageUtils/index.js +8 -5
  157. package/dist/utilities/localStorageUtils/index.js.map +1 -1
  158. package/dist/utilities/renderUtils/index.cjs +31 -30
  159. package/dist/utilities/renderUtils/index.cjs.map +1 -1
  160. package/dist/utilities/renderUtils/index.d.ts +31 -30
  161. package/dist/utilities/renderUtils/index.d.ts.map +1 -1
  162. package/dist/utilities/renderUtils/index.js +31 -30
  163. package/dist/utilities/renderUtils/index.js.map +1 -1
  164. package/dist/utilities/sessionStorageUtils/index.cjs +8 -5
  165. package/dist/utilities/sessionStorageUtils/index.cjs.map +1 -1
  166. package/dist/utilities/sessionStorageUtils/index.d.ts +8 -5
  167. package/dist/utilities/sessionStorageUtils/index.d.ts.map +1 -1
  168. package/dist/utilities/sessionStorageUtils/index.js +8 -5
  169. package/dist/utilities/sessionStorageUtils/index.js.map +1 -1
  170. package/dist/utilities/testIdUtils/index.cjs +44 -10
  171. package/dist/utilities/testIdUtils/index.cjs.map +1 -1
  172. package/dist/utilities/testIdUtils/index.d.ts +44 -10
  173. package/dist/utilities/testIdUtils/index.d.ts.map +1 -1
  174. package/dist/utilities/testIdUtils/index.js +44 -10
  175. package/dist/utilities/testIdUtils/index.js.map +1 -1
  176. package/package.json +1 -1
@@ -18,19 +18,45 @@
18
18
  export declare const TEST_ID_PREFIX = "fd";
19
19
  /** Separator placed between hierarchy levels (within a segment, use single `-`). */
20
20
  export declare const TEST_ID_SEPARATOR = "--";
21
- /** Convert an arbitrary string into a kebab-case, testid-safe segment. */
21
+ /**
22
+ * Converts an arbitrary string into a kebab-case, testid-safe segment.
23
+ *
24
+ * @param value A label or id, in any case or punctuation.
25
+ * @returns Lower-case text with runs of non-alphanumerics collapsed to single hyphens.
26
+ */
22
27
  export declare const slugifyTestId: (value: string) => string;
23
- /** Build a root-level testid, e.g. `rootTestId('sidebar-navigation')` -> `fd-sidebar-navigation`. */
28
+ /**
29
+ * Builds a root-level testid, e.g. `rootTestId('sidebar-navigation')` ->
30
+ * `fd-sidebar-navigation`.
31
+ *
32
+ * @param kebabName The component's kebab-case name.
33
+ * @returns The name prefixed with `fd-`.
34
+ */
24
35
  export declare const rootTestId: (kebabName: string) => string;
25
- /** Append a child segment to a parent testid, e.g. `joinTestId('fd-x', 'nav-item-orders')` -> `fd-x--nav-item-orders`. */
36
+ /**
37
+ * Appends a child segment to a parent testid, e.g. `joinTestId('fd-x', 'nav-item-orders')` ->
38
+ * `fd-x--nav-item-orders`.
39
+ *
40
+ * @param prefix The ancestor's resolved testid.
41
+ * @param segment The child's own segment, already slugified.
42
+ * @returns The two joined with `--`.
43
+ */
26
44
  export declare const joinTestId: (prefix: string, segment: string) => string;
27
- /** Return the override when provided, otherwise the fallback (explicit-child case). */
45
+ /**
46
+ * Returns the override when provided, otherwise the fallback (explicit-child case).
47
+ *
48
+ * @param override A consumer-provided `data-testid`, if any.
49
+ * @param fallback The derived default to use without one.
50
+ * @returns Whichever applies.
51
+ */
28
52
  export declare const resolveTestId: (override: string | undefined, fallback: string) => string;
29
53
  /**
30
- * Spread helper for the resolved testid. Returns `{ 'data-testid': value }` when
31
- * a value is present, otherwise an empty object. Centralising this keeps the
32
- * emitted attribute name in one place (a React Native sibling can map it to
33
- * `testID` in a follow-up without touching call sites).
54
+ * Spread helper for a resolved test id: `{ 'data-testid': value }` when present, else an empty
55
+ * object. Centralising it keeps the attribute name in one place so a React Native sibling can
56
+ * map it to `testID`.
57
+ *
58
+ * @param testId The resolved id, or `undefined` to emit nothing.
59
+ * @returns Props to spread onto the rendered element.
34
60
  */
35
61
  export declare const testIdProps: (testId: string | undefined) => {
36
62
  "data-testid"?: string;
@@ -39,7 +65,11 @@ export declare const testIdProps: (testId: string | undefined) => {
39
65
  export declare const TestIdContext: import("react").Context<string | undefined>;
40
66
  /** Provides a resolved testid as the prefix for descendant library components. */
41
67
  export declare const TestIdProvider: import("react").Provider<string | undefined>;
42
- /** Read the testid prefix contributed by an ancestor component (`undefined` at the root). */
68
+ /**
69
+ * Reads the testid prefix contributed by an ancestor component.
70
+ *
71
+ * @returns The ancestor's resolved testid, or `undefined` at the root.
72
+ */
43
73
  export declare const useTestIdPrefix: () => string | undefined;
44
74
  export interface UseResolvedTestIdOptions {
45
75
  /** Consumer-provided override; wins over any derived value. */
@@ -50,8 +80,12 @@ export interface UseResolvedTestIdOptions {
50
80
  rootName: string;
51
81
  }
52
82
  /**
53
- * Resolve a component's testid: an explicit override wins; otherwise derive
83
+ * Resolves a component's testid: an explicit override wins; otherwise derive
54
84
  * `<ancestorPrefix>--<segment>` when nested, or `fd-<rootName>` at the root.
85
+ *
86
+ * @param options The consumer `testId` override, the component's `segment`, and its
87
+ * `rootName`.
88
+ * @returns The id to render as `data-testid`.
55
89
  */
56
90
  export declare const useResolvedTestId: ({ testId, segment, rootName }: UseResolvedTestIdOptions) => string;
57
91
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/testIdUtils/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,sDAAsD;AACtD,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,oFAAoF;AACpF,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC,0EAA0E;AAC1E,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,MAKlB,CAAC;AAE7B,qGAAqG;AACrG,eAAO,MAAM,UAAU,GAAI,WAAW,MAAM,KAAG,MAA0C,CAAC;AAE1F,0HAA0H;AAC1H,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,EAAE,SAAS,MAAM,KAAG,MAAmD,CAAC;AAEjH,uFAAuF;AACvF,eAAO,MAAM,aAAa,GAAI,UAAU,MAAM,GAAG,SAAS,EAAE,UAAU,MAAM,KAAG,MAA8B,CAAC;AAE9G;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,GAAG,SAAS,KAAG;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAA+C,CAAC;AAEjI,kGAAkG;AAClG,eAAO,MAAM,aAAa,6CAA+C,CAAC;AAE1E,kFAAkF;AAClF,eAAO,MAAM,cAAc,8CAAyB,CAAC;AAErD,6FAA6F;AAC7F,eAAO,MAAM,eAAe,QAAO,MAAM,GAAG,SAAsC,CAAC;AAEnF,MAAM,WAAW,wBAAwB;IACvC,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,+BAA+B,wBAAwB,KAAG,MAG3F,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/testIdUtils/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,sDAAsD;AACtD,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,oFAAoF;AACpF,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,MAKlB,CAAC;AAE7B;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAI,WAAW,MAAM,KAAG,MAA0C,CAAC;AAE1F;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,EAAE,SAAS,MAAM,KAAG,MAAmD,CAAC;AAEjH;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,UAAU,MAAM,GAAG,SAAS,EAAE,UAAU,MAAM,KAAG,MAA8B,CAAC;AAE9G;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,GAAG,SAAS,KAAG;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAA+C,CAAC;AAEjI,kGAAkG;AAClG,eAAO,MAAM,aAAa,6CAA+C,CAAC;AAE1E,kFAAkF;AAClF,eAAO,MAAM,cAAc,8CAAyB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAAO,MAAM,GAAG,SAAsC,CAAC;AAEnF,MAAM,WAAW,wBAAwB;IACvC,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAAI,+BAA+B,wBAAwB,KAAG,MAG3F,CAAC"}
@@ -20,34 +20,68 @@ import { createContext, useContext } from 'react';
20
20
  const TEST_ID_PREFIX = 'fd';
21
21
  /** Separator placed between hierarchy levels (within a segment, use single `-`). */
22
22
  const TEST_ID_SEPARATOR = '--';
23
- /** Convert an arbitrary string into a kebab-case, testid-safe segment. */
23
+ /**
24
+ * Converts an arbitrary string into a kebab-case, testid-safe segment.
25
+ *
26
+ * @param value A label or id, in any case or punctuation.
27
+ * @returns Lower-case text with runs of non-alphanumerics collapsed to single hyphens.
28
+ */
24
29
  const slugifyTestId = (value) => value
25
30
  .toLowerCase()
26
31
  .trim()
27
32
  .replace(/[^a-z0-9]+/g, '-')
28
33
  .replace(/^-+|-+$/g, '');
29
- /** Build a root-level testid, e.g. `rootTestId('sidebar-navigation')` -> `fd-sidebar-navigation`. */
34
+ /**
35
+ * Builds a root-level testid, e.g. `rootTestId('sidebar-navigation')` ->
36
+ * `fd-sidebar-navigation`.
37
+ *
38
+ * @param kebabName The component's kebab-case name.
39
+ * @returns The name prefixed with `fd-`.
40
+ */
30
41
  const rootTestId = (kebabName) => `${TEST_ID_PREFIX}-${kebabName}`;
31
- /** Append a child segment to a parent testid, e.g. `joinTestId('fd-x', 'nav-item-orders')` -> `fd-x--nav-item-orders`. */
42
+ /**
43
+ * Appends a child segment to a parent testid, e.g. `joinTestId('fd-x', 'nav-item-orders')` ->
44
+ * `fd-x--nav-item-orders`.
45
+ *
46
+ * @param prefix The ancestor's resolved testid.
47
+ * @param segment The child's own segment, already slugified.
48
+ * @returns The two joined with `--`.
49
+ */
32
50
  const joinTestId = (prefix, segment) => `${prefix}${TEST_ID_SEPARATOR}${segment}`;
33
- /** Return the override when provided, otherwise the fallback (explicit-child case). */
51
+ /**
52
+ * Returns the override when provided, otherwise the fallback (explicit-child case).
53
+ *
54
+ * @param override A consumer-provided `data-testid`, if any.
55
+ * @param fallback The derived default to use without one.
56
+ * @returns Whichever applies.
57
+ */
34
58
  const resolveTestId = (override, fallback) => override ?? fallback;
35
59
  /**
36
- * Spread helper for the resolved testid. Returns `{ 'data-testid': value }` when
37
- * a value is present, otherwise an empty object. Centralising this keeps the
38
- * emitted attribute name in one place (a React Native sibling can map it to
39
- * `testID` in a follow-up without touching call sites).
60
+ * Spread helper for a resolved test id: `{ 'data-testid': value }` when present, else an empty
61
+ * object. Centralising it keeps the attribute name in one place so a React Native sibling can
62
+ * map it to `testID`.
63
+ *
64
+ * @param testId The resolved id, or `undefined` to emit nothing.
65
+ * @returns Props to spread onto the rendered element.
40
66
  */
41
67
  const testIdProps = (testId) => (testId ? { 'data-testid': testId } : {});
42
68
  /** Context carrying the current resolved testid, used as the prefix for descendant components. */
43
69
  const TestIdContext = createContext(undefined);
44
70
  /** Provides a resolved testid as the prefix for descendant library components. */
45
71
  const TestIdProvider = TestIdContext.Provider;
46
- /** Read the testid prefix contributed by an ancestor component (`undefined` at the root). */
72
+ /**
73
+ * Reads the testid prefix contributed by an ancestor component.
74
+ *
75
+ * @returns The ancestor's resolved testid, or `undefined` at the root.
76
+ */
47
77
  const useTestIdPrefix = () => useContext(TestIdContext);
48
78
  /**
49
- * Resolve a component's testid: an explicit override wins; otherwise derive
79
+ * Resolves a component's testid: an explicit override wins; otherwise derive
50
80
  * `<ancestorPrefix>--<segment>` when nested, or `fd-<rootName>` at the root.
81
+ *
82
+ * @param options The consumer `testId` override, the component's `segment`, and its
83
+ * `rootName`.
84
+ * @returns The id to render as `data-testid`.
51
85
  */
52
86
  const useResolvedTestId = ({ testId, segment, rootName }) => {
53
87
  const prefix = useTestIdPrefix();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/utilities/testIdUtils/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAIA;;;;;;;;;;;;;;;AAeG;AAEH;AACO,MAAM,cAAc,GAAG;AAE9B;AACO,MAAM,iBAAiB,GAAG;AAEjC;MACa,aAAa,GAAG,CAAC,KAAa,KACzC;AACG,KAAA,WAAW;AACX,KAAA,IAAI;AACJ,KAAA,OAAO,CAAC,aAAa,EAAE,GAAG;AAC1B,KAAA,OAAO,CAAC,UAAU,EAAE,EAAE;AAE3B;AACO,MAAM,UAAU,GAAG,CAAC,SAAiB,KAAa,CAAA,EAAG,cAAc,CAAA,CAAA,EAAI,SAAS;AAEvF;AACO,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,OAAe,KAAa,GAAG,MAAM,CAAA,EAAG,iBAAiB,CAAA,EAAG,OAAO;AAE9G;AACO,MAAM,aAAa,GAAG,CAAC,QAA4B,EAAE,QAAgB,KAAa,QAAQ,IAAI;AAErG;;;;;AAKG;AACI,MAAM,WAAW,GAAG,CAAC,MAA0B,MAAkC,MAAM,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE;AAE/H;MACa,aAAa,GAAG,aAAa,CAAqB,SAAS;AAExE;AACO,MAAM,cAAc,GAAG,aAAa,CAAC;AAE5C;AACO,MAAM,eAAe,GAAG,MAA0B,UAAU,CAAC,aAAa;AAWjF;;;AAGG;AACI,MAAM,iBAAiB,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAA4B,KAAY;AACnG,IAAA,MAAM,MAAM,GAAG,eAAe,EAAE;IAChC,OAAO,MAAM,KAAK,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;AAChF;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/utilities/testIdUtils/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAIA;;;;;;;;;;;;;;;AAeG;AAEH;AACO,MAAM,cAAc,GAAG;AAE9B;AACO,MAAM,iBAAiB,GAAG;AAEjC;;;;;AAKG;MACU,aAAa,GAAG,CAAC,KAAa,KACzC;AACG,KAAA,WAAW;AACX,KAAA,IAAI;AACJ,KAAA,OAAO,CAAC,aAAa,EAAE,GAAG;AAC1B,KAAA,OAAO,CAAC,UAAU,EAAE,EAAE;AAE3B;;;;;;AAMG;AACI,MAAM,UAAU,GAAG,CAAC,SAAiB,KAAa,CAAA,EAAG,cAAc,CAAA,CAAA,EAAI,SAAS;AAEvF;;;;;;;AAOG;AACI,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,OAAe,KAAa,GAAG,MAAM,CAAA,EAAG,iBAAiB,CAAA,EAAG,OAAO;AAE9G;;;;;;AAMG;AACI,MAAM,aAAa,GAAG,CAAC,QAA4B,EAAE,QAAgB,KAAa,QAAQ,IAAI;AAErG;;;;;;;AAOG;AACI,MAAM,WAAW,GAAG,CAAC,MAA0B,MAAkC,MAAM,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE;AAE/H;MACa,aAAa,GAAG,aAAa,CAAqB,SAAS;AAExE;AACO,MAAM,cAAc,GAAG,aAAa,CAAC;AAE5C;;;;AAIG;AACI,MAAM,eAAe,GAAG,MAA0B,UAAU,CAAC,aAAa;AAWjF;;;;;;;AAOG;AACI,MAAM,iBAAiB,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAA4B,KAAY;AACnG,IAAA,MAAM,MAAM,GAAG,eAAe,EAAE;IAChC,OAAO,MAAM,KAAK,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;AAChF;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flipdish/ui-library",
3
- "version": "0.31.3",
3
+ "version": "0.31.5",
4
4
  "description": "Flipdish Design System — atomic-design component library (Tailwind v4 + UntitledUI + React Aria).",
5
5
  "type": "module",
6
6
  "imports": {