@fluidattacks/design 11.1.1 → 11.5.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/button/index.js +60 -60
- package/dist/components/button/index.stories.d.ts +2 -1
- package/dist/components/button/index.test.d.ts +1 -0
- package/dist/components/charts/data-number/index.d.ts +4 -0
- package/dist/components/charts/data-number/index.js +75 -0
- package/dist/components/charts/data-number/index.stories.d.ts +10 -0
- package/dist/components/charts/data-number/index.test.d.ts +1 -0
- package/dist/components/charts/data-number/types.d.ts +32 -0
- package/dist/components/charts/data-number/utils.d.ts +2 -0
- package/dist/components/charts/data-number/utils.js +4 -0
- package/dist/components/charts/index.d.ts +3 -0
- package/dist/components/charts/index.js +4 -0
- package/dist/components/filters/context/types.d.ts +2 -0
- package/dist/components/filters/index.js +120 -116
- package/dist/components/filters/index.stories.d.ts +2 -1
- package/dist/components/filters/options-menu/index.js +74 -73
- package/dist/components/filters/types.d.ts +3 -0
- package/dist/components/skeleton/index.d.ts +6 -0
- package/dist/components/skeleton/index.js +18 -0
- package/dist/components/skeleton/index.stories.d.ts +8 -0
- package/dist/components/skeleton/index.test.d.ts +1 -0
- package/dist/components/skeleton/styles.d.ts +5 -0
- package/dist/components/skeleton/styles.js +33 -0
- package/dist/components/skeleton/types.d.ts +24 -0
- package/dist/components/stepper/index.d.ts +1 -1
- package/dist/components/stepper/index.js +16 -15
- package/dist/components/stepper/styles.d.ts +5 -1
- package/dist/components/stepper/styles.js +6 -0
- package/dist/components/stepper/types.d.ts +2 -0
- package/dist/components/tabs/index.js +27 -25
- package/dist/components/tabs/index.stories.d.ts +1 -2
- package/dist/components/tabs/tab/index.d.ts +1 -1
- package/dist/components/tabs/tab/index.js +25 -28
- package/dist/components/tabs/types.d.ts +7 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +304 -300
- package/package.json +1 -1
|
@@ -1,61 +1,62 @@
|
|
|
1
1
|
import { jsx as u, jsxs as V } from "react/jsx-runtime";
|
|
2
2
|
import C from "../../../_virtual/dayjs.min.js";
|
|
3
|
-
import { l as
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import { useTheme as
|
|
6
|
-
import { IncludeExcludeMenu as
|
|
7
|
-
import { Options as
|
|
3
|
+
import { l as ee } from "../../../_virtual/lodash.js";
|
|
4
|
+
import { forwardRef as te, useContext as se, useMemo as oe, useCallback as S, Fragment as le } from "react";
|
|
5
|
+
import { useTheme as ne } from "styled-components";
|
|
6
|
+
import { IncludeExcludeMenu as re } from "./include-exclude/index.js";
|
|
7
|
+
import { Options as ce } from "./options/index.js";
|
|
8
8
|
import { formatValue as A } from "./utils.js";
|
|
9
|
-
import { FiltersContext as
|
|
10
|
-
import { StyledModalContainer as
|
|
11
|
-
import { MAX_FILTERS_LENGTH as
|
|
9
|
+
import { FiltersContext as ae } from "../context/index.js";
|
|
10
|
+
import { StyledModalContainer as ie, StyledFloatingActions as de, StyledHeader as ue, StyledContent as me, StyledActionButton as H } from "../styles.js";
|
|
11
|
+
import { MAX_FILTERS_LENGTH as fe } from "../utils.js";
|
|
12
12
|
import { Container as F } from "../../container/index.js";
|
|
13
|
-
import { Search as
|
|
14
|
-
import { Toggle as
|
|
13
|
+
import { Search as he } from "../../search/index.js";
|
|
14
|
+
import { Toggle as xe } from "../../toggle/index.js";
|
|
15
15
|
import "../../typography/heading/index.js";
|
|
16
16
|
import "../../typography/span/index.js";
|
|
17
17
|
import { Text as Y } from "../../typography/text/index.js";
|
|
18
18
|
import { parseCheckboxesFilterValue as y, formatCheckboxesFilterValue as I } from "../../../utils/filters.js";
|
|
19
|
-
const
|
|
19
|
+
const T = (p) => p.type === "combobox" || p.type === "multiSelect", ge = (p, f) => {
|
|
20
20
|
const g = new Set(
|
|
21
21
|
(f ?? []).filter((a) => a.type === "list" || a.type === "combobox").flatMap((a) => (a.items ?? []).map((k) => k.value))
|
|
22
22
|
);
|
|
23
23
|
return p.filter((a) => !g.has(a));
|
|
24
|
-
},
|
|
25
|
-
const R =
|
|
24
|
+
}, ve = te(function({ hideTitle: f = !1, label: g, options: a }, k) {
|
|
25
|
+
const R = ne(), {
|
|
26
26
|
id: t,
|
|
27
27
|
searchValues: { searchFilter: x },
|
|
28
28
|
setSearchValues: L,
|
|
29
|
-
values:
|
|
29
|
+
values: z,
|
|
30
30
|
setValues: h,
|
|
31
|
-
scrollState:
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
scrollState: B,
|
|
32
|
+
optionsSearchThreshold: D = fe
|
|
33
|
+
} = se(ae), { ref: W } = B, b = z[t], $ = (a ?? []).some(
|
|
34
|
+
(e) => !T(e) && (e.items ?? []).length > D
|
|
34
35
|
), O = a?.find(
|
|
35
36
|
(e) => e.type === "includeExclude"
|
|
36
37
|
), M = a?.find(
|
|
37
38
|
(e) => e.type === "checkboxes" && e.excludeLabel
|
|
38
|
-
), { mode:
|
|
39
|
+
), { mode: _, values: G } = y(b ?? ""), X = _ === "exclude", q = G.length > 0, v = !f || $ || M !== void 0, w = oe(() => a?.map((e) => {
|
|
39
40
|
const s = e?.items ?? [];
|
|
40
|
-
return
|
|
41
|
+
return T(e) ? s : s.filter(
|
|
41
42
|
(m) => m.label?.toLowerCase().includes(x.toLowerCase()) ?? !1
|
|
42
43
|
);
|
|
43
|
-
}) ?? [], [a, x]),
|
|
44
|
+
}) ?? [], [a, x]), J = S(() => {
|
|
44
45
|
h((e) => ({ ...e, [t]: "" }));
|
|
45
|
-
}, [h, t]),
|
|
46
|
+
}, [h, t]), K = S(() => {
|
|
46
47
|
h((e) => {
|
|
47
48
|
const { mode: s, values: m } = y(
|
|
48
49
|
e[t] ?? ""
|
|
49
|
-
),
|
|
50
|
+
), o = [
|
|
50
51
|
...m,
|
|
51
52
|
...w.flat().map((r) => r.value)
|
|
52
53
|
];
|
|
53
54
|
return {
|
|
54
55
|
...e,
|
|
55
|
-
[t]: I({ mode: s, values:
|
|
56
|
+
[t]: I({ mode: s, values: o })
|
|
56
57
|
};
|
|
57
58
|
});
|
|
58
|
-
}, [h, t, w]),
|
|
59
|
+
}, [h, t, w]), P = S(() => {
|
|
59
60
|
h((e) => {
|
|
60
61
|
const { mode: s, values: m } = y(
|
|
61
62
|
e[t] ?? ""
|
|
@@ -68,7 +69,7 @@ const z = (p) => p.type === "combobox" || p.type === "multiSelect", xe = (p, f)
|
|
|
68
69
|
})
|
|
69
70
|
};
|
|
70
71
|
});
|
|
71
|
-
}, [h, t]),
|
|
72
|
+
}, [h, t]), Q = S(
|
|
72
73
|
(e) => {
|
|
73
74
|
L((s) => ({
|
|
74
75
|
...s,
|
|
@@ -76,78 +77,78 @@ const z = (p) => p.type === "combobox" || p.type === "multiSelect", xe = (p, f)
|
|
|
76
77
|
}));
|
|
77
78
|
},
|
|
78
79
|
[L]
|
|
79
|
-
),
|
|
80
|
+
), U = S(
|
|
80
81
|
(e, s, m) => {
|
|
81
|
-
h((
|
|
82
|
+
h((o) => {
|
|
82
83
|
if (s === "checkboxes" || s === "multiSelect") {
|
|
83
84
|
const { mode: r, values: c } = y(
|
|
84
|
-
|
|
85
|
-
), n = s === "multiSelect" ?
|
|
85
|
+
o[t] ?? ""
|
|
86
|
+
), n = s === "multiSelect" ? ge(c, a) : c, l = n.includes(e) ? n.filter((d) => d !== e) : [...n, e];
|
|
86
87
|
return {
|
|
87
|
-
...
|
|
88
|
-
[t]: I({ mode: r, values:
|
|
88
|
+
...o,
|
|
89
|
+
[t]: I({ mode: r, values: l })
|
|
89
90
|
};
|
|
90
91
|
}
|
|
91
92
|
if (s === "dateRange") {
|
|
92
|
-
const r = A(
|
|
93
|
+
const r = A(o[t] ?? ""), c = r.filter(
|
|
93
94
|
(i) => i !== "-" && !RegExp(/^\d+\-\d+\-\d+$/).test(i.trim())
|
|
94
95
|
), n = r.filter(
|
|
95
96
|
(i) => C(i).isValid() && C(i).isAfter(C("1903-01-01"))
|
|
96
|
-
),
|
|
97
|
-
return n.length === 2 ? (d[0] = n[0], d[1] = n[1]) : n.length === 1 && (
|
|
97
|
+
), l = C(e, "YYYY-MM-DD", !0), d = ["-", "-"];
|
|
98
|
+
return n.length === 2 ? (d[0] = n[0], d[1] = n[1]) : n.length === 1 && (l.isAfter(C(n[0])) ? (d[0] = n[0], d[1] = e) : (d[0] = e, d[1] = n[0])), d[m ?? 0] = e, { ...o, [t]: [...c, ...d].join(",") };
|
|
98
99
|
}
|
|
99
100
|
if (s === "numberRange") {
|
|
100
|
-
const r = A(
|
|
101
|
+
const r = A(o[t] ?? ""), c = r.filter(
|
|
101
102
|
(i) => i !== "-" && !RegExp(/^\d+$/).test(i.trim())
|
|
102
103
|
), n = r.filter(
|
|
103
104
|
(i) => i === "-" || RegExp(/^\d+$/).test(i.trim())
|
|
104
|
-
),
|
|
105
|
+
), l = ["-", "-"];
|
|
105
106
|
n.forEach((i, E) => {
|
|
106
107
|
if (E >= 2) return;
|
|
107
108
|
const j = i.trim();
|
|
108
|
-
RegExp(/^\d+$/).test(j) ?
|
|
109
|
+
RegExp(/^\d+$/).test(j) ? l[E] = Number(j) : j === "-" && (l[E] = "-");
|
|
109
110
|
});
|
|
110
111
|
const d = m ?? 0;
|
|
111
112
|
if (e === "" || e === void 0 || e === null)
|
|
112
|
-
|
|
113
|
+
l[d] = "-";
|
|
113
114
|
else {
|
|
114
115
|
const i = Number(e);
|
|
115
|
-
|
|
116
|
+
l[d] = ee.isNaN(i) ? "-" : i;
|
|
116
117
|
}
|
|
117
|
-
return
|
|
118
|
-
...
|
|
118
|
+
return l[0] === "-" && l[1] === "-" ? {
|
|
119
|
+
...o,
|
|
119
120
|
[t]: c.length > 0 ? c.join(",") : ""
|
|
120
121
|
} : {
|
|
121
|
-
...
|
|
122
|
-
[t]: [...
|
|
122
|
+
...o,
|
|
123
|
+
[t]: [...l, ...c].join(",")
|
|
123
124
|
};
|
|
124
125
|
}
|
|
125
126
|
if (s === "combobox" || s === "list") {
|
|
126
|
-
const r = A(
|
|
127
|
+
const r = A(o[t] ?? ""), c = new Set(
|
|
127
128
|
(a ?? []).flatMap(
|
|
128
|
-
(
|
|
129
|
+
(l) => (l.items ?? []).map((d) => d.value)
|
|
129
130
|
)
|
|
130
131
|
), n = r.filter(
|
|
131
|
-
(
|
|
132
|
+
(l) => !c.has(l.trim()) && (l === "-" || RegExp(/^\d+$/).test(l) || RegExp(/^\d+\-\d+\-\d+$/).test(l.trim()))
|
|
132
133
|
);
|
|
133
|
-
return { ...
|
|
134
|
+
return { ...o, [t]: [...n, e].join(",") };
|
|
134
135
|
}
|
|
135
136
|
if (s === "textCheckbox") {
|
|
136
|
-
const r =
|
|
137
|
-
return !
|
|
137
|
+
const r = o[t] ?? "", c = r.match(/^textCheck:(true|false),(.*)$/), n = c ? c[2] : r, l = e === "true";
|
|
138
|
+
return !l && n === "" ? { ...o, [t]: "" } : { ...o, [t]: `textCheck:${l},${n}` };
|
|
138
139
|
}
|
|
139
140
|
if (s === "text") {
|
|
140
|
-
const c = (
|
|
141
|
-
return c ? e === "" && c[1] === "false" ? { ...
|
|
141
|
+
const c = (o[t] ?? "").match(/^textCheck:(true|false),/);
|
|
142
|
+
return c ? e === "" && c[1] === "false" ? { ...o, [t]: "" } : { ...o, [t]: `textCheck:${c[1]},${e}` } : { ...o, [t]: e };
|
|
142
143
|
}
|
|
143
|
-
return { ...
|
|
144
|
+
return { ...o, [t]: e };
|
|
144
145
|
});
|
|
145
146
|
},
|
|
146
147
|
[t, a, h]
|
|
147
148
|
);
|
|
148
149
|
if (O)
|
|
149
150
|
return /* @__PURE__ */ u(
|
|
150
|
-
|
|
151
|
+
re,
|
|
151
152
|
{
|
|
152
153
|
id: t,
|
|
153
154
|
label: g,
|
|
@@ -155,13 +156,13 @@ const z = (p) => p.type === "combobox" || p.type === "multiSelect", xe = (p, f)
|
|
|
155
156
|
ref: k
|
|
156
157
|
}
|
|
157
158
|
);
|
|
158
|
-
const
|
|
159
|
+
const Z = b !== void 0 && b !== "" && x === "" || $ && x !== "", N = /* @__PURE__ */ V(le, { children: [
|
|
159
160
|
b && x === "" ? /* @__PURE__ */ u(
|
|
160
161
|
H,
|
|
161
162
|
{
|
|
162
163
|
$variant: "lowRelevance",
|
|
163
164
|
"data-testid": "reset-all-filters",
|
|
164
|
-
onClick:
|
|
165
|
+
onClick: J,
|
|
165
166
|
type: "button",
|
|
166
167
|
children: "Reset all"
|
|
167
168
|
}
|
|
@@ -171,21 +172,21 @@ const z = (p) => p.type === "combobox" || p.type === "multiSelect", xe = (p, f)
|
|
|
171
172
|
{
|
|
172
173
|
$variant: "lowRelevance",
|
|
173
174
|
"data-testid": "select-all-filters",
|
|
174
|
-
onClick:
|
|
175
|
+
onClick: K,
|
|
175
176
|
type: "button",
|
|
176
177
|
children: "Select all"
|
|
177
178
|
}
|
|
178
179
|
) : void 0
|
|
179
180
|
] });
|
|
180
181
|
return /* @__PURE__ */ V(
|
|
181
|
-
|
|
182
|
+
ie,
|
|
182
183
|
{
|
|
183
184
|
$left: "346px",
|
|
184
185
|
"data-testid": "options-menu",
|
|
185
186
|
ref: k,
|
|
186
187
|
children: [
|
|
187
|
-
f && !v &&
|
|
188
|
-
v ? /* @__PURE__ */ V(
|
|
188
|
+
f && !v && Z ? /* @__PURE__ */ u(de, { "data-testid": "options-menu-floating-actions", children: N }) : void 0,
|
|
189
|
+
v ? /* @__PURE__ */ V(ue, { "data-testid": "options-menu-header", children: [
|
|
189
190
|
/* @__PURE__ */ V(
|
|
190
191
|
F,
|
|
191
192
|
{
|
|
@@ -214,24 +215,24 @@ const z = (p) => p.type === "combobox" || p.type === "multiSelect", xe = (p, f)
|
|
|
214
215
|
justify: "space-between",
|
|
215
216
|
width: "100%",
|
|
216
217
|
children: /* @__PURE__ */ u(
|
|
217
|
-
|
|
218
|
+
xe,
|
|
218
219
|
{
|
|
219
|
-
defaultChecked:
|
|
220
|
-
disabled: !
|
|
220
|
+
defaultChecked: X,
|
|
221
|
+
disabled: !q,
|
|
221
222
|
justify: "space-between",
|
|
222
223
|
leftText: M.excludeLabel,
|
|
223
224
|
name: `${t}-exclude`,
|
|
224
|
-
onChange:
|
|
225
|
+
onChange: P,
|
|
225
226
|
variant: "inline"
|
|
226
227
|
}
|
|
227
228
|
)
|
|
228
229
|
}
|
|
229
230
|
) : void 0,
|
|
230
231
|
$ ? /* @__PURE__ */ u(
|
|
231
|
-
|
|
232
|
+
he,
|
|
232
233
|
{
|
|
233
234
|
name: "options-search",
|
|
234
|
-
onChange:
|
|
235
|
+
onChange: Q,
|
|
235
236
|
placeholder: `Search ${g}...`,
|
|
236
237
|
value: x
|
|
237
238
|
}
|
|
@@ -241,23 +242,23 @@ const z = (p) => p.type === "combobox" || p.type === "multiSelect", xe = (p, f)
|
|
|
241
242
|
F,
|
|
242
243
|
{
|
|
243
244
|
"data-testid": "options-scrollable-menu",
|
|
244
|
-
ref:
|
|
245
|
+
ref: W,
|
|
245
246
|
scroll: "y",
|
|
246
247
|
width: "100%",
|
|
247
248
|
children: a?.map((e, s, m) => {
|
|
248
|
-
const
|
|
249
|
+
const o = e.type === "checkboxes", r = !o || (w[s]?.length ?? 0) > 0;
|
|
249
250
|
return /* @__PURE__ */ u(
|
|
250
251
|
"div",
|
|
251
252
|
{
|
|
252
253
|
style: { position: "relative" },
|
|
253
254
|
children: /* @__PURE__ */ V(
|
|
254
|
-
|
|
255
|
+
me,
|
|
255
256
|
{
|
|
256
257
|
$border: m.length > 1 && s > 0,
|
|
257
|
-
$overflow:
|
|
258
|
+
$overflow: o,
|
|
258
259
|
style: { padding: r ? R.spacing[0.875] : 0 },
|
|
259
260
|
children: [
|
|
260
|
-
f || e.showLabel === !0 || m.length > 1 && !
|
|
261
|
+
f || e.showLabel === !0 || m.length > 1 && !o ? /* @__PURE__ */ u(
|
|
261
262
|
Y,
|
|
262
263
|
{
|
|
263
264
|
color: R.palette.gray[f ? 800 : 400],
|
|
@@ -268,13 +269,13 @@ const z = (p) => p.type === "combobox" || p.type === "multiSelect", xe = (p, f)
|
|
|
268
269
|
}
|
|
269
270
|
) : void 0,
|
|
270
271
|
/* @__PURE__ */ u(
|
|
271
|
-
|
|
272
|
+
ce,
|
|
272
273
|
{
|
|
273
274
|
filterValue: b,
|
|
274
275
|
filteredItems: w[s] ?? [],
|
|
275
276
|
id: t,
|
|
276
277
|
label: g,
|
|
277
|
-
onChange:
|
|
278
|
+
onChange: U,
|
|
278
279
|
option: e
|
|
279
280
|
}
|
|
280
281
|
)
|
|
@@ -292,5 +293,5 @@ const z = (p) => p.type === "combobox" || p.type === "multiSelect", xe = (p, f)
|
|
|
292
293
|
);
|
|
293
294
|
});
|
|
294
295
|
export {
|
|
295
|
-
|
|
296
|
+
ve as OptionsMenu
|
|
296
297
|
};
|
|
@@ -134,6 +134,8 @@ interface IFilterProps {
|
|
|
134
134
|
onBodyClick?: (id: string, mode?: TIncludeExcludeMode) => void;
|
|
135
135
|
/** When true, suppresses the auto-injected search bar in the filters menu. */
|
|
136
136
|
hideMenuSearch?: boolean;
|
|
137
|
+
/** A filter shows its options search once a block has more items than this. Defaults to 7. */
|
|
138
|
+
optionsSearchThreshold?: number;
|
|
137
139
|
}
|
|
138
140
|
/** Imperative handle exposed by Filters via forwardRef. */
|
|
139
141
|
interface IFiltersImperativeHandle {
|
|
@@ -194,5 +196,6 @@ interface IFiltersContentProps {
|
|
|
194
196
|
readonly justify?: Property.JustifyContent;
|
|
195
197
|
readonly imperativeRef?: React.ForwardedRef<IFiltersImperativeHandle>;
|
|
196
198
|
readonly hideMenuSearch?: boolean;
|
|
199
|
+
readonly optionsSearchThreshold?: number;
|
|
197
200
|
}
|
|
198
201
|
export type { IActiveFilterProps, IFilterProps, IFiltersContentProps, IFiltersImperativeHandle, IFiltersOptions, IFilterOptionProps, IFilterItem, IFiltersMenuProps, IOptionsMenuProps, IOptionProps, TFilterType, TIncludeExcludeMode, };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ISkeletonProps, ISkeletonRowProps } from './types';
|
|
2
|
+
declare const Skeleton: (({ as, width, }: Readonly<ISkeletonProps>) => JSX.Element) & {
|
|
3
|
+
Row: ({ columns }: Readonly<ISkeletonRowProps>) => JSX.Element;
|
|
4
|
+
};
|
|
5
|
+
export { Skeleton };
|
|
6
|
+
export type { ISkeletonProps, ISkeletonRowProps };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { StyledSkeleton as i } from "./styles.js";
|
|
3
|
+
import { Container as r } from "../container/index.js";
|
|
4
|
+
const n = ({
|
|
5
|
+
as: e = "span",
|
|
6
|
+
width: t
|
|
7
|
+
}) => /* @__PURE__ */ o(
|
|
8
|
+
i,
|
|
9
|
+
{
|
|
10
|
+
$width: t,
|
|
11
|
+
"aria-hidden": "true",
|
|
12
|
+
as: e,
|
|
13
|
+
"data-testid": "skeleton"
|
|
14
|
+
}
|
|
15
|
+
), l = ({ columns: e }) => /* @__PURE__ */ o(r, { alignItems: "center", display: "flex", gap: 0.75, children: e.map(({ width: t }, a) => /* @__PURE__ */ o(n, { width: t }, a)) }), p = Object.assign(n, { Row: l });
|
|
16
|
+
export {
|
|
17
|
+
p as Skeleton
|
|
18
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react-vite';
|
|
2
|
+
import { ISkeletonProps, ISkeletonRowProps } from './types';
|
|
3
|
+
declare const config: Meta;
|
|
4
|
+
declare const Default: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, Readonly<ISkeletonProps>>;
|
|
5
|
+
declare const Row: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, Readonly<ISkeletonRowProps>>;
|
|
6
|
+
declare const InTable: StoryFn;
|
|
7
|
+
export { Default, InTable, Row };
|
|
8
|
+
export default config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
interface IStyledSkeletonProps {
|
|
2
|
+
$width?: number;
|
|
3
|
+
}
|
|
4
|
+
declare const StyledSkeleton: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$width"> & IStyledSkeletonProps, never> & Partial<Pick<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$width"> & IStyledSkeletonProps, never>>> & string;
|
|
5
|
+
export { StyledSkeleton };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { css as i, styled as o, keyframes as r } from "styled-components";
|
|
2
|
+
const e = r`
|
|
3
|
+
0% {
|
|
4
|
+
background-position: 200% 0;
|
|
5
|
+
}
|
|
6
|
+
100% {
|
|
7
|
+
background-position: -200% 0;
|
|
8
|
+
}
|
|
9
|
+
`, c = o.span`
|
|
10
|
+
${({ theme: a, $width: n }) => i`
|
|
11
|
+
animation: ${e} 1.6s ease-in-out infinite;
|
|
12
|
+
background-color: ${a.palette.gray[200]};
|
|
13
|
+
background-image: linear-gradient(
|
|
14
|
+
90deg,
|
|
15
|
+
${a.palette.gray[200]} 25%,
|
|
16
|
+
${a.palette.gray[100]} 50%,
|
|
17
|
+
${a.palette.gray[200]} 75%
|
|
18
|
+
);
|
|
19
|
+
background-size: 200% 100%;
|
|
20
|
+
border-radius: ${a.spacing[0.25]};
|
|
21
|
+
display: block;
|
|
22
|
+
height: ${a.spacing[0.875]};
|
|
23
|
+
width: ${n === void 0 ? "100%" : `calc(${n} * ${a.spacing[2.25]})`};
|
|
24
|
+
|
|
25
|
+
@media (prefers-reduced-motion: reduce) {
|
|
26
|
+
animation: none;
|
|
27
|
+
background-image: none;
|
|
28
|
+
}
|
|
29
|
+
`}
|
|
30
|
+
`;
|
|
31
|
+
export {
|
|
32
|
+
c as StyledSkeleton
|
|
33
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReactHTML } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Skeleton component props. The rectangle is as tall as a line of text, with
|
|
4
|
+
* rounded corners.
|
|
5
|
+
* @interface ISkeletonProps
|
|
6
|
+
* @property {number} [width] - The rectangle width as a multiple of
|
|
7
|
+
* `theme.spacing[2.25]`, so `2` is `4.5rem`; it fills its container by default.
|
|
8
|
+
* @property {keyof ReactHTML} [as] - The html tag to render, `span` by
|
|
9
|
+
* default.
|
|
10
|
+
*/
|
|
11
|
+
interface ISkeletonProps {
|
|
12
|
+
as?: keyof ReactHTML;
|
|
13
|
+
width?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Skeleton row component props.
|
|
17
|
+
* @interface ISkeletonRowProps
|
|
18
|
+
* @property {Array} columns - One rectangle per item, laid out left to right
|
|
19
|
+
* with an even gap; a width left out takes the Skeleton default.
|
|
20
|
+
*/
|
|
21
|
+
interface ISkeletonRowProps {
|
|
22
|
+
columns: Pick<ISkeletonProps, "width">[];
|
|
23
|
+
}
|
|
24
|
+
export type { ISkeletonProps, ISkeletonRowProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { IStepperProps, IStepperStep } from './types';
|
|
2
|
-
declare const Stepper: ({ completedLabel, currentStep, steps, }: Readonly<IStepperProps>) => JSX.Element;
|
|
2
|
+
declare const Stepper: ({ completedLabel, currentStep, fixedHeader, steps, }: Readonly<IStepperProps>) => JSX.Element;
|
|
3
3
|
export { Stepper };
|
|
4
4
|
export type { IStepperProps, IStepperStep };
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment as a } from "react";
|
|
3
|
-
import { VisuallyHidden as
|
|
4
|
-
import { useTheme as
|
|
5
|
-
import { StyledStepRow as
|
|
6
|
-
import { Icon as
|
|
3
|
+
import { VisuallyHidden as s } from "../../node_modules/react-aria/dist/private/visually-hidden/VisuallyHidden.js";
|
|
4
|
+
import { useTheme as h } from "styled-components";
|
|
5
|
+
import { StyledStepRow as u, StyledStepItem as f, StyledStepIndicator as g, StyledStepConnector as y } from "./styles.js";
|
|
6
|
+
import { Icon as S } from "../icon/index.js";
|
|
7
7
|
import "../typography/heading/index.js";
|
|
8
8
|
import "../typography/span/index.js";
|
|
9
|
-
import { Text as
|
|
10
|
-
const
|
|
9
|
+
import { Text as $ } from "../typography/text/index.js";
|
|
10
|
+
const T = (n, t) => n < t ? "completed" : n === t ? "current" : "upcoming", F = ({
|
|
11
11
|
completedLabel: n = "completed",
|
|
12
12
|
currentStep: t,
|
|
13
|
+
fixedHeader: d = !0,
|
|
13
14
|
steps: m
|
|
14
15
|
}) => {
|
|
15
|
-
const l =
|
|
16
|
+
const l = h();
|
|
16
17
|
return /* @__PURE__ */ c(a, { children: [
|
|
17
|
-
/* @__PURE__ */ e(
|
|
18
|
-
const i =
|
|
18
|
+
/* @__PURE__ */ e(u, { $fixed: d, children: m.map((r, o) => {
|
|
19
|
+
const i = T(o, t), p = i === "upcoming";
|
|
19
20
|
return /* @__PURE__ */ c(
|
|
20
|
-
|
|
21
|
+
f,
|
|
21
22
|
{
|
|
22
23
|
"aria-current": i === "current" ? "step" : void 0,
|
|
23
24
|
children: [
|
|
24
|
-
/* @__PURE__ */ e(
|
|
25
|
+
/* @__PURE__ */ e(g, { $status: i, children: i === "completed" ? /* @__PURE__ */ e(S, { icon: "check", iconSize: "sm", iconType: "fa-solid" }) : o + 1 }),
|
|
25
26
|
/* @__PURE__ */ c(
|
|
26
|
-
|
|
27
|
+
$,
|
|
27
28
|
{
|
|
28
29
|
color: p ? l.palette.gray[400] : l.palette.gray[800],
|
|
29
30
|
display: "inline",
|
|
@@ -32,11 +33,11 @@ const $ = (n, t) => n < t ? "completed" : n === t ? "current" : "upcoming", C =
|
|
|
32
33
|
whiteSpace: "nowrap",
|
|
33
34
|
children: [
|
|
34
35
|
r.title,
|
|
35
|
-
i === "completed" && /* @__PURE__ */ e(
|
|
36
|
+
i === "completed" && /* @__PURE__ */ e(s, { elementType: "span", children: ` (${n})` })
|
|
36
37
|
]
|
|
37
38
|
}
|
|
38
39
|
),
|
|
39
|
-
o < m.length - 1 && /* @__PURE__ */ e(
|
|
40
|
+
o < m.length - 1 && /* @__PURE__ */ e(y, { "aria-hidden": !0 })
|
|
40
41
|
]
|
|
41
42
|
},
|
|
42
43
|
r.title
|
|
@@ -46,5 +47,5 @@ const $ = (n, t) => n < t ? "completed" : n === t ? "current" : "upcoming", C =
|
|
|
46
47
|
] });
|
|
47
48
|
};
|
|
48
49
|
export {
|
|
49
|
-
|
|
50
|
+
F as Stepper
|
|
50
51
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { TStepperStatus } from './types';
|
|
2
|
-
declare const StyledStepRow: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('
|
|
2
|
+
declare const StyledStepRow: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "$fixed"> & {
|
|
3
|
+
$fixed: boolean;
|
|
4
|
+
}, never> & Partial<Pick<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "$fixed"> & {
|
|
5
|
+
$fixed: boolean;
|
|
6
|
+
}, never>>> & string;
|
|
3
7
|
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
8
|
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
9
|
$status: TStepperStatus;
|
|
@@ -24,6 +24,12 @@ const { getVariant: n } = a(
|
|
|
24
24
|
margin: 0;
|
|
25
25
|
margin-bottom: ${({ theme: t }) => t.spacing[1.5]};
|
|
26
26
|
padding: 0;
|
|
27
|
+
${({ theme: t, $fixed: o }) => o ? `
|
|
28
|
+
background-color: ${t.palette.white};
|
|
29
|
+
position: sticky;
|
|
30
|
+
top: 0;
|
|
31
|
+
z-index: 1;
|
|
32
|
+
` : ""}
|
|
27
33
|
`, p = i.li`
|
|
28
34
|
align-items: center;
|
|
29
35
|
display: flex;
|
|
@@ -15,11 +15,13 @@ interface IStepperStep {
|
|
|
15
15
|
* @interface IStepperProps
|
|
16
16
|
* @property { string } [completedLabel] - Screen-reader suffix announced after each completed step's title. Defaults to "completed".
|
|
17
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 { boolean } [fixedHeader] - Whether the progress row sticks to the top of the nearest scrolling ancestor while the step content scrolls under it. Defaults to true.
|
|
18
19
|
* @property { IStepperStep[] } steps - The steps, in order.
|
|
19
20
|
*/
|
|
20
21
|
interface IStepperProps {
|
|
21
22
|
completedLabel?: string;
|
|
22
23
|
currentStep: number;
|
|
24
|
+
fixedHeader?: boolean;
|
|
23
25
|
steps: IStepperStep[];
|
|
24
26
|
}
|
|
25
27
|
export type { IStepperProps, IStepperStep, TStepperStatus };
|