@fluidattacks/design 9.7.2 → 9.8.0

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.
Files changed (29) hide show
  1. package/dist/_virtual/index.js +2 -3
  2. package/dist/_virtual/index2.js +3 -5
  3. package/dist/_virtual/index3.js +5 -5
  4. package/dist/_virtual/index4.js +5 -5
  5. package/dist/_virtual/index5.js +5 -2
  6. package/dist/components/group-selector/index.js +44 -41
  7. package/dist/components/group-selector/index.stories.d.ts +2 -1
  8. package/dist/components/group-selector/option-container/index.d.ts +1 -1
  9. package/dist/components/group-selector/option-container/index.js +37 -24
  10. package/dist/components/group-selector/styles.d.ts +4 -2
  11. package/dist/components/group-selector/styles.js +9 -9
  12. package/dist/components/group-selector/types.d.ts +5 -0
  13. package/dist/components/list-item/index.d.ts +1 -1
  14. package/dist/components/list-item/index.js +67 -47
  15. package/dist/components/list-item/index.stories.d.ts +2 -1
  16. package/dist/components/list-item/item-action/index.d.ts +3 -0
  17. package/dist/components/list-item/item-action/index.js +36 -0
  18. package/dist/components/list-item/item-action/styles.d.ts +6 -0
  19. package/dist/components/list-item/item-action/styles.js +17 -0
  20. package/dist/components/list-item/item-action/types.d.ts +14 -0
  21. package/dist/components/list-item/styles.d.ts +5 -1
  22. package/dist/components/list-item/styles.js +9 -9
  23. package/dist/components/list-item/types.d.ts +17 -1
  24. package/dist/components/menu/index.js +3 -2
  25. package/dist/components/modal/columns-modal/preview-panel/styles.d.ts +1 -1
  26. package/dist/components/modal/columns-modal/search-panel/styles.d.ts +1 -1
  27. package/dist/node_modules/react-joyride/dist/index.js +4 -4
  28. package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
  29. package/package.json +1 -1
@@ -1,5 +1,4 @@
1
- import { __require as r } from "../node_modules/use-sync-external-store/shim/index.js";
2
- var i = r();
1
+ var e = { exports: {} };
3
2
  export {
4
- i as s
3
+ e as __module
5
4
  };
@@ -1,7 +1,5 @@
1
- import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
- import { __require as e } from "../node_modules/react-innertext/index.js";
3
- var t = e();
4
- const n = /* @__PURE__ */ r(t);
1
+ import { __require as r } from "../node_modules/use-sync-external-store/shim/index.js";
2
+ var i = r();
5
3
  export {
6
- n as default
4
+ i as s
7
5
  };
@@ -1,7 +1,7 @@
1
- import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
2
- import { __require as r } from "../node_modules/@fastify/deepmerge/index.js";
3
- var o = r();
4
- const p = /* @__PURE__ */ e(o);
1
+ import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
+ import { __require as e } from "../node_modules/react-innertext/index.js";
3
+ var t = e();
4
+ const n = /* @__PURE__ */ r(t);
5
5
  export {
6
- p as default
6
+ n as default
7
7
  };
@@ -1,7 +1,7 @@
1
- import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
- import { __require as o } from "../node_modules/scroll/index.js";
3
- var t = o();
4
- const s = /* @__PURE__ */ r(t);
1
+ import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
2
+ import { __require as r } from "../node_modules/@fastify/deepmerge/index.js";
3
+ var o = r();
4
+ const p = /* @__PURE__ */ e(o);
5
5
  export {
6
- s as default
6
+ p as default
7
7
  };
@@ -1,4 +1,7 @@
1
- var e = { exports: {} };
1
+ import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
+ import { __require as o } from "../node_modules/scroll/index.js";
3
+ var t = o();
4
+ const s = /* @__PURE__ */ r(t);
2
5
  export {
3
- e as __module
6
+ s as default
4
7
  };
@@ -1,43 +1,44 @@
1
- import { jsx as e, jsxs as a } from "react/jsx-runtime";
2
- import { useState as w, useCallback as p, useMemo as b } from "react";
3
- import { createPortal as v } from "react-dom";
4
- import { useTheme as I } from "styled-components";
5
- import { OptionContainer as z } from "./option-container/index.js";
6
- import { StyledGroupContainer as L, OptionBoxContainer as T } from "./styles.js";
1
+ import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
+ import { useState as v, useCallback as p, useMemo as b } from "react";
3
+ import { createPortal as I } from "react-dom";
4
+ import { useTheme as z } from "styled-components";
5
+ import { OptionContainer as L } from "./option-container/index.js";
6
+ import { StyledGroupContainer as T, OptionBoxContainer as j } from "./styles.js";
7
7
  import { Container as o } from "../container/index.js";
8
- import { Divider as j } from "../divider/index.js";
9
- import { Icon as k } from "../icon/index.js";
10
- import { IconButton as G } from "../icon-button/index.js";
11
- import { Search as A } from "../search/index.js";
8
+ import { Divider as k } from "../divider/index.js";
9
+ import { Icon as G } from "../icon/index.js";
10
+ import { IconButton as A } from "../icon-button/index.js";
11
+ import { Search as H } from "../search/index.js";
12
12
  import "../typography/heading/index.js";
13
13
  import "../typography/span/index.js";
14
14
  import { Text as h } from "../typography/text/index.js";
15
- const c = 100, H = ({
15
+ const c = 100, N = ({
16
16
  items: t,
17
17
  handleNewOrganization: l,
18
- onSelect: d,
19
- onClose: g,
20
- selectedItem: u,
21
- title: f,
22
- variant: C
18
+ itemAction: d,
19
+ onSelect: g,
20
+ onClose: u,
21
+ selectedItem: f,
22
+ title: C,
23
+ variant: x
23
24
  }) => {
24
- const n = I(), [i, m] = w(""), x = p(
25
+ const n = z(), [a, m] = v(""), y = p(
25
26
  (r) => {
26
27
  r.currentTarget && m(r.currentTarget.value.slice(0, c));
27
28
  },
28
29
  []
29
- ), y = p(
30
+ ), S = p(
30
31
  (r) => {
31
32
  m(r.target.value.slice(0, c));
32
33
  },
33
34
  []
34
35
  ), s = b(() => {
35
- if (!i) return [...t];
36
- const r = i.toLowerCase();
36
+ if (!a) return [...t];
37
+ const r = a.toLowerCase();
37
38
  return t.filter(
38
- (S) => String(S.name).toLowerCase().includes(r)
39
+ (w) => String(w.name).toLowerCase().includes(r)
39
40
  );
40
- }, [t, i]);
41
+ }, [t, a]);
41
42
  return /* @__PURE__ */ e(
42
43
  o,
43
44
  {
@@ -55,8 +56,8 @@ const c = 100, H = ({
55
56
  left: "0",
56
57
  top: "0",
57
58
  width: "100%",
58
- children: /* @__PURE__ */ a(L, { $itemsLength: s.length, children: [
59
- /* @__PURE__ */ a(
59
+ children: /* @__PURE__ */ i(T, { $itemsLength: s.length, children: [
60
+ /* @__PURE__ */ i(
60
61
  o,
61
62
  {
62
63
  alignItems: "center",
@@ -69,17 +70,17 @@ const c = 100, H = ({
69
70
  color: n.palette.gray[800],
70
71
  fontWeight: "bold",
71
72
  size: "lg",
72
- children: f
73
+ children: C
73
74
  }
74
75
  ),
75
76
  /* @__PURE__ */ e(
76
- G,
77
+ A,
77
78
  {
78
79
  icon: "xmark",
79
80
  iconColor: n.palette.gray[400],
80
81
  iconSize: "lg",
81
82
  iconType: "fa-light",
82
- onClick: g,
83
+ onClick: u,
83
84
  variant: "ghost"
84
85
  }
85
86
  )
@@ -87,17 +88,17 @@ const c = 100, H = ({
87
88
  }
88
89
  ),
89
90
  /* @__PURE__ */ e(o, { mt: 1, children: /* @__PURE__ */ e(
90
- A,
91
+ H,
91
92
  {
92
93
  maxLength: c,
93
- onChange: y,
94
- onInput: x,
94
+ onChange: S,
95
+ onInput: y,
95
96
  placeholder: "Search",
96
- value: i
97
+ value: a
97
98
  }
98
99
  ) }),
99
- /* @__PURE__ */ e(j, { mb: 1, mt: 1 }),
100
- /* @__PURE__ */ a(
100
+ /* @__PURE__ */ e(k, { mb: 1, mt: 1 }),
101
+ /* @__PURE__ */ i(
101
102
  o,
102
103
  {
103
104
  display: "inline-flex",
@@ -106,9 +107,9 @@ const c = 100, H = ({
106
107
  scroll: "y",
107
108
  wrap: "wrap",
108
109
  children: [
109
- C === "organization-selector" ? /* @__PURE__ */ e(T, { onClick: l, children: /* @__PURE__ */ a(o, { alignItems: "center", display: "flex", children: [
110
+ x === "organization-selector" ? /* @__PURE__ */ e(j, { onClick: l, children: /* @__PURE__ */ i(o, { alignItems: "center", display: "flex", children: [
110
111
  /* @__PURE__ */ e(
111
- k,
112
+ G,
112
113
  {
113
114
  icon: "square-plus",
114
115
  iconColor: n.palette.gray[400],
@@ -120,11 +121,13 @@ const c = 100, H = ({
120
121
  /* @__PURE__ */ e(h, { color: n.palette.gray[400], size: "md", children: "New organization" })
121
122
  ] }) }) : void 0,
122
123
  s.map((r) => /* @__PURE__ */ e(
123
- z,
124
+ L,
124
125
  {
125
- isSelected: u.toLowerCase() === r.name,
126
+ isSelected: f.toLowerCase() === r.name,
127
+ itemAction: d,
126
128
  label: r.name.charAt(0).toUpperCase() + r.name.slice(1),
127
- onSelect: d
129
+ onSelect: g,
130
+ value: r.name
128
131
  },
129
132
  r.name
130
133
  ))
@@ -136,10 +139,10 @@ const c = 100, H = ({
136
139
  )
137
140
  }
138
141
  );
139
- }, $ = ({
142
+ }, F = ({
140
143
  isOpen: t = !0,
141
144
  ...l
142
- }) => t ? v(/* @__PURE__ */ e(H, { ...l }), document.body) : /* @__PURE__ */ e("div", {});
145
+ }) => t ? I(/* @__PURE__ */ e(N, { ...l }), document.body) : /* @__PURE__ */ e("div", {});
143
146
  export {
144
- $ as GroupSelector
147
+ F as GroupSelector
145
148
  };
@@ -4,5 +4,6 @@ declare const config: Meta;
4
4
  declare const Default: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IGroupSelectorProps>;
5
5
  declare const Short: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IGroupSelectorProps>;
6
6
  declare const OrganizationVariant: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IGroupSelectorProps>;
7
+ declare const OrganizationWithItemAction: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IGroupSelectorProps>;
7
8
  export default config;
8
- export { Short, Default, OrganizationVariant };
9
+ export { Short, Default, OrganizationVariant, OrganizationWithItemAction };
@@ -1,4 +1,4 @@
1
1
  import { OptionBoxContainer } from '../styles';
2
2
  import { IOptionProps } from '../types';
3
- declare const OptionContainer: ({ isSelected, label, onSelect, }: Readonly<IOptionProps>) => JSX.Element;
3
+ declare const OptionContainer: ({ isSelected, itemAction, label, onSelect, value, }: Readonly<IOptionProps>) => JSX.Element;
4
4
  export { OptionContainer, OptionBoxContainer };
@@ -1,32 +1,45 @@
1
- import { jsxs as m, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as l, jsx as r } from "react/jsx-runtime";
2
2
  import { useCallback as c } from "react";
3
- import { useTheme as p } from "styled-components";
4
- import { OptionBoxContainer as l } from "../styles.js";
3
+ import { useTheme as f } from "styled-components";
4
+ import { OptionBoxContainer as a } from "../styles.js";
5
+ import { Container as d } from "../../container/index.js";
5
6
  import { Icon as s } from "../../icon/index.js";
7
+ import { ItemAction as h } from "../../list-item/item-action/index.js";
6
8
  import "../../typography/heading/index.js";
7
9
  import "../../typography/span/index.js";
8
- import { Text as f } from "../../typography/text/index.js";
9
- const j = ({
10
- isSelected: i = !1,
11
- label: o,
12
- onSelect: r
10
+ import { Text as C } from "../../typography/text/index.js";
11
+ const T = ({
12
+ isSelected: n = !1,
13
+ itemAction: o,
14
+ label: i,
15
+ onSelect: t,
16
+ value: e
13
17
  }) => {
14
- const t = p(), e = c(() => {
15
- r && r(o);
16
- }, [r, o]);
17
- return /* @__PURE__ */ m(l, { $isSelected: i, onClick: e, children: [
18
- i ? /* @__PURE__ */ n(
19
- s,
20
- {
21
- icon: "check",
22
- iconColor: t.palette.gray[800],
23
- iconSize: "lg"
24
- }
25
- ) : null,
26
- /* @__PURE__ */ n(f, { color: t.palette.gray[800], fontWeight: "bold", size: "md", children: o })
27
- ] });
18
+ const m = f(), p = c(() => {
19
+ t && t(i);
20
+ }, [t, i]);
21
+ return /* @__PURE__ */ l(
22
+ a,
23
+ {
24
+ $hasAction: o !== void 0,
25
+ $isSelected: n,
26
+ onClick: p,
27
+ children: [
28
+ n && o === void 0 ? /* @__PURE__ */ r(
29
+ s,
30
+ {
31
+ icon: "check",
32
+ iconColor: m.palette.gray[800],
33
+ iconSize: "lg"
34
+ }
35
+ ) : null,
36
+ /* @__PURE__ */ r(d, { flexGrow: o === void 0 ? void 0 : 1, children: /* @__PURE__ */ r(C, { color: m.palette.gray[800], fontWeight: "bold", size: "md", children: i }) }),
37
+ o === void 0 ? null : /* @__PURE__ */ r(h, { action: o, value: e })
38
+ ]
39
+ }
40
+ );
28
41
  };
29
42
  export {
30
- l as OptionBoxContainer,
31
- j as OptionContainer
43
+ a as OptionBoxContainer,
44
+ T as OptionContainer
32
45
  };
@@ -3,9 +3,11 @@ declare const StyledGroupContainer: import('styled-components/dist/types').IStyl
3
3
  }, never> & Partial<Pick<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$itemsLength"> & {
4
4
  $itemsLength: number;
5
5
  }, never>>> & string;
6
- declare const OptionBoxContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$isSelected"> & {
6
+ declare const OptionBoxContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$hasAction" | "$isSelected"> & {
7
+ $hasAction?: boolean;
7
8
  $isSelected?: boolean;
8
- }, never> & Partial<Pick<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$isSelected"> & {
9
+ }, never> & Partial<Pick<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$hasAction" | "$isSelected"> & {
10
+ $hasAction?: boolean;
9
11
  $isSelected?: boolean;
10
12
  }, never>>> & string;
11
13
  export { StyledGroupContainer, OptionBoxContainer };
@@ -1,5 +1,5 @@
1
- import { styled as a } from "styled-components";
2
- const o = a.div`
1
+ import { styled as d } from "styled-components";
2
+ const p = d.div`
3
3
  ${({ theme: i, $itemsLength: r }) => `
4
4
  display: flex;
5
5
  background-color: ${i.palette.white};
@@ -18,25 +18,25 @@ const o = a.div`
18
18
  width: 507px;
19
19
  }
20
20
  `}
21
- `, p = a.div`
22
- ${({ theme: i, $isSelected: r }) => `
21
+ `, n = d.div`
22
+ ${({ theme: i, $hasAction: r = !1, $isSelected: a }) => `
23
23
  align-items: center;
24
- background-color: ${r ? i.palette.gray[100] : i.palette.white};
24
+ background-color: ${a ? i.palette.gray[100] : i.palette.white};
25
25
  border: 1px solid ${i.palette.gray[200]};
26
26
  border-radius: ${i.spacing[0.25]};
27
27
  cursor: pointer;
28
28
  display: flex;
29
- flex-direction: ${r ? "row-reverse" : "row"};
29
+ flex-direction: ${a && !r ? "row-reverse" : "row"};
30
30
  min-height: 50px;
31
31
  padding: ${i.spacing[1]} ${i.spacing[0.625]};
32
32
  width: 215px;
33
33
 
34
34
  &:hover {
35
- background-color: ${i.palette.gray[100]};
35
+ background-color: ${i.palette.gray[r ? 50 : 100]};
36
36
  }
37
37
  `}
38
38
  `;
39
39
  export {
40
- p as OptionBoxContainer,
41
- o as StyledGroupContainer
40
+ n as OptionBoxContainer,
41
+ p as StyledGroupContainer
42
42
  };
@@ -1,3 +1,4 @@
1
+ import { IItemAction } from '../list-item/types';
1
2
  type TVariant = "organization-selector";
2
3
  /**
3
4
  * Item handlers.
@@ -5,9 +6,11 @@ type TVariant = "organization-selector";
5
6
  * @property { Function } [handleNewOrganization] - Handle new organization.
6
7
  * @property { Function } [onSelect] - Handle select item.
7
8
  * @property { Function } [onClose] - Handle close.
9
+ * @property { IItemAction } [itemAction] - Action button rendered in every item.
8
10
  */
9
11
  interface IItemHandlers {
10
12
  handleNewOrganization?: () => void;
13
+ itemAction?: IItemAction;
11
14
  onSelect?: (itemName: string) => void;
12
15
  onClose?: () => void;
13
16
  }
@@ -36,9 +39,11 @@ interface IGroupSelectorProps extends IItemHandlers {
36
39
  * @extends IItemHandlers
37
40
  * @property { boolean } [isSelected] - Option is selected.
38
41
  * @property { string } label - Option label.
42
+ * @property { string } value - Option value passed to the item action.
39
43
  */
40
44
  interface IOptionProps extends IItemHandlers {
41
45
  isSelected?: boolean;
42
46
  label: string;
47
+ value: string;
43
48
  }
44
49
  export type { IGroupSelectorProps, IOptionProps, TVariant };
@@ -1,5 +1,5 @@
1
1
  import { ListItemsWrapper } from './styles';
2
2
  import { IListItemProps } from './types';
3
- declare const ListItem: ({ children, disabled, icon, iconType, href, onClick, onClickIcon, onKeyDown, rightIcon, selected, value, ...props }: Readonly<IListItemProps>) => JSX.Element;
3
+ declare const ListItem: ({ children, disabled, icon, iconType, href, itemAction, onClick, onClickIcon, onKeyDown, rightIcon, selected, value, ...props }: Readonly<IListItemProps>) => JSX.Element;
4
4
  export type { IListItemProps };
5
5
  export { ListItem, ListItemsWrapper };
@@ -1,64 +1,84 @@
1
- import { jsxs as f, jsx as i } from "react/jsx-runtime";
2
- import { Children as L, isValidElement as k, cloneElement as I } from "react";
3
- import { useTheme as j } from "styled-components";
1
+ import { jsxs as x, jsx as i } from "react/jsx-runtime";
2
+ import { Children as g, isValidElement as I, cloneElement as L } from "react";
3
+ import { useTheme as k } from "styled-components";
4
+ import { ItemAction as j } from "./item-action/index.js";
4
5
  import { Li as z } from "./styles.js";
5
- import { ListItemsWrapper as F } from "./styles.js";
6
+ import { ListItemsWrapper as J } from "./styles.js";
6
7
  import { Container as E } from "../container/index.js";
7
8
  import { Icon as C } from "../icon/index.js";
8
9
  import { Link as S } from "../link/index.js";
9
- const A = ({
10
- children: n,
10
+ const D = ({
11
+ children: m,
11
12
  disabled: o = !1,
12
- icon: e,
13
- iconType: m = "fa-light",
14
- href: l,
15
- onClick: x,
16
- onClickIcon: h,
17
- onKeyDown: g,
18
- rightIcon: s,
19
- selected: p = !1,
20
- value: r,
21
- ...u
13
+ icon: n,
14
+ iconType: l = "fa-light",
15
+ href: s,
16
+ itemAction: r,
17
+ onClick: h,
18
+ onClickIcon: u,
19
+ onKeyDown: v,
20
+ rightIcon: p,
21
+ selected: a = !1,
22
+ value: t,
23
+ ...d
22
24
  }) => {
23
- const a = j().palette.gray[o ? 300 : 800], c = o ? L.map(n, (t) => k(t) ? I(t, {
25
+ const f = k().palette.gray[o ? 300 : 800], c = o ? g.map(m, (e) => I(e) ? L(e, {
24
26
  disabled: o,
25
- ...t.props
26
- }) : t) : n;
27
- return /* @__PURE__ */ f(
27
+ ...e.props
28
+ }) : e) : m;
29
+ return /* @__PURE__ */ x(
28
30
  z,
29
31
  {
32
+ $hasAction: r !== void 0,
30
33
  "aria-disabled": o,
31
- "aria-label": r,
32
- "aria-selected": p,
33
- "data-testid": r,
34
- onClick: x,
35
- onKeyDown: g,
36
- value: r,
37
- ...u,
34
+ "aria-label": t,
35
+ "aria-selected": a,
36
+ "data-testid": t,
37
+ onClick: h,
38
+ onKeyDown: v,
39
+ value: t,
40
+ ...d,
38
41
  children: [
39
- e !== void 0 || r !== void 0 ? /* @__PURE__ */ f(E, { alignItems: "center", display: "flex", gap: 0.625, children: [
40
- e ? /* @__PURE__ */ i(
41
- C,
42
- {
43
- disabled: o,
44
- icon: e,
45
- iconColor: a,
46
- iconSize: "sm",
47
- iconType: m
48
- }
49
- ) : null,
50
- l === void 0 ? c : /* @__PURE__ */ i(S, { href: l, children: c })
51
- ] }) : null,
52
- p || s ? /* @__PURE__ */ i(
42
+ n !== void 0 || t !== void 0 ? /* @__PURE__ */ x(
43
+ E,
44
+ {
45
+ alignItems: "center",
46
+ display: "flex",
47
+ flexGrow: r === void 0 ? void 0 : 1,
48
+ gap: 0.625,
49
+ children: [
50
+ n ? /* @__PURE__ */ i(
51
+ C,
52
+ {
53
+ disabled: o,
54
+ icon: n,
55
+ iconColor: f,
56
+ iconSize: "sm",
57
+ iconType: l
58
+ }
59
+ ) : null,
60
+ s === void 0 ? c : /* @__PURE__ */ i(S, { href: s, children: c })
61
+ ]
62
+ }
63
+ ) : null,
64
+ r === void 0 ? null : /* @__PURE__ */ i(
65
+ j,
66
+ {
67
+ action: r,
68
+ disabled: o,
69
+ value: t ?? ""
70
+ }
71
+ ),
72
+ r === void 0 && (a || p) ? /* @__PURE__ */ i(
53
73
  C,
54
74
  {
55
75
  disabled: o,
56
- icon: s ?? "check",
76
+ icon: p ?? "check",
57
77
  iconClass: "selected",
58
- iconColor: a,
78
+ iconColor: f,
59
79
  iconSize: "lg",
60
- iconType: m,
61
- onClick: h
80
+ iconType: l,
81
+ onClick: u
62
82
  }
63
83
  ) : null
64
84
  ]
@@ -66,6 +86,6 @@ const A = ({
66
86
  );
67
87
  };
68
88
  export {
69
- A as ListItem,
70
- F as ListItemsWrapper
89
+ D as ListItem,
90
+ J as ListItemsWrapper
71
91
  };
@@ -4,5 +4,6 @@ declare const config: Meta;
4
4
  declare const Default: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, Readonly<IListItemProps>>;
5
5
  declare const WithCheckbox: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, Readonly<IListItemProps>>;
6
6
  declare const WithRadioButton: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, Readonly<IListItemProps>>;
7
+ declare const WithItemAction: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, Readonly<IListItemProps>>;
7
8
  export default config;
8
- export { Default, WithCheckbox, WithRadioButton };
9
+ export { Default, WithCheckbox, WithItemAction, WithRadioButton };
@@ -0,0 +1,3 @@
1
+ import { IItemActionProps } from './types';
2
+ declare const ItemAction: ({ action, disabled, value, }: Readonly<IItemActionProps>) => JSX.Element;
3
+ export { ItemAction };
@@ -0,0 +1,36 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { useCallback as e } from "react";
3
+ import { StyledItemAction as h } from "./styles.js";
4
+ import { Button as d } from "../../button/index.js";
5
+ const g = ({
6
+ action: i,
7
+ disabled: c = !1,
8
+ value: n
9
+ }) => {
10
+ const { icon: s, label: l, onClick: t, showOnHover: a = !0 } = i, m = e(
11
+ (o) => {
12
+ o.stopPropagation(), t(n);
13
+ },
14
+ [t, n]
15
+ ), p = e(
16
+ (o) => {
17
+ o.stopPropagation();
18
+ },
19
+ []
20
+ );
21
+ return /* @__PURE__ */ r(h, { $showOnHover: a, children: /* @__PURE__ */ r(
22
+ d,
23
+ {
24
+ disabled: c,
25
+ icon: s,
26
+ iconSize: "sm",
27
+ onClick: m,
28
+ onKeyDown: p,
29
+ variant: "ghost",
30
+ children: l
31
+ }
32
+ ) });
33
+ };
34
+ export {
35
+ g as ItemAction
36
+ };
@@ -0,0 +1,6 @@
1
+ declare const StyledItemAction: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$showOnHover"> & {
2
+ $showOnHover: boolean;
3
+ }, never> & Partial<Pick<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$showOnHover"> & {
4
+ $showOnHover: boolean;
5
+ }, never>>> & string;
6
+ export { StyledItemAction };
@@ -0,0 +1,17 @@
1
+ import { styled as t } from "styled-components";
2
+ const e = t.span`
3
+ display: inline-flex;
4
+ flex-shrink: 0;
5
+
6
+ ${({ $showOnHover: i }) => i ? `
7
+ opacity: 0;
8
+
9
+ *:hover > &,
10
+ *:focus-within > & {
11
+ opacity: 1;
12
+ }
13
+ ` : ""}
14
+ `;
15
+ export {
16
+ e as StyledItemAction
17
+ };
@@ -0,0 +1,14 @@
1
+ import { IItemAction } from '../types';
2
+ /**
3
+ * Item action component props.
4
+ * @interface IItemActionProps
5
+ * @property { IItemAction } action - The action to render.
6
+ * @property { boolean } [disabled] - Whether the action is disabled.
7
+ * @property { string } value - The item value passed to the action.
8
+ */
9
+ interface IItemActionProps {
10
+ action: IItemAction;
11
+ disabled?: boolean;
12
+ value: string;
13
+ }
14
+ export type { IItemActionProps };
@@ -1,3 +1,7 @@
1
- declare const Li: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, never>>> & string;
1
+ declare const Li: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "$hasAction"> & {
2
+ $hasAction: boolean;
3
+ }, never> & Partial<Pick<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "$hasAction"> & {
4
+ $hasAction: boolean;
5
+ }, never>>> & string;
2
6
  declare const ListItemsWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLUListElement>, HTMLUListElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLUListElement>, HTMLUListElement>, never>>> & string;
3
7
  export { Li, ListItemsWrapper };
@@ -1,6 +1,6 @@
1
- import { styled as r } from "styled-components";
2
- const i = r.li`
3
- ${({ theme: a }) => `
1
+ import { styled as o } from "styled-components";
2
+ const p = o.li`
3
+ ${({ theme: a, $hasAction: r }) => `
4
4
  align-items: center;
5
5
  background-color: ${a.palette.white};
6
6
  color: ${a.palette.gray[800]};
@@ -14,7 +14,7 @@ const i = r.li`
14
14
  list-style-type: none;
15
15
  min-height: 40px;
16
16
  min-width: 240px;
17
- padding: ${a.spacing[0.625]} ${a.spacing[1]};
17
+ padding: ${r ? `6px ${a.spacing[0.5]}` : `${a.spacing[0.625]} ${a.spacing[1]}`};
18
18
 
19
19
  p,
20
20
  a {
@@ -39,14 +39,14 @@ const i = r.li`
39
39
  }
40
40
 
41
41
  &[aria-selected="true"] {
42
- background-color: ${a.palette.gray[200]};
42
+ background-color: ${a.palette.gray[r ? 100 : 200]};
43
43
  }
44
44
 
45
45
  &:hover:not([aria-selected="true"]) {
46
- background-color: ${a.palette.gray[100]};
46
+ background-color: ${a.palette.gray[r ? 50 : 100]};
47
47
  }
48
48
  `}
49
- `, t = r.ul`
49
+ `, l = o.ul`
50
50
  ${({ theme: a }) => `
51
51
  background-color: ${a.palette.white};
52
52
  border: 1px solid ${a.palette.gray[200]};
@@ -59,6 +59,6 @@ const i = r.li`
59
59
  `}
60
60
  `;
61
61
  export {
62
- i as Li,
63
- t as ListItemsWrapper
62
+ p as Li,
63
+ l as ListItemsWrapper
64
64
  };
@@ -11,6 +11,20 @@ interface ILabelProps {
11
11
  color: string;
12
12
  href?: string;
13
13
  }
14
+ /**
15
+ * Item action props.
16
+ * @interface IItemAction
17
+ * @property { IIconModifiable["icon"] } icon - The icon of the action button.
18
+ * @property { string } label - The label of the action button.
19
+ * @property { Function } onClick - The function to call with the item value when the action is clicked.
20
+ * @property { boolean } [showOnHover] - Whether the action shows only while the item is hovered or focused.
21
+ */
22
+ interface IItemAction {
23
+ icon: IIconModifiable["icon"];
24
+ label: string;
25
+ onClick: (value: string) => void;
26
+ showOnHover?: boolean;
27
+ }
14
28
  /**
15
29
  * List item component props.
16
30
  * @interface IListItemProps
@@ -22,6 +36,7 @@ interface ILabelProps {
22
36
  * @property { string } [value] - The value for the list item.
23
37
  * @property { IIconModifiable["icon"] } [rightIcon] - The icon for the right side of the list item.
24
38
  * @property { IIconProps["onClick"] } [onClickIcon] - The function to call when the icon on the left side is clicked.
39
+ * @property { IItemAction } [itemAction] - The action button on the right side of the list item. When set, `rightIcon` and the selected check are not rendered.
25
40
  */
26
41
  interface IListItemProps extends Partial<Pick<IIconModifiable, "icon" | "iconType">>, HTMLAttributes<HTMLLIElement>, HTMLProps<HTMLLIElement> {
27
42
  href?: string;
@@ -29,5 +44,6 @@ interface IListItemProps extends Partial<Pick<IIconModifiable, "icon" | "iconTyp
29
44
  value?: string;
30
45
  rightIcon?: IIconModifiable["icon"];
31
46
  onClickIcon?: IIconProps["onClick"];
47
+ itemAction?: IItemAction;
32
48
  }
33
- export type { IListItemProps, ILabelProps };
49
+ export type { IItemAction, IListItemProps, ILabelProps };
@@ -4,6 +4,7 @@ import { useTheme as x } from "styled-components";
4
4
  import { Container as t } from "../container/index.js";
5
5
  import { Divider as s } from "../divider/index.js";
6
6
  import "react";
7
+ import "../button/index.js";
7
8
  import { ListItemsWrapper as y } from "../list-item/styles.js";
8
9
  import "../icon/index.js";
9
10
  import { Tag as v } from "../tag/index.js";
@@ -11,7 +12,7 @@ import "../typography/heading/index.js";
11
12
  import "../typography/span/index.js";
12
13
  import { Text as o } from "../typography/text/index.js";
13
14
  import { useClickOutside as z } from "../../hooks/use-click-outside.js";
14
- const I = ({
15
+ const M = ({
15
16
  children: a,
16
17
  commitShortSha: l,
17
18
  parentElement: d,
@@ -56,5 +57,5 @@ const I = ({
56
57
  ] });
57
58
  };
58
59
  export {
59
- I as Menu
60
+ M as Menu
60
61
  };
@@ -6,5 +6,5 @@ declare const StyledReorderItem: import('styled-components/dist/types').IStyledC
6
6
  ref?: ((instance: HTMLLIElement | null) => void | import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import('react').RefObject<HTMLLIElement> | null | undefined;
7
7
  }, "$isDragging"> & {
8
8
  $isDragging?: boolean;
9
- }, never>>> & string & Omit<({ children, disabled, icon, iconType, href, onClick, onClickIcon, onKeyDown, rightIcon, selected, value, ...props }: Readonly<import('../../../list-item').IListItemProps>) => JSX.Element, keyof import('react').Component<any, {}, any>>;
9
+ }, never>>> & string & Omit<({ children, disabled, icon, iconType, href, itemAction, onClick, onClickIcon, onKeyDown, rightIcon, selected, value, ...props }: Readonly<import('../../../list-item').IListItemProps>) => JSX.Element, keyof import('react').Component<any, {}, any>>;
10
10
  export { StyledReorderItem };
@@ -2,5 +2,5 @@ declare const StyledList: import('styled-components/dist/types').IStyledComponen
2
2
  ref?: ((instance: HTMLLIElement | null) => void | import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import('react').RefObject<HTMLLIElement> | null | undefined;
3
3
  }, never> & Partial<Pick<Omit<Readonly<import('../../../list-item').IListItemProps>, "ref"> & {
4
4
  ref?: ((instance: HTMLLIElement | null) => void | import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import('react').RefObject<HTMLLIElement> | null | undefined;
5
- }, never>>> & string & Omit<({ children, disabled, icon, iconType, href, onClick, onClickIcon, onKeyDown, rightIcon, selected, value, ...props }: Readonly<import('../../../list-item').IListItemProps>) => JSX.Element, keyof import('react').Component<any, {}, any>>;
5
+ }, never>>> & string & Omit<({ children, disabled, icon, iconType, href, itemAction, onClick, onClickIcon, onKeyDown, rightIcon, selected, value, ...props }: Readonly<import('../../../list-item').IListItemProps>) => JSX.Element, keyof import('react').Component<any, {}, any>>;
6
6
  export { StyledList };
@@ -1,11 +1,11 @@
1
1
  import E, { useMemo as J, useCallback as Q, useRef as N, useState as nt, useEffect as F, isValidElement as dt, cloneElement as ht } from "react";
2
2
  import { useMemoDeepCompare as $t, usePrevious as xt, useMount as Ut, useUpdateEffect as Mt, useWindowSize as jt } from "../../@gilbarbara/hooks/dist/index.js";
3
- import { s as Ht } from "../../../_virtual/index.js";
3
+ import { s as Ht } from "../../../_virtual/index2.js";
4
4
  import z from "../../is-lite/dist/index.js";
5
- import ut from "../../../_virtual/index2.js";
6
- import Yt from "../../../_virtual/index3.js";
5
+ import ut from "../../../_virtual/index3.js";
6
+ import Yt from "../../../_virtual/index4.js";
7
7
  import It from "../../@gilbarbara/deep-equal/dist/index.js";
8
- import zt from "../../../_virtual/index4.js";
8
+ import zt from "../../../_virtual/index5.js";
9
9
  import Nt from "../../../_virtual/scrollparent.js";
10
10
  import { createPortal as Wt } from "react-dom";
11
11
  import { offset as yt, shift as Kt, arrow as Gt, useFloating as Et, autoPlacement as Vt, flip as Jt } from "../../@floating-ui/react-dom/dist/floating-ui.react-dom.js";
@@ -1,4 +1,4 @@
1
- import { __module as r } from "../../../_virtual/index5.js";
1
+ import { __module as r } from "../../../_virtual/index.js";
2
2
  import { __require as o } from "../cjs/use-sync-external-store-shim.production.js";
3
3
  import { __require as i } from "../cjs/use-sync-external-store-shim.development.js";
4
4
  var e;
package/package.json CHANGED
@@ -135,5 +135,5 @@
135
135
  "./dist/index.js"
136
136
  ],
137
137
  "typings": "./dist/index.d.ts",
138
- "version": "9.7.2"
138
+ "version": "9.8.0"
139
139
  }