@situaction/traq-ui-ste 1.2.35 → 1.2.39
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/accordion/Accordion.d.ts +1 -1
- package/dist/components/accordion/item/AccordionItem.d.ts +1 -1
- package/dist/components/accordion/item/AccordionItem.js +46 -45
- package/dist/components/menu/Menu.d.ts +4 -0
- package/dist/components/menu/Menu.js +53 -51
- package/dist/components/select/Select.d.ts +10 -1
- package/dist/components/select/Select.js +153 -125
- package/dist/styles/AccordionItem.css +1 -1
- package/package.json +1 -1
|
@@ -38,7 +38,7 @@ export interface AccordionProps {
|
|
|
38
38
|
/** If true, clicking anywhere on the header (excluding buttons) toggles the content */
|
|
39
39
|
toggleOnHeaderClick?: boolean;
|
|
40
40
|
/** Visual mode for all accordion items */
|
|
41
|
-
mode?: "primary" | "secondary";
|
|
41
|
+
mode?: "primary" | "secondary" | "ghost";
|
|
42
42
|
/** If true, only one item can be open at a time */
|
|
43
43
|
singleOpen?: boolean;
|
|
44
44
|
/** Controlled open ids (optional) */
|
|
@@ -19,7 +19,7 @@ interface AccordionItemProps {
|
|
|
19
19
|
/** If true, clicking anywhere on the header (excluding buttons) toggles the content */
|
|
20
20
|
toggleOnHeaderClick?: boolean;
|
|
21
21
|
/** Visual mode for the accordion item */
|
|
22
|
-
mode?: "primary" | "secondary";
|
|
22
|
+
mode?: "primary" | "secondary" | "ghost";
|
|
23
23
|
/** Controlled open state (optional) */
|
|
24
24
|
open?: boolean;
|
|
25
25
|
/** Toggle callback used when open is controlled */
|
|
@@ -1,67 +1,68 @@
|
|
|
1
1
|
import { jsxs as p, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as y, useEffect as B, useMemo as O } from "react";
|
|
3
3
|
import { IconButton as w } from "../../icon-button/IconButton.js";
|
|
4
|
-
import '../../../styles/AccordionItem.css';const
|
|
5
|
-
accordionHeader:
|
|
6
|
-
"padding-s": "_padding-
|
|
7
|
-
"padding-m": "_padding-
|
|
8
|
-
"padding-l": "_padding-
|
|
9
|
-
"padding-xl": "_padding-
|
|
10
|
-
title:
|
|
11
|
-
fullHeight:
|
|
12
|
-
block:
|
|
13
|
-
tile:
|
|
14
|
-
secondaryOpen:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
import '../../../styles/AccordionItem.css';const A = "_accordionHeader_10lt2_7", M = "_title_10lt2_31", H = "_fullHeight_10lt2_36", I = "_block_10lt2_40", L = "_tile_10lt2_48", N = "_secondaryOpen_10lt2_56", Z = "_ghost_10lt2_61", l = {
|
|
5
|
+
accordionHeader: A,
|
|
6
|
+
"padding-s": "_padding-s_10lt2_15",
|
|
7
|
+
"padding-m": "_padding-m_10lt2_19",
|
|
8
|
+
"padding-l": "_padding-l_10lt2_23",
|
|
9
|
+
"padding-xl": "_padding-xl_10lt2_27",
|
|
10
|
+
title: M,
|
|
11
|
+
fullHeight: H,
|
|
12
|
+
block: I,
|
|
13
|
+
tile: L,
|
|
14
|
+
secondaryOpen: N,
|
|
15
|
+
ghost: Z
|
|
16
|
+
}, q = ({
|
|
17
|
+
header: f,
|
|
18
|
+
children: m,
|
|
19
|
+
iconPosition: c = "right",
|
|
19
20
|
defaultOpen: d = !1,
|
|
20
|
-
type:
|
|
21
|
-
paddingHeader:
|
|
22
|
-
onClickHeader:
|
|
21
|
+
type: h = "block",
|
|
22
|
+
paddingHeader: u = "m",
|
|
23
|
+
onClickHeader: n,
|
|
23
24
|
toggleOnHeaderClick: v = !1,
|
|
24
|
-
mode:
|
|
25
|
+
mode: o = "primary",
|
|
25
26
|
open: g,
|
|
26
|
-
onToggle:
|
|
27
|
+
onToggle: a
|
|
27
28
|
}) => {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}, [d,
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
34
|
-
|
|
29
|
+
const i = g !== void 0, [x, _] = y(!1);
|
|
30
|
+
B(() => {
|
|
31
|
+
i || _(!!d);
|
|
32
|
+
}, [d, i]);
|
|
33
|
+
const e = i ? !!g : x, r = () => {
|
|
34
|
+
if (i) {
|
|
35
|
+
a == null || a();
|
|
35
36
|
return;
|
|
36
37
|
}
|
|
37
|
-
_((
|
|
38
|
-
},
|
|
39
|
-
if (
|
|
40
|
-
|
|
38
|
+
_((s) => !s);
|
|
39
|
+
}, b = (s) => {
|
|
40
|
+
if (s.target.closest("button")) {
|
|
41
|
+
s.stopPropagation();
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
|
-
v &&
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
].filter(Boolean).join(" "), [
|
|
48
|
-
return /* @__PURE__ */ p("div", { className:
|
|
44
|
+
v && r(), n == null || n();
|
|
45
|
+
}, k = O(() => o === "ghost" ? l.ghost : [
|
|
46
|
+
h === "tile" ? l.tile : l.block,
|
|
47
|
+
o === "secondary" && e ? l.secondaryOpen : ""
|
|
48
|
+
].filter(Boolean).join(" "), [h, o, e]);
|
|
49
|
+
return /* @__PURE__ */ p("div", { className: k, children: [
|
|
49
50
|
/* @__PURE__ */ p(
|
|
50
51
|
"div",
|
|
51
52
|
{
|
|
52
|
-
className: `${
|
|
53
|
-
onClick:
|
|
53
|
+
className: `${l.accordionHeader} ${l[`padding-${u}`]}`,
|
|
54
|
+
onClick: b,
|
|
54
55
|
"data-ignore-outside-click": !0,
|
|
55
56
|
children: [
|
|
56
|
-
|
|
57
|
-
/* @__PURE__ */ t("div", { className:
|
|
58
|
-
|
|
57
|
+
c === "left" && /* @__PURE__ */ t(w, { mode: "ghost", size: "s", onClick: r, children: e ? /* @__PURE__ */ t("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "#000000", viewBox: "0 0 256 256", children: /* @__PURE__ */ t("path", { d: "M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z" }) }) : /* @__PURE__ */ t("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "#000000", viewBox: "0 0 256 256", children: /* @__PURE__ */ t("path", { d: "M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z" }) }) }),
|
|
58
|
+
/* @__PURE__ */ t("div", { className: l.title, children: f }),
|
|
59
|
+
c === "right" && /* @__PURE__ */ t(w, { mode: "ghost", size: "s", onClick: r, children: e ? /* @__PURE__ */ t("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "#000000", viewBox: "0 0 256 256", children: /* @__PURE__ */ t("path", { d: "M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z" }) }) : /* @__PURE__ */ t("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "#000000", viewBox: "0 0 256 256", children: /* @__PURE__ */ t("path", { d: "M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z" }) }) })
|
|
59
60
|
]
|
|
60
61
|
}
|
|
61
62
|
),
|
|
62
|
-
|
|
63
|
+
e && m
|
|
63
64
|
] });
|
|
64
65
|
};
|
|
65
66
|
export {
|
|
66
|
-
|
|
67
|
+
q as AccordionItem
|
|
67
68
|
};
|
|
@@ -12,6 +12,8 @@ export interface MenuItem {
|
|
|
12
12
|
label: string;
|
|
13
13
|
/** Callback function executed when the item is clicked */
|
|
14
14
|
onClick: () => void;
|
|
15
|
+
/** Disabled button */
|
|
16
|
+
disabled?: boolean;
|
|
15
17
|
}
|
|
16
18
|
/**
|
|
17
19
|
* Interface for a parameterized menu item that can open a modal or execute a custom action.
|
|
@@ -32,6 +34,8 @@ export interface MenuParam {
|
|
|
32
34
|
bottom: string;
|
|
33
35
|
left: string;
|
|
34
36
|
};
|
|
37
|
+
/** Disabled button */
|
|
38
|
+
disabled?: boolean;
|
|
35
39
|
}
|
|
36
40
|
/**
|
|
37
41
|
* Props for the Menu component, which renders a vertical navigation menu with actions and optional modal parameters.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
2
2
|
import { useState as c, useRef as M, useEffect as B } from "react";
|
|
3
3
|
import { Button as $ } from "../button/Button.js";
|
|
4
4
|
import { IconButton as f } from "../icon-button/IconButton.js";
|
|
@@ -10,7 +10,7 @@ import "../carousel/Carousel.js";
|
|
|
10
10
|
import "../carousel/FadeCarousel.js";
|
|
11
11
|
import "../theme/ThemeContext.js";
|
|
12
12
|
import '../../styles/Size.css';import '../../styles/Menu.css';/* empty css */
|
|
13
|
-
const y = "_fullHeight_11eub_15", O = "_fullWidth_11eub_18", j = "_open_11eub_21", D = "_close_11eub_25", q = "_menuButton_11eub_29", A = "_closeIcon_11eub_37", F = "_textEllipsis_11eub_47", G = "_pointer_11eub_52", J = "_fullImg_11eub_55", K = "_menuParams_11eub_61", Q = "_line_11eub_67", T = "_borderRadiusM_11eub_74", U = "_menuItem_11eub_78", X = "_longLogo_11eub_87", Y = "_flexVerticalBetweenStart_11eub_92", Z = "_flexHorizontalCenter_11eub_106", ee = "_flexVerticalBetweenCenter_11eub_121",
|
|
13
|
+
const y = "_fullHeight_11eub_15", O = "_fullWidth_11eub_18", j = "_open_11eub_21", D = "_close_11eub_25", q = "_menuButton_11eub_29", A = "_closeIcon_11eub_37", F = "_textEllipsis_11eub_47", G = "_pointer_11eub_52", J = "_fullImg_11eub_55", K = "_menuParams_11eub_61", Q = "_line_11eub_67", T = "_borderRadiusM_11eub_74", U = "_menuItem_11eub_78", X = "_longLogo_11eub_87", Y = "_flexVerticalBetweenStart_11eub_92", Z = "_flexHorizontalCenter_11eub_106", ee = "_flexVerticalBetweenCenter_11eub_121", o = {
|
|
14
14
|
fullHeight: y,
|
|
15
15
|
fullWidth: O,
|
|
16
16
|
open: j,
|
|
@@ -28,87 +28,89 @@ const y = "_fullHeight_11eub_15", O = "_fullWidth_11eub_18", j = "_open_11eub_21
|
|
|
28
28
|
flexVerticalBetweenStart: Y,
|
|
29
29
|
flexHorizontalCenter: Z,
|
|
30
30
|
flexVerticalBetweenCenter: ee
|
|
31
|
-
}, _e = ({ menuItems:
|
|
32
|
-
const [
|
|
31
|
+
}, _e = ({ menuItems: i = [], menuParams: d = [], shortLogo: m, logo: p, isOpen: h, defaultOpen: I = !1, selectedId: r }) => {
|
|
32
|
+
const [t, b] = c(I ?? !1), [g, x] = c(r ?? (i.length > 0 ? i[0].id : null)), w = M(null), [H, _] = c(!1), [L, C] = c(!1), [k, E] = c(null), [z, R] = c({}), V = M(null);
|
|
33
33
|
B(() => {
|
|
34
|
-
|
|
35
|
-
}, [
|
|
36
|
-
const v = (
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
39
|
-
|
|
34
|
+
r != null && x(r);
|
|
35
|
+
}, [r]);
|
|
36
|
+
const v = (e, s) => {
|
|
37
|
+
if (e.stopPropagation(), x(s), i) {
|
|
38
|
+
const n = i.find((a) => a.id === s);
|
|
39
|
+
n == null || n.onClick();
|
|
40
40
|
}
|
|
41
41
|
}, S = () => {
|
|
42
|
-
|
|
43
|
-
}, P = (
|
|
44
|
-
var
|
|
45
|
-
if (
|
|
46
|
-
const
|
|
47
|
-
if (!
|
|
48
|
-
if (
|
|
49
|
-
const
|
|
50
|
-
E(
|
|
42
|
+
b(!t), _(!1);
|
|
43
|
+
}, P = (e) => {
|
|
44
|
+
var s;
|
|
45
|
+
if (d) {
|
|
46
|
+
const n = d.find((a) => a.id === e);
|
|
47
|
+
if (!n) return;
|
|
48
|
+
if (n.content) {
|
|
49
|
+
const a = t ? "200px" : "40px";
|
|
50
|
+
E(n.content), R({ ...n.position, left: a }), C(!0);
|
|
51
51
|
} else
|
|
52
|
-
(
|
|
52
|
+
(s = n.onClick) == null || s.call(n);
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
return B(() => {
|
|
56
|
-
h && h(
|
|
57
|
-
}, [
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
/* @__PURE__ */
|
|
56
|
+
h && h(t);
|
|
57
|
+
}, [t]), /* @__PURE__ */ l("nav", { ref: w, children: /* @__PURE__ */ u("div", { className: `${o.flexVerticalBetweenStart} ${o.fullHeight} ${t ? o.open : o.close}`, children: [
|
|
58
|
+
/* @__PURE__ */ u("div", { className: o.fullWidth, children: [
|
|
59
|
+
/* @__PURE__ */ l(
|
|
60
60
|
"div",
|
|
61
61
|
{
|
|
62
|
-
className: `${
|
|
62
|
+
className: `${o.flexHorizontalCenter} ${o.pointer} ${o.textEllipsis}`,
|
|
63
63
|
onClick: () => S(),
|
|
64
|
-
children:
|
|
65
|
-
p && /* @__PURE__ */
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
] }) : /* @__PURE__ */
|
|
64
|
+
children: t ? /* @__PURE__ */ u("div", { className: o.fullImg, children: [
|
|
65
|
+
p && /* @__PURE__ */ l("img", { className: o.longLogo, src: p, alt: "Logo situaction" }),
|
|
66
|
+
/* @__PURE__ */ l(f, { mode: "ghost", size: "menu", children: /* @__PURE__ */ l(N, { icon: "CaretDoubleLeft", size: 16, weight: "duotone" }) })
|
|
67
|
+
] }) : /* @__PURE__ */ l(
|
|
68
68
|
"div",
|
|
69
69
|
{
|
|
70
|
-
className:
|
|
70
|
+
className: o.closeIcon,
|
|
71
71
|
onMouseEnter: () => _(!0),
|
|
72
72
|
onMouseLeave: () => _(!1),
|
|
73
|
-
onClick: () =>
|
|
74
|
-
children: H || !m ? /* @__PURE__ */
|
|
73
|
+
onClick: () => b(!t),
|
|
74
|
+
children: H || !m ? /* @__PURE__ */ l(f, { mode: "ghost", size: "menu", children: /* @__PURE__ */ l(N, { icon: "CaretDoubleRight", size: 22, weight: "duotone" }) }) : /* @__PURE__ */ l("img", { src: m, alt: "Logo situaction" })
|
|
75
75
|
}
|
|
76
76
|
)
|
|
77
77
|
}
|
|
78
78
|
),
|
|
79
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ l("div", { className: o.menuItem, children: i && i.map((e) => t ? /* @__PURE__ */ l("div", { className: `${o.textEllipsis} ${o.menuButton}`, children: /* @__PURE__ */ l(
|
|
80
80
|
$,
|
|
81
81
|
{
|
|
82
|
-
mode:
|
|
83
|
-
label:
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
mode: e.disabled ? "ghost" : g === e.id ? "secondary" : "ghost",
|
|
83
|
+
label: e.label,
|
|
84
|
+
disabled: e.disabled,
|
|
85
|
+
onClick: (s) => v(s, e.id),
|
|
86
|
+
childrenLeft: e.icon
|
|
86
87
|
}
|
|
87
|
-
) }, `button-${
|
|
88
|
+
) }, `button-${e.id}`) : /* @__PURE__ */ l("div", { className: o.textEllipsis, children: /* @__PURE__ */ l(
|
|
88
89
|
f,
|
|
89
90
|
{
|
|
90
|
-
mode:
|
|
91
|
-
children:
|
|
92
|
-
|
|
91
|
+
mode: e.disabled ? "ghost" : g === e.id ? "secondary" : "ghost",
|
|
92
|
+
children: e.icon,
|
|
93
|
+
disabled: e.disabled,
|
|
94
|
+
onClick: (s) => v(s, e.id)
|
|
93
95
|
}
|
|
94
|
-
) }, `icon-${
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
+
) }, `icon-${e.id}`)) }),
|
|
97
|
+
/* @__PURE__ */ l("div", { className: o.line })
|
|
96
98
|
] }),
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
|
|
99
|
+
/* @__PURE__ */ u("div", { className: `${o.menuParams} ${o.flexVerticalBetweenCenter}`, children: [
|
|
100
|
+
d && d.map((e) => /* @__PURE__ */ l(
|
|
99
101
|
"div",
|
|
100
102
|
{
|
|
101
|
-
className: `${
|
|
102
|
-
onClick: () => P(
|
|
103
|
-
children:
|
|
103
|
+
className: `${o.fullWidth} ${o.textEllipsis}`,
|
|
104
|
+
onClick: () => P(e.id),
|
|
105
|
+
children: t ? /* @__PURE__ */ l("div", { className: o.menuButton, children: /* @__PURE__ */ l($, { mode: "ghost", label: e.label, disabled: e.disabled, childrenLeft: e.icon }, e.id) }) : /* @__PURE__ */ l(f, { mode: "ghost", children: e.icon, disabled: e.disabled })
|
|
104
106
|
},
|
|
105
|
-
`param-icon-${
|
|
107
|
+
`param-icon-${e.id}`
|
|
106
108
|
)),
|
|
107
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ l(
|
|
108
110
|
W,
|
|
109
111
|
{
|
|
110
112
|
ref: V,
|
|
111
|
-
className:
|
|
113
|
+
className: o.borderRadiusM,
|
|
112
114
|
open: L,
|
|
113
115
|
onClose: () => C(!1),
|
|
114
116
|
position: z,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { Size } from '../interface';
|
|
2
3
|
|
|
3
4
|
import * as PhosphorIcons from "@phosphor-icons/react";
|
|
@@ -40,6 +41,14 @@ export interface SelectProps {
|
|
|
40
41
|
/** Enable a search input inside the select modal to filter options **/
|
|
41
42
|
searchable?: boolean;
|
|
42
43
|
fullWidth?: boolean;
|
|
44
|
+
/** Custom trigger — replaces the default button. Can be anything (Tag, chip, etc.) **/
|
|
45
|
+
children?: ReactNode;
|
|
46
|
+
/** Custom render for each item in the dropdown list **/
|
|
47
|
+
renderItem?: (item: SelectItem) => ReactNode;
|
|
48
|
+
/** Extra icon displayed on the right of the trigger button (before the caret) **/
|
|
49
|
+
triggerIcon?: ReactNode;
|
|
50
|
+
/** Width of the dropdown panel: 'auto' (natural size) or 'full' (fills the container). Default: 'auto' **/
|
|
51
|
+
dropdownWidth?: 'auto' | 'full';
|
|
43
52
|
iconSize?: number;
|
|
44
53
|
}
|
|
45
54
|
/**
|
|
@@ -47,4 +56,4 @@ export interface SelectProps {
|
|
|
47
56
|
* It supports three display modes: 'all' (icon + text), 'icon' (only icon), and 'text' (only text).
|
|
48
57
|
* The selected value is displayed in a button, and a modal opens to show the list of options.
|
|
49
58
|
*/
|
|
50
|
-
export declare const Select: ({ selected, size, listItem, modeDisplay, onSelect, positionOverride, placeholder, searchPlaceholder, autoCloseCondition, searchable, fullWidth, iconSize }: SelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
export declare const Select: ({ selected, size, listItem, modeDisplay, onSelect, positionOverride, placeholder, searchPlaceholder, autoCloseCondition, searchable, fullWidth, children, renderItem, triggerIcon, dropdownWidth, iconSize }: SelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,214 +1,242 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Button as
|
|
4
|
-
import { Input as
|
|
5
|
-
import { IconButton as
|
|
1
|
+
import { jsxs as m, jsx as o, Fragment as G } from "react/jsx-runtime";
|
|
2
|
+
import { useState as _, useRef as b, useEffect as d } from "react";
|
|
3
|
+
import { Button as S } from "../button/Button.js";
|
|
4
|
+
import { Input as I } from "../input/Input.js";
|
|
5
|
+
import { IconButton as ee } from "../icon-button/IconButton.js";
|
|
6
6
|
import "../../index-CxdrhfJv.mjs";
|
|
7
7
|
import "../accordion/Accordion.js";
|
|
8
|
-
import { Icon as
|
|
9
|
-
import { Modal as
|
|
8
|
+
import { Icon as T } from "../icon/Icon.js";
|
|
9
|
+
import { Modal as te } from "../modal/Modal.js";
|
|
10
10
|
import "../carousel/Carousel.js";
|
|
11
11
|
import "../carousel/FadeCarousel.js";
|
|
12
12
|
import "../theme/ThemeContext.js";
|
|
13
13
|
import '../../styles/Size.css';import '../../styles/Select.css';/* empty css */
|
|
14
|
-
const
|
|
15
|
-
selectContainer:
|
|
16
|
-
children:
|
|
17
|
-
active:
|
|
18
|
-
selectList:
|
|
19
|
-
modal:
|
|
20
|
-
itemLabel:
|
|
21
|
-
searchWrapper:
|
|
22
|
-
noResults:
|
|
23
|
-
},
|
|
14
|
+
const ne = "_selectContainer_133eb_54", re = "_children_133eb_61", oe = "_active_133eb_78", se = "_selectList_133eb_82", ae = "_modal_133eb_91", ce = "_itemLabel_133eb_98", ie = "_searchWrapper_133eb_103", le = "_noResults_133eb_109", f = {
|
|
15
|
+
selectContainer: ne,
|
|
16
|
+
children: re,
|
|
17
|
+
active: oe,
|
|
18
|
+
selectList: se,
|
|
19
|
+
modal: ae,
|
|
20
|
+
itemLabel: ce,
|
|
21
|
+
searchWrapper: ie,
|
|
22
|
+
noResults: le
|
|
23
|
+
}, xe = ({
|
|
24
24
|
selected: k,
|
|
25
|
-
size:
|
|
25
|
+
size: w = "m",
|
|
26
26
|
listItem: h,
|
|
27
|
-
modeDisplay:
|
|
27
|
+
modeDisplay: N = "all",
|
|
28
28
|
onSelect: z,
|
|
29
|
-
positionOverride:
|
|
29
|
+
positionOverride: L,
|
|
30
30
|
placeholder: x = "Sélectionner",
|
|
31
|
-
searchPlaceholder:
|
|
32
|
-
autoCloseCondition:
|
|
33
|
-
searchable:
|
|
34
|
-
fullWidth:
|
|
35
|
-
|
|
31
|
+
searchPlaceholder: H,
|
|
32
|
+
autoCloseCondition: y,
|
|
33
|
+
searchable: J = !1,
|
|
34
|
+
fullWidth: g = !1,
|
|
35
|
+
children: P,
|
|
36
|
+
renderItem: F,
|
|
37
|
+
triggerIcon: R,
|
|
38
|
+
dropdownWidth: V = "auto",
|
|
39
|
+
iconSize: Q = 20
|
|
36
40
|
}) => {
|
|
37
|
-
const [t, l] =
|
|
41
|
+
const [t, l] = _(!1), [X, A] = _({
|
|
38
42
|
top: "calc(100% + 6px)",
|
|
39
43
|
left: "0px"
|
|
40
|
-
}), [
|
|
44
|
+
}), [r, B] = _(k ?? null), [D, Y] = _(""), u = b(null), M = b(null), K = b(null), $ = b({}), U = b({}), v = b(null);
|
|
41
45
|
d(() => {
|
|
42
|
-
|
|
46
|
+
B(k || null);
|
|
43
47
|
}, [k]), d(() => {
|
|
44
|
-
|
|
45
|
-
}, [
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
L && A(L);
|
|
49
|
+
}, [L]);
|
|
50
|
+
const Z = (e) => {
|
|
51
|
+
B(e), l(!1), z && z(e);
|
|
52
|
+
}, W = /* @__PURE__ */ o(T, { icon: t ? "CaretUp" : "CaretDown", size: 14, weight: "bold" }), j = R ? /* @__PURE__ */ m(G, { children: [
|
|
53
|
+
R,
|
|
54
|
+
W
|
|
55
|
+
] }) : W, O = () => {
|
|
56
|
+
if (P)
|
|
57
|
+
return /* @__PURE__ */ o(
|
|
58
|
+
S,
|
|
59
|
+
{
|
|
60
|
+
ref: u,
|
|
61
|
+
mode: "tertiary",
|
|
62
|
+
label: "",
|
|
63
|
+
size: w,
|
|
64
|
+
fullWidth: g,
|
|
65
|
+
childrenLeft: R ? /* @__PURE__ */ m("div", { style: { display: "flex", alignItems: "center", gap: "var(--spacing-xs-3)" }, children: [
|
|
66
|
+
R,
|
|
67
|
+
P
|
|
68
|
+
] }) : P,
|
|
69
|
+
childrenRight: W,
|
|
70
|
+
onClick: () => l(!t),
|
|
71
|
+
"aria-expanded": t,
|
|
72
|
+
"aria-haspopup": "listbox"
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
const e = r == null ? void 0 : r.icon, n = (r == null ? void 0 : r.label) ?? x;
|
|
76
|
+
return N === "icon" && e ? /* @__PURE__ */ o(ee, { ref: u, mode: "tertiary", size: w, onClick: () => l(!t), children: /* @__PURE__ */ o(T, { size: Q, icon: r.icon }) }) : N === "text" ? /* @__PURE__ */ o(
|
|
77
|
+
S,
|
|
52
78
|
{
|
|
53
79
|
ref: u,
|
|
54
80
|
mode: "tertiary",
|
|
55
|
-
label:
|
|
56
|
-
childrenRight:
|
|
57
|
-
size:
|
|
58
|
-
fullWidth:
|
|
81
|
+
label: r ? n : x,
|
|
82
|
+
childrenRight: j,
|
|
83
|
+
size: w,
|
|
84
|
+
fullWidth: g,
|
|
59
85
|
onClick: () => l(!t),
|
|
60
86
|
"aria-expanded": t,
|
|
61
87
|
"aria-haspopup": "listbox"
|
|
62
88
|
}
|
|
63
|
-
) :
|
|
64
|
-
|
|
89
|
+
) : N === "all" ? /* @__PURE__ */ o(
|
|
90
|
+
S,
|
|
65
91
|
{
|
|
66
92
|
ref: u,
|
|
67
93
|
mode: "tertiary",
|
|
68
|
-
label:
|
|
69
|
-
size:
|
|
70
|
-
fullWidth:
|
|
71
|
-
childrenLeft: e && /* @__PURE__ */
|
|
72
|
-
childrenRight:
|
|
94
|
+
label: r ? n : x,
|
|
95
|
+
size: w,
|
|
96
|
+
fullWidth: g,
|
|
97
|
+
childrenLeft: e && /* @__PURE__ */ o(T, { icon: r.icon }),
|
|
98
|
+
childrenRight: j,
|
|
73
99
|
onClick: () => l(!t),
|
|
74
100
|
"aria-expanded": t,
|
|
75
101
|
"aria-haspopup": "listbox"
|
|
76
102
|
}
|
|
77
|
-
) : /* @__PURE__ */
|
|
78
|
-
|
|
103
|
+
) : /* @__PURE__ */ o(
|
|
104
|
+
S,
|
|
79
105
|
{
|
|
80
106
|
ref: u,
|
|
81
107
|
mode: "tertiary",
|
|
82
|
-
fullWidth:
|
|
108
|
+
fullWidth: g,
|
|
83
109
|
label: x ?? "Sélectionner",
|
|
84
|
-
size:
|
|
110
|
+
size: w,
|
|
111
|
+
childrenRight: j,
|
|
85
112
|
onClick: () => l(!t),
|
|
86
113
|
"aria-expanded": t,
|
|
87
114
|
"aria-haspopup": "listbox"
|
|
88
115
|
}
|
|
89
116
|
);
|
|
90
|
-
},
|
|
91
|
-
(e) => String(e.label ?? "").toLowerCase().includes(
|
|
92
|
-
), [C,
|
|
117
|
+
}, q = h.filter(
|
|
118
|
+
(e) => String(e.label ?? "").toLowerCase().includes(D.toLowerCase())
|
|
119
|
+
), [C, E] = _("");
|
|
93
120
|
return d(() => {
|
|
94
121
|
if (t) {
|
|
95
|
-
const e = (
|
|
96
|
-
const
|
|
97
|
-
if (!
|
|
98
|
-
const i = C +
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
var
|
|
102
|
-
return (
|
|
122
|
+
const e = (n) => {
|
|
123
|
+
const a = n.key.length === 1 ? n.key.toLowerCase() : "";
|
|
124
|
+
if (!a) return;
|
|
125
|
+
const i = C + a;
|
|
126
|
+
E(i);
|
|
127
|
+
const s = h.find((c) => {
|
|
128
|
+
var p;
|
|
129
|
+
return (p = c.label) == null ? void 0 : p.toLowerCase().startsWith(i);
|
|
103
130
|
});
|
|
104
|
-
if (
|
|
105
|
-
const
|
|
106
|
-
|
|
131
|
+
if (s) {
|
|
132
|
+
const c = $.current[s.value];
|
|
133
|
+
c == null || c.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
107
134
|
}
|
|
108
|
-
|
|
135
|
+
v.current && clearTimeout(v.current), v.current = setTimeout(() => E(""), 500);
|
|
109
136
|
};
|
|
110
137
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
111
138
|
}
|
|
112
139
|
}, [t, C, h]), d(() => {
|
|
113
|
-
const e = (
|
|
140
|
+
const e = (n) => {
|
|
114
141
|
if (!t) return;
|
|
115
|
-
const
|
|
116
|
-
if (!
|
|
117
|
-
const i = C +
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
(
|
|
121
|
-
var
|
|
122
|
-
return (
|
|
142
|
+
const a = n.key.length === 1 ? n.key.toLowerCase() : "";
|
|
143
|
+
if (!a) return;
|
|
144
|
+
const i = C + a;
|
|
145
|
+
E(i);
|
|
146
|
+
const s = h.find(
|
|
147
|
+
(c) => {
|
|
148
|
+
var p;
|
|
149
|
+
return (p = c.label) == null ? void 0 : p.toLowerCase().startsWith(i);
|
|
123
150
|
}
|
|
124
151
|
);
|
|
125
|
-
if (
|
|
126
|
-
const
|
|
127
|
-
|
|
152
|
+
if (s && K.current && $.current[s.value]) {
|
|
153
|
+
const c = K.current, p = $.current[s.value];
|
|
154
|
+
c.scrollTo({ top: p.offsetTop - c.offsetTop, behavior: "smooth" });
|
|
128
155
|
}
|
|
129
|
-
|
|
156
|
+
v.current && clearTimeout(v.current), v.current = setTimeout(() => E(""), 700);
|
|
130
157
|
};
|
|
131
158
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
132
159
|
}, [t, h, C]), d(() => {
|
|
133
160
|
if (!t) return;
|
|
134
|
-
const e = (
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
137
|
-
const i = h.find((
|
|
138
|
-
var
|
|
139
|
-
return (
|
|
161
|
+
const e = (n) => {
|
|
162
|
+
const a = n.key.toLowerCase();
|
|
163
|
+
if (a.length === 1) {
|
|
164
|
+
const i = h.find((s) => {
|
|
165
|
+
var c;
|
|
166
|
+
return (c = s.label) == null ? void 0 : c.toLowerCase().startsWith(a);
|
|
140
167
|
});
|
|
141
168
|
if (i) {
|
|
142
|
-
const
|
|
143
|
-
|
|
169
|
+
const s = U.current[i.value];
|
|
170
|
+
s && s.scrollIntoView({ block: "start", behavior: "smooth" });
|
|
144
171
|
}
|
|
145
172
|
}
|
|
146
173
|
};
|
|
147
174
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
148
175
|
}, [t, h]), d(() => {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
176
|
+
const e = u.current;
|
|
177
|
+
if (t && e) {
|
|
178
|
+
const { height: n } = e.getBoundingClientRect(), a = { top: `${n + 6}px`, left: "0px" };
|
|
179
|
+
A(L || { ...a, ...V === "full" ? { width: "calc(100% - var(--spacing-xs-6) * 2)" } : {} });
|
|
152
180
|
}
|
|
153
|
-
}, [t,
|
|
154
|
-
if (!t || !
|
|
155
|
-
const e = (
|
|
156
|
-
const
|
|
157
|
-
i && i.contains(
|
|
181
|
+
}, [t, L, V]), d(() => {
|
|
182
|
+
if (!t || !y) return;
|
|
183
|
+
const e = (n) => {
|
|
184
|
+
const a = n.target, i = u.current, s = M.current;
|
|
185
|
+
i && i.contains(a) || s && s.contains(a) || l(!1);
|
|
158
186
|
};
|
|
159
187
|
return document.addEventListener("mousedown", e), document.addEventListener("touchstart", e, { passive: !0 }), () => {
|
|
160
188
|
document.removeEventListener("mousedown", e), document.removeEventListener("touchstart", e);
|
|
161
189
|
};
|
|
162
|
-
}, [t,
|
|
163
|
-
if (!t || !
|
|
164
|
-
const e = (
|
|
165
|
-
|
|
190
|
+
}, [t, y]), d(() => {
|
|
191
|
+
if (!t || !y) return;
|
|
192
|
+
const e = (n) => {
|
|
193
|
+
n.key === "Escape" && l(!1);
|
|
166
194
|
};
|
|
167
195
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
168
|
-
}, [t,
|
|
169
|
-
|
|
170
|
-
/* @__PURE__ */
|
|
171
|
-
|
|
196
|
+
}, [t, y]), /* @__PURE__ */ m("div", { className: f.selectContainer, children: [
|
|
197
|
+
O(),
|
|
198
|
+
/* @__PURE__ */ o(
|
|
199
|
+
te,
|
|
172
200
|
{
|
|
173
201
|
anchorRef: u,
|
|
174
202
|
open: t,
|
|
175
203
|
onClose: () => l(!1),
|
|
176
|
-
position:
|
|
204
|
+
position: X,
|
|
177
205
|
disableOverlay: !0,
|
|
178
206
|
className: f.modal,
|
|
179
|
-
autoCloseCondition:
|
|
180
|
-
children: /* @__PURE__ */
|
|
181
|
-
|
|
182
|
-
/* @__PURE__ */
|
|
183
|
-
|
|
207
|
+
autoCloseCondition: y,
|
|
208
|
+
children: /* @__PURE__ */ m("div", { ref: M, children: [
|
|
209
|
+
J && /* @__PURE__ */ m("div", { children: [
|
|
210
|
+
/* @__PURE__ */ o(
|
|
211
|
+
I,
|
|
184
212
|
{
|
|
185
213
|
type: "text",
|
|
186
|
-
placeholder:
|
|
214
|
+
placeholder: H,
|
|
187
215
|
status: "ghost",
|
|
188
216
|
sizeStyle: "s",
|
|
189
|
-
value:
|
|
190
|
-
onChange: (e) =>
|
|
217
|
+
value: D,
|
|
218
|
+
onChange: (e) => Y(e.target.value)
|
|
191
219
|
}
|
|
192
220
|
),
|
|
193
|
-
/* @__PURE__ */
|
|
221
|
+
/* @__PURE__ */ o("div", { className: f.searchWrapper })
|
|
194
222
|
] }),
|
|
195
|
-
/* @__PURE__ */
|
|
196
|
-
|
|
223
|
+
/* @__PURE__ */ m("div", { className: f.selectList, ref: K, children: [
|
|
224
|
+
q.map((e) => /* @__PURE__ */ o(
|
|
197
225
|
"div",
|
|
198
226
|
{
|
|
199
|
-
ref: (
|
|
200
|
-
className: `${f.children} ${(
|
|
201
|
-
onClick: () =>
|
|
227
|
+
ref: (n) => U.current[e.value] = n,
|
|
228
|
+
className: `${f.children} ${(r == null ? void 0 : r.value) === e.value ? f.active : ""}`,
|
|
229
|
+
onClick: () => Z(e),
|
|
202
230
|
role: "option",
|
|
203
|
-
"aria-selected": (
|
|
204
|
-
children: [
|
|
205
|
-
e.icon && /* @__PURE__ */
|
|
206
|
-
e.label && /* @__PURE__ */
|
|
207
|
-
]
|
|
231
|
+
"aria-selected": (r == null ? void 0 : r.value) === e.value,
|
|
232
|
+
children: F ? F(e) : /* @__PURE__ */ m(G, { children: [
|
|
233
|
+
e.icon && /* @__PURE__ */ o(T, { icon: e.icon, size: e.iconSize ? e.iconSize : 16 }),
|
|
234
|
+
e.label && /* @__PURE__ */ o("div", { className: f.itemLabel, children: e.label })
|
|
235
|
+
] })
|
|
208
236
|
},
|
|
209
237
|
e.value
|
|
210
238
|
)),
|
|
211
|
-
|
|
239
|
+
q.length === 0 && /* @__PURE__ */ o("div", { className: `${f.noResults} textSmall`, children: "Aucun résultat" })
|
|
212
240
|
] })
|
|
213
241
|
] })
|
|
214
242
|
}
|
|
@@ -216,5 +244,5 @@ const X = "_selectContainer_133eb_54", Y = "_children_133eb_61", Z = "_active_13
|
|
|
216
244
|
] });
|
|
217
245
|
};
|
|
218
246
|
export {
|
|
219
|
-
|
|
247
|
+
xe as Select
|
|
220
248
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.
|
|
1
|
+
@charset "UTF-8";._accordionHeader_10lt2_7{display:flex;align-items:center;justify-content:space-between;border-radius:.375rem;gap:.375rem}._padding-s_10lt2_15{padding:var(--spacing-xs-4)}._padding-m_10lt2_19{padding:var(--spacing-xs-2)}._padding-l_10lt2_23{padding:var(--spacing-xs)}._padding-xl_10lt2_27{padding:var(--spacing-s)}._title_10lt2_31{flex-grow:1;text-align:left}._fullHeight_10lt2_36{height:100%}._block_10lt2_40{border:1px solid var(--general-border-window);box-shadow:0 4px 5px 0 var(--shadow-color-minimal);background:var(--background-primary);border-radius:.375rem}._tile_10lt2_48 ._accordionHeader_10lt2_7{border-radius:.375rem;background:var(--background-primary);margin-bottom:.375rem;border:1px solid var(--general-border-window)}._secondaryOpen_10lt2_56{background:var(--skeleton-step-empty-background)}._ghost_10lt2_61 ._accordionHeader_10lt2_7{padding-left:0;padding-right:0}
|