@solostylist/ui-kit 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/s-animated-gradient-text/index.d.ts +2 -0
- package/dist/s-animated-gradient-text/index.js +2 -0
- package/dist/s-animated-gradient-text/s-animated-gradient-text.d.ts +64 -0
- package/dist/s-animated-gradient-text/s-animated-gradient-text.js +92 -0
- package/dist/s-announcement-bar/index.d.ts +2 -0
- package/dist/s-announcement-bar/index.js +2 -0
- package/dist/s-announcement-bar/s-announcement-bar.d.ts +113 -0
- package/dist/s-announcement-bar/s-announcement-bar.js +272 -0
- package/dist/s-carousel/s-carousel.d.ts +2 -0
- package/dist/s-carousel/s-carousel.js +52 -50
- package/dist/s-date-picker/s-date-picker.js +1 -1
- package/dist/s-datetime-picker/s-datetime-picker.js +1 -1
- package/dist/s-drawer/index.d.ts +3 -0
- package/dist/s-drawer/index.js +2 -0
- package/dist/s-drawer/s-drawer.d.ts +70 -0
- package/dist/s-drawer/s-drawer.js +139 -0
- package/dist/s-gradient-blob-pulse/index.d.ts +2 -0
- package/dist/s-gradient-blob-pulse/index.js +2 -0
- package/dist/s-gradient-blob-pulse/s-gradient-blob-pulse.d.ts +62 -0
- package/dist/s-gradient-blob-pulse/s-gradient-blob-pulse.js +236 -0
- package/dist/s-gradient-icon/index.d.ts +1 -1
- package/dist/s-gradient-icon/s-gradient-icon.d.ts +4 -4
- package/dist/s-gradient-icon/s-gradient-icon.js +2 -2
- package/dist/s-icon-button/s-icon-button.d.ts +6 -2
- package/dist/s-interactive-card/index.d.ts +3 -0
- package/dist/s-interactive-card/index.js +2 -0
- package/dist/s-interactive-card/s-interactive-card.d.ts +57 -0
- package/dist/s-interactive-card/s-interactive-card.js +150 -0
- package/dist/s-language-switcher/s-language-switcher.js +66 -71
- package/dist/s-list-action-item/index.d.ts +2 -0
- package/dist/s-list-action-item/index.js +2 -0
- package/dist/s-list-action-item/s-list-action-item.d.ts +89 -0
- package/dist/s-list-action-item/s-list-action-item.js +149 -0
- package/dist/s-mega-menu/index.d.ts +3 -0
- package/dist/s-mega-menu/index.js +2 -0
- package/dist/s-mega-menu/mega-menu-panel.d.ts +38 -0
- package/dist/s-mega-menu/mega-menu-panel.js +251 -0
- package/dist/s-mega-menu/mega-menu-slots.d.ts +65 -0
- package/dist/s-mega-menu/mega-menu-slots.js +232 -0
- package/dist/s-mega-menu/mega-menu-trigger.d.ts +35 -0
- package/dist/s-mega-menu/mega-menu-trigger.js +49 -0
- package/dist/s-mega-menu/s-mega-menu.d.ts +23 -0
- package/dist/s-mega-menu/s-mega-menu.js +225 -0
- package/dist/s-mega-menu/types.d.ts +188 -0
- package/dist/s-mega-menu/types.js +0 -0
- package/dist/s-mega-menu/utils.d.ts +51 -0
- package/dist/s-mega-menu/utils.js +51 -0
- package/dist/s-mobile-dock/index.d.ts +3 -0
- package/dist/s-mobile-dock/index.js +2 -0
- package/dist/s-mobile-dock/s-mobile-dock.d.ts +96 -0
- package/dist/s-mobile-dock/s-mobile-dock.js +145 -0
- package/dist/s-nav-item/index.d.ts +1 -1
- package/dist/s-nav-item/s-nav-item.d.ts +35 -16
- package/dist/s-nav-item/s-nav-item.js +55 -77
- package/dist/s-nav-items/s-nav-items.js +68 -112
- package/dist/s-number-range/index.d.ts +3 -0
- package/dist/s-number-range/index.js +2 -0
- package/dist/s-number-range/s-number-range.d.ts +109 -0
- package/dist/s-number-range/s-number-range.js +250 -0
- package/dist/s-popover/index.d.ts +5 -0
- package/dist/s-popover/index.js +3 -0
- package/dist/s-popover/placement.d.ts +14 -0
- package/dist/s-popover/placement.js +65 -0
- package/dist/s-popover/s-popover-content.d.ts +22 -0
- package/dist/s-popover/s-popover-content.js +21 -0
- package/dist/s-popover/s-popover.d.ts +59 -0
- package/dist/s-popover/s-popover.js +66 -0
- package/dist/s-product-card/index.d.ts +3 -0
- package/dist/s-product-card/index.js +2 -0
- package/dist/s-product-card/s-product-card.d.ts +216 -0
- package/dist/s-product-card/s-product-card.js +499 -0
- package/dist/s-product-gallery/index.d.ts +3 -0
- package/dist/s-product-gallery/index.js +2 -0
- package/dist/s-product-gallery/s-product-gallery.d.ts +116 -0
- package/dist/s-product-gallery/s-product-gallery.js +427 -0
- package/dist/s-scroll-to-top/s-scroll-to-top.d.ts +1 -1
- package/dist/s-segmented-control/index.d.ts +3 -0
- package/dist/s-segmented-control/index.js +2 -0
- package/dist/s-segmented-control/s-segmented-control.d.ts +94 -0
- package/dist/s-segmented-control/s-segmented-control.js +298 -0
- package/dist/s-stepper/index.d.ts +3 -0
- package/dist/s-stepper/index.js +2 -0
- package/dist/s-stepper/s-stepper.d.ts +90 -0
- package/dist/s-stepper/s-stepper.js +102 -0
- package/dist/s-swatch/index.d.ts +3 -0
- package/dist/s-swatch/index.js +2 -0
- package/dist/s-swatch/s-swatch.d.ts +235 -0
- package/dist/s-swatch/s-swatch.js +218 -0
- package/dist/s-text-editor/s-text-editor-toolbar.js +105 -108
- package/dist/s-tool-item/s-tool-item.d.ts +10 -6
- package/dist/s-tool-item/s-tool-item.js +12 -12
- package/dist/theme/component-augmentation.d.ts +65 -1
- package/dist/theme/components/drawer.d.ts +1 -0
- package/dist/theme/components/drawer.js +4 -1
- package/dist/theme/components/slider.js +18 -1
- package/dist/theme/components/step-connector.d.ts +0 -3
- package/dist/theme/components/step-connector.js +1 -6
- package/dist/theme/components/step-icon.d.ts +3 -12
- package/dist/theme/components/step-icon.js +3 -14
- package/package.json +7 -2
- package/dist/theme/components/components.d.ts +0 -2
- package/dist/theme/components/slider.d.ts +0 -34
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { SIconButton as e } from "../s-icon-button/s-icon-button.js";
|
|
2
|
-
import {
|
|
3
|
-
import r from "
|
|
4
|
-
import
|
|
5
|
-
import o from "
|
|
6
|
-
import
|
|
7
|
-
import c from "@mui/material/
|
|
8
|
-
import l from "@mui/material/
|
|
9
|
-
import u from "@mui/material/
|
|
10
|
-
import d from "
|
|
11
|
-
import
|
|
2
|
+
import { placementOrigins as t } from "../s-popover/placement.js";
|
|
3
|
+
import { styled as n, useThemeProps as r } from "@mui/material/styles";
|
|
4
|
+
import i from "react";
|
|
5
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
import s from "@mui/material/Typography";
|
|
7
|
+
import { mergeSlotProps as c } from "@mui/material/utils";
|
|
8
|
+
import l from "@mui/material/ListItemIcon";
|
|
9
|
+
import u from "@mui/material/Menu";
|
|
10
|
+
import d from "@mui/material/MenuItem";
|
|
11
|
+
import f from "react-country-flag";
|
|
12
|
+
import { useTranslation as p } from "react-i18next";
|
|
12
13
|
//#region lib/s-language-switcher/s-language-switcher.tsx
|
|
13
|
-
var
|
|
14
|
+
var m = 16, h = 20, g = [{
|
|
14
15
|
code: "en",
|
|
15
16
|
label: "English",
|
|
16
17
|
countryCode: "GB"
|
|
@@ -18,101 +19,95 @@ var p = 16, m = 20, h = [{
|
|
|
18
19
|
code: "vi",
|
|
19
20
|
label: "Vietnamese",
|
|
20
21
|
countryCode: "VN"
|
|
21
|
-
}],
|
|
22
|
+
}], _ = n(u, {
|
|
22
23
|
name: "SLanguagePopover",
|
|
23
24
|
slot: "Root"
|
|
24
|
-
})({}),
|
|
25
|
-
let
|
|
25
|
+
})({}), v = i.forwardRef(function(e, n) {
|
|
26
|
+
let i = r({
|
|
26
27
|
props: e,
|
|
27
28
|
name: "SLanguagePopover"
|
|
28
|
-
}), { anchorOrigin:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
menuWidth: y,
|
|
42
|
-
onLanguageChange: b,
|
|
43
|
-
open: w.open,
|
|
44
|
-
slotProps: x,
|
|
45
|
-
transformOrigin: S,
|
|
46
|
-
variant: C
|
|
29
|
+
}), { anchorOrigin: u = t["bottom-end"].anchorOrigin, currentLanguage: p, languages: m = g, menuId: v, menuLabelledBy: y, menuWidth: b = "220px", onLanguageChange: x, slotProps: S, transformOrigin: C = t["bottom-end"].transformOrigin, variant: w = "selectedMenu", ...T } = i, E = {
|
|
30
|
+
...i,
|
|
31
|
+
anchorOrigin: u,
|
|
32
|
+
currentLanguage: p,
|
|
33
|
+
languages: m,
|
|
34
|
+
menuId: v,
|
|
35
|
+
menuLabelledBy: y,
|
|
36
|
+
menuWidth: b,
|
|
37
|
+
onLanguageChange: x,
|
|
38
|
+
open: T.open,
|
|
39
|
+
slotProps: S,
|
|
40
|
+
transformOrigin: C,
|
|
41
|
+
variant: w
|
|
47
42
|
};
|
|
48
|
-
return /* @__PURE__ */
|
|
49
|
-
...
|
|
50
|
-
ref:
|
|
51
|
-
anchorOrigin:
|
|
52
|
-
ownerState:
|
|
43
|
+
return /* @__PURE__ */ a(_, {
|
|
44
|
+
...T,
|
|
45
|
+
ref: n,
|
|
46
|
+
anchorOrigin: u,
|
|
47
|
+
ownerState: E,
|
|
53
48
|
slotProps: {
|
|
54
|
-
...
|
|
55
|
-
paper:
|
|
56
|
-
list:
|
|
57
|
-
id:
|
|
58
|
-
"aria-labelledby":
|
|
49
|
+
...S,
|
|
50
|
+
paper: c(S?.paper, { sx: { minWidth: b } }),
|
|
51
|
+
list: c(S?.list, {
|
|
52
|
+
id: v,
|
|
53
|
+
"aria-labelledby": y
|
|
59
54
|
})
|
|
60
55
|
},
|
|
61
|
-
transformOrigin:
|
|
62
|
-
variant:
|
|
63
|
-
children:
|
|
56
|
+
transformOrigin: C,
|
|
57
|
+
variant: w,
|
|
58
|
+
children: m.map((e) => /* @__PURE__ */ o(d, {
|
|
64
59
|
onClick: (t) => {
|
|
65
|
-
|
|
60
|
+
x?.(t, e.code);
|
|
66
61
|
},
|
|
67
|
-
selected:
|
|
68
|
-
children: [/* @__PURE__ */
|
|
62
|
+
selected: p === e.code,
|
|
63
|
+
children: [/* @__PURE__ */ a(l, { children: /* @__PURE__ */ a(f, {
|
|
69
64
|
alt: "",
|
|
70
65
|
"aria-hidden": "true",
|
|
71
66
|
countryCode: e.countryCode,
|
|
72
67
|
svg: !0,
|
|
73
68
|
style: {
|
|
74
|
-
width:
|
|
75
|
-
height:
|
|
69
|
+
width: h,
|
|
70
|
+
height: h
|
|
76
71
|
}
|
|
77
|
-
}) }), /* @__PURE__ */
|
|
72
|
+
}) }), /* @__PURE__ */ a(s, {
|
|
78
73
|
variant: "subtitle2",
|
|
79
74
|
children: e.label
|
|
80
75
|
})]
|
|
81
76
|
}, e.code))
|
|
82
77
|
});
|
|
83
78
|
});
|
|
84
|
-
|
|
85
|
-
var
|
|
79
|
+
v.displayName = "SLanguagePopover";
|
|
80
|
+
var y = n(e, {
|
|
86
81
|
name: "SLanguageSwitcher",
|
|
87
82
|
slot: "Root"
|
|
88
|
-
})({}),
|
|
89
|
-
let
|
|
83
|
+
})({}), b = i.forwardRef(function(e, t) {
|
|
84
|
+
let n = r({
|
|
90
85
|
props: e,
|
|
91
86
|
name: "SLanguageSwitcher"
|
|
92
|
-
}), { "aria-label": s, languages: c =
|
|
87
|
+
}), { "aria-label": s, languages: c = g, onLanguageChange: l, currentLanguage: u, tooltip: d, buttonFlagSize: h = m, menuWidth: _ = "220px", onClick: b, useI18n: x = !0, ...S } = n, C = p(), w = x ? C.t : null, T = x ? C.i18n : null, [E, D] = i.useState(null), O = i.useId(), k = i.useId(), A = S.id ?? O, j = !!E, M = u ?? T?.language ?? c[0]?.code ?? "en", N = c.find((e) => e.code === M) || c[0], P = i.useCallback((e) => {
|
|
93
88
|
b?.(e), e.defaultPrevented || D(e.currentTarget);
|
|
94
|
-
}, [b]), F =
|
|
89
|
+
}, [b]), F = i.useCallback(() => {
|
|
95
90
|
D(null);
|
|
96
|
-
}, []), I =
|
|
91
|
+
}, []), I = i.useCallback((e, t) => {
|
|
97
92
|
l ? l(e, t) : T && T.changeLanguage(t), e.defaultPrevented || F();
|
|
98
93
|
}, [
|
|
99
94
|
F,
|
|
100
95
|
T,
|
|
101
96
|
l
|
|
102
|
-
]), L =
|
|
103
|
-
...
|
|
97
|
+
]), L = d ?? (w ? w("header:language.tooltip") : "Change language"), R = {
|
|
98
|
+
...n,
|
|
104
99
|
"aria-label": s ?? (typeof L == "string" ? L : "Change language"),
|
|
105
|
-
buttonFlagSize:
|
|
100
|
+
buttonFlagSize: h,
|
|
106
101
|
currentLanguage: M,
|
|
107
102
|
languages: c,
|
|
108
|
-
menuWidth:
|
|
103
|
+
menuWidth: _,
|
|
109
104
|
onClick: b,
|
|
110
105
|
onLanguageChange: l,
|
|
111
106
|
open: j,
|
|
112
107
|
tooltip: L,
|
|
113
108
|
useI18n: x
|
|
114
109
|
};
|
|
115
|
-
return /* @__PURE__ */
|
|
110
|
+
return /* @__PURE__ */ o(i.Fragment, { children: [/* @__PURE__ */ a(y, {
|
|
116
111
|
...S,
|
|
117
112
|
ref: t,
|
|
118
113
|
id: A,
|
|
@@ -123,17 +118,17 @@ var v = t(e, {
|
|
|
123
118
|
onClick: P,
|
|
124
119
|
ownerState: R,
|
|
125
120
|
tooltip: L,
|
|
126
|
-
children: /* @__PURE__ */
|
|
121
|
+
children: /* @__PURE__ */ a(f, {
|
|
127
122
|
alt: "",
|
|
128
123
|
"aria-hidden": "true",
|
|
129
124
|
countryCode: N?.countryCode || "US",
|
|
130
125
|
svg: !0,
|
|
131
126
|
style: {
|
|
132
|
-
width:
|
|
133
|
-
height:
|
|
127
|
+
width: h,
|
|
128
|
+
height: h
|
|
134
129
|
}
|
|
135
130
|
})
|
|
136
|
-
}), /* @__PURE__ */
|
|
131
|
+
}), /* @__PURE__ */ a(v, {
|
|
137
132
|
anchorEl: E,
|
|
138
133
|
menuId: k,
|
|
139
134
|
menuLabelledBy: A,
|
|
@@ -142,9 +137,9 @@ var v = t(e, {
|
|
|
142
137
|
onLanguageChange: I,
|
|
143
138
|
languages: c,
|
|
144
139
|
currentLanguage: M,
|
|
145
|
-
menuWidth:
|
|
140
|
+
menuWidth: _
|
|
146
141
|
})] });
|
|
147
142
|
});
|
|
148
|
-
|
|
143
|
+
b.displayName = "SLanguageSwitcher";
|
|
149
144
|
//#endregion
|
|
150
|
-
export {
|
|
145
|
+
export { v as SLanguagePopover, b as SLanguageSwitcher, b as default, g as defaultLanguageOptions };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { BoxProps, ListItemButtonProps, TypographyProps } from '@mui/material';
|
|
2
|
+
import { OwnerStateSlotProps as MuiOwnerStateSlotProps } from '../utils/slots';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
/** Row shape: `plain` spans the full width, `inset` is inset and rounded for popover menus. */
|
|
5
|
+
export type SListActionItemVariant = 'inset' | 'plain';
|
|
6
|
+
export interface SListActionItemSlots {
|
|
7
|
+
/** Secondary text element. */
|
|
8
|
+
description?: React.ElementType;
|
|
9
|
+
/** Leading icon container. */
|
|
10
|
+
icon?: React.ElementType;
|
|
11
|
+
/** Primary label element. */
|
|
12
|
+
label?: React.ElementType;
|
|
13
|
+
/** Interactive row element. */
|
|
14
|
+
root?: React.ElementType;
|
|
15
|
+
/** Column wrapping label and description. */
|
|
16
|
+
text?: React.ElementType;
|
|
17
|
+
/** Trailing content container. */
|
|
18
|
+
trailing?: React.ElementType;
|
|
19
|
+
}
|
|
20
|
+
type OwnerStateSlotProps<Props> = MuiOwnerStateSlotProps<Props, SListActionItemOwnerState>;
|
|
21
|
+
/**
|
|
22
|
+
* Root slot props, widened with the anchor attributes the row forwards when
|
|
23
|
+
* `href` is set — `ListItemButtonProps` on its own describes a `div`.
|
|
24
|
+
*/
|
|
25
|
+
export type SListActionItemRootSlotProps = Omit<ListItemButtonProps, 'children' | 'component'> & Pick<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href' | 'rel' | 'target'>;
|
|
26
|
+
export interface SListActionItemSlotProps {
|
|
27
|
+
/** Props or owner-state callback for the description slot. */
|
|
28
|
+
description?: OwnerStateSlotProps<TypographyProps>;
|
|
29
|
+
/** Props or owner-state callback for the icon slot. */
|
|
30
|
+
icon?: OwnerStateSlotProps<BoxProps>;
|
|
31
|
+
/** Props or owner-state callback for the label slot. */
|
|
32
|
+
label?: OwnerStateSlotProps<TypographyProps>;
|
|
33
|
+
/** Props or owner-state callback for the root slot. */
|
|
34
|
+
root?: OwnerStateSlotProps<SListActionItemRootSlotProps>;
|
|
35
|
+
/** Props or owner-state callback for the text column slot. */
|
|
36
|
+
text?: OwnerStateSlotProps<BoxProps>;
|
|
37
|
+
/** Props or owner-state callback for the trailing slot. */
|
|
38
|
+
trailing?: OwnerStateSlotProps<BoxProps>;
|
|
39
|
+
}
|
|
40
|
+
/** Props for a list action row with button or link semantics. */
|
|
41
|
+
export interface SListActionItemProps extends Omit<ListItemButtonProps, 'children' | 'component' | 'dense' | 'disabled' | 'onClick' | 'selected' | 'title'> {
|
|
42
|
+
/** Root element override. Defaults to `a` when `href` is set, otherwise `button`. */
|
|
43
|
+
component?: React.ElementType;
|
|
44
|
+
/** Uses compact vertical padding. */
|
|
45
|
+
dense?: boolean;
|
|
46
|
+
/** Secondary text rendered under the label. */
|
|
47
|
+
description?: React.ReactNode;
|
|
48
|
+
/** Disables activation and exposes the disabled state to assistive technology. */
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
/** Link destination. When set, the row renders with anchor semantics. */
|
|
51
|
+
href?: string;
|
|
52
|
+
/** Leading content, usually an icon. */
|
|
53
|
+
icon?: React.ReactNode;
|
|
54
|
+
/** Primary label. */
|
|
55
|
+
label: React.ReactNode;
|
|
56
|
+
/** Called when the row is activated. Receives the original mouse event. */
|
|
57
|
+
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
58
|
+
/** Anchor relationship, forwarded when the row renders as a link. */
|
|
59
|
+
rel?: string;
|
|
60
|
+
/** Marks the row as the current selection, and sets `aria-current="page"`. */
|
|
61
|
+
selected?: boolean;
|
|
62
|
+
/** Components used for internal structural slots. */
|
|
63
|
+
slots?: SListActionItemSlots;
|
|
64
|
+
/** Props or owner-state callbacks for internal structural slots. */
|
|
65
|
+
slotProps?: SListActionItemSlotProps;
|
|
66
|
+
/** Anchor target, forwarded when the row renders as a link. */
|
|
67
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
68
|
+
/** Trailing content, e.g. a check mark or shortcut hint. */
|
|
69
|
+
trailing?: React.ReactNode;
|
|
70
|
+
/** Row shape. `inset` adds side margins and a rounded corner for popover menus. */
|
|
71
|
+
variant?: SListActionItemVariant;
|
|
72
|
+
}
|
|
73
|
+
export interface SListActionItemOwnerState extends SListActionItemProps {
|
|
74
|
+
dense: boolean;
|
|
75
|
+
disabled: boolean;
|
|
76
|
+
hasDescription: boolean;
|
|
77
|
+
selected: boolean;
|
|
78
|
+
variant: SListActionItemVariant;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* A single interactive row for menus, settings lists and popovers.
|
|
82
|
+
*
|
|
83
|
+
* Semantics follow the props rather than a flag: the row is a native `button`
|
|
84
|
+
* until `href` is set, at which point it becomes an anchor. Leading `icon`,
|
|
85
|
+
* `description` and `trailing` content are optional, and every structural
|
|
86
|
+
* element is swappable through `slots` / `slotProps`.
|
|
87
|
+
*/
|
|
88
|
+
export declare const SListActionItem: React.ForwardRefExoticComponent<Omit<SListActionItemProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
89
|
+
export default SListActionItem;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { toSxArray as e } from "../utils/sx.js";
|
|
2
|
+
import { resolveOwnerStateSlotProps as t } from "../utils/slots.js";
|
|
3
|
+
import { getFocusVisibleStyle as n, reducedMotionMedia as r } from "../theme/components/action-styles.js";
|
|
4
|
+
import * as i from "react";
|
|
5
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
import { svgIconClasses as s } from "@mui/material/SvgIcon";
|
|
7
|
+
import { Box as c, ListItemButton as l, Typography as u, styled as d, useThemeProps as f } from "@mui/material";
|
|
8
|
+
import { mergeSlotProps as p, useForkRef as m } from "@mui/material/utils";
|
|
9
|
+
import h from "@mui/utils/appendOwnerState";
|
|
10
|
+
//#region lib/s-list-action-item/s-list-action-item.tsx
|
|
11
|
+
var g = 44, _ = 36, v = d(l, {
|
|
12
|
+
name: "SListActionItem",
|
|
13
|
+
slot: "Root",
|
|
14
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
15
|
+
})(({ theme: e }) => ({
|
|
16
|
+
color: (e.vars ?? e).palette.text.primary,
|
|
17
|
+
gap: e.spacing(1),
|
|
18
|
+
minHeight: g,
|
|
19
|
+
transition: e.transitions.create(["background-color", "color"], { duration: e.transitions.duration.shorter }),
|
|
20
|
+
width: "100%",
|
|
21
|
+
[`&&& .${s.root}`]: { color: "inherit" },
|
|
22
|
+
"&.Mui-focusVisible": {
|
|
23
|
+
...n(e),
|
|
24
|
+
outlineOffset: -2
|
|
25
|
+
},
|
|
26
|
+
[r]: { transition: "none" },
|
|
27
|
+
variants: [{
|
|
28
|
+
props: ({ ownerState: e }) => e.variant === "inset",
|
|
29
|
+
style: {
|
|
30
|
+
borderRadius: e.radius.md,
|
|
31
|
+
marginInline: e.spacing(.75),
|
|
32
|
+
width: "auto"
|
|
33
|
+
}
|
|
34
|
+
}, {
|
|
35
|
+
props: ({ ownerState: e }) => e.dense,
|
|
36
|
+
style: {
|
|
37
|
+
minHeight: _,
|
|
38
|
+
paddingBlock: e.spacing(.5)
|
|
39
|
+
}
|
|
40
|
+
}]
|
|
41
|
+
})), y = d(c, {
|
|
42
|
+
name: "SListActionItem",
|
|
43
|
+
slot: "Icon",
|
|
44
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
45
|
+
})({
|
|
46
|
+
alignItems: "center",
|
|
47
|
+
color: "inherit",
|
|
48
|
+
display: "flex",
|
|
49
|
+
flexShrink: 0,
|
|
50
|
+
justifyContent: "center",
|
|
51
|
+
minWidth: 0
|
|
52
|
+
}), b = d(c, {
|
|
53
|
+
name: "SListActionItem",
|
|
54
|
+
slot: "Text",
|
|
55
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
56
|
+
})(({ theme: e }) => ({
|
|
57
|
+
display: "flex",
|
|
58
|
+
flex: 1,
|
|
59
|
+
flexDirection: "column",
|
|
60
|
+
minWidth: 0,
|
|
61
|
+
variants: [{
|
|
62
|
+
props: ({ ownerState: e }) => e.hasDescription,
|
|
63
|
+
style: { gap: e.spacing(.25) }
|
|
64
|
+
}]
|
|
65
|
+
})), x = d(u, {
|
|
66
|
+
name: "SListActionItem",
|
|
67
|
+
slot: "Label",
|
|
68
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
69
|
+
})({
|
|
70
|
+
display: "block",
|
|
71
|
+
minWidth: 0,
|
|
72
|
+
overflow: "hidden",
|
|
73
|
+
textOverflow: "ellipsis"
|
|
74
|
+
}), S = d(u, {
|
|
75
|
+
name: "SListActionItem",
|
|
76
|
+
slot: "Description",
|
|
77
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
78
|
+
})(({ theme: e }) => ({
|
|
79
|
+
color: (e.vars ?? e).palette.text.secondary,
|
|
80
|
+
display: "block",
|
|
81
|
+
minWidth: 0,
|
|
82
|
+
overflow: "hidden",
|
|
83
|
+
textOverflow: "ellipsis"
|
|
84
|
+
})), C = d(c, {
|
|
85
|
+
name: "SListActionItem",
|
|
86
|
+
slot: "Trailing",
|
|
87
|
+
shouldForwardProp: (e) => e !== "ownerState"
|
|
88
|
+
})(({ theme: e }) => ({
|
|
89
|
+
alignItems: "center",
|
|
90
|
+
color: (e.vars ?? e).palette.text.secondary,
|
|
91
|
+
display: "flex",
|
|
92
|
+
flexShrink: 0,
|
|
93
|
+
marginInlineStart: "auto"
|
|
94
|
+
})), w = i.forwardRef(function(n, r) {
|
|
95
|
+
let i = f({
|
|
96
|
+
props: n,
|
|
97
|
+
name: "SListActionItem"
|
|
98
|
+
}), { "aria-current": s, component: c, dense: l = !1, description: u, disabled: d = !1, href: g, icon: _, label: w, selected: T = !1, slotProps: E, slots: D, sx: O, trailing: k, variant: A = "plain", ...j } = i, M = {
|
|
99
|
+
...i,
|
|
100
|
+
dense: l,
|
|
101
|
+
disabled: d,
|
|
102
|
+
hasDescription: u != null,
|
|
103
|
+
selected: T,
|
|
104
|
+
variant: A
|
|
105
|
+
}, N = D?.root ?? v, P = D?.icon ?? y, F = D?.text ?? b, I = D?.label ?? x, L = D?.description ?? S, R = D?.trailing ?? C, z = c ?? (g ? "a" : "button"), B = T ? "page" : void 0, V = "aria-current" in i ? s : B, { ref: H, sx: U, ...W } = h(N, p(t(E?.root, M), {
|
|
106
|
+
...j,
|
|
107
|
+
"aria-current": V,
|
|
108
|
+
dense: l,
|
|
109
|
+
disabled: d,
|
|
110
|
+
href: d ? void 0 : g,
|
|
111
|
+
selected: T
|
|
112
|
+
}), M), G = m(H, r), K = h(P, p(t(E?.icon, M), { component: "span" }), M), q = h(F, p(t(E?.text, M), { component: "span" }), M), J = h(I, p(t(E?.label, M), {
|
|
113
|
+
component: "span",
|
|
114
|
+
variant: "body1"
|
|
115
|
+
}), M), Y = h(L, p(t(E?.description, M), {
|
|
116
|
+
component: "span",
|
|
117
|
+
variant: "body2"
|
|
118
|
+
}), M), X = h(R, p(t(E?.trailing, M), { component: "span" }), M);
|
|
119
|
+
return /* @__PURE__ */ o(N, {
|
|
120
|
+
...W,
|
|
121
|
+
ref: G,
|
|
122
|
+
component: z,
|
|
123
|
+
nativeButton: z === "button",
|
|
124
|
+
sx: [...e(U), ...e(O)],
|
|
125
|
+
children: [
|
|
126
|
+
_ == null ? null : /* @__PURE__ */ a(P, {
|
|
127
|
+
...K,
|
|
128
|
+
children: _
|
|
129
|
+
}),
|
|
130
|
+
/* @__PURE__ */ o(F, {
|
|
131
|
+
...q,
|
|
132
|
+
children: [/* @__PURE__ */ a(I, {
|
|
133
|
+
...J,
|
|
134
|
+
children: w
|
|
135
|
+
}), u == null ? null : /* @__PURE__ */ a(L, {
|
|
136
|
+
...Y,
|
|
137
|
+
children: u
|
|
138
|
+
})]
|
|
139
|
+
}),
|
|
140
|
+
k == null ? null : /* @__PURE__ */ a(R, {
|
|
141
|
+
...X,
|
|
142
|
+
children: k
|
|
143
|
+
})
|
|
144
|
+
]
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
w.displayName = "SListActionItem";
|
|
148
|
+
//#endregion
|
|
149
|
+
export { w as SListActionItem, w as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { default, default as SMegaMenu } from './s-mega-menu';
|
|
2
|
+
export type { SMegaMenuChangeReason, SMegaMenuItem, SMegaMenuItemBase, SMegaMenuItemState, SMegaMenuLayout, SMegaMenuOwnerState, SMegaMenuPanelState, SMegaMenuProps, SMegaMenuResolvedLayout, SMegaMenuSide, SMegaMenuSlotProps, SMegaMenuSlots, SMegaMenuTriggerState, } from './types';
|
|
3
|
+
export type {} from '../theme/component-augmentation';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { SMegaMenuChangeReason, SMegaMenuItem, SMegaMenuItemState, SMegaMenuOwnerState, SMegaMenuSlotProps, SMegaMenuSlots } from './types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
/** Everything the recursive panel renderers need from the owning `SMegaMenu`. */
|
|
4
|
+
export interface MegaMenuRenderContext<T = unknown> {
|
|
5
|
+
/** Closes the whole menu, optionally returning focus to the open trigger. */
|
|
6
|
+
closeMenu: (options: {
|
|
7
|
+
event: Event | React.SyntheticEvent | null;
|
|
8
|
+
focusTrigger?: boolean;
|
|
9
|
+
reason: SMegaMenuChangeReason;
|
|
10
|
+
}) => void;
|
|
11
|
+
/** Resolves the active state of an entry. */
|
|
12
|
+
getIsActive: (item: SMegaMenuItem<T>) => boolean;
|
|
13
|
+
/** Keeps submenu content mounted while closed. */
|
|
14
|
+
keepMounted: boolean;
|
|
15
|
+
/** Default element used for entries that have an `href`. */
|
|
16
|
+
linkComponent?: React.ElementType;
|
|
17
|
+
/** Owner state shared by every slot. */
|
|
18
|
+
ownerState: SMegaMenuOwnerState<T>;
|
|
19
|
+
/** Renders the content of a row. */
|
|
20
|
+
renderItem?: (item: SMegaMenuItem<T>, state: SMegaMenuItemState<T>) => React.ReactNode;
|
|
21
|
+
slotProps?: SMegaMenuSlotProps<T>;
|
|
22
|
+
slots?: SMegaMenuSlots;
|
|
23
|
+
}
|
|
24
|
+
interface PanelContentProps<T> {
|
|
25
|
+
/** Closes the flyout submenu this panel lives in, if any. */
|
|
26
|
+
closeParent?: () => void;
|
|
27
|
+
ctx: MegaMenuRenderContext<T>;
|
|
28
|
+
depth: number;
|
|
29
|
+
items: SMegaMenuItem<T>[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Panel body for one level of the tree.
|
|
33
|
+
*
|
|
34
|
+
* Recursion happens here: a `list` layout renders branch rows that mount another
|
|
35
|
+
* `MegaMenuPanelContent` inside their flyout submenu.
|
|
36
|
+
*/
|
|
37
|
+
export declare function MegaMenuPanelContent<T>({ closeParent, ctx, depth, items, }: Readonly<PanelContentProps<T>>): React.JSX.Element;
|
|
38
|
+
export {};
|