@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
+ "use client";
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import { forwardRef } from 'react';
5
+ import { composeRenderProps, inputStyles } from '@opengovsg/oui-theme';
6
+ import { Input as Input$1 } from 'react-aria-components';
7
+
8
+ const Input = forwardRef(
9
+ ({ size, variant, isDisabled, ...props }, ref) => {
10
+ return /* @__PURE__ */ jsx(
11
+ Input$1,
12
+ {
13
+ ...props,
14
+ disabled: isDisabled,
15
+ className: composeRenderProps(
16
+ props.className,
17
+ (className, renderProps) => inputStyles({ ...renderProps, className, size, variant })
18
+ ),
19
+ ref
20
+ }
21
+ );
22
+ }
23
+ );
24
+ Input.displayName = "Input";
25
+
26
+ export { Input };
@@ -0,0 +1,44 @@
1
+ import { forwardRef, createElement } from 'react';
2
+ import defaultAttributes from './defaultAttributes.js';
3
+ import { mergeClasses } from './shared/src/utils.js';
4
+
5
+ /**
6
+ * @license lucide-react v0.475.0 - ISC
7
+ *
8
+ * This source code is licensed under the ISC license.
9
+ * See the LICENSE file in the root directory of this source tree.
10
+ */
11
+
12
+
13
+ const Icon = forwardRef(
14
+ ({
15
+ color = "currentColor",
16
+ size = 24,
17
+ strokeWidth = 2,
18
+ absoluteStrokeWidth,
19
+ className = "",
20
+ children,
21
+ iconNode,
22
+ ...rest
23
+ }, ref) => {
24
+ return createElement(
25
+ "svg",
26
+ {
27
+ ref,
28
+ ...defaultAttributes,
29
+ width: size,
30
+ height: size,
31
+ stroke: color,
32
+ strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
33
+ className: mergeClasses("lucide", className),
34
+ ...rest
35
+ },
36
+ [
37
+ ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
38
+ ...Array.isArray(children) ? children : [children]
39
+ ]
40
+ );
41
+ }
42
+ );
43
+
44
+ export { Icon as default };
@@ -0,0 +1,26 @@
1
+ import { forwardRef, createElement } from 'react';
2
+ import { mergeClasses, toKebabCase } from './shared/src/utils.js';
3
+ import Icon from './Icon.js';
4
+
5
+ /**
6
+ * @license lucide-react v0.475.0 - ISC
7
+ *
8
+ * This source code is licensed under the ISC license.
9
+ * See the LICENSE file in the root directory of this source tree.
10
+ */
11
+
12
+
13
+ const createLucideIcon = (iconName, iconNode) => {
14
+ const Component = forwardRef(
15
+ ({ className, ...props }, ref) => createElement(Icon, {
16
+ ref,
17
+ iconNode,
18
+ className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className),
19
+ ...props
20
+ })
21
+ );
22
+ Component.displayName = `${iconName}`;
23
+ return Component;
24
+ };
25
+
26
+ export { createLucideIcon as default };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license lucide-react v0.475.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ var defaultAttributes = {
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ width: 24,
11
+ height: 24,
12
+ viewBox: "0 0 24 24",
13
+ fill: "none",
14
+ stroke: "currentColor",
15
+ strokeWidth: 2,
16
+ strokeLinecap: "round",
17
+ strokeLinejoin: "round"
18
+ };
19
+
20
+ export { defaultAttributes as default };
@@ -0,0 +1,14 @@
1
+ import createLucideIcon from '../createLucideIcon.js';
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
+
11
+ const __iconNode = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
12
+ const ChevronDown = createLucideIcon("ChevronDown", __iconNode);
13
+
14
+ export { __iconNode, ChevronDown as default };
@@ -0,0 +1,14 @@
1
+ import createLucideIcon from '../createLucideIcon.js';
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
+
11
+ const __iconNode = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
12
+ const ChevronUp = createLucideIcon("ChevronUp", __iconNode);
13
+
14
+ export { __iconNode, ChevronUp as default };
@@ -0,0 +1,18 @@
1
+ import createLucideIcon from '../createLucideIcon.js';
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
+
11
+ const __iconNode = [
12
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
13
+ ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
14
+ ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
15
+ ];
16
+ const CircleAlert = createLucideIcon("CircleAlert", __iconNode);
17
+
18
+ export { __iconNode, CircleAlert as default };
@@ -0,0 +1,18 @@
1
+ import createLucideIcon from '../createLucideIcon.js';
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
+
11
+ const __iconNode = [
12
+ ["path", { d: "M15 3h6v6", key: "1q9fwt" }],
13
+ ["path", { d: "M10 14 21 3", key: "gplh6r" }],
14
+ ["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
15
+ ];
16
+ const ExternalLink = createLucideIcon("ExternalLink", __iconNode);
17
+
18
+ export { __iconNode, ExternalLink as default };
@@ -0,0 +1,18 @@
1
+ import createLucideIcon from '../createLucideIcon.js';
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
+
11
+ const __iconNode = [
12
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
13
+ ["path", { d: "M12 16v-4", key: "1dtifu" }],
14
+ ["path", { d: "M12 8h.01", key: "e9boi3" }]
15
+ ];
16
+ const Info = createLucideIcon("Info", __iconNode);
17
+
18
+ export { __iconNode, Info as default };
@@ -0,0 +1,21 @@
1
+ import createLucideIcon from '../createLucideIcon.js';
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
+
11
+ const __iconNode = [
12
+ ["line", { x1: "3", x2: "21", y1: "22", y2: "22", key: "j8o0r" }],
13
+ ["line", { x1: "6", x2: "6", y1: "18", y2: "11", key: "10tf0k" }],
14
+ ["line", { x1: "10", x2: "10", y1: "18", y2: "11", key: "54lgf6" }],
15
+ ["line", { x1: "14", x2: "14", y1: "18", y2: "11", key: "380y" }],
16
+ ["line", { x1: "18", x2: "18", y1: "18", y2: "11", key: "1kevvc" }],
17
+ ["polygon", { points: "12 2 20 7 4 7", key: "jkujk7" }]
18
+ ];
19
+ const Landmark = createLucideIcon("Landmark", __iconNode);
20
+
21
+ export { __iconNode, Landmark as default };
@@ -0,0 +1,17 @@
1
+ import createLucideIcon from '../createLucideIcon.js';
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
+
11
+ const __iconNode = [
12
+ ["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
13
+ ["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
14
+ ];
15
+ const Lock = createLucideIcon("Lock", __iconNode);
16
+
17
+ export { __iconNode, Lock as default };
@@ -0,0 +1,17 @@
1
+ import createLucideIcon from '../createLucideIcon.js';
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
+
11
+ const __iconNode = [
12
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
13
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
14
+ ];
15
+ const X = createLucideIcon("X", __iconNode);
16
+
17
+ export { __iconNode, X as default };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license lucide-react v0.475.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
9
+ const mergeClasses = (...classes) => classes.filter((className, index, array) => {
10
+ return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
11
+ }).join(" ").trim();
12
+
13
+ export { mergeClasses, toKebabCase };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ export { Ripple } from './ripple.js';
3
+ export { useRipple } from './use-ripple.js';
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ "use client";
3
+ import { jsx, Fragment } from 'react/jsx-runtime';
4
+ import { clamp } from 'motion';
5
+ import { LazyMotion, domAnimation, AnimatePresence } from 'motion/react';
6
+ import * as m from 'motion/react-m';
7
+
8
+ function Ripple({
9
+ ripples = [],
10
+ style,
11
+ onClear,
12
+ color = "currentColor"
13
+ }) {
14
+ return /* @__PURE__ */ jsx(Fragment, { children: ripples.map((ripple) => {
15
+ const duration = clamp(
16
+ 0.2,
17
+ ripple.size > 100 ? 0.75 : 0.5,
18
+ 0.01 * ripple.size
19
+ );
20
+ return /* @__PURE__ */ jsx(LazyMotion, { features: domAnimation, children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", children: /* @__PURE__ */ jsx(
21
+ m.span,
22
+ {
23
+ animate: { transform: "scale(2)", opacity: 0 },
24
+ exit: { opacity: 0 },
25
+ initial: { transform: "scale(0)", opacity: 0.35 },
26
+ onAnimationComplete: () => {
27
+ onClear(ripple.key);
28
+ },
29
+ style: {
30
+ position: "absolute",
31
+ overflow: "hidden",
32
+ inset: 0,
33
+ zIndex: 0,
34
+ pointerEvents: "none",
35
+ borderRadius: "100%",
36
+ top: ripple.y,
37
+ left: ripple.x,
38
+ width: `${ripple.size}px`,
39
+ height: `${ripple.size}px`,
40
+ backgroundColor: color,
41
+ ...style
42
+ },
43
+ transition: { duration }
44
+ }
45
+ ) }) }, ripple.key);
46
+ }) });
47
+ }
48
+
49
+ export { Ripple };
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ "use client";
3
+ import { useState, useCallback } from 'react';
4
+ import { nanoid } from 'nanoid';
5
+
6
+ const useRipple = () => {
7
+ const [ripples, setRipples] = useState([]);
8
+ const onPress = useCallback((event) => {
9
+ const trigger = event.target;
10
+ const size = Math.max(trigger.clientWidth, trigger.clientHeight);
11
+ setRipples((prevRipples) => [
12
+ ...prevRipples,
13
+ {
14
+ key: nanoid(),
15
+ size,
16
+ x: event.x - size / 2,
17
+ y: event.y - size / 2
18
+ }
19
+ ]);
20
+ }, []);
21
+ const onClear = useCallback((key) => {
22
+ setRipples((prevState) => prevState.filter((ripple) => ripple.key !== key));
23
+ }, []);
24
+ return { ripples, onPress, onClear };
25
+ };
26
+
27
+ export { useRipple };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ export { SkipNavLink } from './skip-nav-link.js';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { skipNavLinkStyles } from '@opengovsg/oui-theme';
4
+
5
+ const SkipNavLink = ({ className, id, ...props }) => {
6
+ return /* @__PURE__ */ jsx(
7
+ "a",
8
+ {
9
+ className: skipNavLinkStyles({ className }),
10
+ ...props,
11
+ href: `#${id}`
12
+ }
13
+ );
14
+ };
15
+
16
+ export { SkipNavLink };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ export { Spinner } from './spinner.js';
3
+ export { useSpinner } from './use-spinner.js';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ "use client";
3
+ import { jsx, jsxs } from 'react/jsx-runtime';
4
+ import { forwardRef } from '../system/utils.js';
5
+ import { useSpinner } from './use-spinner.js';
6
+
7
+ const Spinner = forwardRef((props, ref) => {
8
+ const { slots, classNames, getSpinnerProps } = useSpinner(props);
9
+ return /* @__PURE__ */ jsx("div", { ref, ...getSpinnerProps(), children: /* @__PURE__ */ jsxs("div", { className: slots.wrapper({ class: classNames?.wrapper }), children: [
10
+ /* @__PURE__ */ jsx("i", { className: slots.circle1({ class: classNames?.circle1 }) }),
11
+ /* @__PURE__ */ jsx("i", { className: slots.circle2({ class: classNames?.circle2 }) })
12
+ ] }) });
13
+ });
14
+
15
+ export { Spinner };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ "use client";
3
+ import { useMemo, useCallback } from 'react';
4
+ import { spinnerStyles, cn } from '@opengovsg/oui-theme';
5
+ import { useDeepCompareMemo } from 'use-deep-compare';
6
+ import { mapPropsVariants } from '../system/utils.js';
7
+
8
+ const useSpinner = (originalProps) => {
9
+ const [props, variantProps] = mapPropsVariants(
10
+ originalProps,
11
+ spinnerStyles.variantKeys
12
+ );
13
+ const { className, classNames, ...otherProps } = props;
14
+ const slots = useDeepCompareMemo(
15
+ () => spinnerStyles({ ...variantProps }),
16
+ [variantProps]
17
+ );
18
+ const baseStyles = cn(classNames?.base, className);
19
+ const ariaLabel = useMemo(() => {
20
+ return !otherProps["aria-label"] ? "Loading" : "";
21
+ }, [otherProps["aria-label"]]);
22
+ const getSpinnerProps = useCallback(
23
+ () => ({
24
+ "aria-label": ariaLabel,
25
+ role: "progressbar",
26
+ className: slots.base({
27
+ class: baseStyles
28
+ }),
29
+ ...otherProps
30
+ }),
31
+ [ariaLabel, slots, baseStyles, otherProps]
32
+ );
33
+ return { slots, classNames, getSpinnerProps };
34
+ };
35
+
36
+ export { useSpinner };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ import { createContext as createContext$1, useContext } from 'react';
3
+
4
+ function createContext(options = {}) {
5
+ const {
6
+ strict = true,
7
+ errorMessage = "useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",
8
+ name
9
+ } = options;
10
+ const Context = createContext$1(void 0);
11
+ Context.displayName = name;
12
+ function useContext$1() {
13
+ const context = useContext(Context);
14
+ if (!context && strict) {
15
+ const error = new Error(errorMessage);
16
+ error.name = "ContextError";
17
+ Error.captureStackTrace?.(error, useContext$1);
18
+ throw error;
19
+ }
20
+ return context;
21
+ }
22
+ return [
23
+ Context.Provider,
24
+ useContext$1,
25
+ Context
26
+ ];
27
+ }
28
+
29
+ export { createContext };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ export { createContext } from './context.js';
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ import { forwardRef as forwardRef$1, useMemo } from 'react';
3
+
4
+ function forwardRef(component) {
5
+ return forwardRef$1(component);
6
+ }
7
+ function forwardRefGeneric(render) {
8
+ return forwardRef(render);
9
+ }
10
+ const mapPropsVariants = (props, variantKeys, removeVariantProps = true) => {
11
+ if (!variantKeys) {
12
+ return [props, {}];
13
+ }
14
+ const picked = variantKeys.reduce((acc, key) => {
15
+ if (key in props) {
16
+ return { ...acc, [key]: props[key] };
17
+ }
18
+ return acc;
19
+ }, {});
20
+ if (removeVariantProps) {
21
+ const omitted = Object.keys(props).filter((key) => !variantKeys.includes(key)).reduce((acc, key) => ({ ...acc, [key]: props[key] }), {});
22
+ return [omitted, picked];
23
+ }
24
+ return [props, picked];
25
+ };
26
+ function useRenderProps(props) {
27
+ const {
28
+ className,
29
+ style,
30
+ children,
31
+ defaultClassName = void 0,
32
+ defaultChildren = void 0,
33
+ defaultStyle,
34
+ values
35
+ } = props;
36
+ return useMemo(() => {
37
+ let computedClassName;
38
+ let computedStyle;
39
+ let computedChildren;
40
+ if (typeof className === "function") {
41
+ computedClassName = className({ ...values, defaultClassName });
42
+ } else {
43
+ computedClassName = className;
44
+ }
45
+ if (typeof style === "function") {
46
+ computedStyle = style({ ...values, defaultStyle: defaultStyle || {} });
47
+ } else {
48
+ computedStyle = style;
49
+ }
50
+ if (typeof children === "function") {
51
+ computedChildren = children({ ...values, defaultChildren });
52
+ } else if (children == null) {
53
+ computedChildren = defaultChildren;
54
+ } else {
55
+ computedChildren = children;
56
+ }
57
+ return {
58
+ className: computedClassName ?? defaultClassName,
59
+ style: computedStyle || defaultStyle ? { ...defaultStyle, ...computedStyle } : void 0,
60
+ children: computedChildren ?? defaultChildren,
61
+ "data-rac": ""
62
+ };
63
+ }, [
64
+ className,
65
+ style,
66
+ children,
67
+ defaultClassName,
68
+ defaultChildren,
69
+ defaultStyle,
70
+ values
71
+ ]);
72
+ }
73
+ function removeDataAttributes(props) {
74
+ const prefix = /^(data-.*)$/;
75
+ const filteredProps = {};
76
+ for (const prop in props) {
77
+ if (!prefix.test(prop)) {
78
+ filteredProps[prop] = props[prop];
79
+ }
80
+ }
81
+ return filteredProps;
82
+ }
83
+ function pickAriaAttributes(props) {
84
+ const prefix = /^(aria-.*)$/;
85
+ const filteredProps = {};
86
+ for (const prop in props) {
87
+ if (prefix.test(prop)) {
88
+ filteredProps[prop] = props[prop];
89
+ }
90
+ }
91
+ return filteredProps;
92
+ }
93
+
94
+ export { forwardRef, forwardRefGeneric, mapPropsVariants, pickAriaAttributes, removeDataAttributes, useRenderProps };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ export { TagField } from './tag-field.js';
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { createContext, useContext, createElement } from 'react';
4
+ import { tagFieldItemStyles, dataAttr } from '@opengovsg/oui-theme';
5
+ import { useContextProps } from 'react-aria-components';
6
+ import { forwardRefGeneric } from '../system/utils.js';
7
+ import { TagFieldStateContext } from './tag-field-state-context.js';
8
+
9
+ const TagFieldListContext = createContext(null);
10
+ const TagFieldListItemInner = ({ item, isHighlighted, classNames, ...itemProps }, ref) => {
11
+ const { itemToText, size } = useContext(TagFieldStateContext);
12
+ const styles = tagFieldItemStyles({ size });
13
+ return /* @__PURE__ */ jsx(
14
+ "li",
15
+ {
16
+ ref,
17
+ ...itemProps,
18
+ className: styles.container({ className: classNames?.container }),
19
+ "data-rac": true,
20
+ "data-hovered": dataAttr(isHighlighted),
21
+ children: /* @__PURE__ */ jsx("span", { className: styles.label({ className: classNames?.label }), children: itemToText(item) })
22
+ }
23
+ );
24
+ };
25
+ const TagFieldListItem = forwardRefGeneric(TagFieldListItemInner);
26
+ const TagFieldListInner = (props, ref) => {
27
+ [props, ref] = useContextProps(props, ref, TagFieldListContext);
28
+ const { items, getItemProps, highlightedIndex } = useContext(TagFieldStateContext);
29
+ const { slot, rowVirtualizer, itemClassNames, ...rest } = props;
30
+ return /* @__PURE__ */ jsx("ul", { slot: slot ?? void 0, ref, ...rest, children: props.children !== void 0 && typeof props.children !== "function" ? props.children : /* @__PURE__ */ jsxs(Fragment, { children: [
31
+ /* @__PURE__ */ jsx(
32
+ "li",
33
+ {
34
+ "aria-hidden": true,
35
+ style: { height: rowVirtualizer?.getTotalSize() }
36
+ },
37
+ "total-size"
38
+ ),
39
+ rowVirtualizer?.getVirtualItems().map((virtualRow) => {
40
+ const item = items[virtualRow.index];
41
+ const itemProps = getItemProps({
42
+ item,
43
+ index: virtualRow.index,
44
+ style: {
45
+ position: "absolute",
46
+ top: 0,
47
+ left: 0,
48
+ width: "100%",
49
+ height: virtualRow.size,
50
+ transform: `translateY(${virtualRow.start}px)`
51
+ }
52
+ });
53
+ const childProps = {
54
+ item,
55
+ isHighlighted: highlightedIndex === virtualRow.index,
56
+ key: virtualRow.key,
57
+ ...itemProps,
58
+ classNames: itemClassNames
59
+ };
60
+ if (typeof props.children === "function") {
61
+ return props.children(childProps);
62
+ }
63
+ return /* @__PURE__ */ createElement(TagFieldListItem, { ...childProps, key: childProps.key });
64
+ })
65
+ ] }) });
66
+ };
67
+ const TagFieldList = forwardRefGeneric(TagFieldListInner);
68
+
69
+ export { TagFieldList, TagFieldListContext, TagFieldListItem };