@chotot/clad-ui 3.0.0 → 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 +7 -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/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 +6 -6
- 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,206 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import e from "../../utils/cn.es.js";
|
|
3
|
+
import { SIZES_MAP as t } from "../../utils/sizes.es.js";
|
|
4
|
+
import n from "../Chip/Chip.es.js";
|
|
5
|
+
import { useLayer as r } from "../../utils/floating.es.js";
|
|
6
|
+
import i from "../ShapeIcon/ShapeIcon.es.js";
|
|
7
|
+
import { multiSearchDropdownVariants as a } from "./multi-search-dropdown.styles.es.js";
|
|
8
|
+
import * as o from "react";
|
|
9
|
+
import { ChevronDownFilled as ee, Close as te } from "@chotot/icons";
|
|
10
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
11
|
+
//#region src/components/MultiSearchDropdown/MultiSearchDropdown.tsx
|
|
12
|
+
var { useState: l, useRef: u, useEffect: d } = o, f = () => {};
|
|
13
|
+
function ne(e) {
|
|
14
|
+
let { key: t, keyCode: n } = e;
|
|
15
|
+
return n >= 37 && n <= 40 && t.indexOf("Arrow") !== 0 ? `Arrow${t}` : t;
|
|
16
|
+
}
|
|
17
|
+
var p = ({ id: p, label: m = "", value: h = [], options: g = [], onInput: re = f, onChange: _ = f, onSelect: ie = f, onBlur: v = f, onRemoveOption: y = f, inputRef: b, onClearData: x = f, menuMaxHeight: S = "$sm", emptyString: C = "Không có lựa chọn khả dụng", width: w = "full", disabled: T = !1, required: E = !1, helptext: D = "", helptextClassName: O = "", status: k = "default", className: A = "", ...ae }) => {
|
|
18
|
+
let j = u(null), [M, N] = l(!1), [P, F] = l(h), [I, L] = l(!1), [R, z] = l(-1), [B, V] = l(g), [H, U] = l(g), [W, G] = l(""), K = M, q = u(null), J = typeof b == "object" && b ? b : q;
|
|
19
|
+
o.useImperativeHandle(b, () => J?.current), d(() => {
|
|
20
|
+
if (Array.isArray(B)) {
|
|
21
|
+
let e = [...B];
|
|
22
|
+
h.length > 0 && h.forEach((t) => {
|
|
23
|
+
e.some((e) => e.text === t?.text) && (e = e.filter((e) => e.text !== t.text));
|
|
24
|
+
}), V(e), U(e), F(h);
|
|
25
|
+
}
|
|
26
|
+
}, [h.length]), d(() => {
|
|
27
|
+
V(g), U(g);
|
|
28
|
+
}, [g]);
|
|
29
|
+
let { renderLayer: oe, triggerProps: { ref: se }, layerProps: Y, triggerBounds: ce } = r({
|
|
30
|
+
isOpen: K,
|
|
31
|
+
auto: !0,
|
|
32
|
+
snap: !0,
|
|
33
|
+
placement: "bottom-start",
|
|
34
|
+
possiblePlacements: ["top-start", "bottom-start"],
|
|
35
|
+
triggerOffset: 1,
|
|
36
|
+
onOutsideClick: () => {
|
|
37
|
+
N(!1), G(""), L(!1), U(B);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
se(j.current);
|
|
41
|
+
let le = (e) => (M || (N(!0), L(!0), z(-1), J?.current?.focus()), e), ue = (e) => (G(""), L(!1), U(B), e.stopPropagation(), v(e)), X = (e, t) => {
|
|
42
|
+
let n = H[e];
|
|
43
|
+
return z(-1), n ? (G(""), ie?.(n, t), J?.current?.focus(), _?.(n, t)) : t;
|
|
44
|
+
}, de = (e) => {
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
}, Z = (e, t) => {
|
|
47
|
+
if (e) {
|
|
48
|
+
t.stopPropagation();
|
|
49
|
+
let n = [...B], r = g.filter((t) => t?.text === e?.text);
|
|
50
|
+
return n.push(r[0]), U(n), V(n), y(e, t), J?.current?.focus(), _?.(e, t);
|
|
51
|
+
}
|
|
52
|
+
return t;
|
|
53
|
+
}, fe = (e) => {
|
|
54
|
+
let t = ne(e), n = R;
|
|
55
|
+
switch (t) {
|
|
56
|
+
case "Enter": return R > -1 ? X(R, e) : e;
|
|
57
|
+
case "Backspace": return W.length <= 0 ? Z(P[P.length - 1], e) : e;
|
|
58
|
+
case "ArrowUp":
|
|
59
|
+
--n, n < 0 && (n = B.length - 1), e.preventDefault();
|
|
60
|
+
break;
|
|
61
|
+
case "ArrowDown":
|
|
62
|
+
n += 1, n >= B.length && (n = 0), e.preventDefault();
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
if (/^[a-z0-9]$/i.test(e.key)) {
|
|
66
|
+
let t = e.key, n = setTimeout(() => {
|
|
67
|
+
G("");
|
|
68
|
+
}, 1e3);
|
|
69
|
+
clearTimeout(n);
|
|
70
|
+
let r = W + t, i = RegExp(`^${r}`, "i"), a = g.findIndex((e) => i.test(e?.text));
|
|
71
|
+
return a === -1 ? { typed: r } : {
|
|
72
|
+
tempFocusedValue: a,
|
|
73
|
+
typed: r
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
e.persist(), z(n);
|
|
79
|
+
}, Q = (e) => {
|
|
80
|
+
let t = e.currentTarget;
|
|
81
|
+
return X(Number(t.getAttribute("data-index")), e);
|
|
82
|
+
}, pe = (e) => {
|
|
83
|
+
G(e.target.value), re?.(e);
|
|
84
|
+
let t = e.target.value, n = (e) => e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/đ/g, "d").replace(/Đ/g, "D");
|
|
85
|
+
U(t ? B.filter((e) => {
|
|
86
|
+
if (e?.text) {
|
|
87
|
+
let r = n(e.text).toLowerCase(), i = n(t).toLowerCase();
|
|
88
|
+
return r.includes(i);
|
|
89
|
+
}
|
|
90
|
+
return !1;
|
|
91
|
+
}) : B);
|
|
92
|
+
}, me = (e) => {
|
|
93
|
+
G(""), z(-1), V(g), U(g), x(e), e.stopPropagation();
|
|
94
|
+
}, $ = (e) => {
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
let t = e.target.closest("[data-index]")?.getAttribute("data-index");
|
|
97
|
+
t != null && z(+t);
|
|
98
|
+
}, he = () => {
|
|
99
|
+
let t = [...P].map((t) => /* @__PURE__ */ s(n, {
|
|
100
|
+
value: {
|
|
101
|
+
text: t?.text,
|
|
102
|
+
data: t?.data
|
|
103
|
+
},
|
|
104
|
+
onClose: T ? f : Z,
|
|
105
|
+
size: "sm",
|
|
106
|
+
className: e(T && "msd-chip-disabled"),
|
|
107
|
+
children: t?.text
|
|
108
|
+
}, t?.text));
|
|
109
|
+
return /* @__PURE__ */ c("span", {
|
|
110
|
+
className: "msd-chips-wrapper",
|
|
111
|
+
children: [P.length > 0 && t, /* @__PURE__ */ s("input", {
|
|
112
|
+
className: "msd-search-input",
|
|
113
|
+
autoComplete: "off",
|
|
114
|
+
value: W,
|
|
115
|
+
onChange: pe,
|
|
116
|
+
ref: J
|
|
117
|
+
})]
|
|
118
|
+
});
|
|
119
|
+
}, ge = () => {
|
|
120
|
+
N(!M);
|
|
121
|
+
}, _e = k === "error", ve = t[w] || w;
|
|
122
|
+
return /* @__PURE__ */ c("div", {
|
|
123
|
+
className: e("msd-outer", A),
|
|
124
|
+
style: { width: ve },
|
|
125
|
+
"data-clad": "Multi Select Dropdown",
|
|
126
|
+
children: [/* @__PURE__ */ c("div", {
|
|
127
|
+
id: p,
|
|
128
|
+
className: e(a({ status: k }), I ? "focus" : "", T && "disabled", E && "required"),
|
|
129
|
+
role: "tab",
|
|
130
|
+
tabIndex: 0,
|
|
131
|
+
onClick: T ? void 0 : le,
|
|
132
|
+
onKeyUp: T ? void 0 : de,
|
|
133
|
+
onKeyDown: T ? void 0 : fe,
|
|
134
|
+
ref: j,
|
|
135
|
+
...ae,
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ s("p", {
|
|
138
|
+
className: e("msd-label", (I || h.length > 0) && "focus", _e && "error"),
|
|
139
|
+
children: m
|
|
140
|
+
}),
|
|
141
|
+
he(),
|
|
142
|
+
!!K && oe(/* @__PURE__ */ s("ul", {
|
|
143
|
+
role: "listbox",
|
|
144
|
+
className: "msd-menu",
|
|
145
|
+
...Y,
|
|
146
|
+
style: {
|
|
147
|
+
width: ce?.width,
|
|
148
|
+
maxHeight: t[S] || S,
|
|
149
|
+
...Y.style
|
|
150
|
+
},
|
|
151
|
+
children: H.length > 0 ? H.map((t, n) => /* @__PURE__ */ s("li", {
|
|
152
|
+
role: "menuitem",
|
|
153
|
+
"aria-label": t?.text,
|
|
154
|
+
onMouseOver: $,
|
|
155
|
+
onFocus: $,
|
|
156
|
+
"data-index": n,
|
|
157
|
+
className: e("msd-option", n === R && "highlight"),
|
|
158
|
+
onClick: Q,
|
|
159
|
+
dangerouslySetInnerHTML: { __html: t?.html }
|
|
160
|
+
}, t?.text)) : /* @__PURE__ */ s("li", {
|
|
161
|
+
role: "menuitem",
|
|
162
|
+
"aria-label": "no-result",
|
|
163
|
+
"data-index": 0,
|
|
164
|
+
className: "msd-option",
|
|
165
|
+
dangerouslySetInnerHTML: { __html: C }
|
|
166
|
+
}, "no-result")
|
|
167
|
+
})),
|
|
168
|
+
/* @__PURE__ */ c("span", {
|
|
169
|
+
className: "msd-action-group",
|
|
170
|
+
children: [!T && !!x && P.length > 0 && /* @__PURE__ */ s("span", {
|
|
171
|
+
className: "msd-clear-icon",
|
|
172
|
+
onClick: me,
|
|
173
|
+
role: "tab",
|
|
174
|
+
tabIndex: 0,
|
|
175
|
+
children: /* @__PURE__ */ s(te, {})
|
|
176
|
+
}), /* @__PURE__ */ s("span", {
|
|
177
|
+
className: e(K ? "inverted" : "", "msd-dropdown-icon"),
|
|
178
|
+
onClick: ge,
|
|
179
|
+
role: "tab",
|
|
180
|
+
tabIndex: 0,
|
|
181
|
+
children: /* @__PURE__ */ s(i, {
|
|
182
|
+
bg: "none",
|
|
183
|
+
color: "primary",
|
|
184
|
+
radius: "circle",
|
|
185
|
+
size: "md",
|
|
186
|
+
children: /* @__PURE__ */ s(ee, { className: "arrow" })
|
|
187
|
+
})
|
|
188
|
+
})]
|
|
189
|
+
}),
|
|
190
|
+
/* @__PURE__ */ s("input", {
|
|
191
|
+
value: h.length ? h.length : "",
|
|
192
|
+
required: E,
|
|
193
|
+
onBlur: ue,
|
|
194
|
+
readOnly: !0,
|
|
195
|
+
hidden: !0
|
|
196
|
+
})
|
|
197
|
+
]
|
|
198
|
+
}), D ? /* @__PURE__ */ s("p", {
|
|
199
|
+
className: e("msd-helptext", O),
|
|
200
|
+
children: D
|
|
201
|
+
}) : null]
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
p.displayName = "MultiSearchDropdown";
|
|
205
|
+
//#endregion
|
|
206
|
+
export { p as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);var e=(0,require(`tailwind-variants/lite`).tv)({base:`msd-wrapper`,variants:{status:{default:``,error:`error`}},defaultVariants:{status:`default`}});exports.multiSearchDropdownVariants=e;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { tv as e } from "tailwind-variants/lite";
|
|
2
|
+
//#region src/components/MultiSearchDropdown/multi-search-dropdown.styles.ts
|
|
3
|
+
var t = e({
|
|
4
|
+
base: "msd-wrapper",
|
|
5
|
+
variants: { status: {
|
|
6
|
+
default: "",
|
|
7
|
+
error: "error"
|
|
8
|
+
} },
|
|
9
|
+
defaultVariants: { status: "default" }
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { t as multiSearchDropdownVariants };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils/cn.cjs`),t=require(`../../types/index.cjs`),n=require(`./pagination.styles.cjs`);let r=require(`react`);var i=t.forwardRef((t,i)=>{let{page:a,isActive:o,className:s,as:c=`button`,children:l,...u}=t;return(0,r.createElement)(c,{className:e.default(n.pageItemVariants({isActive:!!o,disabled:!!u.disabled}),s),"data-clad":`PaginationItem`,ref:i,...u},a||l)});i.displayName=`PageItem`,exports.default=i;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import e from "../../utils/cn.es.js";
|
|
2
|
+
import { forwardRef as t } from "../../types/index.es.js";
|
|
3
|
+
import { pageItemVariants as n } from "./pagination.styles.es.js";
|
|
4
|
+
import { createElement as r } from "react";
|
|
5
|
+
//#region src/components/Pagination/PageItem.tsx
|
|
6
|
+
var i = t((t, i) => {
|
|
7
|
+
let { page: a, isActive: o, className: s, as: c = "button", children: l, ...u } = t;
|
|
8
|
+
return r(c, {
|
|
9
|
+
className: e(n({
|
|
10
|
+
isActive: !!o,
|
|
11
|
+
disabled: !!u.disabled
|
|
12
|
+
}), s),
|
|
13
|
+
"data-clad": "PaginationItem",
|
|
14
|
+
ref: i,
|
|
15
|
+
...u
|
|
16
|
+
}, a || l);
|
|
17
|
+
});
|
|
18
|
+
i.displayName = "PageItem";
|
|
19
|
+
//#endregion
|
|
20
|
+
export { i as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../utils/cn.cjs`),n=require(`./pagination.styles.cjs`),r=require(`./PageItem.cjs`);let i=require(`react`);i=e.__toESM(i);let a=require(`@chotot/icons`),o=require(`react/jsx-runtime`);var s=(e,t)=>{let n=t-e+1;return Array.from({length:n},(t,n)=>n+e)},c=`DOT_LEFT`,l=`DOT_RIGHT`,u=({currentPage:e=1,totalPages:u,siblingCount:d=1,onChange:f,className:p,renderPageItem:m,onNextPage:h,onPreviousPage:g,showActionButtons:_=!0,...v})=>{let y=i.useMemo(()=>{if(u<=d*2+3+2)return s(1,u);let t=Math.max(e-d,1),n=Math.min(e+d,u),r=t>2,i=n<u-2;return!r&&i?[...s(1,3+2*d),l,u]:r&&!i?[1,c,...s(u-(3+2*d)+1,u)]:r&&i?[1,c,...s(t,n),l,u]:[]},[u,e,d]),b=t=>{t!==e&&f?.(t)},x=!!(f||g),S=!!(f||h);return(0,o.jsxs)(`div`,{...v,className:t.default(n.paginationVariants(),p),"data-clad":`Pagination`,children:[!!_&&(0,o.jsx)(r.default,{className:`page-item--action`,disabled:e===1,onClick:x?()=>{b(e-1),g?.()}:void 0,children:(0,o.jsx)(a.ChevronLeft,{width:20,height:20})}),y.map(t=>{if(t===c||t===l)return(0,o.jsx)(r.default,{as:`span`,className:`page-item--ellipsis`,children:(0,o.jsx)(a.MoreHorizontal,{})},t);let n={onClick:f?()=>b(Number(t)):void 0,key:t,page:Number(t),isActive:t===e,className:`page-item--action`};return m?m(n):(0,o.jsx)(r.default,{...n})}),!!_&&(0,o.jsx)(r.default,{className:`page-item--action`,disabled:e===u,onClick:S?()=>{b(e+1),h?.()}:void 0,children:(0,o.jsx)(a.ChevronRight,{width:20,height:20})})]})};u.displayName=`Pagination`,exports.default=u;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import e from "../../utils/cn.es.js";
|
|
2
|
+
import { paginationVariants as t } from "./pagination.styles.es.js";
|
|
3
|
+
import n from "./PageItem.es.js";
|
|
4
|
+
import * as r from "react";
|
|
5
|
+
import { ChevronLeft as i, ChevronRight as a, MoreHorizontal as o } from "@chotot/icons";
|
|
6
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/Pagination/Pagination.tsx
|
|
8
|
+
var l = (e, t) => {
|
|
9
|
+
let n = t - e + 1;
|
|
10
|
+
return Array.from({ length: n }, (t, n) => n + e);
|
|
11
|
+
}, u = "DOT_LEFT", d = "DOT_RIGHT", f = ({ currentPage: f = 1, totalPages: p, siblingCount: m = 1, onChange: h, className: g, renderPageItem: _, onNextPage: v, onPreviousPage: y, showActionButtons: b = !0, ...x }) => {
|
|
12
|
+
let S = r.useMemo(() => {
|
|
13
|
+
if (p <= m * 2 + 3 + 2) return l(1, p);
|
|
14
|
+
let e = Math.max(f - m, 1), t = Math.min(f + m, p), n = e > 2, r = t < p - 2;
|
|
15
|
+
return !n && r ? [
|
|
16
|
+
...l(1, 3 + 2 * m),
|
|
17
|
+
d,
|
|
18
|
+
p
|
|
19
|
+
] : n && !r ? [
|
|
20
|
+
1,
|
|
21
|
+
u,
|
|
22
|
+
...l(p - (3 + 2 * m) + 1, p)
|
|
23
|
+
] : n && r ? [
|
|
24
|
+
1,
|
|
25
|
+
u,
|
|
26
|
+
...l(e, t),
|
|
27
|
+
d,
|
|
28
|
+
p
|
|
29
|
+
] : [];
|
|
30
|
+
}, [
|
|
31
|
+
p,
|
|
32
|
+
f,
|
|
33
|
+
m
|
|
34
|
+
]), C = (e) => {
|
|
35
|
+
e !== f && h?.(e);
|
|
36
|
+
}, w = !!(h || y), T = !!(h || v);
|
|
37
|
+
return /* @__PURE__ */ c("div", {
|
|
38
|
+
...x,
|
|
39
|
+
className: e(t(), g),
|
|
40
|
+
"data-clad": "Pagination",
|
|
41
|
+
children: [
|
|
42
|
+
!!b && /* @__PURE__ */ s(n, {
|
|
43
|
+
className: "page-item--action",
|
|
44
|
+
disabled: f === 1,
|
|
45
|
+
onClick: w ? () => {
|
|
46
|
+
C(f - 1), y?.();
|
|
47
|
+
} : void 0,
|
|
48
|
+
children: /* @__PURE__ */ s(i, {
|
|
49
|
+
width: 20,
|
|
50
|
+
height: 20
|
|
51
|
+
})
|
|
52
|
+
}),
|
|
53
|
+
S.map((e) => {
|
|
54
|
+
if (e === u || e === d) return /* @__PURE__ */ s(n, {
|
|
55
|
+
as: "span",
|
|
56
|
+
className: "page-item--ellipsis",
|
|
57
|
+
children: /* @__PURE__ */ s(o, {})
|
|
58
|
+
}, e);
|
|
59
|
+
let t = {
|
|
60
|
+
onClick: h ? () => C(Number(e)) : void 0,
|
|
61
|
+
key: e,
|
|
62
|
+
page: Number(e),
|
|
63
|
+
isActive: e === f,
|
|
64
|
+
className: "page-item--action"
|
|
65
|
+
};
|
|
66
|
+
return _ ? _(t) : /* @__PURE__ */ s(n, { ...t });
|
|
67
|
+
}),
|
|
68
|
+
!!b && /* @__PURE__ */ s(n, {
|
|
69
|
+
className: "page-item--action",
|
|
70
|
+
disabled: f === p,
|
|
71
|
+
onClick: T ? () => {
|
|
72
|
+
C(f + 1), v?.();
|
|
73
|
+
} : void 0,
|
|
74
|
+
children: /* @__PURE__ */ s(a, {
|
|
75
|
+
width: 20,
|
|
76
|
+
height: 20
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
]
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
f.displayName = "Pagination";
|
|
83
|
+
//#endregion
|
|
84
|
+
export { f as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`tailwind-variants/lite`);var t=(0,e.tv)({base:`pagination`}),n=(0,e.tv)({base:`page-item`,variants:{variant:{action:`page-item--action`,ellipsis:`page-item--ellipsis`},isActive:{true:`page-item--active`},disabled:{true:`page-item--disabled`}}});exports.pageItemVariants=n,exports.paginationVariants=t;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { tv as e } from "tailwind-variants/lite";
|
|
2
|
+
//#region src/components/Pagination/pagination.styles.ts
|
|
3
|
+
var t = e({ base: "pagination" }), n = e({
|
|
4
|
+
base: "page-item",
|
|
5
|
+
variants: {
|
|
6
|
+
variant: {
|
|
7
|
+
action: "page-item--action",
|
|
8
|
+
ellipsis: "page-item--ellipsis"
|
|
9
|
+
},
|
|
10
|
+
isActive: { true: "page-item--active" },
|
|
11
|
+
disabled: { true: "page-item--disabled" }
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
//#endregion
|
|
15
|
+
export { n as pageItemVariants, t as paginationVariants };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils/cn.cjs`),t=require(`../../utils/floating.cjs`),n=require(`./popover.styles.cjs`);let r=require(`react`),i=require(`react/jsx-runtime`);var a=()=>{},o=(e,t,n={top:0,bottom:0,left:0,right:0})=>{let{top:r,bottom:i,left:a,right:o}=n;if(t<=Math.floor(r)&&e>a&&e<o)return`top`;if(t>=Math.floor(i)&&e>a&&e<o)return`bottom`;if(e<=Math.floor(a)&&t>r&&t<i)return`left`;if(e>=Math.floor(o)&&t>r&&t<i)return`right`},s=({anchorEl:s,open:c=!1,placement:l,autoPlacement:u,children:d,offset:f,width:p,onOutsideClick:m=a,onOutsideHover:h=a,onMouseLeave:g=a,className:_,style:v,...y})=>{let b=t.useLayer({isOpen:c,placement:l,auto:u,triggerOffset:f,onOutsideClick:m});b.triggerProps.ref(s?.current??null);let{renderLayer:x,layerProps:S,triggerBounds:C,layerSide:w}=b;(0,r.useEffect)(()=>{s?.current&&(s.current.onmouseleave=e=>{let t=o(e.x,e.y,s.current?.getBoundingClientRect());t&&t!==w&&h()})},[]);let T=e=>{g(e),h()};return c?x((0,i.jsx)(`div`,{...y,...S,className:e.default(n.popoverVariants(),_),style:{...S.style,width:p??C?.width,...v},onMouseLeave:T,"data-clad":`Popover`,children:d})):null};s.displayName=`Popover`,exports.default=s;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import e from "../../utils/cn.es.js";
|
|
3
|
+
import { useLayer as t } from "../../utils/floating.es.js";
|
|
4
|
+
import { popoverVariants as n } from "./popover.styles.es.js";
|
|
5
|
+
import { useEffect as r } from "react";
|
|
6
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/Popover/Popover.tsx
|
|
8
|
+
var a = () => {}, o = (e, t, n = {
|
|
9
|
+
top: 0,
|
|
10
|
+
bottom: 0,
|
|
11
|
+
left: 0,
|
|
12
|
+
right: 0
|
|
13
|
+
}) => {
|
|
14
|
+
let { top: r, bottom: i, left: a, right: o } = n;
|
|
15
|
+
if (t <= Math.floor(r) && e > a && e < o) return "top";
|
|
16
|
+
if (t >= Math.floor(i) && e > a && e < o) return "bottom";
|
|
17
|
+
if (e <= Math.floor(a) && t > r && t < i) return "left";
|
|
18
|
+
if (e >= Math.floor(o) && t > r && t < i) return "right";
|
|
19
|
+
}, s = ({ anchorEl: s, open: c = !1, placement: l, autoPlacement: u, children: d, offset: f, width: p, onOutsideClick: m = a, onOutsideHover: h = a, onMouseLeave: g = a, className: _, style: v, ...y }) => {
|
|
20
|
+
let b = t({
|
|
21
|
+
isOpen: c,
|
|
22
|
+
placement: l,
|
|
23
|
+
auto: u,
|
|
24
|
+
triggerOffset: f,
|
|
25
|
+
onOutsideClick: m
|
|
26
|
+
});
|
|
27
|
+
b.triggerProps.ref(s?.current ?? null);
|
|
28
|
+
let { renderLayer: x, layerProps: S, triggerBounds: C, layerSide: w } = b;
|
|
29
|
+
r(() => {
|
|
30
|
+
s?.current && (s.current.onmouseleave = (e) => {
|
|
31
|
+
let t = o(e.x, e.y, s.current?.getBoundingClientRect());
|
|
32
|
+
t && t !== w && h();
|
|
33
|
+
});
|
|
34
|
+
}, []);
|
|
35
|
+
let T = (e) => {
|
|
36
|
+
g(e), h();
|
|
37
|
+
};
|
|
38
|
+
return c ? x(/* @__PURE__ */ i("div", {
|
|
39
|
+
...y,
|
|
40
|
+
...S,
|
|
41
|
+
className: e(n(), _),
|
|
42
|
+
style: {
|
|
43
|
+
...S.style,
|
|
44
|
+
width: p ?? C?.width,
|
|
45
|
+
...v
|
|
46
|
+
},
|
|
47
|
+
onMouseLeave: T,
|
|
48
|
+
"data-clad": "Popover",
|
|
49
|
+
children: d
|
|
50
|
+
})) : null;
|
|
51
|
+
};
|
|
52
|
+
s.displayName = "Popover";
|
|
53
|
+
//#endregion
|
|
54
|
+
export { s as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);var e=(0,require(`tailwind-variants/lite`).tv)({base:`popover`});exports.popoverVariants=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../utils/cn.cjs`),n=require(`../Button/Button.cjs`),r=require(`../../utils/createUniversalPortal.cjs`),i=require(`../../utils/useBodyScrollLock.cjs`);let a=require(`react`);a=e.__toESM(a);let o=require(`@chotot/icons`),s=require(`react/jsx-runtime`);var c=()=>{},l={left:`start`,right:`end`,justify:`center`},u={row:`row-reverse`,column:`column`},d=a.createContext({}),f=({children:e,open:n=!1,onClose:o=c,className:l=``,needBypassScrollLock:u=!1,...f})=>{let p=a.useRef(null);i.default(n&&!u);let m=a.useMemo(()=>({onClose:o}),[o]);return n?r.default((0,s.jsx)(d.Provider,{value:m,children:(0,s.jsxs)(`div`,{ref:p,className:`popup-modal`,"data-clad":`Popup.Modal`,children:[(0,s.jsx)(`div`,{className:`popup-backdrop`,onClick:o}),(0,s.jsx)(`div`,{...f,className:t.default(`popup`,l),"data-clad":`Popup.Container`,children:e})]})})):null},p=({type:e=`icon`,icon:n,text:r,onClick:i,className:o=``,...c})=>{let{onClose:l}=a.useContext(d),u=i||l;return(0,s.jsx)(`button`,{...c,type:`button`,onClick:u,className:t.default(`popup-header-item-btn`,e===`textLink`&&`is-text-link`,o),"data-clad":`Popup.HeaderItem`,children:e===`textLink`?r:n})},m=({title:e,leading:n,trailing:r,className:i=``,...a})=>(0,s.jsxs)(`div`,{...a,className:t.default(`popup-slot-header`,i),"data-clad":`Popup.Header`,children:[(0,s.jsx)(`div`,{className:`header-leading`,children:n}),typeof e==`string`?(0,s.jsx)(`h5`,{className:`header-title`,children:e}):(0,s.jsx)(`div`,{className:`header-title`,children:e}),(0,s.jsx)(`div`,{className:`header-trailing`,children:r})]}),h=({children:e,className:n=``,childrenOverflowVisible:r=!1,...i})=>(0,s.jsx)(`div`,{...i,className:t.default(`popup-slot-body`,r&&`children-overflow-visible`,n),"data-clad":`Popup.Body`,children:e}),g=({children:e,direction:n=`horizontal`,className:r=``,...i})=>(0,s.jsx)(`div`,{...i,className:t.default(`popup-slot-button-group`,n===`vertical`&&`is-vertical`,r),"data-clad":`Popup.Button`,children:e}),_=Object.assign(({className:e=``,title:d=``,img:f,imgSize:p=`lg`,children:m,primaryBtnLabel:h=`Xác nhận`,secondaryBtnLabel:g,primaryColor:_=`primary`,secondaryColor:v=`tertiary`,haveClose:y=!0,btnGroupDirection:b=`row`,btnRowPosition:x=`justify`,open:S=!1,onClose:C,onPrimaryButtonClick:w=c,onSecondaryButtonClick:T=null,childrenOverflowVisible:E=!1,needBypassScrollLock:D=!1,...O})=>{let k=a.useRef(null);if(i.default(S&&!D),!S)return null;let A=t.default(`popup-children-wrapper`,(typeof m==`string`||typeof m==`number`)&&`is-single-string`,typeof h==`string`&&!h.trim()&&`no-button`,E&&`children-overflow-visible`),j={justifyContent:l[x]||l.justify,flexDirection:u[b]||u.row};return r.default((0,s.jsxs)(`div`,{ref:k,className:`popup-modal`,"data-clad":`Popup.Modal`,children:[(0,s.jsx)(`div`,{className:`popup-backdrop`,onClick:C}),(0,s.jsxs)(`div`,{...O,className:t.default(`popup`,e),"data-clad":`Popup`,children:[(0,s.jsx)(`div`,{className:t.default(`popup-header`,p),children:!!y&&(0,s.jsx)(`button`,{className:`popup-close-btn`,type:`button`,onClick:C,children:(0,s.jsx)(o.Close,{})})}),(0,s.jsxs)(`div`,{className:t.default(`popup-wrapper`,y&&`has-close`),children:[!!f&&(0,s.jsx)(`img`,{className:`popup-image`,src:f,alt:``}),!!d&&(0,s.jsx)(`h5`,{className:`popup-title`,children:d}),(0,s.jsx)(`div`,{className:A,children:m}),!!h&&(0,s.jsxs)(`div`,{className:`popup-button-group`,style:j,children:[(0,s.jsx)(n.default,{color:_,size:`large`,className:t.default((x===`justify`||b===`column`)&&`popup-btn-full`),onClick:w,children:h}),!!g&&(0,s.jsx)(n.default,{variant:`outline`,size:`large`,color:v,className:t.default((x===`justify`||b===`column`)&&`popup-btn-full`),onClick:T||C,children:g})]})]})]})]}))},{Container:f,Header:m,HeaderItem:p,Body:h,Button:g});exports.PopupBody=h,exports.PopupButton=g,exports.PopupContainer=f,exports.PopupHeader=m,exports.PopupHeaderItem=p,exports.default=_;
|
|
@@ -0,0 +1,148 @@
|
|
|
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 * as i from "react";
|
|
7
|
+
import { Close as a } from "@chotot/icons";
|
|
8
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/Popup/Popup.tsx
|
|
10
|
+
var c = () => {}, l = {
|
|
11
|
+
left: "start",
|
|
12
|
+
right: "end",
|
|
13
|
+
justify: "center"
|
|
14
|
+
}, u = {
|
|
15
|
+
row: "row-reverse",
|
|
16
|
+
column: "column"
|
|
17
|
+
}, d = i.createContext({}), f = ({ children: t, open: a = !1, onClose: l = c, className: u = "", needBypassScrollLock: f = !1, ...p }) => {
|
|
18
|
+
let m = i.useRef(null);
|
|
19
|
+
r(a && !f);
|
|
20
|
+
let h = i.useMemo(() => ({ onClose: l }), [l]);
|
|
21
|
+
return a ? n(/* @__PURE__ */ o(d.Provider, {
|
|
22
|
+
value: h,
|
|
23
|
+
children: /* @__PURE__ */ s("div", {
|
|
24
|
+
ref: m,
|
|
25
|
+
className: "popup-modal",
|
|
26
|
+
"data-clad": "Popup.Modal",
|
|
27
|
+
children: [/* @__PURE__ */ o("div", {
|
|
28
|
+
className: "popup-backdrop",
|
|
29
|
+
onClick: l
|
|
30
|
+
}), /* @__PURE__ */ o("div", {
|
|
31
|
+
...p,
|
|
32
|
+
className: e("popup", u),
|
|
33
|
+
"data-clad": "Popup.Container",
|
|
34
|
+
children: t
|
|
35
|
+
})]
|
|
36
|
+
})
|
|
37
|
+
})) : null;
|
|
38
|
+
}, p = ({ type: t = "icon", icon: n, text: r, onClick: a, className: s = "", ...c }) => {
|
|
39
|
+
let { onClose: l } = i.useContext(d), u = a || l;
|
|
40
|
+
return /* @__PURE__ */ o("button", {
|
|
41
|
+
...c,
|
|
42
|
+
type: "button",
|
|
43
|
+
onClick: u,
|
|
44
|
+
className: e("popup-header-item-btn", t === "textLink" && "is-text-link", s),
|
|
45
|
+
"data-clad": "Popup.HeaderItem",
|
|
46
|
+
children: t === "textLink" ? r : n
|
|
47
|
+
});
|
|
48
|
+
}, m = ({ title: t, leading: n, trailing: r, className: i = "", ...a }) => /* @__PURE__ */ s("div", {
|
|
49
|
+
...a,
|
|
50
|
+
className: e("popup-slot-header", i),
|
|
51
|
+
"data-clad": "Popup.Header",
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ o("div", {
|
|
54
|
+
className: "header-leading",
|
|
55
|
+
children: n
|
|
56
|
+
}),
|
|
57
|
+
o(typeof t == "string" ? "h5" : "div", {
|
|
58
|
+
className: "header-title",
|
|
59
|
+
children: t
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ o("div", {
|
|
62
|
+
className: "header-trailing",
|
|
63
|
+
children: r
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
}), h = ({ children: t, className: n = "", childrenOverflowVisible: r = !1, ...i }) => /* @__PURE__ */ o("div", {
|
|
67
|
+
...i,
|
|
68
|
+
className: e("popup-slot-body", r && "children-overflow-visible", n),
|
|
69
|
+
"data-clad": "Popup.Body",
|
|
70
|
+
children: t
|
|
71
|
+
}), g = ({ children: t, direction: n = "horizontal", className: r = "", ...i }) => /* @__PURE__ */ o("div", {
|
|
72
|
+
...i,
|
|
73
|
+
className: e("popup-slot-button-group", n === "vertical" && "is-vertical", r),
|
|
74
|
+
"data-clad": "Popup.Button",
|
|
75
|
+
children: t
|
|
76
|
+
}), _ = Object.assign(({ className: d = "", title: f = "", img: p, imgSize: m = "lg", children: h, primaryBtnLabel: g = "Xác nhận", secondaryBtnLabel: _, primaryColor: v = "primary", secondaryColor: y = "tertiary", haveClose: b = !0, btnGroupDirection: x = "row", btnRowPosition: S = "justify", open: C = !1, onClose: w, onPrimaryButtonClick: T = c, onSecondaryButtonClick: E = null, childrenOverflowVisible: D = !1, needBypassScrollLock: O = !1, ...k }) => {
|
|
77
|
+
let A = i.useRef(null);
|
|
78
|
+
if (r(C && !O), !C) return null;
|
|
79
|
+
let j = e("popup-children-wrapper", (typeof h == "string" || typeof h == "number") && "is-single-string", typeof g == "string" && !g.trim() && "no-button", D && "children-overflow-visible"), M = {
|
|
80
|
+
justifyContent: l[S] || l.justify,
|
|
81
|
+
flexDirection: u[x] || u.row
|
|
82
|
+
};
|
|
83
|
+
return n(/* @__PURE__ */ s("div", {
|
|
84
|
+
ref: A,
|
|
85
|
+
className: "popup-modal",
|
|
86
|
+
"data-clad": "Popup.Modal",
|
|
87
|
+
children: [/* @__PURE__ */ o("div", {
|
|
88
|
+
className: "popup-backdrop",
|
|
89
|
+
onClick: w
|
|
90
|
+
}), /* @__PURE__ */ s("div", {
|
|
91
|
+
...k,
|
|
92
|
+
className: e("popup", d),
|
|
93
|
+
"data-clad": "Popup",
|
|
94
|
+
children: [/* @__PURE__ */ o("div", {
|
|
95
|
+
className: e("popup-header", m),
|
|
96
|
+
children: !!b && /* @__PURE__ */ o("button", {
|
|
97
|
+
className: "popup-close-btn",
|
|
98
|
+
type: "button",
|
|
99
|
+
onClick: w,
|
|
100
|
+
children: /* @__PURE__ */ o(a, {})
|
|
101
|
+
})
|
|
102
|
+
}), /* @__PURE__ */ s("div", {
|
|
103
|
+
className: e("popup-wrapper", b && "has-close"),
|
|
104
|
+
children: [
|
|
105
|
+
!!p && /* @__PURE__ */ o("img", {
|
|
106
|
+
className: "popup-image",
|
|
107
|
+
src: p,
|
|
108
|
+
alt: ""
|
|
109
|
+
}),
|
|
110
|
+
!!f && /* @__PURE__ */ o("h5", {
|
|
111
|
+
className: "popup-title",
|
|
112
|
+
children: f
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ o("div", {
|
|
115
|
+
className: j,
|
|
116
|
+
children: h
|
|
117
|
+
}),
|
|
118
|
+
!!g && /* @__PURE__ */ s("div", {
|
|
119
|
+
className: "popup-button-group",
|
|
120
|
+
style: M,
|
|
121
|
+
children: [/* @__PURE__ */ o(t, {
|
|
122
|
+
color: v,
|
|
123
|
+
size: "large",
|
|
124
|
+
className: e((S === "justify" || x === "column") && "popup-btn-full"),
|
|
125
|
+
onClick: T,
|
|
126
|
+
children: g
|
|
127
|
+
}), !!_ && /* @__PURE__ */ o(t, {
|
|
128
|
+
variant: "outline",
|
|
129
|
+
size: "large",
|
|
130
|
+
color: y,
|
|
131
|
+
className: e((S === "justify" || x === "column") && "popup-btn-full"),
|
|
132
|
+
onClick: E || w,
|
|
133
|
+
children: _
|
|
134
|
+
})]
|
|
135
|
+
})
|
|
136
|
+
]
|
|
137
|
+
})]
|
|
138
|
+
})]
|
|
139
|
+
}));
|
|
140
|
+
}, {
|
|
141
|
+
Container: f,
|
|
142
|
+
Header: m,
|
|
143
|
+
HeaderItem: p,
|
|
144
|
+
Body: h,
|
|
145
|
+
Button: g
|
|
146
|
+
});
|
|
147
|
+
//#endregion
|
|
148
|
+
export { h as PopupBody, g as PopupButton, f as PopupContainer, m as PopupHeader, p as PopupHeaderItem, _ as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils/cn.cjs`),t=require(`../../types/index.cjs`),n=require(`./radio-button.styles.cjs`);let r=require(`react`),i=require(`@chotot/icons`),a=require(`react/jsx-runtime`);var o=()=>{},s={vW:`100vw`,vH:`100vh`,quarter:`25%`,third:`33.33%`,half:`50%`,twoThird:`66.66%`,threeQuarter:`75%`,full:`100%`,xxxs:`12px`,xxs:`16px`,xs:`20px`,sm:`24px`,md:`28px`,lg:`32px`,lxl:`40px`,xl:`48px`,xxl:`64px`,xxxl:`80px`,xxxxl:`96px`,xxxxxl:`128px`,buttonMaxWidth:`352px`,$sm:`236px`,$md:`480px`,$lg:`636px`,$xl:`864px`},c=t.forwardRef((t,c)=>{let{id:l=``,className:u=``,name:d=``,value:f=``,checked:p=!1,label:m=``,width:h=`xs`,color:g=`primary`,disabled:_=!1,onChange:v=o,...y}=t,b=e.default(n.radioButtonVariants({color:g}),_&&`radio--disabled`,m&&`radio--with-label`,u),x={id:l,name:d,value:f,type:`radio`,disabled:_,checked:p,onChange:v};return(0,a.jsx)(`div`,{"data-clad":`Radio`,className:`radio-wrapper`,style:{width:s[h]||h},children:(0,r.createElement)(`label`,{ref:c,className:b,...y},(0,r.createElement)(`input`,x),(0,r.createElement)(`span`,{className:`radio-indicator`,"aria-hidden":!0},(0,r.createElement)(i.Check,{"aria-hidden":!0})),m||null)})});c.displayName=`RadioButton`,exports.default=c;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import e from "../../utils/cn.es.js";
|
|
3
|
+
import { forwardRef as t } from "../../types/index.es.js";
|
|
4
|
+
import { radioButtonVariants as n } from "./radio-button.styles.es.js";
|
|
5
|
+
import { createElement as r } from "react";
|
|
6
|
+
import { Check as i } from "@chotot/icons";
|
|
7
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/RadioButton/RadioButton.tsx
|
|
9
|
+
var o = () => {}, s = {
|
|
10
|
+
vW: "100vw",
|
|
11
|
+
vH: "100vh",
|
|
12
|
+
quarter: "25%",
|
|
13
|
+
third: "33.33%",
|
|
14
|
+
half: "50%",
|
|
15
|
+
twoThird: "66.66%",
|
|
16
|
+
threeQuarter: "75%",
|
|
17
|
+
full: "100%",
|
|
18
|
+
xxxs: "12px",
|
|
19
|
+
xxs: "16px",
|
|
20
|
+
xs: "20px",
|
|
21
|
+
sm: "24px",
|
|
22
|
+
md: "28px",
|
|
23
|
+
lg: "32px",
|
|
24
|
+
lxl: "40px",
|
|
25
|
+
xl: "48px",
|
|
26
|
+
xxl: "64px",
|
|
27
|
+
xxxl: "80px",
|
|
28
|
+
xxxxl: "96px",
|
|
29
|
+
xxxxxl: "128px",
|
|
30
|
+
buttonMaxWidth: "352px",
|
|
31
|
+
$sm: "236px",
|
|
32
|
+
$md: "480px",
|
|
33
|
+
$lg: "636px",
|
|
34
|
+
$xl: "864px"
|
|
35
|
+
}, c = t((t, c) => {
|
|
36
|
+
let { id: l = "", className: u = "", name: d = "", value: f = "", checked: p = !1, label: m = "", width: h = "xs", color: g = "primary", disabled: _ = !1, onChange: v = o, ...y } = t, b = e(n({ color: g }), _ && "radio--disabled", m && "radio--with-label", u), x = {
|
|
37
|
+
id: l,
|
|
38
|
+
name: d,
|
|
39
|
+
value: f,
|
|
40
|
+
type: "radio",
|
|
41
|
+
disabled: _,
|
|
42
|
+
checked: p,
|
|
43
|
+
onChange: v
|
|
44
|
+
};
|
|
45
|
+
return /* @__PURE__ */ a("div", {
|
|
46
|
+
"data-clad": "Radio",
|
|
47
|
+
className: "radio-wrapper",
|
|
48
|
+
style: { width: s[h] || h },
|
|
49
|
+
children: r("label", {
|
|
50
|
+
ref: c,
|
|
51
|
+
className: b,
|
|
52
|
+
...y
|
|
53
|
+
}, r("input", x), r("span", {
|
|
54
|
+
className: "radio-indicator",
|
|
55
|
+
"aria-hidden": !0
|
|
56
|
+
}, r(i, { "aria-hidden": !0 })), m || null)
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
c.displayName = "RadioButton";
|
|
60
|
+
//#endregion
|
|
61
|
+
export { c as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);var e=(0,require(`tailwind-variants/lite`).tv)({base:`radio`,defaultVariants:{color:`primary`},variants:{color:{primary:`radio--primary`,info:`radio--info`,success:`radio--success`,error:`radio--error`,neutral:`radio--neutral`}}});exports.radioButtonVariants=e;
|