@cladd-ui/react 0.0.1 → 0.0.2

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 (241) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -1
  3. package/components/Backdrop.d.ts +8 -0
  4. package/components/Backdrop.d.ts.map +1 -0
  5. package/components/Backdrop.js +7 -0
  6. package/components/Backdrop.js.map +1 -0
  7. package/components/BlockTitle.d.ts +10 -0
  8. package/components/BlockTitle.d.ts.map +1 -0
  9. package/components/BlockTitle.js +7 -0
  10. package/components/BlockTitle.js.map +1 -0
  11. package/components/Button.d.ts +61 -0
  12. package/components/Button.d.ts.map +1 -0
  13. package/components/Button.js +83 -0
  14. package/components/Button.js.map +1 -0
  15. package/components/Checkbox.d.ts +57 -0
  16. package/components/Checkbox.d.ts.map +1 -0
  17. package/components/Checkbox.js +48 -0
  18. package/components/Checkbox.js.map +1 -0
  19. package/components/Chip.d.ts +47 -0
  20. package/components/Chip.d.ts.map +1 -0
  21. package/components/Chip.js +55 -0
  22. package/components/Chip.js.map +1 -0
  23. package/components/Dialog.d.ts +118 -0
  24. package/components/Dialog.d.ts.map +1 -0
  25. package/components/Dialog.js +178 -0
  26. package/components/Dialog.js.map +1 -0
  27. package/components/DialogsPortal.d.ts +2 -0
  28. package/components/DialogsPortal.d.ts.map +1 -0
  29. package/components/DialogsPortal.js +17 -0
  30. package/components/DialogsPortal.js.map +1 -0
  31. package/components/DialogsPortalContext.d.ts +49 -0
  32. package/components/DialogsPortalContext.d.ts.map +1 -0
  33. package/components/DialogsPortalContext.js +17 -0
  34. package/components/DialogsPortalContext.js.map +1 -0
  35. package/components/FocusableLayer.d.ts +25 -0
  36. package/components/FocusableLayer.d.ts.map +1 -0
  37. package/components/FocusableLayer.js +18 -0
  38. package/components/FocusableLayer.js.map +1 -0
  39. package/components/Input.d.ts +87 -0
  40. package/components/Input.d.ts.map +1 -0
  41. package/components/Input.js +93 -0
  42. package/components/Input.js.map +1 -0
  43. package/components/Link.d.ts +28 -0
  44. package/components/Link.d.ts.map +1 -0
  45. package/components/Link.js +21 -0
  46. package/components/Link.js.map +1 -0
  47. package/components/List.d.ts +8 -0
  48. package/components/List.d.ts.map +1 -0
  49. package/components/List.js +7 -0
  50. package/components/List.js.map +1 -0
  51. package/components/ListButton.d.ts +61 -0
  52. package/components/ListButton.d.ts.map +1 -0
  53. package/components/ListButton.js +9 -0
  54. package/components/ListButton.js.map +1 -0
  55. package/components/ListItem.d.ts +8 -0
  56. package/components/ListItem.d.ts.map +1 -0
  57. package/components/ListItem.js +7 -0
  58. package/components/ListItem.js.map +1 -0
  59. package/components/ListSeparator.d.ts +8 -0
  60. package/components/ListSeparator.d.ts.map +1 -0
  61. package/components/ListSeparator.js +7 -0
  62. package/components/ListSeparator.js.map +1 -0
  63. package/components/ModalController.d.ts +26 -0
  64. package/components/ModalController.d.ts.map +1 -0
  65. package/components/ModalController.js +52 -0
  66. package/components/ModalController.js.map +1 -0
  67. package/components/NumberField.d.ts +49 -0
  68. package/components/NumberField.d.ts.map +1 -0
  69. package/components/NumberField.js +34 -0
  70. package/components/NumberField.js.map +1 -0
  71. package/components/Popover.d.ts +137 -0
  72. package/components/Popover.d.ts.map +1 -0
  73. package/components/Popover.js +366 -0
  74. package/components/Popover.js.map +1 -0
  75. package/components/Popup.d.ts +120 -0
  76. package/components/Popup.d.ts.map +1 -0
  77. package/components/Popup.js +235 -0
  78. package/components/Popup.js.map +1 -0
  79. package/components/PopupContent.d.ts +19 -0
  80. package/components/PopupContent.d.ts.map +1 -0
  81. package/components/PopupContent.js +8 -0
  82. package/components/PopupContent.js.map +1 -0
  83. package/components/Preloader.d.ts +12 -0
  84. package/components/Preloader.d.ts.map +1 -0
  85. package/components/Preloader.js +30 -0
  86. package/components/Preloader.js.map +1 -0
  87. package/components/Radio.d.ts +53 -0
  88. package/components/Radio.d.ts.map +1 -0
  89. package/components/Radio.js +46 -0
  90. package/components/Radio.js.map +1 -0
  91. package/components/Range.d.ts +35 -0
  92. package/components/Range.d.ts.map +1 -0
  93. package/components/Range.js +76 -0
  94. package/components/Range.js.map +1 -0
  95. package/components/Searchbar.d.ts +29 -0
  96. package/components/Searchbar.d.ts.map +1 -0
  97. package/components/Searchbar.js +10 -0
  98. package/components/Searchbar.js.map +1 -0
  99. package/components/Segmented.d.ts +39 -0
  100. package/components/Segmented.d.ts.map +1 -0
  101. package/components/Segmented.js +26 -0
  102. package/components/Segmented.js.map +1 -0
  103. package/components/SegmentedButton.d.ts +13 -0
  104. package/components/SegmentedButton.d.ts.map +1 -0
  105. package/components/SegmentedButton.js +10 -0
  106. package/components/SegmentedButton.js.map +1 -0
  107. package/components/SegmentedContext.d.ts +36 -0
  108. package/components/SegmentedContext.d.ts.map +1 -0
  109. package/components/SegmentedContext.js +10 -0
  110. package/components/SegmentedContext.js.map +1 -0
  111. package/components/Select.d.ts +145 -0
  112. package/components/Select.d.ts.map +1 -0
  113. package/components/Select.js +316 -0
  114. package/components/Select.js.map +1 -0
  115. package/components/Surface.d.ts +67 -0
  116. package/components/Surface.d.ts.map +1 -0
  117. package/components/Surface.js +36 -0
  118. package/components/Surface.js.map +1 -0
  119. package/components/SurfaceContent.d.ts +8 -0
  120. package/components/SurfaceContent.d.ts.map +1 -0
  121. package/components/SurfaceContent.js +7 -0
  122. package/components/SurfaceContent.js.map +1 -0
  123. package/components/SurfaceContext.d.ts +19 -0
  124. package/components/SurfaceContext.d.ts.map +1 -0
  125. package/components/SurfaceContext.js +9 -0
  126. package/components/SurfaceContext.js.map +1 -0
  127. package/components/SurfaceCut.d.ts +33 -0
  128. package/components/SurfaceCut.d.ts.map +1 -0
  129. package/components/SurfaceCut.js +17 -0
  130. package/components/SurfaceCut.js.map +1 -0
  131. package/components/SurfaceCutContent.d.ts +16 -0
  132. package/components/SurfaceCutContent.d.ts.map +1 -0
  133. package/components/SurfaceCutContent.js +8 -0
  134. package/components/SurfaceCutContent.js.map +1 -0
  135. package/components/TextArea.d.ts +61 -0
  136. package/components/TextArea.d.ts.map +1 -0
  137. package/components/TextArea.js +102 -0
  138. package/components/TextArea.js.map +1 -0
  139. package/components/ThemeContext.d.ts +23 -0
  140. package/components/ThemeContext.d.ts.map +1 -0
  141. package/components/ThemeContext.js +18 -0
  142. package/components/ThemeContext.js.map +1 -0
  143. package/components/Toast.d.ts +89 -0
  144. package/components/Toast.d.ts.map +1 -0
  145. package/components/Toast.js +129 -0
  146. package/components/Toast.js.map +1 -0
  147. package/components/ToastsPortal.d.ts +2 -0
  148. package/components/ToastsPortal.d.ts.map +1 -0
  149. package/components/ToastsPortal.js +17 -0
  150. package/components/ToastsPortal.js.map +1 -0
  151. package/components/ToastsPortalContext.d.ts +45 -0
  152. package/components/ToastsPortalContext.d.ts.map +1 -0
  153. package/components/ToastsPortalContext.js +17 -0
  154. package/components/ToastsPortalContext.js.map +1 -0
  155. package/components/Toggle.d.ts +69 -0
  156. package/components/Toggle.d.ts.map +1 -0
  157. package/components/Toggle.js +48 -0
  158. package/components/Toggle.js.map +1 -0
  159. package/components/Tooltip.d.ts +48 -0
  160. package/components/Tooltip.d.ts.map +1 -0
  161. package/components/Tooltip.js +90 -0
  162. package/components/Tooltip.js.map +1 -0
  163. package/components/UIProvider.d.ts +16 -0
  164. package/components/UIProvider.d.ts.map +1 -0
  165. package/components/UIProvider.js +11 -0
  166. package/components/UIProvider.js.map +1 -0
  167. package/components/WithTooltip.d.ts +36 -0
  168. package/components/WithTooltip.d.ts.map +1 -0
  169. package/components/WithTooltip.js +138 -0
  170. package/components/WithTooltip.js.map +1 -0
  171. package/components/icons/CheckIcon.d.ts +2 -0
  172. package/components/icons/CheckIcon.d.ts.map +1 -0
  173. package/components/icons/CheckIcon.js +5 -0
  174. package/components/icons/CheckIcon.js.map +1 -0
  175. package/components/icons/CloseIcon.d.ts +2 -0
  176. package/components/icons/CloseIcon.d.ts.map +1 -0
  177. package/components/icons/CloseIcon.js +3 -0
  178. package/components/icons/CloseIcon.js.map +1 -0
  179. package/components/icons/DropdownIcon.d.ts +2 -0
  180. package/components/icons/DropdownIcon.d.ts.map +1 -0
  181. package/components/icons/DropdownIcon.js +3 -0
  182. package/components/icons/DropdownIcon.js.map +1 -0
  183. package/components/icons/SearchIcon.d.ts +2 -0
  184. package/components/icons/SearchIcon.d.ts.map +1 -0
  185. package/components/icons/SearchIcon.js +5 -0
  186. package/components/icons/SearchIcon.js.map +1 -0
  187. package/hooks/use-accent-color.d.ts +2 -0
  188. package/hooks/use-accent-color.d.ts.map +1 -0
  189. package/hooks/use-accent-color.js +6 -0
  190. package/hooks/use-accent-color.js.map +1 -0
  191. package/hooks/use-device.d.ts +14 -0
  192. package/hooks/use-device.d.ts.map +1 -0
  193. package/hooks/use-device.js +68 -0
  194. package/hooks/use-device.js.map +1 -0
  195. package/hooks/use-dialog.d.ts +8 -0
  196. package/hooks/use-dialog.d.ts.map +1 -0
  197. package/hooks/use-dialog.js +38 -0
  198. package/hooks/use-dialog.js.map +1 -0
  199. package/hooks/use-focus-trap.d.ts +9 -0
  200. package/hooks/use-focus-trap.d.ts.map +1 -0
  201. package/hooks/use-focus-trap.js +106 -0
  202. package/hooks/use-focus-trap.js.map +1 -0
  203. package/hooks/use-modal-utils.d.ts +17 -0
  204. package/hooks/use-modal-utils.d.ts.map +1 -0
  205. package/hooks/use-modal-utils.js +110 -0
  206. package/hooks/use-modal-utils.js.map +1 -0
  207. package/hooks/use-surface.d.ts +2 -0
  208. package/hooks/use-surface.d.ts.map +1 -0
  209. package/hooks/use-surface.js +6 -0
  210. package/hooks/use-surface.js.map +1 -0
  211. package/hooks/use-theme.d.ts +2 -0
  212. package/hooks/use-theme.d.ts.map +1 -0
  213. package/hooks/use-theme.js +6 -0
  214. package/hooks/use-theme.js.map +1 -0
  215. package/hooks/use-toast.d.ts +3 -0
  216. package/hooks/use-toast.d.ts.map +1 -0
  217. package/hooks/use-toast.js +21 -0
  218. package/hooks/use-toast.js.map +1 -0
  219. package/index.d.ts +42 -0
  220. package/index.d.ts.map +1 -0
  221. package/index.js +42 -0
  222. package/index.js.map +1 -0
  223. package/package.json +27 -9
  224. package/shared/cn.d.ts +3 -0
  225. package/shared/cn.d.ts.map +1 -0
  226. package/shared/cn.js +6 -0
  227. package/shared/cn.js.map +1 -0
  228. package/shared/next-tick.d.ts +2 -0
  229. package/shared/next-tick.d.ts.map +1 -0
  230. package/shared/next-tick.js +6 -0
  231. package/shared/next-tick.js.map +1 -0
  232. package/styles/colors.css +403 -0
  233. package/styles/popup.css +14 -0
  234. package/styles/preloader.css +71 -0
  235. package/styles/range.css +17 -0
  236. package/styles/safe-areas.css +192 -0
  237. package/types.d.ts +2 -0
  238. package/types.d.ts.map +1 -0
  239. package/types.js +2 -0
  240. package/types.js.map +1 -0
  241. package/ui.css +10 -0
@@ -0,0 +1,178 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cloneElement, createContext, useContext, useEffect, useId, useRef, useState, } from 'react';
3
+ import { createPortal } from 'react-dom';
4
+ import { useAccentColor } from '../hooks/use-accent-color';
5
+ import { useDevice } from '../hooks/use-device';
6
+ import { useFocusTrap } from '../hooks/use-focus-trap';
7
+ import { useModalUtils } from '../hooks/use-modal-utils';
8
+ import { useTheme } from '../hooks/use-theme';
9
+ import { cn } from '../shared/cn';
10
+ import { nextTick } from '../shared/next-tick';
11
+ import { Backdrop } from './Backdrop';
12
+ import { Button } from './Button';
13
+ import { Input } from './Input';
14
+ import { ModalController } from './ModalController';
15
+ import { Surface } from './Surface';
16
+ const DialogRootContext = createContext(null);
17
+ /**
18
+ * State container for the `Dialog` + `DialogTrigger` + `Dialog` compound. Use when you want
19
+ * the trigger and the dialog to be siblings in JSX:
20
+ *
21
+ * ```tsx
22
+ * <DialogRoot>
23
+ * <DialogTrigger><Button>Confirm</Button></DialogTrigger>
24
+ * <Dialog title="..." />
25
+ * </DialogRoot>
26
+ * ```
27
+ *
28
+ * Skip this and pass `open`/`onOpenChange` directly to `<Dialog>` if you'd rather control state.
29
+ */
30
+ export const DialogRoot = ({ children, defaultOpen = false, open: openProp, onOpenChange, }) => {
31
+ const [internalOpen, setInternalOpen] = useState(defaultOpen);
32
+ const isControlled = openProp !== undefined;
33
+ const open = isControlled ? openProp : internalOpen;
34
+ const setOpen = (newOpen) => {
35
+ if (!isControlled)
36
+ setInternalOpen(newOpen);
37
+ onOpenChange?.(newOpen);
38
+ };
39
+ return (_jsx(DialogRootContext.Provider, { value: { open, setOpen }, children: children }));
40
+ };
41
+ /**
42
+ * Wraps a single child element to act as the dialog trigger. **Clones** the child to attach
43
+ * an `onClick` handler that toggles the surrounding `DialogRoot`'s open state (composed with
44
+ * any existing `onClick` on the child).
45
+ *
46
+ * No-ops (renders the child as-is) when used outside a `DialogRoot`. Unlike `PopoverTrigger`,
47
+ * this does **not** register an anchor ref - dialogs are centered on the viewport, not anchored.
48
+ */
49
+ export const DialogTrigger = ({ children }) => {
50
+ const ctx = useContext(DialogRootContext);
51
+ if (!ctx)
52
+ return _jsx(_Fragment, { children: children });
53
+ const child = children;
54
+ const originalOnClick = child?.props?.onClick;
55
+ const onClick = (e) => {
56
+ if (originalOnClick)
57
+ originalOnClick(e);
58
+ ctx.setOpen(!ctx.open);
59
+ };
60
+ return cloneElement(child, { onClick });
61
+ };
62
+ /**
63
+ * Wraps a single child element to close the surrounding dialog when clicked. **Clones** the
64
+ * child to attach an `onClick` handler that flips the surrounding `DialogRoot`'s open state
65
+ * to `false` (composed with any existing `onClick` on the child).
66
+ *
67
+ * ```tsx
68
+ * <DialogRoot>
69
+ * <DialogTrigger><Button>Open</Button></DialogTrigger>
70
+ * <Dialog title="...">
71
+ * ...
72
+ * <DialogClose><Button>Dismiss</Button></DialogClose>
73
+ * </Dialog>
74
+ * </DialogRoot>
75
+ * ```
76
+ *
77
+ * No-ops (renders the child as-is) when used outside a `DialogRoot`.
78
+ */
79
+ export const DialogClose = ({ children }) => {
80
+ const ctx = useContext(DialogRootContext);
81
+ if (!ctx)
82
+ return _jsx(_Fragment, { children: children });
83
+ const child = children;
84
+ const originalOnClick = child?.props?.onClick;
85
+ const onClick = (e) => {
86
+ if (originalOnClick)
87
+ originalOnClick(e);
88
+ ctx.setOpen(false);
89
+ };
90
+ return cloneElement(child, { onClick });
91
+ };
92
+ const DialogInner = (props) => {
93
+ const theme = useTheme();
94
+ const accentColor = useAccentColor();
95
+ const { root = '#app, #__next, #root', inertContainer = '.app-container', phase = 'closed', onPhaseChange = () => { }, onClosed = () => { }, className = '', contentClassName = '', title, text, lazy, buttons, requireConfirmText = '', stopPropagationOnClick, cancelButtonText, confirmButtonText, cancelButtonColor = 'neutral', confirmButtonColor = accentColor, surfaceLevel = 1, variant = 'gradient', outline = theme === 'dark', onCancel, onConfirm, ref, children, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledByProp, 'aria-describedby': ariaDescribedByProp, } = props;
96
+ const elRef = useRef(null);
97
+ const containerRef = useRef(null);
98
+ const reactId = useId();
99
+ const titleId = `dialog-title-${reactId}`;
100
+ const descId = `dialog-desc-${reactId}`;
101
+ const ariaLabelledBy = ariaLabelledByProp ?? (title ? titleId : undefined);
102
+ const ariaDescribedBy = ariaDescribedByProp ?? (text ? descId : undefined);
103
+ const [inputText, setInputText] = useState('');
104
+ const [_confirmButtonFocused, _setConfirmButtonFocused] = useState(false);
105
+ const confirmButtonRef = useRef(null);
106
+ const { opened, open, close } = useModalUtils({
107
+ phase,
108
+ onPhaseChange,
109
+ onClosed,
110
+ lazy,
111
+ transitionEndElRef: elRef,
112
+ onOpen() {
113
+ const device = useDevice();
114
+ if (!requireConfirmText && confirmButtonRef.current && !device.mobile) {
115
+ if (!confirmButtonRef.current)
116
+ return;
117
+ nextTick(() => {
118
+ confirmButtonRef.current?.focus();
119
+ });
120
+ }
121
+ },
122
+ onOpened() {
123
+ const container = document.querySelector(inertContainer);
124
+ if (container) {
125
+ container.inert = true;
126
+ }
127
+ },
128
+ onClose() {
129
+ const container = document.querySelector(inertContainer);
130
+ const otherModals = document.querySelectorAll('.popover, .popup');
131
+ if (container && otherModals.length === 0) {
132
+ container.inert = false;
133
+ }
134
+ },
135
+ });
136
+ useEffect(() => {
137
+ open();
138
+ }, []);
139
+ useFocusTrap({
140
+ active: opened,
141
+ containerRef,
142
+ initialFocusRef: requireConfirmText ? undefined : confirmButtonRef,
143
+ });
144
+ const setRefs = (el) => {
145
+ containerRef.current = el;
146
+ if (typeof ref === 'function')
147
+ ref(el);
148
+ else if (ref && typeof ref === 'object')
149
+ ref.current = el;
150
+ };
151
+ const content = (_jsxs("div", { className: "dialog", ref: setRefs, role: "dialog", "aria-modal": "true", "aria-label": !ariaLabelledBy ? ariaLabel : undefined, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, children: [_jsx(Backdrop, { className: cn('duration-200', opened ? 'opacity-100' : 'opacity-0'), onClick: (e) => {
152
+ if (stopPropagationOnClick) {
153
+ e.stopPropagation();
154
+ }
155
+ close();
156
+ } }), _jsxs(Surface, { className: cn(`fixed top-1/2 left-1/2 z-50 w-80 max-w-full -translate-x-1/2 -translate-y-1/2 rounded-3xl`, !opened && 'scale-75 opacity-0 duration-200 ease-out!', opened &&
157
+ 'scale-100 opacity-100 duration-500 ease-[cubic-bezier(0,1,0.2,1.1)]', className), ref: elRef, level: surfaceLevel, variant: variant, outline: outline, contentClassName: cn('space-y-4 p-4', contentClassName), onClick: (e) => {
158
+ if (stopPropagationOnClick) {
159
+ e.stopPropagation();
160
+ }
161
+ }, children: [title && (_jsx("div", { id: titleId, className: "text-base font-semibold", children: title })), text && (_jsx("div", { id: descId, className: "text-sm leading-relaxed", children: text })), children, requireConfirmText && confirmButtonText && (_jsx(Input, { value: inputText, infoMessage: `Type ${requireConfirmText} to confirm`, color: confirmButtonColor, placeholder: `Type ${requireConfirmText} to confirm`, size: "xl", onChange: (v) => setInputText(v) })), (buttons || cancelButtonText || confirmButtonText) && (_jsxs("div", { className: "mt-8! flex flex-wrap items-center justify-end gap-2", children: [cancelButtonText && (_jsx(Button, { tabIndex: 0, rounded: true, size: "lg", variant: "transparent", color: cancelButtonColor, contentClassName: "px-4", onClick: () => {
162
+ close();
163
+ onCancel?.();
164
+ }, children: cancelButtonText })), confirmButtonText && (_jsx(Button, { ref: confirmButtonRef, tabIndex: 0, color: !(requireConfirmText && inputText !== requireConfirmText)
165
+ ? confirmButtonColor
166
+ : undefined, rounded: true, size: "lg", contentClassName: "px-4", disabled: !!(requireConfirmText && inputText !== requireConfirmText), onClick: () => {
167
+ close();
168
+ onConfirm?.();
169
+ }, children: confirmButtonText })), buttons] }))] })] }));
170
+ return root ? createPortal(content, document.querySelector(root)) : content;
171
+ };
172
+ export const Dialog = ({ open, onOpenChange, ...rest }) => {
173
+ const ctx = useContext(DialogRootContext);
174
+ const effectiveOpen = open ?? ctx?.open ?? false;
175
+ const effectiveOnOpenChange = onOpenChange ?? ctx?.setOpen ?? (() => { });
176
+ return (_jsx(ModalController, { open: effectiveOpen, onOpenChange: effectiveOnOpenChange, children: _jsx(DialogInner, { ...rest }) }));
177
+ };
178
+ //# sourceMappingURL=Dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/components/Dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,UAAU,EACV,SAAS,EACT,KAAK,EACL,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,C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AC,YAEA,iBAAiB,GACX,CACV,EACA,OAAO,IACJ,CACP,IACO,IACN,CACP,CAAC;IAEF,OAAO,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AAC/E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,EAAe,EAAE,EAAE;IACrE,MAAM,GAAG,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAC1C,MAAM,aAAa,GAAG,IAAI,IAAI,GAAG,EAAE,IAAI,IAAI,KAAK,CAAC;IACjD,MAAM,qBAAqB,GAAG,YAAY,IAAI,GAAG,EAAE,OAAO,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACzE,OAAO,CACL,KAAC,eAAe,IAAC,IAAI,EAAE,aAAa,EAAE,YAAY,EAAE,qBAAqB,YACvE,KAAC,WAAW,OAAK,IAAI,GAAI,GACT,CACnB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function DialogsPortal(): import("react/jsx-runtime").JSX.Element | null;
2
+ //# sourceMappingURL=DialogsPortal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogsPortal.d.ts","sourceRoot":"","sources":["../../../src/components/DialogsPortal.tsx"],"names":[],"mappings":"AAGA,wBAAgB,aAAa,mDA8B5B"}
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Dialog } from './Dialog';
3
+ import { useDialogsPortalContext } from './DialogsPortalContext';
4
+ export function DialogsPortal() {
5
+ const { data, state, setState, setData } = useDialogsPortalContext();
6
+ if (!data)
7
+ return null;
8
+ return (_jsx(Dialog, { open: state, onOpenChange: setState, lazy: data.lazy, title: data.title, text: data.text, stopPropagationOnClick: data.stopPropagationOnClick, requireConfirmText: data.requireConfirmText ? String(data.requireConfirmText) : undefined, cancelButtonText: data.cancelButtonText, confirmButtonText: data.confirmButtonText, cancelButtonColor: data.cancelButtonColor, confirmButtonColor: data.confirmButtonColor, onCancel: () => {
9
+ data.onCancel?.(false);
10
+ }, onConfirm: () => {
11
+ data.onConfirm?.(true);
12
+ }, onClosed: () => {
13
+ setData(null);
14
+ data.onClosed?.(false);
15
+ } }));
16
+ }
17
+ //# sourceMappingURL=DialogsPortal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogsPortal.js","sourceRoot":"","sources":["../../../src/components/DialogsPortal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,MAAM,UAAU,aAAa;IAC3B,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,uBAAuB,EAAE,CAAC;IACrE,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,OAAO,CACL,KAAC,MAAM,IACL,IAAI,EAAE,KAAK,EACX,YAAY,EAAE,QAAQ,EACtB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,sBAAsB,EAAE,IAAI,CAAC,sBAAsB,EACnD,kBAAkB,EAChB,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS,EAEvE,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EACvC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EACzC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EACzC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB,EAC3C,QAAQ,EAAE,GAAG,EAAE;YACb,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC,EACD,SAAS,EAAE,GAAG,EAAE;YACd,IAAI,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC,EACD,QAAQ,EAAE,GAAG,EAAE;YACb,OAAO,CAAC,IAAI,CAAC,CAAC;YACd,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC,GACD,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+ import { Color } from '../types';
3
+ /**
4
+ * Shape of the currently open dialog in the imperative dialog portal. The portal renders at
5
+ * most one dialog at a time; opening a new one replaces the previous via the context setter.
6
+ * Mirrors `DialogProps` for the props that the portal-rendered Dialog forwards.
7
+ */
8
+ export type DialogsPortalData = {
9
+ /** Dialog title - auto-wired to `aria-labelledby`. */
10
+ title: string;
11
+ /** Dialog body text - auto-wired to `aria-describedby`. */
12
+ text: string | React.ReactNode;
13
+ /**
14
+ * Type-to-confirm guard. If string-coercible (truthy), the confirm button is disabled
15
+ * until the user types this exact value. Forwarded to `Dialog.requireConfirmText` after
16
+ * `String(...)` coercion.
17
+ */
18
+ requireConfirmText?: boolean | string | React.ReactNode;
19
+ /** Stop click propagation on backdrop and surface. */
20
+ stopPropagationOnClick?: boolean;
21
+ cancelButtonText?: React.ReactNode;
22
+ confirmButtonText?: React.ReactNode;
23
+ cancelButtonColor?: Color;
24
+ confirmButtonColor?: Color;
25
+ /** Fires when the confirm button is pressed (and the `requireConfirmText` guard passes). Always called with `true`. */
26
+ onConfirm?: (confirmed: boolean) => void;
27
+ /** Fires when the cancel button is pressed. Always called with `false`. */
28
+ onCancel?: (cancelled: boolean) => void;
29
+ /** Fires after the close transition completes - use for unmount cleanup. */
30
+ onClosed?: (closed: boolean) => void;
31
+ /** Defer rendering until first opened, and unmount after close. */
32
+ lazy?: boolean;
33
+ };
34
+ export declare const DialogsPortalContext: React.Context<{
35
+ data: DialogsPortalData | null;
36
+ setData: React.Dispatch<React.SetStateAction<DialogsPortalData | null>>;
37
+ state: boolean;
38
+ setState: React.Dispatch<React.SetStateAction<boolean>>;
39
+ }>;
40
+ export declare const DialogsPortalProvider: ({ children, }: {
41
+ children: React.ReactNode;
42
+ }) => import("react/jsx-runtime").JSX.Element;
43
+ export declare const useDialogsPortalContext: () => {
44
+ data: DialogsPortalData | null;
45
+ setData: React.Dispatch<React.SetStateAction<DialogsPortalData | null>>;
46
+ state: boolean;
47
+ setState: React.Dispatch<React.SetStateAction<boolean>>;
48
+ };
49
+ //# sourceMappingURL=DialogsPortalContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogsPortalContext.d.ts","sourceRoot":"","sources":["../../../src/components/DialogsPortalContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8C,MAAM,OAAO,CAAC;AAEnE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IAC/B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IACxD,sDAAsD;IACtD,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACpC,iBAAiB,CAAC,EAAE,KAAK,CAAC;IAC1B,kBAAkB,CAAC,EAAE,KAAK,CAAC;IAC3B,uHAAuH;IACvH,SAAS,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,mEAAmE;IACnE,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,oBAAoB;UACzB,iBAAiB,GAAG,IAAI;aACrB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;WAChE,OAAO;cACJ,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;EAMvD,CAAC;AAEH,eAAO,MAAM,qBAAqB,GAAI,eAEnC;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,4CAQA,CAAC;AAEF,eAAO,MAAM,uBAAuB;UAzB5B,iBAAiB,GAAG,IAAI;aACrB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;WAChE,OAAO;cACJ,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;CAwBxD,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useState } from 'react';
3
+ export const DialogsPortalContext = createContext({
4
+ data: null,
5
+ setData: () => { },
6
+ state: false,
7
+ setState: () => { },
8
+ });
9
+ export const DialogsPortalProvider = ({ children, }) => {
10
+ const [data, setData] = useState(null);
11
+ const [state, setState] = useState(false);
12
+ return (_jsx(DialogsPortalContext.Provider, { value: { data, setData, state, setState }, children: children }));
13
+ };
14
+ export const useDialogsPortalContext = () => {
15
+ return useContext(DialogsPortalContext);
16
+ };
17
+ //# sourceMappingURL=DialogsPortalContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogsPortalContext.js","sourceRoot":"","sources":["../../../src/components/DialogsPortalContext.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAoCnE,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAK9C;IACD,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;IACjB,KAAK,EAAE,KAAK;IACZ,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;CACnB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EACpC,QAAQ,GAGT,EAAE,EAAE;IACH,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAA2B,IAAI,CAAC,CAAC;IACjE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACnD,OAAO,CACL,KAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,YACrE,QAAQ,GACqB,CACjC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE;IAC1C,OAAO,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAC1C,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { Color } from '../types';
2
+ export declare const FocusableLayer: (props: {
3
+ className?: string;
4
+ /**
5
+ * Which interactive group's focus state should reveal this ring. The ring is hidden by default
6
+ * (scale 95, opacity 0) and animates in when the matching ancestor receives focus.
7
+ *
8
+ * Each value targets the corresponding `group/<name>` Tailwind group on its parent component:
9
+ * - `'button'` - reveals on `:focus-visible` (keyboard focus only).
10
+ * - `'input'` - reveals when the wrapper has a focused `<input>`.
11
+ * - `'textarea'` - reveals when the wrapper has a focused `[contenteditable]`.
12
+ * - `'checkbox'` / `'toggle'` / `'radio'` / `'range'` - reveal on `:focus-visible` of the
13
+ * wrapper's hidden native input.
14
+ *
15
+ * Pass an unknown value to opt out of the auto-reveal classes (use `force` instead).
16
+ */
17
+ group?: string;
18
+ color?: Color;
19
+ /**
20
+ * Always show the ring, regardless of focus state. Used for error/invalid states
21
+ * (e.g. `Input` passes `force={!valid}` and a red color).
22
+ */
23
+ force?: boolean;
24
+ }) => import("react/jsx-runtime").JSX.Element;
25
+ //# sourceMappingURL=FocusableLayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FocusableLayer.d.ts","sourceRoot":"","sources":["../../../src/components/FocusableLayer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,eAAO,MAAM,cAAc,GAAI,OAAO;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,4CAgCA,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useAccentColor } from '../hooks/use-accent-color';
3
+ import { cn } from '../shared/cn';
4
+ export const FocusableLayer = (props) => {
5
+ const accentColor = useAccentColor();
6
+ const { className, group, color = accentColor, force } = props;
7
+ const groupClasses = {
8
+ button: 'group-focus-visible/button:scale-100 group-focus-visible/button:opacity-100',
9
+ input: 'group-has-[input:focus]/input:scale-100 group-has-[input:focus]/input:opacity-100',
10
+ textarea: 'group-has-[[contenteditable]:focus]/textarea:scale-100 group-has-[[contenteditable]:focus]/textarea:opacity-100',
11
+ checkbox: 'group-has-[input:focus-visible]/checkbox:scale-100 group-has-[input:focus-visible]/checkbox:opacity-100',
12
+ toggle: 'group-has-[input:focus-visible]/toggle:scale-100 group-has-[input:focus-visible]/toggle:opacity-100',
13
+ radio: 'group-has-[input:focus-visible]/radio:scale-100 group-has-[input:focus-visible]/radio:opacity-100',
14
+ range: 'group-has-[input:focus-visible]/range:scale-100 group-has-[input:focus-visible]/range:opacity-100',
15
+ }[group] || '';
16
+ return (_jsx("span", { className: cn('pointer-events-none absolute -inset-1.5 z-1 scale-95 border-2 border-primary opacity-0 duration-200', `color-${color}`, force && 'scale-100 opacity-100', !force && groupClasses, className) }));
17
+ };
18
+ //# sourceMappingURL=FocusableLayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FocusableLayer.js","sourceRoot":"","sources":["../../../src/components/FocusableLayer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAGlC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAsB9B,EAAE,EAAE;IACH,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,GAAG,WAAW,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAC/D,MAAM,YAAY,GAChB;QACE,MAAM,EACJ,6EAA6E;QAC/E,KAAK,EACH,mFAAmF;QACrF,QAAQ,EACN,iHAAiH;QACnH,QAAQ,EACN,yGAAyG;QAC3G,MAAM,EACJ,qGAAqG;QACvG,KAAK,EACH,mGAAmG;QACrG,KAAK,EACH,mGAAmG;KACtG,CAAC,KAAqC,CAAC,IAAI,EAAE,CAAC;IACjD,OAAO,CACL,eACE,SAAS,EAAE,EAAE,CACX,qGAAqG,EAErG,SAAS,KAAK,EAAE,EAChB,KAAK,IAAI,uBAAuB,EAChC,CAAC,KAAK,IAAI,YAAY,EACtB,SAAS,CACV,GACD,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,87 @@
1
+ import { ElementType, ReactNode, Ref, ChangeEvent, KeyboardEvent, FocusEvent, ComponentPropsWithoutRef } from 'react';
2
+ import { Color } from '../types';
3
+ export type InputSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl';
4
+ interface InputOwnProps<C extends ElementType = 'div', IC extends ElementType = 'input'> {
5
+ /** Polymorphic **wrapper** element. Defaults to `'div'`. (For the inner input, see `inputComponent`.) */
6
+ component?: C;
7
+ /** Native `<input type>`. Default `'text'`. */
8
+ type?: string;
9
+ /** Controlled value. */
10
+ value?: string | number;
11
+ /**
12
+ * Custom node displayed in place of the raw `value` while the input is `readOnly` or
13
+ * unfocused. Useful for formatted display (e.g. show "1,234.56" while the underlying
14
+ * value is `1234.56`) - the real value re-appears on focus for editing.
15
+ */
16
+ displayValue?: ReactNode;
17
+ placeholder?: string;
18
+ /** Native `name` attribute, used for form submission. */
19
+ name?: string;
20
+ /** Native `required` attribute. Default `false`. */
21
+ required?: boolean;
22
+ /** Visually dim the input and disable interaction. Default `false`. */
23
+ disabled?: boolean;
24
+ /** Make the input non-editable but still focusable for value display/copying. */
25
+ readOnly?: boolean;
26
+ /** `id` for the inner `<input>`. Used to wire an external `<label htmlFor>`. */
27
+ inputId?: string;
28
+ /** Apply pill (`rounded-full`) corners. Default `false` - uses size-specific radii. */
29
+ rounded?: boolean;
30
+ size?: InputSize;
31
+ /** Fires on every keystroke. First arg is the new value, second is the raw event. */
32
+ onChange?: (value: string, event: ChangeEvent<HTMLInputElement>) => void;
33
+ onKeyDown?: (e: KeyboardEvent<HTMLInputElement>) => void;
34
+ onFocus?: (e: FocusEvent<HTMLInputElement>) => void;
35
+ onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
36
+ /** Called when the clear button is pressed. Pair with `clearButton`. */
37
+ onClear?: () => void;
38
+ /** Accent color token. Drives the focus ring and `infoMessage` colors. Default: theme accent. */
39
+ color?: Color;
40
+ /** Slot rendered before the input element, inside the surface (e.g. unit label, currency symbol). */
41
+ prefix?: ReactNode;
42
+ min?: number | string;
43
+ step?: number | string;
44
+ /** Slot rendered after the input element, inside the surface. */
45
+ suffix?: ReactNode;
46
+ /** Extra classes for the outer wrapper. */
47
+ className?: string;
48
+ /** Extra classes for the inner `SurfaceCut` content area (where prefix/input/suffix live). */
49
+ contentClassName?: string;
50
+ /** Extra classes for the actual `<input>` element (or `inputComponent`). */
51
+ inputClassName?: string;
52
+ max?: number | string;
53
+ maxLength?: number;
54
+ /** Render a clear (X) button on the right that fires `onClear`. Hidden when `value` is empty. */
55
+ clearButton?: boolean;
56
+ /**
57
+ * Validity state. Default `true`. When `false`, switches the focus ring to red and shows
58
+ * `errorMessage` (instead of `infoMessage`).
59
+ */
60
+ valid?: boolean;
61
+ /** Floating label shown above the input on focus. Hidden when `valid === false` or `readOnly`. */
62
+ infoMessage?: ReactNode;
63
+ /** Floating error label. Always visible (no focus required) when `valid === false`. */
64
+ errorMessage?: ReactNode;
65
+ pattern?: string;
66
+ inputMode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';
67
+ /** Icon node rendered inside the surface, absolutely positioned on the left. Shifts input padding. */
68
+ icon?: ReactNode;
69
+ /** Extra classes applied to the inner `SurfaceCut`. */
70
+ surfaceClassName?: string;
71
+ /** Forwarded to the wrapper element. */
72
+ ref?: Ref<HTMLElement>;
73
+ /** Native `autoFocus` - focus the input on mount. */
74
+ autoFocus?: boolean;
75
+ /**
76
+ * Polymorphic **input** element. Defaults to `'input'`. Use this to swap in a custom
77
+ * component (e.g. a masked input library) that should still inherit the Input chrome
78
+ * (focus ring, clear button, prefix/suffix, etc.).
79
+ */
80
+ inputComponent?: IC;
81
+ /** Extra props forwarded to the `inputComponent`. Typed against the chosen component. */
82
+ inputComponentProps?: Partial<ComponentPropsWithoutRef<IC>>;
83
+ }
84
+ export type InputProps<C extends ElementType = 'div', IC extends ElementType = 'input'> = InputOwnProps<C, IC> & Omit<ComponentPropsWithoutRef<C>, keyof InputOwnProps<C, IC>>;
85
+ export declare const Input: <C extends ElementType = "div", IC extends ElementType = "input">(props: InputProps<C, IC>) => import("react/jsx-runtime").JSX.Element;
86
+ export {};
87
+ //# sourceMappingURL=Input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"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AqD;IACrD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,EAAE,CAAC;IACpB,yFAAyF;IACzF,mBAAmB,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,EAAE,CAAC,CAAC,CAAC;CAC7D;AAED,MAAM,MAAM,UAAU,CACpB,CAAC,SAAS,WAAW,GAAG,KAAK,EAC7B,EAAE,SAAS,WAAW,GAAG,OAAO,IAC9B,aAAa,CAAC,CAAC,EAAE,EAAE,CAAC,GACtB,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,MAAM,aAAa,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAEhE,eAAO,MAAM,KAAK,GAChB,CAAC,SAAS,WAAW,GAAG,KAAK,EAC7B,EAAE,SAAS,WAAW,GAAG,OAAO,EAEhC,OAAO,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,4CA6RzB,CAAC"}
@@ -0,0 +1,93 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useRef, useState, } from 'react';
3
+ import { useAccentColor } from '../hooks/use-accent-color';
4
+ import { cn } from '../shared/cn';
5
+ import { Button } from './Button';
6
+ import { FocusableLayer } from './FocusableLayer';
7
+ import { CloseIcon } from './icons/CloseIcon';
8
+ import { SurfaceCut } from './SurfaceCut';
9
+ export const Input = (props) => {
10
+ const accentColor = useAccentColor();
11
+ const { component = 'div', type = 'text', value, displayValue, placeholder, name, required = false, disabled = false, readOnly, inputId, rounded = false, size = 'lg', onChange = () => { }, onKeyDown = () => { }, onFocus = () => { }, onBlur = () => { }, onClear = () => { }, color = accentColor, prefix, min, step, suffix, className, contentClassName, inputClassName, max, maxLength, clearButton, valid = true, infoMessage, errorMessage, pattern, inputMode, icon, surfaceClassName, autoFocus, inputComponent = 'input', inputComponentProps = {}, ref: externalRef, } = props;
12
+ const fontSizes = {
13
+ sm: 'text-xs',
14
+ md: 'text-xs',
15
+ lg: 'text-xs',
16
+ xl: 'text-xs',
17
+ '2xl': 'text-xs',
18
+ };
19
+ const iconWrapClasses = {
20
+ sm: 'left-2.5 [&>svg]:size-4',
21
+ md: 'left-2.5 [&>svg]:size-4',
22
+ lg: 'left-2.5 [&>svg]:size-4',
23
+ xl: 'left-2.5 [&>svg]:size-4',
24
+ '2xl': 'left-3.5 [&>svg]:size-4',
25
+ };
26
+ const inputPaddingNoIcon = {
27
+ sm: 'px-2.5',
28
+ md: 'px-2.5',
29
+ lg: 'px-2.5',
30
+ xl: 'px-2.5',
31
+ '2xl': 'px-3.5',
32
+ };
33
+ const inputPaddingWithIcon = {
34
+ sm: 'pl-8.5 pr-2',
35
+ md: 'pl-8.5 pr-2',
36
+ lg: 'pl-8.5 pr-3',
37
+ xl: 'pl-8.5 pr-3',
38
+ '2xl': 'pl-9.5 pr-4',
39
+ };
40
+ const roundedSizes = {
41
+ sm: 'rounded-md',
42
+ md: 'rounded-lg',
43
+ lg: 'rounded-[10px]',
44
+ xl: 'rounded-xl',
45
+ '2xl': 'rounded-xl',
46
+ };
47
+ const heights = {
48
+ sm: 'h-6',
49
+ md: 'h-7',
50
+ lg: 'h-9',
51
+ xl: 'h-10',
52
+ '2xl': 'h-12',
53
+ };
54
+ const prevSize = {
55
+ sm: 'sm',
56
+ md: 'sm',
57
+ lg: 'md',
58
+ xl: 'lg',
59
+ '2xl': 'xl',
60
+ }[size];
61
+ const inputPadding = icon
62
+ ? inputPaddingWithIcon[size]
63
+ : inputPaddingNoIcon[size];
64
+ const elRef = useRef(null);
65
+ const inputElRef = useRef(null);
66
+ const [focused, setFocused] = useState(false);
67
+ const onFocusInternal = (e) => {
68
+ setFocused(true);
69
+ onFocus(e);
70
+ };
71
+ const onBlurInternal = (e) => {
72
+ setFocused(false);
73
+ onBlur(e);
74
+ };
75
+ const Component = component;
76
+ const InputComponent = inputComponent;
77
+ const showDisplayValue = displayValue && (readOnly || !focused);
78
+ const showRealValue = !showDisplayValue;
79
+ return (_jsxs(Component, { className: cn('input group/input relative', disabled && 'opacity-50', className), children: [!readOnly && !disabled && (_jsx(FocusableLayer, { className: cn(rounded ? 'rounded-full' : roundedSizes[size], valid === false && 'color-red'), force: valid === false, color: valid === false ? 'red' : color, group: "input" })), _jsxs(SurfaceCut, { className: cn(rounded ? 'rounded-full' : roundedSizes[size], surfaceClassName), hoverable: !disabled && !readOnly, contentClassName: cn('flex items-center', contentClassName), onContextMenuCapture: (e) => e.preventDefault(), ref: (el) => {
80
+ elRef.current = el;
81
+ if (externalRef) {
82
+ if (typeof externalRef === 'function')
83
+ externalRef(el);
84
+ else
85
+ externalRef.current = el;
86
+ }
87
+ }, children: [prefix, icon && (_jsx("div", { className: cn('pointer-events-none absolute top-1/2 -translate-y-1/2', iconWrapClasses[size]), children: icon })), _jsx(InputComponent, { tabIndex: disabled || readOnly ? -1 : undefined, autoFocus: autoFocus, readOnly: readOnly, inputMode: inputMode, ref: inputElRef, id: inputId, type: type, disabled: disabled, value: value, name: name, required: required, placeholder: placeholder, className: cn(inputPadding, heights[size], fontSizes[size], rounded ? 'rounded-full' : roundedSizes[size], 'w-full appearance-none border-none bg-transparent font-medium shadow-none outline-none', disabled && 'text-on-surface-darker', 'placeholder-on-surface-darker', !showRealValue && 'text-transparent! placeholder-transparent!', inputClassName), onFocus: onFocusInternal, onBlur: onBlurInternal, onKeyDown: onKeyDown, onChange: (e) => onChange(e.target.value, e), maxLength: maxLength, max: max, min: min, pattern: pattern, step: step, ...inputComponentProps }), showDisplayValue && (_jsx("span", { className: cn(inputPadding, heights[size], fontSizes[size], 'pointer-events-none absolute inset-0 flex items-center font-medium', disabled && 'text-on-surface-darker', inputClassName), children: displayValue })), clearButton && !disabled && !readOnly && (_jsx(Button, { className: cn('mr-1 -ml-2 w-auto shrink-0 transform-gpu duration-200', size === 'sm' && 'h-4 w-5', size === 'md' && 'h-5 w-6', size === 'lg' && 'h-7 w-8', size === 'xl' && 'h-8 w-9', size === '2xl' && 'h-10 w-11', !value && 'pointer-events-none scale-0'), contentClassName: "px-0", disabled: !value, rounded: rounded, size: prevSize, outline: false, onClick: onClear, children: _jsx(CloseIcon, { className: cn('text-on-surface-dark', size === 'sm'
88
+ ? 'size-3!'
89
+ : size === 'md'
90
+ ? 'size-3.5!'
91
+ : 'size-4') }) })), suffix] }), infoMessage && valid !== false && !readOnly && (_jsx("div", { className: cn('pointer-events-none absolute -top-1.5 left-2 z-10 translate-y-1 rounded-lg bg-primary px-2 py-1.5 text-[10px] leading-none font-semibold text-on-primary opacity-0 duration-200 group-has-[input:focus]/input:-translate-y-1/2 group-has-[input:focus]/input:opacity-100', `color-${color}`), children: infoMessage })), errorMessage && valid === false && (_jsx("div", { className: cn('pointer-events-none absolute -top-1.5 left-2 z-10 -translate-y-1/2 rounded-sm bg-primary px-1 py-0.5 text-[10px] leading-none font-semibold text-on-primary opacity-100 duration-200', `color-red`), children: errorMessage }))] }));
92
+ };
93
+ //# sourceMappingURL=Input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../src/components/Input.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,MAAM,EACN,QAAQ,GAST,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC,OAAO,EAAE,MAAM,EAAc,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAsG1C,MAAM,CAAC,MAAM,KAAK,GAAG,CAInB,KAAwB,EACxB,EAAE;IACF,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,MAAM,EACJ,SAAS,GAAG,KAAK,EACjB,IAAI,GAAG,MAAM,EACb,KAAK,EACL,YAAY,E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AoE,EACpE,QAAQ,IAAI,wBAAwB,EACpC,cAAc,CACf,YAEA,YAAY,GACR,CACR,EACA,WAAW,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,IAAI,CACxC,KAAC,MAAM,IACL,SAAS,EAAE,EAAE,CACX,uDAAuD,EACvD,IAAI,KAAK,IAAI,IAAI,SAAS,EAC1B,IAAI,KAAK,IAAI,IAAI,SAAS,EAC1B,IAAI,KAAK,IAAI,IAAI,SAAS,EAC1B,IAAI,KAAK,IAAI,IAAI,SAAS,EAC1B,IAAI,KAAK,KAAK,IAAI,WAAW,EAC7B,CAAC,KAAK,IAAI,6BAA6B,CACxC,EACD,gBAAgB,EAAC,MAAM,EACvB,QAAQ,EAAE,CAAC,KAAK,EAChB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,KAAK,EACd,OAAO,EAAE,OAAO,YAEhB,KAAC,SAAS,IACR,SAAS,EAAE,EAAE,CACX,sBAAsB,EACtB,IAAI,KAAK,IAAI;gCACX,CAAC,CAAC,SAAS;gCACX,CAAC,CAAC,IAAI,KAAK,IAAI;oCACb,CAAC,CAAC,WAAW;oCACb,CAAC,CAAC,QAAQ,CACf,GACD,GACK,CACV,EAEA,MAAM,IACI,EAEZ,WAAW,IAAI,KAAK,KAAK,KAAK,IAAI,CAAC,QAAQ,IAAI,CAC9C,cACE,SAAS,EAAE,EAAE,CACX,0QAA0Q,EAC1Q,SAAS,KAAK,EAAE,CACjB,YAEA,WAAW,GACR,CACP,EACA,YAAY,IAAI,KAAK,KAAK,KAAK,IAAI,CAClC,cACE,SAAS,EAAE,EAAE,CACX,sLAAsL,EACtL,WAAW,CACZ,YAEA,YAAY,GACT,CACP,IACS,CACb,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { ElementType, Ref, ComponentPropsWithoutRef } from 'react';
2
+ interface LinkOwnProps<C extends ElementType = 'button'> {
3
+ /** Link content. */
4
+ children?: React.ReactNode;
5
+ /** Extra classes for the link element. */
6
+ className?: string;
7
+ /** Native `disabled` attribute. */
8
+ disabled?: boolean;
9
+ /** Native `readOnly` attribute. */
10
+ readOnly?: boolean;
11
+ /**
12
+ * Polymorphic element. When omitted, defaults to `'a'` if `href` is provided, otherwise
13
+ * `'button'`. Pass an explicit value to override (e.g. a router `Link` component).
14
+ */
15
+ component?: C;
16
+ /** Reserved for focus-ring styling hooks. Default `true`. */
17
+ focusable?: boolean;
18
+ /** Click handler. */
19
+ onClick?: () => void;
20
+ /** Native `href` - when provided, the polymorphic default switches from `'button'` to `'a'`. */
21
+ href?: string;
22
+ /** Forwarded to the polymorphic root element. */
23
+ ref?: Ref<HTMLElement>;
24
+ }
25
+ export type LinkProps<C extends ElementType = 'button'> = LinkOwnProps<C> & Omit<ComponentPropsWithoutRef<C>, keyof LinkOwnProps<C>>;
26
+ export declare const Link: <C extends ElementType = "button">({ children, className, disabled, readOnly, component, focusable, onClick, href, ref, ...rest }: LinkProps<C>) => import("react/jsx-runtime").JSX.Element;
27
+ export {};
28
+ //# sourceMappingURL=Link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../src/components/Link.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,WAAW,EAAE,GAAG,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAI3E,UAAU,YAAY,CAAC,CAAC,SAAS,WAAW,GAAG,QAAQ;IACrD,oBAAoB;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,CAAC;IACd,6DAA6D;IAC7D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qBAAqB;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,gGAAgG;IAChG,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,WAAW,GAAG,QAAQ,IAAI,YAAY,CAAC,CAAC,CAAC,GACvE,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3D,eAAO,MAAM,IAAI,GAAI,CAAC,SAAS,WAAW,GAAG,QAAQ,EAAE,gGAWpD,SAAS,CAAC,CAAC,CAAC,4CAkCd,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useRef } from 'react';
3
+ import { cn } from '../shared/cn';
4
+ export const Link = ({ children, className = '', disabled = false, readOnly = false, component, focusable = true, onClick, href, ref, ...rest }) => {
5
+ const elRef = useRef(null);
6
+ const Component = (typeof component === 'undefined'
7
+ ? typeof href === 'string'
8
+ ? 'a'
9
+ : 'button'
10
+ : component);
11
+ return (_jsx(Component, { ref: (el) => {
12
+ elRef.current = el;
13
+ if (ref && typeof ref === 'function') {
14
+ ref(el);
15
+ }
16
+ else if (ref) {
17
+ ref.current = el;
18
+ }
19
+ }, className: cn('group/link relative cursor-pointer appearance-none duration-200 select-none focus:ring-0 focus:outline-0 active:opacity-50 active:duration-0', className), readOnly: readOnly, disabled: disabled, onClick: onClick, href: href, ...rest, children: children }));
20
+ };
21
+ //# sourceMappingURL=Link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../../src/components/Link.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAA8C,MAAM,OAAO,CAAC;AAE3E,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AA6BlC,MAAM,CAAC,MAAM,IAAI,GAAG,CAAmC,EACrD,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,KAAK,EAChB,SAAS,EACT,SAAS,GAAG,IAAI,EAChB,OAAO,EACP,IAAI,EACJ,GAAG,EACH,GAAG,IAAI,EACM,EAAE,EAAE;IACjB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAE3B,MAAM,SAAS,GAAG,CAChB,OAAO,SAAS,KAAK,WAAW;QAC9B,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ;YACxB,CAAC,CAAC,GAAG;YACL,CAAC,CAAC,QAAQ;QACZ,CAAC,CAAC,SAAS,CACC,CAAC;IAEjB,OAAO,CACL,KAAC,SAAS,IACR,GAAG,EAAE,CAAC,EAAO,EAAE,EAAE;YACf,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC;YACnB,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;gBACrC,GAAG,CAAC,EAAE,CAAC,CAAC;YACV,CAAC;iBAAM,IAAI,GAAG,EAAE,CAAC;gBACf,GAAG,CAAC,OAAO,GAAG,EAAE,CAAC;YACnB,CAAC;QACH,CAAC,EACD,SAAS,EAAE,EAAE,CACX,8IAA8I,EAC9I,SAAS,CACV,EACD,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,KACN,IAAI,YAEP,QAAQ,GACC,CACb,CAAC;AACJ,CAAC,CAAC"}