@chotot/clad-ui 3.0.0-next.6 → 3.0.1
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/CHANGELOG.md +32 -0
- package/README.md +9 -9
- package/dist/{chunk-Bmb41Sf3.cjs → _virtual/_rolldown/runtime.cjs} +1 -1
- package/dist/brand/ChototLogoText.cjs +1 -0
- package/dist/brand/ChototLogoText.es.js +15 -0
- package/dist/brand/CtC2C.cjs +1 -0
- package/dist/brand/CtC2C.es.js +18 -0
- package/dist/brand/CtProperty.cjs +1 -0
- package/dist/brand/CtProperty.es.js +204 -0
- package/dist/brand/CtVehicle.cjs +1 -0
- package/dist/brand/CtVehicle.es.js +70 -0
- package/dist/brand/Tot.cjs +1 -0
- package/dist/brand/Tot.es.js +17 -0
- package/dist/components/Announcer/Announcer.cjs +1 -0
- package/dist/components/Announcer/Announcer.es.js +100 -0
- package/dist/components/Announcer/announcer.styles.cjs +1 -0
- package/dist/components/Announcer/announcer.styles.es.js +24 -0
- package/dist/components/Badge/Badge.cjs +1 -0
- package/dist/components/Badge/Badge.es.js +83 -0
- package/dist/components/Badge/badge.styles.cjs +1 -0
- package/dist/components/Badge/badge.styles.es.js +83 -0
- package/dist/components/Box/Box.cjs +1 -0
- package/dist/components/Box/Box.es.js +72 -0
- package/dist/components/Breadcrumbs/BreadcrumbItem.cjs +1 -0
- package/dist/components/Breadcrumbs/BreadcrumbItem.es.js +17 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.es.js +44 -0
- package/dist/components/Breadcrumbs/breadcrumbs.styles.cjs +1 -0
- package/dist/components/Breadcrumbs/breadcrumbs.styles.es.js +5 -0
- package/dist/components/Button/Button.cjs +1 -0
- package/dist/components/Button/Button.es.js +41 -0
- package/dist/components/Button/ButtonLink.cjs +1 -0
- package/dist/components/Button/ButtonLink.es.js +5 -0
- package/dist/components/Button/GhostButton.cjs +1 -0
- package/dist/components/Button/GhostButton.es.js +25 -0
- package/dist/components/Button/IconButton.cjs +1 -0
- package/dist/components/Button/IconButton.es.js +13 -0
- package/dist/components/Button/button.styles.cjs +1 -0
- package/dist/components/Button/button.styles.es.js +100 -0
- package/dist/components/Checkbox/Checkbox.cjs +1 -0
- package/dist/components/Checkbox/Checkbox.es.js +43 -0
- package/dist/components/Checkbox/checkbox.styles.cjs +1 -0
- package/dist/components/Checkbox/checkbox.styles.es.js +15 -0
- package/dist/components/Chip/Chip.cjs +1 -0
- package/dist/components/Chip/Chip.es.js +35 -0
- package/dist/components/Chip/chip.styles.cjs +1 -0
- package/dist/components/Chip/chip.styles.es.js +33 -0
- package/dist/components/CurrencyInput/CurrencyInput.cjs +1 -0
- package/dist/components/CurrencyInput/CurrencyInput.es.js +142 -0
- package/dist/components/CurrencyInput/currency-input.styles.cjs +1 -0
- package/dist/components/CurrencyInput/currency-input.styles.es.js +13 -0
- package/dist/components/CurrencyInput/utils.cjs +1 -0
- package/dist/components/CurrencyInput/utils.es.js +30 -0
- package/dist/components/DatePicker/DatePicker.cjs +1 -0
- package/dist/components/DatePicker/DatePicker.es.js +354 -0
- package/dist/components/DatePicker/DateTimePicker.cjs +1 -0
- package/dist/components/DatePicker/DateTimePicker.es.js +416 -0
- package/dist/components/DatePicker/date-picker.styles.cjs +1 -0
- package/dist/components/DatePicker/date-picker.styles.es.js +8 -0
- package/dist/components/DatePicker/date-time-picker.styles.cjs +1 -0
- package/dist/components/DatePicker/date-time-picker.styles.es.js +8 -0
- package/dist/components/DatePicker/index.d.ts +2 -1
- package/dist/components/DatePicker/types.cjs +1 -0
- package/dist/components/DatePicker/types.es.js +6 -0
- package/dist/components/Drawer/Drawer.cjs +1 -0
- package/dist/components/Drawer/Drawer.es.js +407 -0
- package/dist/components/Dropdown/Dropdown.cjs +1 -0
- package/dist/components/Dropdown/Dropdown.es.js +145 -0
- package/dist/components/Dropdown/dropdown.styles.cjs +1 -0
- package/dist/components/Dropdown/dropdown.styles.es.js +12 -0
- package/dist/components/EmptyState/EmptyState.cjs +2 -0
- package/dist/components/EmptyState/EmptyState.es.js +114 -0
- package/dist/components/EmptyState/empty-state.styles.cjs +1 -0
- package/dist/components/EmptyState/empty-state.styles.es.js +5 -0
- package/dist/components/Grid/Col.cjs +1 -0
- package/dist/components/Grid/Col.es.js +37 -0
- package/dist/components/Grid/Grid.cjs +1 -0
- package/dist/components/Grid/Grid.es.js +66 -0
- package/dist/components/Input/Input.cjs +1 -0
- package/dist/components/Input/Input.es.js +122 -0
- package/dist/components/Input/input.styles.cjs +1 -0
- package/dist/components/Input/input.styles.es.js +14 -0
- package/dist/components/InputGroup/InputGroup.cjs +1 -0
- package/dist/components/InputGroup/InputGroup.es.js +16 -0
- package/dist/components/InputGroup/input-group.styles.cjs +1 -0
- package/dist/components/InputGroup/input-group.styles.es.js +12 -0
- package/dist/components/LegacyDialog/DialogMainIcon.cjs +1 -0
- package/dist/components/LegacyDialog/DialogMainIcon.es.js +52 -0
- package/dist/components/LegacyDialog/LegacyDialog.cjs +1 -0
- package/dist/components/LegacyDialog/LegacyDialog.es.js +54 -0
- package/dist/components/LegacyPopup/LegacyPopup.cjs +1 -0
- package/dist/components/LegacyPopup/LegacyPopup.es.js +72 -0
- package/dist/components/MultiSearchDropdown/MultiSearchDropdown.cjs +1 -0
- package/dist/components/MultiSearchDropdown/MultiSearchDropdown.es.js +206 -0
- package/dist/components/MultiSearchDropdown/multi-search-dropdown.styles.cjs +1 -0
- package/dist/components/MultiSearchDropdown/multi-search-dropdown.styles.es.js +12 -0
- package/dist/components/Pagination/PageItem.cjs +1 -0
- package/dist/components/Pagination/PageItem.es.js +20 -0
- package/dist/components/Pagination/Pagination.cjs +1 -0
- package/dist/components/Pagination/Pagination.es.js +84 -0
- package/dist/components/Pagination/pagination.styles.cjs +1 -0
- package/dist/components/Pagination/pagination.styles.es.js +15 -0
- package/dist/components/Pagination/types.d.ts +1 -1
- package/dist/components/Popover/Popover.cjs +1 -0
- package/dist/components/Popover/Popover.es.js +54 -0
- package/dist/components/Popover/popover.styles.cjs +1 -0
- package/dist/components/Popover/popover.styles.es.js +5 -0
- package/dist/components/Popup/Popup.cjs +1 -0
- package/dist/components/Popup/Popup.es.js +148 -0
- package/dist/components/RadioButton/RadioButton.cjs +1 -0
- package/dist/components/RadioButton/RadioButton.es.js +61 -0
- package/dist/components/RadioButton/radio-button.styles.cjs +1 -0
- package/dist/components/RadioButton/radio-button.styles.es.js +15 -0
- package/dist/components/RangeInput/RangeInput.cjs +1 -0
- package/dist/components/RangeInput/RangeInput.es.js +32 -0
- package/dist/components/RangeInput/range-input.styles.cjs +1 -0
- package/dist/components/RangeInput/range-input.styles.es.js +5 -0
- package/dist/components/RowItem/RowItem.cjs +1 -0
- package/dist/components/RowItem/RowItem.es.js +56 -0
- package/dist/components/RowItem/rowitem.styles.cjs +1 -0
- package/dist/components/RowItem/rowitem.styles.es.js +23 -0
- package/dist/components/SearchInput/SearchInput.cjs +1 -0
- package/dist/components/SearchInput/SearchInput.es.js +129 -0
- package/dist/components/SearchInput/search-input.styles.cjs +1 -0
- package/dist/components/SearchInput/search-input.styles.es.js +12 -0
- package/dist/components/Searchbar/Searchbar.cjs +1 -0
- package/dist/components/Searchbar/Searchbar.es.js +51 -0
- package/dist/components/Searchbar/searchbar.styles.cjs +1 -0
- package/dist/components/Searchbar/searchbar.styles.es.js +5 -0
- package/dist/components/ShapeIcon/ShapeIcon.cjs +1 -0
- package/dist/components/ShapeIcon/ShapeIcon.es.js +22 -0
- package/dist/components/ShapeIcon/shape-icon.styles.cjs +1 -0
- package/dist/components/ShapeIcon/shape-icon.styles.es.js +65 -0
- package/dist/components/Slider/Slider.cjs +1 -0
- package/dist/components/Slider/Slider.es.js +169 -0
- package/dist/components/Slider/slider.styles.cjs +1 -0
- package/dist/components/Slider/slider.styles.es.js +5 -0
- package/dist/components/Snack/Snack.cjs +1 -0
- package/dist/components/Snack/Snack.es.js +69 -0
- package/dist/components/Snack/snack.styles.cjs +1 -0
- package/dist/components/Snack/snack.styles.es.js +13 -0
- package/dist/components/Tabs/Tab.cjs +1 -0
- package/dist/components/Tabs/Tab.es.js +42 -0
- package/dist/components/Tabs/Tabs.cjs +1 -0
- package/dist/components/Tabs/Tabs.es.js +80 -0
- package/dist/components/Tabs/tabs.styles.cjs +1 -0
- package/dist/components/Tabs/tabs.styles.es.js +33 -0
- package/dist/components/TagCloud/TagCloud.cjs +1 -0
- package/dist/components/TagCloud/TagCloud.es.js +47 -0
- package/dist/components/TagCloud/tagcloud.styles.cjs +1 -0
- package/dist/components/TagCloud/tagcloud.styles.es.js +12 -0
- package/dist/components/TextArea/TextArea.cjs +1 -0
- package/dist/components/TextArea/TextArea.es.js +104 -0
- package/dist/components/TextArea/text-area.styles.cjs +1 -0
- package/dist/components/TextArea/text-area.styles.es.js +13 -0
- package/dist/components/TextLabel/TextLabel.cjs +1 -0
- package/dist/components/TextLabel/TextLabel.es.js +28 -0
- package/dist/components/TextLabel/textlabel.styles.cjs +1 -0
- package/dist/components/TextLabel/textlabel.styles.es.js +29 -0
- package/dist/components/ToggleSwitch/ToggleSwitch.cjs +1 -0
- package/dist/components/ToggleSwitch/ToggleSwitch.es.js +37 -0
- package/dist/components/ToggleSwitch/toggle-switch.styles.cjs +1 -0
- package/dist/components/ToggleSwitch/toggle-switch.styles.es.js +24 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -0
- package/dist/components/Tooltip/Tooltip.es.js +103 -0
- package/dist/components/Tooltip/tooltip.styles.cjs +1 -0
- package/dist/components/Tooltip/tooltip.styles.es.js +12 -0
- package/dist/forge/index.cjs +1 -0
- package/dist/forge/index.d.ts +6 -3
- package/dist/icons.cjs +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.es.js +82 -0
- package/dist/styles.css +1 -1
- package/dist/types/index.cjs +1 -0
- package/dist/types/index.es.js +7 -0
- package/dist/typography/BodyAnnotation.cjs +1 -0
- package/dist/typography/BodyAnnotation.es.js +10 -0
- package/dist/typography/BodyCaption.cjs +1 -0
- package/dist/typography/BodyCaption.es.js +10 -0
- package/dist/typography/BodyPage.cjs +1 -0
- package/dist/typography/BodyPage.es.js +10 -0
- package/dist/typography/BodySection.cjs +1 -0
- package/dist/typography/BodySection.es.js +10 -0
- package/dist/typography/DisplayAnnotation.cjs +1 -0
- package/dist/typography/DisplayAnnotation.es.js +10 -0
- package/dist/typography/DisplayCaption.cjs +1 -0
- package/dist/typography/DisplayCaption.es.js +10 -0
- package/dist/typography/DisplayPage.cjs +1 -0
- package/dist/typography/DisplayPage.es.js +10 -0
- package/dist/typography/DisplayPrice.cjs +1 -0
- package/dist/typography/DisplayPrice.es.js +10 -0
- package/dist/typography/DisplaySection.cjs +1 -0
- package/dist/typography/DisplaySection.es.js +10 -0
- package/dist/typography/HeaderAnnotation.cjs +1 -0
- package/dist/typography/HeaderAnnotation.es.js +10 -0
- package/dist/typography/HeaderCaption.cjs +1 -0
- package/dist/typography/HeaderCaption.es.js +10 -0
- package/dist/typography/HeaderPage.cjs +1 -0
- package/dist/typography/HeaderPage.es.js +10 -0
- package/dist/typography/HeaderSection.cjs +1 -0
- package/dist/typography/HeaderSection.es.js +10 -0
- package/dist/typography/LabelAnnotation.cjs +1 -0
- package/dist/typography/LabelAnnotation.es.js +10 -0
- package/dist/typography/LabelCaption.cjs +1 -0
- package/dist/typography/LabelCaption.es.js +10 -0
- package/dist/typography/LabelPage.cjs +1 -0
- package/dist/typography/LabelPage.es.js +10 -0
- package/dist/typography/LabelSection.cjs +1 -0
- package/dist/typography/LabelSection.es.js +10 -0
- package/dist/typography/NoteCaption.cjs +1 -0
- package/dist/typography/NoteCaption.es.js +10 -0
- package/dist/typography/NotePage.cjs +1 -0
- package/dist/typography/NotePage.es.js +10 -0
- package/dist/typography/NoteSection.cjs +1 -0
- package/dist/typography/NoteSection.es.js +10 -0
- package/dist/typography/TaglineAnnotation.cjs +1 -0
- package/dist/typography/TaglineAnnotation.es.js +10 -0
- package/dist/typography/TaglineCaption.cjs +1 -0
- package/dist/typography/TaglineCaption.es.js +10 -0
- package/dist/typography/TaglineFootext.cjs +1 -0
- package/dist/typography/TaglineFootext.es.js +10 -0
- package/dist/typography/TaglineSection.cjs +1 -0
- package/dist/typography/TaglineSection.es.js +10 -0
- package/dist/utils/bundleCss.cjs +1 -1
- package/dist/utils/cleanHtml.cjs +1 -0
- package/dist/utils/cleanHtml.es.js +6 -0
- package/dist/utils/cn.cjs +1 -0
- package/dist/utils/cn.es.js +59 -0
- package/dist/utils/createUniversalPortal.cjs +1 -0
- package/dist/utils/createUniversalPortal.es.js +17 -0
- package/dist/utils/floating.cjs +1 -0
- package/dist/utils/floating.es.js +374 -0
- package/dist/utils/getBreakpointsValues.cjs +1 -0
- package/dist/utils/getBreakpointsValues.es.js +27 -0
- package/dist/utils/sizes.cjs +1 -0
- package/dist/utils/sizes.es.js +30 -0
- package/dist/utils/themeTokens.cjs +1 -0
- package/dist/utils/themeTokens.es.js +319 -0
- package/dist/utils/useBodyScrollLock.cjs +1 -0
- package/dist/utils/useBodyScrollLock.es.js +24 -0
- package/dist/utils/useScrollTop.cjs +1 -0
- package/dist/utils/useScrollTop.es.js +9 -0
- package/package.json +7 -16
- package/scripts/postinstall.cjs +34 -6
- package/skills/clad-ui/SKILL.md +3 -1
- package/skills/clad-ui-feedback/SKILL.md +1 -1
- package/skills/migrate-clad-ui-v3/SKILL.md +4 -2
- package/skills/migrate-clad-ui-v3/references/component-api-changes.md +42 -0
- package/skills/migrate-clad-ui-v3/references/token-and-linaria-mapping.md +4 -1
- package/src/styles/preset.css +1 -1
- package/dist/clad-ui.cjs +0 -2
- package/dist/clad-ui.d.ts +0 -2
- package/dist/clad-ui.es.js +0 -9791
- package/dist/components/Drawer/Drawer.pw.fixtures.d.ts +0 -9
- package/dist/components/Grid/Grid.pw.fixtures.d.ts +0 -3
- package/dist/components/Popover/Popover.pw.fixtures.d.ts +0 -6
- package/dist/components/Popup/Popup.pw.fixtures.d.ts +0 -5
- package/dist/components/Tooltip/Tooltip.pw.fixtures.d.ts +0 -1
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import e from "../../utils/cn.es.js";
|
|
3
|
+
import t from "../Button/Button.es.js";
|
|
4
|
+
import n from "../../utils/createUniversalPortal.es.js";
|
|
5
|
+
import r from "../../utils/useBodyScrollLock.es.js";
|
|
6
|
+
import i from "../../utils/useScrollTop.es.js";
|
|
7
|
+
import * as a from "react";
|
|
8
|
+
import { Close as o } from "@chotot/icons";
|
|
9
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
10
|
+
//#region src/components/Drawer/Drawer.tsx
|
|
11
|
+
var u = () => {}, d = {
|
|
12
|
+
left: "flex-start",
|
|
13
|
+
right: "flex-end",
|
|
14
|
+
justify: "center"
|
|
15
|
+
}, f = {
|
|
16
|
+
S: "size-s",
|
|
17
|
+
M: "size-m",
|
|
18
|
+
L: "size-l"
|
|
19
|
+
}, p = a.createContext({}), m = ({ onClick: t, className: n = "", ...r }) => {
|
|
20
|
+
let { onClose: i, isExpanded: o, setIsExpanded: s, halfHeight: l, setIsDragging: u, setDragTranslateY: d, canExpand: f } = a.useContext(p), m = a.useRef(0), h = a.useRef(0), g = a.useRef(!1), _ = (e) => {
|
|
21
|
+
if (e.button === 0 && !(typeof window < "u" && window.innerWidth >= 768)) {
|
|
22
|
+
m.current = e.clientY, h.current = 0, g.current = !0, u?.(!0);
|
|
23
|
+
try {
|
|
24
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
25
|
+
} catch {}
|
|
26
|
+
}
|
|
27
|
+
}, v = (e) => {
|
|
28
|
+
if (!g.current) return;
|
|
29
|
+
let t = e.clientY - m.current, n = t;
|
|
30
|
+
(o || f === !1) && t < 0 && (n = t * .2), h.current = n, d?.(n);
|
|
31
|
+
}, y = (e) => {
|
|
32
|
+
if (!g.current) return;
|
|
33
|
+
g.current = !1, u?.(!1), d?.(0);
|
|
34
|
+
try {
|
|
35
|
+
e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId);
|
|
36
|
+
} catch {}
|
|
37
|
+
let t = h.current;
|
|
38
|
+
t > 50 ? l && o && s ? s(!1) : i && i(e) : t < -50 && l && !o && f !== !1 && s && s(!0);
|
|
39
|
+
}, b = (e) => {
|
|
40
|
+
if (!(Math.abs(h.current) >= 5)) {
|
|
41
|
+
if (t) {
|
|
42
|
+
t(e);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (l) {
|
|
46
|
+
if (!o && f !== !1 && s) {
|
|
47
|
+
s(!0);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (o && s) {
|
|
51
|
+
s(!1);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
i && i(e);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
return l && !f ? null : /* @__PURE__ */ c("div", {
|
|
59
|
+
...r,
|
|
60
|
+
onPointerDown: _,
|
|
61
|
+
onPointerMove: v,
|
|
62
|
+
onPointerUp: y,
|
|
63
|
+
onPointerCancel: y,
|
|
64
|
+
onClick: b,
|
|
65
|
+
className: e("drawer-drag-handle-slot", n),
|
|
66
|
+
"data-clad": "Drawer.DragHandle",
|
|
67
|
+
children: /* @__PURE__ */ c("div", { className: "drawer-drag-handle-pill" })
|
|
68
|
+
});
|
|
69
|
+
}, h = ({ children: t, open: i = !1, onClose: o = u, size: s = "S", halfHeight: d = !1, dragHandle: h = !1, className: g = "", needBypassScrollLock: _ = !1, style: v, ...y }) => {
|
|
70
|
+
let [b, x] = a.useState(!1), [S, C] = a.useState(!1), [w, T] = a.useState(0), [E, D] = a.useState(!d), O = a.useRef(null);
|
|
71
|
+
r(i && !_), a.useEffect(() => {
|
|
72
|
+
i || (x(!1), C(!1), T(0), D(!d));
|
|
73
|
+
}, [i, d]);
|
|
74
|
+
let k = a.useMemo(() => ({
|
|
75
|
+
onClose: o,
|
|
76
|
+
isExpanded: b,
|
|
77
|
+
setIsExpanded: x,
|
|
78
|
+
halfHeight: d,
|
|
79
|
+
isDragging: S,
|
|
80
|
+
setIsDragging: C,
|
|
81
|
+
dragTranslateY: w,
|
|
82
|
+
setDragTranslateY: T,
|
|
83
|
+
canExpand: E,
|
|
84
|
+
setCanExpand: D
|
|
85
|
+
}), [
|
|
86
|
+
o,
|
|
87
|
+
b,
|
|
88
|
+
d,
|
|
89
|
+
S,
|
|
90
|
+
w,
|
|
91
|
+
E
|
|
92
|
+
]);
|
|
93
|
+
if (!i) return null;
|
|
94
|
+
let A = e("drawer", g, f[s] || f.S, d && "half-height", d && b && "is-expanded");
|
|
95
|
+
return n(/* @__PURE__ */ c(p.Provider, {
|
|
96
|
+
value: k,
|
|
97
|
+
children: /* @__PURE__ */ l("div", {
|
|
98
|
+
ref: O,
|
|
99
|
+
className: "drawer-modal",
|
|
100
|
+
"data-clad": "Drawer.Modal",
|
|
101
|
+
children: [/* @__PURE__ */ c("div", {
|
|
102
|
+
className: "drawer-backdrop",
|
|
103
|
+
onClick: o
|
|
104
|
+
}), /* @__PURE__ */ l("div", {
|
|
105
|
+
...y,
|
|
106
|
+
className: A,
|
|
107
|
+
style: S ? {
|
|
108
|
+
...v,
|
|
109
|
+
transform: `translate3d(0, ${w}px, 0)`,
|
|
110
|
+
transition: "none"
|
|
111
|
+
} : v,
|
|
112
|
+
"data-clad": "Drawer.Container",
|
|
113
|
+
children: [!!h && /* @__PURE__ */ c(m, {}), t]
|
|
114
|
+
})]
|
|
115
|
+
})
|
|
116
|
+
}));
|
|
117
|
+
}, g = ({ type: t = "icon", icon: n, text: r, onClick: i, className: o = "", ...s }) => {
|
|
118
|
+
let { onClose: l } = a.useContext(p), u = i || l;
|
|
119
|
+
return /* @__PURE__ */ c("button", {
|
|
120
|
+
...s,
|
|
121
|
+
type: "button",
|
|
122
|
+
onClick: u,
|
|
123
|
+
className: e("drawer-header-item-btn", t === "textLink" && "is-text-link", o),
|
|
124
|
+
"data-clad": "Drawer.HeaderItem",
|
|
125
|
+
children: t === "textLink" ? r : n
|
|
126
|
+
});
|
|
127
|
+
}, _ = ({ title: t, leading: n, trailing: r, className: i = "", ...a }) => /* @__PURE__ */ l("div", {
|
|
128
|
+
...a,
|
|
129
|
+
className: e("drawer-slot-header", i),
|
|
130
|
+
"data-clad": "Drawer.Header",
|
|
131
|
+
children: [
|
|
132
|
+
/* @__PURE__ */ c("div", {
|
|
133
|
+
className: "header-leading",
|
|
134
|
+
children: n
|
|
135
|
+
}),
|
|
136
|
+
c(typeof t == "string" ? "h5" : "div", {
|
|
137
|
+
className: "header-title",
|
|
138
|
+
children: t
|
|
139
|
+
}),
|
|
140
|
+
/* @__PURE__ */ c("div", {
|
|
141
|
+
className: "header-trailing",
|
|
142
|
+
children: r
|
|
143
|
+
})
|
|
144
|
+
]
|
|
145
|
+
}), v = ({ children: t, className: n = "", hideScrollbar: r = !1, childrenOverflowVisible: o = !1, ...s }) => {
|
|
146
|
+
let { halfHeight: u, isExpanded: d, setIsExpanded: f, canExpand: m, setCanExpand: h } = a.useContext(p), [g, _] = i(), [v, y] = a.useState(!1), b = a.useRef(null), x = a.useRef(null);
|
|
147
|
+
a.useEffect(() => {
|
|
148
|
+
u && !d && m !== !1 && +g > 0 && f && f(!0);
|
|
149
|
+
}, [
|
|
150
|
+
g,
|
|
151
|
+
u,
|
|
152
|
+
d,
|
|
153
|
+
m,
|
|
154
|
+
f
|
|
155
|
+
]);
|
|
156
|
+
let S = () => {
|
|
157
|
+
let e = b.current;
|
|
158
|
+
return e ? e.scrollHeight - e.scrollTop > e.clientHeight + 1 : !1;
|
|
159
|
+
};
|
|
160
|
+
a.useEffect(() => {
|
|
161
|
+
y(S());
|
|
162
|
+
}, [g, t]), a.useEffect(() => {
|
|
163
|
+
if (u && !d && b.current && h) {
|
|
164
|
+
let e = () => {
|
|
165
|
+
let e = b.current;
|
|
166
|
+
e && h(e.scrollHeight > e.clientHeight + 1);
|
|
167
|
+
};
|
|
168
|
+
e();
|
|
169
|
+
let t = typeof requestAnimationFrame < "u" ? requestAnimationFrame(e) : void 0, n;
|
|
170
|
+
return typeof ResizeObserver < "u" && b.current && (n = new ResizeObserver(e), n.observe(b.current)), () => {
|
|
171
|
+
t && cancelAnimationFrame(t), n?.disconnect();
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
}, [
|
|
175
|
+
u,
|
|
176
|
+
d,
|
|
177
|
+
t,
|
|
178
|
+
h
|
|
179
|
+
]);
|
|
180
|
+
let C = e((typeof t == "string" || typeof t == "number") && "is-single-string", o && "children-overflow-visible", r && "hide-scrollbar"), w = e(C, n);
|
|
181
|
+
return /* @__PURE__ */ l("div", {
|
|
182
|
+
...s,
|
|
183
|
+
className: e("drawer-children-wrapper", C),
|
|
184
|
+
ref: x,
|
|
185
|
+
"data-clad": "Drawer.Body",
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ c("div", {
|
|
188
|
+
className: "shadow-top shadow",
|
|
189
|
+
style: {
|
|
190
|
+
opacity: +g > 0 ? "1" : "0",
|
|
191
|
+
transition: "opacity 0.3s"
|
|
192
|
+
}
|
|
193
|
+
}),
|
|
194
|
+
/* @__PURE__ */ c("div", {
|
|
195
|
+
className: "shadow-bottom shadow",
|
|
196
|
+
style: {
|
|
197
|
+
opacity: v ? "1" : "0",
|
|
198
|
+
transition: "opacity 0.3s"
|
|
199
|
+
}
|
|
200
|
+
}),
|
|
201
|
+
/* @__PURE__ */ c("div", {
|
|
202
|
+
className: e("drawer-children-content", w),
|
|
203
|
+
ref: b,
|
|
204
|
+
..._,
|
|
205
|
+
children: t
|
|
206
|
+
})
|
|
207
|
+
]
|
|
208
|
+
});
|
|
209
|
+
}, y = ({ children: t, direction: n = "horizontal", className: r = "", ...i }) => /* @__PURE__ */ c("div", {
|
|
210
|
+
...i,
|
|
211
|
+
className: e("drawer-slot-button-group", n === "vertical" && "is-vertical", r),
|
|
212
|
+
"data-clad": "Drawer.Button",
|
|
213
|
+
children: t
|
|
214
|
+
}), b = Object.assign(({ className: h = "", title: g = "", children: _, primaryBtnLabel: v, secondaryBtnLabel: y, primaryColor: b = "primary", disablePrimaryButton: x = !1, optionalBtnLabel: S, onOptionalBtnClick: C, btnRowPosition: w = "justify", open: T = !1, onClose: E = u, onPrimaryButtonClick: D = u, onSecondaryButtonClick: O = null, childrenOverflowVisible: k = !1, isEmptyDrawer: A = !1, haveClose: ee = !0, closeIcon: j = /* @__PURE__ */ c(o, {}), contentClassName: te = "", needBypassScrollLock: ne = !1, actions: M, hideScrollbar: re = !1, size: ie = "S", halfHeight: N = !1, dragHandle: ae = !1, style: P, ...oe }) => {
|
|
215
|
+
let { useEffect: F, useRef: I, useState: L } = a, R = e((typeof _ == "string" || typeof _ == "number") && "is-single-string", !(M || v) && "no-button", k && "children-overflow-visible", re && "hide-scrollbar"), z = e(R, te), [B, se] = i(), V = { ...se };
|
|
216
|
+
r(T && !ne);
|
|
217
|
+
let [H, ce] = L(!1), [U, W] = L(!1), [G, K] = L(!1), [q, J] = L(0), [Y, X] = L(!N), Z = I(null), Q = I(null), le = I(null);
|
|
218
|
+
F(() => {
|
|
219
|
+
T || (W(!1), K(!1), J(0), X(!N));
|
|
220
|
+
}, [T, N]), F(() => {
|
|
221
|
+
N && !U && Y && +B > 0 && W(!0);
|
|
222
|
+
}, [
|
|
223
|
+
B,
|
|
224
|
+
N,
|
|
225
|
+
U,
|
|
226
|
+
Y
|
|
227
|
+
]), F(() => {
|
|
228
|
+
if (N && !U && Z.current) {
|
|
229
|
+
let e = () => {
|
|
230
|
+
let e = Z.current;
|
|
231
|
+
e && X(e.scrollHeight > e.clientHeight + 1);
|
|
232
|
+
};
|
|
233
|
+
e();
|
|
234
|
+
let t = typeof requestAnimationFrame < "u" ? requestAnimationFrame(e) : void 0, n;
|
|
235
|
+
return typeof ResizeObserver < "u" && Z.current && (n = new ResizeObserver(e), n.observe(Z.current)), () => {
|
|
236
|
+
t && cancelAnimationFrame(t), n?.disconnect();
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
}, [
|
|
240
|
+
N,
|
|
241
|
+
U,
|
|
242
|
+
_
|
|
243
|
+
]);
|
|
244
|
+
let $ = e("drawer-option-btn", (typeof S == "string" || typeof S == "number") && "is-text"), ue = { justifyContent: d[w] || "flex-end" }, de = () => {
|
|
245
|
+
let e = Z.current;
|
|
246
|
+
return e ? e.scrollHeight - e.scrollTop > e.clientHeight + 1 : !1;
|
|
247
|
+
};
|
|
248
|
+
F(() => {
|
|
249
|
+
ce(de());
|
|
250
|
+
}, [
|
|
251
|
+
T,
|
|
252
|
+
B,
|
|
253
|
+
_
|
|
254
|
+
]);
|
|
255
|
+
let fe = e("drawer-close-btn", (typeof j == "string" || typeof j == "number") && "is-text"), pe = () => M ? /* @__PURE__ */ c("div", {
|
|
256
|
+
className: "drawer-button-group",
|
|
257
|
+
"data-clad": "Drawer.Button",
|
|
258
|
+
children: M
|
|
259
|
+
}) : v ? /* @__PURE__ */ l("div", {
|
|
260
|
+
className: "drawer-button-group",
|
|
261
|
+
style: ue,
|
|
262
|
+
"data-clad": "Drawer.Button",
|
|
263
|
+
children: [!!y && /* @__PURE__ */ c(t, {
|
|
264
|
+
variant: "outline",
|
|
265
|
+
color: "tertiary",
|
|
266
|
+
size: "large",
|
|
267
|
+
className: e(w === "justify" && "drawer-btn-full"),
|
|
268
|
+
onClick: O || E,
|
|
269
|
+
children: y
|
|
270
|
+
}), /* @__PURE__ */ c(t, {
|
|
271
|
+
color: b,
|
|
272
|
+
size: "large",
|
|
273
|
+
disabled: x,
|
|
274
|
+
className: e(w === "justify" && "drawer-btn-full"),
|
|
275
|
+
onClick: D,
|
|
276
|
+
children: v
|
|
277
|
+
})]
|
|
278
|
+
}) : null, me = a.useMemo(() => ({
|
|
279
|
+
onClose: E,
|
|
280
|
+
isExpanded: U,
|
|
281
|
+
setIsExpanded: W,
|
|
282
|
+
halfHeight: N,
|
|
283
|
+
isDragging: G,
|
|
284
|
+
setIsDragging: K,
|
|
285
|
+
dragTranslateY: q,
|
|
286
|
+
setDragTranslateY: J,
|
|
287
|
+
canExpand: Y,
|
|
288
|
+
setCanExpand: X
|
|
289
|
+
}), [
|
|
290
|
+
E,
|
|
291
|
+
U,
|
|
292
|
+
N,
|
|
293
|
+
G,
|
|
294
|
+
q,
|
|
295
|
+
Y
|
|
296
|
+
]);
|
|
297
|
+
if (!T) return null;
|
|
298
|
+
let he = e("drawer", h, A && "no-spacing", f[ie] || f.S, N && "half-height", N && U && "is-expanded");
|
|
299
|
+
return n(/* @__PURE__ */ c(p.Provider, {
|
|
300
|
+
value: me,
|
|
301
|
+
children: /* @__PURE__ */ l("div", {
|
|
302
|
+
ref: le,
|
|
303
|
+
className: "drawer-modal",
|
|
304
|
+
"data-clad": "Drawer.Modal",
|
|
305
|
+
children: [/* @__PURE__ */ c("div", {
|
|
306
|
+
className: "drawer-backdrop",
|
|
307
|
+
onClick: E
|
|
308
|
+
}), /* @__PURE__ */ l("div", {
|
|
309
|
+
...oe,
|
|
310
|
+
className: he,
|
|
311
|
+
style: G ? {
|
|
312
|
+
...P,
|
|
313
|
+
transform: `translate3d(0, ${q}px, 0)`,
|
|
314
|
+
transition: "none"
|
|
315
|
+
} : P,
|
|
316
|
+
"data-clad": "Drawer",
|
|
317
|
+
children: [!!ae && /* @__PURE__ */ c(m, {}), A ? /* @__PURE__ */ l("div", {
|
|
318
|
+
className: e("drawer-children-wrapper", R),
|
|
319
|
+
ref: Q,
|
|
320
|
+
"data-clad": "Drawer.Body",
|
|
321
|
+
children: [
|
|
322
|
+
/* @__PURE__ */ c("div", {
|
|
323
|
+
className: "shadow-top shadow",
|
|
324
|
+
style: {
|
|
325
|
+
opacity: +B > 0 ? "1" : "0",
|
|
326
|
+
transition: "opacity 0.3s"
|
|
327
|
+
}
|
|
328
|
+
}),
|
|
329
|
+
/* @__PURE__ */ c("div", {
|
|
330
|
+
className: "shadow-bottom shadow",
|
|
331
|
+
style: {
|
|
332
|
+
opacity: H ? "1" : "0",
|
|
333
|
+
transition: "opacity 0.3s"
|
|
334
|
+
}
|
|
335
|
+
}),
|
|
336
|
+
/* @__PURE__ */ c("div", {
|
|
337
|
+
className: e("drawer-children-content", z),
|
|
338
|
+
ref: Z,
|
|
339
|
+
...V,
|
|
340
|
+
children: _
|
|
341
|
+
})
|
|
342
|
+
]
|
|
343
|
+
}) : /* @__PURE__ */ l(s, { children: [
|
|
344
|
+
/* @__PURE__ */ c("div", {
|
|
345
|
+
className: "drawer-header",
|
|
346
|
+
"data-clad": "Drawer.Header",
|
|
347
|
+
children: /* @__PURE__ */ l("div", {
|
|
348
|
+
className: "drawer-header-top-bar",
|
|
349
|
+
children: [
|
|
350
|
+
!!ee && /* @__PURE__ */ c("button", {
|
|
351
|
+
type: "button",
|
|
352
|
+
onClick: E,
|
|
353
|
+
className: fe,
|
|
354
|
+
children: j
|
|
355
|
+
}),
|
|
356
|
+
/* @__PURE__ */ c("div", { children: !!g && /* @__PURE__ */ c("h5", { children: g }) }),
|
|
357
|
+
!!S && /* @__PURE__ */ c("button", {
|
|
358
|
+
type: "button",
|
|
359
|
+
onClick: C,
|
|
360
|
+
className: $,
|
|
361
|
+
children: S
|
|
362
|
+
})
|
|
363
|
+
]
|
|
364
|
+
})
|
|
365
|
+
}),
|
|
366
|
+
/* @__PURE__ */ l("div", {
|
|
367
|
+
className: e("drawer-children-wrapper", R),
|
|
368
|
+
ref: Q,
|
|
369
|
+
"data-clad": "Drawer.Body",
|
|
370
|
+
children: [
|
|
371
|
+
/* @__PURE__ */ c("div", {
|
|
372
|
+
className: "shadow-top shadow",
|
|
373
|
+
style: {
|
|
374
|
+
opacity: +B > 0 ? "1" : "0",
|
|
375
|
+
transition: "opacity 0.3s"
|
|
376
|
+
}
|
|
377
|
+
}),
|
|
378
|
+
/* @__PURE__ */ c("div", {
|
|
379
|
+
className: "shadow-bottom shadow",
|
|
380
|
+
style: {
|
|
381
|
+
opacity: H ? "1" : "0",
|
|
382
|
+
transition: "opacity 0.3s"
|
|
383
|
+
}
|
|
384
|
+
}),
|
|
385
|
+
/* @__PURE__ */ c("div", {
|
|
386
|
+
className: e("drawer-children-content", z),
|
|
387
|
+
ref: Z,
|
|
388
|
+
...V,
|
|
389
|
+
children: _
|
|
390
|
+
})
|
|
391
|
+
]
|
|
392
|
+
}),
|
|
393
|
+
pe()
|
|
394
|
+
] })]
|
|
395
|
+
})]
|
|
396
|
+
})
|
|
397
|
+
}));
|
|
398
|
+
}, {
|
|
399
|
+
Container: h,
|
|
400
|
+
DragHandle: m,
|
|
401
|
+
Header: _,
|
|
402
|
+
HeaderItem: g,
|
|
403
|
+
Body: v,
|
|
404
|
+
Button: y
|
|
405
|
+
});
|
|
406
|
+
//#endregion
|
|
407
|
+
export { v as DrawerBody, y as DrawerButton, h as DrawerContainer, m as DrawerDragHandle, _ as DrawerHeader, g as DrawerHeaderItem, b as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils/cn.cjs`),t=require(`../../utils/sizes.cjs`),n=require(`../../utils/floating.cjs`),r=require(`./dropdown.styles.cjs`);let i=require(`react`),a=require(`@chotot/icons`),o=require(`react/jsx-runtime`);var s=()=>{},c=({className:c=``,id:l=``,name:u=``,label:d=``,value:f=``,onClick:p=s,onChange:m=s,onBlur:h=s,onFocus:g=s,disabled:_=!1,required:v=!1,status:y=`default`,helptext:b=``,helptextClassName:x=``,inputRef:S,options:C=[],width:w=`full`,menuMaxHeight:T=`$sm`,icon:E,paddingForIcon:D=28,...O})=>{let k=(0,i.useRef)(null),A=(0,i.useRef)(null),j=(0,i.useRef)(null),M=typeof S==`object`&&S?S:k;(0,i.useImperativeHandle)(S,()=>M.current);let[N,P]=(0,i.useState)(!1),F=E?D:0,[I,L]=(0,i.useState)(!1),{renderLayer:R,triggerProps:{ref:z},layerProps:B,triggerBounds:V}=n.useLayer({isOpen:N,auto:!0,snap:!0,placement:`bottom-start`,possiblePlacements:[`top-start`,`bottom-start`],triggerOffset:2,onOutsideClick:()=>{P(!1)}});z(A.current),(0,i.useEffect)(()=>{let e=e=>{if(M.current&&!M.current.contains(e.target)){if(j.current?.contains(e.target))return;L(!1)}};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[M]);let H=e.default(`select`,`dropdown-select`,`isDropdown`,f&&`hasValue`,!d&&`noLabel`,v&&`required`),U=t.SIZES_MAP[w]??`initial`,W=C.map(e=>(0,o.jsx)(`option`,{value:e.value,children:e.label},e.value));d&&W.unshift((0,o.jsx)(`option`,{disabled:!0,value:``,children:d},`_label`)),W.unshift((0,o.jsx)(`option`,{hidden:!0,value:``},`_initial-value`));let G=e=>{p(e),!e.isDefaultPrevented()&&(I||g(),L(!0),e.preventDefault(),C.length&&P(!N))},K=e=>{if(M.current){M.current.value=e.currentTarget.getAttribute(`value`)||``;let t=new Event(`change`,{bubbles:!0});M.current.dispatchEvent(t)}P(!1)};return(0,o.jsxs)(`div`,{"data-clad":`Input Field - Dropdown`,className:e.default(`dropdown-container`,c),style:{width:U},children:[(0,o.jsxs)(`div`,{style:{paddingLeft:F},className:e.default(`wrapper`,r.dropdownVariants({status:y}),_&&`disabled`,I&&`focus`),ref:A,onMouseDown:G,children:[E?(0,o.jsx)(`div`,{className:`dropdown-left-icon`,children:E}):null,(0,o.jsx)(`select`,{...O,className:H,ref:M,id:l||void 0,name:u||void 0,disabled:_,required:v,value:f,onChange:m,onBlur:h,onFocus:g,children:W}),!!d&&(0,o.jsx)(`label`,{style:{marginLeft:F},className:`label`,htmlFor:l,children:d}),(0,o.jsx)(`span`,{style:{width:`24px`,height:`24px`,position:`absolute`,right:`8px`,top:`12px`},children:(0,o.jsx)(a.ChevronDownFilled,{className:`arrow`,style:{fontSize:`1.5rem`,color:_?`var(--color-icon-disabled)`:void 0}})})]}),b?(0,o.jsx)(`p`,{className:e.default(`helptext`,`dropdown-helptext`,x),children:b}):null,N?R((0,o.jsx)(`ul`,{role:`listbox`,...B,className:`dropdown-menu`,ref:n.mergeRefs(B.ref,j),style:{...B.style,width:(V?.width||0)+2,left:(V?.left||0)-1,maxHeight:t.SIZES_MAP[T]},children:C.map(t=>(0,o.jsxs)(`li`,{role:`menuitem`,value:t.value,onClick:K,className:e.default(`dropdown-item`,t.value===f&&`selected`),children:[t.icon,t.label,t.value===f?(0,o.jsx)(`span`,{className:`check-icon`,children:(0,o.jsx)(a.Check,{})}):null]},t.value))})):null]})};c.displayName=`Dropdown`,exports.default=c;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import e from "../../utils/cn.es.js";
|
|
3
|
+
import { SIZES_MAP as t } from "../../utils/sizes.es.js";
|
|
4
|
+
import { mergeRefs as n, useLayer as r } from "../../utils/floating.es.js";
|
|
5
|
+
import { dropdownVariants as i } from "./dropdown.styles.es.js";
|
|
6
|
+
import { useEffect as a, useImperativeHandle as o, useRef as s, useState as c } from "react";
|
|
7
|
+
import { Check as l, ChevronDownFilled as u } from "@chotot/icons";
|
|
8
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/Dropdown/Dropdown.tsx
|
|
10
|
+
var p = () => {}, m = ({ className: m = "", id: h = "", name: g = "", label: _ = "", value: v = "", onClick: y = p, onChange: b = p, onBlur: x = p, onFocus: S = p, disabled: C = !1, required: w = !1, status: T = "default", helptext: E = "", helptextClassName: D = "", inputRef: O, options: k = [], width: A = "full", menuMaxHeight: j = "$sm", icon: M, paddingForIcon: N = 28, ...P }) => {
|
|
11
|
+
let F = s(null), I = s(null), L = s(null), R = typeof O == "object" && O ? O : F;
|
|
12
|
+
o(O, () => R.current);
|
|
13
|
+
let [z, B] = c(!1), V = M ? N : 0, [H, U] = c(!1), { renderLayer: W, triggerProps: { ref: G }, layerProps: K, triggerBounds: q } = r({
|
|
14
|
+
isOpen: z,
|
|
15
|
+
auto: !0,
|
|
16
|
+
snap: !0,
|
|
17
|
+
placement: "bottom-start",
|
|
18
|
+
possiblePlacements: ["top-start", "bottom-start"],
|
|
19
|
+
triggerOffset: 2,
|
|
20
|
+
onOutsideClick: () => {
|
|
21
|
+
B(!1);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
G(I.current), a(() => {
|
|
25
|
+
let e = (e) => {
|
|
26
|
+
if (R.current && !R.current.contains(e.target)) {
|
|
27
|
+
if (L.current?.contains(e.target)) return;
|
|
28
|
+
U(!1);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
return document.addEventListener("mousedown", e), () => {
|
|
32
|
+
document.removeEventListener("mousedown", e);
|
|
33
|
+
};
|
|
34
|
+
}, [R]);
|
|
35
|
+
let J = e("select", "dropdown-select", "isDropdown", v && "hasValue", !_ && "noLabel", w && "required"), Y = t[A] ?? "initial", X = k.map((e) => /* @__PURE__ */ d("option", {
|
|
36
|
+
value: e.value,
|
|
37
|
+
children: e.label
|
|
38
|
+
}, e.value));
|
|
39
|
+
_ && X.unshift(/* @__PURE__ */ d("option", {
|
|
40
|
+
disabled: !0,
|
|
41
|
+
value: "",
|
|
42
|
+
children: _
|
|
43
|
+
}, "_label")), X.unshift(/* @__PURE__ */ d("option", {
|
|
44
|
+
hidden: !0,
|
|
45
|
+
value: ""
|
|
46
|
+
}, "_initial-value"));
|
|
47
|
+
let Z = (e) => {
|
|
48
|
+
y(e), !e.isDefaultPrevented() && (H || S(), U(!0), e.preventDefault(), k.length && B(!z));
|
|
49
|
+
}, Q = (e) => {
|
|
50
|
+
if (R.current) {
|
|
51
|
+
R.current.value = e.currentTarget.getAttribute("value") || "";
|
|
52
|
+
let t = new Event("change", { bubbles: !0 });
|
|
53
|
+
R.current.dispatchEvent(t);
|
|
54
|
+
}
|
|
55
|
+
B(!1);
|
|
56
|
+
};
|
|
57
|
+
return /* @__PURE__ */ f("div", {
|
|
58
|
+
"data-clad": "Input Field - Dropdown",
|
|
59
|
+
className: e("dropdown-container", m),
|
|
60
|
+
style: { width: Y },
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ f("div", {
|
|
63
|
+
style: { paddingLeft: V },
|
|
64
|
+
className: e("wrapper", i({ status: T }), C && "disabled", H && "focus"),
|
|
65
|
+
ref: I,
|
|
66
|
+
onMouseDown: Z,
|
|
67
|
+
children: [
|
|
68
|
+
M ? /* @__PURE__ */ d("div", {
|
|
69
|
+
className: "dropdown-left-icon",
|
|
70
|
+
children: M
|
|
71
|
+
}) : null,
|
|
72
|
+
/* @__PURE__ */ d("select", {
|
|
73
|
+
...P,
|
|
74
|
+
className: J,
|
|
75
|
+
ref: R,
|
|
76
|
+
id: h || void 0,
|
|
77
|
+
name: g || void 0,
|
|
78
|
+
disabled: C,
|
|
79
|
+
required: w,
|
|
80
|
+
value: v,
|
|
81
|
+
onChange: b,
|
|
82
|
+
onBlur: x,
|
|
83
|
+
onFocus: S,
|
|
84
|
+
children: X
|
|
85
|
+
}),
|
|
86
|
+
!!_ && /* @__PURE__ */ d("label", {
|
|
87
|
+
style: { marginLeft: V },
|
|
88
|
+
className: "label",
|
|
89
|
+
htmlFor: h,
|
|
90
|
+
children: _
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ d("span", {
|
|
93
|
+
style: {
|
|
94
|
+
width: "24px",
|
|
95
|
+
height: "24px",
|
|
96
|
+
position: "absolute",
|
|
97
|
+
right: "8px",
|
|
98
|
+
top: "12px"
|
|
99
|
+
},
|
|
100
|
+
children: /* @__PURE__ */ d(u, {
|
|
101
|
+
className: "arrow",
|
|
102
|
+
style: {
|
|
103
|
+
fontSize: "1.5rem",
|
|
104
|
+
color: C ? "var(--color-icon-disabled)" : void 0
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
}),
|
|
110
|
+
E ? /* @__PURE__ */ d("p", {
|
|
111
|
+
className: e("helptext", "dropdown-helptext", D),
|
|
112
|
+
children: E
|
|
113
|
+
}) : null,
|
|
114
|
+
z ? W(/* @__PURE__ */ d("ul", {
|
|
115
|
+
role: "listbox",
|
|
116
|
+
...K,
|
|
117
|
+
className: "dropdown-menu",
|
|
118
|
+
ref: n(K.ref, L),
|
|
119
|
+
style: {
|
|
120
|
+
...K.style,
|
|
121
|
+
width: (q?.width || 0) + 2,
|
|
122
|
+
left: (q?.left || 0) - 1,
|
|
123
|
+
maxHeight: t[j]
|
|
124
|
+
},
|
|
125
|
+
children: k.map((t) => /* @__PURE__ */ f("li", {
|
|
126
|
+
role: "menuitem",
|
|
127
|
+
value: t.value,
|
|
128
|
+
onClick: Q,
|
|
129
|
+
className: e("dropdown-item", t.value === v && "selected"),
|
|
130
|
+
children: [
|
|
131
|
+
t.icon,
|
|
132
|
+
t.label,
|
|
133
|
+
t.value === v ? /* @__PURE__ */ d("span", {
|
|
134
|
+
className: "check-icon",
|
|
135
|
+
children: /* @__PURE__ */ d(l, {})
|
|
136
|
+
}) : null
|
|
137
|
+
]
|
|
138
|
+
}, t.value))
|
|
139
|
+
})) : null
|
|
140
|
+
]
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
m.displayName = "Dropdown";
|
|
144
|
+
//#endregion
|
|
145
|
+
export { m as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);var e=(0,require(`tailwind-variants/lite`).tv)({base:`dropdown-wrapper`,defaultVariants:{status:`default`},variants:{status:{default:``,error:`error`}}});exports.dropdownVariants=e;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { tv as e } from "tailwind-variants/lite";
|
|
2
|
+
//#region src/components/Dropdown/dropdown.styles.ts
|
|
3
|
+
var t = e({
|
|
4
|
+
base: "dropdown-wrapper",
|
|
5
|
+
defaultVariants: { status: "default" },
|
|
6
|
+
variants: { status: {
|
|
7
|
+
default: "",
|
|
8
|
+
error: "error"
|
|
9
|
+
} }
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { t as dropdownVariants };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils/cn.cjs`),t=require(`../../types/index.cjs`),n=require(`../Button/Button.cjs`),r=require(`./empty-state.styles.cjs`);let i=require(`react`),a=require(`react/jsx-runtime`);var o=`https://storage.googleapis.com/static-chotot-com/storage/empty_state/png`,s={notFound:{title:`Trang không tồn tại`,description:`Có khi nào bạn nhầm đường dẫn không?`,buttonLabel:`Trở về trang chủ`,img:`${o}/404.png`},maintenance:{title:`Tạm nghỉ để bảo trì`,description:`Chút nữa ghé lại nha bạn ơi.
|
|
2
|
+
Xin hứa trải nghiệm sẽ mượt hơn nhiều!`,buttonLabel:`Trở về trang chủ`,img:`${o}/maintenance.png`},keywordNoResult:{title:`Hic! Chưa tìm thấy kết quả nào`,description:`Thử đổi từ khóa, viết đúng chính tả, những deal ngon ‘“sốt xình xịch” sẽ hiện ra nhanh thôi!`,buttonLabel:`Thay đổi từ khóa`,img:`${o}/keyword-no-result.png`},filterNoResult:{title:`Không có kết quả cho bộ lọc đã chọn`,description:`Không tìm thấy tin đăng cho những gì bạn đã lọc. Hãy thay đổi tiêu chí Lọc hoặc Bỏ lọc.`,buttonLabel:`Thay đổi bộ lọc`,img:`${o}/filter-no-result.png`},noAvailable:{title:`Tin đăng không còn tồn tại`,description:`Một là hết hạn, hai là bị ẩn, ba là đã bán. Xem tiếp các tin khác để không bỏ lỡ deal xịn nha!`,buttonLabel:`Trở về trang chủ`,img:`${o}/no-available.png`},grantAccess:{title:`Xin quyền truy cập nha!`,description:(0,a.jsxs)(`p`,{children:[`Cần quyền truy cập Ảnh để sử dụng tính năng đăng tin. Truy cập vào`,` `,(0,a.jsx)(`strong`,{children:`Cài đặt`}),` `,`>`,` `,(0,a.jsx)(`strong`,{children:`Ứng dụng`}),` `,`>`,` Chợ Tốt Bật `,(0,a.jsx)(`strong`,{children:`“Ảnh”`})]}),buttonLabel:`Cho phép`,img:`${o}/grant-access.png`},disconnection:{title:`Tạm mất kết nối :(`,description:`Nhưng không sao! Deal ngon giá tốt vẫn ở đây & được cập nhật liên tục! Nhanh tay kiểm tra lại wifi/4G để không lỡ deal hot nha!`,buttonLabel:`Thử lại trang`,img:`${o}/disconnection.png`},notFoundWhite:{title:`Trang không tồn tại`,description:`Có khi nào bạn nhầm đường dẫn không?`,buttonLabel:`Trở về trang chủ`,img:`${o}/404-white.png`},working:{title:`Tính năng đang được phát triển`,description:`Chút nữa ghé lại nha bạn ơi!`,buttonLabel:`Trở về trang chủ`,img:`${o}/working.png`},waitingCv:{title:`Chưa có hồ sơ ứng tuyển`,description:`Hiện chưa có ứng viên nào nộp hồ sơ cho tin tuyển dụng này.`,buttonLabel:`Quản lý tin đăng`,img:`${o}/waiting-cv.png`},noReward:{title:`Chưa có phần thưởng nào`,description:`Tham gia chương trình để nhận thêm nhiều ưu đãi hấp dẫn nha!`,buttonLabel:`Khám phá ngay`,img:`${o}/no-reward.png`}},c=t.forwardRef((t,o)=>{let{type:c,title:l,coverImage:u,description:d,buttonLabel:f,onButtonClick:p,showTitle:m=!0,showDescription:h=!0,showButton:g=!0,className:_,as:v=`div`,...y}=t,b=c===`other`?void 0:s[c],x=u??b?.img,S=l??b?.title,C=d??b?.description,w=f??b?.buttonLabel,T=typeof C==`string`?(0,a.jsx)(`p`,{children:C}):C;return(0,i.createElement)(v,{ref:o,className:e.default(r.emptyStateVariants(),_),"data-clad":`Empty State`,...y},(0,a.jsx)(`img`,{src:x,alt:S,width:200,height:200}),(0,a.jsxs)(`div`,{className:`empty-state-content`,children:[(0,a.jsxs)(`div`,{className:`empty-state-content-text`,children:[m&&(0,a.jsx)(`h3`,{children:S}),h&&T]}),g&&(0,a.jsx)(n.default,{size:`large`,color:`primary`,onClick:p,children:w})]}))});c.displayName=`EmptyState`,exports.default=c;
|