@primer/react 0.0.0-20260220194645 → 0.0.0-20260220195401
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/CHANGELOG.md +3 -1
- package/dist/ActionList/Description.d.ts.map +1 -1
- package/dist/ActionList/Description.js +90 -40
- package/dist/ActionList/Item.d.ts.map +1 -1
- package/dist/ActionList/Item.js +108 -63
- package/dist/ActionList/shared.d.ts +1 -0
- package/dist/ActionList/shared.d.ts.map +1 -1
- package/generated/components.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260220195401
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
### Patch Changes
|
|
10
10
|
|
|
11
|
+
- [#7529](https://github.com/primer/react/pull/7529) [`7b11c23`](https://github.com/primer/react/commit/7b11c23088e9887608d28b8198f3370425f4cd8a) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Add keyboard-accessible tooltip for truncated ActionList.Description
|
|
12
|
+
|
|
11
13
|
- Fake entry to force publishing
|
|
12
14
|
|
|
13
15
|
- [#7555](https://github.com/primer/react/pull/7555) [`64c2243`](https://github.com/primer/react/commit/64c2243d07fc580a5565493b917b27081ef6a191) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(useSlots): short-circuit iteration and skip filled slots
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Description.d.ts","sourceRoot":"","sources":["../../src/ActionList/Description.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"Description.d.ts","sourceRoot":"","sources":["../../src/ActionList/Description.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAA;AAG1D,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;IAE5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,gBAAgB,CAAC,KAAK,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,CAmE7F,CAAA"}
|
|
@@ -3,11 +3,12 @@ import React from 'react';
|
|
|
3
3
|
import { ItemContext } from './shared.js';
|
|
4
4
|
import classes from './ActionList.module.css.js';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
|
+
import { useResizeObserver } from '../hooks/useResizeObserver.js';
|
|
6
7
|
import { jsx } from 'react/jsx-runtime';
|
|
7
8
|
import Truncate from '../Truncate/Truncate.js';
|
|
8
9
|
|
|
9
10
|
const Description = t0 => {
|
|
10
|
-
const $ = c(
|
|
11
|
+
const $ = c(37);
|
|
11
12
|
let className;
|
|
12
13
|
let props;
|
|
13
14
|
let style;
|
|
@@ -37,7 +38,8 @@ const Description = t0 => {
|
|
|
37
38
|
const variant = t1 === undefined ? "inline" : t1;
|
|
38
39
|
const {
|
|
39
40
|
blockDescriptionId,
|
|
40
|
-
inlineDescriptionId
|
|
41
|
+
inlineDescriptionId,
|
|
42
|
+
setTruncatedText
|
|
41
43
|
} = React.useContext(ItemContext);
|
|
42
44
|
const containerRef = React.useRef(null);
|
|
43
45
|
const [computedTitle, setComputedTitle] = React.useState("");
|
|
@@ -65,66 +67,114 @@ const Description = t0 => {
|
|
|
65
67
|
}
|
|
66
68
|
React.useEffect(t2, t3);
|
|
67
69
|
const effectiveTitle = typeof props.children === "string" ? props.children : computedTitle;
|
|
70
|
+
const truncateEnabled = truncate && !!setTruncatedText;
|
|
71
|
+
let t4;
|
|
72
|
+
if ($[11] !== effectiveTitle || $[12] !== setTruncatedText) {
|
|
73
|
+
t4 = () => {
|
|
74
|
+
const el = containerRef.current;
|
|
75
|
+
if (!el || !setTruncatedText) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
setTruncatedText(el.scrollWidth > el.clientWidth ? effectiveTitle : undefined);
|
|
79
|
+
};
|
|
80
|
+
$[11] = effectiveTitle;
|
|
81
|
+
$[12] = setTruncatedText;
|
|
82
|
+
$[13] = t4;
|
|
83
|
+
} else {
|
|
84
|
+
t4 = $[13];
|
|
85
|
+
}
|
|
86
|
+
let t5;
|
|
87
|
+
if ($[14] !== effectiveTitle || $[15] !== truncateEnabled) {
|
|
88
|
+
t5 = [truncateEnabled, effectiveTitle];
|
|
89
|
+
$[14] = effectiveTitle;
|
|
90
|
+
$[15] = truncateEnabled;
|
|
91
|
+
$[16] = t5;
|
|
92
|
+
} else {
|
|
93
|
+
t5 = $[16];
|
|
94
|
+
}
|
|
95
|
+
useResizeObserver(t4, containerRef, t5);
|
|
96
|
+
let t6;
|
|
97
|
+
let t7;
|
|
98
|
+
if ($[17] !== effectiveTitle || $[18] !== setTruncatedText || $[19] !== truncateEnabled) {
|
|
99
|
+
t6 = () => {
|
|
100
|
+
if (!truncateEnabled || !containerRef.current) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const el_0 = containerRef.current;
|
|
104
|
+
setTruncatedText(el_0.scrollWidth > el_0.clientWidth ? effectiveTitle : undefined);
|
|
105
|
+
};
|
|
106
|
+
t7 = [truncateEnabled, effectiveTitle, setTruncatedText];
|
|
107
|
+
$[17] = effectiveTitle;
|
|
108
|
+
$[18] = setTruncatedText;
|
|
109
|
+
$[19] = truncateEnabled;
|
|
110
|
+
$[20] = t6;
|
|
111
|
+
$[21] = t7;
|
|
112
|
+
} else {
|
|
113
|
+
t6 = $[20];
|
|
114
|
+
t7 = $[21];
|
|
115
|
+
}
|
|
116
|
+
React.useEffect(t6, t7);
|
|
68
117
|
if (variant === "block" || !truncate) {
|
|
69
|
-
const
|
|
70
|
-
let
|
|
71
|
-
if ($[
|
|
72
|
-
|
|
73
|
-
$[
|
|
74
|
-
$[
|
|
118
|
+
const t8 = variant === "block" ? blockDescriptionId : inlineDescriptionId;
|
|
119
|
+
let t9;
|
|
120
|
+
if ($[22] !== className) {
|
|
121
|
+
t9 = clsx(className, classes.Description);
|
|
122
|
+
$[22] = className;
|
|
123
|
+
$[23] = t9;
|
|
75
124
|
} else {
|
|
76
|
-
|
|
125
|
+
t9 = $[23];
|
|
77
126
|
}
|
|
78
|
-
let
|
|
79
|
-
if ($[
|
|
80
|
-
|
|
81
|
-
id:
|
|
82
|
-
className:
|
|
127
|
+
let t10;
|
|
128
|
+
if ($[24] !== props.children || $[25] !== style || $[26] !== t8 || $[27] !== t9) {
|
|
129
|
+
t10 = /*#__PURE__*/jsx("span", {
|
|
130
|
+
id: t8,
|
|
131
|
+
className: t9,
|
|
83
132
|
style: style,
|
|
84
133
|
"data-component": "ActionList.Description",
|
|
85
134
|
children: props.children
|
|
86
135
|
});
|
|
87
|
-
$[
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
136
|
+
$[24] = props.children;
|
|
137
|
+
$[25] = style;
|
|
138
|
+
$[26] = t8;
|
|
139
|
+
$[27] = t9;
|
|
140
|
+
$[28] = t10;
|
|
92
141
|
} else {
|
|
93
|
-
|
|
142
|
+
t10 = $[28];
|
|
94
143
|
}
|
|
95
|
-
return
|
|
144
|
+
return t10;
|
|
96
145
|
} else {
|
|
97
|
-
let
|
|
98
|
-
if ($[
|
|
99
|
-
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
146
|
+
let t8;
|
|
147
|
+
if ($[29] !== className) {
|
|
148
|
+
t8 = clsx(className, classes.Description);
|
|
149
|
+
$[29] = className;
|
|
150
|
+
$[30] = t8;
|
|
102
151
|
} else {
|
|
103
|
-
|
|
152
|
+
t8 = $[30];
|
|
104
153
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
154
|
+
const t9 = setTruncatedText ? "" : effectiveTitle;
|
|
155
|
+
let t10;
|
|
156
|
+
if ($[31] !== inlineDescriptionId || $[32] !== props.children || $[33] !== style || $[34] !== t8 || $[35] !== t9) {
|
|
157
|
+
t10 = /*#__PURE__*/jsx(Truncate, {
|
|
108
158
|
ref: containerRef,
|
|
109
159
|
id: inlineDescriptionId,
|
|
110
|
-
className:
|
|
160
|
+
className: t8,
|
|
111
161
|
style: style,
|
|
112
|
-
title:
|
|
162
|
+
title: t9,
|
|
113
163
|
inline: true,
|
|
114
164
|
maxWidth: "100%",
|
|
115
165
|
"data-component": "ActionList.Description",
|
|
116
166
|
children: props.children
|
|
117
167
|
});
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
168
|
+
$[31] = inlineDescriptionId;
|
|
169
|
+
$[32] = props.children;
|
|
170
|
+
$[33] = style;
|
|
171
|
+
$[34] = t8;
|
|
172
|
+
$[35] = t9;
|
|
173
|
+
$[36] = t10;
|
|
124
174
|
} else {
|
|
125
|
-
|
|
175
|
+
t10 = $[36];
|
|
126
176
|
}
|
|
127
|
-
return
|
|
177
|
+
return t10;
|
|
128
178
|
}
|
|
129
179
|
};
|
|
130
180
|
Description.__SLOT__ = Symbol('ActionList.Description');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../src/ActionList/Item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../src/ActionList/Item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAA;AAqBrC,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA;AA0BD,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAEpD,CAAA;AAkTD,QAAA,MAAM,IAAI,IA1Ra,EAAE,SAAS,KAAK,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6RjD,CAAA;AAEF,OAAO,EAAC,IAAI,EAAC,CAAA"}
|
package/dist/ActionList/Item.js
CHANGED
|
@@ -15,8 +15,44 @@ import VisuallyHidden from '../_VisuallyHidden.js';
|
|
|
15
15
|
import classes from './ActionList.module.css.js';
|
|
16
16
|
import { clsx } from 'clsx';
|
|
17
17
|
import { fixedForwardRef } from '../utils/modern-polymorphic.js';
|
|
18
|
+
import { TooltipContext, Tooltip } from '../TooltipV2/Tooltip.js';
|
|
18
19
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
19
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Stable wrapper that keeps Tooltip in the tree for button-semantic items
|
|
23
|
+
* to avoid remount cycles when truncation state changes.
|
|
24
|
+
* For non-button-semantic items, renders children directly.
|
|
25
|
+
*/
|
|
26
|
+
function ConditionalTooltip(t0) {
|
|
27
|
+
const $ = c(4);
|
|
28
|
+
const {
|
|
29
|
+
text,
|
|
30
|
+
enabled,
|
|
31
|
+
children
|
|
32
|
+
} = t0;
|
|
33
|
+
if (!enabled) {
|
|
34
|
+
return children;
|
|
35
|
+
}
|
|
36
|
+
const t1 = text || "";
|
|
37
|
+
const t2 = !text;
|
|
38
|
+
let t3;
|
|
39
|
+
if ($[0] !== children || $[1] !== t1 || $[2] !== t2) {
|
|
40
|
+
t3 = /*#__PURE__*/jsx(Tooltip, {
|
|
41
|
+
text: t1,
|
|
42
|
+
direction: "e",
|
|
43
|
+
delay: "medium",
|
|
44
|
+
_privateDisableTooltip: t2,
|
|
45
|
+
children: children
|
|
46
|
+
});
|
|
47
|
+
$[0] = children;
|
|
48
|
+
$[1] = t1;
|
|
49
|
+
$[2] = t2;
|
|
50
|
+
$[3] = t3;
|
|
51
|
+
} else {
|
|
52
|
+
t3 = $[3];
|
|
53
|
+
}
|
|
54
|
+
return t3;
|
|
55
|
+
}
|
|
20
56
|
const SubItem = t0 => {
|
|
21
57
|
const $ = c(2);
|
|
22
58
|
const {
|
|
@@ -218,6 +254,7 @@ const UnwrappedItem = ({
|
|
|
218
254
|
const blockDescriptionId = `${itemId}--block-description`;
|
|
219
255
|
const trailingVisualId = `${itemId}--trailing-visual`;
|
|
220
256
|
const inactiveWarningId = inactive && !showInactiveIndicator ? `${itemId}--warning-message` : undefined;
|
|
257
|
+
const [truncatedText, setTruncatedText] = React.useState(undefined);
|
|
221
258
|
const DefaultItemWrapper = listSemantics ? DivItemContainerNoBox : ButtonItemContainerNoBox;
|
|
222
259
|
const ItemWrapper = _PrivateItemWrapper || DefaultItemWrapper;
|
|
223
260
|
|
|
@@ -238,8 +275,8 @@ const UnwrappedItem = ({
|
|
|
238
275
|
'data-inactive': inactive ? true : undefined,
|
|
239
276
|
'data-loading': loading && !inactive ? true : undefined,
|
|
240
277
|
tabIndex: focusable ? undefined : 0,
|
|
241
|
-
'aria-labelledby': `${labelId} ${slots.trailingVisual ? trailingVisualId : ''}
|
|
242
|
-
'aria-describedby': [slots.description && descriptionVariant === 'block' ? blockDescriptionId : undefined, inactiveWarningId !== null && inactiveWarningId !== void 0 ? inactiveWarningId : undefined].filter(String).join(' ').trim() || undefined,
|
|
278
|
+
'aria-labelledby': `${labelId} ${slots.trailingVisual ? trailingVisualId : ''}`,
|
|
279
|
+
'aria-describedby': [slots.description && descriptionVariant === 'block' ? blockDescriptionId : undefined, slots.description && descriptionVariant === 'inline' ? inlineDescriptionId : undefined, inactiveWarningId !== null && inactiveWarningId !== void 0 ? inactiveWarningId : undefined].filter(String).join(' ').trim() || undefined,
|
|
243
280
|
...(includeSelectionAttribute && {
|
|
244
281
|
[itemSelectionAttribute]: selected
|
|
245
282
|
}),
|
|
@@ -269,68 +306,76 @@ const UnwrappedItem = ({
|
|
|
269
306
|
inactive: Boolean(inactiveText),
|
|
270
307
|
inlineDescriptionId,
|
|
271
308
|
blockDescriptionId,
|
|
272
|
-
trailingVisualId
|
|
309
|
+
trailingVisualId,
|
|
310
|
+
setTruncatedText: buttonSemantics ? setTruncatedText : undefined
|
|
273
311
|
},
|
|
274
|
-
children: /*#__PURE__*/
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
"
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
className: classes.
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
312
|
+
children: /*#__PURE__*/jsx(ConditionalTooltip, {
|
|
313
|
+
text: truncatedText,
|
|
314
|
+
enabled: buttonSemantics,
|
|
315
|
+
children: /*#__PURE__*/jsx("li", {
|
|
316
|
+
...containerProps,
|
|
317
|
+
ref: listSemantics ? forwardedRef : null,
|
|
318
|
+
"data-variant": variant === 'danger' ? variant : undefined,
|
|
319
|
+
"data-active": active ? true : undefined,
|
|
320
|
+
"data-inactive": inactiveText ? true : undefined,
|
|
321
|
+
"data-is-disabled": disabled ? true : undefined,
|
|
322
|
+
"data-has-subitem": slots.subItem ? true : undefined,
|
|
323
|
+
"data-has-description": slots.description ? true : false,
|
|
324
|
+
className: clsx(classes.ActionListItem, className),
|
|
325
|
+
children: /*#__PURE__*/jsxs(TooltipContext.Provider, {
|
|
326
|
+
value: {},
|
|
327
|
+
children: [/*#__PURE__*/jsxs(ItemWrapper, {
|
|
328
|
+
...wrapperProps,
|
|
329
|
+
className: classes.ActionListContent,
|
|
330
|
+
"data-size": size
|
|
331
|
+
// @ts-ignore: ItemWrapper is polymorphic and the ref type depends on the rendered element ('button' or 'li')
|
|
332
|
+
,
|
|
333
|
+
ref: forwardedRef,
|
|
334
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
335
|
+
className: classes.Spacer
|
|
336
|
+
}), /*#__PURE__*/jsx(Selection, {
|
|
337
|
+
selected: selected,
|
|
338
|
+
className: classes.LeadingAction
|
|
339
|
+
}), /*#__PURE__*/jsx(VisualOrIndicator, {
|
|
340
|
+
inactiveText: showInactiveIndicator ? inactiveText : undefined,
|
|
341
|
+
itemHasLeadingVisual: Boolean(slots.leadingVisual),
|
|
342
|
+
labelId: labelId,
|
|
343
|
+
loading: loading,
|
|
344
|
+
position: "leading",
|
|
345
|
+
children: slots.leadingVisual
|
|
346
|
+
}), /*#__PURE__*/jsxs("span", {
|
|
347
|
+
className: classes.ActionListSubContent,
|
|
348
|
+
"data-component": "ActionList.Item--DividerContainer",
|
|
349
|
+
children: [/*#__PURE__*/jsxs(ConditionalWrapper, {
|
|
350
|
+
if: !!slots.description,
|
|
351
|
+
className: classes.ItemDescriptionWrap,
|
|
352
|
+
"data-description-variant": descriptionVariant,
|
|
353
|
+
children: [/*#__PURE__*/jsxs("span", {
|
|
354
|
+
id: labelId,
|
|
355
|
+
className: classes.ItemLabel,
|
|
356
|
+
children: [childrenWithoutSlots, loading === true && !inactive && /*#__PURE__*/jsx(VisuallyHidden, {
|
|
357
|
+
children: "Loading"
|
|
358
|
+
})]
|
|
359
|
+
}), slots.description]
|
|
360
|
+
}), /*#__PURE__*/jsx(VisualOrIndicator, {
|
|
361
|
+
inactiveText: showInactiveIndicator ? inactiveText : undefined,
|
|
362
|
+
itemHasLeadingVisual: Boolean(slots.leadingVisual),
|
|
363
|
+
labelId: labelId,
|
|
364
|
+
loading: loading,
|
|
365
|
+
position: "trailing",
|
|
366
|
+
children: trailingVisual
|
|
367
|
+
}),
|
|
368
|
+
// If the item is inactive, but it's not in an overlay (e.g. ActionMenu, SelectPanel),
|
|
369
|
+
// render the inactive warning message directly in the item.
|
|
370
|
+
!showInactiveIndicator && inactiveText ? /*#__PURE__*/jsx("span", {
|
|
371
|
+
className: classes.InactiveWarning,
|
|
372
|
+
id: inactiveWarningId,
|
|
373
|
+
children: inactiveText
|
|
374
|
+
}) : null]
|
|
375
|
+
})]
|
|
376
|
+
}), !inactive && !loading && !menuContext && Boolean(slots.trailingAction) && slots.trailingAction, slots.subItem]
|
|
377
|
+
})
|
|
378
|
+
})
|
|
334
379
|
})
|
|
335
380
|
});
|
|
336
381
|
};
|
|
@@ -77,6 +77,7 @@ export type ItemContext = Pick<ActionListItemProps<React.ElementType>, 'variant'
|
|
|
77
77
|
blockDescriptionId?: string;
|
|
78
78
|
trailingVisualId?: string;
|
|
79
79
|
inactive?: boolean;
|
|
80
|
+
setTruncatedText?: (text: string | undefined) => void;
|
|
80
81
|
};
|
|
81
82
|
export declare const ItemContext: React.Context<ItemContext>;
|
|
82
83
|
export declare const getVariantStyles: (variant: ActionListItemProps<React.ElementType>["variant"], disabled: ActionListItemProps<React.ElementType>["disabled"], inactive?: boolean) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/ActionList/shared.ts"],"names":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B,GAC3B,SAAS,mBAAmB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,EAC1D,UAAU,mBAAmB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,EAC5D,WAAW,OAAO;;;;;;;;;;CAkCnB,CAAA;AAED,eAAO,MAAM,eAAe,SAAS,CAAA;AAErC,MAAM,MAAM,eAAe,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,IAAI,IAAI,gBAAgB,CACjF,EAAE,EACF,IAAI,EACJ,KAAK,CAAC,iBAAiB,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,kBAAkB,GAAG,MAAM,CAAA;IAC/C;;OAEG;IACH,gBAAgB,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAA;IAClD;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAC,CACH,CAAA;AAED,KAAK,YAAY,GAAG,IAAI,CACtB,eAAe,CAAC,KAAK,CAAC,WAAW,CAAC,EAClC,SAAS,GAAG,kBAAkB,GAAG,cAAc,GAAG,MAAM,CACzD,GAAG;IACF,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,6BAAwC,CAAA"}
|
|
@@ -3244,8 +3244,8 @@
|
|
|
3244
3244
|
"code": "() => {\n const [tokens, setTokens] = useState([...mockTokens])\n const onTokenRemove = (tokenId: string | number) => {\n setTokens(\n tokens.filter((token: { id: string | number }) => token.id !== tokenId),\n )\n }\n return (\n <div className={classes.GridContainer}>\n <FormControl>\n <FormControl.Label id=\"form-label\">\n TextInputWithTokens\n </FormControl.Label>\n <TextInputWithTokens onTokenRemove={onTokenRemove} tokens={tokens} />\n </FormControl>\n <FormControl>\n <FormControl.Label id=\"autocomplete-label\">\n Autocomplete\n </FormControl.Label>\n <Autocomplete>\n <Autocomplete.Input block />\n <Autocomplete.Overlay>\n <Autocomplete.Menu\n aria-labelledby=\"autocomplete-label\"\n items={[\n {\n text: 'css',\n id: '0',\n },\n {\n text: 'css-in-js',\n id: '1',\n },\n {\n text: 'styled-system',\n id: '2',\n },\n {\n text: 'javascript',\n id: '3',\n },\n {\n text: 'typescript',\n id: '4',\n },\n {\n text: 'react',\n id: '5',\n },\n {\n text: 'design-systems',\n id: '6',\n },\n ]}\n selectedItemIds={[]}\n />\n </Autocomplete.Overlay>\n </Autocomplete>\n </FormControl>\n <FormControl>\n <FormControl.Label>Select</FormControl.Label>\n <Select>\n <Select.Option value=\"figma\">Figma</Select.Option>\n <Select.Option value=\"css\">Primer CSS</Select.Option>\n <Select.Option value=\"prc\">Primer React components</Select.Option>\n <Select.Option value=\"pvc\">Primer ViewComponents</Select.Option>\n </Select>\n </FormControl>\n <FormControl>\n <FormControl.Label>Textarea</FormControl.Label>\n <Textarea />\n </FormControl>\n </div>\n )\n}"
|
|
3245
3245
|
},
|
|
3246
3246
|
{
|
|
3247
|
-
"id": "components-formcontrol-features--with-custom-input",
|
|
3248
|
-
"code": "() => {\n const [value, setValue] = React.useState('mona lisa')\n const [validationResult, setValidationResult] = React.useState('')\n const doesValueContainSpaces = (inputValue: string) => /\\s/g.test(inputValue)\n const handleInputChange = (e: {\n currentTarget: {\n value: React.SetStateAction<string>\n }\n }) => {\n setValue(e.currentTarget.value)\n }\n React.useEffect(() => {\n if (doesValueContainSpaces(value)) {\n setValidationResult('noSpaces')\n } else if (value) {\n setValidationResult('validName')\n }\n }, [value])\n return (\n <div className={classes.GridContainer}>\n <FormControl>\n <FormControl.Label htmlFor=\"custom-input\">\n GitHub handle\n </FormControl.Label>\n <CustomTextInput\n id=\"custom-input\"\n aria-describedby=\"custom-input-
|
|
3247
|
+
"id": "components-formcontrol-features--form-control-with-custom-input",
|
|
3248
|
+
"code": "() => {\n const [value, setValue] = React.useState('mona lisa')\n const [validationResult, setValidationResult] = React.useState('')\n const doesValueContainSpaces = (inputValue: string) => /\\s/g.test(inputValue)\n const handleInputChange = (e: {\n currentTarget: {\n value: React.SetStateAction<string>\n }\n }) => {\n setValue(e.currentTarget.value)\n }\n React.useEffect(() => {\n if (doesValueContainSpaces(value)) {\n setValidationResult('noSpaces')\n } else if (value) {\n setValidationResult('validName')\n }\n }, [value])\n return (\n <div className={classes.GridContainer}>\n <FormControl>\n <FormControl.Label htmlFor=\"custom-input\">\n GitHub handle\n </FormControl.Label>\n <CustomTextInput\n id=\"custom-input\"\n aria-describedby=\"custom-input-caption custom-input-validation\"\n aria-invalid={validationResult === 'noSpaces'}\n onChange={handleInputChange}\n />\n {validationResult === 'noSpaces' && (\n <FormControl.Validation id=\"custom-input-validation\" variant=\"error\">\n GitHub handles cannot contain spaces\n </FormControl.Validation>\n )}\n {validationResult === 'validName' && (\n <FormControl.Validation\n id=\"custom-input-validation\"\n variant=\"success\"\n >\n Valid name\n </FormControl.Validation>\n )}\n <FormControl.Caption id=\"custom-input-caption\">\n With or without "@". For example "monalisa" or\n "@monalisa"\n </FormControl.Caption>\n </FormControl>\n\n <CheckboxGroup>\n <CheckboxGroup.Label>Checkboxes</CheckboxGroup.Label>\n <FormControl layout=\"horizontal\">\n <CustomCheckboxInput\n id=\"custom-checkbox-one\"\n aria-describedby=\"custom-checkbox-one-caption\"\n value=\"checkOne\"\n />\n <FormControl.Label htmlFor=\"custom-checkbox-one\">\n Checkbox one\n </FormControl.Label>\n <FormControl.Caption id=\"custom-checkbox-one-caption\">\n Hint text for checkbox one\n </FormControl.Caption>\n </FormControl>\n <FormControl layout=\"horizontal\">\n <CustomCheckboxInput\n id=\"custom-checkbox-two\"\n aria-describedby=\"custom-checkbox-two-caption\"\n value=\"checkTwo\"\n />\n <FormControl.Label htmlFor=\"custom-checkbox-two\">\n Checkbox two\n </FormControl.Label>\n <FormControl.Caption id=\"custom-checkbox-two-caption\">\n Hint text for checkbox two\n </FormControl.Caption>\n </FormControl>\n </CheckboxGroup>\n </div>\n )\n}"
|
|
3249
3249
|
},
|
|
3250
3250
|
{
|
|
3251
3251
|
"id": "components-formcontrol-features--with-checkbox-and-radio-inputs",
|
package/package.json
CHANGED