@zyncat/ui 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +133 -0
- package/dist/alert.css +132 -0
- package/dist/alert.d.ts +46 -0
- package/dist/alert.js +80 -0
- package/dist/alert.js.map +1 -0
- package/dist/avatar-group.d.ts +24 -0
- package/dist/avatar-group.js +23 -0
- package/dist/avatar-group.js.map +1 -0
- package/dist/avatar.css +200 -0
- package/dist/avatar.d.ts +35 -0
- package/dist/avatar.js +67 -0
- package/dist/avatar.js.map +1 -0
- package/dist/badge.css +182 -0
- package/dist/badge.d.ts +34 -0
- package/dist/badge.js +4 -0
- package/dist/badge.js.map +1 -0
- package/dist/button.css +269 -0
- package/dist/button.d.ts +44 -0
- package/dist/button.js +4 -0
- package/dist/button.js.map +1 -0
- package/dist/checkbox.css +177 -0
- package/dist/checkbox.d.ts +35 -0
- package/dist/checkbox.js +5 -0
- package/dist/checkbox.js.map +1 -0
- package/dist/chunk-2ERBBFZS.js +12 -0
- package/dist/chunk-2ERBBFZS.js.map +1 -0
- package/dist/chunk-2HORSLXJ.js +191 -0
- package/dist/chunk-2HORSLXJ.js.map +1 -0
- package/dist/chunk-36WVAQKL.js +40 -0
- package/dist/chunk-36WVAQKL.js.map +1 -0
- package/dist/chunk-3SBCBYB7.js +575 -0
- package/dist/chunk-3SBCBYB7.js.map +1 -0
- package/dist/chunk-4R2GQO43.js +125 -0
- package/dist/chunk-4R2GQO43.js.map +1 -0
- package/dist/chunk-64UU4LGU.js +258 -0
- package/dist/chunk-64UU4LGU.js.map +1 -0
- package/dist/chunk-7SZCJ7WI.js +35 -0
- package/dist/chunk-7SZCJ7WI.js.map +1 -0
- package/dist/chunk-BIDVNLJO.js +38 -0
- package/dist/chunk-BIDVNLJO.js.map +1 -0
- package/dist/chunk-CONSWNIV.js +17 -0
- package/dist/chunk-CONSWNIV.js.map +1 -0
- package/dist/chunk-EQ32F2QJ.js +75 -0
- package/dist/chunk-EQ32F2QJ.js.map +1 -0
- package/dist/chunk-GY7JOPUQ.js +111 -0
- package/dist/chunk-GY7JOPUQ.js.map +1 -0
- package/dist/chunk-I4XQ4PV2.js +30 -0
- package/dist/chunk-I4XQ4PV2.js.map +1 -0
- package/dist/chunk-JSKXZMLH.js +67 -0
- package/dist/chunk-JSKXZMLH.js.map +1 -0
- package/dist/chunk-L3Q3VDIW.js +295 -0
- package/dist/chunk-L3Q3VDIW.js.map +1 -0
- package/dist/chunk-LDC3RIYA.js +62 -0
- package/dist/chunk-LDC3RIYA.js.map +1 -0
- package/dist/chunk-MKIQFK7S.js +43 -0
- package/dist/chunk-MKIQFK7S.js.map +1 -0
- package/dist/chunk-MMRIQNEN.js +20 -0
- package/dist/chunk-MMRIQNEN.js.map +1 -0
- package/dist/chunk-MXOPCFWR.js +59 -0
- package/dist/chunk-MXOPCFWR.js.map +1 -0
- package/dist/chunk-NEF5XAHG.js +17 -0
- package/dist/chunk-NEF5XAHG.js.map +1 -0
- package/dist/chunk-NNXJCLTV.js +22 -0
- package/dist/chunk-NNXJCLTV.js.map +1 -0
- package/dist/chunk-O4N2OBTR.js +94 -0
- package/dist/chunk-O4N2OBTR.js.map +1 -0
- package/dist/chunk-PMECHR3A.js +38 -0
- package/dist/chunk-PMECHR3A.js.map +1 -0
- package/dist/chunk-QDK66S4G.js +44 -0
- package/dist/chunk-QDK66S4G.js.map +1 -0
- package/dist/chunk-QGNC7LH5.js +8 -0
- package/dist/chunk-QGNC7LH5.js.map +1 -0
- package/dist/chunk-QMSJZCK3.js +398 -0
- package/dist/chunk-QMSJZCK3.js.map +1 -0
- package/dist/chunk-S5ZTZANS.js +57 -0
- package/dist/chunk-S5ZTZANS.js.map +1 -0
- package/dist/chunk-S7B34VGN.js +14 -0
- package/dist/chunk-S7B34VGN.js.map +1 -0
- package/dist/chunk-TCUCYFT7.js +25 -0
- package/dist/chunk-TCUCYFT7.js.map +1 -0
- package/dist/chunk-TYHR4VNM.js +193 -0
- package/dist/chunk-TYHR4VNM.js.map +1 -0
- package/dist/chunk-U5QQZC3U.js +56 -0
- package/dist/chunk-U5QQZC3U.js.map +1 -0
- package/dist/chunk-UE63OOVG.js +13 -0
- package/dist/chunk-UE63OOVG.js.map +1 -0
- package/dist/chunk-VTJTGVZZ.js +22 -0
- package/dist/chunk-VTJTGVZZ.js.map +1 -0
- package/dist/chunk-W3SHPKSB.js +49 -0
- package/dist/chunk-W3SHPKSB.js.map +1 -0
- package/dist/chunk-XZAEIQDR.js +188 -0
- package/dist/chunk-XZAEIQDR.js.map +1 -0
- package/dist/chunk-YGGCQNNU.js +92 -0
- package/dist/chunk-YGGCQNNU.js.map +1 -0
- package/dist/collapse.css +88 -0
- package/dist/collapse.d.ts +46 -0
- package/dist/collapse.js +5 -0
- package/dist/collapse.js.map +1 -0
- package/dist/count-badge.d.ts +13 -0
- package/dist/count-badge.js +13 -0
- package/dist/count-badge.js.map +1 -0
- package/dist/date-field.d.ts +25 -0
- package/dist/date-field.js +87 -0
- package/dist/date-field.js.map +1 -0
- package/dist/date-picker.css +595 -0
- package/dist/date-range-field.d.ts +33 -0
- package/dist/date-range-field.js +404 -0
- package/dist/date-range-field.js.map +1 -0
- package/dist/datetime-field.d.ts +29 -0
- package/dist/datetime-field.js +155 -0
- package/dist/datetime-field.js.map +1 -0
- package/dist/dialog.css +180 -0
- package/dist/dialog.d.ts +42 -0
- package/dist/dialog.js +128 -0
- package/dist/dialog.js.map +1 -0
- package/dist/dom-props-C0jrllBw.d.ts +5 -0
- package/dist/field-chrome-CMPOQSLs.d.ts +28 -0
- package/dist/field-shell-Cuda-feL.d.ts +24 -0
- package/dist/glide.d.ts +15 -0
- package/dist/glide.js +5 -0
- package/dist/glide.js.map +1 -0
- package/dist/icon.css +33 -0
- package/dist/input.css +333 -0
- package/dist/mcp.js +359 -0
- package/dist/motion-devtools.css +265 -0
- package/dist/motion-devtools.d.ts +51 -0
- package/dist/motion-devtools.js +354 -0
- package/dist/motion-devtools.js.map +1 -0
- package/dist/motion-scale-Canq4stZ.d.ts +18 -0
- package/dist/motion-tokens.d.ts +28 -0
- package/dist/motion-tokens.js +3 -0
- package/dist/motion-tokens.js.map +1 -0
- package/dist/multi-select.d.ts +44 -0
- package/dist/multi-select.js +109 -0
- package/dist/multi-select.js.map +1 -0
- package/dist/number-field.d.ts +36 -0
- package/dist/number-field.js +112 -0
- package/dist/number-field.js.map +1 -0
- package/dist/odometer.css +62 -0
- package/dist/otp-field.d.ts +31 -0
- package/dist/otp-field.js +98 -0
- package/dist/otp-field.js.map +1 -0
- package/dist/overlay.css +23 -0
- package/dist/pagination.css +43 -0
- package/dist/pagination.d.ts +29 -0
- package/dist/pagination.js +107 -0
- package/dist/pagination.js.map +1 -0
- package/dist/popover.css +69 -0
- package/dist/popover.d.ts +35 -0
- package/dist/popover.js +15 -0
- package/dist/popover.js.map +1 -0
- package/dist/radio-group.css +300 -0
- package/dist/radio-group.d.ts +52 -0
- package/dist/radio-group.js +115 -0
- package/dist/radio-group.js.map +1 -0
- package/dist/select.css +416 -0
- package/dist/select.d.ts +49 -0
- package/dist/select.js +99 -0
- package/dist/select.js.map +1 -0
- package/dist/sheet.css +26 -0
- package/dist/sheet.d.ts +31 -0
- package/dist/sheet.js +14 -0
- package/dist/sheet.js.map +1 -0
- package/dist/status-badge.d.ts +19 -0
- package/dist/status-badge.js +72 -0
- package/dist/status-badge.js.map +1 -0
- package/dist/table.css +348 -0
- package/dist/table.d.ts +75 -0
- package/dist/table.js +262 -0
- package/dist/table.js.map +1 -0
- package/dist/tabs.css +208 -0
- package/dist/tabs.d.ts +71 -0
- package/dist/tabs.js +181 -0
- package/dist/tabs.js.map +1 -0
- package/dist/tag.css +248 -0
- package/dist/tag.d.ts +52 -0
- package/dist/tag.js +72 -0
- package/dist/tag.js.map +1 -0
- package/dist/text-field.d.ts +28 -0
- package/dist/text-field.js +69 -0
- package/dist/text-field.js.map +1 -0
- package/dist/textarea.css +219 -0
- package/dist/textarea.d.ts +38 -0
- package/dist/textarea.js +144 -0
- package/dist/textarea.js.map +1 -0
- package/dist/time-field.d.ts +28 -0
- package/dist/time-field.js +66 -0
- package/dist/time-field.js.map +1 -0
- package/dist/timing-7JA_zQHP.d.ts +27 -0
- package/dist/toast-store.d.ts +86 -0
- package/dist/toast-store.js +3 -0
- package/dist/toast-store.js.map +1 -0
- package/dist/toast.css +257 -0
- package/dist/toast.d.ts +12 -0
- package/dist/toast.js +310 -0
- package/dist/toast.js.map +1 -0
- package/dist/toggle-tag.d.ts +34 -0
- package/dist/toggle-tag.js +57 -0
- package/dist/toggle-tag.js.map +1 -0
- package/dist/toggle.css +152 -0
- package/dist/toggle.d.ts +31 -0
- package/dist/toggle.js +75 -0
- package/dist/toggle.js.map +1 -0
- package/dist/tooltip.css +86 -0
- package/dist/tooltip.d.ts +30 -0
- package/dist/tooltip.js +268 -0
- package/dist/tooltip.js.map +1 -0
- package/dist/types-SGMShK7R.d.ts +22 -0
- package/llms.txt +196 -0
- package/next.d.mts +7 -0
- package/next.mjs +59 -0
- package/package.json +257 -0
- package/src/components/composites/alert/Alert.tsx +141 -0
- package/src/components/composites/alert/alert.css +132 -0
- package/src/components/composites/date-picker/DateField.tsx +80 -0
- package/src/components/composites/date-picker/DateRangeField.tsx +110 -0
- package/src/components/composites/date-picker/DateTimeField.tsx +162 -0
- package/src/components/composites/date-picker/TimeField.tsx +78 -0
- package/src/components/composites/date-picker/calendar-panel.tsx +216 -0
- package/src/components/composites/date-picker/date-picker.css +595 -0
- package/src/components/composites/date-picker/date-utils.ts +56 -0
- package/src/components/composites/date-picker/field-shell.tsx +85 -0
- package/src/components/composites/date-picker/range-panel.tsx +363 -0
- package/src/components/composites/date-picker/time-core.tsx +290 -0
- package/src/components/composites/date-picker/use-day-focus.ts +35 -0
- package/src/components/composites/dialog/Dialog.tsx +198 -0
- package/src/components/composites/dialog/dialog.css +180 -0
- package/src/components/composites/pagination/Pagination.tsx +131 -0
- package/src/components/composites/pagination/pagination.css +43 -0
- package/src/components/composites/popover/Popover.tsx +141 -0
- package/src/components/composites/popover/popover.css +69 -0
- package/src/components/composites/select/MultiSelect.tsx +133 -0
- package/src/components/composites/select/Select.tsx +122 -0
- package/src/components/composites/select/core/index.ts +4 -0
- package/src/components/composites/select/core/menu.tsx +100 -0
- package/src/components/composites/select/core/panel.tsx +154 -0
- package/src/components/composites/select/core/trigger.tsx +74 -0
- package/src/components/composites/select/core/types.ts +39 -0
- package/src/components/composites/select/core/use-listbox.ts +182 -0
- package/src/components/composites/select/select.css +416 -0
- package/src/components/composites/sheet/Sheet.tsx +135 -0
- package/src/components/composites/sheet/sheet.css +26 -0
- package/src/components/composites/sheet/use-sheet-drag.ts +126 -0
- package/src/components/composites/table/Table.tsx +377 -0
- package/src/components/composites/table/table.css +348 -0
- package/src/components/composites/tabs/Tabs.tsx +278 -0
- package/src/components/composites/tabs/tabs.css +208 -0
- package/src/components/composites/toast/Toast.tsx +380 -0
- package/src/components/composites/toast/toast-store.ts +295 -0
- package/src/components/composites/toast/toast.css +257 -0
- package/src/components/composites/tooltip/Tooltip.tsx +110 -0
- package/src/components/composites/tooltip/tooltip-host.tsx +184 -0
- package/src/components/composites/tooltip/tooltip-store.ts +81 -0
- package/src/components/composites/tooltip/tooltip.css +86 -0
- package/src/components/dev/MotionDevtools.tsx +200 -0
- package/src/components/dev/motion-devtools.css +265 -0
- package/src/components/dev/slowmo-engine.ts +230 -0
- package/src/components/internal/glass/glass.css +100 -0
- package/src/components/internal/glass/glint.ts +9 -0
- package/src/components/internal/hooks/use-controllable.ts +21 -0
- package/src/components/internal/hooks/use-scroll-edges.ts +46 -0
- package/src/components/internal/icon/Icon.tsx +66 -0
- package/src/components/internal/icon/IconSlot.tsx +10 -0
- package/src/components/internal/icon/icon.css +33 -0
- package/src/components/internal/overlay/focus.ts +68 -0
- package/src/components/internal/overlay/layer.tsx +149 -0
- package/src/components/internal/overlay/modal.tsx +141 -0
- package/src/components/internal/overlay/overlay.css +23 -0
- package/src/components/internal/overlay/position.ts +103 -0
- package/src/components/internal/utils/cx.ts +3 -0
- package/src/components/internal/utils/token-px.ts +8 -0
- package/src/components/primitives/avatar/Avatar.tsx +120 -0
- package/src/components/primitives/avatar/AvatarGroup.tsx +56 -0
- package/src/components/primitives/avatar/avatar.css +200 -0
- package/src/components/primitives/badge/Badge.tsx +75 -0
- package/src/components/primitives/badge/CountBadge.tsx +20 -0
- package/src/components/primitives/badge/StatusBadge.tsx +111 -0
- package/src/components/primitives/badge/badge.css +182 -0
- package/src/components/primitives/badge/odometer.css +62 -0
- package/src/components/primitives/badge/odometer.tsx +36 -0
- package/src/components/primitives/button/Button.tsx +102 -0
- package/src/components/primitives/button/button.css +269 -0
- package/src/components/primitives/checkbox/Checkbox.tsx +76 -0
- package/src/components/primitives/checkbox/check-glyph.tsx +28 -0
- package/src/components/primitives/checkbox/checkbox.css +177 -0
- package/src/components/primitives/collapse/Collapse.tsx +86 -0
- package/src/components/primitives/collapse/collapse.css +88 -0
- package/src/components/primitives/collapse/collapse.typecheck.tsx +29 -0
- package/src/components/primitives/input/NumberField.tsx +139 -0
- package/src/components/primitives/input/OtpField.tsx +134 -0
- package/src/components/primitives/input/TextField.tsx +110 -0
- package/src/components/primitives/input/field-chrome.tsx +83 -0
- package/src/components/primitives/input/input.css +333 -0
- package/src/components/primitives/radio-group/RadioGroup.tsx +183 -0
- package/src/components/primitives/radio-group/radio-group.css +300 -0
- package/src/components/primitives/tag/Tag.tsx +143 -0
- package/src/components/primitives/tag/ToggleTag.tsx +97 -0
- package/src/components/primitives/tag/tag.css +248 -0
- package/src/components/primitives/textarea/Textarea.tsx +190 -0
- package/src/components/primitives/textarea/textarea.css +219 -0
- package/src/components/primitives/toggle/Toggle.tsx +105 -0
- package/src/components/primitives/toggle/toggle.css +152 -0
- package/src/css.d.ts +1 -0
- package/src/dom-props.ts +1 -0
- package/src/engine/animate.ts +141 -0
- package/src/engine/drag.ts +53 -0
- package/src/engine/ease.ts +155 -0
- package/src/engine/flip.ts +59 -0
- package/src/engine/index.ts +13 -0
- package/src/mcp/server.ts +420 -0
- package/src/motion/element.tsx +53 -0
- package/src/motion/flip.tsx +87 -0
- package/src/motion/glide.tsx +47 -0
- package/src/motion/motion-timing.ts +33 -0
- package/src/motion/presence-context.ts +18 -0
- package/src/motion/presence.tsx +91 -0
- package/src/motion/timing.ts +49 -0
- package/src/motion/use-motion.ts +64 -0
- package/src/styles.css +26 -0
- package/src/tokens/avatar.css +20 -0
- package/src/tokens/color.css +58 -0
- package/src/tokens/elevation.css +22 -0
- package/src/tokens/fonts.css +3 -0
- package/src/tokens/glass.css +20 -0
- package/src/tokens/icons.css +7 -0
- package/src/tokens/layers.css +6 -0
- package/src/tokens/motion-scale.ts +17 -0
- package/src/tokens/motion-tokens.ts +92 -0
- package/src/tokens/motion.css +49 -0
- package/src/tokens/radius.css +11 -0
- package/src/tokens/semantic.css +65 -0
- package/src/tokens/spacing.css +26 -0
- package/src/tokens/typography.css +52 -0
package/package.json
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zyncat/ui",
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "A React 19 design system: accessible, animated UI components built on a small, closed CSS design-token vocabulary. No Tailwind, no CSS-in-JS.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"react-19",
|
|
8
|
+
"design-system",
|
|
9
|
+
"component-library",
|
|
10
|
+
"react-components",
|
|
11
|
+
"ui-components",
|
|
12
|
+
"ui-kit",
|
|
13
|
+
"design-tokens",
|
|
14
|
+
"css",
|
|
15
|
+
"typescript",
|
|
16
|
+
"accessible",
|
|
17
|
+
"a11y",
|
|
18
|
+
"motion",
|
|
19
|
+
"animation",
|
|
20
|
+
"headless-ui",
|
|
21
|
+
"esm"
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"author": "Tabsir Ahammed",
|
|
26
|
+
"homepage": "https://ui.zyncat.app",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/Tabsir99/zyncat-ui.git"
|
|
30
|
+
},
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/Tabsir99/zyncat-ui/issues"
|
|
33
|
+
},
|
|
34
|
+
"sideEffects": [
|
|
35
|
+
"*.css"
|
|
36
|
+
],
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"bin": {
|
|
41
|
+
"zyncat-ui-mcp": "./dist/mcp.js"
|
|
42
|
+
},
|
|
43
|
+
"exports": {
|
|
44
|
+
"./button": {
|
|
45
|
+
"source": "./src/components/primitives/button/Button.tsx",
|
|
46
|
+
"types": "./dist/button.d.ts",
|
|
47
|
+
"import": "./dist/button.js"
|
|
48
|
+
},
|
|
49
|
+
"./collapse": {
|
|
50
|
+
"source": "./src/components/primitives/collapse/Collapse.tsx",
|
|
51
|
+
"types": "./dist/collapse.d.ts",
|
|
52
|
+
"import": "./dist/collapse.js"
|
|
53
|
+
},
|
|
54
|
+
"./badge": {
|
|
55
|
+
"source": "./src/components/primitives/badge/Badge.tsx",
|
|
56
|
+
"types": "./dist/badge.d.ts",
|
|
57
|
+
"import": "./dist/badge.js"
|
|
58
|
+
},
|
|
59
|
+
"./status-badge": {
|
|
60
|
+
"source": "./src/components/primitives/badge/StatusBadge.tsx",
|
|
61
|
+
"types": "./dist/status-badge.d.ts",
|
|
62
|
+
"import": "./dist/status-badge.js"
|
|
63
|
+
},
|
|
64
|
+
"./count-badge": {
|
|
65
|
+
"source": "./src/components/primitives/badge/CountBadge.tsx",
|
|
66
|
+
"types": "./dist/count-badge.d.ts",
|
|
67
|
+
"import": "./dist/count-badge.js"
|
|
68
|
+
},
|
|
69
|
+
"./avatar": {
|
|
70
|
+
"source": "./src/components/primitives/avatar/Avatar.tsx",
|
|
71
|
+
"types": "./dist/avatar.d.ts",
|
|
72
|
+
"import": "./dist/avatar.js"
|
|
73
|
+
},
|
|
74
|
+
"./avatar-group": {
|
|
75
|
+
"source": "./src/components/primitives/avatar/AvatarGroup.tsx",
|
|
76
|
+
"types": "./dist/avatar-group.d.ts",
|
|
77
|
+
"import": "./dist/avatar-group.js"
|
|
78
|
+
},
|
|
79
|
+
"./tag": {
|
|
80
|
+
"source": "./src/components/primitives/tag/Tag.tsx",
|
|
81
|
+
"types": "./dist/tag.d.ts",
|
|
82
|
+
"import": "./dist/tag.js"
|
|
83
|
+
},
|
|
84
|
+
"./toggle-tag": {
|
|
85
|
+
"source": "./src/components/primitives/tag/ToggleTag.tsx",
|
|
86
|
+
"types": "./dist/toggle-tag.d.ts",
|
|
87
|
+
"import": "./dist/toggle-tag.js"
|
|
88
|
+
},
|
|
89
|
+
"./table": {
|
|
90
|
+
"source": "./src/components/composites/table/Table.tsx",
|
|
91
|
+
"types": "./dist/table.d.ts",
|
|
92
|
+
"import": "./dist/table.js"
|
|
93
|
+
},
|
|
94
|
+
"./pagination": {
|
|
95
|
+
"source": "./src/components/composites/pagination/Pagination.tsx",
|
|
96
|
+
"types": "./dist/pagination.d.ts",
|
|
97
|
+
"import": "./dist/pagination.js"
|
|
98
|
+
},
|
|
99
|
+
"./text-field": {
|
|
100
|
+
"source": "./src/components/primitives/input/TextField.tsx",
|
|
101
|
+
"types": "./dist/text-field.d.ts",
|
|
102
|
+
"import": "./dist/text-field.js"
|
|
103
|
+
},
|
|
104
|
+
"./number-field": {
|
|
105
|
+
"source": "./src/components/primitives/input/NumberField.tsx",
|
|
106
|
+
"types": "./dist/number-field.d.ts",
|
|
107
|
+
"import": "./dist/number-field.js"
|
|
108
|
+
},
|
|
109
|
+
"./otp-field": {
|
|
110
|
+
"source": "./src/components/primitives/input/OtpField.tsx",
|
|
111
|
+
"types": "./dist/otp-field.d.ts",
|
|
112
|
+
"import": "./dist/otp-field.js"
|
|
113
|
+
},
|
|
114
|
+
"./textarea": {
|
|
115
|
+
"source": "./src/components/primitives/textarea/Textarea.tsx",
|
|
116
|
+
"types": "./dist/textarea.d.ts",
|
|
117
|
+
"import": "./dist/textarea.js"
|
|
118
|
+
},
|
|
119
|
+
"./checkbox": {
|
|
120
|
+
"source": "./src/components/primitives/checkbox/Checkbox.tsx",
|
|
121
|
+
"types": "./dist/checkbox.d.ts",
|
|
122
|
+
"import": "./dist/checkbox.js"
|
|
123
|
+
},
|
|
124
|
+
"./toggle": {
|
|
125
|
+
"source": "./src/components/primitives/toggle/Toggle.tsx",
|
|
126
|
+
"types": "./dist/toggle.d.ts",
|
|
127
|
+
"import": "./dist/toggle.js"
|
|
128
|
+
},
|
|
129
|
+
"./radio-group": {
|
|
130
|
+
"source": "./src/components/primitives/radio-group/RadioGroup.tsx",
|
|
131
|
+
"types": "./dist/radio-group.d.ts",
|
|
132
|
+
"import": "./dist/radio-group.js"
|
|
133
|
+
},
|
|
134
|
+
"./select": {
|
|
135
|
+
"source": "./src/components/composites/select/Select.tsx",
|
|
136
|
+
"types": "./dist/select.d.ts",
|
|
137
|
+
"import": "./dist/select.js"
|
|
138
|
+
},
|
|
139
|
+
"./multi-select": {
|
|
140
|
+
"source": "./src/components/composites/select/MultiSelect.tsx",
|
|
141
|
+
"types": "./dist/multi-select.d.ts",
|
|
142
|
+
"import": "./dist/multi-select.js"
|
|
143
|
+
},
|
|
144
|
+
"./date-field": {
|
|
145
|
+
"source": "./src/components/composites/date-picker/DateField.tsx",
|
|
146
|
+
"types": "./dist/date-field.d.ts",
|
|
147
|
+
"import": "./dist/date-field.js"
|
|
148
|
+
},
|
|
149
|
+
"./datetime-field": {
|
|
150
|
+
"source": "./src/components/composites/date-picker/DateTimeField.tsx",
|
|
151
|
+
"types": "./dist/datetime-field.d.ts",
|
|
152
|
+
"import": "./dist/datetime-field.js"
|
|
153
|
+
},
|
|
154
|
+
"./date-range-field": {
|
|
155
|
+
"source": "./src/components/composites/date-picker/DateRangeField.tsx",
|
|
156
|
+
"types": "./dist/date-range-field.d.ts",
|
|
157
|
+
"import": "./dist/date-range-field.js"
|
|
158
|
+
},
|
|
159
|
+
"./time-field": {
|
|
160
|
+
"source": "./src/components/composites/date-picker/TimeField.tsx",
|
|
161
|
+
"types": "./dist/time-field.d.ts",
|
|
162
|
+
"import": "./dist/time-field.js"
|
|
163
|
+
},
|
|
164
|
+
"./tabs": {
|
|
165
|
+
"source": "./src/components/composites/tabs/Tabs.tsx",
|
|
166
|
+
"types": "./dist/tabs.d.ts",
|
|
167
|
+
"import": "./dist/tabs.js"
|
|
168
|
+
},
|
|
169
|
+
"./popover": {
|
|
170
|
+
"source": "./src/components/composites/popover/Popover.tsx",
|
|
171
|
+
"types": "./dist/popover.d.ts",
|
|
172
|
+
"import": "./dist/popover.js"
|
|
173
|
+
},
|
|
174
|
+
"./sheet": {
|
|
175
|
+
"source": "./src/components/composites/sheet/Sheet.tsx",
|
|
176
|
+
"types": "./dist/sheet.d.ts",
|
|
177
|
+
"import": "./dist/sheet.js"
|
|
178
|
+
},
|
|
179
|
+
"./dialog": {
|
|
180
|
+
"source": "./src/components/composites/dialog/Dialog.tsx",
|
|
181
|
+
"types": "./dist/dialog.d.ts",
|
|
182
|
+
"import": "./dist/dialog.js"
|
|
183
|
+
},
|
|
184
|
+
"./tooltip": {
|
|
185
|
+
"source": "./src/components/composites/tooltip/Tooltip.tsx",
|
|
186
|
+
"types": "./dist/tooltip.d.ts",
|
|
187
|
+
"import": "./dist/tooltip.js"
|
|
188
|
+
},
|
|
189
|
+
"./alert": {
|
|
190
|
+
"source": "./src/components/composites/alert/Alert.tsx",
|
|
191
|
+
"types": "./dist/alert.d.ts",
|
|
192
|
+
"import": "./dist/alert.js"
|
|
193
|
+
},
|
|
194
|
+
"./toast": {
|
|
195
|
+
"source": "./src/components/composites/toast/Toast.tsx",
|
|
196
|
+
"types": "./dist/toast.d.ts",
|
|
197
|
+
"import": "./dist/toast.js"
|
|
198
|
+
},
|
|
199
|
+
"./toast-store": {
|
|
200
|
+
"source": "./src/components/composites/toast/toast-store.ts",
|
|
201
|
+
"types": "./dist/toast-store.d.ts",
|
|
202
|
+
"import": "./dist/toast-store.js"
|
|
203
|
+
},
|
|
204
|
+
"./motion-tokens": {
|
|
205
|
+
"source": "./src/tokens/motion-tokens.ts",
|
|
206
|
+
"types": "./dist/motion-tokens.d.ts",
|
|
207
|
+
"import": "./dist/motion-tokens.js"
|
|
208
|
+
},
|
|
209
|
+
"./motion-devtools": {
|
|
210
|
+
"source": "./src/components/dev/MotionDevtools.tsx",
|
|
211
|
+
"types": "./dist/motion-devtools.d.ts",
|
|
212
|
+
"import": "./dist/motion-devtools.js"
|
|
213
|
+
},
|
|
214
|
+
"./glide": {
|
|
215
|
+
"source": "./src/motion/glide.tsx",
|
|
216
|
+
"types": "./dist/glide.d.ts",
|
|
217
|
+
"import": "./dist/glide.js"
|
|
218
|
+
},
|
|
219
|
+
"./styles.css": "./src/styles.css",
|
|
220
|
+
"./next": {
|
|
221
|
+
"types": "./next.d.mts",
|
|
222
|
+
"default": "./next.mjs"
|
|
223
|
+
},
|
|
224
|
+
"./package.json": "./package.json"
|
|
225
|
+
},
|
|
226
|
+
"files": [
|
|
227
|
+
"dist",
|
|
228
|
+
"src",
|
|
229
|
+
"llms.txt",
|
|
230
|
+
"next.mjs",
|
|
231
|
+
"next.d.mts"
|
|
232
|
+
],
|
|
233
|
+
"scripts": {
|
|
234
|
+
"build": "tsup",
|
|
235
|
+
"typecheck": "tsc --noEmit && tsc -p tsconfig.node.json",
|
|
236
|
+
"check:css": "node scripts/check-css-graph.mjs",
|
|
237
|
+
"format": "prettier --write .",
|
|
238
|
+
"format:check": "prettier --check .",
|
|
239
|
+
"prepublishOnly": "pnpm build"
|
|
240
|
+
},
|
|
241
|
+
"peerDependencies": {
|
|
242
|
+
"react": "^19",
|
|
243
|
+
"react-dom": "^19"
|
|
244
|
+
},
|
|
245
|
+
"devDependencies": {
|
|
246
|
+
"@phosphor-icons/react": "^2.1.10",
|
|
247
|
+
"@types/node": "^26.0.1",
|
|
248
|
+
"@types/react": "^19.2.17",
|
|
249
|
+
"@types/react-dom": "^19.2.3",
|
|
250
|
+
"madge": "^8.0.0",
|
|
251
|
+
"prettier": "^3.8.3",
|
|
252
|
+
"react": "^19.2.7",
|
|
253
|
+
"react-dom": "^19.2.7",
|
|
254
|
+
"tsup": "^8.5.0",
|
|
255
|
+
"typescript": "~6.0.3"
|
|
256
|
+
}
|
|
257
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import './alert.css';
|
|
4
|
+
import type { CSSProperties, HTMLAttributes, ReactNode } from 'react';
|
|
5
|
+
import { Presence } from '../../../motion/presence';
|
|
6
|
+
import { Motion } from '../../../motion/element';
|
|
7
|
+
import { resolveMotionTiming } from '../../../motion/motion-timing';
|
|
8
|
+
import type { DisableableAnimation } from '../../../motion/timing';
|
|
9
|
+
import { Icon, type IconName } from '../../internal/icon/Icon';
|
|
10
|
+
import { Button } from '../../primitives/button/Button';
|
|
11
|
+
import { IconSlot } from '../../internal/icon/IconSlot';
|
|
12
|
+
import { useControllable } from '../../internal/hooks/use-controllable';
|
|
13
|
+
import type { DataAttributes } from '../../../dom-props';
|
|
14
|
+
import { cx } from '../../internal/utils/cx';
|
|
15
|
+
|
|
16
|
+
export type AlertTone = 'info' | 'success' | 'warning' | 'danger';
|
|
17
|
+
|
|
18
|
+
export interface AlertAction {
|
|
19
|
+
/** Sentence-case label, e.g. "Update billing". */
|
|
20
|
+
label: string;
|
|
21
|
+
onClick?: () => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface AlertOwnProps {
|
|
25
|
+
/** Status of the message; info/success are polite, warning/danger assertive. Default 'info'. */
|
|
26
|
+
tone?: AlertTone;
|
|
27
|
+
/** The message - sentence case, ideally one line. */
|
|
28
|
+
title: ReactNode;
|
|
29
|
+
/** Optional description; stays neutral - tone marks the message, not the prose. */
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
/** One action max, rendered as the system secondary small button. */
|
|
32
|
+
action?: AlertAction;
|
|
33
|
+
/** Renders the always-visible close button. Uncontrolled unless `open` is given. */
|
|
34
|
+
dismissible?: boolean;
|
|
35
|
+
/** Fires on dismiss. With `open` set, the parent owns hiding the alert. */
|
|
36
|
+
onDismiss?: () => void;
|
|
37
|
+
/** Controlled visibility; omit for uncontrolled. Exit eases shut (height collapse). */
|
|
38
|
+
open?: boolean;
|
|
39
|
+
/** App-level strip: square corners, hairline below only. Paint modifier. */
|
|
40
|
+
banner?: boolean;
|
|
41
|
+
/** Override the tone glyph; pass null to render no glyph. */
|
|
42
|
+
icon?: ReactNode | null;
|
|
43
|
+
/** Extra class(es) merged onto the alert. */
|
|
44
|
+
className?: string;
|
|
45
|
+
/** Inline styles merged onto the alert. */
|
|
46
|
+
style?: CSSProperties;
|
|
47
|
+
/** Enter/exit timing - motion tokens only, or `null` to disable (the height collapse snaps).
|
|
48
|
+
* @default height 'slow'/'entrance'; opacity in 'base'/'entrance', out 'fast'/'exit' */
|
|
49
|
+
animation?: DisableableAnimation;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface AlertProps extends AlertOwnProps {
|
|
53
|
+
/** Standard <div> attributes (aria-*, data-*, ...) forwarded to the alert. */
|
|
54
|
+
htmlProps?: Omit<HTMLAttributes<HTMLDivElement>, keyof AlertOwnProps> & DataAttributes;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const ALERT_HEIGHT_TIMING = {
|
|
58
|
+
open: { duration: 'slow', ease: 'entrance' },
|
|
59
|
+
close: { duration: 'slow', ease: 'entrance' },
|
|
60
|
+
} as const;
|
|
61
|
+
const ALERT_OPACITY_TIMING = {
|
|
62
|
+
open: { duration: 'base', ease: 'entrance' },
|
|
63
|
+
close: { duration: 'fast', ease: 'exit' },
|
|
64
|
+
} as const;
|
|
65
|
+
|
|
66
|
+
const TONE_GLYPH: Record<AlertTone, IconName> = {
|
|
67
|
+
info: 'info',
|
|
68
|
+
success: 'check-circle',
|
|
69
|
+
warning: 'warning',
|
|
70
|
+
danger: 'warning-circle',
|
|
71
|
+
};
|
|
72
|
+
const TONE_ROLE: Record<AlertTone, string> = { info: 'status', success: 'status', warning: 'alert', danger: 'alert' };
|
|
73
|
+
|
|
74
|
+
export function Alert({
|
|
75
|
+
tone = 'info',
|
|
76
|
+
title,
|
|
77
|
+
children = null,
|
|
78
|
+
action = null,
|
|
79
|
+
dismissible = false,
|
|
80
|
+
onDismiss,
|
|
81
|
+
open,
|
|
82
|
+
banner = false,
|
|
83
|
+
icon,
|
|
84
|
+
className = '',
|
|
85
|
+
style,
|
|
86
|
+
htmlProps,
|
|
87
|
+
animation,
|
|
88
|
+
}: AlertProps) {
|
|
89
|
+
const [isOpen, setOpen] = useControllable(open, true, onDismiss);
|
|
90
|
+
const dismiss = () => setOpen(false);
|
|
91
|
+
|
|
92
|
+
const h = resolveMotionTiming(animation, ALERT_HEIGHT_TIMING);
|
|
93
|
+
const o = resolveMotionTiming(animation, ALERT_OPACITY_TIMING);
|
|
94
|
+
|
|
95
|
+
const cls = cx('alert', banner && 'alert--banner', className);
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<Presence initial={false}>
|
|
99
|
+
{isOpen && (
|
|
100
|
+
<Motion
|
|
101
|
+
key="alert-shell"
|
|
102
|
+
className="alert-shell"
|
|
103
|
+
animate={[
|
|
104
|
+
{ height: [0, 'auto'], timing: h.open },
|
|
105
|
+
{ opacity: [0, 1], timing: o.open },
|
|
106
|
+
]}
|
|
107
|
+
exit={[
|
|
108
|
+
{ height: ['auto', 0], timing: h.close },
|
|
109
|
+
{ opacity: [1, 0], timing: o.close },
|
|
110
|
+
]}
|
|
111
|
+
>
|
|
112
|
+
<div className={cls} style={style} data-tone={tone} role={TONE_ROLE[tone] || 'status'} {...htmlProps}>
|
|
113
|
+
{icon === null ? null : (
|
|
114
|
+
<span className="alert__icon" aria-hidden="true">
|
|
115
|
+
{icon !== undefined ? (
|
|
116
|
+
<IconSlot size="md">{icon}</IconSlot>
|
|
117
|
+
) : (
|
|
118
|
+
<Icon name={TONE_GLYPH[tone] || 'info'} size="md" />
|
|
119
|
+
)}
|
|
120
|
+
</span>
|
|
121
|
+
)}
|
|
122
|
+
<div className="alert__body">
|
|
123
|
+
<p className="alert__title">{title}</p>
|
|
124
|
+
{children != null && <p className="alert__desc">{children}</p>}
|
|
125
|
+
</div>
|
|
126
|
+
{action && (
|
|
127
|
+
<Button variant="unstyled" size="sm" className="alert__action" onClick={action.onClick}>
|
|
128
|
+
{action.label}
|
|
129
|
+
</Button>
|
|
130
|
+
)}
|
|
131
|
+
{dismissible && (
|
|
132
|
+
<button type="button" className="alert__close" aria-label="Dismiss" onClick={dismiss}>
|
|
133
|
+
<Icon name="close" size="sm" />
|
|
134
|
+
</button>
|
|
135
|
+
)}
|
|
136
|
+
</div>
|
|
137
|
+
</Motion>
|
|
138
|
+
)}
|
|
139
|
+
</Presence>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/* alert.css - the persistent in-flow status message: a lit tinted pane per tone. */
|
|
2
|
+
|
|
3
|
+
.alert-shell {
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.alert {
|
|
8
|
+
/* tone hooks - repointed by [data-tone] below; info is the default */
|
|
9
|
+
--alert-hue: var(--info);
|
|
10
|
+
--alert-fg: var(--info-text);
|
|
11
|
+
--alert-bg: var(--info-subtle);
|
|
12
|
+
--alert-wash: var(--accent-wash); /* info's wash = accent (teal) */
|
|
13
|
+
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: var(--space-3);
|
|
18
|
+
padding: var(--space-3) var(--space-4);
|
|
19
|
+
/* the lit pane: top-light gradient over the tint + 1px inner highlight (Button's lighting model) */
|
|
20
|
+
background: linear-gradient(180deg, color-mix(in oklab, var(--bg-surface) 45%, var(--alert-bg)), var(--alert-bg));
|
|
21
|
+
border: var(--border-hairline) solid color-mix(in oklab, var(--alert-hue) 30%, transparent);
|
|
22
|
+
border-radius: var(--radius-lg);
|
|
23
|
+
box-shadow: inset 0 1px 0 0 rgb(255 255 255 / 0.55);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.alert[data-tone='success'] {
|
|
27
|
+
--alert-hue: var(--success);
|
|
28
|
+
--alert-fg: var(--success-text);
|
|
29
|
+
--alert-bg: var(--success-subtle);
|
|
30
|
+
--alert-wash: var(--success-wash);
|
|
31
|
+
}
|
|
32
|
+
.alert[data-tone='warning'] {
|
|
33
|
+
--alert-hue: var(--warning);
|
|
34
|
+
--alert-fg: var(--warning-text);
|
|
35
|
+
--alert-bg: var(--warning-subtle);
|
|
36
|
+
--alert-wash: var(--warning-wash);
|
|
37
|
+
}
|
|
38
|
+
.alert[data-tone='danger'] {
|
|
39
|
+
--alert-hue: var(--danger);
|
|
40
|
+
--alert-fg: var(--danger-text);
|
|
41
|
+
--alert-bg: var(--danger-subtle);
|
|
42
|
+
--alert-wash: var(--danger-wash);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* with a description: glyph rides the title line, controls stay centered */
|
|
46
|
+
.alert:has(.alert__desc) {
|
|
47
|
+
align-items: flex-start;
|
|
48
|
+
}
|
|
49
|
+
.alert:has(.alert__desc) .alert__action,
|
|
50
|
+
.alert:has(.alert__desc) .alert__close {
|
|
51
|
+
align-self: center;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.alert--banner {
|
|
55
|
+
border-radius: 0;
|
|
56
|
+
border-block-start: 0;
|
|
57
|
+
border-inline: 0;
|
|
58
|
+
padding-inline: var(--space-6);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Glyph - one --leading-body tall so it centers on the title line. */
|
|
62
|
+
.alert__icon {
|
|
63
|
+
flex: none;
|
|
64
|
+
display: grid;
|
|
65
|
+
place-items: center;
|
|
66
|
+
height: var(--leading-body);
|
|
67
|
+
color: var(--alert-hue);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.alert__body {
|
|
71
|
+
flex: 1 1 auto;
|
|
72
|
+
min-width: 0;
|
|
73
|
+
}
|
|
74
|
+
.alert__title {
|
|
75
|
+
margin: 0;
|
|
76
|
+
font: var(--type-label);
|
|
77
|
+
color: var(--alert-fg);
|
|
78
|
+
text-wrap: pretty;
|
|
79
|
+
}
|
|
80
|
+
.alert__desc {
|
|
81
|
+
margin: var(--space-1) 0 0;
|
|
82
|
+
font: var(--type-caption);
|
|
83
|
+
color: color-mix(in oklab, var(--alert-fg) 56%, var(--text-body));
|
|
84
|
+
text-wrap: pretty;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Action - the system .btn .btn--sm re-skinned to the pane's tone (alert-local chrome, not a global Button variant). */
|
|
88
|
+
.alert__action {
|
|
89
|
+
flex: none;
|
|
90
|
+
color: var(--alert-fg);
|
|
91
|
+
background: transparent;
|
|
92
|
+
}
|
|
93
|
+
.alert__action:hover:not(:disabled) {
|
|
94
|
+
color: var(--alert-fg);
|
|
95
|
+
background: var(--alert-wash);
|
|
96
|
+
}
|
|
97
|
+
.alert__action:active:not(:disabled) {
|
|
98
|
+
background: color-mix(in oklab, var(--alert-hue) 16%, transparent);
|
|
99
|
+
transform: translateY(var(--space-px));
|
|
100
|
+
}
|
|
101
|
+
.alert[data-tone='danger'] .alert__action {
|
|
102
|
+
--btn-ring: var(--ring-danger);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* Dismiss - always visible (alerts persist; no hover-reveal like toast). */
|
|
106
|
+
.alert__close {
|
|
107
|
+
flex: none;
|
|
108
|
+
appearance: none;
|
|
109
|
+
display: grid;
|
|
110
|
+
place-items: center;
|
|
111
|
+
width: var(--space-6);
|
|
112
|
+
height: var(--space-6);
|
|
113
|
+
margin: 0;
|
|
114
|
+
padding: 0;
|
|
115
|
+
border: none;
|
|
116
|
+
border-radius: var(--radius-sm);
|
|
117
|
+
background: transparent;
|
|
118
|
+
color: color-mix(in oklab, var(--alert-fg) 64%, transparent);
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
transition: var(--transition-control);
|
|
121
|
+
}
|
|
122
|
+
.alert__close:hover {
|
|
123
|
+
background: color-mix(in oklab, var(--alert-fg) 9%, transparent);
|
|
124
|
+
color: var(--alert-fg);
|
|
125
|
+
}
|
|
126
|
+
.alert__close:active {
|
|
127
|
+
background: color-mix(in oklab, var(--alert-fg) 14%, transparent);
|
|
128
|
+
}
|
|
129
|
+
.alert__close:focus-visible {
|
|
130
|
+
outline: none;
|
|
131
|
+
box-shadow: var(--focus-ring);
|
|
132
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import './date-picker.css';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { Popover } from '../popover/Popover';
|
|
6
|
+
import { FieldShell, FieldTrigger, type DateFieldBaseProps } from './field-shell';
|
|
7
|
+
import { useControllable } from '../../internal/hooks/use-controllable';
|
|
8
|
+
import { DtpPanel } from './calendar-panel';
|
|
9
|
+
import { displayDay } from './date-utils';
|
|
10
|
+
|
|
11
|
+
export interface DateFieldProps extends DateFieldBaseProps {
|
|
12
|
+
/** Controlled value, 'YYYY-MM-DD'. */
|
|
13
|
+
value?: string | null;
|
|
14
|
+
/** Uncontrolled initial value, 'YYYY-MM-DD'. Use instead of `value`. @default null */
|
|
15
|
+
defaultValue?: string | null;
|
|
16
|
+
/** Fires on each day pick (commit is live), with the picked 'YYYY-MM-DD'. */
|
|
17
|
+
onChange?: (value: string) => void;
|
|
18
|
+
/** Trigger text shown when no date is picked. @default 'Pick a date' */
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
/** IANA timezone name (e.g. 'Europe/Riga') - display context only, shown with its GMT offset in the footer. */
|
|
21
|
+
timezone?: string;
|
|
22
|
+
/** Earliest pickable date, 'YYYY-MM-DD', inclusive. */
|
|
23
|
+
min?: string;
|
|
24
|
+
/** Latest pickable date, 'YYYY-MM-DD', inclusive. */
|
|
25
|
+
max?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function DateField({
|
|
29
|
+
value,
|
|
30
|
+
defaultValue = null,
|
|
31
|
+
onChange,
|
|
32
|
+
label,
|
|
33
|
+
placeholder = 'Pick a date',
|
|
34
|
+
timezone,
|
|
35
|
+
min,
|
|
36
|
+
max,
|
|
37
|
+
required = false,
|
|
38
|
+
invalid = false,
|
|
39
|
+
message,
|
|
40
|
+
disabled = false,
|
|
41
|
+
className = '',
|
|
42
|
+
htmlProps,
|
|
43
|
+
animation,
|
|
44
|
+
}: DateFieldProps) {
|
|
45
|
+
const [val, commit] = useControllable(value, defaultValue, onChange);
|
|
46
|
+
const [pickerOpen, setPickerOpen] = useState(false);
|
|
47
|
+
const trigger = <FieldTrigger display={displayDay(val)} placeholder={placeholder} disabled={disabled} />;
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<FieldShell
|
|
51
|
+
variant="dtf"
|
|
52
|
+
label={label}
|
|
53
|
+
required={required}
|
|
54
|
+
invalid={invalid}
|
|
55
|
+
message={message}
|
|
56
|
+
icon="calendar"
|
|
57
|
+
className={className}
|
|
58
|
+
htmlProps={htmlProps}
|
|
59
|
+
>
|
|
60
|
+
<Popover
|
|
61
|
+
trigger={trigger}
|
|
62
|
+
side="bottom"
|
|
63
|
+
align="start"
|
|
64
|
+
animation={animation}
|
|
65
|
+
open={pickerOpen}
|
|
66
|
+
onOpenChange={setPickerOpen}
|
|
67
|
+
>
|
|
68
|
+
<DtpPanel
|
|
69
|
+
val={val}
|
|
70
|
+
commit={commit}
|
|
71
|
+
close={() => setPickerOpen(false)}
|
|
72
|
+
min={min}
|
|
73
|
+
max={max}
|
|
74
|
+
timezone={timezone}
|
|
75
|
+
label={label}
|
|
76
|
+
/>
|
|
77
|
+
</Popover>
|
|
78
|
+
</FieldShell>
|
|
79
|
+
);
|
|
80
|
+
}
|