@opengovsg/oui 0.0.0-snapshot-20250311073924

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 (215) hide show
  1. package/LICENSE.md +13 -0
  2. package/dist/cjs/banner/banner.cjs +118 -0
  3. package/dist/cjs/banner/index.cjs +8 -0
  4. package/dist/cjs/button/button.cjs +86 -0
  5. package/dist/cjs/button/index.cjs +8 -0
  6. package/dist/cjs/combo-box/combo-box-fuzzy.cjs +107 -0
  7. package/dist/cjs/combo-box/combo-box.cjs +277 -0
  8. package/dist/cjs/combo-box/index.cjs +12 -0
  9. package/dist/cjs/field/field.cjs +63 -0
  10. package/dist/cjs/field/index.cjs +11 -0
  11. package/dist/cjs/govt-banner/govt-banner.cjs +259 -0
  12. package/dist/cjs/govt-banner/index.cjs +8 -0
  13. package/dist/cjs/hooks/index.cjs +8 -0
  14. package/dist/cjs/hooks/use-callback-ref.cjs +17 -0
  15. package/dist/cjs/hooks/use-controllable-state.cjs +37 -0
  16. package/dist/cjs/index.cjs +47 -0
  17. package/dist/cjs/input/index.cjs +8 -0
  18. package/dist/cjs/input/input.cjs +28 -0
  19. package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/Icon.cjs +48 -0
  20. package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/createLucideIcon.cjs +30 -0
  21. package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/defaultAttributes.cjs +24 -0
  22. package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-down.cjs +19 -0
  23. package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-up.cjs +19 -0
  24. package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/circle-alert.cjs +23 -0
  25. package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/external-link.cjs +23 -0
  26. package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/info.cjs +23 -0
  27. package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/landmark.cjs +26 -0
  28. package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/lock.cjs +22 -0
  29. package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/x.cjs +22 -0
  30. package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/shared/src/utils.cjs +16 -0
  31. package/dist/cjs/ripple/index.cjs +10 -0
  32. package/dist/cjs/ripple/ripple.cjs +70 -0
  33. package/dist/cjs/ripple/use-ripple.cjs +29 -0
  34. package/dist/cjs/skip-nav-link/index.cjs +8 -0
  35. package/dist/cjs/skip-nav-link/skip-nav-link.cjs +18 -0
  36. package/dist/cjs/spinner/index.cjs +10 -0
  37. package/dist/cjs/spinner/spinner.cjs +17 -0
  38. package/dist/cjs/spinner/use-spinner.cjs +38 -0
  39. package/dist/cjs/system/react-utils/context.cjs +31 -0
  40. package/dist/cjs/system/react-utils/index.cjs +8 -0
  41. package/dist/cjs/system/types.cjs +3 -0
  42. package/dist/cjs/system/utils.cjs +101 -0
  43. package/dist/cjs/tag-field/index.cjs +8 -0
  44. package/dist/cjs/tag-field/tag-field-list.cjs +73 -0
  45. package/dist/cjs/tag-field/tag-field-root.cjs +184 -0
  46. package/dist/cjs/tag-field/tag-field-state-context.cjs +11 -0
  47. package/dist/cjs/tag-field/tag-field-tag-list.cjs +70 -0
  48. package/dist/cjs/tag-field/tag-field-trigger.cjs +27 -0
  49. package/dist/cjs/tag-field/tag-field.cjs +106 -0
  50. package/dist/cjs/tag-field/types.cjs +3 -0
  51. package/dist/cjs/tag-field/use-tag-field-state.cjs +103 -0
  52. package/dist/cjs/tag-field/use-tag-field.cjs +188 -0
  53. package/dist/cjs/text-area/index.cjs +8 -0
  54. package/dist/cjs/text-area/text-area.cjs +28 -0
  55. package/dist/cjs/text-area-field/index.cjs +8 -0
  56. package/dist/cjs/text-area-field/text-area-field.cjs +48 -0
  57. package/dist/cjs/text-field/index.cjs +8 -0
  58. package/dist/cjs/text-field/text-field.cjs +48 -0
  59. package/dist/cjs/toggle/index.cjs +8 -0
  60. package/dist/cjs/toggle/toggle.cjs +48 -0
  61. package/dist/esm/banner/banner.js +116 -0
  62. package/dist/esm/banner/index.js +2 -0
  63. package/dist/esm/button/button.js +84 -0
  64. package/dist/esm/button/index.js +2 -0
  65. package/dist/esm/combo-box/combo-box-fuzzy.js +105 -0
  66. package/dist/esm/combo-box/combo-box.js +273 -0
  67. package/dist/esm/combo-box/index.js +3 -0
  68. package/dist/esm/field/field.js +58 -0
  69. package/dist/esm/field/index.js +2 -0
  70. package/dist/esm/govt-banner/govt-banner.js +257 -0
  71. package/dist/esm/govt-banner/index.js +2 -0
  72. package/dist/esm/hooks/index.js +2 -0
  73. package/dist/esm/hooks/use-callback-ref.js +15 -0
  74. package/dist/esm/hooks/use-controllable-state.js +35 -0
  75. package/dist/esm/index.js +19 -0
  76. package/dist/esm/input/index.js +2 -0
  77. package/dist/esm/input/input.js +26 -0
  78. package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/Icon.js +44 -0
  79. package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/createLucideIcon.js +26 -0
  80. package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/defaultAttributes.js +20 -0
  81. package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-down.js +14 -0
  82. package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-up.js +14 -0
  83. package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/circle-alert.js +18 -0
  84. package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/external-link.js +18 -0
  85. package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/info.js +18 -0
  86. package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/landmark.js +21 -0
  87. package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/lock.js +17 -0
  88. package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/x.js +17 -0
  89. package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/shared/src/utils.js +13 -0
  90. package/dist/esm/ripple/index.js +3 -0
  91. package/dist/esm/ripple/ripple.js +49 -0
  92. package/dist/esm/ripple/use-ripple.js +27 -0
  93. package/dist/esm/skip-nav-link/index.js +2 -0
  94. package/dist/esm/skip-nav-link/skip-nav-link.js +16 -0
  95. package/dist/esm/spinner/index.js +3 -0
  96. package/dist/esm/spinner/spinner.js +15 -0
  97. package/dist/esm/spinner/use-spinner.js +36 -0
  98. package/dist/esm/system/react-utils/context.js +29 -0
  99. package/dist/esm/system/react-utils/index.js +2 -0
  100. package/dist/esm/system/types.js +1 -0
  101. package/dist/esm/system/utils.js +94 -0
  102. package/dist/esm/tag-field/index.js +2 -0
  103. package/dist/esm/tag-field/tag-field-list.js +69 -0
  104. package/dist/esm/tag-field/tag-field-root.js +182 -0
  105. package/dist/esm/tag-field/tag-field-state-context.js +9 -0
  106. package/dist/esm/tag-field/tag-field-tag-list.js +68 -0
  107. package/dist/esm/tag-field/tag-field-trigger.js +24 -0
  108. package/dist/esm/tag-field/tag-field.js +104 -0
  109. package/dist/esm/tag-field/types.js +1 -0
  110. package/dist/esm/tag-field/use-tag-field-state.js +101 -0
  111. package/dist/esm/tag-field/use-tag-field.js +186 -0
  112. package/dist/esm/text-area/index.js +2 -0
  113. package/dist/esm/text-area/text-area.js +26 -0
  114. package/dist/esm/text-area-field/index.js +2 -0
  115. package/dist/esm/text-area-field/text-area-field.js +46 -0
  116. package/dist/esm/text-field/index.js +2 -0
  117. package/dist/esm/text-field/text-field.js +46 -0
  118. package/dist/esm/toggle/index.js +2 -0
  119. package/dist/esm/toggle/toggle.js +46 -0
  120. package/dist/types/banner/banner.d.ts +19 -0
  121. package/dist/types/banner/banner.d.ts.map +1 -0
  122. package/dist/types/banner/index.d.ts +2 -0
  123. package/dist/types/banner/index.d.ts.map +1 -0
  124. package/dist/types/button/button.d.ts +48 -0
  125. package/dist/types/button/button.d.ts.map +1 -0
  126. package/dist/types/button/index.d.ts +2 -0
  127. package/dist/types/button/index.d.ts.map +1 -0
  128. package/dist/types/combo-box/combo-box-fuzzy.d.ts +11 -0
  129. package/dist/types/combo-box/combo-box-fuzzy.d.ts.map +1 -0
  130. package/dist/types/combo-box/combo-box.d.ts +50 -0
  131. package/dist/types/combo-box/combo-box.d.ts.map +1 -0
  132. package/dist/types/combo-box/index.d.ts +3 -0
  133. package/dist/types/combo-box/index.d.ts.map +1 -0
  134. package/dist/types/field/field.d.ts +14 -0
  135. package/dist/types/field/field.d.ts.map +1 -0
  136. package/dist/types/field/index.d.ts +2 -0
  137. package/dist/types/field/index.d.ts.map +1 -0
  138. package/dist/types/govt-banner/govt-banner.d.ts +39 -0
  139. package/dist/types/govt-banner/govt-banner.d.ts.map +1 -0
  140. package/dist/types/govt-banner/index.d.ts +2 -0
  141. package/dist/types/govt-banner/index.d.ts.map +1 -0
  142. package/dist/types/hooks/index.d.ts +2 -0
  143. package/dist/types/hooks/index.d.ts.map +1 -0
  144. package/dist/types/hooks/use-callback-ref.d.ts +6 -0
  145. package/dist/types/hooks/use-callback-ref.d.ts.map +1 -0
  146. package/dist/types/hooks/use-controllable-state.d.ts +11 -0
  147. package/dist/types/hooks/use-controllable-state.d.ts.map +1 -0
  148. package/dist/types/index.d.mts +16 -0
  149. package/dist/types/index.d.ts +16 -0
  150. package/dist/types/index.d.ts.map +1 -0
  151. package/dist/types/input/index.d.ts +2 -0
  152. package/dist/types/input/index.d.ts.map +1 -0
  153. package/dist/types/input/input.d.ts +9 -0
  154. package/dist/types/input/input.d.ts.map +1 -0
  155. package/dist/types/ripple/index.d.ts +3 -0
  156. package/dist/types/ripple/index.d.ts.map +1 -0
  157. package/dist/types/ripple/ripple.d.ts +10 -0
  158. package/dist/types/ripple/ripple.d.ts.map +1 -0
  159. package/dist/types/ripple/use-ripple.d.ts +15 -0
  160. package/dist/types/ripple/use-ripple.d.ts.map +1 -0
  161. package/dist/types/skip-nav-link/index.d.ts +2 -0
  162. package/dist/types/skip-nav-link/index.d.ts.map +1 -0
  163. package/dist/types/skip-nav-link/skip-nav-link.d.ts +11 -0
  164. package/dist/types/skip-nav-link/skip-nav-link.d.ts.map +1 -0
  165. package/dist/types/spinner/index.d.ts +3 -0
  166. package/dist/types/spinner/index.d.ts.map +1 -0
  167. package/dist/types/spinner/spinner.d.ts +4 -0
  168. package/dist/types/spinner/spinner.d.ts.map +1 -0
  169. package/dist/types/spinner/use-spinner.d.ts +66 -0
  170. package/dist/types/spinner/use-spinner.d.ts.map +1 -0
  171. package/dist/types/system/react-utils/context.d.ts +27 -0
  172. package/dist/types/system/react-utils/context.d.ts.map +1 -0
  173. package/dist/types/system/react-utils/index.d.ts +2 -0
  174. package/dist/types/system/react-utils/index.d.ts.map +1 -0
  175. package/dist/types/system/types.d.ts +63 -0
  176. package/dist/types/system/types.d.ts.map +1 -0
  177. package/dist/types/system/utils.d.ts +856 -0
  178. package/dist/types/system/utils.d.ts.map +1 -0
  179. package/dist/types/tag-field/index.d.ts +2 -0
  180. package/dist/types/tag-field/index.d.ts.map +1 -0
  181. package/dist/types/tag-field/tag-field-list.d.ts +22 -0
  182. package/dist/types/tag-field/tag-field-list.d.ts.map +1 -0
  183. package/dist/types/tag-field/tag-field-root.d.ts +14 -0
  184. package/dist/types/tag-field/tag-field-root.d.ts.map +1 -0
  185. package/dist/types/tag-field/tag-field-state-context.d.ts +12 -0
  186. package/dist/types/tag-field/tag-field-state-context.d.ts.map +1 -0
  187. package/dist/types/tag-field/tag-field-tag-list.d.ts +17 -0
  188. package/dist/types/tag-field/tag-field-tag-list.d.ts.map +1 -0
  189. package/dist/types/tag-field/tag-field-trigger.d.ts +8 -0
  190. package/dist/types/tag-field/tag-field-trigger.d.ts.map +1 -0
  191. package/dist/types/tag-field/tag-field.d.ts +3 -0
  192. package/dist/types/tag-field/tag-field.d.ts.map +1 -0
  193. package/dist/types/tag-field/types.d.ts +71 -0
  194. package/dist/types/tag-field/types.d.ts.map +1 -0
  195. package/dist/types/tag-field/use-tag-field-state.d.ts +35 -0
  196. package/dist/types/tag-field/use-tag-field-state.d.ts.map +1 -0
  197. package/dist/types/tag-field/use-tag-field.d.ts +48 -0
  198. package/dist/types/tag-field/use-tag-field.d.ts.map +1 -0
  199. package/dist/types/text-area/index.d.ts +2 -0
  200. package/dist/types/text-area/index.d.ts.map +1 -0
  201. package/dist/types/text-area/text-area.d.ts +9 -0
  202. package/dist/types/text-area/text-area.d.ts.map +1 -0
  203. package/dist/types/text-area-field/index.d.ts +2 -0
  204. package/dist/types/text-area-field/index.d.ts.map +1 -0
  205. package/dist/types/text-area-field/text-area-field.d.ts +12 -0
  206. package/dist/types/text-area-field/text-area-field.d.ts.map +1 -0
  207. package/dist/types/text-field/index.d.ts +2 -0
  208. package/dist/types/text-field/index.d.ts.map +1 -0
  209. package/dist/types/text-field/text-field.d.ts +12 -0
  210. package/dist/types/text-field/text-field.d.ts.map +1 -0
  211. package/dist/types/toggle/index.d.ts +2 -0
  212. package/dist/types/toggle/index.d.ts.map +1 -0
  213. package/dist/types/toggle/toggle.d.ts +22 -0
  214. package/dist/types/toggle/toggle.d.ts.map +1 -0
  215. package/package.json +93 -0
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var createLucideIcon = require('../createLucideIcon.cjs');
6
+
7
+ /**
8
+ * @license lucide-react v0.475.0 - ISC
9
+ *
10
+ * This source code is licensed under the ISC license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */
13
+
14
+
15
+ const __iconNode = [
16
+ ["line", { x1: "3", x2: "21", y1: "22", y2: "22", key: "j8o0r" }],
17
+ ["line", { x1: "6", x2: "6", y1: "18", y2: "11", key: "10tf0k" }],
18
+ ["line", { x1: "10", x2: "10", y1: "18", y2: "11", key: "54lgf6" }],
19
+ ["line", { x1: "14", x2: "14", y1: "18", y2: "11", key: "380y" }],
20
+ ["line", { x1: "18", x2: "18", y1: "18", y2: "11", key: "1kevvc" }],
21
+ ["polygon", { points: "12 2 20 7 4 7", key: "jkujk7" }]
22
+ ];
23
+ const Landmark = createLucideIcon.default("Landmark", __iconNode);
24
+
25
+ exports.__iconNode = __iconNode;
26
+ exports.default = Landmark;
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var createLucideIcon = require('../createLucideIcon.cjs');
6
+
7
+ /**
8
+ * @license lucide-react v0.475.0 - ISC
9
+ *
10
+ * This source code is licensed under the ISC license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */
13
+
14
+
15
+ const __iconNode = [
16
+ ["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
17
+ ["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
18
+ ];
19
+ const Lock = createLucideIcon.default("Lock", __iconNode);
20
+
21
+ exports.__iconNode = __iconNode;
22
+ exports.default = Lock;
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var createLucideIcon = require('../createLucideIcon.cjs');
6
+
7
+ /**
8
+ * @license lucide-react v0.475.0 - ISC
9
+ *
10
+ * This source code is licensed under the ISC license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */
13
+
14
+
15
+ const __iconNode = [
16
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
17
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
18
+ ];
19
+ const X = createLucideIcon.default("X", __iconNode);
20
+
21
+ exports.__iconNode = __iconNode;
22
+ exports.default = X;
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @license lucide-react v0.475.0 - ISC
5
+ *
6
+ * This source code is licensed under the ISC license.
7
+ * See the LICENSE file in the root directory of this source tree.
8
+ */
9
+
10
+ const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
11
+ const mergeClasses = (...classes) => classes.filter((className, index, array) => {
12
+ return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
13
+ }).join(" ").trim();
14
+
15
+ exports.mergeClasses = mergeClasses;
16
+ exports.toKebabCase = toKebabCase;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var ripple = require('./ripple.cjs');
5
+ var useRipple = require('./use-ripple.cjs');
6
+
7
+
8
+
9
+ exports.Ripple = ripple.Ripple;
10
+ exports.useRipple = useRipple.useRipple;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ "use client";
3
+ 'use strict';
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var motion = require('motion');
7
+ var react = require('motion/react');
8
+ var m = require('motion/react-m');
9
+
10
+ function _interopNamespaceDefault(e) {
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var m__namespace = /*#__PURE__*/_interopNamespaceDefault(m);
28
+
29
+ function Ripple({
30
+ ripples = [],
31
+ style,
32
+ onClear,
33
+ color = "currentColor"
34
+ }) {
35
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: ripples.map((ripple) => {
36
+ const duration = motion.clamp(
37
+ 0.2,
38
+ ripple.size > 100 ? 0.75 : 0.5,
39
+ 0.01 * ripple.size
40
+ );
41
+ return /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domAnimation, children: /* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { mode: "popLayout", children: /* @__PURE__ */ jsxRuntime.jsx(
42
+ m__namespace.span,
43
+ {
44
+ animate: { transform: "scale(2)", opacity: 0 },
45
+ exit: { opacity: 0 },
46
+ initial: { transform: "scale(0)", opacity: 0.35 },
47
+ onAnimationComplete: () => {
48
+ onClear(ripple.key);
49
+ },
50
+ style: {
51
+ position: "absolute",
52
+ overflow: "hidden",
53
+ inset: 0,
54
+ zIndex: 0,
55
+ pointerEvents: "none",
56
+ borderRadius: "100%",
57
+ top: ripple.y,
58
+ left: ripple.x,
59
+ width: `${ripple.size}px`,
60
+ height: `${ripple.size}px`,
61
+ backgroundColor: color,
62
+ ...style
63
+ },
64
+ transition: { duration }
65
+ }
66
+ ) }) }, ripple.key);
67
+ }) });
68
+ }
69
+
70
+ exports.Ripple = Ripple;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ "use client";
3
+ 'use strict';
4
+
5
+ var react = require('react');
6
+ var nanoid = require('nanoid');
7
+
8
+ const useRipple = () => {
9
+ const [ripples, setRipples] = react.useState([]);
10
+ const onPress = react.useCallback((event) => {
11
+ const trigger = event.target;
12
+ const size = Math.max(trigger.clientWidth, trigger.clientHeight);
13
+ setRipples((prevRipples) => [
14
+ ...prevRipples,
15
+ {
16
+ key: nanoid.nanoid(),
17
+ size,
18
+ x: event.x - size / 2,
19
+ y: event.y - size / 2
20
+ }
21
+ ]);
22
+ }, []);
23
+ const onClear = react.useCallback((key) => {
24
+ setRipples((prevState) => prevState.filter((ripple) => ripple.key !== key));
25
+ }, []);
26
+ return { ripples, onPress, onClear };
27
+ };
28
+
29
+ exports.useRipple = useRipple;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var skipNavLink = require('./skip-nav-link.cjs');
5
+
6
+
7
+
8
+ exports.SkipNavLink = skipNavLink.SkipNavLink;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var ouiTheme = require('@opengovsg/oui-theme');
6
+
7
+ const SkipNavLink = ({ className, id, ...props }) => {
8
+ return /* @__PURE__ */ jsxRuntime.jsx(
9
+ "a",
10
+ {
11
+ className: ouiTheme.skipNavLinkStyles({ className }),
12
+ ...props,
13
+ href: `#${id}`
14
+ }
15
+ );
16
+ };
17
+
18
+ exports.SkipNavLink = SkipNavLink;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var spinner = require('./spinner.cjs');
5
+ var useSpinner = require('./use-spinner.cjs');
6
+
7
+
8
+
9
+ exports.Spinner = spinner.Spinner;
10
+ exports.useSpinner = useSpinner.useSpinner;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ "use client";
3
+ 'use strict';
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var utils = require('../system/utils.cjs');
7
+ var useSpinner = require('./use-spinner.cjs');
8
+
9
+ const Spinner = utils.forwardRef((props, ref) => {
10
+ const { slots, classNames, getSpinnerProps } = useSpinner.useSpinner(props);
11
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, ...getSpinnerProps(), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: slots.wrapper({ class: classNames?.wrapper }), children: [
12
+ /* @__PURE__ */ jsxRuntime.jsx("i", { className: slots.circle1({ class: classNames?.circle1 }) }),
13
+ /* @__PURE__ */ jsxRuntime.jsx("i", { className: slots.circle2({ class: classNames?.circle2 }) })
14
+ ] }) });
15
+ });
16
+
17
+ exports.Spinner = Spinner;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ "use client";
3
+ 'use strict';
4
+
5
+ var react = require('react');
6
+ var ouiTheme = require('@opengovsg/oui-theme');
7
+ var useDeepCompare = require('use-deep-compare');
8
+ var utils = require('../system/utils.cjs');
9
+
10
+ const useSpinner = (originalProps) => {
11
+ const [props, variantProps] = utils.mapPropsVariants(
12
+ originalProps,
13
+ ouiTheme.spinnerStyles.variantKeys
14
+ );
15
+ const { className, classNames, ...otherProps } = props;
16
+ const slots = useDeepCompare.useDeepCompareMemo(
17
+ () => ouiTheme.spinnerStyles({ ...variantProps }),
18
+ [variantProps]
19
+ );
20
+ const baseStyles = ouiTheme.cn(classNames?.base, className);
21
+ const ariaLabel = react.useMemo(() => {
22
+ return !otherProps["aria-label"] ? "Loading" : "";
23
+ }, [otherProps["aria-label"]]);
24
+ const getSpinnerProps = react.useCallback(
25
+ () => ({
26
+ "aria-label": ariaLabel,
27
+ role: "progressbar",
28
+ className: slots.base({
29
+ class: baseStyles
30
+ }),
31
+ ...otherProps
32
+ }),
33
+ [ariaLabel, slots, baseStyles, otherProps]
34
+ );
35
+ return { slots, classNames, getSpinnerProps };
36
+ };
37
+
38
+ exports.useSpinner = useSpinner;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var react = require('react');
5
+
6
+ function createContext(options = {}) {
7
+ const {
8
+ strict = true,
9
+ errorMessage = "useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",
10
+ name
11
+ } = options;
12
+ const Context = react.createContext(void 0);
13
+ Context.displayName = name;
14
+ function useContext() {
15
+ const context = react.useContext(Context);
16
+ if (!context && strict) {
17
+ const error = new Error(errorMessage);
18
+ error.name = "ContextError";
19
+ Error.captureStackTrace?.(error, useContext);
20
+ throw error;
21
+ }
22
+ return context;
23
+ }
24
+ return [
25
+ Context.Provider,
26
+ useContext,
27
+ Context
28
+ ];
29
+ }
30
+
31
+ exports.createContext = createContext;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var context = require('./context.cjs');
5
+
6
+
7
+
8
+ exports.createContext = context.createContext;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ 'use strict';
3
+
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var react = require('react');
5
+
6
+ function forwardRef(component) {
7
+ return react.forwardRef(component);
8
+ }
9
+ function forwardRefGeneric(render) {
10
+ return forwardRef(render);
11
+ }
12
+ const mapPropsVariants = (props, variantKeys, removeVariantProps = true) => {
13
+ if (!variantKeys) {
14
+ return [props, {}];
15
+ }
16
+ const picked = variantKeys.reduce((acc, key) => {
17
+ if (key in props) {
18
+ return { ...acc, [key]: props[key] };
19
+ }
20
+ return acc;
21
+ }, {});
22
+ if (removeVariantProps) {
23
+ const omitted = Object.keys(props).filter((key) => !variantKeys.includes(key)).reduce((acc, key) => ({ ...acc, [key]: props[key] }), {});
24
+ return [omitted, picked];
25
+ }
26
+ return [props, picked];
27
+ };
28
+ function useRenderProps(props) {
29
+ const {
30
+ className,
31
+ style,
32
+ children,
33
+ defaultClassName = void 0,
34
+ defaultChildren = void 0,
35
+ defaultStyle,
36
+ values
37
+ } = props;
38
+ return react.useMemo(() => {
39
+ let computedClassName;
40
+ let computedStyle;
41
+ let computedChildren;
42
+ if (typeof className === "function") {
43
+ computedClassName = className({ ...values, defaultClassName });
44
+ } else {
45
+ computedClassName = className;
46
+ }
47
+ if (typeof style === "function") {
48
+ computedStyle = style({ ...values, defaultStyle: defaultStyle || {} });
49
+ } else {
50
+ computedStyle = style;
51
+ }
52
+ if (typeof children === "function") {
53
+ computedChildren = children({ ...values, defaultChildren });
54
+ } else if (children == null) {
55
+ computedChildren = defaultChildren;
56
+ } else {
57
+ computedChildren = children;
58
+ }
59
+ return {
60
+ className: computedClassName ?? defaultClassName,
61
+ style: computedStyle || defaultStyle ? { ...defaultStyle, ...computedStyle } : void 0,
62
+ children: computedChildren ?? defaultChildren,
63
+ "data-rac": ""
64
+ };
65
+ }, [
66
+ className,
67
+ style,
68
+ children,
69
+ defaultClassName,
70
+ defaultChildren,
71
+ defaultStyle,
72
+ values
73
+ ]);
74
+ }
75
+ function removeDataAttributes(props) {
76
+ const prefix = /^(data-.*)$/;
77
+ const filteredProps = {};
78
+ for (const prop in props) {
79
+ if (!prefix.test(prop)) {
80
+ filteredProps[prop] = props[prop];
81
+ }
82
+ }
83
+ return filteredProps;
84
+ }
85
+ function pickAriaAttributes(props) {
86
+ const prefix = /^(aria-.*)$/;
87
+ const filteredProps = {};
88
+ for (const prop in props) {
89
+ if (prefix.test(prop)) {
90
+ filteredProps[prop] = props[prop];
91
+ }
92
+ }
93
+ return filteredProps;
94
+ }
95
+
96
+ exports.forwardRef = forwardRef;
97
+ exports.forwardRefGeneric = forwardRefGeneric;
98
+ exports.mapPropsVariants = mapPropsVariants;
99
+ exports.pickAriaAttributes = pickAriaAttributes;
100
+ exports.removeDataAttributes = removeDataAttributes;
101
+ exports.useRenderProps = useRenderProps;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var tagField = require('./tag-field.cjs');
5
+
6
+
7
+
8
+ exports.TagField = tagField.TagField;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var react = require('react');
6
+ var ouiTheme = require('@opengovsg/oui-theme');
7
+ var reactAriaComponents = require('react-aria-components');
8
+ var utils = require('../system/utils.cjs');
9
+ var tagFieldStateContext = require('./tag-field-state-context.cjs');
10
+
11
+ const TagFieldListContext = react.createContext(null);
12
+ const TagFieldListItemInner = ({ item, isHighlighted, classNames, ...itemProps }, ref) => {
13
+ const { itemToText, size } = react.useContext(tagFieldStateContext.TagFieldStateContext);
14
+ const styles = ouiTheme.tagFieldItemStyles({ size });
15
+ return /* @__PURE__ */ jsxRuntime.jsx(
16
+ "li",
17
+ {
18
+ ref,
19
+ ...itemProps,
20
+ className: styles.container({ className: classNames?.container }),
21
+ "data-rac": true,
22
+ "data-hovered": ouiTheme.dataAttr(isHighlighted),
23
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.label({ className: classNames?.label }), children: itemToText(item) })
24
+ }
25
+ );
26
+ };
27
+ const TagFieldListItem = utils.forwardRefGeneric(TagFieldListItemInner);
28
+ const TagFieldListInner = (props, ref) => {
29
+ [props, ref] = reactAriaComponents.useContextProps(props, ref, TagFieldListContext);
30
+ const { items, getItemProps, highlightedIndex } = react.useContext(tagFieldStateContext.TagFieldStateContext);
31
+ const { slot, rowVirtualizer, itemClassNames, ...rest } = props;
32
+ return /* @__PURE__ */ jsxRuntime.jsx("ul", { slot: slot ?? void 0, ref, ...rest, children: props.children !== void 0 && typeof props.children !== "function" ? props.children : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
33
+ /* @__PURE__ */ jsxRuntime.jsx(
34
+ "li",
35
+ {
36
+ "aria-hidden": true,
37
+ style: { height: rowVirtualizer?.getTotalSize() }
38
+ },
39
+ "total-size"
40
+ ),
41
+ rowVirtualizer?.getVirtualItems().map((virtualRow) => {
42
+ const item = items[virtualRow.index];
43
+ const itemProps = getItemProps({
44
+ item,
45
+ index: virtualRow.index,
46
+ style: {
47
+ position: "absolute",
48
+ top: 0,
49
+ left: 0,
50
+ width: "100%",
51
+ height: virtualRow.size,
52
+ transform: `translateY(${virtualRow.start}px)`
53
+ }
54
+ });
55
+ const childProps = {
56
+ item,
57
+ isHighlighted: highlightedIndex === virtualRow.index,
58
+ key: virtualRow.key,
59
+ ...itemProps,
60
+ classNames: itemClassNames
61
+ };
62
+ if (typeof props.children === "function") {
63
+ return props.children(childProps);
64
+ }
65
+ return /* @__PURE__ */ react.createElement(TagFieldListItem, { ...childProps, key: childProps.key });
66
+ })
67
+ ] }) });
68
+ };
69
+ const TagFieldList = utils.forwardRefGeneric(TagFieldListInner);
70
+
71
+ exports.TagFieldList = TagFieldList;
72
+ exports.TagFieldListContext = TagFieldListContext;
73
+ exports.TagFieldListItem = TagFieldListItem;