@fluidattacks/design 9.7.2 → 9.9.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.
- package/dist/components/card/card-with-input/index.js +3 -2
- package/dist/components/drawer/index.js +77 -73
- package/dist/components/drawer/types.d.ts +2 -0
- package/dist/components/filters/filters-menu/index.js +24 -23
- package/dist/components/filters/index.d.ts +2 -2
- package/dist/components/filters/options-menu/index.js +21 -21
- package/dist/components/filters/options-menu/options/index.js +3 -2
- package/dist/components/filters/types.d.ts +2 -0
- package/dist/components/group-selector/index.js +44 -41
- package/dist/components/group-selector/index.stories.d.ts +2 -1
- package/dist/components/group-selector/option-container/index.d.ts +1 -1
- package/dist/components/group-selector/option-container/index.js +37 -24
- package/dist/components/group-selector/styles.d.ts +4 -2
- package/dist/components/group-selector/styles.js +9 -9
- package/dist/components/group-selector/types.d.ts +5 -0
- package/dist/components/list-item/index.d.ts +1 -1
- package/dist/components/list-item/index.js +67 -47
- package/dist/components/list-item/index.stories.d.ts +2 -1
- package/dist/components/list-item/item-action/index.d.ts +3 -0
- package/dist/components/list-item/item-action/index.js +36 -0
- package/dist/components/list-item/item-action/styles.d.ts +6 -0
- package/dist/components/list-item/item-action/styles.js +17 -0
- package/dist/components/list-item/item-action/types.d.ts +14 -0
- package/dist/components/list-item/styles.d.ts +5 -1
- package/dist/components/list-item/styles.js +10 -10
- package/dist/components/list-item/types.d.ts +17 -1
- package/dist/components/menu/index.js +3 -2
- package/dist/components/modal/columns-modal/preview-panel/styles.d.ts +1 -1
- package/dist/components/modal/columns-modal/search-panel/styles.d.ts +1 -1
- package/dist/components/slider/index.js +3 -2
- package/package.json +1 -1
|
@@ -1,43 +1,44 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { useTheme as
|
|
5
|
-
import { OptionContainer as
|
|
6
|
-
import { StyledGroupContainer as
|
|
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
|
|
9
|
-
import { Icon as
|
|
10
|
-
import { IconButton as
|
|
11
|
-
import { Search as
|
|
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,
|
|
15
|
+
const c = 100, N = ({
|
|
16
16
|
items: t,
|
|
17
17
|
handleNewOrganization: l,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
itemAction: d,
|
|
19
|
+
onSelect: g,
|
|
20
|
+
onClose: u,
|
|
21
|
+
selectedItem: f,
|
|
22
|
+
title: C,
|
|
23
|
+
variant: x
|
|
23
24
|
}) => {
|
|
24
|
-
const n =
|
|
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
|
-
),
|
|
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 (!
|
|
36
|
-
const r =
|
|
36
|
+
if (!a) return [...t];
|
|
37
|
+
const r = a.toLowerCase();
|
|
37
38
|
return t.filter(
|
|
38
|
-
(
|
|
39
|
+
(w) => String(w.name).toLowerCase().includes(r)
|
|
39
40
|
);
|
|
40
|
-
}, [t,
|
|
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__ */
|
|
59
|
-
/* @__PURE__ */
|
|
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:
|
|
73
|
+
children: C
|
|
73
74
|
}
|
|
74
75
|
),
|
|
75
76
|
/* @__PURE__ */ e(
|
|
76
|
-
|
|
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:
|
|
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
|
-
|
|
91
|
+
H,
|
|
91
92
|
{
|
|
92
93
|
maxLength: c,
|
|
93
|
-
onChange:
|
|
94
|
-
onInput:
|
|
94
|
+
onChange: S,
|
|
95
|
+
onInput: y,
|
|
95
96
|
placeholder: "Search",
|
|
96
|
-
value:
|
|
97
|
+
value: a
|
|
97
98
|
}
|
|
98
99
|
) }),
|
|
99
|
-
/* @__PURE__ */ e(
|
|
100
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
110
|
+
x === "organization-selector" ? /* @__PURE__ */ e(j, { onClick: l, children: /* @__PURE__ */ i(o, { alignItems: "center", display: "flex", children: [
|
|
110
111
|
/* @__PURE__ */ e(
|
|
111
|
-
|
|
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
|
-
|
|
124
|
+
L,
|
|
124
125
|
{
|
|
125
|
-
isSelected:
|
|
126
|
+
isSelected: f.toLowerCase() === r.name,
|
|
127
|
+
itemAction: d,
|
|
126
128
|
label: r.name.charAt(0).toUpperCase() + r.name.slice(1),
|
|
127
|
-
onSelect:
|
|
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 ?
|
|
145
|
+
}) => t ? I(/* @__PURE__ */ e(N, { ...l }), document.body) : /* @__PURE__ */ e("div", {});
|
|
143
146
|
export {
|
|
144
|
-
|
|
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
|
|
1
|
+
import { jsxs as l, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback as c } from "react";
|
|
3
|
-
import { useTheme as
|
|
4
|
-
import { OptionBoxContainer as
|
|
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
|
|
9
|
-
const
|
|
10
|
-
isSelected:
|
|
11
|
-
|
|
12
|
-
|
|
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
|
|
15
|
-
|
|
16
|
-
}, [
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
31
|
-
|
|
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
|
|
2
|
-
const
|
|
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
|
-
`,
|
|
22
|
-
${({ theme: i, $
|
|
21
|
+
`, n = d.div`
|
|
22
|
+
${({ theme: i, $hasAction: r = !1, $isSelected: a }) => `
|
|
23
23
|
align-items: center;
|
|
24
|
-
background-color: ${
|
|
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
|
-
|
|
41
|
-
|
|
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
|
|
2
|
-
import { Children as
|
|
3
|
-
import { useTheme as
|
|
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
|
|
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
|
|
10
|
-
children:
|
|
10
|
+
const D = ({
|
|
11
|
+
children: m,
|
|
11
12
|
disabled: o = !1,
|
|
12
|
-
icon:
|
|
13
|
-
iconType:
|
|
14
|
-
href:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
25
|
+
const f = k().palette.gray[o ? 300 : 800], c = o ? g.map(m, (e) => I(e) ? L(e, {
|
|
24
26
|
disabled: o,
|
|
25
|
-
...
|
|
26
|
-
}) :
|
|
27
|
-
return /* @__PURE__ */
|
|
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":
|
|
32
|
-
"aria-selected":
|
|
33
|
-
"data-testid":
|
|
34
|
-
onClick:
|
|
35
|
-
onKeyDown:
|
|
36
|
-
value:
|
|
37
|
-
...
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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:
|
|
76
|
+
icon: p ?? "check",
|
|
57
77
|
iconClass: "selected",
|
|
58
|
-
iconColor:
|
|
78
|
+
iconColor: f,
|
|
59
79
|
iconSize: "lg",
|
|
60
|
-
iconType:
|
|
61
|
-
onClick:
|
|
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
|
-
|
|
70
|
-
|
|
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,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('
|
|
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
|
|
2
|
-
const
|
|
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
|
-
&:hover:not([aria-selected="true"]) {
|
|
46
|
-
background-color: ${a.palette.gray[100]};
|
|
45
|
+
&:hover${r ? "" : ':not([aria-selected="true"])'} {
|
|
46
|
+
background-color: ${a.palette.gray[r ? 50 : 100]};
|
|
47
47
|
}
|
|
48
48
|
`}
|
|
49
|
-
`,
|
|
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
|
-
|
|
63
|
-
|
|
62
|
+
p as Li,
|
|
63
|
+
l as ListItemsWrapper
|
|
64
64
|
};
|