@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.
@@ -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 k, useEffect as y, useMemo as B } from "react";
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 O = "_accordionHeader_bor6q_7", A = "_title_bor6q_31", M = "_fullHeight_bor6q_36", H = "_block_bor6q_40", I = "_tile_bor6q_48", L = "_secondaryOpen_bor6q_56", e = {
5
- accordionHeader: O,
6
- "padding-s": "_padding-s_bor6q_15",
7
- "padding-m": "_padding-m_bor6q_19",
8
- "padding-l": "_padding-l_bor6q_23",
9
- "padding-xl": "_padding-xl_bor6q_27",
10
- title: A,
11
- fullHeight: M,
12
- block: H,
13
- tile: I,
14
- secondaryOpen: L
15
- }, z = ({
16
- header: m,
17
- children: f,
18
- iconPosition: a = "right",
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: c = "block",
21
- paddingHeader: b = "m",
22
- onClickHeader: s,
21
+ type: h = "block",
22
+ paddingHeader: u = "m",
23
+ onClickHeader: n,
23
24
  toggleOnHeaderClick: v = !1,
24
- mode: h = "primary",
25
+ mode: o = "primary",
25
26
  open: g,
26
- onToggle: r
27
+ onToggle: a
27
28
  }) => {
28
- const l = g !== void 0, [u, _] = k(!1);
29
- y(() => {
30
- l || _(!!d);
31
- }, [d, l]);
32
- const i = l ? !!g : u, n = () => {
33
- if (l) {
34
- r == null || r();
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
- _((o) => !o);
38
- }, x = (o) => {
39
- if (o.target.closest("button")) {
40
- o.stopPropagation();
38
+ _((s) => !s);
39
+ }, b = (s) => {
40
+ if (s.target.closest("button")) {
41
+ s.stopPropagation();
41
42
  return;
42
43
  }
43
- v && n(), s == null || s();
44
- }, q = B(() => [
45
- c === "tile" ? e.tile : e.block,
46
- h === "secondary" && i ? e.secondaryOpen : ""
47
- ].filter(Boolean).join(" "), [c, h, i]);
48
- return /* @__PURE__ */ p("div", { className: q, children: [
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: `${e.accordionHeader} ${e[`padding-${b}`]}`,
53
- onClick: x,
53
+ className: `${l.accordionHeader} ${l[`padding-${u}`]}`,
54
+ onClick: b,
54
55
  "data-ignore-outside-click": !0,
55
56
  children: [
56
- a === "left" && /* @__PURE__ */ t(w, { mode: "ghost", size: "s", onClick: n, children: i ? /* @__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" }) }) }),
57
- /* @__PURE__ */ t("div", { className: e.title, children: m }),
58
- a === "right" && /* @__PURE__ */ t(w, { mode: "ghost", size: "s", onClick: n, children: i ? /* @__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" }) }) })
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
- i && f
63
+ e && m
63
64
  ] });
64
65
  };
65
66
  export {
66
- z as AccordionItem
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 n, jsxs as d } from "react/jsx-runtime";
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", e = {
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: s = [], menuParams: a = [], shortLogo: m, logo: p, isOpen: h, defaultOpen: I = !1, selectedId: u }) => {
32
- const [l, g] = c(I ?? !1), [b, x] = c(u ?? (s.length > 0 ? s[0].id : null)), w = M(null), [H, _] = c(!1), [L, C] = c(!1), [k, E] = c(null), [z, R] = c({}), V = M(null);
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
- u != null && x(u);
35
- }, [u]);
36
- const v = (o, i) => {
37
- if (o.stopPropagation(), x(i), s) {
38
- const t = s.find((r) => r.id === i);
39
- t == null || t.onClick();
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
- g(!l), _(!1);
43
- }, P = (o) => {
44
- var i;
45
- if (a) {
46
- const t = a.find((r) => r.id === o);
47
- if (!t) return;
48
- if (t.content) {
49
- const r = l ? "200px" : "40px";
50
- E(t.content), R({ ...t.position, left: r }), C(!0);
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
- (i = t.onClick) == null || i.call(t);
52
+ (s = n.onClick) == null || s.call(n);
53
53
  }
54
54
  };
55
55
  return B(() => {
56
- h && h(l);
57
- }, [l]), /* @__PURE__ */ n("nav", { ref: w, children: /* @__PURE__ */ d("div", { className: `${e.flexVerticalBetweenStart} ${e.fullHeight} ${l ? e.open : e.close}`, children: [
58
- /* @__PURE__ */ d("div", { className: e.fullWidth, children: [
59
- /* @__PURE__ */ n(
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: `${e.flexHorizontalCenter} ${e.pointer} ${e.textEllipsis}`,
62
+ className: `${o.flexHorizontalCenter} ${o.pointer} ${o.textEllipsis}`,
63
63
  onClick: () => S(),
64
- children: l ? /* @__PURE__ */ d("div", { className: e.fullImg, children: [
65
- p && /* @__PURE__ */ n("img", { className: e.longLogo, src: p, alt: "Logo situaction" }),
66
- /* @__PURE__ */ n(f, { mode: "ghost", size: "menu", children: /* @__PURE__ */ n(N, { icon: "CaretDoubleLeft", size: 16, weight: "duotone" }) })
67
- ] }) : /* @__PURE__ */ n(
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: e.closeIcon,
70
+ className: o.closeIcon,
71
71
  onMouseEnter: () => _(!0),
72
72
  onMouseLeave: () => _(!1),
73
- onClick: () => g(!l),
74
- children: H || !m ? /* @__PURE__ */ n(f, { mode: "ghost", size: "menu", children: /* @__PURE__ */ n(N, { icon: "CaretDoubleRight", size: 22, weight: "duotone" }) }) : /* @__PURE__ */ n("img", { src: m, alt: "Logo situaction" })
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__ */ n("div", { className: e.menuItem, children: s && s.map((o) => l ? /* @__PURE__ */ n("div", { className: `${e.textEllipsis} ${e.menuButton}`, children: /* @__PURE__ */ n(
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: b === o.id ? "secondary" : "ghost",
83
- label: o.label,
84
- onClick: (i) => v(i, o.id),
85
- childrenLeft: o.icon
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-${o.id}`) : /* @__PURE__ */ n("div", { className: e.textEllipsis, children: /* @__PURE__ */ n(
88
+ ) }, `button-${e.id}`) : /* @__PURE__ */ l("div", { className: o.textEllipsis, children: /* @__PURE__ */ l(
88
89
  f,
89
90
  {
90
- mode: b === o.id ? "secondary" : "ghost",
91
- children: o.icon,
92
- onClick: (i) => v(i, o.id)
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-${o.id}`)) }),
95
- /* @__PURE__ */ n("div", { className: e.line })
96
+ ) }, `icon-${e.id}`)) }),
97
+ /* @__PURE__ */ l("div", { className: o.line })
96
98
  ] }),
97
- /* @__PURE__ */ d("div", { className: `${e.menuParams} ${e.flexVerticalBetweenCenter}`, children: [
98
- a && a.map((o) => /* @__PURE__ */ n(
99
+ /* @__PURE__ */ u("div", { className: `${o.menuParams} ${o.flexVerticalBetweenCenter}`, children: [
100
+ d && d.map((e) => /* @__PURE__ */ l(
99
101
  "div",
100
102
  {
101
- className: `${e.fullWidth} ${e.textEllipsis}`,
102
- onClick: () => P(o.id),
103
- children: l ? /* @__PURE__ */ n("div", { className: e.menuButton, children: /* @__PURE__ */ n($, { mode: "ghost", label: o.label, childrenLeft: o.icon }, o.id) }) : /* @__PURE__ */ n(f, { mode: "ghost", children: o.icon })
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-${o.id}`
107
+ `param-icon-${e.id}`
106
108
  )),
107
- /* @__PURE__ */ n(
109
+ /* @__PURE__ */ l(
108
110
  W,
109
111
  {
110
112
  ref: V,
111
- className: e.borderRadiusM,
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 L, jsx as s } from "react/jsx-runtime";
2
- import { useState as y, useRef as v, useEffect as d } from "react";
3
- import { Button as W } from "../button/Button.js";
4
- import { Input as H } from "../input/Input.js";
5
- import { IconButton as J } from "../icon-button/IconButton.js";
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 _ } from "../icon/Icon.js";
9
- import { Modal as Q } from "../modal/Modal.js";
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 X = "_selectContainer_133eb_54", Y = "_children_133eb_61", Z = "_active_133eb_78", O = "_selectList_133eb_82", I = "_modal_133eb_91", ee = "_itemLabel_133eb_98", te = "_searchWrapper_133eb_103", ne = "_noResults_133eb_109", f = {
15
- selectContainer: X,
16
- children: Y,
17
- active: Z,
18
- selectList: O,
19
- modal: I,
20
- itemLabel: ee,
21
- searchWrapper: te,
22
- noResults: ne
23
- }, ve = ({
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: g = "m",
25
+ size: w = "m",
26
26
  listItem: h,
27
- modeDisplay: E = "all",
27
+ modeDisplay: N = "all",
28
28
  onSelect: z,
29
- positionOverride: b,
29
+ positionOverride: L,
30
30
  placeholder: x = "Sélectionner",
31
- searchPlaceholder: U,
32
- autoCloseCondition: w,
33
- searchable: V = !1,
34
- fullWidth: S = !1,
35
- iconSize: A = 20
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] = y(!1), [F, B] = y({
41
+ const [t, l] = _(!1), [X, A] = _({
38
42
  top: "calc(100% + 6px)",
39
43
  left: "0px"
40
- }), [n, T] = y(k ?? null), [K, M] = y(""), u = v(null), $ = v(null), N = v(null), P = v({}), j = v({}), p = v(null);
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
- T(k || null);
46
+ B(k || null);
43
47
  }, [k]), d(() => {
44
- b && B(b);
45
- }, [b]);
46
- const q = (e) => {
47
- T(e), l(!1), z && z(e);
48
- }, G = () => {
49
- const e = n == null ? void 0 : n.icon, r = (n == null ? void 0 : n.label) ?? x;
50
- return E === "icon" && e ? /* @__PURE__ */ s(J, { ref: u, mode: "tertiary", size: g, onClick: () => l(!t), children: /* @__PURE__ */ s(_, { size: A, icon: n.icon }) }) : E === "text" ? /* @__PURE__ */ s(
51
- W,
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: n ? r : x,
56
- childrenRight: /* @__PURE__ */ s(_, { icon: t ? "CaretUp" : "CaretDown", size: 14, weight: "bold" }),
57
- size: g,
58
- fullWidth: S,
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
- ) : E === "all" ? /* @__PURE__ */ s(
64
- W,
89
+ ) : N === "all" ? /* @__PURE__ */ o(
90
+ S,
65
91
  {
66
92
  ref: u,
67
93
  mode: "tertiary",
68
- label: n ? r : x,
69
- size: g,
70
- fullWidth: S,
71
- childrenLeft: e && /* @__PURE__ */ s(_, { icon: n.icon }),
72
- childrenRight: /* @__PURE__ */ s(_, { icon: t ? "CaretUp" : "CaretDown", size: 14, weight: "bold" }),
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__ */ s(
78
- W,
103
+ ) : /* @__PURE__ */ o(
104
+ S,
79
105
  {
80
106
  ref: u,
81
107
  mode: "tertiary",
82
- fullWidth: S,
108
+ fullWidth: g,
83
109
  label: x ?? "Sélectionner",
84
- size: g,
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
- }, D = h.filter(
91
- (e) => String(e.label ?? "").toLowerCase().includes(K.toLowerCase())
92
- ), [C, R] = y("");
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 = (r) => {
96
- const c = r.key.length === 1 ? r.key.toLowerCase() : "";
97
- if (!c) return;
98
- const i = C + c;
99
- R(i);
100
- const o = h.find((a) => {
101
- var m;
102
- return (m = a.label) == null ? void 0 : m.toLowerCase().startsWith(i);
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 (o) {
105
- const a = P.current[o.value];
106
- a == null || a.scrollIntoView({ behavior: "smooth", block: "nearest" });
131
+ if (s) {
132
+ const c = $.current[s.value];
133
+ c == null || c.scrollIntoView({ behavior: "smooth", block: "nearest" });
107
134
  }
108
- p.current && clearTimeout(p.current), p.current = setTimeout(() => R(""), 500);
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 = (r) => {
140
+ const e = (n) => {
114
141
  if (!t) return;
115
- const c = r.key.length === 1 ? r.key.toLowerCase() : "";
116
- if (!c) return;
117
- const i = C + c;
118
- R(i);
119
- const o = h.find(
120
- (a) => {
121
- var m;
122
- return (m = a.label) == null ? void 0 : m.toLowerCase().startsWith(i);
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 (o && N.current && P.current[o.value]) {
126
- const a = N.current, m = P.current[o.value];
127
- a.scrollTo({ top: m.offsetTop - a.offsetTop, behavior: "smooth" });
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
- p.current && clearTimeout(p.current), p.current = setTimeout(() => R(""), 700);
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 = (r) => {
135
- const c = r.key.toLowerCase();
136
- if (c.length === 1) {
137
- const i = h.find((o) => {
138
- var a;
139
- return (a = o.label) == null ? void 0 : a.toLowerCase().startsWith(c);
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 o = j.current[i.value];
143
- o && o.scrollIntoView({ block: "start", behavior: "smooth" });
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
- if (t && u.current) {
150
- const e = u.current.getBoundingClientRect().height;
151
- B(b || { top: `${e + 6}px`, left: "0px" });
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, b]), d(() => {
154
- if (!t || !w) return;
155
- const e = (r) => {
156
- const c = r.target, i = u.current, o = $.current;
157
- i && i.contains(c) || o && o.contains(c) || l(!1);
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, w]), d(() => {
163
- if (!t || !w) return;
164
- const e = (r) => {
165
- r.key === "Escape" && l(!1);
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, w]), /* @__PURE__ */ L("div", { className: f.selectContainer, children: [
169
- G(),
170
- /* @__PURE__ */ s(
171
- Q,
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: F,
204
+ position: X,
177
205
  disableOverlay: !0,
178
206
  className: f.modal,
179
- autoCloseCondition: w,
180
- children: /* @__PURE__ */ L("div", { ref: $, children: [
181
- V && /* @__PURE__ */ L("div", { children: [
182
- /* @__PURE__ */ s(
183
- H,
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: U,
214
+ placeholder: H,
187
215
  status: "ghost",
188
216
  sizeStyle: "s",
189
- value: K,
190
- onChange: (e) => M(e.target.value)
217
+ value: D,
218
+ onChange: (e) => Y(e.target.value)
191
219
  }
192
220
  ),
193
- /* @__PURE__ */ s("div", { className: f.searchWrapper })
221
+ /* @__PURE__ */ o("div", { className: f.searchWrapper })
194
222
  ] }),
195
- /* @__PURE__ */ L("div", { className: f.selectList, ref: N, children: [
196
- D.map((e) => /* @__PURE__ */ L(
223
+ /* @__PURE__ */ m("div", { className: f.selectList, ref: K, children: [
224
+ q.map((e) => /* @__PURE__ */ o(
197
225
  "div",
198
226
  {
199
- ref: (r) => j.current[e.value] = r,
200
- className: `${f.children} ${(n == null ? void 0 : n.value) === e.value ? f.active : ""}`,
201
- onClick: () => q(e),
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": (n == null ? void 0 : n.value) === e.value,
204
- children: [
205
- e.icon && /* @__PURE__ */ s(_, { icon: e.icon, size: e.iconSize ? e.iconSize : 16 }),
206
- e.label && /* @__PURE__ */ s("div", { className: f.itemLabel, children: e.label })
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
- D.length === 0 && /* @__PURE__ */ s("div", { className: `${f.noResults} textSmall`, children: "Aucun résultat" })
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
- ve as Select
247
+ xe as Select
220
248
  };
@@ -1 +1 @@
1
- @charset "UTF-8";._accordionHeader_bor6q_7{display:flex;align-items:center;justify-content:space-between;border-radius:.375rem;gap:.375rem}._padding-s_bor6q_15{padding:var(--spacing-xs-4)}._padding-m_bor6q_19{padding:var(--spacing-xs-2)}._padding-l_bor6q_23{padding:var(--spacing-xs)}._padding-xl_bor6q_27{padding:var(--spacing-s)}._title_bor6q_31{flex-grow:1;text-align:left}._fullHeight_bor6q_36{height:100%}._block_bor6q_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_bor6q_48 ._accordionHeader_bor6q_7{border-radius:.375rem;background:var(--background-primary);margin-bottom:.375rem;border:1px solid var(--general-border-window)}._secondaryOpen_bor6q_56{background:var(--skeleton-step-empty-background)}
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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@situaction/traq-ui-ste",
3
- "version": "1.2.35",
3
+ "version": "1.2.39",
4
4
  "description": "library react component Situaction",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",