@vkzstudio/muza-ui 1.0.44 → 1.0.45
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/dist/components/DataTable/DataTable.d.ts +14 -5
- package/dist/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/components/DataTable/DataTable.js +39 -39
- package/dist/components/DataTable/DataTable.stories.d.ts.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +38 -7
- package/dist/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +165 -163
- package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts +3 -17
- package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts.map +1 -1
- package/dist/components/ExpandableTable/ExpandableTable.d.ts +30 -11
- package/dist/components/ExpandableTable/ExpandableTable.d.ts.map +1 -1
- package/dist/components/ExpandableTable/ExpandableTable.js +100 -111
- package/dist/components/ExpandableTable/ExpandableTable.stories.d.ts +3 -1
- package/dist/components/ExpandableTable/ExpandableTable.stories.d.ts.map +1 -1
- package/dist/components/FileUpload/FileItem.d.ts +6 -0
- package/dist/components/FileUpload/FileItem.d.ts.map +1 -1
- package/dist/components/FileUpload/FileItem.js +38 -41
- package/dist/components/FileUpload/FileUpload.d.ts +32 -0
- package/dist/components/FileUpload/FileUpload.d.ts.map +1 -1
- package/dist/components/FileUpload/FileUpload.js +87 -83
- package/dist/components/FileUpload/FileUpload.stories.d.ts +1 -0
- package/dist/components/FileUpload/FileUpload.stories.d.ts.map +1 -1
- package/dist/components/Flex/Flex.d.ts +1 -1
- package/dist/components/Icons/CustomBadges.d.ts +14 -0
- package/dist/components/Icons/CustomBadges.d.ts.map +1 -0
- package/dist/components/Icons/CustomBadges.js +334 -0
- package/dist/components/Icons/CustomIcons.d.ts +24 -0
- package/dist/components/Icons/CustomIcons.d.ts.map +1 -1
- package/dist/components/Icons/CustomIcons.js +88 -42
- package/dist/components/Icons/CustomLogos.d.ts +29 -0
- package/dist/components/Icons/CustomLogos.d.ts.map +1 -0
- package/dist/components/Icons/CustomLogos.js +593 -0
- package/dist/components/Icons/LogosAndBadges.stories.d.ts +7 -0
- package/dist/components/Icons/LogosAndBadges.stories.d.ts.map +1 -0
- package/dist/components/Icons/index.d.ts +2 -0
- package/dist/components/Icons/index.d.ts.map +1 -1
- package/dist/components/LanguageSwitcher/LanguageSwitcher.d.ts +24 -1
- package/dist/components/LanguageSwitcher/LanguageSwitcher.d.ts.map +1 -1
- package/dist/components/LanguageSwitcher/LanguageSwitcher.js +71 -52
- package/dist/components/LanguageSwitcher/LanguageSwitcher.stories.d.ts +2 -0
- package/dist/components/LanguageSwitcher/LanguageSwitcher.stories.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +18 -17
- package/dist/components/ResponsiveLayoutTable/ResponsiveLayoutTable.d.ts +266 -0
- package/dist/components/ResponsiveLayoutTable/ResponsiveLayoutTable.d.ts.map +1 -0
- package/dist/components/ResponsiveLayoutTable/ResponsiveLayoutTable.examples.d.ts +39 -0
- package/dist/components/ResponsiveLayoutTable/ResponsiveLayoutTable.examples.d.ts.map +1 -0
- package/dist/components/ResponsiveLayoutTable/ResponsiveLayoutTable.js +134 -0
- package/dist/components/ResponsiveLayoutTable/ResponsiveLayoutTable.stories.d.ts +14 -0
- package/dist/components/ResponsiveLayoutTable/ResponsiveLayoutTable.stories.d.ts.map +1 -0
- package/dist/components/ResponsiveLayoutTable/index.d.ts +2 -0
- package/dist/components/ResponsiveLayoutTable/index.d.ts.map +1 -0
- package/dist/components/Select/Select.d.ts +20 -7
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.js +123 -92
- package/dist/components/Select/Select.stories.d.ts +1 -0
- package/dist/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/components/Select/utils.d.ts +1 -0
- package/dist/components/Select/utils.d.ts.map +1 -1
- package/dist/components/Select/utils.js +5 -2
- package/dist/components/Toggle/Toggle.js +1 -1
- package/dist/components/ToggleCheckButton/ToggleCheckButton.d.ts +69 -0
- package/dist/components/ToggleCheckButton/ToggleCheckButton.d.ts.map +1 -0
- package/dist/components/ToggleCheckButton/ToggleCheckButton.js +64 -0
- package/dist/components/ToggleCheckButton/ToggleCheckButton.stories.d.ts +8 -0
- package/dist/components/ToggleCheckButton/ToggleCheckButton.stories.d.ts.map +1 -0
- package/dist/components/ToggleCheckButton/index.d.ts +2 -0
- package/dist/components/ToggleCheckButton/index.d.ts.map +1 -0
- package/dist/components/WebCheckoutNav/WebCheckoutNav.examples.d.ts +19 -0
- package/dist/components/WebCheckoutNav/WebCheckoutNav.examples.d.ts.map +1 -0
- package/dist/components/WebCheckoutNav/WebCheckoutNav.stories.d.ts +8 -0
- package/dist/components/WebCheckoutNav/WebCheckoutNav.stories.d.ts.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/hooks/use-is-breakpoint.d.ts +11 -0
- package/dist/hooks/use-is-breakpoint.d.ts.map +1 -1
- package/dist/hooks/use-is-breakpoint.js +24 -13
- package/dist/index.js +236 -215
- package/dist/muza-ui.css +1 -1
- package/dist/styles/token-colors.css +64 -3
- package/dist/styles/token-sizes.css +86 -54
- package/dist/utils/cn.d.ts.map +1 -1
- package/dist/utils/cn.js +16 -5
- package/package.json +1 -1
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { jsx as r, jsxs as T } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { useBreakpoints as E } from "../../hooks/use-is-breakpoint.js";
|
|
4
|
+
import { Skeleton as H } from "../Skeleton/Skeleton.js";
|
|
5
|
+
import { cn as l } from "../../utils/cn.js";
|
|
6
|
+
import { typographyVariants as S, Typography as V } from "../Typography/Typography.js";
|
|
7
|
+
const J = ({
|
|
8
|
+
data: y,
|
|
9
|
+
layouts: n,
|
|
10
|
+
onRowClick: f,
|
|
11
|
+
disabled: o = !1,
|
|
12
|
+
isRowNew: h,
|
|
13
|
+
isRowLoading: d,
|
|
14
|
+
overflowingRowBackground: i = !1,
|
|
15
|
+
classNames: c,
|
|
16
|
+
tableLayout: x,
|
|
17
|
+
...k
|
|
18
|
+
}) => {
|
|
19
|
+
const K = E(), g = (() => {
|
|
20
|
+
for (const e of n) {
|
|
21
|
+
if (e.responsive === void 0) return e;
|
|
22
|
+
if (typeof e.responsive == "boolean") {
|
|
23
|
+
if (e.responsive) return e;
|
|
24
|
+
} else if (K[e.responsive])
|
|
25
|
+
return e;
|
|
26
|
+
}
|
|
27
|
+
return n[n.length - 1];
|
|
28
|
+
})(), {
|
|
29
|
+
columns: u,
|
|
30
|
+
showHeader: m = !0,
|
|
31
|
+
classNames: p
|
|
32
|
+
} = g, j = !!f && !o;
|
|
33
|
+
return /* @__PURE__ */ r(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
className: l(
|
|
37
|
+
"w-full",
|
|
38
|
+
i ? "overflow-visible" : "overflow-x-auto overflow-y-hidden",
|
|
39
|
+
c == null ? void 0 : c.root
|
|
40
|
+
),
|
|
41
|
+
...k,
|
|
42
|
+
children: /* @__PURE__ */ T(
|
|
43
|
+
"table",
|
|
44
|
+
{
|
|
45
|
+
className: l("w-full border-collapse", {
|
|
46
|
+
"table-fixed": x === "fixed"
|
|
47
|
+
}),
|
|
48
|
+
children: [
|
|
49
|
+
m && /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ r("tr", { className: l(p == null ? void 0 : p.header), children: u.map((e, s) => /* @__PURE__ */ r(
|
|
50
|
+
"th",
|
|
51
|
+
{
|
|
52
|
+
className: l(
|
|
53
|
+
S({
|
|
54
|
+
size: "sm",
|
|
55
|
+
uppercase: !0,
|
|
56
|
+
variant: "body",
|
|
57
|
+
weight: "medium"
|
|
58
|
+
}),
|
|
59
|
+
"h-comp-webcheckout-table-cells-h-first-row",
|
|
60
|
+
"px-comp-webcheckout-table-cells-p-hor py-comp-webcheckout-table-cells-p-ver text-left",
|
|
61
|
+
"text-text-dark-secondary",
|
|
62
|
+
{ "text-text-dark-disabled": o },
|
|
63
|
+
e.className
|
|
64
|
+
),
|
|
65
|
+
children: e.title
|
|
66
|
+
},
|
|
67
|
+
s
|
|
68
|
+
)) }) }),
|
|
69
|
+
/* @__PURE__ */ r("tbody", { children: y.map((e, s) => {
|
|
70
|
+
const a = (d == null ? void 0 : d(e, s)) ?? !1, v = !a && ((h == null ? void 0 : h(e, s)) ?? !1), b = j && !a;
|
|
71
|
+
return /* @__PURE__ */ r(
|
|
72
|
+
"tr",
|
|
73
|
+
{
|
|
74
|
+
className: l(
|
|
75
|
+
"border-t border-stroke-base-secondary",
|
|
76
|
+
!m && "first:border-t-0",
|
|
77
|
+
{
|
|
78
|
+
"relative before:absolute before:inset-0 before:content-['']": i,
|
|
79
|
+
"bg-comp-responsive-layout-table-bg-success": !i && v,
|
|
80
|
+
"before:bg-comp-responsive-layout-table-bg-success": i && v,
|
|
81
|
+
"cursor-pointer": b,
|
|
82
|
+
"outline-0 hover:bg-surface-state-bg-info focus-visible:bg-surface-state-bg-info": b && !i,
|
|
83
|
+
"outline-0 hover:before:bg-surface-state-bg-info focus-visible:before:bg-surface-state-bg-info": b && i
|
|
84
|
+
},
|
|
85
|
+
i && (c == null ? void 0 : c.rowBackgroundInset),
|
|
86
|
+
p == null ? void 0 : p.row
|
|
87
|
+
),
|
|
88
|
+
onClick: b ? () => f(e, s) : void 0,
|
|
89
|
+
onKeyDown: b ? (t) => {
|
|
90
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), f(e, s));
|
|
91
|
+
} : void 0,
|
|
92
|
+
tabIndex: b ? 0 : void 0,
|
|
93
|
+
"aria-busy": a || void 0,
|
|
94
|
+
children: u.map((t, z) => /* @__PURE__ */ r(
|
|
95
|
+
"td",
|
|
96
|
+
{
|
|
97
|
+
className: l(
|
|
98
|
+
"h-comp-webcheckout-table-cells-h w-full",
|
|
99
|
+
"px-comp-webcheckout-table-cells-p-hor py-comp-webcheckout-table-cells-p-ver",
|
|
100
|
+
i && "relative",
|
|
101
|
+
t.className
|
|
102
|
+
),
|
|
103
|
+
children: a ? t.skeleton ?? /* @__PURE__ */ r(H, { color: "light", className: "h-4 w-full" }) : t.render ? t.render(e, s, o) : /* @__PURE__ */ r(
|
|
104
|
+
V,
|
|
105
|
+
{
|
|
106
|
+
variant: "body",
|
|
107
|
+
size: "base",
|
|
108
|
+
weight: "medium",
|
|
109
|
+
component: "span",
|
|
110
|
+
fixY: !0,
|
|
111
|
+
className: l({
|
|
112
|
+
"line-clamp-1": t.lineClamp === !0 || t.lineClamp === 1,
|
|
113
|
+
"line-clamp-2": t.lineClamp === 2,
|
|
114
|
+
"text-text-dark-disabled": o
|
|
115
|
+
}),
|
|
116
|
+
children: t.dataKey ? e[t.dataKey] : null
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
},
|
|
120
|
+
z
|
|
121
|
+
))
|
|
122
|
+
},
|
|
123
|
+
e.id
|
|
124
|
+
);
|
|
125
|
+
}) })
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
export {
|
|
133
|
+
J as ResponsiveLayoutTable
|
|
134
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: Meta;
|
|
3
|
+
export default meta;
|
|
4
|
+
type Story = StoryObj;
|
|
5
|
+
export declare const Default: Story;
|
|
6
|
+
export declare const WithRowClick: Story;
|
|
7
|
+
export declare const WithNewRow: Story;
|
|
8
|
+
export declare const NewRowWithRowClick: Story;
|
|
9
|
+
export declare const OverflowingRowBackground: Story;
|
|
10
|
+
export declare const Disabled: Story;
|
|
11
|
+
export declare const Loading: Story;
|
|
12
|
+
export declare const LoadingMore: Story;
|
|
13
|
+
export declare const CustomBreakpoint: Story;
|
|
14
|
+
//# sourceMappingURL=ResponsiveLayoutTable.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResponsiveLayoutTable.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ResponsiveLayoutTable/ResponsiveLayoutTable.stories.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAiB3D,QAAA,MAAM,IAAI,EAAE,IAoDX,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAA;AAErB,eAAO,MAAM,OAAO,EAAE,KAmBrB,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAuB1B,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAoBxB,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,KAwBhC,CAAA;AAED,eAAO,MAAM,wBAAwB,EAAE,KA8BtC,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAsBtB,CAAA;AAUD,eAAO,MAAM,OAAO,EAAE,KAoBrB,CAAA;AAeD,eAAO,MAAM,WAAW,EAAE,KAwBzB,CAAA;AAID,eAAO,MAAM,gBAAgB,EAAE,KA6B9B,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { ResponsiveLayoutTable, type ResponsiveLayoutTableProps, type ResponsiveLayoutTableLayout, type ResponsiveLayoutTableColumn, type ResponsiveLayoutTableClassNames, type ResponsiveLayoutTableLayoutClassNames, } from './ResponsiveLayoutTable';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ResponsiveLayoutTable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,+BAA+B,EACpC,KAAK,qCAAqC,GAC3C,MAAM,yBAAyB,CAAA"}
|
|
@@ -6,6 +6,7 @@ import { default as React, ReactNode } from 'react';
|
|
|
6
6
|
* const options: ISelectOption[] = [
|
|
7
7
|
* { value: 'a', label: 'Option A' },
|
|
8
8
|
* { value: 'b', label: 'Option B', disabled: true, icon: <Icon /> },
|
|
9
|
+
* { value: 'c', label: 'Location C', description: 'Address line' },
|
|
9
10
|
* ]
|
|
10
11
|
*/
|
|
11
12
|
export interface ISelectOption {
|
|
@@ -13,6 +14,8 @@ export interface ISelectOption {
|
|
|
13
14
|
value: string;
|
|
14
15
|
/** Visible label rendered inside the dropdown item and in the trigger when selected. */
|
|
15
16
|
label: ReactNode;
|
|
17
|
+
/** Secondary text rendered below the label, producing a two-line layout. */
|
|
18
|
+
description?: ReactNode;
|
|
16
19
|
/** Prevents the option from being selected and applies disabled styling. @default false */
|
|
17
20
|
disabled?: boolean;
|
|
18
21
|
/** Icon rendered before the option label inside the dropdown. */
|
|
@@ -20,23 +23,25 @@ export interface ISelectOption {
|
|
|
20
23
|
}
|
|
21
24
|
/**
|
|
22
25
|
* Props for the Select component.
|
|
26
|
+
*
|
|
27
|
+
* @see ISelectOption
|
|
23
28
|
*/
|
|
24
29
|
export interface ISelectProps {
|
|
25
|
-
/** Label text
|
|
30
|
+
/** Label text rendered above the trigger by `FormField`. */
|
|
26
31
|
label?: string;
|
|
27
|
-
/** Helper text
|
|
32
|
+
/** Helper text rendered below the trigger. Switches to the error color when `error` is `true`. */
|
|
28
33
|
hint?: string;
|
|
29
|
-
/** Applies error styling to the trigger border and hint text. @default false */
|
|
34
|
+
/** Applies error styling to the trigger border and `hint` text. @default false */
|
|
30
35
|
error?: boolean;
|
|
31
36
|
/** Marks the field as required and shows an asterisk next to the label. @default false */
|
|
32
37
|
required?: boolean;
|
|
33
|
-
/** Hides the required asterisk even when `required` is true
|
|
38
|
+
/** Hides the required asterisk even when `required` is `true`. @default false */
|
|
34
39
|
disableRequiredAsterisk?: boolean;
|
|
35
40
|
/** Element rendered after the selected value inside the trigger. */
|
|
36
41
|
suffix?: ReactNode;
|
|
37
42
|
/** Icon or element rendered before the selected value inside the trigger. */
|
|
38
43
|
prefix?: ReactNode;
|
|
39
|
-
/**
|
|
44
|
+
/** Placeholder text shown when no option is selected. @default translations.select.placeholder */
|
|
40
45
|
placeholder?: string;
|
|
41
46
|
/** Text shown inside the dropdown when `options` is empty. @default translations.select.noOptions */
|
|
42
47
|
emptyMessage?: string;
|
|
@@ -51,6 +56,7 @@ export interface ISelectProps {
|
|
|
51
56
|
* options={[
|
|
52
57
|
* { value: 'a', label: 'Option A' },
|
|
53
58
|
* { value: 'b', label: 'Option B', disabled: true, icon: <Icon /> },
|
|
59
|
+
* { value: 'c', label: 'Location C', description: 'Address line' },
|
|
54
60
|
* ]}
|
|
55
61
|
* />
|
|
56
62
|
*/
|
|
@@ -59,9 +65,16 @@ export interface ISelectProps {
|
|
|
59
65
|
disabled?: boolean;
|
|
60
66
|
/** Controlled selected value. Must match a `value` field in `options`. */
|
|
61
67
|
value?: string;
|
|
62
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Fires when the user picks an option. Receives the newly selected `value` string.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```tsx
|
|
73
|
+
* <Select onChange={(value) => setSelected(value)} />
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
63
76
|
onChange?: (value: string) => void;
|
|
64
|
-
/** Scrolls the dropdown to the selected option when
|
|
77
|
+
/** Scrolls the dropdown to the selected option when it opens. @default false */
|
|
65
78
|
shouldScrollToSelectedOption?: boolean;
|
|
66
79
|
/** Distance in pixels from the viewport edge before the dropdown repositions. Passed to Radix collision padding. */
|
|
67
80
|
collisionPadding?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/Select/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/Select/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;AAgBd;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B,+EAA+E;IAC/E,KAAK,EAAE,MAAM,CAAA;IACb,wFAAwF;IACxF,KAAK,EAAE,SAAS,CAAA;IAChB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iEAAiE;IACjE,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kGAAkG;IAClG,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kFAAkF;IAClF,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iFAAiF;IACjF,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,oEAAoE;IACpE,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,kGAAkG;IAClG,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,qGAAqG;IACrG,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,2DAA2D;IAC3D,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;IAClC;;;;;;;;;;;;OAYG;IACH,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,gFAAgF;IAChF,4BAA4B,CAAC,EAAE,OAAO,CAAA;IACtC,oHAAoH;IACpH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,6HAA6H;IAC7H,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,sGAAsG;IACtG,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,eAAO,MAAM,MAAM,wFA+OlB,CAAA"}
|
|
@@ -1,111 +1,140 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { triggerWrapperVariants as
|
|
4
|
-
import { useMuzaTranslations as
|
|
5
|
-
import { FormField as
|
|
6
|
-
import { Typography as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { cn as
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
import { jsx as t, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import f, { forwardRef as G, useId as L, useMemo as U, useRef as S, useEffect as T } from "react";
|
|
3
|
+
import { triggerWrapperVariants as H } from "./utils.js";
|
|
4
|
+
import { useMuzaTranslations as J } from "../../translations/TranslationContext.js";
|
|
5
|
+
import { FormField as K } from "../FormField/FormField.js";
|
|
6
|
+
import { Typography as o } from "../Typography/Typography.js";
|
|
7
|
+
import { Flex as Q } from "../Flex/Flex.js";
|
|
8
|
+
import { DropdownMenu as X, DropdownMenuTrigger as Y, DropdownMenuContent as Z, DropdownMenuRadioGroup as ee, DropdownMenuRadioItem as te } from "../DropdownMenu/DropdownMenu.js";
|
|
9
|
+
import { cn as D } from "../../utils/cn.js";
|
|
10
|
+
import { AltArrowUpOutline as re } from "@solar-icons/react-perf";
|
|
11
|
+
const ne = G(
|
|
12
|
+
(I, h) => {
|
|
13
|
+
const g = J(), {
|
|
14
|
+
label: x,
|
|
15
|
+
hint: b,
|
|
16
|
+
error: w,
|
|
17
|
+
options: a,
|
|
18
|
+
onChange: d,
|
|
19
|
+
value: n,
|
|
20
|
+
disabled: s,
|
|
21
|
+
prefix: y,
|
|
22
|
+
size: O,
|
|
23
|
+
placeholder: W,
|
|
24
|
+
emptyMessage: A,
|
|
25
|
+
shouldScrollToSelectedOption: v,
|
|
26
|
+
collisionPadding: C,
|
|
27
|
+
required: N,
|
|
28
|
+
disableRequiredAsterisk: F,
|
|
29
|
+
labelExtra: V,
|
|
30
|
+
infoTooltip: q
|
|
31
|
+
} = I, R = W ?? g.select.placeholder, E = A ?? g.select.noOptions, M = L(), P = x ? `${M}-label` : void 0, $ = b ? `${M}-hint` : void 0, r = n ? a.find((e) => e.value === n) : void 0, j = U(() => r ? r.description ? /* @__PURE__ */ u(Q, { flex: 1, direction: "column", className: "min-w-0 text-left", children: [
|
|
32
|
+
/* @__PURE__ */ t(
|
|
33
|
+
o,
|
|
34
34
|
{
|
|
35
|
-
size: "
|
|
36
|
-
|
|
35
|
+
size: "sm",
|
|
36
|
+
variant: "title",
|
|
37
37
|
weight: "medium",
|
|
38
38
|
component: "span",
|
|
39
|
-
|
|
39
|
+
className: "truncate text-comp-select-text-primary",
|
|
40
|
+
children: r.label
|
|
40
41
|
}
|
|
41
|
-
)
|
|
42
|
-
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ t(
|
|
44
|
+
o,
|
|
43
45
|
{
|
|
44
|
-
size: "
|
|
45
|
-
|
|
46
|
+
size: "sm",
|
|
47
|
+
variant: "body",
|
|
46
48
|
weight: "regular",
|
|
47
49
|
component: "span",
|
|
48
|
-
|
|
50
|
+
className: "truncate text-comp-select-text-primary",
|
|
51
|
+
children: r.description
|
|
49
52
|
}
|
|
50
|
-
)
|
|
51
|
-
|
|
53
|
+
)
|
|
54
|
+
] }) : typeof r.label != "function" ? /* @__PURE__ */ t(
|
|
55
|
+
o,
|
|
56
|
+
{
|
|
57
|
+
size: "input",
|
|
58
|
+
className: "grow-1 fix-y-text truncate text-left text-comp-select-text-primary",
|
|
59
|
+
weight: "medium",
|
|
60
|
+
component: "span",
|
|
61
|
+
children: r.label
|
|
62
|
+
}
|
|
63
|
+
) : r.label : /* @__PURE__ */ t(
|
|
64
|
+
o,
|
|
65
|
+
{
|
|
66
|
+
size: "input",
|
|
67
|
+
className: "grow-1 fix-y-text truncate text-left text-comp-select-text-placeholder",
|
|
68
|
+
weight: "regular",
|
|
69
|
+
component: "span",
|
|
70
|
+
children: R
|
|
71
|
+
}
|
|
72
|
+
), [r, R]), [l, k] = f.useState(!1), [z, _] = f.useState(0), p = f.useRef(!1), B = S(null), m = S({}), i = (typeof h == "function" ? null : h) ?? B;
|
|
52
73
|
return T(() => {
|
|
53
74
|
const e = () => {
|
|
54
|
-
|
|
75
|
+
i.current && _(i.current.offsetWidth);
|
|
55
76
|
};
|
|
56
77
|
e();
|
|
57
|
-
const
|
|
58
|
-
return
|
|
59
|
-
|
|
78
|
+
const c = new ResizeObserver(e);
|
|
79
|
+
return i.current && c.observe(i.current), () => {
|
|
80
|
+
c.disconnect();
|
|
60
81
|
};
|
|
61
|
-
}, [
|
|
82
|
+
}, [i]), T(() => {
|
|
62
83
|
var e;
|
|
63
|
-
|
|
64
|
-
}, [
|
|
65
|
-
|
|
84
|
+
l && n && m.current[n] && v && ((e = m.current[n]) == null || e.scrollIntoView({ block: "nearest" }));
|
|
85
|
+
}, [l, v, n]), /* @__PURE__ */ t(
|
|
86
|
+
K,
|
|
66
87
|
{
|
|
67
|
-
label:
|
|
68
|
-
hint:
|
|
69
|
-
error:
|
|
70
|
-
required:
|
|
71
|
-
disableRequiredAsterisk:
|
|
72
|
-
labelId:
|
|
73
|
-
hintId:
|
|
74
|
-
labelExtra:
|
|
75
|
-
infoTooltip:
|
|
88
|
+
label: x,
|
|
89
|
+
hint: b,
|
|
90
|
+
error: w,
|
|
91
|
+
required: N,
|
|
92
|
+
disableRequiredAsterisk: F,
|
|
93
|
+
labelId: P,
|
|
94
|
+
hintId: $,
|
|
95
|
+
labelExtra: V,
|
|
96
|
+
infoTooltip: q,
|
|
76
97
|
className: "flex-1",
|
|
77
|
-
children: /* @__PURE__ */
|
|
78
|
-
|
|
98
|
+
children: /* @__PURE__ */ u(
|
|
99
|
+
X,
|
|
79
100
|
{
|
|
80
101
|
onOpenChange: (e) => {
|
|
81
|
-
|
|
102
|
+
k(e);
|
|
82
103
|
},
|
|
83
104
|
children: [
|
|
84
|
-
/* @__PURE__ */ t(
|
|
105
|
+
/* @__PURE__ */ t(Y, { disabled: s, asChild: !0, children: /* @__PURE__ */ t(
|
|
85
106
|
"button",
|
|
86
107
|
{
|
|
87
|
-
ref:
|
|
108
|
+
ref: i,
|
|
88
109
|
type: "button",
|
|
89
110
|
role: "input",
|
|
90
111
|
tabIndex: 0,
|
|
91
|
-
disabled:
|
|
92
|
-
"aria-required":
|
|
93
|
-
className:
|
|
94
|
-
|
|
95
|
-
|
|
112
|
+
disabled: s,
|
|
113
|
+
"aria-required": N,
|
|
114
|
+
className: D(
|
|
115
|
+
H({
|
|
116
|
+
size: O,
|
|
117
|
+
error: w,
|
|
118
|
+
expanded: l,
|
|
119
|
+
hasDescription: !!(r != null && r.description)
|
|
120
|
+
})
|
|
121
|
+
),
|
|
122
|
+
children: /* @__PURE__ */ u("div", { className: "flex min-w-0 flex-1 items-center gap-sm", children: [
|
|
123
|
+
y && /* @__PURE__ */ t(
|
|
96
124
|
"span",
|
|
97
125
|
{
|
|
98
|
-
className:
|
|
99
|
-
children:
|
|
126
|
+
className: s ? "text-comp-select-icon-disabled" : "text-comp-select-icon-brand-def",
|
|
127
|
+
children: y
|
|
100
128
|
}
|
|
101
129
|
),
|
|
102
|
-
|
|
130
|
+
j,
|
|
103
131
|
/* @__PURE__ */ t(
|
|
104
|
-
|
|
132
|
+
re,
|
|
105
133
|
{
|
|
106
|
-
className:
|
|
134
|
+
className: D(
|
|
107
135
|
"transition-transform duration-200",
|
|
108
|
-
|
|
136
|
+
l ? "rotate-0" : "rotate-180",
|
|
137
|
+
s ? "text-comp-select-icon-disabled" : "text-comp-select-icon-brand-def"
|
|
109
138
|
)
|
|
110
139
|
}
|
|
111
140
|
)
|
|
@@ -113,40 +142,42 @@ const te = _(
|
|
|
113
142
|
}
|
|
114
143
|
) }),
|
|
115
144
|
/* @__PURE__ */ t(
|
|
116
|
-
|
|
145
|
+
Z,
|
|
117
146
|
{
|
|
118
147
|
className: "mt-1",
|
|
119
148
|
style: {
|
|
120
|
-
width:
|
|
149
|
+
width: z > 0 ? `${z}px` : void 0
|
|
121
150
|
},
|
|
151
|
+
align: "center",
|
|
122
152
|
onCloseAutoFocus: (e) => {
|
|
123
|
-
|
|
153
|
+
p.current || e.preventDefault(), p.current = !1;
|
|
124
154
|
},
|
|
125
|
-
collisionPadding:
|
|
126
|
-
children:
|
|
127
|
-
|
|
155
|
+
collisionPadding: C,
|
|
156
|
+
children: a.length === 0 ? /* @__PURE__ */ t("div", { className: "px-lg py-md", role: "presentation", children: /* @__PURE__ */ t(
|
|
157
|
+
o,
|
|
128
158
|
{
|
|
129
159
|
component: "span",
|
|
130
160
|
size: "input",
|
|
131
161
|
weight: "regular",
|
|
132
162
|
className: "text-comp-select-text-secondary",
|
|
133
|
-
children:
|
|
163
|
+
children: E
|
|
134
164
|
}
|
|
135
165
|
) }) : /* @__PURE__ */ t(
|
|
136
|
-
|
|
166
|
+
ee,
|
|
137
167
|
{
|
|
138
|
-
value:
|
|
168
|
+
value: n,
|
|
139
169
|
onValueChange: (e) => {
|
|
140
|
-
|
|
170
|
+
p.current = !0, d == null || d(e);
|
|
141
171
|
},
|
|
142
|
-
children:
|
|
143
|
-
|
|
172
|
+
children: a.map((e) => /* @__PURE__ */ t(
|
|
173
|
+
te,
|
|
144
174
|
{
|
|
145
175
|
value: e.value.toString(),
|
|
146
176
|
disabled: e.disabled,
|
|
147
177
|
icon: e.icon,
|
|
148
|
-
|
|
149
|
-
|
|
178
|
+
description: e.description,
|
|
179
|
+
ref: (c) => {
|
|
180
|
+
m.current[e.value] = c;
|
|
150
181
|
},
|
|
151
182
|
children: e.label
|
|
152
183
|
},
|
|
@@ -163,7 +194,7 @@ const te = _(
|
|
|
163
194
|
);
|
|
164
195
|
}
|
|
165
196
|
);
|
|
166
|
-
|
|
197
|
+
ne.displayName = "Select";
|
|
167
198
|
export {
|
|
168
|
-
|
|
199
|
+
ne as Select
|
|
169
200
|
};
|
|
@@ -15,5 +15,6 @@ export declare const Interactive: Story;
|
|
|
15
15
|
export declare const WithPrefix: Story;
|
|
16
16
|
export declare const WithIconsInOptions: Story;
|
|
17
17
|
export declare const WithDisabledOptions: Story;
|
|
18
|
+
export declare const TwoLine: Story;
|
|
18
19
|
export declare const NoOptions: Story;
|
|
19
20
|
//# sourceMappingURL=Select.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Select/Select.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAS3D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"Select.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Select/Select.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAS3D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CAoI7B,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,MAAM,CAAC,CAAA;AA6BpC,eAAO,MAAM,OAAO,EAAE,KAwBrB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KA0B9B,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KA0BvB,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAwB/B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KA0BtB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KA0BtB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KA6DtB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KA0C7B,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAgCzB,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAyBxB,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,KAqDhC,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,KAkCjC,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KAoDrB,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAqBvB,CAAA"}
|
|
@@ -3,5 +3,6 @@ export declare const triggerWrapperVariants: (props?: ({
|
|
|
3
3
|
error?: boolean | null | undefined;
|
|
4
4
|
expanded?: boolean | null | undefined;
|
|
5
5
|
hasIcon?: boolean | null | undefined;
|
|
6
|
+
hasDescription?: boolean | null | undefined;
|
|
6
7
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
8
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/Select/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/Select/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB;;;;;;8EAkClC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cva as e } from "class-variance-authority";
|
|
2
|
-
const
|
|
2
|
+
const r = e(
|
|
3
3
|
[
|
|
4
4
|
"flex w-full cursor-pointer items-center gap-sm rounded-full border border-comp-select-stroke-def",
|
|
5
5
|
"overflow-hidden bg-comp-select-fill-def whitespace-nowrap focus-visible-default transition-colors",
|
|
@@ -23,6 +23,9 @@ const o = e(
|
|
|
23
23
|
},
|
|
24
24
|
hasIcon: {
|
|
25
25
|
false: "pl-comp-select-p-large"
|
|
26
|
+
},
|
|
27
|
+
hasDescription: {
|
|
28
|
+
true: "py-sm"
|
|
26
29
|
}
|
|
27
30
|
},
|
|
28
31
|
defaultVariants: {
|
|
@@ -32,5 +35,5 @@ const o = e(
|
|
|
32
35
|
}
|
|
33
36
|
);
|
|
34
37
|
export {
|
|
35
|
-
|
|
38
|
+
r as triggerWrapperVariants
|
|
36
39
|
};
|
|
@@ -19,7 +19,7 @@ const b = u(
|
|
|
19
19
|
// Active/pressed state (on)
|
|
20
20
|
"data-[state=on]:bg-comp-button-primary-bg-def data-[state=on]:text-comp-button-primary-text-def",
|
|
21
21
|
// Disabled state
|
|
22
|
-
"disabled:pointer-events-none disabled:bg-surface-brand-primary-
|
|
22
|
+
"disabled:pointer-events-none disabled:bg-surface-brand-primary-disabled2 disabled:text-text-dark-disabled"
|
|
23
23
|
],
|
|
24
24
|
{
|
|
25
25
|
variants: {
|