@rovula/ui 0.1.6 → 0.1.8

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 (232) hide show
  1. package/dist/cjs/bundle.css +630 -467
  2. package/dist/cjs/bundle.js +1545 -1545
  3. package/dist/cjs/bundle.js.map +1 -1
  4. package/dist/cjs/types/components/AlertDialog/AlertDialog.stories.d.ts +3 -0
  5. package/dist/cjs/types/components/Dialog/Dialog.d.ts +7 -1
  6. package/dist/cjs/types/components/Dialog/Dialog.stories.d.ts +3 -0
  7. package/dist/cjs/types/components/Dropdown/Dropdown.d.ts +2 -0
  8. package/dist/cjs/types/components/Dropdown/Dropdown.stories.d.ts +2 -0
  9. package/dist/cjs/types/components/Form/Field.d.ts +26 -0
  10. package/dist/cjs/types/components/Form/FieldMessage.d.ts +7 -0
  11. package/dist/cjs/types/components/Form/Form.d.ts +49 -11
  12. package/dist/cjs/types/components/Form/Form.stories.d.ts +23 -0
  13. package/dist/cjs/types/components/Form/ValidationHintList.d.ts +17 -0
  14. package/dist/cjs/types/components/Form/ValidationHintList.stories.d.ts +9 -0
  15. package/dist/cjs/types/components/Form/index.d.ts +10 -0
  16. package/dist/cjs/types/components/Form/useOptionBridge.d.ts +17 -0
  17. package/dist/cjs/types/components/OtpInput/OtpInput.d.ts +17 -0
  18. package/dist/cjs/types/components/OtpInput/OtpInput.stories.d.ts +15 -0
  19. package/dist/cjs/types/components/OtpInput/OtpInputGroup.d.ts +25 -0
  20. package/dist/cjs/types/components/OtpInput/index.d.ts +5 -0
  21. package/dist/cjs/types/components/TextInput/TextInput.styles.d.ts +3 -0
  22. package/dist/cjs/types/index.d.ts +5 -0
  23. package/dist/cjs/types/theme/ThemeColorCoverageRuntime.stories.d.ts +10 -0
  24. package/dist/cjs/types/utils/colors.d.ts +351 -267
  25. package/dist/components/ActionButton/ActionButton.stories.js +2 -2
  26. package/dist/components/ActionButton/ActionButton.styles.js +1 -1
  27. package/dist/components/AlertDialog/AlertDialog.js +6 -6
  28. package/dist/components/AlertDialog/AlertDialog.stories.js +3 -0
  29. package/dist/components/Avatar/Avatar.stories.js +1 -1
  30. package/dist/components/Avatar/Avatar.styles.js +1 -1
  31. package/dist/components/Avatar/AvatarBase.js +1 -1
  32. package/dist/components/Avatar/AvatarGroup.stories.js +1 -1
  33. package/dist/components/Button/Buttons.stories.js +2 -2
  34. package/dist/components/Calendar/Calendar.js +1 -1
  35. package/dist/components/Checkbox/Checkbox.js +1 -1
  36. package/dist/components/Checkbox/Checkbox.stories.js +17 -7
  37. package/dist/components/Collapsible/Collapsible.styles.js +1 -1
  38. package/dist/components/DataTable/DataTable.js +2 -2
  39. package/dist/components/Dialog/Dialog.js +12 -7
  40. package/dist/components/Dialog/Dialog.stories.js +90 -2
  41. package/dist/components/Dropdown/Dropdown.js +2 -2
  42. package/dist/components/DropdownMenu/DropdownMenu.js +3 -3
  43. package/dist/components/FocusedScrollView/FocusedScrollView.stories.js +6 -6
  44. package/dist/components/Form/Field.js +60 -0
  45. package/dist/components/Form/FieldMessage.js +24 -0
  46. package/dist/components/Form/Form.js +73 -41
  47. package/dist/components/Form/Form.stories.js +221 -0
  48. package/dist/components/Form/ValidationHintList.js +30 -0
  49. package/dist/components/Form/ValidationHintList.stories.js +50 -0
  50. package/dist/components/Form/index.js +5 -0
  51. package/dist/components/Form/useOptionBridge.js +27 -0
  52. package/dist/components/InputFilter/InputFilter.js +5 -4
  53. package/dist/components/InputFilter/InputFilter.stories.js +1 -1
  54. package/dist/components/InputFilter/InputFilter.styles.js +14 -1
  55. package/dist/components/Label/Label.styles.js +1 -1
  56. package/dist/components/Menu/Menu.js +2 -2
  57. package/dist/components/NumberInput/NumberInput.stories.js +1 -1
  58. package/dist/components/OtpInput/OtpInput.js +118 -0
  59. package/dist/components/OtpInput/OtpInput.stories.js +60 -0
  60. package/dist/components/OtpInput/OtpInputGroup.js +23 -0
  61. package/dist/components/OtpInput/index.js +3 -0
  62. package/dist/components/PasswordInput/PasswordInput.stories.js +1 -1
  63. package/dist/components/Popover/Popover.js +1 -1
  64. package/dist/components/RadioGroup/RadioGroup.js +1 -1
  65. package/dist/components/RadioGroup/RadioGroup.stories.js +2 -2
  66. package/dist/components/Search/Search.js +13 -1
  67. package/dist/components/Search/Search.stories.js +1 -1
  68. package/dist/components/Slider/Slider.js +1 -1
  69. package/dist/components/Slider/Slider.stories.js +5 -5
  70. package/dist/components/Switch/Switch.stories.js +2 -2
  71. package/dist/components/Switch/Switch.styles.js +1 -1
  72. package/dist/components/Table/Table.js +5 -5
  73. package/dist/components/Tabs/Tabs.js +12 -9
  74. package/dist/components/Tabs/Tabs.stories.js +1 -1
  75. package/dist/components/Text/Text.js +1 -1
  76. package/dist/components/Text/Text.stories.js +1 -1
  77. package/dist/components/TextArea/TextArea.stories.js +1 -1
  78. package/dist/components/TextArea/TextArea.styles.js +3 -3
  79. package/dist/components/TextInput/TextInput.js +3 -2
  80. package/dist/components/TextInput/TextInput.stories.js +3 -3
  81. package/dist/components/TextInput/TextInput.styles.js +41 -19
  82. package/dist/components/Toast/Toast.js +4 -2
  83. package/dist/components/Toast/Toast.stories.js +1 -1
  84. package/dist/components/Toast/Toast.styles.js +4 -4
  85. package/dist/components/Toast/Toaster.js +2 -2
  86. package/dist/components/Tree/Tree.stories.js +1 -1
  87. package/dist/components/Tree/TreeItem.js +1 -1
  88. package/dist/esm/bundle.css +630 -467
  89. package/dist/esm/bundle.js +1545 -1545
  90. package/dist/esm/bundle.js.map +1 -1
  91. package/dist/esm/types/components/AlertDialog/AlertDialog.stories.d.ts +3 -0
  92. package/dist/esm/types/components/Dialog/Dialog.d.ts +7 -1
  93. package/dist/esm/types/components/Dialog/Dialog.stories.d.ts +3 -0
  94. package/dist/esm/types/components/Dropdown/Dropdown.d.ts +2 -0
  95. package/dist/esm/types/components/Dropdown/Dropdown.stories.d.ts +2 -0
  96. package/dist/esm/types/components/Form/Field.d.ts +26 -0
  97. package/dist/esm/types/components/Form/FieldMessage.d.ts +7 -0
  98. package/dist/esm/types/components/Form/Form.d.ts +49 -11
  99. package/dist/esm/types/components/Form/Form.stories.d.ts +23 -0
  100. package/dist/esm/types/components/Form/ValidationHintList.d.ts +17 -0
  101. package/dist/esm/types/components/Form/ValidationHintList.stories.d.ts +9 -0
  102. package/dist/esm/types/components/Form/index.d.ts +10 -0
  103. package/dist/esm/types/components/Form/useOptionBridge.d.ts +17 -0
  104. package/dist/esm/types/components/OtpInput/OtpInput.d.ts +17 -0
  105. package/dist/esm/types/components/OtpInput/OtpInput.stories.d.ts +15 -0
  106. package/dist/esm/types/components/OtpInput/OtpInputGroup.d.ts +25 -0
  107. package/dist/esm/types/components/OtpInput/index.d.ts +5 -0
  108. package/dist/esm/types/components/TextInput/TextInput.styles.d.ts +3 -0
  109. package/dist/esm/types/index.d.ts +5 -0
  110. package/dist/esm/types/theme/ThemeColorCoverageRuntime.stories.d.ts +10 -0
  111. package/dist/esm/types/utils/colors.d.ts +351 -267
  112. package/dist/index.d.ts +512 -269
  113. package/dist/index.js +3 -0
  114. package/dist/src/theme/global.css +2739 -2681
  115. package/dist/theme/ThemeColorCoverageRuntime.stories.js +91 -0
  116. package/dist/utils/colors.js +359 -267
  117. package/package.json +4 -2
  118. package/src/components/ActionButton/ActionButton.stories.tsx +6 -6
  119. package/src/components/ActionButton/ActionButton.styles.ts +1 -1
  120. package/src/components/AlertDialog/AlertDialog.stories.tsx +22 -0
  121. package/src/components/AlertDialog/AlertDialog.tsx +6 -6
  122. package/src/components/Avatar/Avatar.stories.tsx +1 -1
  123. package/src/components/Avatar/Avatar.styles.ts +1 -1
  124. package/src/components/Avatar/AvatarBase.tsx +1 -1
  125. package/src/components/Avatar/AvatarGroup.stories.tsx +1 -1
  126. package/src/components/Button/Buttons.stories.tsx +25 -17
  127. package/src/components/Calendar/Calendar.tsx +3 -3
  128. package/src/components/Checkbox/Checkbox.stories.tsx +35 -12
  129. package/src/components/Checkbox/Checkbox.tsx +7 -5
  130. package/src/components/Collapsible/Collapsible.styles.ts +1 -1
  131. package/src/components/DataTable/DataTable.tsx +2 -2
  132. package/src/components/Dialog/Dialog.stories.tsx +173 -0
  133. package/src/components/Dialog/Dialog.tsx +32 -15
  134. package/src/components/Dropdown/Dropdown.styles.ts +1 -1
  135. package/src/components/Dropdown/Dropdown.tsx +16 -14
  136. package/src/components/DropdownMenu/DropdownMenu.tsx +3 -3
  137. package/src/components/FocusedScrollView/FocusedScrollView.stories.tsx +10 -10
  138. package/src/components/Form/Field.tsx +160 -0
  139. package/src/components/Form/FieldMessage.tsx +38 -0
  140. package/src/components/Form/Form.docs.mdx +67 -0
  141. package/src/components/Form/Form.stories.tsx +490 -0
  142. package/src/components/Form/Form.tsx +185 -87
  143. package/src/components/Form/README.md +284 -0
  144. package/src/components/Form/ValidationHintList.stories.tsx +118 -0
  145. package/src/components/Form/ValidationHintList.tsx +82 -0
  146. package/src/components/Form/index.ts +28 -0
  147. package/src/components/Form/useOptionBridge.ts +55 -0
  148. package/src/components/InputFilter/InputFilter.stories.tsx +1 -1
  149. package/src/components/InputFilter/InputFilter.styles.ts +14 -1
  150. package/src/components/InputFilter/InputFilter.tsx +33 -28
  151. package/src/components/Label/Label.styles.ts +2 -2
  152. package/src/components/Label/Label.tsx +1 -1
  153. package/src/components/Menu/Menu.tsx +12 -12
  154. package/src/components/NumberInput/NumberInput.stories.tsx +1 -1
  155. package/src/components/OtpInput/OtpInput.stories.tsx +168 -0
  156. package/src/components/OtpInput/OtpInput.tsx +210 -0
  157. package/src/components/OtpInput/OtpInputGroup.tsx +74 -0
  158. package/src/components/OtpInput/index.ts +5 -0
  159. package/src/components/PasswordInput/PasswordInput.stories.tsx +1 -1
  160. package/src/components/Popover/Popover.tsx +1 -1
  161. package/src/components/RadioGroup/RadioGroup.stories.tsx +4 -4
  162. package/src/components/RadioGroup/RadioGroup.tsx +2 -1
  163. package/src/components/Search/Search.stories.tsx +1 -1
  164. package/src/components/Search/Search.tsx +6 -2
  165. package/src/components/Slider/Slider.stories.tsx +7 -7
  166. package/src/components/Slider/Slider.tsx +1 -1
  167. package/src/components/Switch/Switch.stories.tsx +4 -4
  168. package/src/components/Switch/Switch.styles.ts +1 -1
  169. package/src/components/Table/Table.tsx +5 -5
  170. package/src/components/Tabs/Tabs.stories.tsx +1 -1
  171. package/src/components/Tabs/Tabs.tsx +29 -18
  172. package/src/components/Text/Text.stories.tsx +1 -1
  173. package/src/components/Text/Text.tsx +1 -1
  174. package/src/components/TextArea/TextArea.stories.tsx +1 -1
  175. package/src/components/TextArea/TextArea.styles.ts +3 -3
  176. package/src/components/TextInput/TextInput.stories.tsx +7 -7
  177. package/src/components/TextInput/TextInput.styles.ts +42 -19
  178. package/src/components/TextInput/TextInput.tsx +3 -1
  179. package/src/components/Toast/Toast.stories.tsx +1 -1
  180. package/src/components/Toast/Toast.styles.tsx +7 -7
  181. package/src/components/Toast/Toast.tsx +5 -4
  182. package/src/components/Toast/Toaster.tsx +17 -20
  183. package/src/components/Tree/Tree.stories.tsx +1 -1
  184. package/src/components/Tree/TreeItem.tsx +1 -1
  185. package/src/index.ts +5 -0
  186. package/src/theme/THEME_MAPPING.md +36 -37
  187. package/src/theme/ThemeColorCoverageRuntime.stories.tsx +236 -0
  188. package/src/theme/direct-token-migration-plan.md +121 -0
  189. package/src/theme/figma-mcp-check-report.md +225 -0
  190. package/src/theme/figma-mcp-component-checklist.json +1250 -0
  191. package/src/theme/global.css +7 -3
  192. package/src/theme/presets/colors.js +173 -64
  193. package/src/theme/themes/skyller/baseline.css +0 -4
  194. package/src/theme/themes/variable-mapping.css +1064 -0
  195. package/src/theme/themes/variable.css +248 -230
  196. package/src/theme/themes/xspector/baseline.css +0 -4
  197. package/src/theme/themes/xspector/components/dropdown-menu.css +4 -4
  198. package/src/theme/themes/xspector/components/loading.css +2 -2
  199. package/src/theme/tokens/baseline.css +0 -3
  200. package/src/theme/tokens/color.css +36 -65
  201. package/src/theme/tokens/components/action-button.css +6 -6
  202. package/src/theme/tokens/components/button.css +189 -189
  203. package/src/theme/tokens/components/dropdown-menu.css +5 -5
  204. package/src/theme/tokens/components/footer.css +1 -1
  205. package/src/theme/tokens/components/loading.css +2 -2
  206. package/src/theme/tokens/components/switch.css +11 -11
  207. package/src/theme/tokens/typography.css +28 -28
  208. package/src/theme/tokens_old/baseline.css +13 -0
  209. package/src/theme/tokens_old/color.css +78 -0
  210. package/src/theme/tokens_old/components/action-button.css +127 -0
  211. package/src/theme/tokens_old/components/button.css +512 -0
  212. package/src/theme/tokens_old/components/dropdown-menu.css +27 -0
  213. package/src/theme/tokens_old/components/footer.css +9 -0
  214. package/src/theme/tokens_old/components/loading.css +11 -0
  215. package/src/theme/tokens_old/components/navbar.css +9 -0
  216. package/src/theme/tokens_old/components/progress-bar.css +8 -0
  217. package/src/theme/tokens_old/components/switch.css +29 -0
  218. package/src/theme/tokens_old/typography.css +199 -0
  219. package/src/theme/tokens_old/variables.css +28 -0
  220. package/src/theme/utils.js +172 -33
  221. package/src/utils/colors.ts +367 -278
  222. package/src/theme/themes/skyller/color.css +0 -79
  223. package/src/theme/themes/skyller/palette.css +0 -143
  224. package/src/theme/themes/skyller/state.css +0 -94
  225. package/src/theme/themes/skyller/transparent.css +0 -94
  226. package/src/theme/themes/xspector/color.css +0 -83
  227. package/src/theme/themes/xspector/palette.css +0 -142
  228. package/src/theme/themes/xspector/state.css +0 -94
  229. package/src/theme/themes/xspector/transparent.css +0 -93
  230. /package/src/theme/{tokens → tokens_old}/palette.css +0 -0
  231. /package/src/theme/{tokens → tokens_old}/state.css +0 -0
  232. /package/src/theme/{tokens → tokens_old}/transparent.css +0 -0
@@ -16,7 +16,7 @@ const meta = {
16
16
  layout: "fullscreen",
17
17
  },
18
18
  decorators: [
19
- (Story) => (_jsx("div", { className: "p-5 bg-base-bg2", children: _jsx(Story, {}) })),
19
+ (Story) => (_jsx("div", { className: "p-5 bg-bg-bg2", children: _jsx(Story, {}) })),
20
20
  ],
21
21
  };
22
22
  export default meta;
@@ -59,7 +59,7 @@ const forcedStateClassName = {
59
59
  disable: {},
60
60
  };
61
61
  const icon = _jsx(ArrowsUpDownIcon, {});
62
- const renderPreview = (shape) => (_jsx("div", { className: "bg-base-bg2 p-8 min-h-screen", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsx("h3", { className: "text-xl font-semibold tracking-wide text-text-white", children: "Function button" }), previewStates.map((state) => (_jsxs("div", { className: "grid grid-cols-[120px_repeat(3,minmax(0,1fr))] items-stretch gap-4", children: [_jsx("span", { className: "pt-3 text-sm font-semibold text-text-white", children: state.label }), previewVariants.map((previewVariant) => (_jsxs("div", { className: "h-full rounded-lg border border-base-bg-stroke1 bg-base-bg1 p-3", children: [_jsx("span", { className: "text-xs font-semibold tracking-wide text-text-white uppercase", children: previewVariant.label }), _jsx("div", { className: "mt-3 flex flex-wrap items-center gap-2", children: previewVariant.sizes.map((size) => (_jsx(ActionButton, { variant: previewVariant.variant, size: size, shape: shape, active: state.key === "active" || state.key === "active-hover", disabled: state.key === "disable", className: forcedStateClassName[state.key][previewVariant.variant], children: icon }, `${previewVariant.variant}-${size}-${state.key}`))) })] }, previewVariant.variant)))] }, state.key)))] }) }));
62
+ const renderPreview = (shape) => (_jsx("div", { className: "bg-bg-bg2 p-8 min-h-screen", children: _jsxs("div", { className: "flex flex-col gap-6", children: [_jsx("h3", { className: "text-xl font-semibold tracking-wide text-text-contrast-max", children: "Function button" }), previewStates.map((state) => (_jsxs("div", { className: "grid grid-cols-[120px_repeat(3,minmax(0,1fr))] items-stretch gap-4", children: [_jsx("span", { className: "pt-3 text-sm font-semibold text-text-contrast-max", children: state.label }), previewVariants.map((previewVariant) => (_jsxs("div", { className: "h-full rounded-lg border border-bg-stroke1 bg-bg-bg1 p-3", children: [_jsx("span", { className: "text-xs font-semibold tracking-wide text-text-contrast-max uppercase", children: previewVariant.label }), _jsx("div", { className: "mt-3 flex flex-wrap items-center gap-2", children: previewVariant.sizes.map((size) => (_jsx(ActionButton, { variant: previewVariant.variant, size: size, shape: shape, active: state.key === "active" || state.key === "active-hover", disabled: state.key === "disable", className: forcedStateClassName[state.key][previewVariant.variant], children: icon }, `${previewVariant.variant}-${size}-${state.key}`))) })] }, previewVariant.variant)))] }, state.key)))] }) }));
63
63
  export const FigmaPreview = {
64
64
  render: () => renderPreview("round"),
65
65
  };
@@ -103,7 +103,7 @@ export const actionButtonVariants = cva(["box-border flex items-center justify-c
103
103
  {
104
104
  size: "xxs",
105
105
  variant: "icon",
106
- className: "px-[1px] py-[1px] [&_svg]:size-[12px]",
106
+ className: "px-[1px] py-[1px] [&_svg]:size-[10px]",
107
107
  },
108
108
  {
109
109
  size: "xs",
@@ -20,32 +20,32 @@ const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
20
20
  const AlertDialogPortal = AlertDialogPrimitive.Portal;
21
21
  const AlertDialogOverlay = React.forwardRef((_a, ref) => {
22
22
  var { className } = _a, props = __rest(_a, ["className"]);
23
- return (_jsx(AlertDialogPrimitive.Overlay, Object.assign({ className: cn("fixed inset-0 bg-base-popup-curtain z-50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className) }, props, { ref: ref })));
23
+ return (_jsx(AlertDialogPrimitive.Overlay, Object.assign({ className: cn("fixed inset-0 bg-modal-overlay z-50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className) }, props, { ref: ref })));
24
24
  });
25
25
  AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
26
26
  const AlertDialogContent = React.forwardRef((_a, ref) => {
27
27
  var { className } = _a, props = __rest(_a, ["className"]);
28
- return (_jsxs(AlertDialogPortal, { children: [_jsx(AlertDialogOverlay, {}), _jsx(AlertDialogPrimitive.Content, Object.assign({ ref: ref, className: cn("fixed text-base-popup-foreground left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-6 border border-base-popup bg-base-popup p-8 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-md", className) }, props))] }));
28
+ return (_jsxs(AlertDialogPortal, { children: [_jsx(AlertDialogOverlay, {}), _jsx(AlertDialogPrimitive.Content, Object.assign({ ref: ref, className: cn("fixed left-[50%] top-[50%] z-50 grid w-[calc(100%-32px)] max-w-[460px] translate-x-[-50%] translate-y-[-50%] gap-8 rounded-md bg-modal-surface px-6 py-8 text-text-contrast-max shadow-[0px_12px_24px_-4px_rgba(0,0,0,0.12)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]", className) }, props))] }));
29
29
  });
30
30
  AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
31
31
  const AlertDialogHeader = (_a) => {
32
32
  var { className } = _a, props = __rest(_a, ["className"]);
33
- return (_jsx("div", Object.assign({ className: cn("flex flex-col space-y-2 text-center sm:text-left", className) }, props)));
33
+ return (_jsx("div", Object.assign({ className: cn("flex flex-col items-center gap-2 text-center", className) }, props)));
34
34
  };
35
35
  AlertDialogHeader.displayName = "AlertDialogHeader";
36
36
  const AlertDialogFooter = (_a) => {
37
37
  var { className } = _a, props = __rest(_a, ["className"]);
38
- return (_jsx("div", Object.assign({ className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className) }, props)));
38
+ return (_jsx("div", Object.assign({ className: cn("flex flex-col-reverse items-center justify-center gap-3 sm:flex-row sm:gap-4", className) }, props)));
39
39
  };
40
40
  AlertDialogFooter.displayName = "AlertDialogFooter";
41
41
  const AlertDialogTitle = React.forwardRef((_a, ref) => {
42
42
  var { className } = _a, props = __rest(_a, ["className"]);
43
- return (_jsx(AlertDialogPrimitive.Title, Object.assign({ ref: ref, className: cn("typography-h5", className) }, props)));
43
+ return (_jsx(AlertDialogPrimitive.Title, Object.assign({ ref: ref, className: cn("typography-subtitle3 text-text-contrast-max", className) }, props)));
44
44
  });
45
45
  AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
46
46
  const AlertDialogDescription = React.forwardRef((_a, ref) => {
47
47
  var { className } = _a, props = __rest(_a, ["className"]);
48
- return (_jsx(AlertDialogPrimitive.Description, Object.assign({ ref: ref, className: cn("text-sm", className) }, props)));
48
+ return (_jsx(AlertDialogPrimitive.Description, Object.assign({ ref: ref, className: cn("typography-small1 text-text-contrast-max", className) }, props)));
49
49
  });
50
50
  AlertDialogDescription.displayName =
51
51
  AlertDialogPrimitive.Description.displayName;
@@ -38,3 +38,6 @@ export const CustomStyle = {
38
38
  return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsxs(AlertDialog, { children: [_jsx(AlertDialogTrigger, { children: "Open" }), _jsxs(AlertDialogContent, { className: "justify-center text-center", children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { className: "text-center", children: "Are you absolutely sure?" }), _jsx(AlertDialogDescription, { className: "text-center", children: "This action cannot be undone. This will permanently delete your account and remove your data from our servers." })] }), _jsxs(AlertDialogFooter, { className: "flex sm:justify-stretch", children: [_jsx(AlertDialogCancel, { className: "flex-1 justify-center", children: "Cancel" }), _jsx(AlertDialogAction, { className: "flex-1 justify-center", children: "Continue" })] })] })] }) }));
39
39
  },
40
40
  };
41
+ export const FigmaFail = {
42
+ render: () => (_jsx("div", { className: "flex w-full", children: _jsx(AlertDialog, { defaultOpen: true, children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: "Infomation update failed" }), _jsx(AlertDialogDescription, { children: "Please login again and complete your profile to activate your account." })] }), _jsx(AlertDialogFooter, { children: _jsx(AlertDialogAction, { className: "w-[140px] justify-center", children: "Try again" }) })] }) }) })),
43
+ };
@@ -31,6 +31,6 @@ export const Preview = {
31
31
  console.log("args ", args);
32
32
  const props = Object.assign({}, args);
33
33
  const BORDER = ["full", "normal", "none"];
34
- return (_jsxs("div", { className: "flex flex-col gap-2 w-full bg-black p-20", children: [BORDER.map((rounded) => (_jsxs("div", { className: "flex flex-row items-center gap-3", children: [_jsx(Avatar, { size: "xxs", rounded: rounded, type: "image", imageUrl: "https://i.pravatar.cc/300?img=59", fallback: "AS" }), _jsx(Avatar, { size: "xs", rounded: rounded, type: "image", imageUrl: "https://i.pravatar.cc/300?img=59", fallback: "AS" }), _jsx(Avatar, { size: "sm", rounded: rounded, type: "image", imageUrl: "https://i.pravatar.cc/300?img=59", fallback: "AS" }), _jsx(Avatar, { size: "md", rounded: rounded, type: "image", imageUrl: "https://i.pravatar.cc/300?img=59", fallback: "AS" }), _jsx(Avatar, { size: "lg", rounded: rounded, type: "image", imageUrl: "https://i.pravatar.cc/300?img=59", fallback: "AS" })] }, rounded))), BORDER.map((rounded) => (_jsxs("div", { className: "flex flex-row items-center gap-3", children: [_jsx(Avatar, { size: "xxs", rounded: rounded, type: "text", text: "AS" }), _jsx(Avatar, { size: "xs", rounded: rounded, type: "text", text: "AS" }), _jsx(Avatar, { size: "sm", rounded: rounded, type: "text", text: "AS" }), _jsx(Avatar, { size: "md", rounded: rounded, type: "text", text: "AS" }), _jsx(Avatar, { size: "lg", rounded: rounded, type: "text", text: "AS" })] }, rounded)))] }));
34
+ return (_jsxs("div", { className: "flex flex-col gap-2 w-full bg-bg-bg2 p-20", children: [BORDER.map((rounded) => (_jsxs("div", { className: "flex flex-row items-center gap-3", children: [_jsx(Avatar, { size: "xxs", rounded: rounded, type: "image", imageUrl: "https://i.pravatar.cc/300?img=59", fallback: "AS" }), _jsx(Avatar, { size: "xs", rounded: rounded, type: "image", imageUrl: "https://i.pravatar.cc/300?img=59", fallback: "AS" }), _jsx(Avatar, { size: "sm", rounded: rounded, type: "image", imageUrl: "https://i.pravatar.cc/300?img=59", fallback: "AS" }), _jsx(Avatar, { size: "md", rounded: rounded, type: "image", imageUrl: "https://i.pravatar.cc/300?img=59", fallback: "AS" }), _jsx(Avatar, { size: "lg", rounded: rounded, type: "image", imageUrl: "https://i.pravatar.cc/300?img=59", fallback: "AS" })] }, rounded))), BORDER.map((rounded) => (_jsxs("div", { className: "flex flex-row items-center gap-3", children: [_jsx(Avatar, { size: "xxs", rounded: rounded, type: "text", text: "AS" }), _jsx(Avatar, { size: "xs", rounded: rounded, type: "text", text: "AS" }), _jsx(Avatar, { size: "sm", rounded: rounded, type: "text", text: "AS" }), _jsx(Avatar, { size: "md", rounded: rounded, type: "text", text: "AS" }), _jsx(Avatar, { size: "lg", rounded: rounded, type: "text", text: "AS" })] }, rounded)))] }));
35
35
  },
36
36
  };
@@ -1,6 +1,6 @@
1
1
  import { cva } from "class-variance-authority";
2
2
  export const avatarVariants = cva([
3
- "flex items-center justify-center bg-grey2-700 text-foreground typography-subtitle2 truncate",
3
+ "flex items-center justify-center bg-grey2-700 text-common-black typography-subtitle2 truncate",
4
4
  ], {
5
5
  variants: {
6
6
  size: {
@@ -26,7 +26,7 @@ const AvatarImage = React.forwardRef((_a, ref) => {
26
26
  AvatarImage.displayName = AvatarPrimitive.Image.displayName;
27
27
  const AvatarFallback = React.forwardRef((_a, ref) => {
28
28
  var { className } = _a, props = __rest(_a, ["className"]);
29
- return (_jsx(AvatarPrimitive.Fallback, Object.assign({ ref: ref, className: cn("flex h-full w-full items-center justify-center rounded-full bg-muted", className) }, props)));
29
+ return (_jsx(AvatarPrimitive.Fallback, Object.assign({ ref: ref, className: cn("flex h-full w-full items-center justify-center rounded-full bg-inherit text-inherit", className) }, props)));
30
30
  });
31
31
  AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
32
32
  export { AvatarBase, AvatarImage, AvatarFallback };
@@ -31,6 +31,6 @@ export const Preview = {
31
31
  render: (args) => {
32
32
  console.log("args ", args);
33
33
  const props = Object.assign({}, args);
34
- return (_jsx("div", { className: "flex flex-col gap-2 w-full bg-black p-20", children: _jsx("div", { className: "flex flex-row items-center gap-3", children: _jsxs(AvatarGroup, { children: [_jsx(Avatar, { size: "lg", rounded: "full", type: "text", text: "AS" }), _jsx(Avatar, { size: "lg", rounded: "full", type: "text", text: "AS" }), _jsx(Avatar, { size: "lg", rounded: "full", type: "image", imageUrl: "https://i.pravatar.cc/300?img=59", fallback: "AS" }), _jsx(Avatar, { size: "lg", rounded: "full", type: "text", text: "AS" }), _jsx(Avatar, { size: "lg", rounded: "full", type: "text", text: "AS" })] }) }) }));
34
+ return (_jsx("div", { className: "flex flex-col gap-2 w-full bg-bg-bg2 p-20", children: _jsx("div", { className: "flex flex-row items-center gap-3", children: _jsxs(AvatarGroup, { children: [_jsx(Avatar, { size: "lg", rounded: "full", type: "text", text: "AS" }), _jsx(Avatar, { size: "lg", rounded: "full", type: "text", text: "AS" }), _jsx(Avatar, { size: "lg", rounded: "full", type: "image", imageUrl: "https://i.pravatar.cc/300?img=59", fallback: "AS" }), _jsx(Avatar, { size: "lg", rounded: "full", type: "text", text: "AS" }), _jsx(Avatar, { size: "lg", rounded: "full", type: "text", text: "AS" })] }) }) }));
35
35
  },
36
36
  };
@@ -111,8 +111,8 @@ const previewStates = [
111
111
  { label: "Disable", isLoading: false, disabled: true },
112
112
  ];
113
113
  export const FigmaPreview = {
114
- render: () => (_jsx("div", { className: "bg-base-bg2 p-8 min-h-screen", children: _jsx("div", { className: "flex flex-col gap-10", children: previewColors.map((color) => (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs("h3", { className: "text-xl font-semibold tracking-wide text-text-white capitalize", children: [color, " btn"] }), previewStates.map((state) => (_jsx("div", { className: "grid grid-cols-[repeat(3,minmax(0,1fr))] items-stretch gap-2", children: previewStyles.map((style) => (_jsxs("div", { className: "h-full rounded-lg border border-base-bg-stroke1 bg-base-bg1 p-3", children: [_jsxs("span", { className: "text-xs font-semibold tracking-wide text-text-white uppercase", children: [style.label, " (", state.label, ")"] }), _jsx("div", { className: "mt-3 flex flex-col gap-2", children: previewSizes.map((size) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Button, { color: color, variant: style.variant, size: size, title: previewSizeLabel[size], startIcon: icon, isLoading: state.isLoading, disabled: state.disabled, fullwidth: false }), _jsx(Button, { color: color, variant: style.variant, size: size, title: previewSizeLabel[size], isLoading: state.isLoading, disabled: state.disabled, fullwidth: false }), _jsx(Button, { color: color, variant: style.variant, size: size, title: previewSizeLabel[size], endIcon: icon, isLoading: state.isLoading, disabled: state.disabled, fullwidth: false })] }, size))) })] }, style.label))) }, state.label)))] }, color))) }) })),
114
+ render: () => (_jsx("div", { className: "bg-bg-bg2 p-8 min-h-screen", children: _jsx("div", { className: "flex flex-col gap-10", children: previewColors.map((color) => (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs("h3", { className: "text-xl font-semibold tracking-wide text-text-contrast-max capitalize", children: [color, " btn"] }), previewStates.map((state) => (_jsx("div", { className: "grid grid-cols-[repeat(3,minmax(0,1fr))] items-stretch gap-2", children: previewStyles.map((style) => (_jsxs("div", { className: "h-full rounded-lg border border-bg-stroke1 bg-bg-bg1 p-3", children: [_jsxs("span", { className: "text-xs font-semibold tracking-wide text-text-contrast-max uppercase", children: [style.label, " (", state.label, ")"] }), _jsx("div", { className: "mt-3 flex flex-col gap-2", children: previewSizes.map((size) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Button, { color: color, variant: style.variant, size: size, title: previewSizeLabel[size], startIcon: icon, isLoading: state.isLoading, disabled: state.disabled, fullwidth: false }), _jsx(Button, { color: color, variant: style.variant, size: size, title: previewSizeLabel[size], isLoading: state.isLoading, disabled: state.disabled, fullwidth: false }), _jsx(Button, { color: color, variant: style.variant, size: size, title: previewSizeLabel[size], endIcon: icon, isLoading: state.isLoading, disabled: state.disabled, fullwidth: false })] }, size))) })] }, style.label))) }, state.label)))] }, color))) }) })),
115
115
  };
116
116
  export const FigmaPreviewCapsule = {
117
- render: () => (_jsx("div", { className: "bg-base-bg2 p-8 min-h-screen", children: _jsx("div", { className: "flex flex-col gap-10", children: previewColors.map((color) => (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("h3", { className: "text-xl font-semibold tracking-wide text-text-white capitalize", children: [color, " btn"] }), previewStates.map((state) => (_jsx("div", { className: "grid grid-cols-[repeat(3,minmax(0,1fr))] items-stretch gap-4", children: previewStyles.map((style) => (_jsxs("div", { className: "h-full rounded-lg border border-base-bg-stroke1 bg-base-bg1 p-3", children: [_jsxs("span", { className: "text-xs font-semibold tracking-wide text-text-white uppercase", children: [style.label, " (", state.label, ")"] }), _jsx("div", { className: "mt-3 flex flex-col gap-2", children: previewSizes.map((size) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Button, { color: color, variant: style.variant, size: size, shape: "capsule", title: previewSizeLabel[size], startIcon: icon, isLoading: state.isLoading, disabled: state.disabled, fullwidth: false }), _jsx(Button, { color: color, variant: style.variant, size: size, shape: "capsule", title: previewSizeLabel[size], isLoading: state.isLoading, disabled: state.disabled, fullwidth: false }), _jsx(Button, { color: color, variant: style.variant, size: size, shape: "capsule", title: previewSizeLabel[size], endIcon: icon, isLoading: state.isLoading, disabled: state.disabled, fullwidth: false })] }, size))) })] }, style.label))) }, state.label)))] }, color))) }) })),
117
+ render: () => (_jsx("div", { className: "bg-bg-bg2 p-8 min-h-screen", children: _jsx("div", { className: "flex flex-col gap-10", children: previewColors.map((color) => (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("h3", { className: "text-xl font-semibold tracking-wide text-text-contrast-max capitalize", children: [color, " btn"] }), previewStates.map((state) => (_jsx("div", { className: "grid grid-cols-[repeat(3,minmax(0,1fr))] items-stretch gap-4", children: previewStyles.map((style) => (_jsxs("div", { className: "h-full rounded-lg border border-bg-stroke1 bg-bg-bg1 p-3", children: [_jsxs("span", { className: "text-xs font-semibold tracking-wide text-text-contrast-max uppercase", children: [style.label, " (", state.label, ")"] }), _jsx("div", { className: "mt-3 flex flex-col gap-2", children: previewSizes.map((size) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Button, { color: color, variant: style.variant, size: size, shape: "capsule", title: previewSizeLabel[size], startIcon: icon, isLoading: state.isLoading, disabled: state.disabled, fullwidth: false }), _jsx(Button, { color: color, variant: style.variant, size: size, shape: "capsule", title: previewSizeLabel[size], isLoading: state.isLoading, disabled: state.disabled, fullwidth: false }), _jsx(Button, { color: color, variant: style.variant, size: size, shape: "capsule", title: previewSizeLabel[size], endIcon: icon, isLoading: state.isLoading, disabled: state.disabled, fullwidth: false })] }, size))) })] }, style.label))) }, state.label)))] }, color))) }) })),
118
118
  };
@@ -17,7 +17,7 @@ import { cn } from "@/utils/cn";
17
17
  function Calendar(_a) {
18
18
  var { className, classNames, showOutsideDays = true } = _a, props = __rest(_a, ["className", "classNames", "showOutsideDays"]);
19
19
  const defaultClassNames = getDefaultClassNames();
20
- return (_jsx(DayPicker, Object.assign({ showOutsideDays: showOutsideDays, captionLayout: "dropdown-years" }, props, { className: cn("bg-surface text-surface-foreground border-surface", className), classNames: Object.assign(Object.assign(Object.assign({}, defaultClassNames), { day_button: cn(defaultClassNames.day_button, "size-9"), day: "typography-subtitle1 ", today: "text-bold text-surface-foreground [&_button]:rounded-full [&_button]:!border-primary [&_button]:!border [&_button]:!border-solid", selected: "bg-primary !text-primary-foreground rounded-full ", weekdays: "text-gray-400", month_caption: cn(defaultClassNames.month_caption, "h-[54px]"), outside: "text-gray-400", nav: cn(defaultClassNames.nav, "gap-6 absolute flex right-0"), chevron: "fill-primary", root: cn(defaultClassNames.root, "px-6 py-4"), caption_label: cn(defaultClassNames.caption_label, "gap-2 flex items-center"), months: "flex flex-col relative", disabled: "[&_button]:rounded-full [&_button]:!text-input-disable-text" }), classNames), styles: {
20
+ return (_jsx(DayPicker, Object.assign({ showOutsideDays: showOutsideDays, captionLayout: "dropdown-years" }, props, { className: cn("bg-bg-bg1 text-common-black border-bg-bg1", className), classNames: Object.assign(Object.assign(Object.assign({}, defaultClassNames), { day_button: cn(defaultClassNames.day_button, "size-9"), day: "typography-subtitle1 ", today: "text-bold text-common-black [&_button]:rounded-full [&_button]:!border-primary [&_button]:!border [&_button]:!border-solid", selected: "bg-primary !text-state-primary-text-solid rounded-full ", weekdays: "text-gray-400", month_caption: cn(defaultClassNames.month_caption, "h-[54px]"), outside: "text-gray-400", nav: cn(defaultClassNames.nav, "gap-6 absolute flex right-0"), chevron: "fill-primary", root: cn(defaultClassNames.root, "px-6 py-4"), caption_label: cn(defaultClassNames.caption_label, "gap-2 flex items-center"), months: "flex flex-col relative", disabled: "[&_button]:rounded-full [&_button]:!text-input-disable-text" }), classNames), styles: {
21
21
  caption_label: {
22
22
  zIndex: 1,
23
23
  position: "relative",
@@ -17,7 +17,7 @@ import { CheckIcon, MinusIcon } from "@heroicons/react/16/solid";
17
17
  import { cn } from "@/utils/cn";
18
18
  const Checkbox = React.forwardRef((_a, ref) => {
19
19
  var { className } = _a, props = __rest(_a, ["className"]);
20
- return (_jsx(CheckboxPrimitive.Root, Object.assign({ ref: ref, className: cn("peer size-4 shrink-0 cursor-pointer rounded-[var(--spacing-spacing-xxs,2px)] border border-function-default-solid ring-offset-background", "hover:border-function-default-hover", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", "disabled:cursor-not-allowed disabled:border-state-disable-solid disabled:text-state-disable-outline disabled:data-[state=checked]:bg-state-disable-solid disabled:data-[state=indeterminate]:bg-state-disable-solid", {
20
+ return (_jsx(CheckboxPrimitive.Root, Object.assign({ ref: ref, className: cn("peer size-4 shrink-0 cursor-pointer rounded-[var(--spacing-spacing-xxs,2px)] border border-function-default-solid ring-offset-bg-bg1", "hover:border-function-default-hover", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-input-active-stroke focus-visible:ring-offset-2", "disabled:cursor-not-allowed disabled:border-state-disable-outline disabled:text-state-disable-outline", "disabled:data-[state=checked]:border-state-disable-solid disabled:data-[state=checked]:bg-state-disable-solid", "disabled:data-[state=indeterminate]:border-state-disable-solid disabled:data-[state=indeterminate]:bg-state-disable-solid", {
21
21
  "data-[state=checked]:border-function-active-solid data-[state=checked]:bg-function-active-solid data-[state=checked]:text-function-active-icon data-[state=indeterminate]:border-function-active-solid data-[state=indeterminate]:bg-function-active-solid data-[state=indeterminate]:text-function-active-icon": !props.disabled,
22
22
  "hover:data-[state=checked]:border-function-active-hover hover:data-[state=checked]:bg-function-active-hover hover:data-[state=indeterminate]:border-function-active-hover hover:data-[state=indeterminate]:bg-function-active-hover": !props.disabled,
23
23
  }, className) }, props, { children: _jsxs(CheckboxPrimitive.Indicator, { className: cn("flex size-[14px] items-center justify-center text-current", "[&[data-state=checked]_.checkbox-check-icon]:block", "[&[data-state=indeterminate]_.checkbox-minus-icon]:block"), children: [_jsx(CheckIcon, { className: "checkbox-check-icon hidden size-[14px]" }), _jsx(MinusIcon, { className: "checkbox-minus-icon hidden size-[14px]" })] }) })));
@@ -8,7 +8,7 @@ const meta = {
8
8
  layout: "fullscreen",
9
9
  },
10
10
  decorators: [
11
- (Story) => (_jsx("div", { className: "p-5 flex w-full bg-base-bg2", children: _jsx(Story, {}) })),
11
+ (Story) => (_jsx("div", { className: "p-5 flex w-full bg-bg-bg2", children: _jsx(Story, {}) })),
12
12
  ],
13
13
  };
14
14
  export default meta;
@@ -19,26 +19,30 @@ export const Default = {
19
19
  },
20
20
  render: (args) => {
21
21
  const props = Object.assign({}, args);
22
- return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(Checkbox, Object.assign({ id: "terms" }, props)), _jsx("label", { htmlFor: "terms", className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", children: "Accept terms and conditions" })] }) }));
22
+ return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(Checkbox, Object.assign({ id: "terms" }, props)), _jsx("label", { htmlFor: "terms", className: "text-sm font-medium leading-none text-text-contrast-max peer-disabled:cursor-not-allowed peer-disabled:text-state-disable-outline", children: "Accept terms and conditions" })] }) }));
23
23
  },
24
24
  };
25
25
  export const WithText = {
26
26
  args: {},
27
27
  render: (args) => {
28
28
  const props = Object.assign({}, args);
29
- return (_jsxs("div", { className: "items-top flex space-x-2", children: [_jsx(Checkbox, { id: "terms1" }), _jsxs("div", { className: "grid gap-1.5 leading-none", children: [_jsx("label", { htmlFor: "terms1", className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", children: "Accept terms and conditions" }), _jsx("p", { className: "text-sm text-muted-foreground", children: "You agree to our Terms of Service and Privacy Policy." })] })] }));
29
+ return (_jsxs("div", { className: "items-top flex space-x-2", children: [_jsx(Checkbox, { id: "terms1" }), _jsxs("div", { className: "grid gap-1.5 leading-none", children: [_jsx("label", { htmlFor: "terms1", className: "text-sm font-medium leading-none text-text-contrast-max peer-disabled:cursor-not-allowed peer-disabled:text-state-disable-outline", children: "Accept terms and conditions" }), _jsx("p", { className: "text-sm text-text-g-contrast-medium", children: "You agree to our Terms of Service and Privacy Policy." })] })] }));
30
30
  },
31
31
  };
32
32
  export const Disabled = {
33
33
  args: {},
34
34
  render: (args) => {
35
35
  const props = Object.assign({}, args);
36
- return (_jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(Checkbox, { id: "terms2", disabled: true }), _jsx("label", { htmlFor: "terms2", className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", children: "Accept terms and conditions" })] }));
36
+ return (_jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(Checkbox, { id: "terms2", disabled: true }), _jsx("label", { htmlFor: "terms2", className: "text-sm font-medium leading-none text-state-disable-outline peer-disabled:cursor-not-allowed", children: "Accept terms and conditions" })] }));
37
37
  },
38
38
  };
39
39
  const checkboxPreviewRows = [
40
40
  { label: "Default", checked: false },
41
- { label: "Hover", checked: false, className: "!border-function-default-hover" },
41
+ {
42
+ label: "Hover",
43
+ checked: false,
44
+ className: "!border-function-default-hover",
45
+ },
42
46
  { label: "Disable", checked: false, disabled: true },
43
47
  { label: "Checked", checked: true },
44
48
  {
@@ -53,8 +57,14 @@ const checkboxPreviewRows = [
53
57
  checked: "indeterminate",
54
58
  className: "!data-[state=indeterminate]:border-function-active-hover !data-[state=indeterminate]:bg-function-active-hover",
55
59
  },
56
- { label: "Indeterminate - Disable", checked: "indeterminate", disabled: true },
60
+ {
61
+ label: "Indeterminate - Disable",
62
+ checked: "indeterminate",
63
+ disabled: true,
64
+ },
57
65
  ];
58
66
  export const FigmaPreview = {
59
- render: () => (_jsx("div", { className: "bg-base-bg2 p-8 min-h-screen", children: _jsx("div", { className: "mx-auto flex w-full max-w-[360px] flex-col gap-4 rounded-lg border border-base-bg-stroke1 bg-base-bg1 p-6", children: checkboxPreviewRows.map((row) => (_jsxs("div", { className: "grid grid-cols-[160px_16px] items-center gap-4", children: [_jsx("span", { className: "text-sm font-medium text-text-white", children: row.label }), _jsx(Checkbox, { checked: row.checked, disabled: row.disabled, className: row.className })] }, row.label))) }) })),
67
+ render: () => (_jsx("div", { className: "bg-bg-bg2 p-8 min-h-screen", children: _jsx("div", { className: "mx-auto flex w-full max-w-[360px] flex-col gap-4 rounded-lg border border-bg-stroke1 bg-bg-bg1 p-6", children: checkboxPreviewRows.map((row) => (_jsxs("div", { className: "grid grid-cols-[160px_16px] items-center gap-4", children: [_jsx("span", { className: `text-sm font-medium ${row.disabled
68
+ ? "text-state-disable-outline"
69
+ : "text-text-contrast-max"}`, children: row.label }), _jsx(Checkbox, { checked: row.checked, disabled: row.disabled, className: row.className })] }, row.label))) }) })),
60
70
  };
@@ -1,6 +1,6 @@
1
1
  import { cva } from "class-variance-authority";
2
2
  export const collapseButtonVariants = cva([
3
- "flex flex-1 bg-secondary-default hover:bg-secondary-hover text-secondary-foreground",
3
+ "flex flex-1 bg-secondary-default hover:bg-secondary-hover text-state-secondary-text-solid",
4
4
  "focus:outline-none focus-visible:ring focus-visible:ring-gray-500 focus-visible:ring-opacity-75",
5
5
  ], {
6
6
  variants: {
@@ -65,6 +65,6 @@ export function DataTable({ data, columns, manualSorting = false, onSorting, fet
65
65
  : flexRender(header.column.columnDef.header, header.getContext()), (_a = {
66
66
  asc: _jsx(ArrowUpIcon, { className: "ml-3 h-4 w-4" }),
67
67
  desc: _jsx(ArrowDownIcon, { className: "ml-3 h-4 w-4" }),
68
- }[header.column.getIsSorted()]) !== null && _a !== void 0 ? _a : (header.column.getCanSort() ? (_jsx(ArrowsUpDownIcon, { className: "ml-3 h-4 w-4 text-text-grey-light" })) : null)] }) }, header.id));
69
- }) }, headerGroup.id))) }), _jsx(TableBody, { className: "overflow-y-scroll", children: !isEmpty ? (table.getRowModel().rows.map((row) => (_jsx(TableRow, { "data-state": row.getIsSelected() && "selected", className: "", children: row.getVisibleCells().map((cell) => (_jsx(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id)))) : (_jsx(TableRow, { className: "h-full self-stretch", children: _jsx(TableCell, { colSpan: columns.length, className: "typography-body1 text-text-grey-medium text-center h-full", children: _jsxs("div", { className: "flex flex-1 h-full flex-col items-center justify-center gap-3", children: [_jsx(ClipboardDocumentListIcon, { className: "w-8 text-secondary-120" }), "There is no information yet."] }) }) })) })] }) }));
68
+ }[header.column.getIsSorted()]) !== null && _a !== void 0 ? _a : (header.column.getCanSort() ? (_jsx(ArrowsUpDownIcon, { className: "ml-3 h-4 w-4 text-text-g-contrast-high" })) : null)] }) }, header.id));
69
+ }) }, headerGroup.id))) }), _jsx(TableBody, { className: "overflow-y-scroll", children: !isEmpty ? (table.getRowModel().rows.map((row) => (_jsx(TableRow, { "data-state": row.getIsSelected() && "selected", className: "", children: row.getVisibleCells().map((cell) => (_jsx(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id)))) : (_jsx(TableRow, { className: "h-full self-stretch", children: _jsx(TableCell, { colSpan: columns.length, className: "typography-body1 text-text-g-contrast-medium text-center h-full", children: _jsxs("div", { className: "flex flex-1 h-full flex-col items-center justify-center gap-3", children: [_jsx(ClipboardDocumentListIcon, { className: "w-8 text-secondary-120" }), "There is no information yet."] }) }) })) })] }) }));
70
70
  }
@@ -21,32 +21,37 @@ const DialogPortal = DialogPrimitive.Portal;
21
21
  const DialogClose = DialogPrimitive.Close;
22
22
  const DialogOverlay = React.forwardRef((_a, ref) => {
23
23
  var { className } = _a, props = __rest(_a, ["className"]);
24
- return (_jsx(DialogPrimitive.Overlay, Object.assign({ ref: ref, className: cn("fixed inset-0 z-50 bg-base-popup-curtain data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className) }, props)));
24
+ return (_jsx(DialogPrimitive.Overlay, Object.assign({ ref: ref, className: cn("fixed inset-0 z-50 bg-modal-overlay data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className) }, props)));
25
25
  });
26
26
  DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
27
27
  const DialogContent = React.forwardRef((_a, ref) => {
28
28
  var { className, children, showCloseButton = false, closeButtonClassName } = _a, props = __rest(_a, ["className", "children", "showCloseButton", "closeButtonClassName"]);
29
- return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, Object.assign({ ref: ref, className: cn("fixed text-base-popup-foreground left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-base-popup bg-base-popup p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-md", className) }, props, { children: [children, showCloseButton && (_jsxs(DialogPrimitive.Close, { className: cn("absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-primary data-[state=open]:text-primary-foreground", closeButtonClassName), children: [_jsx(XMarkIcon, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "Close" })] }))] }))] }));
29
+ return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, Object.assign({ ref: ref, className: cn("fixed left-[50%] top-[50%] z-50 flex w-[calc(100%-32px)] max-w-[650px] translate-x-[-50%] translate-y-[-50%] flex-col rounded-md bg-modal-surface p-8 text-text-g-contrast-medium shadow-[0px_12px_24px_-4px_rgba(0,0,0,0.12)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]", className) }, props, { children: [children, showCloseButton && (_jsxs(DialogPrimitive.Close, { className: cn("absolute right-8 top-8 rounded-sm opacity-70 ring-offset-bg-bg1 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-input-active-stroke focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-primary data-[state=open]:text-state-primary-text-solid", closeButtonClassName), children: [_jsx(XMarkIcon, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "Close" })] }))] }))] }));
30
30
  });
31
31
  DialogContent.displayName = DialogPrimitive.Content.displayName;
32
32
  const DialogHeader = (_a) => {
33
33
  var { className } = _a, props = __rest(_a, ["className"]);
34
- return (_jsx("div", Object.assign({ className: cn("flex flex-col space-y-2 text-center sm:text-left", className) }, props)));
34
+ return (_jsx("div", Object.assign({ className: cn("flex flex-col gap-2 text-left", className) }, props)));
35
35
  };
36
36
  DialogHeader.displayName = "DialogHeader";
37
+ const DialogBody = (_a) => {
38
+ var { className, scrollable = false } = _a, props = __rest(_a, ["className", "scrollable"]);
39
+ return (_jsx("div", Object.assign({ className: cn("flex flex-1 min-h-0 flex-col mt-8", scrollable && "overflow-y-auto", className) }, props)));
40
+ };
41
+ DialogBody.displayName = "DialogBody";
37
42
  const DialogFooter = (_a) => {
38
43
  var { className } = _a, props = __rest(_a, ["className"]);
39
- return (_jsx("div", Object.assign({ className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 ", className) }, props)));
44
+ return (_jsx("div", Object.assign({ className: cn("flex flex-col-reverse gap-3 sm:flex-row sm:items-center sm:justify-end sm:gap-6", className) }, props)));
40
45
  };
41
46
  DialogFooter.displayName = "DialogFooter";
42
47
  const DialogTitle = React.forwardRef((_a, ref) => {
43
48
  var { className } = _a, props = __rest(_a, ["className"]);
44
- return (_jsx(DialogPrimitive.Title, Object.assign({ ref: ref, className: cn("typography-h5 tracking-tight ", className) }, props)));
49
+ return (_jsx(DialogPrimitive.Title, Object.assign({ ref: ref, className: cn("typography-h4 tracking-tight text-text-contrast-max", className) }, props)));
45
50
  });
46
51
  DialogTitle.displayName = DialogPrimitive.Title.displayName;
47
52
  const DialogDescription = React.forwardRef((_a, ref) => {
48
53
  var { className } = _a, props = __rest(_a, ["className"]);
49
- return (_jsx(DialogPrimitive.Description, Object.assign({ ref: ref, className: cn("text-sm", className) }, props)));
54
+ return (_jsx(DialogPrimitive.Description, Object.assign({ ref: ref, className: cn("typography-subtitle1 text-text-g-contrast-medium", className) }, props)));
50
55
  });
51
56
  DialogDescription.displayName = DialogPrimitive.Description.displayName;
52
- export { Dialog, DialogPortal, DialogOverlay, DialogClose, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, };
57
+ export { Dialog, DialogPortal, DialogOverlay, DialogClose, DialogTrigger, DialogContent, DialogHeader, DialogBody, DialogFooter, DialogTitle, DialogDescription, };
@@ -1,8 +1,11 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "./Dialog";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import * as yup from "yup";
3
+ import { Dialog, DialogContent, DialogDescription, DialogBody, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "./Dialog";
3
4
  import Button from "../Button/Button";
4
5
  import { Label } from "../Label/Label";
5
6
  import { Input } from "../Input/Input";
7
+ import { Field, Form, ValidationHintList } from "../Form";
8
+ import PasswordInput from "../PasswordInput";
6
9
  const meta = {
7
10
  title: "Components/Dialog",
8
11
  component: Dialog,
@@ -39,3 +42,88 @@ export const Demo = {
39
42
  return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsxs(Dialog, { children: [_jsx(DialogTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Edit Profile" }) }), _jsxs(DialogContent, { className: "sm:max-w-[425px]", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Edit profile" }), _jsx(DialogDescription, { children: "Make changes to your profile here. Click save when you're done." })] }), _jsxs("div", { className: "grid gap-4 py-4", children: [_jsxs("div", { className: "grid grid-cols-4 items-center gap-4", children: [_jsx(Label, { htmlFor: "name", className: "text-right", children: "Name" }), _jsx(Input, { id: "name", defaultValue: "Pedro Duarte", className: "col-span-3" })] }), _jsxs("div", { className: "grid grid-cols-4 items-center gap-4", children: [_jsx(Label, { htmlFor: "username", className: "text-right", children: "Username" }), _jsx(Input, { id: "username", defaultValue: "@peduarte", className: "col-span-3" })] })] }), _jsx(DialogFooter, { children: _jsx(Button, { type: "submit", children: "Save changes" }) })] })] }) }));
40
43
  },
41
44
  };
45
+ const passwordHints = [
46
+ {
47
+ id: "min-length",
48
+ label: "Minimum 12 characters",
49
+ validate: (values) => values.newPassword.length >= 12,
50
+ when: (values) => Boolean(values.newPassword),
51
+ },
52
+ {
53
+ id: "lower-and-upper",
54
+ label: "At least a lower and upper case",
55
+ validate: (values) => /[a-z]/.test(values.newPassword) && /[A-Z]/.test(values.newPassword),
56
+ when: (values) => Boolean(values.newPassword),
57
+ },
58
+ {
59
+ id: "special",
60
+ label: "At least 1 special character",
61
+ validate: (values) => /[^A-Za-z0-9]/.test(values.newPassword),
62
+ when: (values) => Boolean(values.newPassword),
63
+ },
64
+ {
65
+ id: "numeral",
66
+ label: "At least 1 numeral",
67
+ validate: (values) => /\d/.test(values.newPassword),
68
+ when: (values) => Boolean(values.newPassword),
69
+ },
70
+ {
71
+ id: "capital",
72
+ label: "At least 1 capital letter",
73
+ validate: (values) => /[A-Z]/.test(values.newPassword),
74
+ when: (values) => Boolean(values.newPassword),
75
+ },
76
+ {
77
+ id: "match",
78
+ label: "Password and confirmation are matching",
79
+ validate: (values) => Boolean(values.newPassword) &&
80
+ values.newPassword === values.confirmPassword,
81
+ when: (values) => Boolean(values.newPassword) && Boolean(values.confirmPassword),
82
+ },
83
+ ];
84
+ const changePasswordSchema = yup.object({
85
+ newPassword: yup
86
+ .string()
87
+ .required("New password is required")
88
+ .min(12, "Password must be at least 12 characters")
89
+ .matches(/[a-z]/, "Password must include a lowercase letter")
90
+ .matches(/[A-Z]/, "Password must include an uppercase letter")
91
+ .matches(/\d/, "Password must include a numeral")
92
+ .matches(/[^A-Za-z0-9]/, "Password must include a special character"),
93
+ confirmPassword: yup
94
+ .string()
95
+ .required("Please confirm your password")
96
+ .oneOf([yup.ref("newPassword")], "Passwords must match"),
97
+ });
98
+ export const FigmaChangePassword = {
99
+ render: () => {
100
+ return (_jsx("div", { className: "flex w-full", children: _jsx(Dialog, { defaultOpen: true, children: _jsx(DialogContent, { className: "min-h-[686px] max-w-[650px]", children: _jsx(Form, { className: "contents", defaultValues: {
101
+ newPassword: "",
102
+ confirmPassword: "",
103
+ }, mode: "onTouched", validationSchema: changePasswordSchema, onSubmit: (values) => {
104
+ // eslint-disable-next-line no-console
105
+ console.log("Change password submit:", values);
106
+ }, children: ({ formState, watch }) => {
107
+ const newPassword = watch("newPassword");
108
+ const confirmPassword = watch("confirmPassword");
109
+ return (_jsxs(_Fragment, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Welcome!" }), _jsx(DialogDescription, { children: "Please create a new password to replace the temporary password." })] }), _jsx(DialogBody, { children: _jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(Field, { name: "newPassword", component: PasswordInput, componentProps: {
110
+ id: "new-password",
111
+ label: "New password",
112
+ type: "password",
113
+ required: true,
114
+ fullwidth: true,
115
+ size: "lg",
116
+ } }), _jsx(Field, { name: "confirmPassword", component: PasswordInput, componentProps: {
117
+ id: "confirm-password",
118
+ label: "Confirm password",
119
+ type: "password",
120
+ required: true,
121
+ fullwidth: true,
122
+ size: "lg",
123
+ } }), _jsx(ValidationHintList, { values: {
124
+ newPassword: newPassword || "",
125
+ confirmPassword: confirmPassword || "",
126
+ }, rules: passwordHints })] }) }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "outline", color: "primary", size: "lg", fullwidth: false, children: "Back" }), _jsx(Button, { type: "submit", size: "lg", fullwidth: false, className: "w-[180px]", disabled: !formState.isValid || formState.isSubmitting, isLoading: formState.isSubmitting, children: "Save changes" })] })] }));
127
+ } }) }) }) }));
128
+ },
129
+ };
@@ -18,7 +18,7 @@ import { Menu } from "../Menu/Menu";
18
18
  import { ChevronDownIcon } from "@heroicons/react/16/solid";
19
19
  import { cn } from "@/utils/cn";
20
20
  const Dropdown = forwardRef((_a, ref) => {
21
- var { id, options = [], value, label, size = "md", rounded = "normal", variant = "outline", defaultMenuItemType = "checkbox", helperText, errorMessage, fullwidth = true, disabled = false, error = false, filterMode = false, required = true, modal = false, onChangeText, onSelect, renderOptions: customRenderOptions, optionContainerClassName, optionItemClassName, optionNotFoundItemClassName } = _a, props = __rest(_a, ["id", "options", "value", "label", "size", "rounded", "variant", "defaultMenuItemType", "helperText", "errorMessage", "fullwidth", "disabled", "error", "filterMode", "required", "modal", "onChangeText", "onSelect", "renderOptions", "optionContainerClassName", "optionItemClassName", "optionNotFoundItemClassName"]);
21
+ var { id, options = [], value, label, size = "md", rounded = "normal", variant = "outline", defaultMenuItemType = "checkbox", helperText, errorMessage, fullwidth = true, disabled = false, error = false, filterMode = false, required = true, modal = false, onChangeText, onSelect, renderOptions: customRenderOptions, optionContainerClassName, optionItemClassName, optionNotFoundItemClassName, segmentedInput = true } = _a, props = __rest(_a, ["id", "options", "value", "label", "size", "rounded", "variant", "defaultMenuItemType", "helperText", "errorMessage", "fullwidth", "disabled", "error", "filterMode", "required", "modal", "onChangeText", "onSelect", "renderOptions", "optionContainerClassName", "optionItemClassName", "optionNotFoundItemClassName", "segmentedInput"]);
22
22
  const _id = id || `${label}-select`;
23
23
  const [isFocused, setIsFocused] = useState(false);
24
24
  const [selectedOption, setSelectedOption] = useState(null);
@@ -192,7 +192,7 @@ const Dropdown = forwardRef((_a, ref) => {
192
192
  keyCode.current = e.code;
193
193
  (_a = props === null || props === void 0 ? void 0 : props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, e);
194
194
  }, [props === null || props === void 0 ? void 0 : props.onKeyDown]);
195
- return (_jsxs("div", { className: `relative ${fullwidth ? "w-full" : ""}`, children: [_jsx(TextInput, Object.assign({ hasClearIcon: false, endIcon: _jsx(ChevronDownIcon, { className: dropdownIconVariant({ isFocus: isFocused }) }) }, props, { ref: inputRef, readOnly: !filterMode, value: textValue, onChange: handleOnChangeText, label: label, placeholder: " ", type: "text", autoComplete: "off", rounded: rounded, variant: variant, helperText: helperText, errorMessage: errorMessage, fullwidth: fullwidth, error: error, required: required, id: _id, disabled: disabled, size: size, className: customInputVariant({ size }), onFocus: handleOnFocus, onBlur: handleOnBlur, onKeyDown: handleOnKeyDown })), isFocused &&
195
+ return (_jsxs("div", { className: `relative ${fullwidth ? "w-full" : ""}`, children: [_jsx(TextInput, Object.assign({ hasClearIcon: false, endIcon: _jsx(ChevronDownIcon, { className: dropdownIconVariant({ isFocus: isFocused }) }) }, props, { ref: inputRef, readOnly: !filterMode, value: textValue, onChange: handleOnChangeText, label: label, placeholder: " ", type: "text", autoComplete: "off", rounded: rounded, variant: variant, helperText: helperText, errorMessage: errorMessage, fullwidth: fullwidth, error: error, required: required, id: _id, disabled: disabled, size: size, className: segmentedInput ? customInputVariant({ size }) : undefined, onFocus: handleOnFocus, onBlur: handleOnBlur, onKeyDown: handleOnKeyDown })), isFocused &&
196
196
  (usePortal ? (_jsx(Portal.Root, { container: document.body, children: renderOptions() })) : (renderOptions()))] }));
197
197
  });
198
198
  export default Dropdown;
@@ -31,13 +31,13 @@ DropdownMenuSubTrigger.displayName =
31
31
  DropdownMenuPrimitive.SubTrigger.displayName;
32
32
  const DropdownMenuSubContent = React.forwardRef((_a, ref) => {
33
33
  var { className } = _a, props = __rest(_a, ["className"]);
34
- return (_jsx(DropdownMenuPrimitive.SubContent, Object.assign({ ref: ref, className: cn("z-50 min-w-[154px] overflow-hidden rounded-md bg-base-popup text-base-popup-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className) }, props, { style: Object.assign({ boxShadow: "var(--dropdown-menu-shadow)" }, props.style) })));
34
+ return (_jsx(DropdownMenuPrimitive.SubContent, Object.assign({ ref: ref, className: cn("z-50 min-w-[154px] overflow-hidden rounded-md bg-modal-surface text-text-contrast-low data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className) }, props, { style: Object.assign({ boxShadow: "var(--dropdown-menu-shadow)" }, props.style) })));
35
35
  });
36
36
  DropdownMenuSubContent.displayName =
37
37
  DropdownMenuPrimitive.SubContent.displayName;
38
38
  const DropdownMenuContent = React.forwardRef((_a, ref) => {
39
39
  var { className, sideOffset = 4 } = _a, props = __rest(_a, ["className", "sideOffset"]);
40
- return (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, Object.assign({ ref: ref, sideOffset: sideOffset, className: cn("z-50 min-w-[154px] overflow-hidden rounded-md bg-base-popup text-base-popup-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className) }, props, { style: Object.assign({ boxShadow: "var(--dropdown-menu-shadow)" }, props.style) })) }));
40
+ return (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, Object.assign({ ref: ref, sideOffset: sideOffset, className: cn("z-50 min-w-[154px] overflow-hidden rounded-md bg-modal-surface text-text-contrast-low data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className) }, props, { style: Object.assign({ boxShadow: "var(--dropdown-menu-shadow)" }, props.style) })) }));
41
41
  });
42
42
  DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
43
43
  const DropdownMenuItem = React.forwardRef((_a, ref) => {
@@ -58,7 +58,7 @@ const DropdownMenuRadioItem = React.forwardRef((_a, ref) => {
58
58
  DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
59
59
  const DropdownMenuLabel = React.forwardRef((_a, ref) => {
60
60
  var { className, inset } = _a, props = __rest(_a, ["className", "inset"]);
61
- return (_jsx(DropdownMenuPrimitive.Label, Object.assign({ ref: ref, className: cn("px-3 py-2 typography-small4 text-text-grey-medium", inset && "pl-8", className) }, props)));
61
+ return (_jsx(DropdownMenuPrimitive.Label, Object.assign({ ref: ref, className: cn("px-3 py-2 typography-small4 text-text-g-contrast-medium", inset && "pl-8", className) }, props)));
62
62
  });
63
63
  DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
64
64
  const DropdownMenuSeparator = React.forwardRef((_a, ref) => {
@@ -15,9 +15,9 @@ const items = Array.from({ length: 30 }, (_, i) => `Item ${i + 1}`);
15
15
  export const VerticalScroll = {
16
16
  render: (args) => {
17
17
  const [selected, setSelected] = useState("item-5");
18
- return (_jsxs("div", { className: "p-6 space-y-4", children: [_jsxs("div", { className: "flex gap-2", children: [_jsx("button", { onClick: () => setSelected("item-5"), className: "px-3 py-1 bg-primary text-white rounded", children: "Scroll to Item 5" }), _jsx("button", { onClick: () => setSelected("item-20"), className: "px-3 py-1 bg-primary text-white rounded", children: "Scroll to Item 20" }), _jsx("button", { onClick: () => setSelected("item-29"), className: "px-3 py-1 bg-primary text-white rounded", children: "Scroll to Item 30" })] }), _jsx(FocusedScrollView, Object.assign({}, args, { selectedKey: selected, children: items.map((item, index) => (_jsx("div", { className: `px-4 py-2 ${selected === `item-${index + 1}`
19
- ? "bg-secondary text-secondary-foreground"
20
- : "bg-white"}`, children: item }, `item-${index + 1}`))) }))] }));
18
+ return (_jsxs("div", { className: "p-6 space-y-4", children: [_jsxs("div", { className: "flex gap-2", children: [_jsx("button", { onClick: () => setSelected("item-5"), className: "px-3 py-1 bg-primary text-state-primary-text-solid rounded", children: "Scroll to Item 5" }), _jsx("button", { onClick: () => setSelected("item-20"), className: "px-3 py-1 bg-primary text-state-primary-text-solid rounded", children: "Scroll to Item 20" }), _jsx("button", { onClick: () => setSelected("item-29"), className: "px-3 py-1 bg-primary text-state-primary-text-solid rounded", children: "Scroll to Item 30" })] }), _jsx(FocusedScrollView, Object.assign({}, args, { selectedKey: selected, children: items.map((item, index) => (_jsx("div", { className: `px-4 py-2 ${selected === `item-${index + 1}`
19
+ ? "bg-secondary text-state-secondary-text-solid"
20
+ : "bg-bg-bg1"}`, children: item }, `item-${index + 1}`))) }))] }));
21
21
  },
22
22
  };
23
23
  export const HorizontalScroll = {
@@ -26,8 +26,8 @@ export const HorizontalScroll = {
26
26
  },
27
27
  render: (args) => {
28
28
  const [selected, setSelected] = useState("item-15");
29
- return (_jsxs("div", { className: "p-6 space-y-4", children: [_jsxs("div", { className: "flex gap-2", children: [_jsx("button", { onClick: () => setSelected("item-5"), className: "px-3 py-1 bg-primary text-white rounded", children: "Scroll to Item 5" }), _jsx("button", { onClick: () => setSelected("item-15"), className: "px-3 py-1 bg-primary text-white rounded", children: "Scroll to Item 15" }), _jsx("button", { onClick: () => setSelected("item-25"), className: "px-3 py-1 bg-primary text-white rounded", children: "Scroll to Item 25" })] }), _jsx(FocusedScrollView, Object.assign({}, args, { selectedKey: selected, children: items.map((item, index) => (_jsx("div", { className: `inline-block w-28 h-12 mx-2 text-center leading-[3rem] rounded ${selected === `item-${index + 1}`
30
- ? "bg-secondary text-secondary-foreground"
31
- : "bg-gray-200"}`, children: item }, `item-${index + 1}`))) }))] }));
29
+ return (_jsxs("div", { className: "p-6 space-y-4", children: [_jsxs("div", { className: "flex gap-2", children: [_jsx("button", { onClick: () => setSelected("item-5"), className: "px-3 py-1 bg-primary text-state-primary-text-solid rounded", children: "Scroll to Item 5" }), _jsx("button", { onClick: () => setSelected("item-15"), className: "px-3 py-1 bg-primary text-state-primary-text-solid rounded", children: "Scroll to Item 15" }), _jsx("button", { onClick: () => setSelected("item-25"), className: "px-3 py-1 bg-primary text-state-primary-text-solid rounded", children: "Scroll to Item 25" })] }), _jsx(FocusedScrollView, Object.assign({}, args, { selectedKey: selected, children: items.map((item, index) => (_jsx("div", { className: `inline-block w-28 h-12 mx-2 text-center leading-[3rem] rounded ${selected === `item-${index + 1}`
30
+ ? "bg-secondary text-state-secondary-text-solid"
31
+ : "bg-transparent-grey2-16"}`, children: item }, `item-${index + 1}`))) }))] }));
32
32
  },
33
33
  };
@@ -0,0 +1,60 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useId } from "react";
3
+ import { useController, } from "react-hook-form";
4
+ const extractChangedValue = (payload) => {
5
+ if (payload &&
6
+ typeof payload === "object" &&
7
+ "target" in payload &&
8
+ payload.target &&
9
+ typeof payload.target === "object") {
10
+ const target = payload.target;
11
+ if (target.type === "checkbox") {
12
+ return target.checked;
13
+ }
14
+ return target.value;
15
+ }
16
+ return payload;
17
+ };
18
+ export const Field = ({ name, component: Component, componentProps, rules, defaultValue, disabled = false, shouldUnregister = false, id, describedBy, valuePropName = "value", changePropName = "onChange", blurPropName = "onBlur", refPropName = "ref", errorMessagePropName = "errorMessage", invalidPropName = "error", parseValue, formatValue, onChange, onBlur, }) => {
19
+ const fieldId = useId();
20
+ const resolvedId = id || `${name.replace(/\./g, "-")}-${fieldId}`;
21
+ const { field, fieldState: { error, invalid }, } = useController({
22
+ name,
23
+ rules,
24
+ disabled,
25
+ defaultValue,
26
+ shouldUnregister,
27
+ });
28
+ const handleChange = (rawPayload) => {
29
+ const extractedValue = extractChangedValue(rawPayload);
30
+ const parsedValue = parseValue
31
+ ? parseValue(extractedValue, rawPayload)
32
+ : extractedValue;
33
+ field.onChange(parsedValue);
34
+ onChange === null || onChange === void 0 ? void 0 : onChange(parsedValue, rawPayload);
35
+ };
36
+ const handleBlur = () => {
37
+ field.onBlur();
38
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur();
39
+ };
40
+ const componentValue = formatValue
41
+ ? formatValue(field.value)
42
+ : field.value;
43
+ const sharedProps = Object.assign(Object.assign({}, componentProps), { id: resolvedId, name: field.name, disabled, "aria-invalid": invalid || undefined, "aria-describedby": describedBy });
44
+ sharedProps[valuePropName] = componentValue;
45
+ sharedProps[changePropName] = handleChange;
46
+ if (blurPropName) {
47
+ sharedProps[blurPropName] = handleBlur;
48
+ }
49
+ if (refPropName) {
50
+ sharedProps[refPropName] = field.ref;
51
+ }
52
+ if (errorMessagePropName) {
53
+ sharedProps[errorMessagePropName] = error === null || error === void 0 ? void 0 : error.message;
54
+ }
55
+ if (invalidPropName) {
56
+ sharedProps[invalidPropName] = invalid;
57
+ }
58
+ return _jsx(Component, Object.assign({}, sharedProps));
59
+ };
60
+ export default Field;