@rafal.lemieszewski/tide-ui 0.83.0 → 0.84.3

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 (256) hide show
  1. package/README.md +20 -8
  2. package/dist/cjs/components/core-index.cjs +1 -0
  3. package/dist/cjs/components/fundamental/accordion.cjs +1 -0
  4. package/dist/cjs/components/fundamental/alert-dialog.cjs +1 -0
  5. package/dist/cjs/components/fundamental/alert.cjs +1 -0
  6. package/dist/cjs/components/fundamental/autocomplete-search.cjs +1 -0
  7. package/dist/cjs/components/fundamental/avatar-group.cjs +1 -0
  8. package/dist/cjs/components/fundamental/avatar.cjs +1 -0
  9. package/dist/cjs/components/fundamental/badge.cjs +1 -0
  10. package/dist/cjs/components/fundamental/breadcrumb.cjs +1 -0
  11. package/dist/cjs/components/fundamental/button-group.cjs +1 -0
  12. package/dist/cjs/components/fundamental/button.cjs +1 -0
  13. package/dist/cjs/components/fundamental/calendar.cjs +1 -0
  14. package/dist/cjs/components/fundamental/card.cjs +1 -0
  15. package/dist/cjs/components/fundamental/chart.cjs +1 -0
  16. package/dist/cjs/components/fundamental/checkbox.cjs +1 -0
  17. package/dist/cjs/components/fundamental/collapsible.cjs +1 -0
  18. package/dist/cjs/components/fundamental/combobox.cjs +1 -0
  19. package/dist/cjs/components/fundamental/command.cjs +1 -0
  20. package/dist/cjs/components/fundamental/country-dropdown.cjs +1 -0
  21. package/dist/cjs/components/fundamental/custom-icons.cjs +1 -0
  22. package/dist/cjs/components/fundamental/date-picker.cjs +1 -0
  23. package/dist/cjs/components/fundamental/dialog.cjs +1 -0
  24. package/dist/cjs/components/fundamental/drawer.cjs +1 -0
  25. package/dist/cjs/components/fundamental/dropdown-menu.cjs +1 -0
  26. package/dist/cjs/components/fundamental/editable.cjs +1 -0
  27. package/dist/cjs/components/fundamental/empty.cjs +1 -0
  28. package/dist/cjs/components/fundamental/file-upload.cjs +1 -0
  29. package/dist/cjs/components/fundamental/flag.cjs +1 -0
  30. package/dist/cjs/components/fundamental/form-field.cjs +1 -0
  31. package/dist/cjs/components/fundamental/hover-card.cjs +1 -0
  32. package/dist/cjs/components/fundamental/icon.cjs +1 -0
  33. package/dist/cjs/components/fundamental/input-group.cjs +1 -0
  34. package/dist/cjs/components/fundamental/input.cjs +1 -0
  35. package/dist/cjs/components/fundamental/kbd.cjs +1 -0
  36. package/dist/cjs/components/fundamental/label.cjs +1 -0
  37. package/dist/cjs/components/fundamental/month-picker.cjs +1 -0
  38. package/dist/cjs/components/fundamental/pagination.cjs +1 -0
  39. package/dist/cjs/components/fundamental/popover.cjs +1 -0
  40. package/dist/cjs/components/fundamental/progress.cjs +1 -0
  41. package/dist/cjs/components/fundamental/radio-group.cjs +1 -0
  42. package/dist/cjs/components/fundamental/resizable.cjs +1 -0
  43. package/dist/cjs/components/fundamental/scroll-area.cjs +1 -0
  44. package/dist/cjs/components/fundamental/select.cjs +1 -0
  45. package/dist/cjs/components/fundamental/separator.cjs +1 -0
  46. package/dist/cjs/components/fundamental/sheet.cjs +1 -0
  47. package/dist/cjs/components/fundamental/sidebar.cjs +1 -0
  48. package/dist/cjs/components/fundamental/skeleton.cjs +1 -0
  49. package/dist/cjs/components/fundamental/slider.cjs +1 -0
  50. package/dist/cjs/components/fundamental/spinner.cjs +1 -0
  51. package/dist/cjs/components/fundamental/switch.cjs +1 -0
  52. package/dist/cjs/components/fundamental/table.cjs +1 -0
  53. package/dist/cjs/components/fundamental/tabs.cjs +1 -0
  54. package/dist/cjs/components/fundamental/tag.cjs +27 -0
  55. package/dist/cjs/components/fundamental/text-link.cjs +1 -0
  56. package/dist/cjs/components/fundamental/textarea.cjs +1 -0
  57. package/dist/cjs/components/fundamental/toast.cjs +1 -0
  58. package/dist/cjs/components/fundamental/toggle-group.cjs +1 -0
  59. package/dist/cjs/components/fundamental/toggle.cjs +1 -0
  60. package/dist/cjs/components/fundamental/tooltip.cjs +1 -0
  61. package/dist/cjs/components/fundamental/tree.cjs +1 -0
  62. package/dist/cjs/components/product/activity-log.cjs +1 -0
  63. package/dist/cjs/components/product/app-frame.cjs +1 -0
  64. package/dist/cjs/components/product/attributes-list.cjs +1 -0
  65. package/dist/cjs/components/product/bookmarks.cjs +1 -0
  66. package/dist/cjs/components/product/data-table-settings-menu.cjs +1 -0
  67. package/dist/cjs/components/product/data-table.cjs +1 -0
  68. package/dist/cjs/components/product/filters.cjs +1 -0
  69. package/dist/cjs/components/product/fixture-status.cjs +1 -0
  70. package/dist/cjs/components/product/linked-chart.cjs +1 -0
  71. package/dist/cjs/components/product/view-mode-menu.cjs +1 -0
  72. package/dist/cjs/lib/date-utils.cjs +1 -0
  73. package/dist/cjs/lib/hooks.cjs +1 -0
  74. package/dist/cjs/lib/index.cjs +1 -0
  75. package/dist/cjs/lib/utils.cjs +1 -0
  76. package/dist/es/components/core-index.js +37 -0
  77. package/dist/es/components/fundamental/accordion.js +60 -0
  78. package/dist/es/components/fundamental/alert-dialog.js +116 -0
  79. package/dist/es/components/fundamental/alert.js +65 -0
  80. package/dist/es/components/fundamental/autocomplete-search.js +139 -0
  81. package/dist/es/components/fundamental/avatar-group.js +51 -0
  82. package/dist/es/components/fundamental/avatar.js +165 -0
  83. package/dist/es/components/fundamental/badge.js +157 -0
  84. package/dist/es/components/fundamental/breadcrumb.js +142 -0
  85. package/dist/es/components/fundamental/button-group.js +86 -0
  86. package/dist/es/components/fundamental/button.js +186 -0
  87. package/dist/es/components/fundamental/calendar.js +130 -0
  88. package/dist/es/components/fundamental/card.js +68 -0
  89. package/dist/es/components/fundamental/chart.js +1006 -0
  90. package/dist/es/components/fundamental/checkbox.js +51 -0
  91. package/dist/es/components/fundamental/collapsible.js +55 -0
  92. package/dist/es/components/fundamental/combobox.js +229 -0
  93. package/dist/es/components/fundamental/command.js +155 -0
  94. package/dist/es/components/fundamental/country-dropdown.js +215 -0
  95. package/dist/es/components/fundamental/custom-icons.js +876 -0
  96. package/dist/es/components/fundamental/date-picker.js +119 -0
  97. package/dist/es/components/fundamental/dialog.js +106 -0
  98. package/dist/es/components/fundamental/drawer.js +93 -0
  99. package/dist/es/components/fundamental/dropdown-menu.js +600 -0
  100. package/dist/es/components/fundamental/editable.js +123 -0
  101. package/dist/es/components/fundamental/empty.js +152 -0
  102. package/dist/es/components/fundamental/file-upload.js +289 -0
  103. package/dist/es/components/fundamental/flag.js +60 -0
  104. package/dist/es/components/fundamental/form-field.js +352 -0
  105. package/dist/es/components/fundamental/hover-card.js +23 -0
  106. package/dist/es/components/fundamental/icon.js +200 -0
  107. package/dist/es/components/fundamental/input-group.js +135 -0
  108. package/dist/es/components/fundamental/input.js +78 -0
  109. package/dist/es/components/fundamental/kbd.js +57 -0
  110. package/dist/es/components/fundamental/label.js +54 -0
  111. package/dist/es/components/fundamental/month-picker.js +161 -0
  112. package/dist/es/components/fundamental/pagination.js +109 -0
  113. package/dist/es/components/fundamental/popover.js +24 -0
  114. package/dist/es/components/fundamental/progress.js +66 -0
  115. package/dist/es/components/fundamental/radio-group.js +64 -0
  116. package/dist/es/components/fundamental/resizable.js +43 -0
  117. package/dist/es/components/fundamental/scroll-area.js +38 -0
  118. package/dist/es/components/fundamental/select.js +136 -0
  119. package/dist/es/components/fundamental/separator.js +47 -0
  120. package/dist/es/components/fundamental/sheet.js +134 -0
  121. package/dist/es/components/fundamental/sidebar.js +709 -0
  122. package/dist/es/components/fundamental/skeleton.js +158 -0
  123. package/dist/es/components/fundamental/slider.js +35 -0
  124. package/dist/es/components/fundamental/spinner.js +225 -0
  125. package/dist/es/components/fundamental/switch.js +27 -0
  126. package/dist/es/components/fundamental/table.js +263 -0
  127. package/dist/es/components/fundamental/tabs.js +170 -0
  128. package/dist/es/components/fundamental/tag.js +295 -0
  129. package/dist/es/components/fundamental/text-link.js +105 -0
  130. package/dist/es/components/fundamental/textarea.js +47 -0
  131. package/dist/es/components/fundamental/toast.js +108 -0
  132. package/dist/es/components/fundamental/toggle-group.js +37 -0
  133. package/dist/es/components/fundamental/toggle.js +51 -0
  134. package/dist/es/components/fundamental/tooltip.js +26 -0
  135. package/dist/es/components/fundamental/tree.js +161 -0
  136. package/dist/es/components/product/activity-log.js +231 -0
  137. package/dist/es/components/product/app-frame.js +985 -0
  138. package/dist/es/components/product/attributes-list.js +351 -0
  139. package/dist/es/components/product/bookmarks.js +833 -0
  140. package/dist/es/components/product/data-table-settings-menu.js +169 -0
  141. package/dist/es/components/product/data-table.js +2473 -0
  142. package/dist/es/components/product/filters.js +1041 -0
  143. package/dist/es/components/product/fixture-status.js +178 -0
  144. package/dist/es/components/product/linked-chart.js +179 -0
  145. package/dist/es/components/product/view-mode-menu.js +353 -0
  146. package/dist/es/lib/date-utils.js +151 -0
  147. package/dist/es/lib/hooks.js +29 -0
  148. package/dist/es/lib/index.js +348 -0
  149. package/dist/es/lib/utils.js +8 -0
  150. package/dist/es/style.css +1 -0
  151. package/dist/types/bookmarks.d.ts +2 -0
  152. package/dist/types/calendar.d.ts +2 -0
  153. package/dist/types/chart.d.ts +2 -0
  154. package/dist/types/components/core-index.d.cts +135 -0
  155. package/dist/types/components/core-index.d.ts +135 -0
  156. package/dist/{components → types/components}/fundamental/avatar.d.ts +3 -3
  157. package/dist/{components → types/components}/fundamental/badge.d.ts +2 -2
  158. package/dist/{components → types/components}/fundamental/button-group.d.ts +2 -2
  159. package/dist/{components → types/components}/fundamental/button.d.ts +1 -1
  160. package/dist/types/components/fundamental/calendar.d.ts +7 -0
  161. package/dist/types/components/fundamental/chart.d.ts +95 -0
  162. package/dist/{components → types/components}/fundamental/command.d.ts +2 -2
  163. package/dist/types/components/fundamental/country-dropdown.d.ts +34 -0
  164. package/dist/types/components/fundamental/date-picker.d.ts +30 -0
  165. package/dist/{components → types/components}/fundamental/file-upload.d.ts +1 -1
  166. package/dist/{components → types/components}/fundamental/form-field.d.ts +2 -2
  167. package/dist/{components → types/components}/fundamental/form.d.ts +2 -2
  168. package/dist/{components → types/components}/fundamental/icon.d.ts +1 -1
  169. package/dist/{components → types/components}/fundamental/input-group.d.ts +1 -1
  170. package/dist/types/components/fundamental/resizable.d.cts +23 -0
  171. package/dist/{components → types/components}/fundamental/resizable.d.ts +1 -1
  172. package/dist/{components → types/components}/fundamental/sidebar.d.ts +3 -3
  173. package/dist/{components → types/components}/fundamental/spinner.d.ts +1 -1
  174. package/dist/{components → types/components}/fundamental/table.d.ts +3 -3
  175. package/dist/{components → types/components}/fundamental/text-link.d.ts +1 -1
  176. package/dist/{components → types/components}/index.d.ts +118 -118
  177. package/dist/{components → types/components}/product/activity-log.d.ts +1 -1
  178. package/dist/{components → types/components}/product/attributes-list.d.ts +1 -1
  179. package/dist/types/components/product/bookmarks.d.cts +90 -0
  180. package/dist/{components → types/components}/product/bookmarks.d.ts +1 -1
  181. package/dist/types/components/product/data-table.d.ts +802 -0
  182. package/dist/types/components/product/filters.d.ts +124 -0
  183. package/dist/{components → types/components}/product/fixture-status.d.ts +1 -1
  184. package/dist/types/components/product/linked-chart.d.cts +22 -0
  185. package/dist/{components → types/components}/product/linked-chart.d.ts +1 -1
  186. package/dist/types/country-dropdown.d.ts +2 -0
  187. package/dist/types/data-table.d.ts +2 -0
  188. package/dist/types/date-picker.d.ts +2 -0
  189. package/dist/types/filters.d.ts +2 -0
  190. package/dist/types/index.d.ts +2 -0
  191. package/dist/types/lib/index.d.cts +104 -0
  192. package/dist/types/lib/index.d.ts +104 -0
  193. package/dist/types/linked-chart.d.ts +2 -0
  194. package/dist/types/resizable.d.ts +2 -0
  195. package/package.json +191 -31
  196. package/dist/index.cjs.js +0 -144
  197. package/dist/index.cjs.js.map +0 -1
  198. package/dist/index.d.ts +0 -2
  199. package/dist/index.es.js +0 -87768
  200. package/dist/index.es.js.map +0 -1
  201. package/dist/lib/index.d.ts +0 -3
  202. package/dist/style.css +0 -1
  203. /package/dist/{components → types/components}/fundamental/accordion.d.ts +0 -0
  204. /package/dist/{components → types/components}/fundamental/alert-dialog.d.ts +0 -0
  205. /package/dist/{components → types/components}/fundamental/alert.d.ts +0 -0
  206. /package/dist/{components → types/components}/fundamental/autocomplete-search.d.ts +0 -0
  207. /package/dist/{components → types/components}/fundamental/avatar-group.d.ts +0 -0
  208. /package/dist/{components → types/components}/fundamental/breadcrumb.d.ts +0 -0
  209. /package/dist/{components → types/components}/fundamental/button.test.d.ts +0 -0
  210. /package/dist/{components/fundamental/calendar.d.ts → types/components/fundamental/calendar.d.cts} +0 -0
  211. /package/dist/{components → types/components}/fundamental/card.d.ts +0 -0
  212. /package/dist/{components/fundamental/chart.d.ts → types/components/fundamental/chart.d.cts} +0 -0
  213. /package/dist/{components → types/components}/fundamental/checkbox.d.ts +0 -0
  214. /package/dist/{components → types/components}/fundamental/collapsible.d.ts +0 -0
  215. /package/dist/{components → types/components}/fundamental/combobox.d.ts +0 -0
  216. /package/dist/{components/fundamental/country-dropdown.d.ts → types/components/fundamental/country-dropdown.d.cts} +0 -0
  217. /package/dist/{components → types/components}/fundamental/custom-icons.d.ts +0 -0
  218. /package/dist/{components/fundamental/date-picker.d.ts → types/components/fundamental/date-picker.d.cts} +0 -0
  219. /package/dist/{components → types/components}/fundamental/dialog.d.ts +0 -0
  220. /package/dist/{components → types/components}/fundamental/drawer.d.ts +0 -0
  221. /package/dist/{components → types/components}/fundamental/dropdown-menu.d.ts +0 -0
  222. /package/dist/{components → types/components}/fundamental/editable.d.ts +0 -0
  223. /package/dist/{components → types/components}/fundamental/empty.d.ts +0 -0
  224. /package/dist/{components → types/components}/fundamental/flag.d.ts +0 -0
  225. /package/dist/{components → types/components}/fundamental/hover-card.d.ts +0 -0
  226. /package/dist/{components → types/components}/fundamental/input.d.ts +0 -0
  227. /package/dist/{components → types/components}/fundamental/kbd.d.ts +0 -0
  228. /package/dist/{components → types/components}/fundamental/label.d.ts +0 -0
  229. /package/dist/{components → types/components}/fundamental/month-picker.d.ts +0 -0
  230. /package/dist/{components → types/components}/fundamental/pagination.d.ts +0 -0
  231. /package/dist/{components → types/components}/fundamental/popover.d.ts +0 -0
  232. /package/dist/{components → types/components}/fundamental/progress.d.ts +0 -0
  233. /package/dist/{components → types/components}/fundamental/radio-group.d.ts +0 -0
  234. /package/dist/{components → types/components}/fundamental/scroll-area.d.ts +0 -0
  235. /package/dist/{components → types/components}/fundamental/select.d.ts +0 -0
  236. /package/dist/{components → types/components}/fundamental/separator.d.ts +0 -0
  237. /package/dist/{components → types/components}/fundamental/sheet.d.ts +0 -0
  238. /package/dist/{components → types/components}/fundamental/skeleton.d.ts +0 -0
  239. /package/dist/{components → types/components}/fundamental/slider.d.ts +0 -0
  240. /package/dist/{components → types/components}/fundamental/switch.d.ts +0 -0
  241. /package/dist/{components → types/components}/fundamental/tabs.d.ts +0 -0
  242. /package/dist/{components → types/components}/fundamental/tag.d.ts +0 -0
  243. /package/dist/{components → types/components}/fundamental/textarea.d.ts +0 -0
  244. /package/dist/{components → types/components}/fundamental/toast.d.ts +0 -0
  245. /package/dist/{components → types/components}/fundamental/toggle-group.d.ts +0 -0
  246. /package/dist/{components → types/components}/fundamental/toggle.d.ts +0 -0
  247. /package/dist/{components → types/components}/fundamental/tooltip.d.ts +0 -0
  248. /package/dist/{components → types/components}/fundamental/tree.d.ts +0 -0
  249. /package/dist/{components → types/components}/product/app-frame.d.ts +0 -0
  250. /package/dist/{components → types/components}/product/data-table-settings-menu.d.ts +0 -0
  251. /package/dist/{components/product/data-table.d.ts → types/components/product/data-table.d.cts} +0 -0
  252. /package/dist/{components/product/filters.d.ts → types/components/product/filters.d.cts} +0 -0
  253. /package/dist/{components → types/components}/product/view-mode-menu.d.ts +0 -0
  254. /package/dist/{lib → types/lib}/date-utils.d.ts +0 -0
  255. /package/dist/{lib → types/lib}/hooks.d.ts +0 -0
  256. /package/dist/{lib → types/lib}/utils.d.ts +0 -0
@@ -0,0 +1,123 @@
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import { useState as y, useRef as D, useEffect as I, createContext as B, useContext as K } from "react";
3
+ const S = B(null), k = () => {
4
+ const t = K(S);
5
+ if (!t)
6
+ throw new Error("Editable compound components must be used within Editable");
7
+ return t;
8
+ }, V = ({
9
+ value: t,
10
+ defaultValue: o = "",
11
+ onSubmit: u,
12
+ onChange: s,
13
+ disabled: a = !1,
14
+ placeholder: c,
15
+ autoFocus: f = !0,
16
+ selectAllOnFocus: d = !0,
17
+ children: g,
18
+ className: m,
19
+ style: C
20
+ }) => {
21
+ const e = t !== void 0, [x, i] = y(t ?? o), [h, r] = y(!1), [E, n] = y(t ?? o), v = D(null), b = e ? t : x;
22
+ I(() => {
23
+ e && (i(t), h || n(t));
24
+ }, [t, e, h]);
25
+ const w = {
26
+ isEditing: h,
27
+ value: b,
28
+ originalValue: E,
29
+ disabled: a,
30
+ placeholder: c,
31
+ onStartEdit: () => {
32
+ a || (r(!0), n(b), f && setTimeout(() => {
33
+ v.current && (v.current.focus(), d && v.current.select());
34
+ }, 0));
35
+ },
36
+ onSave: () => {
37
+ const l = b.trim();
38
+ if (!l) {
39
+ e || i(E), r(!1);
40
+ return;
41
+ }
42
+ u?.(l), e || i(l), r(!1);
43
+ },
44
+ onCancel: () => {
45
+ e || i(E), r(!1);
46
+ },
47
+ onChange: (l) => {
48
+ s?.(l), e || i(l);
49
+ },
50
+ inputRef: v
51
+ };
52
+ return /* @__PURE__ */ p(S.Provider, { value: w, children: /* @__PURE__ */ p("div", { className: m, style: C, children: g }) });
53
+ }, W = ({
54
+ className: t,
55
+ style: o,
56
+ children: u
57
+ }) => {
58
+ const { isEditing: s, value: a, disabled: c, onStartEdit: f } = k();
59
+ return s ? null : /* @__PURE__ */ p(
60
+ "div",
61
+ {
62
+ onClick: () => {
63
+ f();
64
+ },
65
+ className: t,
66
+ style: {
67
+ cursor: c ? "default" : "pointer",
68
+ ...o
69
+ },
70
+ children: u || a || "Click to edit"
71
+ }
72
+ );
73
+ }, $ = ({
74
+ className: t,
75
+ style: o,
76
+ type: u = "text",
77
+ autoResize: s = !1,
78
+ minWidth: a = 120,
79
+ charWidth: c = 16
80
+ }) => {
81
+ const {
82
+ isEditing: f,
83
+ value: d,
84
+ placeholder: g,
85
+ onChange: m,
86
+ onSave: C,
87
+ onCancel: e,
88
+ inputRef: x
89
+ } = k();
90
+ if (!f) return null;
91
+ const i = (n) => {
92
+ m(n.target.value);
93
+ }, h = (n) => {
94
+ n.key === "Enter" ? (n.preventDefault(), C()) : n.key === "Escape" && (n.preventDefault(), e());
95
+ }, r = () => {
96
+ C();
97
+ }, E = s ? Math.max(a, d.length * c) : void 0;
98
+ return /* @__PURE__ */ p(
99
+ "input",
100
+ {
101
+ ref: x,
102
+ type: u,
103
+ value: d,
104
+ onChange: i,
105
+ onKeyDown: h,
106
+ onBlur: r,
107
+ placeholder: g,
108
+ className: t,
109
+ style: {
110
+ ...o,
111
+ ...s && { width: `${E}px` }
112
+ }
113
+ }
114
+ );
115
+ };
116
+ export {
117
+ V as Editable,
118
+ W as EditableDisplay,
119
+ $ as EditableField,
120
+ $ as EditableInput,
121
+ W as EditablePreview,
122
+ V as default
123
+ };
@@ -0,0 +1,152 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import * as s from "react";
3
+ import { cn as l } from "../../lib/utils.js";
4
+ import { cva as c } from "class-variance-authority";
5
+ const m = c(
6
+ "flex flex-col items-center justify-center text-center",
7
+ {
8
+ variants: {
9
+ size: {
10
+ s: "gap-[var(--space-m)] py-[var(--space-3xl)] px-[var(--space-l)]",
11
+ m: "gap-[var(--space-l)] py-[var(--space-4xl)] px-[var(--space-xl)]",
12
+ l: "gap-[var(--space-xl)] py-[var(--space-5xl)] px-[var(--space-2xl)]"
13
+ }
14
+ },
15
+ defaultVariants: {
16
+ size: "m"
17
+ }
18
+ }
19
+ ), d = /* @__PURE__ */ s.forwardRef(
20
+ ({ className: a, size: e, ...t }, r) => /* @__PURE__ */ o(
21
+ "div",
22
+ {
23
+ ref: r,
24
+ className: l(m({ size: e }), a),
25
+ ...t
26
+ }
27
+ )
28
+ );
29
+ d.displayName = "Empty";
30
+ const p = /* @__PURE__ */ s.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ o(
31
+ "div",
32
+ {
33
+ ref: t,
34
+ className: l("flex flex-col items-center gap-[var(--space-m)]", a),
35
+ ...e
36
+ }
37
+ ));
38
+ p.displayName = "EmptyHeader";
39
+ const x = c(
40
+ "rounded-full flex items-center justify-center",
41
+ {
42
+ variants: {
43
+ variant: {
44
+ icon: "rounded-full",
45
+ default: ""
46
+ // For avatars, images, etc.
47
+ },
48
+ color: {
49
+ default: "bg-[var(--color-background-neutral-subtlest)] text-[var(--color-text-tertiary)]",
50
+ primary: "bg-[var(--color-background-brand-subtle)] text-[var(--color-text-brand-bold)]",
51
+ success: "bg-[var(--color-background-success-subtle)] text-[var(--color-text-success-bold)]",
52
+ warning: "bg-[var(--color-background-warning-subtle)] text-[var(--color-text-warning-bold)]",
53
+ error: "bg-[var(--color-background-error-subtle)] text-[var(--color-text-error-bold)]",
54
+ info: "bg-[var(--color-background-info-subtle)] text-[var(--color-text-info-bold)]"
55
+ },
56
+ size: {
57
+ s: "h-[var(--size-3xl)] w-[var(--size-3xl)]",
58
+ m: "h-[var(--size-4xl)] w-[var(--size-4xl)]",
59
+ l: "h-[var(--size-5xl)] w-[var(--size-5xl)]"
60
+ }
61
+ },
62
+ defaultVariants: {
63
+ variant: "icon",
64
+ color: "default",
65
+ size: "m"
66
+ }
67
+ }
68
+ ), v = /* @__PURE__ */ s.forwardRef(
69
+ ({ className: a, variant: e, color: t, size: r, ...i }, n) => /* @__PURE__ */ o(
70
+ "div",
71
+ {
72
+ ref: n,
73
+ className: l(
74
+ x({ variant: e, color: e === "icon" ? t : void 0, size: r }),
75
+ a
76
+ ),
77
+ ...i
78
+ }
79
+ )
80
+ );
81
+ v.displayName = "EmptyMedia";
82
+ const f = c(
83
+ "font-semibold text-[var(--color-text-primary)]",
84
+ {
85
+ variants: {
86
+ size: {
87
+ s: "text-heading-sm",
88
+ m: "text-heading-md",
89
+ l: "text-heading-lg"
90
+ }
91
+ },
92
+ defaultVariants: {
93
+ size: "m"
94
+ }
95
+ }
96
+ ), y = /* @__PURE__ */ s.forwardRef(
97
+ ({ className: a, size: e, ...t }, r) => /* @__PURE__ */ o(
98
+ "h3",
99
+ {
100
+ ref: r,
101
+ className: l(f({ size: e }), a),
102
+ ...t
103
+ }
104
+ )
105
+ );
106
+ y.displayName = "EmptyTitle";
107
+ const u = c(
108
+ "text-[var(--color-text-secondary)]",
109
+ {
110
+ variants: {
111
+ size: {
112
+ s: "text-body-sm",
113
+ m: "text-body-md",
114
+ l: "text-body-lg"
115
+ }
116
+ },
117
+ defaultVariants: {
118
+ size: "m"
119
+ }
120
+ }
121
+ ), b = /* @__PURE__ */ s.forwardRef(
122
+ ({ className: a, size: e, ...t }, r) => /* @__PURE__ */ o(
123
+ "p",
124
+ {
125
+ ref: r,
126
+ className: l(u({ size: e }), a),
127
+ ...t
128
+ }
129
+ )
130
+ );
131
+ b.displayName = "EmptyDescription";
132
+ const g = /* @__PURE__ */ s.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ o(
133
+ "div",
134
+ {
135
+ ref: t,
136
+ className: l("flex flex-col sm:flex-row items-center gap-[var(--space-m)]", a),
137
+ ...e
138
+ }
139
+ ));
140
+ g.displayName = "EmptyContent";
141
+ export {
142
+ d as Empty,
143
+ g as EmptyContent,
144
+ b as EmptyDescription,
145
+ p as EmptyHeader,
146
+ v as EmptyMedia,
147
+ y as EmptyTitle,
148
+ u as emptyDescriptionVariants,
149
+ x as emptyMediaVariants,
150
+ f as emptyTitleVariants,
151
+ m as emptyVariants
152
+ };
@@ -0,0 +1,289 @@
1
+ import { jsx as s, jsxs as b } from "react/jsx-runtime";
2
+ import * as n from "react";
3
+ import { cn as v } from "../../lib/utils.js";
4
+ import { cva as X } from "class-variance-authority";
5
+ import { Button as P } from "./button.js";
6
+ import { Progress as Y } from "./progress.js";
7
+ import { Icon as z } from "./icon.js";
8
+ import { Badge as Z } from "./badge.js";
9
+ const M = n.createContext(
10
+ null
11
+ ), D = () => {
12
+ const r = n.useContext(M);
13
+ if (!r)
14
+ throw new Error("useFileUpload must be used within a FileUpload component");
15
+ return r;
16
+ }, j = /* @__PURE__ */ n.forwardRef(
17
+ ({
18
+ className: r,
19
+ files: e,
20
+ onFilesChange: o,
21
+ maxFiles: t = 10,
22
+ maxSize: l = 10 * 1024 * 1024,
23
+ // 10MB
24
+ accept: i,
25
+ disabled: m = !1,
26
+ multiple: c = !0,
27
+ onUpload: p,
28
+ children: u,
29
+ ...x
30
+ }, w) => {
31
+ const g = n.useMemo(
32
+ () => ({
33
+ files: e,
34
+ onFilesChange: o,
35
+ maxFiles: t,
36
+ maxSize: l,
37
+ accept: i,
38
+ disabled: m,
39
+ multiple: c,
40
+ onUpload: p
41
+ }),
42
+ [
43
+ e,
44
+ o,
45
+ t,
46
+ l,
47
+ i,
48
+ m,
49
+ c,
50
+ p
51
+ ]
52
+ );
53
+ return /* @__PURE__ */ s(M.Provider, { value: g, children: /* @__PURE__ */ s("div", { ref: w, className: v("space-y-4", r), ...x, children: u }) });
54
+ }
55
+ );
56
+ j.displayName = "FileUploadRoot";
57
+ const _ = X(
58
+ "relative flex flex-col items-center justify-center rounded-l border-2 border-dashed p-6 text-center transition-colors duration-200",
59
+ {
60
+ variants: {
61
+ isDragActive: {
62
+ true: "border-[var(--color-border-brand-bold)] bg-[var(--color-background-brand-subtle)]",
63
+ false: "border-[var(--color-interaction-border-input)] hover:border-[var(--color-border-brand-bold)]"
64
+ },
65
+ disabled: {
66
+ true: "cursor-not-allowed opacity-50",
67
+ false: "cursor-pointer"
68
+ }
69
+ },
70
+ defaultVariants: {
71
+ isDragActive: !1,
72
+ disabled: !1
73
+ }
74
+ }
75
+ ), k = /* @__PURE__ */ n.forwardRef(({ className: r, children: e, ...o }, t) => {
76
+ const {
77
+ files: l,
78
+ onFilesChange: i,
79
+ maxFiles: m,
80
+ maxSize: c,
81
+ accept: p,
82
+ disabled: u,
83
+ multiple: x
84
+ } = D(), [w, g] = n.useState(!1), y = n.useRef(null), O = (a) => {
85
+ if (c && a.size > c)
86
+ return `File size must be less than ${E(c)}`;
87
+ if (p && p.length > 0) {
88
+ const d = a.type, N = `.${a.name.split(".").pop()?.toLowerCase()}`;
89
+ if (!p.some((f) => {
90
+ if (f.startsWith("."))
91
+ return f.toLowerCase() === N;
92
+ if (f.includes("*")) {
93
+ const F = f.split("/")[0];
94
+ return d.startsWith(F);
95
+ }
96
+ return d === f;
97
+ }))
98
+ return `File type not supported. Accepted types: ${p.join(", ")}`;
99
+ }
100
+ return null;
101
+ }, I = (a) => {
102
+ const d = [], N = l.length;
103
+ Array.from(a).forEach((h, f) => {
104
+ if (m && N + d.length >= m) return;
105
+ const F = O(h), R = {
106
+ id: `${Date.now()}-${f}`,
107
+ file: h,
108
+ status: F ? "error" : "pending",
109
+ error: F || void 0,
110
+ progress: 0
111
+ };
112
+ if (h.type.startsWith("image/")) {
113
+ const C = new FileReader();
114
+ C.onload = (J) => {
115
+ const Q = l.map(
116
+ (U) => U.id === R.id ? { ...U, preview: J.target?.result } : U
117
+ );
118
+ i(Q);
119
+ }, C.readAsDataURL(h);
120
+ }
121
+ d.push(R);
122
+ }), d.length > 0 && i([...l, ...d]);
123
+ }, S = (a) => {
124
+ a.preventDefault(), a.stopPropagation(), u || g(!0);
125
+ }, G = (a) => {
126
+ a.preventDefault(), a.stopPropagation(), g(!1);
127
+ }, K = (a) => {
128
+ if (a.preventDefault(), a.stopPropagation(), g(!1), u) return;
129
+ const d = a.dataTransfer.files;
130
+ d.length > 0 && I(d);
131
+ }, q = () => {
132
+ u || y.current?.click();
133
+ }, H = (a) => {
134
+ const d = a.target.files;
135
+ d && I(d), a.target.value = "";
136
+ };
137
+ return /* @__PURE__ */ b(
138
+ "div",
139
+ {
140
+ ref: t,
141
+ className: v(_({ isDragActive: w, disabled: u }), r),
142
+ onDragOver: S,
143
+ onDragLeave: G,
144
+ onDrop: K,
145
+ onClick: q,
146
+ role: "button",
147
+ tabIndex: u ? -1 : 0,
148
+ "aria-label": "Upload files",
149
+ ...o,
150
+ children: [
151
+ /* @__PURE__ */ s(
152
+ "input",
153
+ {
154
+ ref: y,
155
+ type: "file",
156
+ multiple: x,
157
+ accept: p?.join(","),
158
+ disabled: u,
159
+ className: "hidden",
160
+ onChange: H
161
+ }
162
+ ),
163
+ e
164
+ ]
165
+ }
166
+ );
167
+ });
168
+ k.displayName = "FileUploadDropzone";
169
+ const L = /* @__PURE__ */ n.forwardRef(({ children: r, ...e }, o) => {
170
+ const { disabled: t } = D();
171
+ return /* @__PURE__ */ s(P, { ref: o, disabled: t, ...e, children: r });
172
+ });
173
+ L.displayName = "FileUploadTrigger";
174
+ const A = /* @__PURE__ */ n.forwardRef(
175
+ ({ className: r, children: e, ...o }, t) => /* @__PURE__ */ s("div", { ref: t, className: v("space-y-2", r), ...o, children: e })
176
+ );
177
+ A.displayName = "FileUploadList";
178
+ const B = /* @__PURE__ */ n.forwardRef(
179
+ ({ className: r, file: e, children: o, ...t }, l) => /* @__PURE__ */ s(
180
+ "div",
181
+ {
182
+ ref: l,
183
+ className: v(
184
+ "flex items-center gap-3 rounded-l border p-3",
185
+ "border-[var(--color-border-primary)]",
186
+ e.status === "error" && "border-[var(--color-border-error-bold)] bg-[var(--color-background-error-subtle)]",
187
+ e.status === "success" && "border-[var(--color-border-success-bold)] bg-[var(--color-background-success-subtle)]",
188
+ r
189
+ ),
190
+ ...t,
191
+ children: o
192
+ }
193
+ )
194
+ );
195
+ B.displayName = "FileUploadItem";
196
+ const W = /* @__PURE__ */ n.forwardRef(({ className: r, file: e, ...o }, t) => {
197
+ const l = (i) => i.startsWith("image/") ? "image" : i.startsWith("video/") ? "video" : i.startsWith("audio/") ? "volume-2" : i.includes("pdf") || i.includes("text/") || i.includes("application/json") ? "file-text" : "file";
198
+ return /* @__PURE__ */ s(
199
+ "div",
200
+ {
201
+ ref: t,
202
+ className: v(
203
+ "flex h-10 w-10 items-center justify-center rounded",
204
+ r
205
+ ),
206
+ ...o,
207
+ children: e.preview ? /* @__PURE__ */ s(
208
+ "img",
209
+ {
210
+ src: e.preview,
211
+ alt: e.file.name,
212
+ className: "h-full w-full rounded object-cover"
213
+ }
214
+ ) : /* @__PURE__ */ s(
215
+ z,
216
+ {
217
+ name: l(e.file.type),
218
+ className: "h-5 w-5 text-[var(--color-text-secondary)]"
219
+ }
220
+ )
221
+ }
222
+ );
223
+ });
224
+ W.displayName = "FileUploadItemPreview";
225
+ const $ = /* @__PURE__ */ n.forwardRef(({ className: r, file: e, ...o }, t) => /* @__PURE__ */ b("div", { ref: t, className: v("flex-1 space-y-1", r), ...o, children: [
226
+ /* @__PURE__ */ b("div", { className: "flex items-center gap-2", children: [
227
+ /* @__PURE__ */ s("p", { className: "text-body-sm truncate font-medium", children: e.file.name }),
228
+ /* @__PURE__ */ s(Z, { children: e.status })
229
+ ] }),
230
+ /* @__PURE__ */ s("p", { className: "text-caption-sm text-[var(--color-text-secondary)]", children: E(e.file.size) }),
231
+ e.error && /* @__PURE__ */ s("p", { className: "text-caption-sm text-[var(--color-text-error-bold)]", children: e.error })
232
+ ] }));
233
+ $.displayName = "FileUploadItemMetadata";
234
+ const V = /* @__PURE__ */ n.forwardRef(({ className: r, file: e, variant: o = "linear", ...t }, l) => e.status !== "uploading" || e.progress === void 0 ? null : /* @__PURE__ */ b("div", { ref: l, className: v("w-full", r), ...t, children: [
235
+ /* @__PURE__ */ s(Y, { value: e.progress, className: "h-2" }),
236
+ /* @__PURE__ */ b("p", { className: "text-caption-sm mt-1 text-[var(--color-text-secondary)]", children: [
237
+ Math.round(e.progress),
238
+ "%"
239
+ ] })
240
+ ] }));
241
+ V.displayName = "FileUploadItemProgress";
242
+ const T = /* @__PURE__ */ n.forwardRef(({ file: r, ...e }, o) => {
243
+ const { files: t, onFilesChange: l } = D();
244
+ return /* @__PURE__ */ s(
245
+ P,
246
+ {
247
+ ref: o,
248
+ variant: "ghost",
249
+ size: "s",
250
+ onClick: () => {
251
+ const m = t.filter((c) => c.id !== r.id);
252
+ l(m);
253
+ },
254
+ "aria-label": `Remove ${r.file.name}`,
255
+ ...e,
256
+ children: /* @__PURE__ */ s(z, { name: "x", className: "h-4 w-4" })
257
+ }
258
+ );
259
+ });
260
+ T.displayName = "FileUploadItemDelete";
261
+ const E = (r) => {
262
+ if (r === 0) return "0 Bytes";
263
+ const e = 1024, o = ["Bytes", "KB", "MB", "GB"], t = Math.floor(Math.log(r) / Math.log(e));
264
+ return parseFloat((r / Math.pow(e, t)).toFixed(2)) + " " + o[t];
265
+ }, ne = {
266
+ Root: j,
267
+ Dropzone: k,
268
+ Trigger: L,
269
+ List: A,
270
+ Item: B,
271
+ ItemPreview: W,
272
+ ItemMetadata: $,
273
+ ItemProgress: V,
274
+ ItemDelete: T
275
+ };
276
+ export {
277
+ ne as FileUpload,
278
+ k as FileUploadDropzone,
279
+ B as FileUploadItem,
280
+ T as FileUploadItemDelete,
281
+ $ as FileUploadItemMetadata,
282
+ W as FileUploadItemPreview,
283
+ V as FileUploadItemProgress,
284
+ A as FileUploadList,
285
+ j as FileUploadRoot,
286
+ L as FileUploadTrigger,
287
+ E as formatFileSize,
288
+ D as useFileUpload
289
+ };
@@ -0,0 +1,60 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { cn as l } from "../../lib/utils.js";
3
+ const g = {
4
+ s: {
5
+ width: "w-[var(--size-3xs)]",
6
+ // 12px
7
+ height: "h-[9px]"
8
+ // 12 * 0.75 = 9px for 4:3 aspect ratio
9
+ },
10
+ m: {
11
+ width: "w-[var(--size-2xs)]",
12
+ // 16px
13
+ height: "h-[12px]"
14
+ // 16 * 0.75 = 12px for 4:3 aspect ratio
15
+ },
16
+ l: {
17
+ width: "w-[var(--size-xs)]",
18
+ // 20px
19
+ height: "h-[15px]"
20
+ // 20 * 0.75 = 15px for 4:3 aspect ratio
21
+ },
22
+ xl: {
23
+ width: "w-[var(--size-s)]",
24
+ // 24px
25
+ height: "h-[18px]"
26
+ // 24 * 0.75 = 18px for 4:3 aspect ratio
27
+ }
28
+ };
29
+ function d({
30
+ country: e,
31
+ size: s = "m",
32
+ className: t,
33
+ "aria-label": a,
34
+ ...r
35
+ }) {
36
+ if (!e)
37
+ return null;
38
+ const i = g[s], h = e.toLowerCase();
39
+ return /* @__PURE__ */ o(
40
+ "div",
41
+ {
42
+ className: l(
43
+ "inline-block rounded-[2px] shadow-[inset_0_0_0_1px_rgba(85,95,109,0.1)] bg-cover bg-center bg-no-repeat",
44
+ i.width,
45
+ i.height,
46
+ t
47
+ ),
48
+ style: {
49
+ backgroundImage: `url(https://flagcdn.com/${h}.svg)`
50
+ },
51
+ role: "img",
52
+ "aria-label": a || `${e.toUpperCase()} flag`,
53
+ ...r
54
+ }
55
+ );
56
+ }
57
+ export {
58
+ d as Flag,
59
+ g as flagSizes
60
+ };