@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.
- package/README.md +20 -8
- package/dist/cjs/components/core-index.cjs +1 -0
- package/dist/cjs/components/fundamental/accordion.cjs +1 -0
- package/dist/cjs/components/fundamental/alert-dialog.cjs +1 -0
- package/dist/cjs/components/fundamental/alert.cjs +1 -0
- package/dist/cjs/components/fundamental/autocomplete-search.cjs +1 -0
- package/dist/cjs/components/fundamental/avatar-group.cjs +1 -0
- package/dist/cjs/components/fundamental/avatar.cjs +1 -0
- package/dist/cjs/components/fundamental/badge.cjs +1 -0
- package/dist/cjs/components/fundamental/breadcrumb.cjs +1 -0
- package/dist/cjs/components/fundamental/button-group.cjs +1 -0
- package/dist/cjs/components/fundamental/button.cjs +1 -0
- package/dist/cjs/components/fundamental/calendar.cjs +1 -0
- package/dist/cjs/components/fundamental/card.cjs +1 -0
- package/dist/cjs/components/fundamental/chart.cjs +1 -0
- package/dist/cjs/components/fundamental/checkbox.cjs +1 -0
- package/dist/cjs/components/fundamental/collapsible.cjs +1 -0
- package/dist/cjs/components/fundamental/combobox.cjs +1 -0
- package/dist/cjs/components/fundamental/command.cjs +1 -0
- package/dist/cjs/components/fundamental/country-dropdown.cjs +1 -0
- package/dist/cjs/components/fundamental/custom-icons.cjs +1 -0
- package/dist/cjs/components/fundamental/date-picker.cjs +1 -0
- package/dist/cjs/components/fundamental/dialog.cjs +1 -0
- package/dist/cjs/components/fundamental/drawer.cjs +1 -0
- package/dist/cjs/components/fundamental/dropdown-menu.cjs +1 -0
- package/dist/cjs/components/fundamental/editable.cjs +1 -0
- package/dist/cjs/components/fundamental/empty.cjs +1 -0
- package/dist/cjs/components/fundamental/file-upload.cjs +1 -0
- package/dist/cjs/components/fundamental/flag.cjs +1 -0
- package/dist/cjs/components/fundamental/form-field.cjs +1 -0
- package/dist/cjs/components/fundamental/hover-card.cjs +1 -0
- package/dist/cjs/components/fundamental/icon.cjs +1 -0
- package/dist/cjs/components/fundamental/input-group.cjs +1 -0
- package/dist/cjs/components/fundamental/input.cjs +1 -0
- package/dist/cjs/components/fundamental/kbd.cjs +1 -0
- package/dist/cjs/components/fundamental/label.cjs +1 -0
- package/dist/cjs/components/fundamental/month-picker.cjs +1 -0
- package/dist/cjs/components/fundamental/pagination.cjs +1 -0
- package/dist/cjs/components/fundamental/popover.cjs +1 -0
- package/dist/cjs/components/fundamental/progress.cjs +1 -0
- package/dist/cjs/components/fundamental/radio-group.cjs +1 -0
- package/dist/cjs/components/fundamental/resizable.cjs +1 -0
- package/dist/cjs/components/fundamental/scroll-area.cjs +1 -0
- package/dist/cjs/components/fundamental/select.cjs +1 -0
- package/dist/cjs/components/fundamental/separator.cjs +1 -0
- package/dist/cjs/components/fundamental/sheet.cjs +1 -0
- package/dist/cjs/components/fundamental/sidebar.cjs +1 -0
- package/dist/cjs/components/fundamental/skeleton.cjs +1 -0
- package/dist/cjs/components/fundamental/slider.cjs +1 -0
- package/dist/cjs/components/fundamental/spinner.cjs +1 -0
- package/dist/cjs/components/fundamental/switch.cjs +1 -0
- package/dist/cjs/components/fundamental/table.cjs +1 -0
- package/dist/cjs/components/fundamental/tabs.cjs +1 -0
- package/dist/cjs/components/fundamental/tag.cjs +27 -0
- package/dist/cjs/components/fundamental/text-link.cjs +1 -0
- package/dist/cjs/components/fundamental/textarea.cjs +1 -0
- package/dist/cjs/components/fundamental/toast.cjs +1 -0
- package/dist/cjs/components/fundamental/toggle-group.cjs +1 -0
- package/dist/cjs/components/fundamental/toggle.cjs +1 -0
- package/dist/cjs/components/fundamental/tooltip.cjs +1 -0
- package/dist/cjs/components/fundamental/tree.cjs +1 -0
- package/dist/cjs/components/product/activity-log.cjs +1 -0
- package/dist/cjs/components/product/app-frame.cjs +1 -0
- package/dist/cjs/components/product/attributes-list.cjs +1 -0
- package/dist/cjs/components/product/bookmarks.cjs +1 -0
- package/dist/cjs/components/product/data-table-settings-menu.cjs +1 -0
- package/dist/cjs/components/product/data-table.cjs +1 -0
- package/dist/cjs/components/product/filters.cjs +1 -0
- package/dist/cjs/components/product/fixture-status.cjs +1 -0
- package/dist/cjs/components/product/linked-chart.cjs +1 -0
- package/dist/cjs/components/product/view-mode-menu.cjs +1 -0
- package/dist/cjs/lib/date-utils.cjs +1 -0
- package/dist/cjs/lib/hooks.cjs +1 -0
- package/dist/cjs/lib/index.cjs +1 -0
- package/dist/cjs/lib/utils.cjs +1 -0
- package/dist/es/components/core-index.js +37 -0
- package/dist/es/components/fundamental/accordion.js +60 -0
- package/dist/es/components/fundamental/alert-dialog.js +116 -0
- package/dist/es/components/fundamental/alert.js +65 -0
- package/dist/es/components/fundamental/autocomplete-search.js +139 -0
- package/dist/es/components/fundamental/avatar-group.js +51 -0
- package/dist/es/components/fundamental/avatar.js +165 -0
- package/dist/es/components/fundamental/badge.js +157 -0
- package/dist/es/components/fundamental/breadcrumb.js +142 -0
- package/dist/es/components/fundamental/button-group.js +86 -0
- package/dist/es/components/fundamental/button.js +186 -0
- package/dist/es/components/fundamental/calendar.js +130 -0
- package/dist/es/components/fundamental/card.js +68 -0
- package/dist/es/components/fundamental/chart.js +1006 -0
- package/dist/es/components/fundamental/checkbox.js +51 -0
- package/dist/es/components/fundamental/collapsible.js +55 -0
- package/dist/es/components/fundamental/combobox.js +229 -0
- package/dist/es/components/fundamental/command.js +155 -0
- package/dist/es/components/fundamental/country-dropdown.js +215 -0
- package/dist/es/components/fundamental/custom-icons.js +876 -0
- package/dist/es/components/fundamental/date-picker.js +119 -0
- package/dist/es/components/fundamental/dialog.js +106 -0
- package/dist/es/components/fundamental/drawer.js +93 -0
- package/dist/es/components/fundamental/dropdown-menu.js +600 -0
- package/dist/es/components/fundamental/editable.js +123 -0
- package/dist/es/components/fundamental/empty.js +152 -0
- package/dist/es/components/fundamental/file-upload.js +289 -0
- package/dist/es/components/fundamental/flag.js +60 -0
- package/dist/es/components/fundamental/form-field.js +352 -0
- package/dist/es/components/fundamental/hover-card.js +23 -0
- package/dist/es/components/fundamental/icon.js +200 -0
- package/dist/es/components/fundamental/input-group.js +135 -0
- package/dist/es/components/fundamental/input.js +78 -0
- package/dist/es/components/fundamental/kbd.js +57 -0
- package/dist/es/components/fundamental/label.js +54 -0
- package/dist/es/components/fundamental/month-picker.js +161 -0
- package/dist/es/components/fundamental/pagination.js +109 -0
- package/dist/es/components/fundamental/popover.js +24 -0
- package/dist/es/components/fundamental/progress.js +66 -0
- package/dist/es/components/fundamental/radio-group.js +64 -0
- package/dist/es/components/fundamental/resizable.js +43 -0
- package/dist/es/components/fundamental/scroll-area.js +38 -0
- package/dist/es/components/fundamental/select.js +136 -0
- package/dist/es/components/fundamental/separator.js +47 -0
- package/dist/es/components/fundamental/sheet.js +134 -0
- package/dist/es/components/fundamental/sidebar.js +709 -0
- package/dist/es/components/fundamental/skeleton.js +158 -0
- package/dist/es/components/fundamental/slider.js +35 -0
- package/dist/es/components/fundamental/spinner.js +225 -0
- package/dist/es/components/fundamental/switch.js +27 -0
- package/dist/es/components/fundamental/table.js +263 -0
- package/dist/es/components/fundamental/tabs.js +170 -0
- package/dist/es/components/fundamental/tag.js +295 -0
- package/dist/es/components/fundamental/text-link.js +105 -0
- package/dist/es/components/fundamental/textarea.js +47 -0
- package/dist/es/components/fundamental/toast.js +108 -0
- package/dist/es/components/fundamental/toggle-group.js +37 -0
- package/dist/es/components/fundamental/toggle.js +51 -0
- package/dist/es/components/fundamental/tooltip.js +26 -0
- package/dist/es/components/fundamental/tree.js +161 -0
- package/dist/es/components/product/activity-log.js +231 -0
- package/dist/es/components/product/app-frame.js +985 -0
- package/dist/es/components/product/attributes-list.js +351 -0
- package/dist/es/components/product/bookmarks.js +833 -0
- package/dist/es/components/product/data-table-settings-menu.js +169 -0
- package/dist/es/components/product/data-table.js +2473 -0
- package/dist/es/components/product/filters.js +1041 -0
- package/dist/es/components/product/fixture-status.js +178 -0
- package/dist/es/components/product/linked-chart.js +179 -0
- package/dist/es/components/product/view-mode-menu.js +353 -0
- package/dist/es/lib/date-utils.js +151 -0
- package/dist/es/lib/hooks.js +29 -0
- package/dist/es/lib/index.js +348 -0
- package/dist/es/lib/utils.js +8 -0
- package/dist/es/style.css +1 -0
- package/dist/types/bookmarks.d.ts +2 -0
- package/dist/types/calendar.d.ts +2 -0
- package/dist/types/chart.d.ts +2 -0
- package/dist/types/components/core-index.d.cts +135 -0
- package/dist/types/components/core-index.d.ts +135 -0
- package/dist/{components → types/components}/fundamental/avatar.d.ts +3 -3
- package/dist/{components → types/components}/fundamental/badge.d.ts +2 -2
- package/dist/{components → types/components}/fundamental/button-group.d.ts +2 -2
- package/dist/{components → types/components}/fundamental/button.d.ts +1 -1
- package/dist/types/components/fundamental/calendar.d.ts +7 -0
- package/dist/types/components/fundamental/chart.d.ts +95 -0
- package/dist/{components → types/components}/fundamental/command.d.ts +2 -2
- package/dist/types/components/fundamental/country-dropdown.d.ts +34 -0
- package/dist/types/components/fundamental/date-picker.d.ts +30 -0
- package/dist/{components → types/components}/fundamental/file-upload.d.ts +1 -1
- package/dist/{components → types/components}/fundamental/form-field.d.ts +2 -2
- package/dist/{components → types/components}/fundamental/form.d.ts +2 -2
- package/dist/{components → types/components}/fundamental/icon.d.ts +1 -1
- package/dist/{components → types/components}/fundamental/input-group.d.ts +1 -1
- package/dist/types/components/fundamental/resizable.d.cts +23 -0
- package/dist/{components → types/components}/fundamental/resizable.d.ts +1 -1
- package/dist/{components → types/components}/fundamental/sidebar.d.ts +3 -3
- package/dist/{components → types/components}/fundamental/spinner.d.ts +1 -1
- package/dist/{components → types/components}/fundamental/table.d.ts +3 -3
- package/dist/{components → types/components}/fundamental/text-link.d.ts +1 -1
- package/dist/{components → types/components}/index.d.ts +118 -118
- package/dist/{components → types/components}/product/activity-log.d.ts +1 -1
- package/dist/{components → types/components}/product/attributes-list.d.ts +1 -1
- package/dist/types/components/product/bookmarks.d.cts +90 -0
- package/dist/{components → types/components}/product/bookmarks.d.ts +1 -1
- package/dist/types/components/product/data-table.d.ts +802 -0
- package/dist/types/components/product/filters.d.ts +124 -0
- package/dist/{components → types/components}/product/fixture-status.d.ts +1 -1
- package/dist/types/components/product/linked-chart.d.cts +22 -0
- package/dist/{components → types/components}/product/linked-chart.d.ts +1 -1
- package/dist/types/country-dropdown.d.ts +2 -0
- package/dist/types/data-table.d.ts +2 -0
- package/dist/types/date-picker.d.ts +2 -0
- package/dist/types/filters.d.ts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/lib/index.d.cts +104 -0
- package/dist/types/lib/index.d.ts +104 -0
- package/dist/types/linked-chart.d.ts +2 -0
- package/dist/types/resizable.d.ts +2 -0
- package/package.json +191 -31
- package/dist/index.cjs.js +0 -144
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.es.js +0 -87768
- package/dist/index.es.js.map +0 -1
- package/dist/lib/index.d.ts +0 -3
- package/dist/style.css +0 -1
- /package/dist/{components → types/components}/fundamental/accordion.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/alert-dialog.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/alert.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/autocomplete-search.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/avatar-group.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/breadcrumb.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/button.test.d.ts +0 -0
- /package/dist/{components/fundamental/calendar.d.ts → types/components/fundamental/calendar.d.cts} +0 -0
- /package/dist/{components → types/components}/fundamental/card.d.ts +0 -0
- /package/dist/{components/fundamental/chart.d.ts → types/components/fundamental/chart.d.cts} +0 -0
- /package/dist/{components → types/components}/fundamental/checkbox.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/collapsible.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/combobox.d.ts +0 -0
- /package/dist/{components/fundamental/country-dropdown.d.ts → types/components/fundamental/country-dropdown.d.cts} +0 -0
- /package/dist/{components → types/components}/fundamental/custom-icons.d.ts +0 -0
- /package/dist/{components/fundamental/date-picker.d.ts → types/components/fundamental/date-picker.d.cts} +0 -0
- /package/dist/{components → types/components}/fundamental/dialog.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/drawer.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/dropdown-menu.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/editable.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/empty.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/flag.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/hover-card.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/input.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/kbd.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/label.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/month-picker.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/pagination.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/popover.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/progress.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/radio-group.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/scroll-area.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/select.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/separator.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/sheet.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/skeleton.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/slider.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/switch.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/tabs.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/tag.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/textarea.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/toast.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/toggle-group.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/toggle.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/tooltip.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/tree.d.ts +0 -0
- /package/dist/{components → types/components}/product/app-frame.d.ts +0 -0
- /package/dist/{components → types/components}/product/data-table-settings-menu.d.ts +0 -0
- /package/dist/{components/product/data-table.d.ts → types/components/product/data-table.d.cts} +0 -0
- /package/dist/{components/product/filters.d.ts → types/components/product/filters.d.cts} +0 -0
- /package/dist/{components → types/components}/product/view-mode-menu.d.ts +0 -0
- /package/dist/{lib → types/lib}/date-utils.d.ts +0 -0
- /package/dist/{lib → types/lib}/hooks.d.ts +0 -0
- /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
|
+
};
|