@g4rcez/components 2.0.32 → 2.0.34

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 (184) hide show
  1. package/dist/components/core/{button.js → button.jsx} +5 -3
  2. package/dist/components/core/heading.d.ts +1 -1
  3. package/dist/components/core/heading.d.ts.map +1 -1
  4. package/dist/components/core/heading.jsx +4 -0
  5. package/dist/components/core/{polymorph.js → polymorph.jsx} +1 -2
  6. package/dist/components/core/render-on-view.d.ts +1 -1
  7. package/dist/components/core/render-on-view.d.ts.map +1 -1
  8. package/dist/components/core/{render-on-view.js → render-on-view.jsx} +4 -3
  9. package/dist/components/core/resizable.d.ts +1 -1
  10. package/dist/components/core/resizable.d.ts.map +1 -1
  11. package/dist/components/core/{resizable.js → resizable.jsx} +4 -3
  12. package/dist/components/core/{slot.js → slot.jsx} +8 -5
  13. package/dist/components/core/{tag.js → tag.jsx} +6 -3
  14. package/dist/components/core/typography.d.ts +5 -5
  15. package/dist/components/core/typography.d.ts.map +1 -1
  16. package/dist/components/core/typography.jsx +26 -0
  17. package/dist/components/display/alert.d.ts +1 -1
  18. package/dist/components/display/alert.d.ts.map +1 -1
  19. package/dist/components/display/alert.jsx +56 -0
  20. package/dist/components/display/calendar.d.ts +1 -1
  21. package/dist/components/display/calendar.d.ts.map +1 -1
  22. package/dist/components/display/{calendar.js → calendar.jsx} +83 -21
  23. package/dist/components/display/card.d.ts +3 -3
  24. package/dist/components/display/card.d.ts.map +1 -1
  25. package/dist/components/display/card.jsx +43 -0
  26. package/dist/components/display/empty.d.ts +1 -1
  27. package/dist/components/display/empty.d.ts.map +1 -1
  28. package/dist/components/display/empty.jsx +11 -0
  29. package/dist/components/display/list.d.ts +2 -2
  30. package/dist/components/display/list.d.ts.map +1 -1
  31. package/dist/components/display/list.jsx +81 -0
  32. package/dist/components/display/notifications.d.ts +1 -1
  33. package/dist/components/display/notifications.d.ts.map +1 -1
  34. package/dist/components/display/{notifications.js → notifications.jsx} +34 -10
  35. package/dist/components/display/progress.d.ts +1 -1
  36. package/dist/components/display/progress.d.ts.map +1 -1
  37. package/dist/components/display/progress.jsx +13 -0
  38. package/dist/components/display/shortcut.d.ts +1 -1
  39. package/dist/components/display/shortcut.d.ts.map +1 -1
  40. package/dist/components/display/shortcut.jsx +23 -0
  41. package/dist/components/display/skeleton.d.ts +4 -4
  42. package/dist/components/display/skeleton.d.ts.map +1 -1
  43. package/dist/components/display/skeleton.jsx +14 -0
  44. package/dist/components/display/spinner.d.ts +2 -2
  45. package/dist/components/display/spinner.d.ts.map +1 -1
  46. package/dist/components/display/spinner.jsx +7 -0
  47. package/dist/components/display/stats.d.ts +1 -1
  48. package/dist/components/display/stats.d.ts.map +1 -1
  49. package/dist/components/display/stats.jsx +20 -0
  50. package/dist/components/display/step.d.ts +2 -2
  51. package/dist/components/display/step.d.ts.map +1 -1
  52. package/dist/components/display/step.jsx +133 -0
  53. package/dist/components/display/tabs.d.ts +3 -3
  54. package/dist/components/display/tabs.d.ts.map +1 -1
  55. package/dist/components/display/{tabs.js → tabs.jsx} +21 -7
  56. package/dist/components/display/timeline.d.ts +6 -6
  57. package/dist/components/display/timeline.d.ts.map +1 -1
  58. package/dist/components/display/timeline.jsx +25 -0
  59. package/dist/components/floating/command-palette.d.ts +1 -1
  60. package/dist/components/floating/command-palette.d.ts.map +1 -1
  61. package/dist/components/floating/command-palette.jsx +187 -0
  62. package/dist/components/floating/dropdown.d.ts +1 -1
  63. package/dist/components/floating/dropdown.d.ts.map +1 -1
  64. package/dist/components/floating/{dropdown.js → dropdown.jsx} +17 -3
  65. package/dist/components/floating/expand.d.ts +1 -1
  66. package/dist/components/floating/expand.d.ts.map +1 -1
  67. package/dist/components/floating/{expand.js → expand.jsx} +14 -2
  68. package/dist/components/floating/{menu.js → menu.jsx} +52 -27
  69. package/dist/components/floating/modal.d.ts +10 -2
  70. package/dist/components/floating/modal.d.ts.map +1 -1
  71. package/dist/components/floating/modal.jsx +240 -0
  72. package/dist/components/floating/toolbar.d.ts +1 -1
  73. package/dist/components/floating/toolbar.d.ts.map +1 -1
  74. package/dist/components/floating/toolbar.jsx +5 -0
  75. package/dist/components/floating/{tooltip.js → tooltip.jsx} +12 -3
  76. package/dist/components/floating/wizard.d.ts +1 -1
  77. package/dist/components/floating/wizard.d.ts.map +1 -1
  78. package/dist/components/floating/{wizard.js → wizard.jsx} +64 -19
  79. package/dist/components/form/autocomplete.jsx +276 -0
  80. package/dist/components/form/checkbox.jsx +12 -0
  81. package/dist/components/form/{date-picker.js → date-picker.jsx} +15 -4
  82. package/dist/components/form/file-upload.d.ts +1 -1
  83. package/dist/components/form/file-upload.d.ts.map +1 -1
  84. package/dist/components/form/file-upload.jsx +133 -0
  85. package/dist/components/form/form.d.ts +1 -1
  86. package/dist/components/form/form.d.ts.map +1 -1
  87. package/dist/components/form/{form.js → form.jsx} +2 -2
  88. package/dist/components/form/{free-text.js → free-text.jsx} +4 -3
  89. package/dist/components/form/input-field.d.ts +1 -1
  90. package/dist/components/form/input-field.d.ts.map +1 -1
  91. package/dist/components/form/input-field.jsx +54 -0
  92. package/dist/components/form/multi-select.jsx +328 -0
  93. package/dist/components/form/radiobox.d.ts +1 -1
  94. package/dist/components/form/radiobox.d.ts.map +1 -1
  95. package/dist/components/form/radiobox.jsx +6 -0
  96. package/dist/components/form/select.jsx +42 -0
  97. package/dist/components/form/slider.d.ts +1 -1
  98. package/dist/components/form/slider.d.ts.map +1 -1
  99. package/dist/components/form/{slider.js → slider.jsx} +11 -3
  100. package/dist/components/form/switch.jsx +46 -0
  101. package/dist/components/form/task-list.d.ts +1 -1
  102. package/dist/components/form/task-list.d.ts.map +1 -1
  103. package/dist/components/form/{task-list.js → task-list.jsx} +1 -2
  104. package/dist/components/form/transfer-list.d.ts +1 -1
  105. package/dist/components/form/transfer-list.d.ts.map +1 -1
  106. package/dist/components/form/transfer-list.jsx +39 -0
  107. package/dist/components/table/filter.d.ts +2 -2
  108. package/dist/components/table/filter.d.ts.map +1 -1
  109. package/dist/components/table/{filter.js → filter.jsx} +35 -7
  110. package/dist/components/table/group.d.ts +1 -1
  111. package/dist/components/table/group.d.ts.map +1 -1
  112. package/dist/components/table/group.jsx +68 -0
  113. package/dist/components/table/index.d.ts +1 -1
  114. package/dist/components/table/index.d.ts.map +1 -1
  115. package/dist/components/table/{index.js → index.jsx} +10 -2
  116. package/dist/components/table/inner-table.d.ts +1 -1
  117. package/dist/components/table/inner-table.d.ts.map +1 -1
  118. package/dist/components/table/{inner-table.js → inner-table.jsx} +21 -9
  119. package/dist/components/table/metadata.d.ts +1 -1
  120. package/dist/components/table/metadata.d.ts.map +1 -1
  121. package/dist/components/table/metadata.jsx +37 -0
  122. package/dist/components/table/pagination.d.ts +1 -1
  123. package/dist/components/table/pagination.d.ts.map +1 -1
  124. package/dist/components/table/pagination.jsx +73 -0
  125. package/dist/components/table/row.d.ts +1 -1
  126. package/dist/components/table/row.d.ts.map +1 -1
  127. package/dist/components/table/row.jsx +58 -0
  128. package/dist/components/table/sort.d.ts +2 -2
  129. package/dist/components/table/sort.d.ts.map +1 -1
  130. package/dist/components/table/{sort.js → sort.jsx} +32 -6
  131. package/dist/components/table/thead.d.ts +2 -1
  132. package/dist/components/table/thead.d.ts.map +1 -1
  133. package/dist/components/table/thead.jsx +103 -0
  134. package/dist/config/default-translations.d.ts +1 -1
  135. package/dist/config/{default-translations.js → default-translations.jsx} +5 -3
  136. package/dist/flow/flow.d.ts +1 -1
  137. package/dist/flow/flow.d.ts.map +1 -1
  138. package/dist/flow/flow.jsx +111 -0
  139. package/dist/hooks/use-components-provider.d.ts +2 -2
  140. package/dist/hooks/use-components-provider.d.ts.map +1 -1
  141. package/dist/hooks/{use-components-provider.js → use-components-provider.jsx} +2 -3
  142. package/dist/hooks/use-translations.d.ts +1 -1
  143. package/dist/index.css +1 -1
  144. package/dist/index.js.map +1 -1
  145. package/dist/index.mjs +13463 -16070
  146. package/dist/index.mjs.map +1 -1
  147. package/dist/index.umd.js +14 -31
  148. package/dist/index.umd.js.map +1 -1
  149. package/package.json +1 -1
  150. package/dist/components/core/heading.js +0 -5
  151. package/dist/components/core/typography.js +0 -10
  152. package/dist/components/display/alert.js +0 -37
  153. package/dist/components/display/card.js +0 -18
  154. package/dist/components/display/empty.js +0 -8
  155. package/dist/components/display/list.js +0 -32
  156. package/dist/components/display/progress.js +0 -9
  157. package/dist/components/display/shortcut.js +0 -19
  158. package/dist/components/display/skeleton.js +0 -13
  159. package/dist/components/display/spinner.js +0 -6
  160. package/dist/components/display/stats.js +0 -5
  161. package/dist/components/display/step.js +0 -122
  162. package/dist/components/display/timeline.js +0 -14
  163. package/dist/components/floating/command-palette.js +0 -155
  164. package/dist/components/floating/modal.js +0 -195
  165. package/dist/components/floating/toolbar.js +0 -4
  166. package/dist/components/form/autocomplete.js +0 -247
  167. package/dist/components/form/checkbox.js +0 -7
  168. package/dist/components/form/file-upload.js +0 -88
  169. package/dist/components/form/input-field.js +0 -17
  170. package/dist/components/form/multi-select.js +0 -277
  171. package/dist/components/form/radiobox.js +0 -3
  172. package/dist/components/form/select.js +0 -31
  173. package/dist/components/form/switch.js +0 -36
  174. package/dist/components/form/transfer-list.js +0 -22
  175. package/dist/components/table/group.js +0 -41
  176. package/dist/components/table/metadata.js +0 -10
  177. package/dist/components/table/pagination.js +0 -42
  178. package/dist/components/table/row.js +0 -47
  179. package/dist/components/table/thead.js +0 -71
  180. package/dist/flow/flow.js +0 -77
  181. /package/dist/components/form/{formReset.js → formReset.jsx} +0 -0
  182. /package/dist/components/form/{input.js → input.jsx} +0 -0
  183. /package/dist/components/form/{textarea.js → textarea.jsx} +0 -0
  184. /package/dist/components/table/{table.context.js → table.context.jsx} +0 -0
@@ -0,0 +1,81 @@
1
+ "use client";
2
+ import { FloatingFocusManager, FloatingOverlay, FloatingPortal, useClick, useDismiss, useFloating, useInteractions, useRole, } from "@floating-ui/react";
3
+ import { AnimatePresence, motion, MotionConfig } from "motion/react";
4
+ import { XIcon } from "lucide-react";
5
+ import React, { Fragment, useCallback, useId, useState } from "react";
6
+ const FloatItem = ({ item, context, setter, get, refs }) => (<FloatingPortal>
7
+ <MotionConfig reducedMotion="user" transition={{ type: "tween", stiffness: 25, duration: 0.3 }}>
8
+ <AnimatePresence presenceAffectsLayout>
9
+ {item ? (<motion.div exit={{ opacity: 0 }} animate={{ opacity: 1 }} initial={{ opacity: 0 }} className="pointer-events-none fixed inset-0 top-0 z-overlay h-screen w-screen bg-floating-overlay/70"/>) : null}
10
+ {item ? (<FloatingOverlay lockScroll className="absolute inset-0 z-floating flex items-center justify-center">
11
+ <FloatingFocusManager visuallyHiddenDismiss modal closeOnFocusOut context={context}>
12
+ <motion.div layout layoutId={`item-${item.id}`} className="relative flex h-min w-min min-w-xs flex-col gap-4 rounded-card border border-card-border bg-card-background p-6 py-4 pb-8 shadow-shadow-card" ref={refs.setFloating} {...get()}>
13
+ <nav className="absolute right-4 top-1 lg:right-2">
14
+ <button type="button" onClick={setter} className="p-1 opacity-70 transition-colors hover:text-danger hover:opacity-100 focus:text-danger">
15
+ <XIcon />
16
+ </button>
17
+ </nav>
18
+ <header className="flex w-full flex-wrap items-center justify-between gap-2">
19
+ <h3 className="min-w-full text-balance text-2xl font-medium">{item.title}</h3>
20
+ <p className="text-sm leading-snug text-secondary">{item.description}</p>
21
+ </header>
22
+ {item.children}
23
+ </motion.div>
24
+ </FloatingFocusManager>
25
+ </FloatingOverlay>) : null}
26
+ </AnimatePresence>
27
+ </MotionConfig>
28
+ </FloatingPortal>);
29
+ export const AnimatedList = (props) => {
30
+ const [selected, setSelected] = useState(null);
31
+ const id = useId();
32
+ const { context, refs } = useFloating({
33
+ open: selected !== null,
34
+ transform: true,
35
+ onOpenChange: (open) => (open ? undefined : setSelected(null)),
36
+ });
37
+ const click = useClick(context);
38
+ const role = useRole(context, { role: "dialog" });
39
+ const dismiss = useDismiss(context, { escapeKey: true, referencePress: true, outsidePress: true });
40
+ const { getFloatingProps } = useInteractions([click, role, dismiss]);
41
+ const clear = useCallback(() => {
42
+ setSelected(null);
43
+ }, []);
44
+ const items = React.Children.toArray(props.children);
45
+ return (<Fragment>
46
+ <FloatItem refs={refs} context={context} get={getFloatingProps} item={selected} setter={clear}/>
47
+ <ul role="list">
48
+ {items.map((x, index) => {
49
+ const item = x.props;
50
+ const innerId = `${id}-${index}`;
51
+ const setter = () => setSelected({ ...item, id: innerId });
52
+ const Leading = item.leading;
53
+ return (<motion.li layout key={innerId} layoutId={`item-${innerId}`} className={`border-b border-card-border py-2 last:border-transparent`}>
54
+ <motion.div layoutId={`toast-${innerId}`} className="relative">
55
+ <div className="relative flex items-start space-x-3">
56
+ <Fragment>
57
+ {item.avatar ? (<div>
58
+ <div className="relative px-1">
59
+ <button onClick={setter} className="flex size-10 items-center justify-center ring-primary">
60
+ {item.avatar}
61
+ </button>
62
+ </div>
63
+ </div>) : null}
64
+ <div className="min-w-0 flex-1 py-1 text-foreground">
65
+ <div className="flex flex-row flex-nowrap justify-between gap-4">
66
+ <button onClick={setter} className="cursor-pointer text-left transition-all ease-out hover:text-primary">
67
+ <h3>{item.title}</h3>
68
+ <p className="text-sm leading-snug text-secondary">{item.description}</p>
69
+ </button>
70
+ {Leading ? <Leading open={setter}/> : null}
71
+ </div>
72
+ </div>
73
+ </Fragment>
74
+ </div>
75
+ </motion.div>
76
+ </motion.li>);
77
+ })}
78
+ </ul>
79
+ </Fragment>);
80
+ };
81
+ export const AnimatedListItem = (props) => <Fragment>{props.children}</Fragment>;
@@ -20,6 +20,6 @@ export type NotificationProps = Partial<{
20
20
  max: number;
21
21
  timeout: number;
22
22
  }>;
23
- export declare function Notifications({ children, max, timeout }: PropsWithChildren<NotificationProps>): import("react/jsx-runtime").JSX.Element;
23
+ export declare function Notifications({ children, max, timeout }: PropsWithChildren<NotificationProps>): import("react").JSX.Element;
24
24
  export {};
25
25
  //# sourceMappingURL=notifications.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../src/components/display/notifications.tsx"],"names":[],"mappings":"AACA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,OAAO,EAAiB,KAAK,iBAAiB,EAAmC,MAAM,OAAO,CAAC;AAE/F,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,QAAA,MAAM,QAAQ;;mFAgBb,CAAC;AAEF,KAAK,mBAAmB,GAAG,OAAO,CAAC;IACjC,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,YAAY,CAAC,OAAO,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC;CAC/C,CAAC,CAAC;AAIH,KAAK,sBAAsB,GAAG;IAAE,KAAK,EAAE,MAAM,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AAEvE,KAAK,eAAe,GAAG,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,mBAAmB,KAAK,sBAAsB,CAAC;AAMlG,eAAO,MAAM,eAAe,uBAAwC,CAAC;AAwDrE,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAqE1E,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,GAAO,EAAE,OAAc,EAAE,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,2CAMxG"}
1
+ {"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../src/components/display/notifications.tsx"],"names":[],"mappings":"AACA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,OAAO,EAAiB,KAAK,iBAAiB,EAAmC,MAAM,OAAO,CAAC;AAE/F,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,QAAA,MAAM,QAAQ;;mFAgBb,CAAC;AAEF,KAAK,mBAAmB,GAAG,OAAO,CAAC;IACjC,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,YAAY,CAAC,OAAO,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC;CAC/C,CAAC,CAAC;AAIH,KAAK,sBAAsB,GAAG;IAAE,KAAK,EAAE,MAAM,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AAEvE,KAAK,eAAe,GAAG,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,mBAAmB,KAAK,sBAAsB,CAAC;AAMlG,eAAO,MAAM,eAAe,uBAAwC,CAAC;AAwDrE,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAqE1E,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,GAAO,EAAE,OAAc,EAAE,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,+BAMxG"}
@@ -1,5 +1,4 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
2
  import { cva } from "class-variance-authority";
4
3
  import { XIcon } from "lucide-react";
5
4
  import { AnimatePresence, motion } from "motion/react";
@@ -34,21 +33,39 @@ function Notification(props) {
34
33
  const closable = props.toast.data?.closable ?? true;
35
34
  const variant = props.hover ? "hover" : props.isLast ? "isLast" : "other";
36
35
  const className = variants({ theme: props.toast.data?.theme || "default" });
37
- return (_jsx(Base.Root, { toast: props.toast, swipeDirection: ["down", "right"], children: _jsx(motion.li, { layout: true, layoutScroll: true, animate: variant, "data-index": props.index, initial: { y: -100, zIndex: -1 }, className: "absolute top-0 right-0 w-80 pointer-events-auto text-select", variants: {
38
- isLast: { y: 10, scale: 1, animationDuration: "300ms", opacity: 1 },
39
- hover: { y: 0, position: "static", scale: 1, opacity: 1 },
40
- other: animatedIndex[props.reversedIndex] || animatedIndex.default,
41
- }, transition: { type: "spring", mass: 1.2, damping: 30, stiffness: 200 }, exit: { opacity: [0.9, 0], transition: { opacity: { bounce: 0.25, duration: 0.3 } } }, children: _jsxs(Base.Content, { className: className, children: [_jsxs("div", { className: "flex flex-col p-4", children: [props.toast.title ? (_jsx(Base.Title, { className: "text-lg font-medium leading-relaxed select-text truncate" })) : null, _jsx(Base.Description, { className: "select-text truncate" })] }), closable ? (_jsx(Base.Close, { className: "absolute top-2 right-2 p-1 rounded-full transition text-foreground hover:bg-danger/10 hover:text-danger-hover", children: _jsx(XIcon, { className: "size-5" }) })) : null] }) }) }));
36
+ return (<Base.Root toast={props.toast} swipeDirection={["down", "right"]}>
37
+ <motion.li layout layoutScroll animate={variant} data-index={props.index} initial={{ y: -100, zIndex: -1 }} className="absolute top-0 right-0 w-80 pointer-events-auto text-select" variants={{
38
+ isLast: { y: 10, scale: 1, animationDuration: "300ms", opacity: 1 },
39
+ hover: { y: 0, position: "static", scale: 1, opacity: 1 },
40
+ other: animatedIndex[props.reversedIndex] || animatedIndex.default,
41
+ }} transition={{ type: "spring", mass: 1.2, damping: 30, stiffness: 200 }} exit={{ opacity: [0.9, 0], transition: { opacity: { bounce: 0.25, duration: 0.3 } } }}>
42
+ <Base.Content className={className}>
43
+ <div className="flex flex-col p-4">
44
+ {props.toast.title ? (<Base.Title className="text-lg font-medium leading-relaxed select-text truncate"/>) : null}
45
+ <Base.Description className="select-text truncate"/>
46
+ </div>
47
+ {closable ? (<Base.Close className="absolute top-2 right-2 p-1 rounded-full transition text-foreground hover:bg-danger/10 hover:text-danger-hover">
48
+ <XIcon className="size-5"/>
49
+ </Base.Close>) : null}
50
+ </Base.Content>
51
+ </motion.li>
52
+ </Base.Root>);
42
53
  }
43
54
  function NotificationsViewport({ max = 5 }) {
44
55
  const ref = useRef(null);
45
56
  const hover = useHover(ref);
46
57
  const toastManager = Base.useToastManager();
47
58
  const toasts = toastManager.toasts.slice(-max);
48
- return (_jsx(Base.Viewport, { ref: ref, "data-items": toasts.length, style: {
59
+ return (<Base.Viewport ref={ref} data-items={toasts.length} style={{
49
60
  justifyContent: "start",
50
61
  height: `${(hover ? toasts.length : Math.min(1, toasts.length)) * 7}rem`,
51
- }, className: "fixed right-4 top-10 flex w-80 list-none flex-col-reverse items-end gap-4 overflow-y-clip overflow-x-visible data-[items=true]:pb-8 max-sm:top-20", children: _jsx(motion.ol, { className: "flex flex-col gap-4", children: _jsx(AnimatePresence, { presenceAffectsLayout: true, mode: "popLayout", children: toasts.reverse().map((toast, index, list) => (_jsx(Notification, { toast: toast, hover: hover, index: index, isLast: list.length - 1 === index, reversedIndex: list.length - (index + 1) }, toast.id))) }) }) }));
62
+ }} className="fixed right-4 top-10 flex w-80 list-none flex-col-reverse items-end gap-4 overflow-y-clip overflow-x-visible data-[items=true]:pb-8 max-sm:top-20">
63
+ <motion.ol className="flex flex-col gap-4">
64
+ <AnimatePresence presenceAffectsLayout mode="popLayout">
65
+ {toasts.reverse().map((toast, index, list) => (<Notification toast={toast} hover={hover} index={index} key={toast.id} isLast={list.length - 1 === index} reversedIndex={list.length - (index + 1)}/>))}
66
+ </AnimatePresence>
67
+ </motion.ol>
68
+ </Base.Viewport>);
52
69
  }
53
70
  function NotificationsInner({ children, max = 5 }) {
54
71
  const toastManager = Base.useToastManager();
@@ -67,8 +84,15 @@ function NotificationsInner({ children, max = 5 }) {
67
84
  clear,
68
85
  };
69
86
  }, [toastManager, clear]);
70
- return (_jsxs(NotificationContext.Provider, { value: notify, children: [children, _jsx(Base.Portal, { children: _jsx(NotificationsViewport, { max: max }) })] }));
87
+ return (<NotificationContext.Provider value={notify}>
88
+ {children}
89
+ <Base.Portal>
90
+ <NotificationsViewport max={max}/>
91
+ </Base.Portal>
92
+ </NotificationContext.Provider>);
71
93
  }
72
94
  export function Notifications({ children, max = 5, timeout = 5000 }) {
73
- return (_jsx(Base.Provider, { limit: max, timeout: timeout, children: _jsx(NotificationsInner, { max: max, children: children }) }));
95
+ return (<Base.Provider limit={max} timeout={timeout}>
96
+ <NotificationsInner max={max}>{children}</NotificationsInner>
97
+ </Base.Provider>);
74
98
  }
@@ -8,6 +8,6 @@ type ProgressProps = {
8
8
  className?: string;
9
9
  textClassName?: string;
10
10
  };
11
- export declare const Progress: (props: PropsWithoutRef<ProgressProps>) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const Progress: (props: PropsWithoutRef<ProgressProps>) => import("react").JSX.Element;
12
12
  export {};
13
13
  //# sourceMappingURL=progress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/components/display/progress.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,KAAK,aAAa,GAAG;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,OAAO,eAAe,CAAC,aAAa,CAAC,4CAoB7D,CAAA"}
1
+ {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/components/display/progress.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,KAAK,aAAa,GAAG;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,OAAO,eAAe,CAAC,aAAa,CAAC,gCAoB7D,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { Is } from "sidekicker";
2
+ import { Progress as RadixProgress } from "@base-ui/react/progress";
3
+ import { css } from "../../lib/dom";
4
+ export const Progress = (props) => {
5
+ return (<RadixProgress.Root max={props.max} value={props.percent ?? null} style={{ transform: "translateZ(0)", }} className={css("overflow-hidden relative w-full rounded-full h-6 bg-background", props.container)}>
6
+ <RadixProgress.Indicator style={{ transform: Is.number(props.percent) ? `translateX(-${100 - props.percent}%)` : undefined }} className={css("bg-primary transition-transform ease-in-out size-full duration-500", props.className)}/>
7
+ {Is.number(props.percent)
8
+ ? <p className={css("flex absolute inset-0 justify-center items-center w-full font-semibold tabular-nums text-primary-foreground", props.textClassName)}>
9
+ {props.label ? props.label : `${props.percent} %`}
10
+ </p>
11
+ : null}
12
+ </RadixProgress.Root>);
13
+ };
@@ -1,4 +1,4 @@
1
1
  export declare const Shortcut: (props: {
2
2
  value: string;
3
- }) => import("react/jsx-runtime").JSX.Element;
3
+ }) => import("react").JSX.Element;
4
4
  //# sourceMappingURL=shortcut.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shortcut.d.ts","sourceRoot":"","sources":["../../../src/components/display/shortcut.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,QAAQ,GAAI,OAAO;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,4CAehD,CAAC"}
1
+ {"version":3,"file":"shortcut.d.ts","sourceRoot":"","sources":["../../../src/components/display/shortcut.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,QAAQ,GAAI,OAAO;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,gCAehD,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { CommandIcon, OptionIcon } from "lucide-react";
2
+ import { Fragment } from "react";
3
+ import { isMac } from "../../lib/combi-keys";
4
+ const remap = (x) => {
5
+ x = x.trim();
6
+ if (x === "Alt")
7
+ return isMac() ? <OptionIcon aria-label="Option" size={14}/> : "Alt";
8
+ if (x === "Mod")
9
+ return isMac() ? <CommandIcon aria-label="Command" size={14}/> : "Ctrl";
10
+ return x;
11
+ };
12
+ export const Shortcut = (props) => {
13
+ const p = props.value.trim().split("+");
14
+ return (<span className="flex items-center gap-1">
15
+ {p.map((x, i) => {
16
+ const isLast = p.length - 1 === i;
17
+ return (<Fragment key={`${props.value}-${x}-key-${i}`}>
18
+ <kbd aria-label={x}>{remap(x)}</kbd>
19
+ {isLast ? null : <span>+</span>}
20
+ </Fragment>);
21
+ })}
22
+ </span>);
23
+ };
@@ -1,12 +1,12 @@
1
- import { CSSProperties, type ElementType } from "react";
2
- export declare const SkeletonCell: import("react/jsx-runtime").JSX.Element;
1
+ import React, { CSSProperties, type ElementType } from "react";
2
+ export declare const SkeletonCell: React.JSX.Element;
3
3
  export declare const Skeleton: (props: {
4
4
  className?: string;
5
5
  as?: ElementType;
6
6
  style?: CSSProperties;
7
- }) => import("react/jsx-runtime").JSX.Element;
7
+ }) => React.JSX.Element;
8
8
  export declare const SkeletonList: (props: {
9
9
  className?: string;
10
10
  rows: number;
11
- }) => import("react/jsx-runtime").JSX.Element;
11
+ }) => React.JSX.Element;
12
12
  //# sourceMappingURL=skeleton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"skeleton.d.ts","sourceRoot":"","sources":["../../../src/components/display/skeleton.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAU,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAIvE,eAAO,MAAM,YAAY,yCAAiE,CAAC;AAE3F,eAAO,MAAM,QAAQ,GAAI,OAAO;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,aAAa,CAAA;CAAE,4CAE9F,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,4CAUvE,CAAA"}
1
+ {"version":3,"file":"skeleton.d.ts","sourceRoot":"","sources":["../../../src/components/display/skeleton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAU,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAIvE,eAAO,MAAM,YAAY,mBAAiE,CAAC;AAE3F,eAAO,MAAM,QAAQ,GAAI,OAAO;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,aAAa,CAAA;CAAE,sBAE9F,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,sBAUvE,CAAA"}
@@ -0,0 +1,14 @@
1
+ import React, { useRef } from "react";
2
+ import { css } from "../../lib/dom";
3
+ import { Polymorph } from "../core/polymorph";
4
+ export const SkeletonCell = <div className="w-10/12 h-6 rounded animate-pulse bg-muted"/>;
5
+ export const Skeleton = (props) => (<Polymorph {...props} as={props.as || "span"} className={css("block rounded h-8 w-32 animate-pulse bg-muted", props.className)}/>);
6
+ export const SkeletonList = (props) => {
7
+ const items = useRef(Array.from({ length: props.rows }).map((_, i) => {
8
+ const rand = Math.max(100, Math.random() * 99);
9
+ return <Skeleton key={`skeleton-${rand}-${i}`} style={{ width: `${rand}%` }} as="li"/>;
10
+ }));
11
+ return (<ul className={css("flex flex-col gap-6", props.className)}>
12
+ {items.current}
13
+ </ul>);
14
+ };
@@ -1,5 +1,5 @@
1
1
  export declare const Spinner: (props: {
2
2
  className?: string;
3
- }) => import("react/jsx-runtime").JSX.Element;
4
- export declare const Loading: () => import("react/jsx-runtime").JSX.Element;
3
+ }) => import("react").JSX.Element;
4
+ export declare const Loading: () => import("react").JSX.Element;
5
5
  //# sourceMappingURL=spinner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/components/display/spinner.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,GAAI,OAAO;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,4CASpD,CAAC;AAEF,eAAO,MAAM,OAAO,+CAMnB,CAAC"}
1
+ {"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/components/display/spinner.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,GAAI,OAAO;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,gCASpD,CAAC;AAEF,eAAO,MAAM,OAAO,mCAMnB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { css } from "../../lib/dom";
2
+ export const Spinner = (props) => (<span aria-busy="true" aria-description="Carregando..." className={css("box-border inline-block aspect-square size-12 animate-spin rounded-full border-4 border-background border-b-primary", props.className)}/>);
3
+ export const Loading = () => {
4
+ return (<div className="flex h-full w-full items-center justify-center p-12">
5
+ <Spinner />
6
+ </div>);
7
+ };
@@ -8,5 +8,5 @@ export type StatsProps = {
8
8
  className: string;
9
9
  }>;
10
10
  };
11
- export declare const Stats: (props: React.PropsWithChildren<StatsProps>) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const Stats: (props: React.PropsWithChildren<StatsProps>) => React.JSX.Element;
12
12
  //# sourceMappingURL=stats.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/components/display/stats.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,MAAM,UAAU,GAAG;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC5B,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,OAAO,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,4CAmB/D,CAAC"}
1
+ {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/components/display/stats.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,MAAM,UAAU,GAAG;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC5B,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,OAAO,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,sBAmB/D,CAAC"}
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import { css } from "../../lib/dom";
3
+ export const Stats = (props) => {
4
+ return (<div className="divide-y divide-card-border rounded-card border border-card-border bg-card-background shadow-shadow-card">
5
+ <header className="flex items-start gap-4 p-6">
6
+ <div className={css("flex aspect-square size-10 items-center justify-center rounded-card bg-primary p-8", props.iconContainer)}>
7
+ <div>
8
+ <props.Icon className="aspect-square size-10 text-primary-foreground"/>
9
+ </div>
10
+ </div>
11
+ <div className="flex flex-col gap-1">
12
+ <header>
13
+ <h3 className="text-base leading-none">{props.title}</h3>
14
+ </header>
15
+ <p className="text-4xl font-semibold">{props.children}</p>
16
+ </div>
17
+ </header>
18
+ {props.footer ? <footer className="px-6 py-2">{props.footer}</footer> : null}
19
+ </div>);
20
+ };
@@ -14,10 +14,10 @@ export type StepProps = React.ComponentProps<"button"> & {
14
14
  titleClassName?: string;
15
15
  };
16
16
  export declare const useStepContext: () => StepContextValue | null;
17
- export declare const Step: ({ step, currentStep, status, title, titleClassName, ...props }: StepProps) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const Step: ({ step, currentStep, status, title, titleClassName, ...props }: StepProps) => React.JSX.Element;
18
18
  export declare const Steps: (props: PropsWithChildren<{
19
19
  steps: number;
20
20
  currentStep: number;
21
- }>) => import("react/jsx-runtime").JSX.Element;
21
+ }>) => React.JSX.Element;
22
22
  export {};
23
23
  //# sourceMappingURL=step.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../src/components/display/step.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAA2C,iBAAiB,EAA2C,MAAM,OAAO,CAAC;AAEnI,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAMpC,KAAK,gBAAgB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,mBAAmB,EAAE,MAAM,CAAA;CAAE,CAAC;AA+BnG,KAAK,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;AAE/D,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAoCF,eAAO,MAAM,cAAc,+BAAgC,CAAC;AAE5D,eAAO,MAAM,IAAI,GAAI,gEAAgE,SAAS,4CAqF7F,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,OAAO,iBAAiB,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,4CA2CrF,CAAC"}
1
+ {"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../src/components/display/step.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAA2C,iBAAiB,EAA2C,MAAM,OAAO,CAAC;AAEnI,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAMpC,KAAK,gBAAgB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,mBAAmB,EAAE,MAAM,CAAA;CAAE,CAAC;AA+BnG,KAAK,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;AAE/D,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAiCF,eAAO,MAAM,cAAc,+BAAgC,CAAC;AAE5D,eAAO,MAAM,IAAI,GAAI,gEAAgE,SAAS,sBA4F7F,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,OAAO,iBAAiB,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,sBAyBrF,CAAC"}
@@ -0,0 +1,133 @@
1
+ "use client";
2
+ import { motion } from "motion/react";
3
+ import React, { createContext, Fragment, useContext, useEffect, useRef, useState } from "react";
4
+ import { useColorParser } from "../../hooks/use-color-parser";
5
+ const PROGRESS_BAR_DURATION = 0.3;
6
+ const transition = { duration: PROGRESS_BAR_DURATION, type: "tween", ease: "easeInOut" };
7
+ const StepContext = createContext(null);
8
+ const iconTransitions = { delay: 0.2, duration: 0.3, type: "tween", ease: "easeOut" };
9
+ const states = {
10
+ initial: { pathLength: 0, opacity: 0 },
11
+ animate: { pathLength: 1, opacity: 1 },
12
+ };
13
+ const ErrorIcon = (props) => (<svg {...props} viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
14
+ <motion.path className="currentColor" initial={states.initial} animate={states.animate} transition={iconTransitions} d="M18 6 6 18"/>
15
+ <motion.path className="currentColor" initial={states.initial} animate={states.animate} transition={iconTransitions} d="m6 6 12 12"/>
16
+ </svg>);
17
+ const CheckIcon = (props) => (<svg {...props} fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={3}>
18
+ <motion.path d="M5 13l4 4L19 7" strokeLinecap="round" strokeLinejoin="round" animate={states.animate} initial={states.initial} transition={iconTransitions}/>
19
+ </svg>);
20
+ const variants = {
21
+ complete: { scale: 1.25 },
22
+ active: { scale: 1, transition: { delay: 0, duration: 0.3 } }
23
+ };
24
+ const transitions = { duration: 0.6, delay: 0.2, type: "tween", ease: "circOut", };
25
+ const getCurrentStatus = (step, currentStep, status) => {
26
+ if (status === "error")
27
+ return "error";
28
+ if (currentStep === step)
29
+ return "active";
30
+ if (currentStep < step)
31
+ return "inactive";
32
+ return "complete";
33
+ };
34
+ const calculateStepDelay = (step, currentStep, previousStep, duration) => {
35
+ if (currentStep === previousStep)
36
+ return 0;
37
+ const isForward = currentStep > previousStep;
38
+ if (isForward) {
39
+ if (step <= previousStep || step > currentStep)
40
+ return 0;
41
+ return ((step - previousStep) / (currentStep - previousStep)) * duration;
42
+ }
43
+ if (step <= currentStep || step > previousStep)
44
+ return 0;
45
+ return ((previousStep - step) / (previousStep - currentStep)) * duration;
46
+ };
47
+ export const useStepContext = () => useContext(StepContext);
48
+ export const Step = ({ step, currentStep, status, title, titleClassName, ...props }) => {
49
+ const parser = useColorParser();
50
+ const context = useStepContext();
51
+ const [visualCurrentStep, setVisualCurrentStep] = useState(currentStep);
52
+ useEffect(() => {
53
+ if (!context) {
54
+ setVisualCurrentStep(currentStep);
55
+ return;
56
+ }
57
+ const delay = calculateStepDelay(step, context.currentStep, context.previousStep, context.progressBarDuration);
58
+ if (delay === 0) {
59
+ setVisualCurrentStep(currentStep);
60
+ return;
61
+ }
62
+ const timer = setTimeout(() => {
63
+ setVisualCurrentStep(currentStep);
64
+ }, delay * 1000);
65
+ return () => clearTimeout(timer);
66
+ }, [currentStep, context, step]);
67
+ const innerStatus = getCurrentStatus(step, visualCurrentStep, status);
68
+ return (<Fragment>
69
+ <div className={`h-[2px] w-full lg:block bg-card-border hidden first:hidden ${innerStatus === "active" || innerStatus === "complete" ? "bg-success" : ""}`}/>
70
+ <motion.button {...props} type="button" data-step={step} animate={innerStatus} className="flex relative justify-center items-center w-auto text-center">
71
+ <motion.div variants={variants} transition={transitions} className={`hidden lg:block absolute inset-0 rounded-full text-center ${innerStatus === "error" ? "bg-danger" : ""}`}/>
72
+ <motion.div initial={false} animate={innerStatus} transition={transition} className="flex relative justify-center items-center w-10 h-10 font-semibold rounded-full" variants={{
73
+ error: {
74
+ color: parser("var(--danger-foreground)"),
75
+ borderColor: parser("var(--danger-hover)"),
76
+ backgroundColor: parser("var(--danger-DEFAULT)"),
77
+ },
78
+ inactive: {
79
+ transition,
80
+ color: parser("var(--disabled)"),
81
+ borderColor: parser("var(--card-border)"),
82
+ backgroundColor: parser("var(--background)"),
83
+ },
84
+ active: {
85
+ transition,
86
+ color: parser("var(--primary-foreground)"),
87
+ borderColor: parser("var(--primary-DEFAULT)"),
88
+ backgroundColor: parser("var(--primary-DEFAULT)"),
89
+ },
90
+ complete: {
91
+ transition,
92
+ color: parser("var(--success-foreground)"),
93
+ borderColor: parser("var(--success-DEFAULT)"),
94
+ backgroundColor: parser("var(--success-DEFAULT)"),
95
+ },
96
+ }}>
97
+ <div className="flex justify-center items-center">
98
+ {innerStatus === "complete" ? (<CheckIcon className="size-6 text-primary-foreground"/>) : innerStatus === "error" ? (<ErrorIcon className="size-6 text-danger-foreground"/>) : (<Fragment>
99
+ <span>{step}</span>
100
+ </Fragment>)}
101
+ </div>
102
+ </motion.div>
103
+ {title && innerStatus === "active" ?
104
+ <header className="flex flex-col justify-start items-start px-2">
105
+ <h3 className={`h-full flex items-center ${titleClassName}`}>{title}</h3>
106
+ </header> :
107
+ <header className="flex flex-col justify-start items-start px-2 lg:hidden">
108
+ <h3 className={`h-full whitespace-nowrap flex items-center ${titleClassName}`}>{title}</h3>
109
+ </header>}
110
+ </motion.button>
111
+ </Fragment>);
112
+ };
113
+ export const Steps = (props) => {
114
+ const previousStepRef = useRef(props.currentStep);
115
+ const [previousStep, setPreviousStep] = useState(props.currentStep);
116
+ useEffect(() => {
117
+ previousStepRef.current = previousStep;
118
+ const timer = setTimeout(() => {
119
+ setPreviousStep(props.currentStep);
120
+ }, PROGRESS_BAR_DURATION * 1000);
121
+ return () => clearTimeout(timer);
122
+ }, [props.currentStep, previousStep]);
123
+ const contextValue = {
124
+ currentStep: props.currentStep,
125
+ previousStep: previousStepRef.current,
126
+ progressBarDuration: PROGRESS_BAR_DURATION,
127
+ };
128
+ return (<StepContext.Provider value={contextValue}>
129
+ <div className="flex relative flex-col gap-4 justify-center items-start w-full lg:flex-row lg:justify-between lg:items-center">
130
+ {props.children}
131
+ </div>
132
+ </StepContext.Provider>);
133
+ };
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren } from "react";
1
+ import React, { PropsWithChildren } from "react";
2
2
  import { Label } from "../../types";
3
3
  import { CardProps } from "./card";
4
4
  export type TabsProps = Omit<CardProps<"div">, "onChange"> & {
@@ -7,7 +7,7 @@ export type TabsProps = Omit<CardProps<"div">, "onChange"> & {
7
7
  className?: string;
8
8
  onChange?: (id: string) => void;
9
9
  };
10
- export declare const Tabs: (props: PropsWithChildren<TabsProps>) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const Tabs: (props: PropsWithChildren<TabsProps>) => React.JSX.Element;
11
11
  type CommonTabProps = {
12
12
  id: string;
13
13
  disabled?: boolean;
@@ -19,6 +19,6 @@ export type TabProps = CommonTabProps & ({
19
19
  label: string;
20
20
  title: Omit<Label, string>;
21
21
  });
22
- export declare const Tab: (props: PropsWithChildren<TabProps>) => import("react/jsx-runtime").JSX.Element;
22
+ export declare const Tab: (props: PropsWithChildren<TabProps>) => React.JSX.Element;
23
23
  export {};
24
24
  //# sourceMappingURL=tabs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/components/display/tabs.tsx"],"names":[],"mappings":"AACA,OAAc,EAA2B,iBAAiB,EAAiC,MAAM,OAAO,CAAC;AAMzG,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAQ,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEzC,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AAiCF,eAAO,MAAM,IAAI,GAAI,OAAO,iBAAiB,CAAC,SAAS,CAAC,4CAsFvD,CAAC;AAIF,KAAK,cAAc,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEzD,MAAM,MAAM,QAAQ,GAAG,cAAc,GACjC,CACM;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GACpC;IACE,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAC9B,CACJ,CAAC;AAEN,eAAO,MAAM,GAAG,GAAI,OAAO,iBAAiB,CAAC,QAAQ,CAAC,4CAGrD,CAAC"}
1
+ {"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/components/display/tabs.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAA2B,iBAAiB,EAAiC,MAAM,OAAO,CAAC;AAMzG,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAQ,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEzC,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AAiCF,eAAO,MAAM,IAAI,GAAI,OAAO,iBAAiB,CAAC,SAAS,CAAC,sBAsFvD,CAAC;AAIF,KAAK,cAAc,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEzD,MAAM,MAAM,QAAQ,GAAG,cAAc,GACjC,CACM;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GACpC;IACE,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAC9B,CACJ,CAAC;AAEN,eAAO,MAAM,GAAG,GAAI,OAAO,iBAAiB,CAAC,QAAQ,CAAC,sBAGrD,CAAC"}
@@ -1,5 +1,4 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
2
  import React, { createContext, Fragment, useContext, useEffect, useRef } from "react";
4
3
  import { Is } from "sidekicker";
5
4
  import { useReactive } from "../../hooks/use-reactive";
@@ -73,14 +72,29 @@ export const Tabs = (props) => {
73
72
  setActive(result);
74
73
  }
75
74
  };
76
- return (_jsx(Context.Provider, { value: active, children: _jsx(Card, { className: props.className, container: css("pt-0 max-w-full w-full min-w-0", props.container), header: _jsxs("header", { className: "overflow-x-auto relative mb-2", children: [_jsx("div", { className: "absolute bottom-0 w-full h-[1px] bg-card-border" }), _jsx("nav", { className: "min-w-0", children: _jsx("ul", { onKeyDown: onKeyDown, ref: ref, className: "flex overflow-x-auto flex-1 justify-start w-0 min-w-full", children: items.map((x) => {
77
- const inner = x.props;
78
- const current = active === inner.id;
79
- return (_jsx("li", { "data-id": inner.id, "data-active": current, "aria-disabled": inner.disabled, className: css("relative w-fit border-b border-transparent transition-all", current ? "border-primary font-medium text-primary" : "", inner.disabled ? "aria-disabled:text-disabled" : ""), children: _jsx(Polymorph, { as: "button", type: "button", "data-id": inner.id, "aria-current": "page", disabled: inner.disabled, onClick: inner.disabled ? undefined : onClick, className: "block py-4 px-10 w-full whitespace-nowrap disabled:cursor-not-allowed", children: inner.title }) }, `tab-header-${inner.id}`));
80
- }) }) })] }), children: props.children }) }));
75
+ return (<Context.Provider value={active}>
76
+ <Card className={props.className} container={css("pt-0 max-w-full w-full min-w-0", props.container)} header={<header className="overflow-x-auto relative mb-2">
77
+ <div className="absolute bottom-0 w-full h-[1px] bg-card-border"/>
78
+ <nav className="min-w-0">
79
+ <ul onKeyDown={onKeyDown} ref={ref} className="flex overflow-x-auto flex-1 justify-start w-0 min-w-full">
80
+ {items.map((x) => {
81
+ const inner = x.props;
82
+ const current = active === inner.id;
83
+ return (<li data-id={inner.id} data-active={current} key={`tab-header-${inner.id}`} aria-disabled={inner.disabled} className={css("relative w-fit border-b border-transparent transition-all", current ? "border-primary font-medium text-primary" : "", inner.disabled ? "aria-disabled:text-disabled" : "")}>
84
+ <Polymorph as="button" type="button" data-id={inner.id} aria-current="page" disabled={inner.disabled} onClick={inner.disabled ? undefined : onClick} className="block py-4 px-10 w-full whitespace-nowrap disabled:cursor-not-allowed">
85
+ {inner.title}
86
+ </Polymorph>
87
+ </li>);
88
+ })}
89
+ </ul>
90
+ </nav>
91
+ </header>}>
92
+ {props.children}
93
+ </Card>
94
+ </Context.Provider>);
81
95
  };
82
96
  const useTabs = () => useContext(Context);
83
97
  export const Tab = (props) => {
84
98
  const active = useTabs();
85
- return _jsx(Fragment, { children: props.id === active ? props.children : null });
99
+ return <Fragment>{props.id === active ? props.children : null}</Fragment>;
86
100
  };
@@ -1,10 +1,10 @@
1
- import { ComponentProps, ElementType, PropsWithChildren } from "react";
1
+ import React, { ComponentProps, ElementType, PropsWithChildren } from "react";
2
2
  import { PolymorphicProps } from "../core/polymorph";
3
3
  export declare const TimelineItem: {
4
- (props: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
5
- Icon(props: PropsWithChildren<ComponentProps<"header">>): import("react/jsx-runtime").JSX.Element;
6
- Body<T extends ElementType = "section">(props: PropsWithChildren<PolymorphicProps<object, T>>): import("react/jsx-runtime").JSX.Element;
7
- Right<T extends ElementType = "button">(props: PolymorphicProps<object, T>): import("react/jsx-runtime").JSX.Element;
4
+ (props: PropsWithChildren): React.JSX.Element;
5
+ Icon(props: PropsWithChildren<ComponentProps<"header">>): React.JSX.Element;
6
+ Body<T extends ElementType = "section">(props: PropsWithChildren<PolymorphicProps<object, T>>): React.JSX.Element;
7
+ Right<T extends ElementType = "button">(props: PolymorphicProps<object, T>): React.JSX.Element;
8
8
  };
9
- export declare const Timeline: (props: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const Timeline: (props: PropsWithChildren) => React.JSX.Element;
10
10
  //# sourceMappingURL=timeline.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../../../src/components/display/timeline.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE9E,OAAO,EAAa,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,eAAO,MAAM,YAAY;YAAW,iBAAiB;gBAOJ,iBAAiB,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;SAW9C,CAAC,SAAS,WAAW,qBAAqB,iBAAiB,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;UAQtF,CAAC,SAAS,WAAW,oBAAoB,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC;CArBnH,CAAC;AA6BF,eAAO,MAAM,QAAQ,GAAI,OAAO,iBAAiB,4CAIhD,CAAC"}
1
+ {"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../../../src/components/display/timeline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE9E,OAAO,EAAa,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,eAAO,MAAM,YAAY;YAAW,iBAAiB;gBAOJ,iBAAiB,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;SAW9C,CAAC,SAAS,WAAW,qBAAqB,iBAAiB,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;UAQtF,CAAC,SAAS,WAAW,oBAAoB,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC;CArBnH,CAAC;AA6BF,eAAO,MAAM,QAAQ,GAAI,OAAO,iBAAiB,sBAIhD,CAAC"}