@g4rcez/components 0.0.38 → 0.0.40

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 +146 -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,78 @@
1
+ import { __rest } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { format, isValid, parse, startOfDay } from "date-fns";
4
+ import { CalendarIcon } from "lucide-react";
5
+ import { forwardRef, Fragment, useId, useMemo, useState } from "react";
6
+ import { Is } from "sidekicker";
7
+ import { useTranslations } from "../../hooks/use-translate-context";
8
+ import { Calendar } from "../display/calendar";
9
+ import { Dropdown } from "../floating/dropdown";
10
+ import { Input } from "./input";
11
+ const fixedDate = new Date(1970, 11, 31);
12
+ const parts = {
13
+ year: () => [/\d/, /\d/, /\d/, /\d/],
14
+ month: () => [/\d/, /\d/],
15
+ day: () => [/\d/, /\d/],
16
+ literal: (str) => str.split(""),
17
+ };
18
+ const placeholders = {
19
+ year: () => "yyyy",
20
+ month: () => "MM",
21
+ day: () => "dd",
22
+ literal: (str) => str,
23
+ };
24
+ const partValues = {
25
+ literal: (date, str) => str,
26
+ year: (date) => date.getFullYear(),
27
+ day: (date) => date.getDate().toString().padStart(2, "0"),
28
+ month: (date) => (date.getMonth() + 1).toString().padStart(2, "0"),
29
+ };
30
+ const formatParts = (datetimeFormat, date) => {
31
+ try {
32
+ return datetimeFormat.formatToParts(date);
33
+ }
34
+ catch (e) {
35
+ return [];
36
+ }
37
+ };
38
+ export const DatePicker = forwardRef((_a, externalRef) => {
39
+ var _b;
40
+ var { date, locale, disabledDate, onChange, markToday } = _a, props = __rest(_a, ["date", "locale", "disabledDate", "onChange", "markToday"]);
41
+ const labelId = useId();
42
+ const translation = useTranslations();
43
+ const datetimeFormat = useMemo(() => new Intl.DateTimeFormat(locale), [locale]);
44
+ const [innerDate, setInnerDate] = useState(date || undefined);
45
+ const [open, setOpen] = useState(false);
46
+ const mask = formatParts(datetimeFormat, fixedDate).flatMap((x) => (Is.keyof(parts, x.type) ? parts[x.type](x.value) : []));
47
+ const placeholder = formatParts(datetimeFormat, fixedDate).reduce((acc, x) => acc + (Is.keyof(placeholders, x.type) ? placeholders[x.type](x.value) : ""), "");
48
+ const [value, setValue] = useState(!innerDate
49
+ ? ""
50
+ : formatParts(datetimeFormat, innerDate).reduce((acc, x) => acc + (Is.keyof(parts, x.type) ? partValues[x.type](innerDate, x.value) : ""), ""));
51
+ const onChangeDateInput = (e) => {
52
+ const v = e.target.value;
53
+ setValue(v);
54
+ if (mask.length === v.length) {
55
+ const matches = mask.every((x, i) => {
56
+ const c = v.charAt(i);
57
+ return typeof x === "string" ? c === x : x.test(c);
58
+ });
59
+ if (matches) {
60
+ const d = startOfDay(parse(v, placeholder, new Date()));
61
+ setInnerDate(d);
62
+ return onChange === null || onChange === void 0 ? void 0 : onChange(d);
63
+ }
64
+ }
65
+ setInnerDate(undefined);
66
+ return onChange === null || onChange === void 0 ? void 0 : onChange(undefined);
67
+ };
68
+ const onChangeDate = (d) => {
69
+ setInnerDate(d);
70
+ onChange === null || onChange === void 0 ? void 0 : onChange(d);
71
+ if (d)
72
+ return setValue(format(d, placeholder));
73
+ return setValue("");
74
+ };
75
+ const validDate = isValid(innerDate);
76
+ const htmlValue = validDate ? innerDate.toISOString() : undefined;
77
+ return (_jsx(Input, Object.assign({}, props, { mask: mask, value: value, "data-value": htmlValue, "data-target": props.name, className: "uppercase", formNoValidate: !open, placeholder: placeholder, onChange: onChangeDateInput, required: (_b = props.required) !== null && _b !== void 0 ? _b : true, error: open ? undefined : props.error, name: undefined, id: undefined, right: _jsxs(Fragment, { children: [_jsx("input", { "data-origin": props.name, hidden: true, type: "date", id: props.name, ref: externalRef, name: props.name, defaultValue: htmlValue }), _jsx(Dropdown, { open: open, onChange: setOpen, trigger: _jsxs("span", { "aria-labelledby": labelId, children: [_jsx("span", { id: labelId, className: "sr-only", children: translation.datePickerCalendarButtonLabel }), _jsx(CalendarIcon, {})] }), buttonProps: { "aria-describedby": labelId }, children: _jsx(Calendar, Object.assign({}, props, { locale: locale, changeOnlyOnClick: true, markToday: markToday, onChange: onChangeDate, disabledDate: disabledDate, date: validDate ? innerDate : undefined })) })] }) })));
78
+ });
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import { DropzoneProps } from "react-dropzone";
3
+ import { Override } from "sidekicker";
4
+ type Props = Override<React.ComponentProps<"input">, DropzoneProps> & {
5
+ onDeleteFile?: (file: File) => void;
6
+ files?: File[];
7
+ idle?: React.ReactElement;
8
+ onDrop?: (file: File[]) => void;
9
+ };
10
+ export declare const FileUpload: ({ idle, onDeleteFile, onDrop, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
12
+ //# sourceMappingURL=file-upload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-upload.d.ts","sourceRoot":"","sources":["../../../../src/components/form/file-upload.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAe,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,KAAK,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,GAAG;IAClE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACpC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC1B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;CACnC,CAAC;AAmGF,eAAO,MAAM,UAAU,6CAA4D,KAAK,4CAiBvF,CAAC"}
@@ -0,0 +1,62 @@
1
+ "use client";
2
+ import { __rest } from "tslib";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { FileIcon, Trash2Icon, UploadIcon } from "lucide-react";
5
+ import prettyBytes from "pretty-bytes";
6
+ import { Fragment, useEffect, useState } from "react";
7
+ import { useDropzone } from "react-dropzone";
8
+ import { Button } from "../core/button";
9
+ const mime = {
10
+ isImage: (file) => file.type.includes("image"),
11
+ };
12
+ const FileViewer = (props) => {
13
+ const [info, setInfo] = useState({ url: "", type: "", size: "" });
14
+ useEffect(() => {
15
+ if (mime.isImage(props.file)) {
16
+ const url = URL.createObjectURL(props.file);
17
+ setInfo({ url, type: "img", size: prettyBytes(props.file.size) });
18
+ return () => {
19
+ URL.revokeObjectURL(url);
20
+ };
21
+ }
22
+ setInfo({ url: "", type: props.file.type, size: prettyBytes(props.file.size) });
23
+ }, [props.file]);
24
+ if (info.type === "img") {
25
+ return (_jsxs("div", { className: "flex flex-row gap-jade-200 items-center justify-between w-full", children: [_jsxs("header", { className: "flex flex-row gap-jade-200 items-center", children: [_jsx("img", { src: info.url, className: "size-jade-500 rounded-jade-xsmall", alt: `Miniatura do arquivo ${props.file.name}` }), _jsxs("div", { className: "flex flex-col", children: [_jsx("span", { children: props.file.name }), _jsx("span", { children: info.size })] })] }), _jsx(Button, { className: "isolate", type: "button", theme: "raw", onClick: (e) => {
26
+ var _a;
27
+ e.stopPropagation();
28
+ (_a = props.onDeleteFile) === null || _a === void 0 ? void 0 : _a.call(props, props.file);
29
+ }, children: _jsx(Trash2Icon, {}) })] }));
30
+ }
31
+ return (_jsxs("div", { className: "flex flex-row gap-jade-200 items-center justify-between w-full", children: [_jsxs("header", { className: "flex flex-row gap-4 items-center", children: [_jsx(FileIcon, { size: 48 }), _jsxs("div", { className: "flex flex-col text-left justify-start items-start", children: [_jsx("span", { children: props.file.name }), _jsx("span", { children: info.size })] })] }), _jsx(Button, { className: "isolate", type: "button", theme: "raw", onClick: (e) => {
32
+ var _a;
33
+ e.stopPropagation();
34
+ (_a = props.onDeleteFile) === null || _a === void 0 ? void 0 : _a.call(props, props.file);
35
+ }, children: _jsx(Trash2Icon, { className: "text-danger" }) })] }));
36
+ };
37
+ const DefaultViewer = (props) => {
38
+ return (_jsx("ul", { className: "w-full space-y-jade-200", children: props.files.map((file) => {
39
+ return _jsx(FileViewer, { onDeleteFile: props.onDeleteFile, file: file }, file.name);
40
+ }) }));
41
+ };
42
+ const InteractiveArea = (props) => {
43
+ if (props.isDragActive) {
44
+ return _jsx("p", { children: "Solte os arquivos selecionados" });
45
+ }
46
+ if (props.files.length > 0) {
47
+ return _jsx(DefaultViewer, { onDeleteFile: props.onDeleteFile, files: props.files });
48
+ }
49
+ return _jsx(Fragment, { children: props.idle });
50
+ };
51
+ const DefaultIdle = (_jsxs("div", { className: "flex flex-col gap-4 justify-center items-center", children: [_jsx(UploadIcon, { size: 64 }), _jsxs("p", { children: ["You can drag your files or", " ", _jsx("button", { className: "text-primary underline", type: "button", children: "drag to here" })] })] }));
52
+ export const FileUpload = (_a) => {
53
+ var _b, _c;
54
+ var { idle = DefaultIdle, onDeleteFile, onDrop } = _a, props = __rest(_a, ["idle", "onDeleteFile", "onDrop"]);
55
+ const [files, setFiles] = useState([]);
56
+ const drop = (x) => {
57
+ onDrop === null || onDrop === void 0 ? void 0 : onDrop(x);
58
+ setFiles(x);
59
+ };
60
+ const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop: drop });
61
+ return (_jsxs("div", Object.assign({}, getRootProps(), { "data-active": ((_b = props.files) === null || _b === void 0 ? void 0 : _b.length) ? props.files.length > 0 : false, className: "flex text-foreground flex-col items-center justify-center border-2 rounded-lg p-6 border-card-border data-[active=true]:bg-card-background data-[active=true]:border-solid data-[active=false]:border-dashed", children: [_jsx("input", Object.assign({}, getInputProps(props), { name: props.name, id: props.name })), _jsx(InteractiveArea, { onDeleteFile: onDeleteFile, isDragActive: isDragActive, idle: idle, files: (_c = props.files) !== null && _c !== void 0 ? _c : files })] })));
62
+ };
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ export declare const formReset: (form?: HTMLFormElement | null) => void;
3
+ export declare const Form: (props: React.ComponentProps<"form">) => import("react/jsx-runtime").JSX.Element;
4
+ //# sourceMappingURL=form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../src/components/form/form.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,SAAS,UAAW,eAAe,GAAG,IAAI,SAatD,CAAC;AAEF,eAAO,MAAM,IAAI,UAAW,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,4CAOvD,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ const inputFields = ["INPUT", "SELECT"];
4
+ export const formReset = (form) => {
5
+ if (!form)
6
+ return;
7
+ const elements = Array.from(form.elements);
8
+ elements.forEach((field) => {
9
+ if (!inputFields.includes(field.tagName))
10
+ return;
11
+ if (field.tagName === "INPUT") {
12
+ field.value = field.defaultValue;
13
+ }
14
+ if (field.tagName === "SELECT") {
15
+ field.value = "";
16
+ }
17
+ field.setAttribute("data-initialized", "false");
18
+ });
19
+ };
20
+ export const Form = (props) => {
21
+ const onSubmit = (e) => {
22
+ var _a;
23
+ e.persist();
24
+ e.preventDefault();
25
+ (_a = props.onSubmit) === null || _a === void 0 ? void 0 : _a.call(props, e);
26
+ };
27
+ return _jsx("form", Object.assign({}, props, { onSubmit: onSubmit }));
28
+ };
@@ -0,0 +1,30 @@
1
+ import React, { PropsWithChildren } from "react";
2
+ import { Label } from "../../types";
3
+ import { PolymorphicProps } from "../core/polymorph";
4
+ export type FeedbackProps = React.PropsWithChildren<Partial<{
5
+ info: Label;
6
+ title: Label;
7
+ hideLeft?: boolean;
8
+ className?: string;
9
+ placeholder: string;
10
+ reportStatus: boolean;
11
+ }>>;
12
+ export declare const InputFeedback: ({ reportStatus, hideLeft, className, info, children, title }: FeedbackProps) => import("react/jsx-runtime").JSX.Element;
13
+ export type InputFieldProps<T extends "input" | "select"> = PolymorphicProps<Partial<{
14
+ info: Label;
15
+ labelClassName: string;
16
+ error: string;
17
+ hideLeft: boolean;
18
+ interactive: boolean;
19
+ container: string;
20
+ left: Label;
21
+ feedback: Label;
22
+ optionalText: string;
23
+ right: Label;
24
+ rightLabel: Label;
25
+ id: string;
26
+ name: string;
27
+ placeholder: string;
28
+ }>, T>;
29
+ export declare const InputField: <T extends "input" | "select">({ optionalText: _optionalText, left, rightLabel, container, feedback, interactive, right, info, children, error, form, id, labelClassName, name, title, placeholder, hideLeft, required, }: PropsWithChildren<InputFieldProps<T>>) => import("react/jsx-runtime").JSX.Element;
30
+ //# sourceMappingURL=input-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-field.d.ts","sourceRoot":"","sources":["../../../../src/components/form/input-field.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAY,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,iBAAiB,CAC/C,OAAO,CAAC;IACJ,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;CACzB,CAAC,CACL,CAAC;AAEF,eAAO,MAAM,aAAa,iEAA0E,aAAa,4CA2ChH,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,OAAO,GAAG,QAAQ,IAAI,gBAAgB,CACxE,OAAO,CAAC;IACJ,IAAI,EAAE,KAAK,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,KAAK,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,EAAE,KAAK,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACvB,CAAC,EACF,CAAC,CACJ,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,OAAO,GAAG,QAAQ,8LAmBpD,iBAAiB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,4CAqCvC,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { CheckCircle, InfoIcon, XCircle } from "lucide-react";
4
+ import { Fragment } from "react";
5
+ import { useTranslations } from "../../hooks/use-translate-context";
6
+ import { css } from "../../lib/dom";
7
+ import { Tooltip } from "../floating/tooltip";
8
+ export const InputFeedback = ({ reportStatus, hideLeft = false, className, info, children, title }) => (_jsxs("div", { className: css("w-full justify-between", hideLeft && children === null ? "hidden" : "flex", className), children: [hideLeft ? null : (_jsxs("span", { className: "flex items-center gap-1 transition-colors group-focus-within:text-primary group-hover:text-primary group-error:text-danger", children: [title, reportStatus || info ? (_jsxs("span", { className: "flex items-center justify-center gap-1", children: [info ? (_jsx(Tooltip, { title: _jsxs("span", { className: "cursor-help", children: [_jsx("span", { className: "sr-only", children: info }), _jsx(InfoIcon, { className: "aspect-square size-3", "aria-hidden": "true", size: 16, strokeWidth: 1, absoluteStrokeWidth: true })] }), children: info })) : null, reportStatus ? (_jsxs(Fragment, { children: [_jsx(CheckCircle, { className: "hidden aspect-square size-3 opacity-0 transition-opacity group-assert:block group-assert:text-success group-assert:opacity-100", "aria-hidden": "true", size: 16, strokeWidth: 1, absoluteStrokeWidth: true }), _jsx(XCircle, { className: "hidden aspect-square size-3 opacity-0 transition-opacity group-error:block group-error:opacity-100", "aria-hidden": "true", size: 16, strokeWidth: 1, absoluteStrokeWidth: true })] })) : null] })) : null] })), children] }));
9
+ export const InputField = ({ optionalText: _optionalText, left, rightLabel, container, feedback, interactive, right, info, children, error, form, id, labelClassName = "", name, title, placeholder, hideLeft, required, }) => {
10
+ const ID = id !== null && id !== void 0 ? id : name;
11
+ const translation = useTranslations();
12
+ const optionalText = _optionalText !== null && _optionalText !== void 0 ? _optionalText : translation.inputOptionalLabel;
13
+ return (_jsxs("fieldset", { form: form, "data-error": !!error, "data-interactive": !!interactive, className: css("group inline-flex w-full gap-input-gap", container), children: [_jsxs("label", { form: form, htmlFor: ID, className: "inline-flex w-full cursor-text flex-row flex-wrap justify-between gap-1 text-sm transition-colors empty:hidden group-hover:border-primary group-error:text-danger", children: [!hideLeft && !rightLabel ? (_jsx(InputFeedback, { info: info, hideLeft: hideLeft, reportStatus: true, title: title, placeholder: placeholder, children: optionalText || rightLabel ? (_jsxs(Fragment, { children: [!required ? _jsx("span", { className: "text-opacity-70", children: optionalText }) : null, rightLabel ? _jsx(Fragment, { children: rightLabel }) : null] })) : null })) : null, _jsxs("div", { className: `group relative flex w-full flex-row flex-nowrap items-center gap-x-2 gap-y-1 rounded-md border border-input-border bg-transparent transition-colors group-focus-within:border-primary group-hover:border-primary group-error:border-danger ${labelClassName} focus:ring-2 focus:ring-inset focus:ring-primary`, children: [left ? _jsx("span", { className: "absolute left-0 flex flex-nowrap gap-1 whitespace-nowrap pl-2", children: left }) : null, children, right ? _jsx("span", { className: "absolute right-0 flex flex-nowrap gap-2 whitespace-nowrap pr-1", children: right }) : null] })] }), _jsx("p", { className: "hidden text-xs empty:hidden group-has-[input:not(:focus):invalid[data-initialized=true]]:block group-error:block group-error:text-danger", children: error }), _jsx("p", { className: "text-xs empty:mt-0 empty:hidden group-has-[input:not(:focus):valid[data-initialized=true]]:block group-assert:block group-error:hidden", children: feedback })] }));
14
+ };
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { TheMaskProps } from "the-mask-input";
3
+ import { Override } from "../../types";
4
+ import { FeedbackProps, InputFieldProps } from "./input-field";
5
+ export type InputProps = Override<InputFieldProps<"input">, TheMaskProps & FeedbackProps & {
6
+ next?: string;
7
+ }>;
8
+ export declare const Input: React.FC<InputProps>;
9
+ //# sourceMappingURL=input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../src/components/form/input.tsx"],"names":[],"mappings":"AACA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAC7D,OAAkB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,aAAa,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAE3E,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,aAAa,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE9G,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAoF/B,CAAC"}
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { __rest } from "tslib";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { forwardRef, useEffect, useRef } from "react";
5
+ import MaskInput from "the-mask-input";
6
+ import { css, initializeInputDataset, mergeRefs } from "../../lib/dom";
7
+ import { InputField } from "./input-field";
8
+ export const Input = forwardRef((_a, ref) => {
9
+ var _b;
10
+ var { type = "text", feedback = null, info, labelClassName, next, interactive, rightLabel, optionalText, container, hideLeft = false, right, left, error } = _a, props = __rest(_a, ["type", "feedback", "info", "labelClassName", "next", "interactive", "rightLabel", "optionalText", "container", "hideLeft", "right", "left", "error"]);
11
+ const id = (_b = props.id) !== null && _b !== void 0 ? _b : props.name;
12
+ const inputRef = useRef(null);
13
+ useEffect(() => {
14
+ if (inputRef.current === null)
15
+ return;
16
+ const input = inputRef.current;
17
+ const focus = initializeInputDataset(inputRef.current);
18
+ const goNextInputImpl = (e) => {
19
+ const event = e;
20
+ if (event.key === "Enter" && input.enterKeyHint === "next") {
21
+ const focusNext = input.getAttribute("data-next");
22
+ if (focusNext) {
23
+ const el = document.getElementById(focusNext);
24
+ if (el) {
25
+ el.focus();
26
+ return void event.preventDefault();
27
+ }
28
+ }
29
+ }
30
+ };
31
+ input.addEventListener("keydown", goNextInputImpl);
32
+ return () => {
33
+ focus();
34
+ input.removeEventListener("keydown", goNextInputImpl);
35
+ };
36
+ }, []);
37
+ return (_jsx(InputField, { info: info, container: css("group inline-block w-full", container), error: error, feedback: feedback, hideLeft: hideLeft, left: left, optionalText: optionalText, right: right, rightLabel: rightLabel, interactive: interactive, form: props.form, id: props.name || props.id, name: props.name, labelClassName: labelClassName, title: props.title, placeholder: props.placeholder, required: props.required, children: _jsx(MaskInput, Object.assign({}, props, { type: type, "data-next": next, ref: mergeRefs(ref, inputRef), id: id, name: id, className: css("input placeholder-input-mask h-input-height px-input-x py-input-y group w-full flex-1 rounded-md bg-transparent text-foreground outline-none transition-colors group-error:text-danger group-error:placeholder-input-mask-error", !!right ? "pe-input-inline" : "", !!left ? "ps-input-inline" : "", props.className) })) }));
38
+ });
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { Override } from "../../types";
3
+ export type RadioboxProps = Override<React.PropsWithChildren<React.ComponentProps<"input">>, {
4
+ size?: "medium" | "large";
5
+ }>;
6
+ export declare const Radiobox: ({ children, className, size, ...props }: RadioboxProps) => import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=radiobox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radiobox.d.ts","sourceRoot":"","sources":["../../../../src/components/form/radiobox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,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,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC7B,CACJ,CAAC;AAEF,eAAO,MAAM,QAAQ,4CAAkD,aAAa,4CAiBnF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { __rest } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { css } from "../../lib/dom";
4
+ export const Radiobox = (_a) => {
5
+ var { children, className = "", size } = _a, props = __rest(_a, ["children", "className", "size"]);
6
+ return (_jsxs("label", { "data-disabled": props.disabled, "aria-disabled": props.disabled, className: "group font-normal flex items-center gap-2 data-[disabled=true]:cursor-not-allowed", children: [_jsx("input", Object.assign({}, props, { type: "radio", className: css("form-radio rounded-full h-4 w-4 app border-card-border text-primary focus:ring-primary appearance-none inline-block bg-origin-border group-aria-disabled:cursor-not-allowed disabled:opacity-70", className) }, props)), children] }));
7
+ };
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { Override } from "../../types";
3
+ import { InputFieldProps } from "./input-field";
4
+ export type OptionProps = Override<React.ComponentProps<"option">, {
5
+ value: string;
6
+ "data-dynamic"?: string;
7
+ }>;
8
+ export type SelectProps = Override<InputFieldProps<"select">, {
9
+ options: OptionProps[];
10
+ selectContainer?: string;
11
+ }>;
12
+ export declare const Select: React.ForwardRefExoticComponent<Omit<SelectProps, "ref"> & React.RefAttributes<HTMLSelectElement>>;
13
+ //# sourceMappingURL=select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../src/components/form/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA6D,MAAM,OAAO,CAAC;AAGlF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAE5D,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE/G,MAAM,MAAM,WAAW,GAAG,QAAQ,CAC9B,eAAe,CAAC,QAAQ,CAAC,EACzB;IACI,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC,CAAC;AAEP,eAAO,MAAM,MAAM,oGA4FlB,CAAC"}
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ import { __rest } from "tslib";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { ChevronDown } from "lucide-react";
5
+ import { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
6
+ import { useTranslations } from "../../hooks/use-translate-context";
7
+ import { css, initializeInputDataset, mergeRefs } from "../../lib/dom";
8
+ import { InputField } from "./input-field";
9
+ export const Select = forwardRef((_a, ref) => {
10
+ var _b;
11
+ var { required = true, options, info, selectContainer = "", feedback = null, labelClassName, interactive, rightLabel, optionalText, container, hideLeft = false, right, left, error } = _a, props = __rest(_a, ["required", "options", "info", "selectContainer", "feedback", "labelClassName", "interactive", "rightLabel", "optionalText", "container", "hideLeft", "right", "left", "error"]);
12
+ const translation = useTranslations();
13
+ const inputRef = useRef(null);
14
+ const id = (_b = props.id) !== null && _b !== void 0 ? _b : props.name;
15
+ useImperativeHandle(ref, () => inputRef.current);
16
+ useEffect(() => {
17
+ if (inputRef.current === null)
18
+ return;
19
+ const input = inputRef.current;
20
+ const focus = initializeInputDataset(inputRef.current);
21
+ const change = () => input.setAttribute("data-selected", "true");
22
+ input.addEventListener("change", change);
23
+ return () => {
24
+ focus();
25
+ input.removeEventListener("change", change);
26
+ };
27
+ }, []);
28
+ const onClickLabel = () => { var _a; return (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); };
29
+ return (_jsx(InputField, { container: css("group inline-block w-full", container), error: error, feedback: feedback, hideLeft: hideLeft, left: left, info: info, optionalText: optionalText, rightLabel: rightLabel, interactive: interactive, form: props.form, id: props.name || props.id, name: props.name, labelClassName: labelClassName, title: props.title, placeholder: props.placeholder, required: required, right: _jsx("label", { htmlFor: id, children: _jsxs("button", { onClick: onClickLabel, type: "button", className: "mt-2 transition-colors hover:text-primary", children: [_jsx(ChevronDown, { size: 20 }), _jsx("span", { className: "sr-only", children: translation.inputCaretDown })] }) }), children: _jsxs("select", Object.assign({}, props, { id: id, name: id, value: props.value, required: required, ref: mergeRefs(ref, inputRef), "data-selected": !!props.value || false, defaultValue: props.value ? undefined : "", className: css("input appearance-none select group h-10 py-1 px-2 w-full flex-1 rounded-md bg-transparent text-foreground placeholder-input-placeholder outline-none transition-colors group-error:text-danger group-error:placeholder-input-mask-error", "data-[selected=false]:text-input-placeholder", props.className), children: [_jsx("option", { value: "", disabled: true, hidden: true, children: props.placeholder }), options.map((option) => {
30
+ var _a;
31
+ return (_jsx("option", Object.assign({}, option, { children: (_a = option.label) !== null && _a !== void 0 ? _a : option.value }), `${id}-select-option-${option.value}`));
32
+ })] })) }));
33
+ });
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ export type SwitchProps = React.ComponentProps<"input"> & {
3
+ error?: string;
4
+ container?: string;
5
+ onCheck?: (nextValue: boolean) => void;
6
+ };
7
+ export declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
8
+ //# sourceMappingURL=switch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../../src/components/form/switch.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8E,MAAM,OAAO,CAAC;AAInG,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,MAAM,mGAiEjB,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use client";
2
+ import { __rest } from "tslib";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { forwardRef, useEffect, useId, useImperativeHandle, useRef, useState } from "react";
5
+ import { useCallbackRef } from "../../hooks/use-callback-ref";
6
+ import { css } from "../../lib/dom";
7
+ export const Switch = forwardRef((_a, ref) => {
8
+ var _b;
9
+ var { children, container, error } = _a, props = __rest(_a, ["children", "container", "error"]);
10
+ const id = useId();
11
+ const [innerChecked, setInnerChecked] = useState((_b = props.checked) !== null && _b !== void 0 ? _b : false);
12
+ const checked = innerChecked;
13
+ const innerRef = useRef(null);
14
+ const stableOnChange = useCallbackRef(props.onChange);
15
+ useImperativeHandle(ref, () => innerRef.current);
16
+ useEffect(() => {
17
+ if (innerRef.current !== null) {
18
+ if (stableOnChange.current) {
19
+ const onChange = (e) => {
20
+ e.target.checked = !e.target.checked;
21
+ stableOnChange.current && stableOnChange.current(e);
22
+ };
23
+ innerRef.current.addEventListener("change", onChange);
24
+ return () => { var _a; return (_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener("change", onChange); };
25
+ }
26
+ }
27
+ }, []);
28
+ const onCheck = () => {
29
+ var _a, _b;
30
+ const checked = !((_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.checked);
31
+ setInnerChecked(checked);
32
+ (_b = props === null || props === void 0 ? void 0 : props.onCheck) === null || _b === void 0 ? void 0 : _b.call(props, checked);
33
+ if (innerRef.current !== null) {
34
+ innerRef.current.checked = checked;
35
+ innerRef.current.dispatchEvent(new Event("change", { bubbles: true }));
36
+ }
37
+ };
38
+ return (_jsxs("fieldset", { className: css("flex flex-wrap items-center", container), children: [_jsx("input", Object.assign({}, props, { checked: checked, "data-checked": checked, "data-trigger": "change", hidden: true, id: props.id || id, onChange: (e) => setInnerChecked(e.target.checked), ref: innerRef, type: "checkbox" })), _jsx("button", { type: "button", role: "switch", onClick: onCheck, "aria-checked": checked, "data-checked": checked, "aria-labelledby": `${id}-label`, className: "relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-300 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 data-[checked=false]:bg-input-switch-bg data-[checked=true]:bg-primary", children: _jsx("span", { "aria-hidden": "true", "data-checked": checked, className: "inline-block aspect-square size-5 transform rounded-full shadow ring-0 transition duration-300 ease-in-out data-[checked=false]:translate-x-0 data-[checked=true]:translate-x-5 data-[checked=false]:bg-disabled data-[checked=true]:bg-input-switch" }) }), _jsx("label", { htmlFor: props.id || id, className: "ml-3 inline-block text-sm", id: `${id}-label`, children: _jsx("span", { className: "font-medium text-foreground", children: children }) }), _jsx("span", { className: "mt-1 flex-1 whitespace-nowrap text-xs text-danger empty:mt-0 empty:hidden", children: error })] }));
39
+ });
@@ -0,0 +1,3 @@
1
+ import { ComponentProps, PropsWithChildren } from "react";
2
+ export declare const TaskList: (props: PropsWithChildren<ComponentProps<"fieldset">>) => import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=task-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-list.d.ts","sourceRoot":"","sources":["../../../../src/components/form/task-list.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAa,MAAM,OAAO,CAAC;AAErE,eAAO,MAAM,QAAQ,UAAW,iBAAiB,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,4CA2B5E,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { stagger, useAnimate } from "framer-motion";
3
+ import { useEffect } from "react";
4
+ export const TaskList = (props) => {
5
+ const [ref, animate] = useAnimate();
6
+ useEffect(() => {
7
+ const container = ref.current;
8
+ if (!container)
9
+ return;
10
+ const handler = (e) => {
11
+ const input = e.target;
12
+ const items = Array.from(container.querySelectorAll("input"));
13
+ const allTaskChecked = items.every((el) => el.checked && el.getAttribute("data-task") === "true");
14
+ const index = items.indexOf(input);
15
+ if (allTaskChecked && index !== -1) {
16
+ animate("input", { scale: [1, 1.35, 1], rotate: [0, 10, -10, 0] }, {
17
+ duration: 0.5,
18
+ delay: stagger(0.075, { from: index }),
19
+ });
20
+ }
21
+ };
22
+ container.addEventListener("change", handler);
23
+ return () => container.removeEventListener("change", handler);
24
+ }, []);
25
+ return _jsx("fieldset", Object.assign({}, props, { ref: ref }));
26
+ };
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { POJO, SetState } from "../../types";
3
+ export type TransferListProps<T> = {
4
+ source: T[];
5
+ target: T[];
6
+ Item: React.FC<{
7
+ data: T;
8
+ }>;
9
+ reference: keyof T;
10
+ setSource: SetState<T[]>;
11
+ setTarget: SetState<T[]>;
12
+ };
13
+ export declare const TransferList: <T extends POJO, K extends keyof T>(props: TransferListProps<T>) => import("react/jsx-runtime").JSX.Element;
14
+ //# sourceMappingURL=transfer-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transfer-list.d.ts","sourceRoot":"","sources":["../../../../src/components/form/transfer-list.tsx"],"names":[],"mappings":"AACA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAG5D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAK7C,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IAC/B,MAAM,EAAE,CAAC,EAAE,CAAC;IACZ,MAAM,EAAE,CAAC,EAAE,CAAC;IACZ,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC,CAAC;IACnB,SAAS,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;IACzB,SAAS,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;CAC5B,CAAC;AAWF,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,IAAI,EAAE,CAAC,SAAS,MAAM,CAAC,SAAS,iBAAiB,CAAC,CAAC,CAAC,4CAgC1F,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ChevronRightIcon } from "lucide-react";
3
+ import { forwardRef, Fragment, useRef } from "react";
4
+ import { Virtuoso } from "react-virtuoso";
5
+ import { useParentHeight } from "../../hooks/use-parent";
6
+ import { Button } from "../core/button";
7
+ import { Checkbox } from "../form/checkbox";
8
+ import { Input } from "./input";
9
+ const components = {
10
+ Item: forwardRef(function InnerList(props, ref) {
11
+ return _jsx("li", Object.assign({}, props, { ref: ref, className: "flex items-center gap-1 justify-between" }));
12
+ }),
13
+ List: forwardRef(function InnerList(props, ref) {
14
+ return _jsx("ul", Object.assign({}, props, { ref: ref, className: "space-y-3" }));
15
+ }),
16
+ };
17
+ export const TransferList = (props) => {
18
+ const ref = useRef(null);
19
+ const h = useParentHeight(ref);
20
+ return (_jsxs("div", { className: "flex flex-row gap-4", ref: ref, children: [_jsxs("div", { className: "py-8 space-y-4 min-w-64 w-fit flex flex-col whitespace-nowrap rounded-lg border border-card-border", children: [_jsx("header", { className: "border-b border-card-border pb-2" }), _jsxs("div", { className: "px-8 space-y-2", children: [_jsx(Input, { rightLabel: "", title: "Search", placeholder: "Looking for..." }), _jsx(Virtuoso, { height: h, useWindowScroll: true, data: props.source, components: components, itemContent: (_, row) => (_jsx(Fragment, { children: _jsx(Checkbox, { children: _jsx(props.Item, { data: row }) }) })) })] })] }), _jsx("div", { children: _jsx(Button, { children: _jsx(ChevronRightIcon, {}) }) }), _jsx("div", {})] }));
21
+ };
@@ -0,0 +1,30 @@
1
+ export * from "./core/button";
2
+ export * from "./core/polymorph";
3
+ export * from "./core/tag";
4
+ export * from "./display/alert";
5
+ export * from "./display/calendar";
6
+ export * from "./display/card";
7
+ export * from "./display/stats";
8
+ export * from "./display/tabs";
9
+ export * from "./floating/dropdown";
10
+ export * from "./floating/expand";
11
+ export * from "./floating/menu";
12
+ export * from "./floating/modal";
13
+ export * from "./floating/toolbar";
14
+ export * from "./floating/tooltip";
15
+ export * from "./form/autocomplete";
16
+ export * from "./form/checkbox";
17
+ export * from "./form/date-picker";
18
+ export * from "./form/file-upload";
19
+ export * from "./form/form";
20
+ export * from "./form/input";
21
+ export * from "./form/input-field";
22
+ export * from "./form/radiobox";
23
+ export * from "./form/select";
24
+ export * from "./form/select";
25
+ export * from "./form/switch";
26
+ export * from "./form/task-list";
27
+ export * from "./form/transfer-list";
28
+ export * from "./table/index";
29
+ export { createColumns, createOptionCols, type ColType, useTablePreferences, type TablePagination } from "./table/table-lib";
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,OAAO,EAAE,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,29 @@
1
+ export * from "./core/button";
2
+ export * from "./core/polymorph";
3
+ export * from "./core/tag";
4
+ export * from "./display/alert";
5
+ export * from "./display/calendar";
6
+ export * from "./display/card";
7
+ export * from "./display/stats";
8
+ export * from "./display/tabs";
9
+ export * from "./floating/dropdown";
10
+ export * from "./floating/expand";
11
+ export * from "./floating/menu";
12
+ export * from "./floating/modal";
13
+ export * from "./floating/toolbar";
14
+ export * from "./floating/tooltip";
15
+ export * from "./form/autocomplete";
16
+ export * from "./form/checkbox";
17
+ export * from "./form/date-picker";
18
+ export * from "./form/file-upload";
19
+ export * from "./form/form";
20
+ export * from "./form/input";
21
+ export * from "./form/input-field";
22
+ export * from "./form/radiobox";
23
+ export * from "./form/select";
24
+ export * from "./form/select";
25
+ export * from "./form/switch";
26
+ export * from "./form/task-list";
27
+ export * from "./form/transfer-list";
28
+ export * from "./table/index";
29
+ export { createColumns, createOptionCols, useTablePreferences } from "./table/table-lib";