@g4rcez/components 0.0.38 → 0.0.39

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 (194) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/index.js +201 -10
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +3609 -3600
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/index.umd.js +40 -40
  7. package/dist/index.umd.js.map +1 -1
  8. package/dist/preset.tailwind.d.ts +10 -0
  9. package/dist/preset.tailwind.d.ts.map +1 -0
  10. package/dist/preset.tailwind.js +53 -0
  11. package/dist/src/components/core/button.d.ts +16 -0
  12. package/dist/src/components/core/button.d.ts.map +1 -0
  13. package/dist/src/components/core/button.js +43 -0
  14. package/dist/src/components/core/polymorph.d.ts +10 -0
  15. package/dist/src/components/core/polymorph.d.ts.map +1 -0
  16. package/dist/src/components/core/polymorph.js +8 -0
  17. package/dist/src/components/core/resizable.d.ts +3 -0
  18. package/dist/src/components/core/resizable.d.ts.map +1 -0
  19. package/dist/src/components/core/resizable.js +50 -0
  20. package/dist/src/components/core/tag.d.ts +19 -0
  21. package/dist/src/components/core/tag.d.ts.map +1 -0
  22. package/dist/src/components/core/tag.js +45 -0
  23. package/dist/src/components/display/alert.d.ts +19 -0
  24. package/dist/src/components/display/alert.d.ts.map +1 -0
  25. package/dist/src/components/display/alert.js +34 -0
  26. package/dist/src/components/display/calendar.d.ts +42 -0
  27. package/dist/src/components/display/calendar.d.ts.map +1 -0
  28. package/dist/src/components/display/calendar.js +215 -0
  29. package/dist/src/components/display/card.d.ts +10 -0
  30. package/dist/src/components/display/card.d.ts.map +1 -0
  31. package/dist/src/components/display/card.js +8 -0
  32. package/dist/src/components/display/list.d.ts +16 -0
  33. package/dist/src/components/display/list.d.ts.map +1 -0
  34. package/dist/src/components/display/list.js +31 -0
  35. package/dist/src/components/display/notifications.d.ts +25 -0
  36. package/dist/src/components/display/notifications.d.ts.map +1 -0
  37. package/dist/src/components/display/notifications.js +70 -0
  38. package/dist/src/components/display/stats.d.ts +10 -0
  39. package/dist/src/components/display/stats.d.ts.map +1 -0
  40. package/dist/src/components/display/stats.js +5 -0
  41. package/dist/src/components/display/step.d.ts +14 -0
  42. package/dist/src/components/display/step.d.ts.map +1 -0
  43. package/dist/src/components/display/step.js +59 -0
  44. package/dist/src/components/display/tabs.d.ts +20 -0
  45. package/dist/src/components/display/tabs.d.ts.map +1 -0
  46. package/dist/src/components/display/tabs.js +67 -0
  47. package/dist/src/components/display/timeline.d.ts +32 -0
  48. package/dist/src/components/display/timeline.d.ts.map +1 -0
  49. package/dist/src/components/display/timeline.js +21 -0
  50. package/dist/src/components/floating/dropdown.d.ts +14 -0
  51. package/dist/src/components/floating/dropdown.d.ts.map +1 -0
  52. package/dist/src/components/floating/dropdown.js +39 -0
  53. package/dist/src/components/floating/expand.d.ts +9 -0
  54. package/dist/src/components/floating/expand.d.ts.map +1 -0
  55. package/dist/src/components/floating/expand.js +25 -0
  56. package/dist/src/components/floating/menu.d.ts +52 -0
  57. package/dist/src/components/floating/menu.d.ts.map +1 -0
  58. package/dist/src/components/floating/menu.js +126 -0
  59. package/dist/src/components/floating/modal.d.ts +19 -0
  60. package/dist/src/components/floating/modal.d.ts.map +1 -0
  61. package/dist/src/components/floating/modal.js +102 -0
  62. package/dist/src/components/floating/toolbar.d.ts +6 -0
  63. package/dist/src/components/floating/toolbar.d.ts.map +1 -0
  64. package/dist/src/components/floating/toolbar.js +4 -0
  65. package/dist/src/components/floating/tooltip.d.ts +12 -0
  66. package/dist/src/components/floating/tooltip.d.ts.map +1 -0
  67. package/dist/src/components/floating/tooltip.js +28 -0
  68. package/dist/src/components/form/autocomplete.d.ts +17 -0
  69. package/dist/src/components/form/autocomplete.d.ts.map +1 -0
  70. package/dist/src/components/form/autocomplete.js +152 -0
  71. package/dist/src/components/form/checkbox.d.ts +11 -0
  72. package/dist/src/components/form/checkbox.d.ts.map +1 -0
  73. package/dist/src/components/form/checkbox.js +8 -0
  74. package/dist/src/components/form/date-picker.d.ts +61 -0
  75. package/dist/src/components/form/date-picker.d.ts.map +1 -0
  76. package/dist/src/components/form/date-picker.js +78 -0
  77. package/dist/src/components/form/file-upload.d.ts +12 -0
  78. package/dist/src/components/form/file-upload.d.ts.map +1 -0
  79. package/dist/src/components/form/file-upload.js +62 -0
  80. package/dist/src/components/form/form.d.ts +4 -0
  81. package/dist/src/components/form/form.d.ts.map +1 -0
  82. package/dist/src/components/form/form.js +28 -0
  83. package/dist/src/components/form/input-field.d.ts +30 -0
  84. package/dist/src/components/form/input-field.d.ts.map +1 -0
  85. package/dist/src/components/form/input-field.js +14 -0
  86. package/dist/src/components/form/input.d.ts +9 -0
  87. package/dist/src/components/form/input.d.ts.map +1 -0
  88. package/dist/src/components/form/input.js +38 -0
  89. package/dist/src/components/form/radiobox.d.ts +7 -0
  90. package/dist/src/components/form/radiobox.d.ts.map +1 -0
  91. package/dist/src/components/form/radiobox.js +7 -0
  92. package/dist/src/components/form/select.d.ts +13 -0
  93. package/dist/src/components/form/select.d.ts.map +1 -0
  94. package/dist/src/components/form/select.js +33 -0
  95. package/dist/src/components/form/switch.d.ts +8 -0
  96. package/dist/src/components/form/switch.d.ts.map +1 -0
  97. package/dist/src/components/form/switch.js +39 -0
  98. package/dist/src/components/form/task-list.d.ts +3 -0
  99. package/dist/src/components/form/task-list.d.ts.map +1 -0
  100. package/dist/src/components/form/task-list.js +26 -0
  101. package/dist/src/components/form/transfer-list.d.ts +14 -0
  102. package/dist/src/components/form/transfer-list.d.ts.map +1 -0
  103. package/dist/src/components/form/transfer-list.js +21 -0
  104. package/dist/src/components/index.d.ts +30 -0
  105. package/dist/src/components/index.d.ts.map +1 -0
  106. package/dist/src/components/index.js +29 -0
  107. package/dist/src/components/table/filter.d.ts +41 -0
  108. package/dist/src/components/table/filter.d.ts.map +1 -0
  109. package/dist/src/components/table/filter.js +91 -0
  110. package/dist/src/components/table/group.d.ts +17 -0
  111. package/dist/src/components/table/group.d.ts.map +1 -0
  112. package/dist/src/components/table/group.js +43 -0
  113. package/dist/src/components/table/index.d.ts +38 -0
  114. package/dist/src/components/table/index.d.ts.map +1 -0
  115. package/dist/src/components/table/index.js +145 -0
  116. package/dist/src/components/table/metadata.d.ts +3 -0
  117. package/dist/src/components/table/metadata.d.ts.map +1 -0
  118. package/dist/src/components/table/metadata.js +10 -0
  119. package/dist/src/components/table/pagination.d.ts +3 -0
  120. package/dist/src/components/table/pagination.d.ts.map +1 -0
  121. package/dist/src/components/table/pagination.js +43 -0
  122. package/dist/src/components/table/sort.d.ts +28 -0
  123. package/dist/src/components/table/sort.d.ts.map +1 -0
  124. package/dist/src/components/table/sort.js +79 -0
  125. package/dist/src/components/table/table-lib.d.ts +122 -0
  126. package/dist/src/components/table/table-lib.d.ts.map +1 -0
  127. package/dist/src/components/table/table-lib.js +51 -0
  128. package/dist/src/components/table/thead.d.ts +8 -0
  129. package/dist/src/components/table/thead.d.ts.map +1 -0
  130. package/dist/src/components/table/thead.js +29 -0
  131. package/dist/src/constants.d.ts +3 -0
  132. package/dist/src/constants.d.ts.map +1 -0
  133. package/dist/src/constants.js +2 -0
  134. package/dist/src/hooks/use-callback-ref.d.ts +3 -0
  135. package/dist/src/hooks/use-callback-ref.d.ts.map +1 -0
  136. package/dist/src/hooks/use-callback-ref.js +8 -0
  137. package/dist/src/hooks/use-click-outside.d.ts +3 -0
  138. package/dist/src/hooks/use-click-outside.d.ts.map +1 -0
  139. package/dist/src/hooks/use-click-outside.js +17 -0
  140. package/dist/src/hooks/use-debounce.d.ts +4 -0
  141. package/dist/src/hooks/use-debounce.d.ts.map +1 -0
  142. package/dist/src/hooks/use-debounce.js +12 -0
  143. package/dist/src/hooks/use-form.d.ts +41 -0
  144. package/dist/src/hooks/use-form.d.ts.map +1 -0
  145. package/dist/src/hooks/use-form.js +169 -0
  146. package/dist/src/hooks/use-hover.d.ts +3 -0
  147. package/dist/src/hooks/use-hover.d.ts.map +1 -0
  148. package/dist/src/hooks/use-hover.js +18 -0
  149. package/dist/src/hooks/use-media-query.d.ts +2 -0
  150. package/dist/src/hooks/use-media-query.d.ts.map +1 -0
  151. package/dist/src/hooks/use-media-query.js +25 -0
  152. package/dist/src/hooks/use-mutable-state.d.ts +2 -0
  153. package/dist/src/hooks/use-mutable-state.d.ts.map +1 -0
  154. package/dist/src/hooks/use-mutable-state.js +8 -0
  155. package/dist/src/hooks/use-on-event.d.ts +4 -0
  156. package/dist/src/hooks/use-on-event.d.ts.map +1 -0
  157. package/dist/src/hooks/use-on-event.js +7 -0
  158. package/dist/src/hooks/use-parent.d.ts +3 -0
  159. package/dist/src/hooks/use-parent.d.ts.map +1 -0
  160. package/dist/src/hooks/use-parent.js +21 -0
  161. package/dist/src/hooks/use-previous.d.ts +2 -0
  162. package/dist/src/hooks/use-previous.d.ts.map +1 -0
  163. package/dist/src/hooks/use-previous.js +8 -0
  164. package/dist/src/hooks/use-reactive.d.ts +2 -0
  165. package/dist/src/hooks/use-reactive.d.ts.map +1 -0
  166. package/dist/src/hooks/use-reactive.js +8 -0
  167. package/dist/src/hooks/use-stable-ref.d.ts +2 -0
  168. package/dist/src/hooks/use-stable-ref.d.ts.map +1 -0
  169. package/dist/src/hooks/use-stable-ref.js +8 -0
  170. package/dist/src/hooks/use-translate-context.d.ts +103 -0
  171. package/dist/src/hooks/use-translate-context.d.ts.map +1 -0
  172. package/dist/src/hooks/use-translate-context.js +63 -0
  173. package/dist/src/index.d.ts +12 -0
  174. package/dist/src/index.d.ts.map +1 -0
  175. package/dist/src/index.js +10 -0
  176. package/dist/src/lib/dom.d.ts +9 -0
  177. package/dist/src/lib/dom.d.ts.map +1 -0
  178. package/dist/src/lib/dom.js +34 -0
  179. package/dist/src/lib/fns.d.ts +7 -0
  180. package/dist/src/lib/fns.d.ts.map +1 -0
  181. package/dist/src/lib/fns.js +26 -0
  182. package/dist/src/styles/design-tokens.d.ts +19 -0
  183. package/dist/src/styles/design-tokens.d.ts.map +1 -0
  184. package/dist/src/styles/design-tokens.js +52 -0
  185. package/dist/src/styles/theme.d.ts +4 -0
  186. package/dist/src/styles/theme.d.ts.map +1 -0
  187. package/dist/src/styles/theme.js +294 -0
  188. package/dist/src/styles/theme.types.d.ts +101 -0
  189. package/dist/src/styles/theme.types.d.ts.map +1 -0
  190. package/dist/src/styles/theme.types.js +1 -0
  191. package/dist/src/types.d.ts +10 -0
  192. package/dist/src/types.d.ts.map +1 -0
  193. package/dist/src/types.js +1 -0
  194. package/package.json +1 -1
@@ -0,0 +1,126 @@
1
+ "use client";
2
+ import { __rest } from "tslib";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { autoUpdate, flip, FloatingFocusManager, FloatingList, FloatingNode, FloatingPortal, FloatingTree, offset, safePolygon, shift, useClick, useDismiss, useFloating, useFloatingNodeId, useFloatingParentNodeId, useFloatingTree, useHover, useInteractions, useListItem, useListNavigation, useMergeRefs, useRole, useTypeahead, } from "@floating-ui/react";
5
+ import { Slot } from "@radix-ui/react-slot";
6
+ import { ChevronRightIcon } from "lucide-react";
7
+ import React, { createContext, Fragment, useContext, useEffect, useRef, useState } from "react";
8
+ import { FLOATING_DELAY, TYPEAHEAD_RESET_DELAY } from "../../constants";
9
+ import { css } from "../../lib/dom";
10
+ const menuItemClassName = (highlight = "") => css("w-full min-w-36 outline-none p-2.5 items-center flex justify-between text-left", "hover:bg-primary data-[open]:bg-primary focus:bg-primary aria-expanded:opacity-80", "first-of-type:rounded-t-lg last-of-type:rounded-b-lg", "disabled:opacity-40 disabled:cursor-not-allowed", highlight);
11
+ const MenuContext = createContext({
12
+ activeIndex: null,
13
+ getItemProps: () => ({}),
14
+ isOpen: false,
15
+ setActiveIndex: () => { },
16
+ setHasFocusInside: () => { },
17
+ });
18
+ const MenuComponent = React.forwardRef((_a, forwardedRef) => {
19
+ var { children, FloatingComponent = "div", hover = true, isParent, floatingClassName = "", label } = _a, props = __rest(_a, ["children", "FloatingComponent", "hover", "isParent", "floatingClassName", "label"]);
20
+ const parentId = useFloatingParentNodeId();
21
+ const isNested = parentId !== null;
22
+ const [isOpen, setIsOpen] = useState(false);
23
+ const [hasFocusInside, setHasFocusInside] = useState(false);
24
+ const [activeIndex, setActiveIndex] = useState(null);
25
+ const elementsRef = useRef([]);
26
+ const labelsRef = useRef([]);
27
+ const parent = useContext(MenuContext);
28
+ const tree = useFloatingTree();
29
+ const nodeId = useFloatingNodeId();
30
+ const item = useListItem();
31
+ const { floatingStyles, refs, context } = useFloating({
32
+ nodeId,
33
+ open: isOpen,
34
+ transform: true,
35
+ onOpenChange: setIsOpen,
36
+ whileElementsMounted: autoUpdate,
37
+ placement: isNested ? "right" : "bottom-start",
38
+ strategy: "absolute",
39
+ middleware: [offset({ mainAxis: isNested ? 0 : 4, alignmentAxis: isNested ? -4 : 0 }), flip(), shift()],
40
+ });
41
+ const role = useRole(context, { role: "menu", enabled: true });
42
+ const dismiss = useDismiss(context, { bubbles: true });
43
+ const hoverModule = useHover(context, {
44
+ enabled: hover,
45
+ delay: { open: FLOATING_DELAY },
46
+ handleClose: safePolygon({ blockPointerEvents: true }),
47
+ });
48
+ const click = useClick(context, {
49
+ event: "mousedown",
50
+ toggle: !isNested,
51
+ ignoreMouse: isNested,
52
+ keyboardHandlers: true,
53
+ });
54
+ const listNavigation = useListNavigation(context, {
55
+ loop: true,
56
+ activeIndex,
57
+ virtual: true,
58
+ nested: isNested,
59
+ allowEscape: true,
60
+ listRef: elementsRef,
61
+ scrollItemIntoView: true,
62
+ onNavigate: setActiveIndex,
63
+ });
64
+ const typeahead = useTypeahead(context, {
65
+ activeIndex,
66
+ listRef: labelsRef,
67
+ resetMs: TYPEAHEAD_RESET_DELAY,
68
+ onMatch: isOpen ? setActiveIndex : undefined,
69
+ });
70
+ const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([hoverModule, click, role, dismiss, listNavigation, typeahead]);
71
+ useEffect(() => {
72
+ if (!tree)
73
+ return;
74
+ const handleTreeClick = () => setIsOpen(false);
75
+ const onSubMenuOpen = (event) => {
76
+ if (event.nodeId !== nodeId && event.parentId === parentId) {
77
+ setIsOpen(false);
78
+ }
79
+ };
80
+ tree.events.on("click", handleTreeClick);
81
+ tree.events.on("menuopen", onSubMenuOpen);
82
+ return () => {
83
+ tree.events.off("click", handleTreeClick);
84
+ tree.events.off("menuopen", onSubMenuOpen);
85
+ };
86
+ }, [tree, nodeId, parentId]);
87
+ useEffect(() => {
88
+ if (isOpen && tree)
89
+ tree.events.emit("menuopen", { parentId, nodeId });
90
+ }, [tree, isOpen, nodeId, parentId]);
91
+ const className = isParent ? props.className : css(menuItemClassName(props.className));
92
+ return (_jsxs(FloatingNode, { id: nodeId, children: [_jsx(Fragment, { children: props.asChild ? (_jsx(Slot, Object.assign({ children: label, ref: useMergeRefs([refs.setReference, item.ref, forwardedRef]), tabIndex: !isNested ? undefined : parent.activeIndex === item.index ? 0 : -1, "data-open": isOpen ? "" : undefined, "data-nested": isNested ? "" : undefined, role: isNested ? "menuitem" : undefined, "data-focus-inside": hasFocusInside ? "" : undefined, className: className }, getReferenceProps(parent.getItemProps(Object.assign(Object.assign({}, props), { onFocus(event) {
93
+ var _a;
94
+ (_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, event);
95
+ setHasFocusInside(false);
96
+ parent.setHasFocusInside(true);
97
+ } })))))) : (_jsxs("button", Object.assign({ type: "button", ref: useMergeRefs([refs.setReference, item.ref, forwardedRef]), tabIndex: !isNested ? undefined : parent.activeIndex === item.index ? 0 : -1, "data-open": isOpen ? "" : undefined, "data-nested": isNested ? "" : undefined, role: isNested ? "menuitem" : undefined, "data-focus-inside": hasFocusInside ? "" : undefined, className: className }, getReferenceProps(parent.getItemProps(Object.assign(Object.assign({}, props), { onFocus(event) {
98
+ var _a;
99
+ (_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, event);
100
+ setHasFocusInside(false);
101
+ parent.setHasFocusInside(true);
102
+ } }))), { children: [label, isNested && (_jsxs("span", { style: { marginLeft: 10, fontSize: 10 }, children: [_jsx("span", { className: "sr-only", children: "Next menu" }), _jsx(ChevronRightIcon, { size: 14 })] }))] }))) }), _jsx(MenuContext.Provider, { value: { activeIndex, setActiveIndex, getItemProps, setHasFocusInside, isOpen }, children: _jsx(FloatingList, { elementsRef: elementsRef, labelsRef: labelsRef, children: isOpen && (_jsx(FloatingPortal, { preserveTabOrder: true, children: _jsx(FloatingFocusManager, { context: context, modal: false, initialFocus: isNested ? -1 : 0, returnFocus: !isNested, children: _jsx(FloatingComponent, Object.assign({}, getFloatingProps(), { ref: refs.setFloating, style: Object.assign(Object.assign({}, props.style), floatingStyles), className: css("isolate z-tooltip flex flex-col items-start rounded-lg border border-floating-border bg-floating-background text-left shadow-xl outline-none", floatingClassName), children: children })) }) })) }) })] }));
103
+ });
104
+ export const MenuItem = React.forwardRef((_a, forwardedRef) => {
105
+ var { label, title, Right, disabled } = _a, props = __rest(_a, ["label", "title", "Right", "disabled"]);
106
+ const menu = useContext(MenuContext);
107
+ const item = useListItem({ label: disabled ? null : typeof label === "string" ? label : title });
108
+ const tree = useFloatingTree();
109
+ const isActive = item.index === menu.activeIndex;
110
+ return (_jsxs("button", Object.assign({}, props, { ref: useMergeRefs([item.ref, forwardedRef]), "data-active": isActive, type: "button", role: "menuitem", disabled: disabled, tabIndex: isActive ? 0 : -1, className: menuItemClassName(props.className) }, menu.getItemProps({
111
+ onClick(event) {
112
+ var _a;
113
+ (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, event);
114
+ tree === null || tree === void 0 ? void 0 : tree.events.emit("click");
115
+ },
116
+ onFocus(event) {
117
+ var _a;
118
+ (_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, event);
119
+ menu.setHasFocusInside(true);
120
+ },
121
+ }), { children: [label, Right ? _jsx(Right, { size: 16 }) : null] })));
122
+ });
123
+ export const Menu = React.forwardRef((props, ref) => {
124
+ const parentId = useFloatingParentNodeId();
125
+ return parentId !== null ? (_jsx(MenuComponent, Object.assign({}, props, { isParent: false, ref: ref }))) : (_jsx(FloatingTree, { children: _jsx(MenuComponent, Object.assign({}, props, { isParent: true, ref: ref })) }));
126
+ });
@@ -0,0 +1,19 @@
1
+ import React, { PropsWithChildren } from "react";
2
+ import { Label } from "../../types";
3
+ export type ModalProps = {
4
+ layoutId?: string;
5
+ title?: Label;
6
+ open: boolean;
7
+ footer?: Label;
8
+ resizer?: boolean;
9
+ asChild?: boolean;
10
+ closable?: boolean;
11
+ overlayClickClose?: boolean;
12
+ position?: "left" | "right";
13
+ trigger?: Label | React.FC<any>;
14
+ forceType?: boolean;
15
+ type?: "dialog" | "drawer" | "sheet";
16
+ onChange: (nextState: boolean) => void;
17
+ };
18
+ export declare const Modal: ({ type: _type, resizer, overlayClickClose, forceType, closable, ...props }: PropsWithChildren<ModalProps>) => import("react/jsx-runtime").JSX.Element;
19
+ //# sourceMappingURL=modal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../../src/components/floating/modal.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,EAAY,iBAAiB,EAAS,MAAM,OAAO,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AA2DpC,MAAM,MAAM,UAAU,GAAG;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CAAC;AAoEF,eAAO,MAAM,KAAK,+EAOf,iBAAiB,CAAC,UAAU,CAAC,4CAsG/B,CAAC"}
@@ -0,0 +1,102 @@
1
+ "use client";
2
+ import { __rest } from "tslib";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { FloatingFocusManager, FloatingOverlay, FloatingPortal, useClick, useDismiss, useFloating, useInteractions, useRole, } from "@floating-ui/react";
5
+ import { Slot } from "@radix-ui/react-slot";
6
+ import { cva } from "class-variance-authority";
7
+ import { AnimatePresence, motion, useMotionValue } from "framer-motion";
8
+ import { XIcon } from "lucide-react";
9
+ import { Fragment, useId } from "react";
10
+ import { useMediaQuery } from "../../hooks/use-media-query";
11
+ import { css } from "../../lib/dom";
12
+ const animationDuration = "600ms";
13
+ const drawerLeft = {
14
+ initial: { translateX: ["-30%", "0%"], opacity: 0.8, animationDuration },
15
+ enter: { translateX: ["-30%", "0%"], opacity: 1, animationDuration },
16
+ exit: { translateX: ["0%", "-30%"], opacity: 0, animationDuration },
17
+ };
18
+ const drawerRight = {
19
+ initial: { translateX: ["30%", "0%"], opacity: 0.8 },
20
+ enter: { translateX: "0%", opacity: 1, animationDuration },
21
+ exit: { translateX: ["0%", "30%"], opacity: 0, animationDuration },
22
+ };
23
+ const animations = {
24
+ drawer: (type) => (type === "left" ? drawerLeft : drawerRight),
25
+ sheet: {
26
+ initial: { opacity: 0.5, translateY: "25%", animationDuration, originY: "bottom" },
27
+ enter: { opacity: 1, translateY: "0%", animationDuration, originY: "bottom" },
28
+ exit: { opacity: 0.1, translateY: "50%", animationDuration, originY: "bottom" },
29
+ },
30
+ dialog: {
31
+ initial: { opacity: 0, scale: 0.95, animationDuration },
32
+ enter: { opacity: 1, scale: [1.05, 1], animationDuration },
33
+ exit: { opacity: 0, scale: 0.97, animationDuration },
34
+ },
35
+ };
36
+ const variants = cva("isolate z-floating border border-card-border ring-0 outline-0 appearance-none flex flex-col gap-4 flex-nowrap min-w-xs bg-floating-background", {
37
+ variants: {
38
+ type: {
39
+ drawer: "max-h-screen max-w-[90%] absolute w-fit h-screen min-h-0",
40
+ dialog: "max-h-[calc(100lvh-10%)] relative container h-min rounded-lg py-4",
41
+ sheet: "w-screen absolute bottom-0 h-[85vh] max-h-[85vh] max-h-[85svh] pt-6 pb-4 rounded-t-lg",
42
+ },
43
+ position: {
44
+ none: "",
45
+ right: "py-4 absolute right-0 top-0 rounded-l-lg",
46
+ left: "py-4 absolute left-0 top-0 rounded-r-lg",
47
+ },
48
+ },
49
+ defaultVariants: { position: "right", type: "dialog" },
50
+ });
51
+ const dragConstraints = { top: 0, left: 0, right: 0, bottom: -1 };
52
+ const calculateClose = (n) => n * 0.62;
53
+ const Draggable = (props) => {
54
+ const onDrag = (_, info) => {
55
+ if (props.parent.current) {
56
+ if (!props.sheet) {
57
+ const div = props.parent.current;
58
+ const v = props.value.get() || div.getBoundingClientRect().width;
59
+ const delta = props.position === "right" ? -info.delta.x : info.delta.x;
60
+ return props.value.set(Math.abs(v + delta));
61
+ }
62
+ const div = props.parent.current;
63
+ const rect = div.getBoundingClientRect();
64
+ const v = props.value.get() || rect.height;
65
+ const result = Math.abs(v - info.delta.y);
66
+ const screenHeightToClose = calculateClose(window.outerHeight);
67
+ if (result < screenHeightToClose) {
68
+ props.onChange(false);
69
+ return setTimeout(() => props.value.set(window.outerHeight), 350);
70
+ }
71
+ return props.value.set(result);
72
+ }
73
+ };
74
+ return (_jsx(motion.div, { draggable: true, dragMomentum: true, dragListener: true, dragPropagation: true, onDrag: onDrag, animate: false, initial: false, dragElastic: 0, dragDirectionLock: true, dragSnapToOrigin: true, drag: props.sheet ? "y" : "x", dragConstraints: dragConstraints, whileDrag: { cursor: "grabbing" }, className: css("absolute rounded-lg", props.sheet ? "cursor-row-resize" : "cursor-col-resize bg-floating-border", props.sheet
75
+ ? "top-1 flex h-3 w-full justify-center py-2"
76
+ : props.position === "left"
77
+ ? "right-5 top-1/2 h-10 w-2"
78
+ : "left-2 top-1/2 h-10 w-2"), children: props.sheet ? _jsx("div", { className: "h-2 w-1/4 rounded-lg bg-floating-border" }) : null }));
79
+ };
80
+ const positions = { drawer: "right", sheet: "none", dialog: "none" };
81
+ export const Modal = (_a) => {
82
+ var { type: _type = "dialog", resizer = true, overlayClickClose = false, forceType = false, closable = true } = _a, props = __rest(_a, ["type", "resizer", "overlayClickClose", "forceType", "closable"]);
83
+ const headingId = useId();
84
+ const descriptionId = useId();
85
+ const isDesktop = useMediaQuery("(min-width: 64rem)");
86
+ const useResizer = _type !== "dialog";
87
+ const position = isDesktop ? (_type === "drawer" ? props.position : positions[_type]) : forceType ? positions[_type] : positions.sheet;
88
+ const func = isDesktop ? animations[_type] : forceType ? animations[_type] : animations.sheet;
89
+ const animation = typeof func === "function" ? func(position) : func;
90
+ const type = isDesktop ? _type : forceType ? _type : "sheet";
91
+ const { refs, context } = useFloating({ open: props.open, onOpenChange: props.onChange });
92
+ const click = useClick(context);
93
+ const role = useRole(context);
94
+ const dismiss = useDismiss(context, { escapeKey: true, referencePress: true, outsidePress: overlayClickClose });
95
+ const { getReferenceProps, getFloatingProps } = useInteractions([click, role, dismiss]);
96
+ const Trigger = props.trigger;
97
+ const value = useMotionValue(undefined);
98
+ const onClose = () => props.onChange(false);
99
+ return (_jsxs(Fragment, { children: [props.trigger ? (_jsx(Fragment, { children: props.asChild ? (_jsx(Slot, Object.assign({ ref: refs.setReference }, getReferenceProps({
100
+ layoutId: props.layoutId,
101
+ }), { children: Trigger }))) : (_jsx(motion.button, Object.assign({ ref: refs.setReference }, getReferenceProps(), { layoutId: props.layoutId, type: "button", children: Trigger }))) })) : null, _jsx(FloatingPortal, { children: _jsx(AnimatePresence, { presenceAffectsLayout: true, children: props.open ? (_jsx(FloatingOverlay, { lockScroll: true, className: `inset-0 isolate z-overlay h-[100dvh] !overflow-clip bg-floating-overlay/70 ${type === "drawer" ? "" : "grid items-end justify-center lg:items-center"}`, children: _jsx(FloatingFocusManager, { visuallyHiddenDismiss: true, modal: true, closeOnFocusOut: true, context: context, children: _jsxs(motion.div, Object.assign({ animate: "enter", "aria-describedby": descriptionId, "aria-labelledby": headingId, className: variants({ position, type }), exit: "exit", layoutId: props.layoutId, initial: "initial", ref: refs.setFloating, style: type === "drawer" ? { width: value } : { height: value }, variants: animation }, getFloatingProps(), { children: [props.title ? (_jsx("header", { className: "relative w-full", children: props.title ? (_jsx("h2", { className: "border-b border-floating-border px-8 pb-2 text-3xl font-medium leading-relaxed", children: props.title })) : null })) : null, _jsx("section", { className: "flex-1 overflow-y-auto px-8 py-1", children: props.children }), props.footer ? (_jsx("footer", { className: "w-full border-t border-floating-border px-8 pt-4", children: props.footer })) : null, closable ? (_jsx("nav", { className: "absolute right-4 top-1 z-floating", children: _jsx("button", { type: "button", onClick: onClose, className: "p-1 opacity-70 transition-colors hover:text-danger hover:opacity-100 focus:text-danger", children: _jsx(XIcon, {}) }) })) : null, useResizer && resizer ? (_jsx(Draggable, { onChange: props.onChange, parent: refs.floating, position: position, sheet: type === "sheet", value: value })) : null] })) }) })) : null }) })] }));
102
+ };
@@ -0,0 +1,6 @@
1
+ import { PropsWithChildren } from "react";
2
+ export type ToolbarProps = {
3
+ root?: HTMLElement;
4
+ };
5
+ export declare const Toolbar: (props: PropsWithChildren<ToolbarProps>) => import("react/jsx-runtime").JSX.Element;
6
+ //# sourceMappingURL=toolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolbar.d.ts","sourceRoot":"","sources":["../../../../src/components/floating/toolbar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,MAAM,YAAY,GAAG;IACvB,IAAI,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,OAAO,UAAW,iBAAiB,CAAC,YAAY,CAAC,4CAI7D,CAAC"}
@@ -0,0 +1,4 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { motion } from "framer-motion";
4
+ export const Toolbar = (props) => (_jsx(motion.div, { className: "sticky bottom-4 flex items-center justify-center rounded-lg border border-card-border bg-background p-4", children: props.children }));
@@ -0,0 +1,12 @@
1
+ import { type Placement } from "@floating-ui/react";
2
+ import React from "react";
3
+ import { PolymorphicProps } from "../../components/core/polymorph";
4
+ import { ComponentLike, Label, Override } from "../../types";
5
+ export type TooltipProps<T extends ComponentLike = "span"> = Override<PolymorphicProps<React.ComponentProps<T>, T>, {
6
+ title: Label;
7
+ enabled?: boolean;
8
+ placement?: Placement;
9
+ followCursor?: boolean;
10
+ }>;
11
+ export declare const Tooltip: <T extends ComponentLike = "span">({ children, followCursor, placement, enabled, as, title, ...props }: TooltipProps<T>) => import("react/jsx-runtime").JSX.Element;
12
+ //# sourceMappingURL=tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/floating/tooltip.tsx"],"names":[],"mappings":"AACA,OAAO,EAOH,KAAK,SAAS,EASjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAqC,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAa,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAE9E,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE7D,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,aAAa,GAAG,MAAM,IAAI,QAAQ,CACjE,gBAAgB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAC5C;IACI,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B,CACJ,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,aAAa,gFAAwF,YAAY,CAAC,CAAC,CAAC,4CAuCrJ,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { __rest } from "tslib";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { arrow, autoUpdate, flip, FloatingArrow, FloatingPortal, offset, shift, useClientPoint, useDismiss, useFloating, useFocus, useHover, useInteractions, useRole, } from "@floating-ui/react";
5
+ import { Fragment, useRef, useState } from "react";
6
+ import { Polymorph } from "../../components/core/polymorph";
7
+ import { FLOATING_DELAY } from "../../constants";
8
+ export const Tooltip = (_a) => {
9
+ var { children, followCursor = false, placement, enabled, as, title } = _a, props = __rest(_a, ["children", "followCursor", "placement", "enabled", "as", "title"]);
10
+ const [open, setOpen] = useState(false);
11
+ const arrowRef = useRef(null);
12
+ const Component = as || "span";
13
+ const { refs, floatingStyles, context } = useFloating({
14
+ open,
15
+ placement,
16
+ transform: true,
17
+ onOpenChange: setOpen,
18
+ whileElementsMounted: autoUpdate,
19
+ middleware: [offset(5), flip({ fallbackAxisSideDirection: "start" }), shift(), arrow({ element: arrowRef, padding: 5 })],
20
+ });
21
+ const hover = useHover(context, { move: true, enabled, delay: { open: FLOATING_DELAY } });
22
+ const focus = useFocus(context, { enabled });
23
+ const dismiss = useDismiss(context, { enabled });
24
+ const role = useRole(context, { role: "tooltip", enabled });
25
+ const clientPoint = useClientPoint(context, { enabled: !!enabled && !!followCursor });
26
+ const { getReferenceProps, getFloatingProps } = useInteractions([hover, focus, dismiss, role, clientPoint]);
27
+ return (_jsxs(Fragment, { children: [_jsx(Component, Object.assign({ ref: refs.setReference }, getReferenceProps(props), { children: title })), _jsx(FloatingPortal, { children: open && (_jsxs(Polymorph, Object.assign({}, getFloatingProps(), { ref: refs.setFloating, style: floatingStyles, className: "z-tooltip rounded-lg border border-tooltip-border bg-tooltip-background p-3 text-tooltip-foreground shadow-lg", children: [_jsx(FloatingArrow, { ref: arrowRef, context: context, strokeWidth: 0.1, className: "fill-tooltip-background stroke-tooltip-border" }), children] }))) })] }));
28
+ };
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { InputFieldProps } from "./input-field";
3
+ import { type OptionProps } from "./select";
4
+ type ItemProps = Omit<React.HTMLProps<HTMLLIElement>, "children"> & {
5
+ selected: boolean;
6
+ active: boolean;
7
+ option: OptionProps;
8
+ };
9
+ export declare const Option: React.ForwardRefExoticComponent<Omit<ItemProps, "ref"> & React.RefAttributes<HTMLLIElement>>;
10
+ export type AutocompleteProps = Omit<InputFieldProps<"input">, "value"> & {
11
+ value?: string;
12
+ options: OptionProps[];
13
+ dynamicOption?: boolean;
14
+ };
15
+ export declare const Autocomplete: React.ForwardRefExoticComponent<Omit<AutocompleteProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
16
+ export {};
17
+ //# sourceMappingURL=autocomplete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../../src/components/form/autocomplete.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAIvE,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,KAAK,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC,GAAG;IAChE,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,MAAM,8FAmBjB,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAaF,eAAO,MAAM,YAAY,yGAmPxB,CAAC"}
@@ -0,0 +1,152 @@
1
+ "use client";
2
+ import { __rest } from "tslib";
3
+ import { createElement as _createElement } from "react";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ import { autoUpdate, FloatingFocusManager, FloatingPortal, offset, size, useDismiss, useFloating, useInteractions, useListNavigation, useRole, useTransitionStyles, } from "@floating-ui/react";
6
+ import Fuzzy from "fuzzy-search";
7
+ import { CheckIcon, ChevronDown } from "lucide-react";
8
+ import { forwardRef, useEffect, useRef, useState } from "react";
9
+ import { useTranslations } from "../../hooks/use-translate-context";
10
+ import { css, dispatchInput, initializeInputDataset } from "../../lib/dom";
11
+ import { safeRegex } from "../../lib/fns";
12
+ import { InputField } from "./input-field";
13
+ export const Option = forwardRef((_a, ref) => {
14
+ var _b;
15
+ var { selected, active, onClick, option } = _a, rest = __rest(_a, ["selected", "active", "onClick", "option"]);
16
+ return (_jsx("li", Object.assign({}, rest, { ref: ref, role: "option", "aria-selected": active, className: "w-full border-b border-tooltip-border last:border-transparent", children: _jsxs("button", { type: "button", "data-value": option.value, onClick: onClick, "aria-selected": active, "aria-checked": active, "aria-current": active, className: `flex w-full cursor-pointer justify-between p-2 text-left ${active ? "bg-primary text-primary-foreground" : ""} ${selected ? "bg-primary/70 text-primary-foreground" : ""}`, children: [(_b = option.label) !== null && _b !== void 0 ? _b : option.value, active ? (_jsx("span", { children: _jsx(CheckIcon, { "aria-hidden": true, className: "text-current", absoluteStrokeWidth: true, strokeWidth: 2, size: 22 }) })) : null] }) })));
17
+ });
18
+ const transitionStyles = {
19
+ duration: 300,
20
+ initial: { transform: "scaleY(0)", opacity: 0.4 },
21
+ open: { transform: "scaleY(1)", opacity: 1 },
22
+ close: { transform: "scaleY(0)", opacity: 0 },
23
+ };
24
+ const fuzzyOptions = { caseSensitive: false, sort: false };
25
+ const emptyRef = [];
26
+ export const Autocomplete = forwardRef((_a, externalRef) => {
27
+ var _b, _c, _d, _e;
28
+ var { options, dynamicOption = false, feedback = null, labelClassName, interactive, rightLabel, optionalText, container, hideLeft = false, right, left, error, required = false } = _a, props = __rest(_a, ["options", "dynamicOption", "feedback", "labelClassName", "interactive", "rightLabel", "optionalText", "container", "hideLeft", "right", "left", "error", "required"]);
29
+ const translation = useTranslations();
30
+ const ref = useRef(null);
31
+ const [open, setOpen] = useState(false);
32
+ const [shadow, setShadow] = useState("");
33
+ const [value, setValue] = useState((_c = (_b = props.value) !== null && _b !== void 0 ? _b : props.defaultValue) !== null && _c !== void 0 ? _c : "");
34
+ const [label, setLabel] = useState((_e = (_d = props.value) !== null && _d !== void 0 ? _d : props.defaultValue) !== null && _e !== void 0 ? _e : "");
35
+ const [index, setIndex] = useState(null);
36
+ const listRef = useRef(emptyRef);
37
+ const innerOptions = dynamicOption && shadow !== "" ? [{ value: shadow, label: shadow, "data-dynamic": "true" }, ...options] : options;
38
+ const list = new Fuzzy(innerOptions, ["value", "label"], fuzzyOptions).search(shadow);
39
+ const pattern = dynamicOption
40
+ ? undefined
41
+ : `^(${options.map((x) => `${safeRegex(x.value)}${x.label ? "|" + safeRegex(x.label) : ""}`).join("|")})$`;
42
+ useEffect(() => {
43
+ const input = refs.reference.current;
44
+ if (!input)
45
+ return;
46
+ return initializeInputDataset(input);
47
+ }, []);
48
+ useEffect(() => {
49
+ var _a;
50
+ if (props.value) {
51
+ const item = options.find((x) => x.value === props.value);
52
+ setValue((_a = item === null || item === void 0 ? void 0 : item.label) !== null && _a !== void 0 ? _a : props.value);
53
+ }
54
+ }, [props.value]);
55
+ const { x, y, strategy, refs, context } = useFloating({
56
+ open,
57
+ transform: true,
58
+ onOpenChange: setOpen,
59
+ whileElementsMounted: autoUpdate,
60
+ middleware: [
61
+ offset(4),
62
+ size({
63
+ padding: 10,
64
+ apply(a) {
65
+ Object.assign(a.elements.floating.style, {
66
+ width: `${a.rects.reference.width}px`,
67
+ maxHeight: `${Math.min(480, a.availableHeight)}px`,
68
+ });
69
+ },
70
+ }),
71
+ ],
72
+ });
73
+ const transitions = useTransitionStyles(context, transitionStyles);
74
+ const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([
75
+ useRole(context, { role: "listbox" }),
76
+ useDismiss(context),
77
+ useListNavigation(context, {
78
+ activeIndex: index,
79
+ allowEscape: true,
80
+ cols: 0,
81
+ focusItemOnOpen: "auto",
82
+ listRef,
83
+ loop: true,
84
+ openOnArrowKeyDown: true,
85
+ scrollItemIntoView: true,
86
+ selectedIndex: index,
87
+ virtual: true,
88
+ onNavigate: (n) => setIndex((prev) => n !== null && n !== void 0 ? n : prev),
89
+ }),
90
+ ]);
91
+ const onSelect = (opt, i) => {
92
+ var _a, _b, _c;
93
+ setValue(opt.value);
94
+ (_a = refs.reference.current) === null || _a === void 0 ? void 0 : _a.setAttribute("data-value", opt.value);
95
+ setLabel((_b = opt.label) !== null && _b !== void 0 ? _b : "");
96
+ const fakeEvent = dispatchInput(ref.current, opt.value);
97
+ if (fakeEvent)
98
+ (_c = props.onChange) === null || _c === void 0 ? void 0 : _c.call(props, fakeEvent);
99
+ setOpen(false);
100
+ setShadow("");
101
+ setIndex(i);
102
+ };
103
+ const onChange = (event) => {
104
+ var _a;
105
+ const value = event.target.value;
106
+ setShadow(value);
107
+ if (!open && value === "")
108
+ return setOpen(true);
109
+ event.target.name = props.name || "";
110
+ return value ? setOpen(true) : (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, event);
111
+ };
112
+ const onFocus = () => {
113
+ setOpen(true);
114
+ setShadow("");
115
+ };
116
+ const onClose = () => {
117
+ var _a;
118
+ setShadow("");
119
+ setValue("");
120
+ (_a = refs.reference.current) === null || _a === void 0 ? void 0 : _a.setAttribute("data-value", "");
121
+ setLabel("");
122
+ dispatchInput(refs.reference.current, "");
123
+ setOpen(false);
124
+ };
125
+ const id = props.id || props.name;
126
+ return (_jsxs(InputField, Object.assign({}, props, { container: css("group inline-block w-full", container), error: error, feedback: feedback, form: props.form, hideLeft: hideLeft, id: props.name || props.id, interactive: interactive, labelClassName: labelClassName, left: left, name: props.name, optionalText: optionalText, placeholder: props.placeholder, required: required, rightLabel: rightLabel, title: props.title, right: _jsxs("span", { className: "flex items-center gap-0.5", children: [_jsxs("button", { type: "button", className: "transition-colors link:text-primary", children: [_jsx(ChevronDown, { size: 20 }), _jsx("span", { className: "sr-only", children: translation.inputCaretDown })] }), value ? (_jsx("button", { type: "button", onClick: onClose, className: "transition-colors link:text-danger", children: _jsx("svg", { width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z", fill: "currentColor", fillRule: "evenodd", clipRule: "evenodd" }) }) })) : null] }), children: [_jsx("input", Object.assign({}, getReferenceProps(Object.assign(Object.assign({}, props), { onChange,
127
+ onFocus,
128
+ pattern, ref: refs.setReference, name: `${id}-shadow`, id: `${id}-shadow`, onClick: (e) => e.currentTarget.focus(), onKeyDown(event) {
129
+ if (event.key === "Escape") {
130
+ event.currentTarget.blur();
131
+ return setOpen(false);
132
+ }
133
+ if (event.key === "Enter") {
134
+ if (index !== null && list[index]) {
135
+ event.preventDefault();
136
+ return onSelect(list[index], index);
137
+ }
138
+ if (list.length === 1) {
139
+ event.preventDefault();
140
+ return onSelect(list[0], 0);
141
+ }
142
+ }
143
+ } })), { "data-value": value, "data-error": !!error, "data-name": id, "data-target": id, required: required, value: open ? shadow : label || value, "aria-autocomplete": "list", autoComplete: "off", className: css("input placeholder-input-mask group h-10 w-full flex-1 rounded-md bg-transparent px-2 py-1 text-base text-foreground outline-none transition-colors group-error:text-danger group-error:placeholder-input-mask-error", !!right || shadow ? "pe-12" : "", !!left ? "ps-8" : "", props.className) })), _jsx("input", { id: id, name: id, type: "hidden", "data-origin": id, ref: externalRef, required: required, defaultValue: props.value || value || undefined }), _jsx(FloatingPortal, { preserveTabOrder: true, children: open ? (_jsx(FloatingFocusManager, { guards: true, returnFocus: false, context: context, initialFocus: -1, visuallyHiddenDismiss: true, children: _jsx("ul", Object.assign({}, getFloatingProps({
144
+ ref: refs.setFloating,
145
+ style: Object.assign({ position: strategy, left: x !== null && x !== void 0 ? x : 0, top: y !== null && y !== void 0 ? y : 0 }, transitions.styles),
146
+ }), { "data-floating": "true", className: "z-floating m-0 origin-[top_center] list-none overflow-auto overflow-y-auto rounded-b-lg rounded-t-lg border border-floating-border bg-floating-background p-0 text-foreground shadow-floating", children: list.map((option, i) => (_createElement(Option, Object.assign({}, getItemProps({
147
+ onClick: () => onSelect(option, i),
148
+ ref: (node) => void (listRef.current[i] = node),
149
+ selected: index === i,
150
+ active: value === option.value,
151
+ }), { key: `${option.value}-option`, option: option, selected: index === i, active: value === option.value })))) })) })) : null })] })));
152
+ });
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { Override } from "../../types";
3
+ export type CheckboxProps = Override<React.PropsWithChildren<React.ComponentProps<"input">>, {
4
+ error?: string;
5
+ asTask?: boolean;
6
+ container?: string;
7
+ labelClassName?: string;
8
+ size?: "medium" | "large";
9
+ }>;
10
+ export declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
11
+ //# sourceMappingURL=checkbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/form/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,MAAM,aAAa,GAAG,QAAQ,CAChC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EACtD;IACI,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC7B,CACJ,CAAC;AAEF,eAAO,MAAM,QAAQ,qGA4BpB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { __rest } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { forwardRef } from "react";
4
+ import { css } from "../../lib/dom";
5
+ export const Checkbox = forwardRef((_a, ref) => {
6
+ var { children, asTask = false, labelClassName, error, className = "", size, container } = _a, props = __rest(_a, ["children", "asTask", "labelClassName", "error", "className", "size", "container"]);
7
+ return (_jsxs("label", { "data-task": asTask, "data-disabled": props.disabled, "aria-disabled": props.disabled, className: css("group flex w-fit flex-wrap items-center font-normal data-[disabled=true]:cursor-not-allowed", asTask ? "group-checkbox-checked:line-through" : "", container), children: [_jsx("input", Object.assign({}, props, { ref: ref, type: "checkbox", "data-task": asTask, className: css("form-checkbox mr-2 inline-block size-4 appearance-none rounded border-card-border bg-origin-border text-primary focus:ring-primary disabled:opacity-70 group-aria-disabled:cursor-not-allowed", className) })), children, _jsx("span", { "data-name": "checkbox-label", className: css("min-w-full flex-1 text-xs text-danger empty:mt-0 empty:hidden", labelClassName), children: error })] }));
8
+ });
@@ -0,0 +1,61 @@
1
+ import React from "react";
2
+ import { Override } from "../../types";
3
+ import { CalendarProps } from "../display/calendar";
4
+ import { InputProps } from "./input";
5
+ export type DatePickerProps = Override<InputProps, CalendarProps<"date">>;
6
+ export declare const DatePicker: React.ForwardRefExoticComponent<(Omit<Omit<InputProps, "onChange" | "date" | "locale" | "markToday" | "rangeMode" | "changeOnlyOnClick" | "onChangeMonth" | "onChangeYear" | "RenderOnDay" | "disabledDate" | "styles"> & Partial<{
7
+ locale: import("the-mask-input").Locales;
8
+ markToday: boolean;
9
+ rangeMode: boolean;
10
+ changeOnlyOnClick: boolean;
11
+ onChangeMonth: (d: Date) => void;
12
+ onChangeYear: (d: Date) => void;
13
+ RenderOnDay: React.FC<{
14
+ date: Date;
15
+ }>;
16
+ disabledDate: (date: Date) => boolean;
17
+ styles: Partial<{
18
+ day: string;
19
+ week: string;
20
+ weekDay: string;
21
+ dayFrame: string;
22
+ calendar: string;
23
+ }>;
24
+ } & {
25
+ date: Date;
26
+ onChange: (d: Date | undefined) => void;
27
+ } & {
28
+ date: Date;
29
+ onChange: (d: Date | undefined) => void;
30
+ }>, "ref"> | Omit<Omit<InputProps, "onChange" | "date" | "locale" | "markToday" | "rangeMode" | "changeOnlyOnClick" | "onChangeMonth" | "onChangeYear" | "RenderOnDay" | "disabledDate" | "styles"> & Partial<{
31
+ locale: import("the-mask-input").Locales;
32
+ markToday: boolean;
33
+ rangeMode: boolean;
34
+ changeOnlyOnClick: boolean;
35
+ onChangeMonth: (d: Date) => void;
36
+ onChangeYear: (d: Date) => void;
37
+ RenderOnDay: React.FC<{
38
+ date: Date;
39
+ }>;
40
+ disabledDate: (date: Date) => boolean;
41
+ styles: Partial<{
42
+ day: string;
43
+ week: string;
44
+ weekDay: string;
45
+ dayFrame: string;
46
+ calendar: string;
47
+ }>;
48
+ } & {
49
+ date: Date;
50
+ onChange: (d: Date | undefined) => void;
51
+ } & {
52
+ range: {
53
+ from?: Date;
54
+ to?: Date;
55
+ };
56
+ onChange: (d: {
57
+ from?: Date;
58
+ to?: Date;
59
+ } | undefined) => void;
60
+ }>, "ref">) & React.RefAttributes<HTMLInputElement>>;
61
+ //# sourceMappingURL=date-picker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../../src/components/form/date-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAG9E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAY,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAS,UAAU,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AAmC1E,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAyGtB,CAAC"}