@financedistrict/apps-ui 0.1.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.
Files changed (136) hide show
  1. package/LICENSE +19 -0
  2. package/README.md +119 -0
  3. package/dist/Radio-BYWz1n7p.d.cts +32 -0
  4. package/dist/Radio-BYWz1n7p.d.ts +32 -0
  5. package/dist/SelectTrigger-By0iPBI3.d.cts +78 -0
  6. package/dist/SelectTrigger-By0iPBI3.d.ts +78 -0
  7. package/dist/accordion.cjs +322 -0
  8. package/dist/accordion.d.cts +156 -0
  9. package/dist/accordion.d.ts +156 -0
  10. package/dist/accordion.js +2 -0
  11. package/dist/apps-ui.umd.js +1 -0
  12. package/dist/button.cjs +366 -0
  13. package/dist/button.d.cts +52 -0
  14. package/dist/button.d.ts +52 -0
  15. package/dist/button.js +3 -0
  16. package/dist/checkbox.cjs +74 -0
  17. package/dist/checkbox.d.cts +63 -0
  18. package/dist/checkbox.d.ts +63 -0
  19. package/dist/checkbox.js +2 -0
  20. package/dist/chunk-3RU7JMFE.js +27 -0
  21. package/dist/chunk-5TWRK4NW.js +783 -0
  22. package/dist/chunk-7EOSDFS3.js +9 -0
  23. package/dist/chunk-AIQ4UOGK.js +142 -0
  24. package/dist/chunk-B3MMGTPV.js +200 -0
  25. package/dist/chunk-DAHQYLUI.js +146 -0
  26. package/dist/chunk-DGBXADSS.js +1 -0
  27. package/dist/chunk-E6KPNTWW.js +295 -0
  28. package/dist/chunk-EOAB6G2D.js +149 -0
  29. package/dist/chunk-FAOVKDVM.js +32 -0
  30. package/dist/chunk-FV76Z4Z2.js +78 -0
  31. package/dist/chunk-GLTLBUZ7.js +285 -0
  32. package/dist/chunk-GTZFV43T.js +154 -0
  33. package/dist/chunk-HRGZNL4A.js +88 -0
  34. package/dist/chunk-IEVN3J2F.js +98 -0
  35. package/dist/chunk-IRS3T6LF.js +352 -0
  36. package/dist/chunk-IYYHCQXG.js +146 -0
  37. package/dist/chunk-JIXW3455.js +89 -0
  38. package/dist/chunk-N4VAP2GB.js +77 -0
  39. package/dist/chunk-SJ2ZRYVV.js +167 -0
  40. package/dist/chunk-SNU4YXOR.js +66 -0
  41. package/dist/chunk-TT6JQATV.js +99 -0
  42. package/dist/chunk-UPQ3ZPCO.js +66 -0
  43. package/dist/chunk-UVUSVFOH.js +264 -0
  44. package/dist/chunk-WJFPGGJB.js +255 -0
  45. package/dist/chunk-WXEBQA7A.js +371 -0
  46. package/dist/chunk-Y2O4YYZQ.js +184 -0
  47. package/dist/cut-corner.cjs +111 -0
  48. package/dist/cut-corner.d.cts +49 -0
  49. package/dist/cut-corner.d.ts +49 -0
  50. package/dist/cut-corner.js +1 -0
  51. package/dist/dialog.cjs +441 -0
  52. package/dist/dialog.d.cts +240 -0
  53. package/dist/dialog.d.ts +240 -0
  54. package/dist/dialog.js +3 -0
  55. package/dist/feature-card.cjs +182 -0
  56. package/dist/feature-card.d.cts +54 -0
  57. package/dist/feature-card.d.ts +54 -0
  58. package/dist/feature-card.js +2 -0
  59. package/dist/filter.cjs +873 -0
  60. package/dist/filter.d.cts +129 -0
  61. package/dist/filter.d.ts +129 -0
  62. package/dist/filter.js +6 -0
  63. package/dist/index.cjs +4583 -0
  64. package/dist/index.d.cts +29 -0
  65. package/dist/index.d.ts +29 -0
  66. package/dist/index.js +27 -0
  67. package/dist/inline-select.cjs +856 -0
  68. package/dist/inline-select.d.cts +92 -0
  69. package/dist/inline-select.d.ts +92 -0
  70. package/dist/inline-select.js +6 -0
  71. package/dist/input.cjs +263 -0
  72. package/dist/input.d.cts +157 -0
  73. package/dist/input.d.ts +157 -0
  74. package/dist/input.js +4 -0
  75. package/dist/panel.cjs +185 -0
  76. package/dist/panel.d.cts +103 -0
  77. package/dist/panel.d.ts +103 -0
  78. package/dist/panel.js +2 -0
  79. package/dist/property-grid.cjs +110 -0
  80. package/dist/property-grid.d.cts +56 -0
  81. package/dist/property-grid.d.ts +56 -0
  82. package/dist/property-grid.js +2 -0
  83. package/dist/radio.cjs +74 -0
  84. package/dist/radio.d.cts +39 -0
  85. package/dist/radio.d.ts +39 -0
  86. package/dist/radio.js +2 -0
  87. package/dist/scrollbar.cjs +34 -0
  88. package/dist/scrollbar.d.cts +35 -0
  89. package/dist/scrollbar.d.ts +35 -0
  90. package/dist/scrollbar.js +1 -0
  91. package/dist/search-bar.cjs +408 -0
  92. package/dist/search-bar.d.cts +42 -0
  93. package/dist/search-bar.d.ts +42 -0
  94. package/dist/search-bar.js +4 -0
  95. package/dist/select.cjs +998 -0
  96. package/dist/select.d.cts +357 -0
  97. package/dist/select.d.ts +357 -0
  98. package/dist/select.js +5 -0
  99. package/dist/selectable-feature-card.cjs +159 -0
  100. package/dist/selectable-feature-card.d.cts +74 -0
  101. package/dist/selectable-feature-card.d.ts +74 -0
  102. package/dist/selectable-feature-card.js +3 -0
  103. package/dist/sidebar-item.cjs +175 -0
  104. package/dist/sidebar-item.d.cts +75 -0
  105. package/dist/sidebar-item.d.ts +75 -0
  106. package/dist/sidebar-item.js +2 -0
  107. package/dist/switch.cjs +86 -0
  108. package/dist/switch.d.cts +72 -0
  109. package/dist/switch.d.ts +72 -0
  110. package/dist/switch.js +2 -0
  111. package/dist/table-cell.cjs +196 -0
  112. package/dist/table-cell.d.cts +76 -0
  113. package/dist/table-cell.d.ts +76 -0
  114. package/dist/table-cell.js +2 -0
  115. package/dist/table-title.cjs +34 -0
  116. package/dist/table-title.d.cts +16 -0
  117. package/dist/table-title.d.ts +16 -0
  118. package/dist/table-title.js +2 -0
  119. package/dist/tabs.cjs +299 -0
  120. package/dist/tabs.d.cts +116 -0
  121. package/dist/tabs.d.ts +116 -0
  122. package/dist/tabs.js +2 -0
  123. package/dist/toast.cjs +87 -0
  124. package/dist/toast.d.cts +48 -0
  125. package/dist/toast.d.ts +48 -0
  126. package/dist/toast.js +2 -0
  127. package/dist/token-input.cjs +415 -0
  128. package/dist/token-input.d.cts +90 -0
  129. package/dist/token-input.d.ts +90 -0
  130. package/dist/token-input.js +3 -0
  131. package/dist/tooltip.cjs +384 -0
  132. package/dist/tooltip.d.cts +142 -0
  133. package/dist/tooltip.d.ts +142 -0
  134. package/dist/tooltip.js +2 -0
  135. package/package.json +200 -0
  136. package/src/fonts.css +33 -0
@@ -0,0 +1,352 @@
1
+ import { cn } from './chunk-7EOSDFS3.js';
2
+ import * as React from 'react';
3
+ import { createPortal } from 'react-dom';
4
+ import { cva } from 'class-variance-authority';
5
+ import { jsx } from 'react/jsx-runtime';
6
+
7
+ var tooltipVariants = cva([
8
+ "pointer-events-none max-w-[244px] rounded-sm bg-card-reversed-background px-1.5 py-1",
9
+ "body-04 text-center text-card-reversed-foreground shadow-xs"
10
+ ]);
11
+ var TOOLTIP_OFFSET = 6;
12
+ var VIEWPORT_MARGIN = 8;
13
+ var OPPOSITE_SIDE = {
14
+ top: "bottom",
15
+ bottom: "top",
16
+ left: "right",
17
+ right: "left"
18
+ };
19
+ function sideFits(trigger, content, side, viewport) {
20
+ switch (side) {
21
+ case "top":
22
+ return trigger.top - TOOLTIP_OFFSET - content.height >= 0;
23
+ case "bottom":
24
+ return trigger.top + trigger.height + TOOLTIP_OFFSET + content.height <= viewport.height;
25
+ case "left":
26
+ return trigger.left - TOOLTIP_OFFSET - content.width >= 0;
27
+ case "right":
28
+ return trigger.left + trigger.width + TOOLTIP_OFFSET + content.width <= viewport.width;
29
+ }
30
+ }
31
+ function alignCoord(anchorStart, anchorSize, contentSize, align) {
32
+ switch (align) {
33
+ case "start":
34
+ return anchorStart;
35
+ case "center":
36
+ return anchorStart + anchorSize / 2 - contentSize / 2;
37
+ case "end":
38
+ return anchorStart + anchorSize - contentSize;
39
+ }
40
+ }
41
+ function clamp(value, min, max) {
42
+ return Math.max(min, Math.min(value, Math.max(min, max)));
43
+ }
44
+ function computeTooltipPosition(trigger, content, side, align, viewport) {
45
+ const resolvedSide = sideFits(trigger, content, side, viewport) || !sideFits(trigger, content, OPPOSITE_SIDE[side], viewport) ? side : OPPOSITE_SIDE[side];
46
+ const vertical = resolvedSide === "top" || resolvedSide === "bottom";
47
+ let top;
48
+ let left;
49
+ if (vertical) {
50
+ top = resolvedSide === "top" ? trigger.top - TOOLTIP_OFFSET - content.height : trigger.top + trigger.height + TOOLTIP_OFFSET;
51
+ left = alignCoord(trigger.left, trigger.width, content.width, align);
52
+ left = clamp(
53
+ left,
54
+ VIEWPORT_MARGIN,
55
+ viewport.width - content.width - VIEWPORT_MARGIN
56
+ );
57
+ } else {
58
+ left = resolvedSide === "left" ? trigger.left - TOOLTIP_OFFSET - content.width : trigger.left + trigger.width + TOOLTIP_OFFSET;
59
+ top = alignCoord(trigger.top, trigger.height, content.height, align);
60
+ top = clamp(
61
+ top,
62
+ VIEWPORT_MARGIN,
63
+ viewport.height - content.height - VIEWPORT_MARGIN
64
+ );
65
+ }
66
+ return { top, left, side: resolvedSide };
67
+ }
68
+ var TooltipContext = React.createContext(null);
69
+ function useTooltipContext(part) {
70
+ const context = React.useContext(TooltipContext);
71
+ if (context === null) {
72
+ throw new Error(`${part} must be used within <Tooltip.Root>`);
73
+ }
74
+ return context;
75
+ }
76
+ function setRef(ref, node) {
77
+ if (typeof ref === "function") ref(node);
78
+ else if (ref) ref.current = node;
79
+ }
80
+ function TooltipRoot({
81
+ open: openProp,
82
+ defaultOpen = false,
83
+ onOpenChange,
84
+ delayDuration = 600,
85
+ side = "top",
86
+ align = "center",
87
+ disabled = false,
88
+ children
89
+ }) {
90
+ const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);
91
+ const isControlled = openProp !== void 0;
92
+ const rawOpen = isControlled ? openProp : uncontrolledOpen;
93
+ const open = disabled ? false : rawOpen;
94
+ const reactId = React.useId();
95
+ const contentId = `${reactId}-tooltip`;
96
+ const anchorRef = React.useRef(null);
97
+ const [anchorRect, setAnchorRect] = React.useState(null);
98
+ const timerRef = React.useRef(null);
99
+ const setOpen = React.useCallback(
100
+ (next) => {
101
+ if (!isControlled) setUncontrolledOpen(next);
102
+ onOpenChange?.(next);
103
+ },
104
+ [isControlled, onOpenChange]
105
+ );
106
+ const clearTimer = React.useCallback(() => {
107
+ if (timerRef.current !== null) {
108
+ clearTimeout(timerRef.current);
109
+ timerRef.current = null;
110
+ }
111
+ }, []);
112
+ React.useEffect(() => clearTimer, [clearTimer]);
113
+ const onTriggerPointerEnter = () => {
114
+ if (disabled) return;
115
+ clearTimer();
116
+ timerRef.current = setTimeout(() => setOpen(true), delayDuration);
117
+ };
118
+ const onTriggerPointerLeave = () => {
119
+ clearTimer();
120
+ setOpen(false);
121
+ };
122
+ const onTriggerFocus = () => {
123
+ if (disabled) return;
124
+ clearTimer();
125
+ setOpen(true);
126
+ };
127
+ const onTriggerBlur = () => {
128
+ clearTimer();
129
+ setOpen(false);
130
+ };
131
+ React.useLayoutEffect(() => {
132
+ if (!open) {
133
+ setAnchorRect(null);
134
+ return;
135
+ }
136
+ const measure = () => {
137
+ const node = anchorRef.current;
138
+ if (node) setAnchorRect(node.getBoundingClientRect());
139
+ };
140
+ measure();
141
+ window.addEventListener("scroll", measure, true);
142
+ window.addEventListener("resize", measure);
143
+ return () => {
144
+ window.removeEventListener("scroll", measure, true);
145
+ window.removeEventListener("resize", measure);
146
+ };
147
+ }, [open]);
148
+ React.useEffect(() => {
149
+ if (!open) return;
150
+ const handleEscape = (event) => {
151
+ if (event.key === "Escape") {
152
+ clearTimer();
153
+ setOpen(false);
154
+ }
155
+ };
156
+ document.addEventListener("keydown", handleEscape);
157
+ return () => document.removeEventListener("keydown", handleEscape);
158
+ }, [open, setOpen, clearTimer]);
159
+ const value = {
160
+ open,
161
+ setOpen,
162
+ disabled,
163
+ contentId,
164
+ side,
165
+ align,
166
+ anchorRef,
167
+ anchorRect,
168
+ onTriggerPointerEnter,
169
+ onTriggerPointerLeave,
170
+ onTriggerFocus,
171
+ onTriggerBlur
172
+ };
173
+ return /* @__PURE__ */ jsx(TooltipContext.Provider, { value, children });
174
+ }
175
+ function TooltipTrigger({
176
+ asChild = false,
177
+ className,
178
+ children,
179
+ ref,
180
+ onPointerEnter,
181
+ onPointerLeave,
182
+ onFocus,
183
+ onBlur,
184
+ ...props
185
+ }) {
186
+ const {
187
+ open,
188
+ disabled,
189
+ contentId,
190
+ anchorRef,
191
+ onTriggerPointerEnter,
192
+ onTriggerPointerLeave,
193
+ onTriggerFocus,
194
+ onTriggerBlur
195
+ } = useTooltipContext("Tooltip.Trigger");
196
+ const describedBy = !disabled && open ? contentId : void 0;
197
+ const handlePointerEnter = (event) => {
198
+ onPointerEnter?.(event);
199
+ onTriggerPointerEnter();
200
+ };
201
+ const handlePointerLeave = (event) => {
202
+ onPointerLeave?.(event);
203
+ onTriggerPointerLeave();
204
+ };
205
+ const handleFocus = (event) => {
206
+ onFocus?.(event);
207
+ onTriggerFocus();
208
+ };
209
+ const handleBlur = (event) => {
210
+ onBlur?.(event);
211
+ onTriggerBlur();
212
+ };
213
+ if (asChild) {
214
+ if (!React.isValidElement(children)) {
215
+ throw new Error(
216
+ "Tooltip.Trigger: `asChild` requires a single React element child"
217
+ );
218
+ }
219
+ const child = children;
220
+ const childProps = child.props;
221
+ const childHandlers = childProps;
222
+ return React.cloneElement(
223
+ child,
224
+ {
225
+ ...props,
226
+ ...childProps,
227
+ "data-slot": "tooltip-trigger",
228
+ "aria-describedby": describedBy,
229
+ onPointerEnter: (event) => {
230
+ childHandlers.onPointerEnter?.(event);
231
+ onPointerEnter?.(event);
232
+ onTriggerPointerEnter();
233
+ },
234
+ onPointerLeave: (event) => {
235
+ childHandlers.onPointerLeave?.(event);
236
+ onPointerLeave?.(event);
237
+ onTriggerPointerLeave();
238
+ },
239
+ onFocus: (event) => {
240
+ childHandlers.onFocus?.(event);
241
+ onFocus?.(event);
242
+ onTriggerFocus();
243
+ },
244
+ onBlur: (event) => {
245
+ childHandlers.onBlur?.(event);
246
+ onBlur?.(event);
247
+ onTriggerBlur();
248
+ },
249
+ className: cn(className, childHandlers.className),
250
+ ref: (node) => {
251
+ anchorRef.current = node;
252
+ setRef(ref, node);
253
+ setRef(childHandlers.ref, node);
254
+ }
255
+ },
256
+ childProps.children
257
+ );
258
+ }
259
+ return /* @__PURE__ */ jsx(
260
+ "button",
261
+ {
262
+ ...props,
263
+ type: props.type ?? "button",
264
+ "data-slot": "tooltip-trigger",
265
+ "aria-describedby": describedBy,
266
+ className,
267
+ onPointerEnter: handlePointerEnter,
268
+ onPointerLeave: handlePointerLeave,
269
+ onFocus: handleFocus,
270
+ onBlur: handleBlur,
271
+ ref: (node) => {
272
+ anchorRef.current = node;
273
+ setRef(ref, node);
274
+ },
275
+ children
276
+ }
277
+ );
278
+ }
279
+ function TooltipContent({
280
+ className,
281
+ children,
282
+ style,
283
+ ref,
284
+ ...props
285
+ }) {
286
+ const { open, contentId, side, align, anchorRect } = useTooltipContext("Tooltip.Content");
287
+ const contentRef = React.useRef(null);
288
+ const [placement, setPlacement] = React.useState(null);
289
+ React.useLayoutEffect(() => {
290
+ if (!open || anchorRect == null) {
291
+ setPlacement(null);
292
+ return;
293
+ }
294
+ const node = contentRef.current;
295
+ if (!node) return;
296
+ const rect = node.getBoundingClientRect();
297
+ setPlacement(
298
+ computeTooltipPosition(
299
+ anchorRect,
300
+ { width: rect.width, height: rect.height },
301
+ side,
302
+ align,
303
+ { width: window.innerWidth, height: window.innerHeight }
304
+ )
305
+ );
306
+ }, [open, anchorRect, side, align]);
307
+ if (!open) return null;
308
+ const positioned = placement !== null;
309
+ const positionStyle = positioned ? {
310
+ position: "absolute",
311
+ top: placement.top + window.scrollY,
312
+ left: placement.left + window.scrollX,
313
+ zIndex: 50,
314
+ ...style
315
+ } : {
316
+ position: "absolute",
317
+ top: 0,
318
+ left: 0,
319
+ visibility: "hidden",
320
+ zIndex: 50,
321
+ ...style
322
+ };
323
+ const setContentRef = (node) => {
324
+ contentRef.current = node;
325
+ setRef(ref, node);
326
+ };
327
+ return createPortal(
328
+ /* @__PURE__ */ jsx(
329
+ "div",
330
+ {
331
+ ...props,
332
+ ref: setContentRef,
333
+ role: "tooltip",
334
+ id: contentId,
335
+ "data-slot": "tooltip-content",
336
+ "data-side": positioned ? placement.side : side,
337
+ "data-align": align,
338
+ className: cn(tooltipVariants(), className),
339
+ style: positionStyle,
340
+ children
341
+ }
342
+ ),
343
+ document.body
344
+ );
345
+ }
346
+ var Tooltip = {
347
+ Root: TooltipRoot,
348
+ Trigger: TooltipTrigger,
349
+ Content: TooltipContent
350
+ };
351
+
352
+ export { Tooltip, TooltipContent, TooltipRoot, TooltipTrigger, computeTooltipPosition, tooltipVariants };
@@ -0,0 +1,146 @@
1
+ import { cn } from './chunk-7EOSDFS3.js';
2
+ import * as React from 'react';
3
+ import { XIcon } from '@phosphor-icons/react';
4
+ import { cva } from 'class-variance-authority';
5
+ import { jsx, jsxs } from 'react/jsx-runtime';
6
+
7
+ var panelVariants = cva([
8
+ "flex w-80 flex-col gap-4 rounded-md border border-card-border bg-card-background p-5"
9
+ ]);
10
+ var panelHeaderVariants = cva(["flex items-start gap-4"]);
11
+ var panelHeaderContentVariants = cva([
12
+ "flex min-w-0 flex-1 items-center gap-3"
13
+ ]);
14
+ var panelHeaderIconVariants = cva([
15
+ "flex items-center text-card-foreground [&_svg]:size-6 [&_svg]:shrink-0"
16
+ ]);
17
+ var panelHeaderTextVariants = cva(["flex min-w-0 flex-col"]);
18
+ var panelCloseButtonVariants = cva([
19
+ "flex shrink-0 cursor-pointer items-center justify-center rounded-xs",
20
+ "text-card-foreground-muted transition-colors hover:text-card-foreground",
21
+ "[&_svg]:size-4 [&_svg]:shrink-0",
22
+ "outline-none focus-visible:text-card-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus"
23
+ ]);
24
+ var panelBodyVariants = cva(["text-card-foreground"]);
25
+ var panelFooterVariants = cva(["flex items-start gap-2"]);
26
+ var PanelContext = React.createContext(null);
27
+ function usePanelContext() {
28
+ return React.useContext(PanelContext);
29
+ }
30
+ function PanelRoot({
31
+ className,
32
+ children,
33
+ ref,
34
+ "aria-label": ariaLabel,
35
+ "aria-labelledby": ariaLabelledby,
36
+ ...props
37
+ }) {
38
+ const reactId = React.useId();
39
+ const titleId = `${reactId}-title`;
40
+ const [hasTitle, setHasTitle] = React.useState(false);
41
+ const labelledBy = hasTitle ? titleId : ariaLabelledby;
42
+ const hasName = Boolean(labelledBy || ariaLabel);
43
+ const value = { titleId, setHasTitle };
44
+ return /* @__PURE__ */ jsx(PanelContext.Provider, { value, children: /* @__PURE__ */ jsx(
45
+ "div",
46
+ {
47
+ ref,
48
+ role: hasName ? "region" : void 0,
49
+ "aria-label": ariaLabel,
50
+ "aria-labelledby": labelledBy,
51
+ "data-slot": "panel",
52
+ className: cn(panelVariants(), className),
53
+ ...props,
54
+ children
55
+ }
56
+ ) });
57
+ }
58
+ function PanelHeader({
59
+ icon,
60
+ title,
61
+ description,
62
+ showClose = true,
63
+ onClose,
64
+ className,
65
+ ref,
66
+ ...props
67
+ }) {
68
+ const context = usePanelContext();
69
+ const titleId = context?.titleId;
70
+ const setHasTitle = context?.setHasTitle;
71
+ const hasDescription = description != null;
72
+ React.useEffect(() => {
73
+ if (!setHasTitle) return;
74
+ setHasTitle(true);
75
+ return () => setHasTitle(false);
76
+ }, [setHasTitle]);
77
+ return /* @__PURE__ */ jsxs(
78
+ "div",
79
+ {
80
+ ref,
81
+ "data-slot": "panel-header",
82
+ className: cn(panelHeaderVariants(), className),
83
+ ...props,
84
+ children: [
85
+ /* @__PURE__ */ jsxs("div", { className: panelHeaderContentVariants(), children: [
86
+ icon != null && /* @__PURE__ */ jsx(
87
+ "span",
88
+ {
89
+ "data-slot": "panel-header-icon",
90
+ "aria-hidden": "true",
91
+ className: panelHeaderIconVariants(),
92
+ children: icon
93
+ }
94
+ ),
95
+ /* @__PURE__ */ jsxs("div", { className: panelHeaderTextVariants(), children: [
96
+ /* @__PURE__ */ jsx("p", { id: titleId, className: "body-02-medium text-card-foreground", children: title }),
97
+ hasDescription && /* @__PURE__ */ jsx("p", { className: "body-03 text-card-foreground-muted", children: description })
98
+ ] })
99
+ ] }),
100
+ showClose && /* @__PURE__ */ jsx(
101
+ "button",
102
+ {
103
+ type: "button",
104
+ "data-slot": "panel-header-close",
105
+ "aria-label": "Close",
106
+ className: panelCloseButtonVariants(),
107
+ onClick: () => onClose?.(),
108
+ children: /* @__PURE__ */ jsx(XIcon, { weight: "regular" })
109
+ }
110
+ )
111
+ ]
112
+ }
113
+ );
114
+ }
115
+ function PanelBody({ className, children, ref, ...props }) {
116
+ return /* @__PURE__ */ jsx(
117
+ "div",
118
+ {
119
+ ref,
120
+ "data-slot": "panel-body",
121
+ className: cn(panelBodyVariants(), className),
122
+ ...props,
123
+ children
124
+ }
125
+ );
126
+ }
127
+ function PanelFooter({ className, children, ref, ...props }) {
128
+ return /* @__PURE__ */ jsx(
129
+ "div",
130
+ {
131
+ ref,
132
+ "data-slot": "panel-footer",
133
+ className: cn(panelFooterVariants(), className),
134
+ ...props,
135
+ children
136
+ }
137
+ );
138
+ }
139
+ var Panel = {
140
+ Root: PanelRoot,
141
+ Header: PanelHeader,
142
+ Body: PanelBody,
143
+ Footer: PanelFooter
144
+ };
145
+
146
+ export { Panel, PanelBody, PanelFooter, PanelHeader, PanelRoot, panelBodyVariants, panelCloseButtonVariants, panelFooterVariants, panelHeaderContentVariants, panelHeaderIconVariants, panelHeaderTextVariants, panelHeaderVariants, panelVariants };
@@ -0,0 +1,89 @@
1
+ import * as React from 'react';
2
+
3
+ // src/lib/cut-corner.ts
4
+ function buildCutPath({
5
+ W,
6
+ H,
7
+ cut,
8
+ rTR,
9
+ rBL,
10
+ rCut,
11
+ ox = 0,
12
+ oy = 0
13
+ }) {
14
+ const rCutSq = rCut / Math.SQRT2;
15
+ const x = (v) => v + ox;
16
+ const y = (v) => v + oy;
17
+ return [
18
+ `M ${x(cut + rCut)} ${y(0)}`,
19
+ `L ${x(W - rTR)} ${y(0)}`,
20
+ `Q ${x(W)} ${y(0)} ${x(W)} ${y(rTR)}`,
21
+ `L ${x(W)} ${y(H - cut - rCut)}`,
22
+ `Q ${x(W)} ${y(H - cut)} ${x(W - rCutSq)} ${y(H - cut + rCutSq)}`,
23
+ `L ${x(W - cut + rCutSq)} ${y(H - rCutSq)}`,
24
+ `Q ${x(W - cut)} ${y(H)} ${x(W - cut - rCut)} ${y(H)}`,
25
+ `L ${x(rBL)} ${y(H)}`,
26
+ `Q ${x(0)} ${y(H)} ${x(0)} ${y(H - rBL)}`,
27
+ `L ${x(0)} ${y(cut + rCut)}`,
28
+ `Q ${x(0)} ${y(cut)} ${x(rCutSq)} ${y(cut - rCutSq)}`,
29
+ `L ${x(cut - rCutSq)} ${y(rCutSq)}`,
30
+ `Q ${x(cut)} ${y(0)} ${x(cut + rCut)} ${y(0)}`,
31
+ `Z`
32
+ ].join(" ");
33
+ }
34
+ function useCutCornerClipPath(cut, {
35
+ radius = 2,
36
+ radiusCuts,
37
+ radiusTopRight,
38
+ radiusBottomLeft,
39
+ outset
40
+ } = {}) {
41
+ const ref = React.useRef(null);
42
+ const [clipPath, setClipPath] = React.useState();
43
+ const [pathD, setPathD] = React.useState();
44
+ const [outsetPathD, setOutsetPathD] = React.useState();
45
+ React.useLayoutEffect(() => {
46
+ const el = ref.current;
47
+ if (!el) return;
48
+ const rTR = radiusTopRight ?? radius;
49
+ const rBL = radiusBottomLeft ?? radius;
50
+ const rCut = radiusCuts ?? radius;
51
+ function compute(W, H) {
52
+ const d = buildCutPath({ W, H, cut, rTR, rBL, rCut });
53
+ setClipPath(`path('${d}')`);
54
+ setPathD(d);
55
+ if (outset != null) {
56
+ const g = outset;
57
+ setOutsetPathD(
58
+ buildCutPath({
59
+ W: W + 2 * g,
60
+ H: H + 2 * g,
61
+ cut: cut + (2 - Math.SQRT2) * g,
62
+ rTR: rTR + g,
63
+ rBL: rBL + g,
64
+ rCut: rCut + g,
65
+ ox: -g,
66
+ oy: -g
67
+ })
68
+ );
69
+ }
70
+ }
71
+ const initial = el.getBoundingClientRect();
72
+ compute(initial.width, initial.height);
73
+ const ro = new ResizeObserver((entries) => {
74
+ const box = entries[entries.length - 1]?.borderBoxSize?.[0];
75
+ if (box) {
76
+ compute(box.inlineSize, box.blockSize);
77
+ } else {
78
+ const rect = el.getBoundingClientRect();
79
+ compute(rect.width, rect.height);
80
+ }
81
+ });
82
+ ro.observe(el);
83
+ return () => ro.disconnect();
84
+ }, [cut, radius, radiusCuts, radiusTopRight, radiusBottomLeft, outset]);
85
+ return { ref, clipPath, pathD, outsetPathD };
86
+ }
87
+ var BUTTON_CUT = { cut: 8, radius: 2, radiusCuts: 0 };
88
+
89
+ export { BUTTON_CUT, useCutCornerClipPath };
@@ -0,0 +1,77 @@
1
+ import { cn } from './chunk-7EOSDFS3.js';
2
+ import { XCircleIcon, CheckCircleIcon, XIcon } from '@phosphor-icons/react';
3
+ import { cva } from 'class-variance-authority';
4
+ import { jsxs, jsx } from 'react/jsx-runtime';
5
+
6
+ var toastVariants = cva(
7
+ "flex items-center gap-4 rounded-sm bg-card-reversed-background px-5 py-4"
8
+ );
9
+ var toastIconVariants = cva(
10
+ "flex shrink-0 items-center [&_svg]:size-5 [&_svg]:shrink-0",
11
+ {
12
+ variants: {
13
+ variation: {
14
+ success: "text-success-primary-foreground",
15
+ error: "text-destructive-primary-foreground"
16
+ }
17
+ },
18
+ defaultVariants: { variation: "success" }
19
+ }
20
+ );
21
+ var toastCloseVariants = cva([
22
+ "flex shrink-0 cursor-pointer items-center rounded-xs text-card-reversed-foreground-muted",
23
+ "transition-colors hover:text-card-reversed-foreground",
24
+ "[&_svg]:size-5 [&_svg]:shrink-0",
25
+ "outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-solid focus-visible:outline-focus"
26
+ ]);
27
+ var STATUS_ICON = {
28
+ success: CheckCircleIcon,
29
+ error: XCircleIcon
30
+ };
31
+ function Toast({
32
+ variation = "success",
33
+ children,
34
+ onClose,
35
+ className,
36
+ ref,
37
+ ...props
38
+ }) {
39
+ const StatusIcon = STATUS_ICON[variation];
40
+ return /* @__PURE__ */ jsxs(
41
+ "div",
42
+ {
43
+ "data-slot": "toast",
44
+ role: variation === "error" ? "alert" : "status",
45
+ className: cn(toastVariants(), className),
46
+ ref,
47
+ ...props,
48
+ children: [
49
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
50
+ /* @__PURE__ */ jsx(
51
+ "span",
52
+ {
53
+ "data-slot": "toast-icon",
54
+ "aria-hidden": "true",
55
+ className: toastIconVariants({ variation }),
56
+ children: /* @__PURE__ */ jsx(StatusIcon, { weight: "fill" })
57
+ }
58
+ ),
59
+ /* @__PURE__ */ jsx("span", { className: "body-03 min-w-0 flex-1 text-card-reversed-foreground", children })
60
+ ] }),
61
+ onClose && /* @__PURE__ */ jsx(
62
+ "button",
63
+ {
64
+ type: "button",
65
+ "data-slot": "toast-close",
66
+ "aria-label": "Dismiss",
67
+ className: toastCloseVariants(),
68
+ onClick: onClose,
69
+ children: /* @__PURE__ */ jsx(XIcon, { weight: "regular" })
70
+ }
71
+ )
72
+ ]
73
+ }
74
+ );
75
+ }
76
+
77
+ export { Toast, toastCloseVariants, toastIconVariants, toastVariants };