@fluidattacks/design 9.1.1 → 9.2.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/inputs/fields/combobox/field/index.js +158 -156
- package/dist/components/inputs/fields/combobox/option/index.d.ts +1 -1
- package/dist/components/inputs/fields/combobox/option/index.js +85 -81
- package/dist/components/inputs/fields/combobox/types.d.ts +2 -0
- package/dist/components/stepper/index.d.ts +4 -0
- package/dist/components/stepper/index.js +50 -0
- package/dist/components/stepper/index.stories.d.ts +6 -0
- package/dist/components/stepper/index.test.d.ts +1 -0
- package/dist/components/stepper/styles.d.ts +10 -0
- package/dist/components/stepper/styles.js +65 -0
- package/dist/components/stepper/types.d.ts +25 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +128 -126
- package/dist/utils/open-url.test.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,121 +1,125 @@
|
|
|
1
|
-
import { jsx as
|
|
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 { jsx as l, jsxs as G } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as H, useMemo as f, useCallback as k } from "react";
|
|
3
|
+
import { useOption as J } from "../../../../../node_modules/react-aria/dist/private/listbox/useOption.js";
|
|
4
|
+
import { useTheme as Q } from "styled-components";
|
|
5
|
+
import { StyledOption as W } from "../styles.js";
|
|
6
|
+
import { describeSelection as X, toSelection as j } from "../utils.js";
|
|
7
|
+
import { Checkbox as u } from "../../../../checkbox/index.js";
|
|
8
|
+
import { Icon as Y } from "../../../../icon/index.js";
|
|
9
|
+
import { Link as Z } from "../../../../link/index.js";
|
|
10
|
+
import { Tag as _ } 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:
|
|
13
|
+
import { Text as I } from "../../../../typography/text/index.js";
|
|
14
|
+
import { useClickOutside as V } from "../../../../../hooks/use-click-outside.js";
|
|
15
|
+
import { openUrl as oo } from "../../../../../utils/open-url.js";
|
|
16
|
+
const Co = ({
|
|
17
|
+
allItemKeys: a,
|
|
18
|
+
containerRef: D,
|
|
19
19
|
item: o,
|
|
20
|
-
multiSelection:
|
|
21
|
-
name:
|
|
22
|
-
popoverRef:
|
|
23
|
-
setInputValue:
|
|
20
|
+
multiSelection: s,
|
|
21
|
+
name: e,
|
|
22
|
+
popoverRef: w,
|
|
23
|
+
setInputValue: i,
|
|
24
24
|
setValue: n,
|
|
25
25
|
state: c,
|
|
26
|
-
|
|
26
|
+
tag: C,
|
|
27
|
+
watch: h
|
|
27
28
|
}) => {
|
|
28
|
-
const
|
|
29
|
-
(
|
|
30
|
-
), { optionProps:
|
|
29
|
+
const z = Q(), y = H(null), d = o.props.hrefLang, g = c.disabledKeys, A = a.filter(
|
|
30
|
+
(r) => !Array.from(g).includes(r) && r !== "All"
|
|
31
|
+
), { optionProps: F, isSelected: $, isFocused: q, isDisabled: O } = J(
|
|
31
32
|
{ key: o.key },
|
|
32
33
|
c,
|
|
33
|
-
|
|
34
|
-
),
|
|
34
|
+
y
|
|
35
|
+
), m = f(() => c.collection.getItem("All")?.rendered?.toString(), [c.collection]), B = [
|
|
35
36
|
$ ? "selected" : "",
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
].join(" "),
|
|
39
|
-
(
|
|
40
|
-
const { allSelected:
|
|
41
|
-
|
|
37
|
+
q ? "focused" : "",
|
|
38
|
+
O ? "disabled" : ""
|
|
39
|
+
].join(" "), b = k(
|
|
40
|
+
(r) => {
|
|
41
|
+
const { allSelected: t, text: p } = X(
|
|
42
|
+
r,
|
|
43
|
+
a,
|
|
42
44
|
g,
|
|
43
|
-
|
|
44
|
-
b
|
|
45
|
+
m
|
|
45
46
|
);
|
|
46
|
-
n?.(`${
|
|
47
|
+
n?.(`${e}CheckAll`, t ? p : ""), i(p);
|
|
47
48
|
},
|
|
48
|
-
[
|
|
49
|
-
),
|
|
50
|
-
(
|
|
51
|
-
if (
|
|
52
|
-
const
|
|
53
|
-
n?.(`${
|
|
49
|
+
[a, m, g, e, i, n]
|
|
50
|
+
), K = k(
|
|
51
|
+
(r) => {
|
|
52
|
+
if (r.target.checked) {
|
|
53
|
+
const t = [...A].sort();
|
|
54
|
+
n?.(`${e}Options`, t), n?.(`${e}CheckAll`, r.target.value), i(r.target.value);
|
|
54
55
|
} else
|
|
55
|
-
n?.(`${
|
|
56
|
+
n?.(`${e}Options`, []), n?.(`${e}CheckAll`, ""), i("");
|
|
56
57
|
},
|
|
57
|
-
[
|
|
58
|
-
),
|
|
59
|
-
(
|
|
60
|
-
const
|
|
61
|
-
n?.(`${
|
|
58
|
+
[A, e, i, n]
|
|
59
|
+
), M = k(
|
|
60
|
+
(r) => {
|
|
61
|
+
const t = r.target.value, p = j(h?.(`${e}Options`)), T = r.target.checked ? [...p, t] : p.filter((E) => E !== t);
|
|
62
|
+
n?.(`${e}Options`, T), b(T);
|
|
62
63
|
},
|
|
63
|
-
[
|
|
64
|
-
),
|
|
65
|
-
() =>
|
|
66
|
-
[
|
|
67
|
-
),
|
|
68
|
-
|
|
64
|
+
[e, n, h, b]
|
|
65
|
+
), S = h?.(`${e}Options`), v = f(
|
|
66
|
+
() => j(S),
|
|
67
|
+
[S]
|
|
68
|
+
), N = f(
|
|
69
|
+
() => v.includes(o.key.toString()),
|
|
70
|
+
[v, o.key]
|
|
71
|
+
), x = h?.(`${e}CheckAll`), P = f(() => !!x, [x]), R = o.key === "All" ? /* @__PURE__ */ l(
|
|
72
|
+
u,
|
|
69
73
|
{
|
|
70
|
-
checked:
|
|
74
|
+
checked: P,
|
|
71
75
|
label: o.rendered?.toString(),
|
|
72
|
-
name: `${
|
|
73
|
-
onChange:
|
|
76
|
+
name: `${e}CheckAll`,
|
|
77
|
+
onChange: K,
|
|
74
78
|
value: o.rendered?.toString()
|
|
75
79
|
}
|
|
76
|
-
) : /* @__PURE__ */
|
|
77
|
-
|
|
80
|
+
) : /* @__PURE__ */ l(
|
|
81
|
+
u,
|
|
78
82
|
{
|
|
79
|
-
checked:
|
|
83
|
+
checked: N,
|
|
80
84
|
label: o.rendered?.toString(),
|
|
81
|
-
name: `${
|
|
82
|
-
onChange:
|
|
85
|
+
name: `${e}Options`,
|
|
86
|
+
onChange: M,
|
|
83
87
|
value: o.key.toString()
|
|
84
88
|
}
|
|
85
|
-
),
|
|
86
|
-
|
|
89
|
+
), L = s && !O ? R : /* @__PURE__ */ l(
|
|
90
|
+
I,
|
|
87
91
|
{
|
|
88
|
-
color:
|
|
92
|
+
color: z.palette.gray[800],
|
|
89
93
|
size: "md",
|
|
90
94
|
textOverflow: "ellipsis",
|
|
91
95
|
whiteSpace: "nowrap",
|
|
92
96
|
children: o.rendered
|
|
93
97
|
}
|
|
94
|
-
),
|
|
95
|
-
(
|
|
96
|
-
|
|
98
|
+
), U = k(
|
|
99
|
+
(r) => {
|
|
100
|
+
r.preventDefault(), i(o.rendered?.toString() ?? ""), c.setSelectedKey(o.key), requestAnimationFrame(() => {
|
|
97
101
|
c.setOpen(!1);
|
|
98
|
-
}),
|
|
102
|
+
}), oo(d);
|
|
99
103
|
},
|
|
100
|
-
[
|
|
104
|
+
[d, o.key, o.rendered, c, i]
|
|
101
105
|
);
|
|
102
|
-
return
|
|
103
|
-
|
|
104
|
-
}, [
|
|
105
|
-
|
|
106
|
+
return V(w, () => {
|
|
107
|
+
s && c.close();
|
|
108
|
+
}, [D]), /* @__PURE__ */ G(
|
|
109
|
+
W,
|
|
106
110
|
{
|
|
107
|
-
...!
|
|
108
|
-
$multiSelection:
|
|
109
|
-
className:
|
|
110
|
-
ref:
|
|
111
|
+
...!s && !d ? F : {},
|
|
112
|
+
$multiSelection: s,
|
|
113
|
+
className: B,
|
|
114
|
+
ref: y,
|
|
111
115
|
children: [
|
|
112
|
-
|
|
113
|
-
$ && !
|
|
114
|
-
|
|
116
|
+
d ? /* @__PURE__ */ l(Z, { href: d, onClick: U, children: L }) : L,
|
|
117
|
+
$ && !O && !s ? /* @__PURE__ */ l(Y, { icon: "check", iconSize: "sm", iconType: "fa-light" }) : void 0,
|
|
118
|
+
C === void 0 ? void 0 : /* @__PURE__ */ l(_, { tagLabel: C, variant: "inactive" })
|
|
115
119
|
]
|
|
116
120
|
}
|
|
117
121
|
);
|
|
118
122
|
};
|
|
119
123
|
export {
|
|
120
|
-
|
|
124
|
+
Co as Option
|
|
121
125
|
};
|
|
@@ -28,6 +28,7 @@ interface IItem {
|
|
|
28
28
|
* @property { string } name - The name of the Select.
|
|
29
29
|
* @property { MutableRefObject } popoverRef - The ref of the options popover.
|
|
30
30
|
* @property { ComboBoxState<T> } state - The state of the ComboBox.
|
|
31
|
+
* @property { string } [tag] - Optional tag shown next to the option.
|
|
31
32
|
*/
|
|
32
33
|
interface IOptionProps<T> {
|
|
33
34
|
allItemKeys: string[];
|
|
@@ -39,6 +40,7 @@ interface IOptionProps<T> {
|
|
|
39
40
|
setInputValue: React.Dispatch<React.SetStateAction<string>>;
|
|
40
41
|
state: ComboBoxState<T>;
|
|
41
42
|
setValue?: UseFormSetValue<any>;
|
|
43
|
+
tag?: string;
|
|
42
44
|
watch?: UseFormWatch<any>;
|
|
43
45
|
}
|
|
44
46
|
/**
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsxs as m, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment as d } from "react";
|
|
3
|
+
import { VisuallyHidden as a } from "../../node_modules/react-aria/dist/private/visually-hidden/VisuallyHidden.js";
|
|
4
|
+
import { useTheme as s } from "styled-components";
|
|
5
|
+
import { StyledStepRow as h, StyledStepItem as u, StyledStepIndicator as f, StyledStepConnector as g } from "./styles.js";
|
|
6
|
+
import { Icon as S } from "../icon/index.js";
|
|
7
|
+
import "../typography/heading/index.js";
|
|
8
|
+
import "../typography/span/index.js";
|
|
9
|
+
import { Text as y } from "../typography/text/index.js";
|
|
10
|
+
const $ = (n, e) => n < e ? "completed" : n === e ? "current" : "upcoming", C = ({
|
|
11
|
+
completedLabel: n = "completed",
|
|
12
|
+
currentStep: e,
|
|
13
|
+
steps: c
|
|
14
|
+
}) => {
|
|
15
|
+
const l = s();
|
|
16
|
+
return /* @__PURE__ */ m(d, { children: [
|
|
17
|
+
/* @__PURE__ */ t(h, { children: c.map((r, o) => {
|
|
18
|
+
const i = $(o, e), p = i === "upcoming";
|
|
19
|
+
return /* @__PURE__ */ m(
|
|
20
|
+
u,
|
|
21
|
+
{
|
|
22
|
+
"aria-current": i === "current" ? "step" : void 0,
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ t(f, { $status: i, children: i === "completed" ? /* @__PURE__ */ t(S, { icon: "check", iconSize: "sm", iconType: "fa-solid" }) : o + 1 }),
|
|
25
|
+
/* @__PURE__ */ m(
|
|
26
|
+
y,
|
|
27
|
+
{
|
|
28
|
+
color: p ? l.palette.gray[400] : l.palette.gray[800],
|
|
29
|
+
display: "inline",
|
|
30
|
+
fontWeight: p ? "regular" : "bold",
|
|
31
|
+
size: "md",
|
|
32
|
+
whiteSpace: "nowrap",
|
|
33
|
+
children: [
|
|
34
|
+
r.title,
|
|
35
|
+
i === "completed" && /* @__PURE__ */ t(a, { children: ` (${n})` })
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
o < c.length - 1 && /* @__PURE__ */ t(g, { "aria-hidden": !0 })
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
r.title
|
|
43
|
+
);
|
|
44
|
+
}) }),
|
|
45
|
+
c.map((r, o) => /* @__PURE__ */ t("div", { hidden: o !== e, children: r.content }, r.title))
|
|
46
|
+
] });
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
C as Stepper
|
|
50
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react-vite';
|
|
2
|
+
import { IStepperProps } from './types';
|
|
3
|
+
declare const config: Meta;
|
|
4
|
+
declare const Default: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, IStepperProps>;
|
|
5
|
+
export { Default };
|
|
6
|
+
export default config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TStepperStatus } from './types';
|
|
2
|
+
declare const StyledStepRow: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, never>>> & string;
|
|
3
|
+
declare const StyledStepItem: 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;
|
|
4
|
+
declare const StyledStepIndicator: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$status"> & {
|
|
5
|
+
$status: TStepperStatus;
|
|
6
|
+
}, never> & Partial<Pick<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$status"> & {
|
|
7
|
+
$status: TStepperStatus;
|
|
8
|
+
}, never>>> & string;
|
|
9
|
+
declare const StyledStepConnector: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>> & string;
|
|
10
|
+
export { StyledStepConnector, StyledStepIndicator, StyledStepItem, StyledStepRow, };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { styled as i } from "styled-components";
|
|
2
|
+
import { variantBuilder as a } from "../@core/variants/utils.js";
|
|
3
|
+
const { getVariant: n } = a(
|
|
4
|
+
(t) => ({
|
|
5
|
+
completed: `
|
|
6
|
+
background-color: ${t.palette.success[500]};
|
|
7
|
+
color: ${t.palette.white};
|
|
8
|
+
`,
|
|
9
|
+
current: `
|
|
10
|
+
background-color: ${t.palette.gray[800]};
|
|
11
|
+
color: ${t.palette.white};
|
|
12
|
+
`,
|
|
13
|
+
upcoming: `
|
|
14
|
+
background-color: ${t.palette.white};
|
|
15
|
+
border: 1px solid ${t.palette.gray[400]};
|
|
16
|
+
color: ${t.palette.gray[400]};
|
|
17
|
+
`
|
|
18
|
+
})
|
|
19
|
+
), r = i.ol`
|
|
20
|
+
align-items: center;
|
|
21
|
+
display: flex;
|
|
22
|
+
gap: ${({ theme: t }) => t.spacing[0.75]};
|
|
23
|
+
list-style: none;
|
|
24
|
+
margin: 0;
|
|
25
|
+
margin-bottom: ${({ theme: t }) => t.spacing[1.5]};
|
|
26
|
+
padding: 0;
|
|
27
|
+
`, p = i.li`
|
|
28
|
+
align-items: center;
|
|
29
|
+
display: flex;
|
|
30
|
+
flex: 1 1 0;
|
|
31
|
+
gap: ${({ theme: t }) => t.spacing[0.75]};
|
|
32
|
+
min-width: 0;
|
|
33
|
+
|
|
34
|
+
&:last-child {
|
|
35
|
+
flex: 0 0 auto;
|
|
36
|
+
}
|
|
37
|
+
`, c = i.span`
|
|
38
|
+
${({ theme: t, $status: o }) => `
|
|
39
|
+
align-items: center;
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
box-sizing: border-box;
|
|
42
|
+
display: inline-flex;
|
|
43
|
+
flex-shrink: 0;
|
|
44
|
+
font-family: ${t.typography.type.primary};
|
|
45
|
+
font-size: ${t.typography.text.md};
|
|
46
|
+
font-weight: ${t.typography.weight.bold};
|
|
47
|
+
line-height: ${t.spacing[1.25]};
|
|
48
|
+
height: ${t.spacing[1.5]};
|
|
49
|
+
justify-content: center;
|
|
50
|
+
width: ${t.spacing[1.5]};
|
|
51
|
+
|
|
52
|
+
${n(t, o)}
|
|
53
|
+
`}
|
|
54
|
+
`, g = i.span`
|
|
55
|
+
background-color: ${({ theme: t }) => t.palette.gray[300]};
|
|
56
|
+
flex: 1 1 auto;
|
|
57
|
+
height: 1px;
|
|
58
|
+
min-width: ${({ theme: t }) => t.spacing[1]};
|
|
59
|
+
`;
|
|
60
|
+
export {
|
|
61
|
+
g as StyledStepConnector,
|
|
62
|
+
c as StyledStepIndicator,
|
|
63
|
+
p as StyledStepItem,
|
|
64
|
+
r as StyledStepRow
|
|
65
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type TStepperStatus = "completed" | "current" | "upcoming";
|
|
3
|
+
/**
|
|
4
|
+
* Stepper step props.
|
|
5
|
+
* @interface IStepperStep
|
|
6
|
+
* @property { ReactNode } content - The step's panel. It stays mounted while other steps are current, so form fields keep their registration and values.
|
|
7
|
+
* @property { string } title - The step's label in the progress row; must be unique among the steps.
|
|
8
|
+
*/
|
|
9
|
+
interface IStepperStep {
|
|
10
|
+
content: ReactNode;
|
|
11
|
+
title: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Stepper component props.
|
|
15
|
+
* @interface IStepperProps
|
|
16
|
+
* @property { string } [completedLabel] - Screen-reader suffix announced after each completed step's title. Defaults to "completed".
|
|
17
|
+
* @property { number } currentStep - Zero-based index of the current step, owned by the consumer: steps before it render as completed, steps after it as upcoming.
|
|
18
|
+
* @property { IStepperStep[] } steps - The steps, in order.
|
|
19
|
+
*/
|
|
20
|
+
interface IStepperProps {
|
|
21
|
+
completedLabel?: string;
|
|
22
|
+
currentStep: number;
|
|
23
|
+
steps: IStepperStep[];
|
|
24
|
+
}
|
|
25
|
+
export type { IStepperProps, IStepperStep, TStepperStatus };
|
package/dist/index.d.ts
CHANGED
|
@@ -72,6 +72,7 @@ export * from './components/show-on-hover';
|
|
|
72
72
|
export * from './components/slide-out-menu';
|
|
73
73
|
export * from './components/slider';
|
|
74
74
|
export * from './components/step-lapse';
|
|
75
|
+
export * from './components/stepper';
|
|
75
76
|
export * from './components/summary-card';
|
|
76
77
|
export * from './components/table';
|
|
77
78
|
export * from './components/table-button';
|