@fluidattacks/design 11.11.0 → 11.12.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 +2 -3
- package/dist/components/filters/filters-menu/index.js +23 -24
- package/dist/components/filters/options-menu/options/index.js +2 -3
- package/dist/components/inputs/fields/combobox/field/index.js +230 -225
- package/dist/components/inputs/fields/combobox/index.stories.d.ts +3 -1
- package/dist/components/inputs/fields/combobox/option/index.d.ts +1 -1
- package/dist/components/inputs/fields/combobox/option/index.js +103 -87
- package/dist/components/inputs/fields/combobox/styles.d.ts +9 -8
- package/dist/components/inputs/fields/combobox/styles.js +84 -64
- package/dist/components/inputs/fields/combobox/types.d.ts +8 -3
- package/dist/components/inputs/fields/month/index.js +20 -20
- package/dist/components/inputs/fields/month/panel.js +0 -2
- package/dist/components/inputs/fields/month/styles.d.ts +2 -1
- package/dist/components/inputs/fields/month/styles.js +21 -16
- package/dist/components/slider/index.js +2 -3
- package/package.json +1 -1
|
@@ -2,6 +2,8 @@ import { Meta } from '@storybook/react-vite';
|
|
|
2
2
|
import { IComboBoxProps } from '.';
|
|
3
3
|
declare const config: Meta;
|
|
4
4
|
declare const Default: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IComboBoxProps>;
|
|
5
|
+
declare const optionStates: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IComboBoxProps>;
|
|
6
|
+
declare const disabledMultiSelect: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IComboBoxProps>;
|
|
5
7
|
declare const multiSelectWithAll: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IComboBoxProps>;
|
|
6
8
|
declare const withEmptyMessage: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IComboBoxProps>;
|
|
7
9
|
declare const withStatusMessage: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IComboBoxProps>;
|
|
@@ -11,5 +13,5 @@ declare const narrowMultiSelect: import('storybook/internal/csf').AnnotatedStory
|
|
|
11
13
|
declare const countLabelMultiSelect: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IComboBoxProps>;
|
|
12
14
|
declare const whiteOptionsMultiSelect: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IComboBoxProps>;
|
|
13
15
|
declare const preselectedMultiSelect: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IComboBoxProps>;
|
|
14
|
-
export { countLabelMultiSelect, Default, multiSelectWithAll, withEmptyMessage, withStatusMessage, withClearButton, groupedMultiSelect, narrowMultiSelect, preselectedMultiSelect, whiteOptionsMultiSelect, };
|
|
16
|
+
export { countLabelMultiSelect, Default, disabledMultiSelect, multiSelectWithAll, optionStates, withEmptyMessage, withStatusMessage, withClearButton, groupedMultiSelect, narrowMultiSelect, preselectedMultiSelect, whiteOptionsMultiSelect, };
|
|
15
17
|
export default config;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IOptionProps } from '../types';
|
|
2
|
-
declare const Option: <T extends object>({ allItemKeys, containerRef, countLabel, item, multiSelection, name, popoverRef, setInputValue, setValue, state, tag, watch, }: Readonly<IOptionProps<T>>) => JSX.Element;
|
|
2
|
+
declare const Option: <T extends object>({ allItemKeys, containerRef, countLabel, icon, item, multiSelection, name, popoverRef, setInputValue, setValue, state, tag, watch, }: Readonly<IOptionProps<T>>) => JSX.Element;
|
|
3
3
|
export { Option };
|
|
@@ -1,137 +1,153 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { useOption as
|
|
4
|
-
import { useTheme as
|
|
5
|
-
import { StyledOption as
|
|
6
|
-
import { describeSelection as
|
|
7
|
-
import { Checkbox as
|
|
8
|
-
import { Icon as
|
|
9
|
-
import { Link as
|
|
10
|
-
import { Tag as
|
|
1
|
+
import { jsxs as D, Fragment as X, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as Y, useMemo as f, useCallback as k } from "react";
|
|
3
|
+
import { useOption as Z } from "../../../../../node_modules/react-aria/dist/private/listbox/useOption.js";
|
|
4
|
+
import { useTheme as _ } from "styled-components";
|
|
5
|
+
import { StyledOption as I } from "../styles.js";
|
|
6
|
+
import { describeSelection as V, toSelection as F } from "../utils.js";
|
|
7
|
+
import { Checkbox as w } from "../../../../checkbox/index.js";
|
|
8
|
+
import { Icon as N } from "../../../../icon/index.js";
|
|
9
|
+
import { Link as oo } from "../../../../link/index.js";
|
|
10
|
+
import { Tag as eo } from "../../../../tag/index.js";
|
|
11
11
|
import "../../../../typography/heading/index.js";
|
|
12
12
|
import "../../../../typography/span/index.js";
|
|
13
|
-
import { Text as
|
|
14
|
-
import { useClickOutside as
|
|
15
|
-
import { openUrl as
|
|
16
|
-
const
|
|
17
|
-
allItemKeys:
|
|
18
|
-
containerRef:
|
|
19
|
-
countLabel:
|
|
13
|
+
import { Text as ro } from "../../../../typography/text/index.js";
|
|
14
|
+
import { useClickOutside as to } from "../../../../../hooks/use-click-outside.js";
|
|
15
|
+
import { openUrl as io } from "../../../../../utils/open-url.js";
|
|
16
|
+
const bo = ({
|
|
17
|
+
allItemKeys: g,
|
|
18
|
+
containerRef: q,
|
|
19
|
+
countLabel: O,
|
|
20
|
+
icon: $,
|
|
20
21
|
item: o,
|
|
21
22
|
multiSelection: s,
|
|
22
23
|
name: e,
|
|
23
|
-
popoverRef:
|
|
24
|
-
setInputValue:
|
|
25
|
-
setValue:
|
|
26
|
-
state:
|
|
27
|
-
tag:
|
|
24
|
+
popoverRef: B,
|
|
25
|
+
setInputValue: c,
|
|
26
|
+
setValue: t,
|
|
27
|
+
state: i,
|
|
28
|
+
tag: A,
|
|
28
29
|
watch: h
|
|
29
30
|
}) => {
|
|
30
|
-
const
|
|
31
|
-
(r) => !Array.from(
|
|
32
|
-
), { optionProps:
|
|
31
|
+
const K = _(), b = Y(null), d = o.props.hrefLang, y = i.disabledKeys, m = g.filter(
|
|
32
|
+
(r) => !Array.from(y).includes(r) && r !== "All"
|
|
33
|
+
), { optionProps: M, isSelected: v, isFocused: P, isDisabled: p } = Z(
|
|
33
34
|
{ key: o.key },
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
),
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
].join(" "),
|
|
35
|
+
i,
|
|
36
|
+
b
|
|
37
|
+
), x = f(() => i.collection.getItem("All")?.rendered?.toString(), [i.collection]), R = [
|
|
38
|
+
v ? "selected" : "",
|
|
39
|
+
P ? "focused" : "",
|
|
40
|
+
p ? "disabled" : ""
|
|
41
|
+
].join(" "), S = k(
|
|
41
42
|
(r) => {
|
|
42
|
-
const { allSelected:
|
|
43
|
+
const { allSelected: l, text: a } = V(
|
|
43
44
|
r,
|
|
44
|
-
a,
|
|
45
45
|
g,
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
y,
|
|
47
|
+
x,
|
|
48
|
+
O
|
|
48
49
|
);
|
|
49
|
-
|
|
50
|
+
t?.(`${e}CheckAll`, l ? a : ""), c(a);
|
|
50
51
|
},
|
|
51
52
|
[
|
|
52
|
-
a,
|
|
53
|
-
b,
|
|
54
|
-
$,
|
|
55
53
|
g,
|
|
54
|
+
x,
|
|
55
|
+
O,
|
|
56
|
+
y,
|
|
56
57
|
e,
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
c,
|
|
59
|
+
t
|
|
59
60
|
]
|
|
60
|
-
),
|
|
61
|
+
), U = k(
|
|
61
62
|
(r) => {
|
|
62
63
|
if (r.target.checked) {
|
|
63
|
-
const
|
|
64
|
-
|
|
64
|
+
const l = [...m].sort();
|
|
65
|
+
t?.(`${e}Options`, l), t?.(`${e}CheckAll`, r.target.value), c(r.target.value);
|
|
65
66
|
} else
|
|
66
|
-
|
|
67
|
+
t?.(`${e}Options`, []), t?.(`${e}CheckAll`, ""), c("");
|
|
67
68
|
},
|
|
68
|
-
[
|
|
69
|
-
),
|
|
69
|
+
[m, e, c, t]
|
|
70
|
+
), E = k(
|
|
70
71
|
(r) => {
|
|
71
|
-
const
|
|
72
|
-
|
|
72
|
+
const l = r.target.value, a = F(h?.(`${e}Options`)), z = r.target.checked ? [...a, l] : a.filter((W) => W !== l);
|
|
73
|
+
t?.(`${e}Options`, z), S(z);
|
|
73
74
|
},
|
|
74
|
-
[e,
|
|
75
|
-
),
|
|
76
|
-
() => u
|
|
77
|
-
[
|
|
78
|
-
),
|
|
79
|
-
() =>
|
|
80
|
-
[
|
|
81
|
-
),
|
|
82
|
-
|
|
75
|
+
[e, t, h, S]
|
|
76
|
+
), u = h?.(`${e}Options`), L = f(
|
|
77
|
+
() => F(u),
|
|
78
|
+
[u]
|
|
79
|
+
), G = f(
|
|
80
|
+
() => L.includes(o.key.toString()),
|
|
81
|
+
[L, o.key]
|
|
82
|
+
), T = h?.(`${e}CheckAll`), H = f(() => !!T, [T]), C = /* @__PURE__ */ D(X, { children: [
|
|
83
|
+
$ === void 0 ? void 0 : /* @__PURE__ */ n(
|
|
84
|
+
N,
|
|
85
|
+
{
|
|
86
|
+
icon: $,
|
|
87
|
+
iconSize: "lg",
|
|
88
|
+
iconType: "fa-light",
|
|
89
|
+
spanClass: "option-icon"
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ n("span", { className: "option-name", children: o.rendered })
|
|
93
|
+
] }), J = o.key === "All" ? /* @__PURE__ */ n(
|
|
94
|
+
w,
|
|
83
95
|
{
|
|
84
|
-
checked:
|
|
85
|
-
|
|
96
|
+
checked: H,
|
|
97
|
+
"data-testid": o.textValue,
|
|
98
|
+
disabled: p,
|
|
99
|
+
label: C,
|
|
86
100
|
name: `${e}CheckAll`,
|
|
87
|
-
onChange:
|
|
101
|
+
onChange: U,
|
|
88
102
|
value: o.rendered?.toString()
|
|
89
103
|
}
|
|
90
|
-
) : /* @__PURE__ */
|
|
91
|
-
|
|
104
|
+
) : /* @__PURE__ */ n(
|
|
105
|
+
w,
|
|
92
106
|
{
|
|
93
|
-
checked:
|
|
94
|
-
|
|
107
|
+
checked: G,
|
|
108
|
+
"data-testid": o.textValue,
|
|
109
|
+
disabled: p,
|
|
110
|
+
label: C,
|
|
95
111
|
name: `${e}Options`,
|
|
96
|
-
onChange:
|
|
112
|
+
onChange: E,
|
|
97
113
|
value: o.key.toString()
|
|
98
114
|
}
|
|
99
|
-
),
|
|
100
|
-
|
|
115
|
+
), j = s ? J : /* @__PURE__ */ n(
|
|
116
|
+
ro,
|
|
101
117
|
{
|
|
102
|
-
color:
|
|
118
|
+
color: K.palette.gray[800],
|
|
103
119
|
size: "md",
|
|
104
120
|
textOverflow: "ellipsis",
|
|
105
121
|
whiteSpace: "nowrap",
|
|
106
|
-
children:
|
|
122
|
+
children: C
|
|
107
123
|
}
|
|
108
|
-
),
|
|
124
|
+
), Q = k(
|
|
109
125
|
(r) => {
|
|
110
|
-
r.preventDefault(),
|
|
111
|
-
|
|
112
|
-
}),
|
|
126
|
+
r.preventDefault(), c(o.rendered?.toString() ?? ""), i.setSelectedKey(o.key), requestAnimationFrame(() => {
|
|
127
|
+
i.setOpen(!1);
|
|
128
|
+
}), io(d);
|
|
113
129
|
},
|
|
114
|
-
[d, o.key, o.rendered,
|
|
130
|
+
[d, o.key, o.rendered, i, c]
|
|
115
131
|
);
|
|
116
|
-
return
|
|
117
|
-
s &&
|
|
118
|
-
}, [
|
|
119
|
-
|
|
132
|
+
return to(B, () => {
|
|
133
|
+
s && i.close();
|
|
134
|
+
}, [q]), /* @__PURE__ */ D(
|
|
135
|
+
I,
|
|
120
136
|
{
|
|
121
|
-
...!s && !d ?
|
|
137
|
+
...!s && !d ? M : {},
|
|
122
138
|
$multiSelection: s,
|
|
123
|
-
className:
|
|
139
|
+
className: R,
|
|
124
140
|
"data-testid": `${e}-option-${o.key}`,
|
|
125
|
-
ref:
|
|
141
|
+
ref: b,
|
|
126
142
|
title: o.textValue,
|
|
127
143
|
children: [
|
|
128
|
-
d ? /* @__PURE__ */
|
|
129
|
-
|
|
130
|
-
|
|
144
|
+
d && !p ? /* @__PURE__ */ n(oo, { href: d, onClick: Q, children: j }) : j,
|
|
145
|
+
v && !p && !s ? /* @__PURE__ */ n(N, { icon: "check", iconSize: "sm", iconType: "fa-light" }) : void 0,
|
|
146
|
+
A === void 0 ? void 0 : /* @__PURE__ */ n(eo, { tagLabel: A, variant: "inactive" })
|
|
131
147
|
]
|
|
132
148
|
}
|
|
133
149
|
);
|
|
134
150
|
};
|
|
135
151
|
export {
|
|
136
|
-
|
|
152
|
+
bo as Option
|
|
137
153
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
$hasStatus: boolean;
|
|
3
|
-
$multiSelection: boolean;
|
|
1
|
+
declare const StyledMenu: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$width"> & {
|
|
4
2
|
$width: number;
|
|
5
|
-
}, never> & Partial<Pick<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<
|
|
6
|
-
$hasStatus: boolean;
|
|
7
|
-
$multiSelection: boolean;
|
|
3
|
+
}, never> & Partial<Pick<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$width"> & {
|
|
8
4
|
$width: number;
|
|
9
5
|
}, never>>> & string;
|
|
6
|
+
declare const StyledDropdown: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "$multiSelection"> & {
|
|
7
|
+
$multiSelection: boolean;
|
|
8
|
+
}, never> & Partial<Pick<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "$multiSelection"> & {
|
|
9
|
+
$multiSelection: boolean;
|
|
10
|
+
}, never>>> & string;
|
|
10
11
|
declare const StyledOption: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "$multiSelection"> & {
|
|
11
12
|
$multiSelection: boolean;
|
|
12
13
|
}, never> & Partial<Pick<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "$multiSelection"> & {
|
|
@@ -73,5 +74,5 @@ declare const ChevronIconButton: import('styled-components/dist/types').IStyledC
|
|
|
73
74
|
forwardedAs?: import('styled-components').WebTarget | undefined;
|
|
74
75
|
}, never>>> & string;
|
|
75
76
|
declare const StyledGroupHeader: 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;
|
|
76
|
-
declare const StyledStatusMessage: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').
|
|
77
|
-
export { StyledDropdown, StyledOption, StyledEmptyMessage, StyledGroupHeader, StyledStatusMessage, ChevronIconButton, };
|
|
77
|
+
declare const StyledStatusMessage: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
78
|
+
export { StyledDropdown, StyledMenu, StyledOption, StyledEmptyMessage, StyledGroupHeader, StyledStatusMessage, ChevronIconButton, };
|
|
@@ -1,41 +1,45 @@
|
|
|
1
|
-
import { styled as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { styled as n } from "styled-components";
|
|
2
|
+
import { LabelText as i } from "../../../checkbox/styles.js";
|
|
3
|
+
import { StyledIconButton as p } from "../../../icon-button/styles.js";
|
|
4
|
+
const s = n.div`
|
|
5
|
+
${({ theme: o, $width: a }) => `
|
|
5
6
|
align-self: center;
|
|
6
|
-
background: ${
|
|
7
|
-
border: 1px solid ${
|
|
8
|
-
border-radius: ${
|
|
9
|
-
box-shadow: ${
|
|
7
|
+
background: ${o.palette.white};
|
|
8
|
+
border: 1px solid ${o.palette.gray[200]};
|
|
9
|
+
border-radius: ${o.spacing[0.5]};
|
|
10
|
+
box-shadow: ${o.shadows.md};
|
|
11
|
+
min-width: ${a < 240 ? a : 240}px;
|
|
12
|
+
padding: ${o.spacing[0.25]} 0;
|
|
13
|
+
width: 95%;
|
|
14
|
+
`}
|
|
15
|
+
`, d = n.ul`
|
|
16
|
+
${({ theme: o, $multiSelection: a }) => `
|
|
10
17
|
list-style: none;
|
|
11
18
|
max-height: 200px;
|
|
12
|
-
min-width: ${i < 240 ? i : 240}px;
|
|
13
19
|
overflow: hidden auto;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
scroll-padding: ${a.spacing[0.5]};
|
|
17
|
-
width: 95%;
|
|
20
|
+
scrollbar-color: ${o.palette.gray[600]} ${o.palette.gray[100]};
|
|
21
|
+
scroll-padding: ${o.spacing[0.5]};
|
|
18
22
|
|
|
19
23
|
> li:first-child {
|
|
20
|
-
border-bottom: ${
|
|
24
|
+
border-bottom: ${a ? `1px solid ${o.palette.gray[200]}` : "unset"};
|
|
21
25
|
}
|
|
22
26
|
`}
|
|
23
|
-
`,
|
|
24
|
-
${({ theme:
|
|
27
|
+
`, c = n.li`
|
|
28
|
+
${({ theme: o, $multiSelection: a }) => `
|
|
25
29
|
align-items: center;
|
|
26
|
-
background: ${
|
|
27
|
-
color: ${
|
|
30
|
+
background: ${o.palette.white};
|
|
31
|
+
color: ${o.palette.gray[800]};
|
|
28
32
|
cursor: pointer;
|
|
29
33
|
display: flex;
|
|
30
|
-
gap: ${
|
|
34
|
+
gap: ${o.spacing[0.5]};
|
|
31
35
|
justify-content: space-between;
|
|
32
|
-
line-height: ${
|
|
33
|
-
padding: ${
|
|
36
|
+
line-height: ${o.spacing[1.25]};
|
|
37
|
+
padding: ${a ? `${o.spacing[0.125]} ${o.spacing[0.75]}` : `${o.spacing[0.25]} ${o.spacing[1]}`};
|
|
34
38
|
|
|
35
39
|
a, p, label {
|
|
36
40
|
display: inline-flex;
|
|
37
41
|
overflow: hidden;
|
|
38
|
-
padding: ${
|
|
42
|
+
padding: ${a ? o.spacing[0.25] : "0"};
|
|
39
43
|
width: 100%;
|
|
40
44
|
}
|
|
41
45
|
|
|
@@ -50,44 +54,56 @@ const t = o.ul`
|
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
span {
|
|
53
|
-
color: ${
|
|
57
|
+
color: ${o.palette.gray[700]};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.option-icon {
|
|
61
|
+
color: ${o.palette.gray[800]};
|
|
62
|
+
margin-right: ${o.spacing[0.5]};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.option-name {
|
|
66
|
+
color: ${o.palette.gray[800]};
|
|
54
67
|
}
|
|
55
68
|
|
|
56
69
|
&:hover:not(.disabled, .selected) {
|
|
57
|
-
background: ${
|
|
70
|
+
background: ${o.palette.gray[50]};
|
|
58
71
|
}
|
|
59
72
|
|
|
60
73
|
&.selected {
|
|
61
|
-
background: ${
|
|
74
|
+
background: ${a ? o.palette.white : o.palette.gray[100]};
|
|
62
75
|
}
|
|
63
76
|
|
|
64
77
|
&.disabled {
|
|
65
|
-
background: ${a.palette.gray[100]};
|
|
66
78
|
cursor: not-allowed;
|
|
67
79
|
|
|
68
|
-
|
|
69
|
-
|
|
80
|
+
input:disabled ~ ${i} {
|
|
81
|
+
opacity: 1;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.option-icon {
|
|
85
|
+
opacity: 0.4;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.option-name {
|
|
89
|
+
color: ${o.palette.gray[600]};
|
|
90
|
+
opacity: 0.5;
|
|
70
91
|
}
|
|
71
92
|
}
|
|
72
93
|
`}
|
|
73
|
-
`,
|
|
74
|
-
${({ theme:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
gap: ${a.spacing[0.5]};
|
|
79
|
-
justify-content: space-between;
|
|
80
|
-
line-height: ${a.spacing[1.25]};
|
|
81
|
-
padding: ${a.spacing[0.25]} ${a.spacing[1]};
|
|
82
|
-
size: 28;
|
|
94
|
+
`, g = n.li`
|
|
95
|
+
${({ theme: o }) => `
|
|
96
|
+
line-height: ${o.spacing[1.25]};
|
|
97
|
+
padding: ${o.spacing[1]};
|
|
98
|
+
text-align: center;
|
|
83
99
|
`}
|
|
84
|
-
`,
|
|
85
|
-
${({ disabled:
|
|
100
|
+
`, e = n(p)`
|
|
101
|
+
${({ disabled: o, theme: a }) => `
|
|
86
102
|
position: relative;
|
|
87
103
|
|
|
88
104
|
& .chevron-down span,
|
|
89
105
|
& .chevron-up span {
|
|
90
|
-
${
|
|
106
|
+
${o ? `color: ${a.palette.gray[300]};` : ""}
|
|
91
107
|
}
|
|
92
108
|
|
|
93
109
|
/* CLOSE STATE */
|
|
@@ -104,36 +120,40 @@ const t = o.ul`
|
|
|
104
120
|
display: none;
|
|
105
121
|
}
|
|
106
122
|
`}
|
|
107
|
-
`,
|
|
108
|
-
${({ theme:
|
|
109
|
-
border-top: 1px solid ${
|
|
110
|
-
color: ${
|
|
123
|
+
`, $ = n.li`
|
|
124
|
+
${({ theme: o }) => `
|
|
125
|
+
border-top: 1px solid ${o.palette.gray[200]};
|
|
126
|
+
color: ${o.palette.gray[400]};
|
|
111
127
|
cursor: default;
|
|
112
128
|
font-weight: bold;
|
|
113
|
-
line-height: ${
|
|
114
|
-
margin-bottom: ${
|
|
115
|
-
margin-top: ${
|
|
116
|
-
padding: ${
|
|
129
|
+
line-height: ${o.spacing[1.25]};
|
|
130
|
+
margin-bottom: ${o.spacing[0.625]};
|
|
131
|
+
margin-top: ${o.spacing[0.625]};
|
|
132
|
+
padding: ${o.spacing[0.25]} ${o.spacing[1]};
|
|
117
133
|
user-select: none;
|
|
118
134
|
`}
|
|
119
|
-
`,
|
|
120
|
-
${({ theme:
|
|
121
|
-
|
|
122
|
-
border-top: 1px solid ${a.palette.gray[200]};
|
|
123
|
-
bottom: 0;
|
|
124
|
-
color: ${a.palette.gray[400]};
|
|
135
|
+
`, y = n.div`
|
|
136
|
+
${({ theme: o }) => `
|
|
137
|
+
border-bottom: 1px solid ${o.palette.gray[200]};
|
|
125
138
|
cursor: default;
|
|
126
|
-
line-height: ${
|
|
127
|
-
|
|
128
|
-
|
|
139
|
+
line-height: ${o.spacing[1.25]};
|
|
140
|
+
margin-bottom: ${o.spacing[0.5]};
|
|
141
|
+
padding: ${o.spacing[0.25]} ${o.spacing[1]} ${o.spacing[0.75]};
|
|
129
142
|
user-select: none;
|
|
143
|
+
|
|
144
|
+
&:has(+ ul:empty) {
|
|
145
|
+
border-bottom: none;
|
|
146
|
+
margin-bottom: 0;
|
|
147
|
+
padding-bottom: ${o.spacing[0.25]};
|
|
148
|
+
}
|
|
130
149
|
`}
|
|
131
150
|
`;
|
|
132
151
|
export {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
152
|
+
e as ChevronIconButton,
|
|
153
|
+
d as StyledDropdown,
|
|
154
|
+
g as StyledEmptyMessage,
|
|
155
|
+
$ as StyledGroupHeader,
|
|
156
|
+
s as StyledMenu,
|
|
157
|
+
c as StyledOption,
|
|
158
|
+
y as StyledStatusMessage
|
|
139
159
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IconName } from '@fortawesome/free-solid-svg-icons';
|
|
1
2
|
import { Key, Node } from '@react-types/shared';
|
|
2
3
|
import { InputHTMLAttributes, MutableRefObject } from 'react';
|
|
3
4
|
import { Control, UseFormSetValue, UseFormWatch } from 'react-hook-form';
|
|
@@ -8,13 +9,15 @@ import { IOutlineContainerProps } from '../../types';
|
|
|
8
9
|
* @interface IItem
|
|
9
10
|
* @property { string } [group] - Optional group header for the item.
|
|
10
11
|
* @property { string } [href] - The href of the item.
|
|
12
|
+
* @property { IconName } [icon] - Optional icon shown before the name.
|
|
11
13
|
* @property { string } name - The name of the item.
|
|
12
|
-
* @property { string } [tag] - Optional tag of the item.
|
|
14
|
+
* @property { string } [tag] - Optional tag shown at the end of the item.
|
|
13
15
|
* @property { string } value - The value of the item.
|
|
14
16
|
*/
|
|
15
17
|
interface IItem {
|
|
16
18
|
group?: string;
|
|
17
19
|
href?: string;
|
|
20
|
+
icon?: IconName;
|
|
18
21
|
name: string;
|
|
19
22
|
tag?: string;
|
|
20
23
|
value: string;
|
|
@@ -24,6 +27,7 @@ interface IItem {
|
|
|
24
27
|
* @interface IOptionProps
|
|
25
28
|
* @property { MutableRefObject } containerRef - The ref of the ComboBox container.
|
|
26
29
|
* @property { string } [countLabel] - Plural noun of the selection summary.
|
|
30
|
+
* @property { IconName } [icon] - Optional icon shown before the name.
|
|
27
31
|
* @property { IItem } item - The item to be rendered as an option.
|
|
28
32
|
* @property { boolean } multiSelection - Enable to select more than one option.
|
|
29
33
|
* @property { string } name - The name of the Select.
|
|
@@ -35,6 +39,7 @@ interface IOptionProps<T> {
|
|
|
35
39
|
allItemKeys: string[];
|
|
36
40
|
containerRef: MutableRefObject<HTMLDivElement | null>;
|
|
37
41
|
countLabel?: string;
|
|
42
|
+
icon?: IconName;
|
|
38
43
|
item: Node<IItem>;
|
|
39
44
|
multiSelection: boolean;
|
|
40
45
|
name: string;
|
|
@@ -57,8 +62,8 @@ interface IOptionProps<T> {
|
|
|
57
62
|
* @property { Function } [onChange] - The callback to be called on input change.
|
|
58
63
|
* @property { string } [placeholder] - The placeholder for the input.
|
|
59
64
|
* @property { string } [emptyMessage] - Message shown when no items are present.
|
|
60
|
-
* @property { string } [statusMessage] - Message
|
|
61
|
-
*
|
|
65
|
+
* @property { string } [statusMessage] - Message fixed at the top of the
|
|
66
|
+
* dropdown, above the items it describes.
|
|
62
67
|
* @property { boolean } [clearable] - Whether the clear button is shown.
|
|
63
68
|
* @property {Function} [onClear] - Called when the clear button is clicked.
|
|
64
69
|
* @property { string } [countLabel] - Plural noun that summarizes two or
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsxs as f, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { useButton as
|
|
2
|
+
import { useRef as $, useCallback as x } from "react";
|
|
3
|
+
import { useButton as y } from "../../../../node_modules/react-aria/dist/private/button/useButton.js";
|
|
4
4
|
import { useOverlayTrigger as T } from "../../../../node_modules/react-aria/dist/private/overlays/useOverlayTrigger.js";
|
|
5
5
|
import { useOverlayTriggerState as v } from "../../../../node_modules/react-stately/dist/private/overlays/useOverlayTriggerState.js";
|
|
6
6
|
import { MonthPanel as O } from "./panel.js";
|
|
7
|
-
import { TriggerButton as S } from "./styles.js";
|
|
8
|
-
import { formatPeriod as
|
|
9
|
-
import { OutlineContainer as
|
|
10
|
-
import { Dialog as
|
|
11
|
-
import { Popover as
|
|
12
|
-
import { theme as
|
|
7
|
+
import { TriggerButton as S, PeriodText as C } from "./styles.js";
|
|
8
|
+
import { formatPeriod as j } from "./utils.js";
|
|
9
|
+
import { OutlineContainer as k } from "../../outline-container/index.js";
|
|
10
|
+
import { Dialog as z } from "../../utils/dialog/index.js";
|
|
11
|
+
import { Popover as B } from "../../utils/popover/index.js";
|
|
12
|
+
import { theme as D } from "../../../colors/index.js";
|
|
13
13
|
import { Icon as p } from "../../../icon/index.js";
|
|
14
|
-
const
|
|
14
|
+
const N = ({
|
|
15
15
|
disabled: t = !1,
|
|
16
16
|
label: n,
|
|
17
17
|
maxValue: a,
|
|
@@ -20,20 +20,20 @@ const L = ({
|
|
|
20
20
|
onChange: s,
|
|
21
21
|
value: l
|
|
22
22
|
}) => {
|
|
23
|
-
const e =
|
|
23
|
+
const e = $(null), r = v({}), { close: c } = r, { triggerProps: d, overlayProps: h } = T(
|
|
24
24
|
{ type: "dialog" },
|
|
25
25
|
r,
|
|
26
26
|
e
|
|
27
|
-
), { buttonProps: u } =
|
|
27
|
+
), { buttonProps: u } = y(
|
|
28
28
|
{ ...d, isDisabled: t, onPress: r.toggle },
|
|
29
29
|
e
|
|
30
|
-
), b =
|
|
31
|
-
(
|
|
32
|
-
s(
|
|
30
|
+
), b = x(
|
|
31
|
+
(P) => {
|
|
32
|
+
s(P), c();
|
|
33
33
|
},
|
|
34
34
|
[c, s]
|
|
35
|
-
), m =
|
|
36
|
-
return /* @__PURE__ */ f(
|
|
35
|
+
), m = D.palette.gray[t ? 400 : 700];
|
|
36
|
+
return /* @__PURE__ */ f(k, { htmlFor: i, label: n, children: [
|
|
37
37
|
/* @__PURE__ */ f(S, { ...u, id: i, ref: e, children: [
|
|
38
38
|
/* @__PURE__ */ o(
|
|
39
39
|
p,
|
|
@@ -44,7 +44,7 @@ const L = ({
|
|
|
44
44
|
iconType: "fa-light"
|
|
45
45
|
}
|
|
46
46
|
),
|
|
47
|
-
/* @__PURE__ */ o(
|
|
47
|
+
/* @__PURE__ */ o(C, { children: j(l) }),
|
|
48
48
|
/* @__PURE__ */ o(
|
|
49
49
|
p,
|
|
50
50
|
{
|
|
@@ -56,13 +56,13 @@ const L = ({
|
|
|
56
56
|
)
|
|
57
57
|
] }),
|
|
58
58
|
r.isOpen && !t ? /* @__PURE__ */ o(
|
|
59
|
-
|
|
59
|
+
B,
|
|
60
60
|
{
|
|
61
61
|
offset: 8,
|
|
62
62
|
placement: "bottom end",
|
|
63
63
|
state: r,
|
|
64
64
|
triggerRef: e,
|
|
65
|
-
children: /* @__PURE__ */ o(
|
|
65
|
+
children: /* @__PURE__ */ o(z, { ...h, "aria-label": n ?? i, children: /* @__PURE__ */ o(
|
|
66
66
|
O,
|
|
67
67
|
{
|
|
68
68
|
maxValue: a,
|
|
@@ -77,5 +77,5 @@ const L = ({
|
|
|
77
77
|
] });
|
|
78
78
|
};
|
|
79
79
|
export {
|
|
80
|
-
|
|
80
|
+
N as MonthPicker
|
|
81
81
|
};
|