@zendeskgarden/react-forms 9.15.8 → 9.16.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/esm/elements/Checkbox.js +1 -0
- package/dist/esm/elements/ClearableInput.js +111 -0
- package/dist/esm/elements/FileUpload.js +1 -0
- package/dist/esm/elements/Input.js +4 -2
- package/dist/esm/elements/MediaInput.js +1 -0
- package/dist/esm/elements/Radio.js +1 -0
- package/dist/esm/elements/Range.js +1 -0
- package/dist/esm/elements/Select.js +1 -0
- package/dist/esm/elements/Textarea.js +1 -0
- package/dist/esm/elements/Toggle.js +1 -0
- package/dist/esm/elements/common/Field.js +6 -2
- package/dist/esm/elements/common/Fieldset.js +1 -0
- package/dist/esm/elements/common/Hint.js +1 -0
- package/dist/esm/elements/common/Label.js +9 -1
- package/dist/esm/elements/common/Legend.js +1 -0
- package/dist/esm/elements/common/Message.js +1 -0
- package/dist/esm/elements/common/MessageIcon.js +1 -0
- package/dist/esm/elements/faux-input/FauxInput.js +1 -0
- package/dist/esm/elements/faux-input/components/EndIcon.js +1 -0
- package/dist/esm/elements/faux-input/components/StartIcon.js +1 -0
- package/dist/esm/elements/file-list/FileList.js +1 -0
- package/dist/esm/elements/file-list/components/Close.js +1 -0
- package/dist/esm/elements/file-list/components/Delete.js +1 -0
- package/dist/esm/elements/file-list/components/File.js +1 -0
- package/dist/esm/elements/file-list/components/Item.js +1 -0
- package/dist/esm/elements/input-group/InputGroup.js +26 -49
- package/dist/esm/elements/tiles/components/Description.js +1 -0
- package/dist/esm/elements/tiles/components/Icon.js +1 -0
- package/dist/esm/elements/tiles/components/Label.js +1 -0
- package/dist/esm/elements/tiles/components/Tile.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/x-stroke.svg.js +6 -6
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js +6 -6
- package/dist/esm/styled/checkbox/StyledCheckHint.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckInput.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckLabel.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckMessage.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckSvg.js +1 -1
- package/dist/esm/styled/checkbox/StyledDashSvg.js +1 -1
- package/dist/esm/styled/common/StyledField.js +1 -1
- package/dist/esm/styled/common/StyledFieldset.js +1 -1
- package/dist/esm/styled/common/StyledHint.js +1 -1
- package/dist/esm/styled/common/StyledLabel.js +1 -1
- package/dist/esm/styled/common/StyledLegend.js +1 -1
- package/dist/esm/styled/common/StyledMessage.js +1 -1
- package/dist/esm/styled/common/StyledMessageIcon.js +1 -1
- package/dist/esm/styled/file-list/StyledFile.js +1 -1
- package/dist/esm/styled/file-list/StyledFileClose.js +1 -1
- package/dist/esm/styled/file-list/StyledFileDelete.js +1 -1
- package/dist/esm/styled/file-list/StyledFileIcon.js +1 -1
- package/dist/esm/styled/file-list/StyledFileList.js +1 -1
- package/dist/esm/styled/file-list/StyledFileListItem.js +1 -1
- package/dist/esm/styled/file-upload/StyledFileUpload.js +1 -1
- package/dist/esm/styled/input-group/StyledClearableInput.js +16 -0
- package/dist/esm/styled/input-group/StyledInputGroup.js +97 -5
- package/dist/esm/styled/radio/StyledRadioHint.js +1 -1
- package/dist/esm/styled/radio/StyledRadioInput.js +1 -1
- package/dist/esm/styled/radio/StyledRadioLabel.js +1 -1
- package/dist/esm/styled/radio/StyledRadioMessage.js +1 -1
- package/dist/esm/styled/radio/StyledRadioSvg.js +1 -1
- package/dist/esm/styled/range/StyledRangeInput.js +1 -1
- package/dist/esm/styled/select/StyledSelect.js +1 -1
- package/dist/esm/styled/select/StyledSelectWrapper.js +1 -1
- package/dist/esm/styled/text/StyledTextFauxInput.js +1 -1
- package/dist/esm/styled/text/StyledTextInput.js +2 -2
- package/dist/esm/styled/text/StyledTextMediaFigure.js +1 -1
- package/dist/esm/styled/text/StyledTextMediaInput.js +1 -1
- package/dist/esm/styled/text/StyledTextarea.js +1 -1
- package/dist/esm/styled/tiles/StyledTile.js +1 -1
- package/dist/esm/styled/tiles/StyledTileDescription.js +1 -1
- package/dist/esm/styled/tiles/StyledTileIcon.js +1 -1
- package/dist/esm/styled/tiles/StyledTileLabel.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleHint.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleInput.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleLabel.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleMessage.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleSvg.js +1 -1
- package/dist/esm/utils/useInputGroupContext.js +53 -2
- package/dist/index.cjs.js +362 -91
- package/dist/typings/elements/ClearableInput.d.ts +12 -0
- package/dist/typings/index.d.ts +3 -1
- package/dist/typings/styled/index.d.ts +1 -0
- package/dist/typings/styled/input-group/StyledClearableInput.d.ts +12 -0
- package/dist/typings/styled/input-group/StyledInputGroup.d.ts +4 -0
- package/dist/typings/types/index.d.ts +22 -3
- package/dist/typings/utils/useFieldContext.d.ts +2 -0
- package/dist/typings/utils/useInputGroupContext.d.ts +22 -0
- package/package.json +4 -3
package/dist/index.cjs.js
CHANGED
|
@@ -14,6 +14,7 @@ var polished = require('polished');
|
|
|
14
14
|
var PropTypes = require('prop-types');
|
|
15
15
|
var containerUtilities = require('@zendeskgarden/container-utilities');
|
|
16
16
|
var reactMergeRefs = require('react-merge-refs');
|
|
17
|
+
var reactButtons = require('@zendeskgarden/react-buttons');
|
|
17
18
|
|
|
18
19
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
20
|
|
|
@@ -48,7 +49,7 @@ const useFieldContext = () => {
|
|
|
48
49
|
const COMPONENT_ID$G = 'forms.field';
|
|
49
50
|
const StyledField = styled__default.default.div.attrs({
|
|
50
51
|
'data-garden-id': COMPONENT_ID$G,
|
|
51
|
-
'data-garden-version': '9.
|
|
52
|
+
'data-garden-version': '9.16.0'
|
|
52
53
|
}).withConfig({
|
|
53
54
|
displayName: "StyledField",
|
|
54
55
|
componentId: "sc-12gzfsu-0"
|
|
@@ -58,7 +59,7 @@ const COMPONENT_ID$F = 'forms.fieldset';
|
|
|
58
59
|
const StyledFieldset = styled__default.default(StyledField).attrs({
|
|
59
60
|
as: 'fieldset',
|
|
60
61
|
'data-garden-id': COMPONENT_ID$F,
|
|
61
|
-
'data-garden-version': '9.
|
|
62
|
+
'data-garden-version': '9.16.0'
|
|
62
63
|
}).withConfig({
|
|
63
64
|
displayName: "StyledFieldset",
|
|
64
65
|
componentId: "sc-1vr4mxv-0"
|
|
@@ -67,7 +68,7 @@ const StyledFieldset = styled__default.default(StyledField).attrs({
|
|
|
67
68
|
const COMPONENT_ID$E = 'forms.input_label';
|
|
68
69
|
const StyledLabel = styled__default.default.label.attrs(props => ({
|
|
69
70
|
'data-garden-id': props['data-garden-id'] || COMPONENT_ID$E,
|
|
70
|
-
'data-garden-version': props['data-garden-version'] || '9.
|
|
71
|
+
'data-garden-version': props['data-garden-version'] || '9.16.0'
|
|
71
72
|
})).withConfig({
|
|
72
73
|
displayName: "StyledLabel",
|
|
73
74
|
componentId: "sc-2utmsz-0"
|
|
@@ -80,7 +81,7 @@ const COMPONENT_ID$D = 'forms.fieldset_legend';
|
|
|
80
81
|
const StyledLegend = styled__default.default(StyledLabel).attrs({
|
|
81
82
|
as: 'legend',
|
|
82
83
|
'data-garden-id': COMPONENT_ID$D,
|
|
83
|
-
'data-garden-version': '9.
|
|
84
|
+
'data-garden-version': '9.16.0'
|
|
84
85
|
}).withConfig({
|
|
85
86
|
displayName: "StyledLegend",
|
|
86
87
|
componentId: "sc-6s0zwq-0"
|
|
@@ -89,7 +90,7 @@ const StyledLegend = styled__default.default(StyledLabel).attrs({
|
|
|
89
90
|
const COMPONENT_ID$C = 'forms.input_hint';
|
|
90
91
|
const StyledHint = styled__default.default.div.attrs(props => ({
|
|
91
92
|
'data-garden-id': props['data-garden-id'] || COMPONENT_ID$C,
|
|
92
|
-
'data-garden-version': props['data-garden-version'] || '9.
|
|
93
|
+
'data-garden-version': props['data-garden-version'] || '9.16.0'
|
|
93
94
|
})).withConfig({
|
|
94
95
|
displayName: "StyledHint",
|
|
95
96
|
componentId: "sc-17c2wu8-0"
|
|
@@ -101,7 +102,7 @@ const StyledHint = styled__default.default.div.attrs(props => ({
|
|
|
101
102
|
const COMPONENT_ID$B = 'forms.input_message_icon';
|
|
102
103
|
const StyledMessageIcon = styled__default.default(reactTheming.StyledBaseIcon).attrs({
|
|
103
104
|
'data-garden-id': COMPONENT_ID$B,
|
|
104
|
-
'data-garden-version': '9.
|
|
105
|
+
'data-garden-version': '9.16.0'
|
|
105
106
|
}).withConfig({
|
|
106
107
|
displayName: "StyledMessageIcon",
|
|
107
108
|
componentId: "sc-1ph2gba-0"
|
|
@@ -140,7 +141,7 @@ const sizeStyles$g = ({
|
|
|
140
141
|
};
|
|
141
142
|
const StyledMessage = styled__default.default.div.attrs(props => ({
|
|
142
143
|
'data-garden-id': props['data-garden-id'] || COMPONENT_ID$A,
|
|
143
|
-
'data-garden-version': props['data-garden-version'] || '9.
|
|
144
|
+
'data-garden-version': props['data-garden-version'] || '9.16.0'
|
|
144
145
|
})).withConfig({
|
|
145
146
|
displayName: "StyledMessage",
|
|
146
147
|
componentId: "sc-30hgg7-0"
|
|
@@ -269,8 +270,8 @@ const sizeStyles$f = ({
|
|
|
269
270
|
return styled.css(["padding:", ";min-height:", ";line-height:", ";font-size:", ";&::-ms-browse{font-size:", ";}&[type='date'],&[type='datetime-local'],&[type='file'],&[type='month'],&[type='time'],&[type='week']{max-height:", ";}&[type='file']{line-height:1;}@supports (-ms-ime-align:auto){&[type='color']{padding:", ";}}&::-moz-color-swatch{margin-top:", ";margin-left:", ";width:calc(100% + ", ");height:", ";}&::-webkit-calendar-picker-indicator{background-position:center;background-size:", ";padding:0;width:", ";height:", ";}&::-webkit-color-swatch{margin:", " ", ";}", ":not([hidden]) + &&,", " + &&,", " + &&,&& + ", ",&& ~ ", "{margin-top:", "px;}"], padding, $isBare ? '1em' : height, reactTheming.getLineHeight(lineHeight, fontSize), fontSize, browseFontSize, height, $isCompact ? '0 2px' : '1px 3px', swatchMarginVertical, swatchMarginHorizontal, polished.math(`${swatchMarginHorizontal} * -2`), swatchHeight, calendarPickerBackgroundSize, calendarPickerSize, calendarPickerSize, swatchMarginVertical, swatchMarginHorizontal, StyledLabel, StyledHint, StyledMessage, StyledHint, StyledMessage, theme.space.base * ($isCompact ? 1 : 2));
|
|
270
271
|
};
|
|
271
272
|
const StyledTextInput = styled__default.default.input.attrs(props => ({
|
|
272
|
-
'data-garden-id': COMPONENT_ID$z,
|
|
273
|
-
'data-garden-version': '9.
|
|
273
|
+
'data-garden-id': props['data-garden-id'] || COMPONENT_ID$z,
|
|
274
|
+
'data-garden-version': '9.16.0',
|
|
274
275
|
'aria-invalid': isInvalid(props.$validation)
|
|
275
276
|
})).withConfig({
|
|
276
277
|
displayName: "StyledTextInput",
|
|
@@ -290,7 +291,7 @@ const hiddenStyles = `
|
|
|
290
291
|
const StyledTextarea = styled__default.default(StyledTextInput).attrs({
|
|
291
292
|
as: 'textarea',
|
|
292
293
|
'data-garden-id': COMPONENT_ID$y,
|
|
293
|
-
'data-garden-version': '9.
|
|
294
|
+
'data-garden-version': '9.16.0'
|
|
294
295
|
}).withConfig({
|
|
295
296
|
displayName: "StyledTextarea",
|
|
296
297
|
componentId: "sc-wxschl-0"
|
|
@@ -344,7 +345,7 @@ const sizeStyles$e = props => {
|
|
|
344
345
|
};
|
|
345
346
|
const StyledTextMediaFigure = styled__default.default(reactTheming.StyledBaseIcon).attrs({
|
|
346
347
|
'data-garden-id': COMPONENT_ID$x,
|
|
347
|
-
'data-garden-version': '9.
|
|
348
|
+
'data-garden-version': '9.16.0'
|
|
348
349
|
}).withConfig({
|
|
349
350
|
displayName: "StyledTextMediaFigure",
|
|
350
351
|
componentId: "sc-1qepknj-0"
|
|
@@ -397,7 +398,7 @@ const StyledTextFauxInput = styled__default.default(StyledTextInput).attrs(props
|
|
|
397
398
|
'aria-readonly': props.$isReadOnly,
|
|
398
399
|
'aria-disabled': props.$isDisabled,
|
|
399
400
|
'data-garden-id': COMPONENT_ID$w,
|
|
400
|
-
'data-garden-version': '9.
|
|
401
|
+
'data-garden-version': '9.16.0'
|
|
401
402
|
})).withConfig({
|
|
402
403
|
displayName: "StyledTextFauxInput",
|
|
403
404
|
componentId: "sc-yqw7j9-0"
|
|
@@ -406,7 +407,7 @@ const StyledTextFauxInput = styled__default.default(StyledTextInput).attrs(props
|
|
|
406
407
|
const COMPONENT_ID$v = 'forms.media_input';
|
|
407
408
|
const StyledTextMediaInput = styled__default.default(StyledTextInput).attrs({
|
|
408
409
|
'data-garden-id': COMPONENT_ID$v,
|
|
409
|
-
'data-garden-version': '9.
|
|
410
|
+
'data-garden-version': '9.16.0',
|
|
410
411
|
$isBare: true
|
|
411
412
|
}).withConfig({
|
|
412
413
|
displayName: "StyledTextMediaInput",
|
|
@@ -414,22 +415,212 @@ const StyledTextMediaInput = styled__default.default(StyledTextInput).attrs({
|
|
|
414
415
|
})(["flex-grow:1;", ";"], reactTheming.componentStyles);
|
|
415
416
|
|
|
416
417
|
const COMPONENT_ID$u = 'forms.input_group';
|
|
418
|
+
const BUTTON_SELECTOR = "button[data-garden-id='buttons.button']";
|
|
419
|
+
const ICON_BUTTON_SELECTOR = "button[data-garden-id='buttons.icon_button']";
|
|
420
|
+
const getCompactIconButtonSize = theme => polished.math(`${theme.space.base}px * 6`);
|
|
421
|
+
const VALIDATION_BORDER_VARIABLE = {
|
|
422
|
+
success: 'border.successEmphasis',
|
|
423
|
+
warning: 'border.warningEmphasis',
|
|
424
|
+
error: 'border.dangerEmphasis'
|
|
425
|
+
};
|
|
426
|
+
const readOnlyStyles = props => {
|
|
427
|
+
const {
|
|
428
|
+
theme
|
|
429
|
+
} = props;
|
|
430
|
+
const backgroundColor = reactTheming.getColor({
|
|
431
|
+
theme,
|
|
432
|
+
variable: 'background.disabled'
|
|
433
|
+
});
|
|
434
|
+
return styled.css(["&:has(", "[readonly]){background-color:", ";}"], StyledTextInput, backgroundColor);
|
|
435
|
+
};
|
|
436
|
+
const disabledStyles = props => {
|
|
437
|
+
const {
|
|
438
|
+
theme
|
|
439
|
+
} = props;
|
|
440
|
+
const borderColor = reactTheming.getColor({
|
|
441
|
+
theme,
|
|
442
|
+
variable: 'border.disabled'
|
|
443
|
+
});
|
|
444
|
+
const backgroundColor = reactTheming.getColor({
|
|
445
|
+
theme,
|
|
446
|
+
variable: 'background.disabled'
|
|
447
|
+
});
|
|
448
|
+
return styled.css(["&:has(", ":disabled){border-color:", ";background-color:", ";cursor:default;}"], StyledTextInput, borderColor, backgroundColor);
|
|
449
|
+
};
|
|
450
|
+
const unifiedItemStyles = props => {
|
|
451
|
+
const {
|
|
452
|
+
theme,
|
|
453
|
+
$isCompact,
|
|
454
|
+
$focusInset,
|
|
455
|
+
$validation
|
|
456
|
+
} = props;
|
|
457
|
+
const fontSize = theme.fontSizes.md;
|
|
458
|
+
const containerSize = $isCompact ? theme.space.lg : theme.space.xl;
|
|
459
|
+
const buttonSize = polished.math(`${theme.space.base}px * ${$isCompact ? 6 : 7}`);
|
|
460
|
+
const iconButtonSize = $isCompact ? getCompactIconButtonSize(theme) : theme.space.lg;
|
|
461
|
+
const backgroundColor = reactTheming.getColor({
|
|
462
|
+
theme,
|
|
463
|
+
variable: 'background.default'
|
|
464
|
+
});
|
|
465
|
+
const buttonLineHeight = polished.math(`${buttonSize} - (${theme.borderWidths.sm} * 2)`);
|
|
466
|
+
let borderColor;
|
|
467
|
+
let hoverBorderColor;
|
|
468
|
+
let borderVariable;
|
|
469
|
+
if ($validation) {
|
|
470
|
+
borderVariable = VALIDATION_BORDER_VARIABLE[$validation];
|
|
471
|
+
borderColor = reactTheming.getColor({
|
|
472
|
+
theme,
|
|
473
|
+
variable: borderVariable
|
|
474
|
+
});
|
|
475
|
+
hoverBorderColor = borderColor;
|
|
476
|
+
} else {
|
|
477
|
+
borderVariable = 'border.primaryEmphasis';
|
|
478
|
+
borderColor = reactTheming.getColor({
|
|
479
|
+
theme,
|
|
480
|
+
variable: 'border.default',
|
|
481
|
+
dark: {
|
|
482
|
+
offset: -100
|
|
483
|
+
},
|
|
484
|
+
light: {
|
|
485
|
+
offset: 100
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
hoverBorderColor = reactTheming.getColor({
|
|
489
|
+
theme,
|
|
490
|
+
variable: borderVariable
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
const focusBorderColor = hoverBorderColor;
|
|
494
|
+
const buttonEdgeTarget = polished.em(theme.space.sm, fontSize);
|
|
495
|
+
const iconButtonInset = (parseFloat(iconButtonSize) - parseFloat(theme.iconSizes.md)) / 2;
|
|
496
|
+
const iconButtonPaddingInline = `calc(${buttonEdgeTarget} - ${iconButtonInset}px)`;
|
|
497
|
+
return styled.css(["box-sizing:border-box;align-items:center;transition:border-color 0.25s ease-in-out,box-shadow 0.1s ease-in-out;border:", ";border-radius:", ";border-color:", ";background-color:", ";cursor:text;min-height:", ";font-size:", ";padding-inline:", ";&:hover{border-color:", ";}&:has(> ", ":first-child){padding-inline-start:", ";}&:has(> ", ":last-child){padding-inline-end:", ";}&:has(> ", ":first-child),&:has(> [data-garden-id='", "']:first-child){padding-inline-start:0;}&:has(> ", ":last-child),&:has(> [data-garden-id='", "']:last-child){padding-inline-end:0;}& > * + ", "{margin-inline-start:", ";}& > ", " + ", "{margin-inline-start:", ";}", " & ", "{align-self:stretch;}& > ", "{padding-inline:", ";}& > * + ", "{margin-inline-start:", ";}& > ", ":first-child{border-start-start-radius:", ";border-end-start-radius:", ";padding-inline-start:", ";}& > ", ":last-child{border-start-end-radius:", ";border-end-end-radius:", ";padding-inline-end:", ";}& > [data-garden-id='", "']:first-child > ", ":first-child{border-start-start-radius:", ";border-end-start-radius:", ";}& > [data-garden-id='", "']:last-child > ", ":last-child{border-start-end-radius:", ";border-end-end-radius:", ";}& ", "{flex:none;align-self:center;width:", ";min-width:", ";height:", ";min-height:", ";}& > [data-garden-id='", "']{flex:1 1 auto;align-self:stretch;border:none;background-color:transparent;min-width:0;min-height:0;padding-block:0;padding-inline:0;&:has(> ", ":last-child){padding-inline-end:0;}&:has(> ", ":first-child){padding-inline-start:0;}&:focus-within:not(:has(button:focus-visible)){border-color:transparent;box-shadow:none;}&:has(", ":disabled),&:has(", "[readonly]){background-color:transparent;}}& ", "{height:", ";min-height:", ";line-height:", ";}", " ", " ", ""], theme.borders.sm, theme.borderRadii.md, borderColor, backgroundColor, containerSize, fontSize, theme.space.xxs, hoverBorderColor, ICON_BUTTON_SELECTOR, iconButtonPaddingInline, ICON_BUTTON_SELECTOR, iconButtonPaddingInline, StyledTextInput, COMPONENT_ID$u, StyledTextInput, COMPONENT_ID$u, BUTTON_SELECTOR, theme.space.xxs, StyledTextInput, ICON_BUTTON_SELECTOR, theme.space.xxs, $isCompact && styled.css(["& > [data-garden-id='", "'] + ", "{margin-inline-start:", ";}"], COMPONENT_ID$u, ICON_BUTTON_SELECTOR, theme.space.xs), StyledTextInput, StyledTextInput, theme.space.xs, StyledTextInput, theme.space.xxs, StyledTextInput, theme.borderRadii.md, theme.borderRadii.md, theme.space.sm, StyledTextInput, theme.borderRadii.md, theme.borderRadii.md, theme.space.sm, COMPONENT_ID$u, StyledTextInput, theme.borderRadii.md, theme.borderRadii.md, COMPONENT_ID$u, StyledTextInput, theme.borderRadii.md, theme.borderRadii.md, ICON_BUTTON_SELECTOR, iconButtonSize, iconButtonSize, iconButtonSize, iconButtonSize, COMPONENT_ID$u, ICON_BUTTON_SELECTOR, ICON_BUTTON_SELECTOR, StyledTextInput, StyledTextInput, BUTTON_SELECTOR, buttonSize, buttonSize, buttonLineHeight, reactTheming.focusStyles({
|
|
498
|
+
theme,
|
|
499
|
+
inset: $focusInset,
|
|
500
|
+
color: {
|
|
501
|
+
variable: borderVariable
|
|
502
|
+
},
|
|
503
|
+
selector: '&:focus-within:not(:has(button:focus-visible))',
|
|
504
|
+
styles: {
|
|
505
|
+
borderColor: focusBorderColor
|
|
506
|
+
}
|
|
507
|
+
}), readOnlyStyles(props), disabledStyles(props));
|
|
508
|
+
};
|
|
417
509
|
const positionStyles = props => {
|
|
418
510
|
const topMargin = `${props.theme.space.base * (props.$isCompact ? 1 : 2)}px`;
|
|
419
|
-
return styled.css(["", ":not([hidden]) + &&,", " + &&,", "
|
|
511
|
+
return styled.css(["", ":not([hidden]) + &&,", " + &&,", " ~ &&,&& + ", ",&& ~ ", "{margin-top:", ";}& > ", "{position:relative;flex:1 1 auto;margin-top:0;margin-bottom:0;width:auto;min-width:0;}"], StyledLabel, StyledHint, StyledMessage, StyledHint, StyledMessage, topMargin, StyledTextInput);
|
|
420
512
|
};
|
|
421
|
-
const
|
|
513
|
+
const segmentedItemStyles = props => {
|
|
422
514
|
const startDirection = props.theme.rtl ? 'right' : 'left';
|
|
423
515
|
const endDirection = props.theme.rtl ? 'left' : 'right';
|
|
424
516
|
return styled.css(["& > *{z-index:-1;}& > ", "{z-index:0;}& > ", ":disabled{z-index:-2;}& > ", ":hover,& > button:hover,& > ", ":focus-visible,& > button:focus-visible,& > ", ":active,& > button:active,& > button[aria-pressed='true'],& > button[aria-pressed='mixed']{z-index:1;}& > button:disabled{border-top-width:0;border-bottom-width:0;}& > *:not(:first-child){margin-", ":-", ";}& > *:first-child:not(:last-child){border-top-", "-radius:0;border-bottom-", "-radius:0;}& > *:last-child:not(:first-child){border-top-", "-radius:0;border-bottom-", "-radius:0;}& > *:not(:first-child):not(:last-child){border-radius:0;}"], StyledTextInput, StyledTextInput, StyledTextInput, StyledTextInput, StyledTextInput, startDirection, props.theme.borderWidths.sm, endDirection, endDirection, startDirection, startDirection);
|
|
425
517
|
};
|
|
426
518
|
const StyledInputGroup = styled__default.default.div.attrs({
|
|
427
519
|
'data-garden-id': COMPONENT_ID$u,
|
|
428
|
-
'data-garden-version': '9.
|
|
520
|
+
'data-garden-version': '9.16.0'
|
|
429
521
|
}).withConfig({
|
|
430
522
|
displayName: "StyledInputGroup",
|
|
431
523
|
componentId: "sc-kjh1f0-0"
|
|
432
|
-
})(["display:inline-flex;position:relative;flex-wrap:nowrap;align-items:stretch;z-index:0;width:100%;", ";", ";", ";"], props => positionStyles(props), props =>
|
|
524
|
+
})(["display:inline-flex;position:relative;flex-wrap:nowrap;align-items:stretch;z-index:0;width:100%;", ";", ";", ";", ";"], props => positionStyles(props), props => !props.$isUnified && segmentedItemStyles(props), props => props.$isUnified && unifiedItemStyles(props), reactTheming.componentStyles);
|
|
525
|
+
|
|
526
|
+
const InputGroupContext = React.createContext(undefined);
|
|
527
|
+
const useInputGroupContext = () => {
|
|
528
|
+
return React.useContext(InputGroupContext);
|
|
529
|
+
};
|
|
530
|
+
const deriveValidation = map => {
|
|
531
|
+
let derived;
|
|
532
|
+
map.forEach(value => {
|
|
533
|
+
derived = value;
|
|
534
|
+
});
|
|
535
|
+
return derived;
|
|
536
|
+
};
|
|
537
|
+
const useInputGroupValidationState = () => {
|
|
538
|
+
const validationsRef = React.useRef(new Map());
|
|
539
|
+
const [validation, setValidation] = React.useState();
|
|
540
|
+
const registerValidation = React.useCallback((id, next) => {
|
|
541
|
+
const map = validationsRef.current;
|
|
542
|
+
if (next === undefined) {
|
|
543
|
+
if (!map.has(id)) {
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
map.delete(id);
|
|
547
|
+
} else if (map.get(id) === next) {
|
|
548
|
+
return;
|
|
549
|
+
} else {
|
|
550
|
+
if (!map.has(id) && map.size > 0 && process.env.NODE_ENV === 'development') {
|
|
551
|
+
console.warn('Warning: a unified <InputGroup> supports a single Input with a `validation` prop. Multiple validation-bearing Inputs produce an ambiguous container validation state. Render a single Input per unified group, or use the classic InputGroup for multi-input layouts.');
|
|
552
|
+
}
|
|
553
|
+
map.set(id, next);
|
|
554
|
+
}
|
|
555
|
+
const derived = deriveValidation(map);
|
|
556
|
+
setValidation(prev => prev === derived ? prev : derived);
|
|
557
|
+
}, []);
|
|
558
|
+
return {
|
|
559
|
+
validation,
|
|
560
|
+
registerValidation
|
|
561
|
+
};
|
|
562
|
+
};
|
|
563
|
+
const usePublishInputGroupValidation = validation => {
|
|
564
|
+
const context = useInputGroupContext();
|
|
565
|
+
const id = React.useRef({});
|
|
566
|
+
const {
|
|
567
|
+
registerValidation,
|
|
568
|
+
isUnified
|
|
569
|
+
} = context || {};
|
|
570
|
+
React.useLayoutEffect(() => {
|
|
571
|
+
if (!registerValidation || !isUnified) {
|
|
572
|
+
return undefined;
|
|
573
|
+
}
|
|
574
|
+
const validationId = id.current;
|
|
575
|
+
registerValidation(validationId, validation);
|
|
576
|
+
return () => {
|
|
577
|
+
registerValidation(validationId, undefined);
|
|
578
|
+
};
|
|
579
|
+
}, [isUnified, registerValidation, validation]);
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
const InputGroup = React__namespace.default.forwardRef(({
|
|
583
|
+
isCompact,
|
|
584
|
+
isUnified,
|
|
585
|
+
focusInset,
|
|
586
|
+
children,
|
|
587
|
+
...other
|
|
588
|
+
}, ref) => {
|
|
589
|
+
const fieldContext = useFieldContext();
|
|
590
|
+
const {
|
|
591
|
+
validation,
|
|
592
|
+
registerValidation
|
|
593
|
+
} = useInputGroupValidationState();
|
|
594
|
+
const contextValue = React.useMemo(() => ({
|
|
595
|
+
isCompact,
|
|
596
|
+
isUnified,
|
|
597
|
+
registerValidation
|
|
598
|
+
}), [isCompact, isUnified, registerValidation]);
|
|
599
|
+
const labelId = fieldContext?.hasLabel && !other['aria-label'] ? fieldContext.getLabelProps({}).id : undefined;
|
|
600
|
+
return React__namespace.default.createElement(InputGroupContext.Provider, {
|
|
601
|
+
value: contextValue
|
|
602
|
+
}, React__namespace.default.createElement(StyledInputGroup, Object.assign({
|
|
603
|
+
role: "group",
|
|
604
|
+
"aria-labelledby": labelId,
|
|
605
|
+
ref: ref,
|
|
606
|
+
$isCompact: isCompact,
|
|
607
|
+
$isUnified: isUnified,
|
|
608
|
+
$focusInset: focusInset
|
|
609
|
+
}, other, {
|
|
610
|
+
$validation: validation
|
|
611
|
+
}), children));
|
|
612
|
+
});
|
|
613
|
+
InputGroup.displayName = 'InputGroup';
|
|
614
|
+
InputGroup.propTypes = {
|
|
615
|
+
isCompact: PropTypes__default.default.bool,
|
|
616
|
+
isUnified: PropTypes__default.default.bool,
|
|
617
|
+
focusInset: PropTypes__default.default.bool
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
const StyledClearableInput = styled__default.default(InputGroup).withConfig({
|
|
621
|
+
displayName: "StyledClearableInput",
|
|
622
|
+
componentId: "sc-v0381a-0"
|
|
623
|
+
})(["", ""], props => props.$isBare && styled.css(["&&", "{border:none;border-radius:0;background-color:transparent;&:focus-within{box-shadow:none;}}"], StyledInputGroup));
|
|
433
624
|
|
|
434
625
|
const COMPONENT_ID$t = 'forms.radio_label';
|
|
435
626
|
const sizeStyles$d = props => {
|
|
@@ -440,7 +631,7 @@ const sizeStyles$d = props => {
|
|
|
440
631
|
};
|
|
441
632
|
const StyledRadioLabel = styled__default.default(StyledLabel).attrs({
|
|
442
633
|
'data-garden-id': COMPONENT_ID$t,
|
|
443
|
-
'data-garden-version': '9.
|
|
634
|
+
'data-garden-version': '9.16.0',
|
|
444
635
|
$isRadio: true
|
|
445
636
|
}).withConfig({
|
|
446
637
|
displayName: "StyledRadioLabel",
|
|
@@ -450,7 +641,7 @@ const StyledRadioLabel = styled__default.default(StyledLabel).attrs({
|
|
|
450
641
|
const COMPONENT_ID$s = 'forms.checkbox_label';
|
|
451
642
|
const StyledCheckLabel = styled__default.default(StyledRadioLabel).attrs({
|
|
452
643
|
'data-garden-id': COMPONENT_ID$s,
|
|
453
|
-
'data-garden-version': '9.
|
|
644
|
+
'data-garden-version': '9.16.0'
|
|
454
645
|
}).withConfig({
|
|
455
646
|
displayName: "StyledCheckLabel",
|
|
456
647
|
componentId: "sc-x7nr1-0"
|
|
@@ -459,7 +650,7 @@ const StyledCheckLabel = styled__default.default(StyledRadioLabel).attrs({
|
|
|
459
650
|
const COMPONENT_ID$r = 'forms.radio_hint';
|
|
460
651
|
const StyledRadioHint = styled__default.default(StyledHint).attrs({
|
|
461
652
|
'data-garden-id': COMPONENT_ID$r,
|
|
462
|
-
'data-garden-version': '9.
|
|
653
|
+
'data-garden-version': '9.16.0'
|
|
463
654
|
}).withConfig({
|
|
464
655
|
displayName: "StyledRadioHint",
|
|
465
656
|
componentId: "sc-eo8twg-0"
|
|
@@ -468,7 +659,7 @@ const StyledRadioHint = styled__default.default(StyledHint).attrs({
|
|
|
468
659
|
const COMPONENT_ID$q = 'forms.checkbox_hint';
|
|
469
660
|
const StyledCheckHint = styled__default.default(StyledRadioHint).attrs({
|
|
470
661
|
'data-garden-id': COMPONENT_ID$q,
|
|
471
|
-
'data-garden-version': '9.
|
|
662
|
+
'data-garden-version': '9.16.0'
|
|
472
663
|
}).withConfig({
|
|
473
664
|
displayName: "StyledCheckHint",
|
|
474
665
|
componentId: "sc-1kl8e8c-0"
|
|
@@ -571,7 +762,7 @@ const sizeStyles$c = ({
|
|
|
571
762
|
};
|
|
572
763
|
const StyledRadioInput = styled__default.default.input.attrs({
|
|
573
764
|
'data-garden-id': COMPONENT_ID$p,
|
|
574
|
-
'data-garden-version': '9.
|
|
765
|
+
'data-garden-version': '9.16.0',
|
|
575
766
|
type: 'radio'
|
|
576
767
|
}).withConfig({
|
|
577
768
|
displayName: "StyledRadioInput",
|
|
@@ -633,7 +824,7 @@ const colorStyles$8 = ({
|
|
|
633
824
|
};
|
|
634
825
|
const StyledCheckInput = styled__default.default(StyledRadioInput).attrs({
|
|
635
826
|
'data-garden-id': COMPONENT_ID$o,
|
|
636
|
-
'data-garden-version': '9.
|
|
827
|
+
'data-garden-version': '9.16.0',
|
|
637
828
|
type: 'checkbox'
|
|
638
829
|
}).withConfig({
|
|
639
830
|
displayName: "StyledCheckInput",
|
|
@@ -643,7 +834,7 @@ const StyledCheckInput = styled__default.default(StyledRadioInput).attrs({
|
|
|
643
834
|
const COMPONENT_ID$n = 'forms.radio_message';
|
|
644
835
|
const StyledRadioMessage = styled__default.default(StyledMessage).attrs({
|
|
645
836
|
'data-garden-id': COMPONENT_ID$n,
|
|
646
|
-
'data-garden-version': '9.
|
|
837
|
+
'data-garden-version': '9.16.0'
|
|
647
838
|
}).withConfig({
|
|
648
839
|
displayName: "StyledRadioMessage",
|
|
649
840
|
componentId: "sc-1pmi0q8-0"
|
|
@@ -652,7 +843,7 @@ const StyledRadioMessage = styled__default.default(StyledMessage).attrs({
|
|
|
652
843
|
const COMPONENT_ID$m = 'forms.checkbox_message';
|
|
653
844
|
const StyledCheckMessage = styled__default.default(StyledRadioMessage).attrs({
|
|
654
845
|
'data-garden-id': COMPONENT_ID$m,
|
|
655
|
-
'data-garden-version': '9.
|
|
846
|
+
'data-garden-version': '9.16.0'
|
|
656
847
|
}).withConfig({
|
|
657
848
|
displayName: "StyledCheckMessage",
|
|
658
849
|
componentId: "sc-s4p6kd-0"
|
|
@@ -681,7 +872,7 @@ var SvgCheckSmFill = function SvgCheckSmFill(props) {
|
|
|
681
872
|
const COMPONENT_ID$l = 'forms.check_svg';
|
|
682
873
|
const StyledCheckSvg = styled__default.default(SvgCheckSmFill).attrs({
|
|
683
874
|
'data-garden-id': COMPONENT_ID$l,
|
|
684
|
-
'data-garden-version': '9.
|
|
875
|
+
'data-garden-version': '9.16.0'
|
|
685
876
|
}).withConfig({
|
|
686
877
|
displayName: "StyledCheckSvg",
|
|
687
878
|
componentId: "sc-fvxetk-0"
|
|
@@ -708,7 +899,7 @@ var SvgDashFill = function SvgDashFill(props) {
|
|
|
708
899
|
const COMPONENT_ID$k = 'forms.dash_svg';
|
|
709
900
|
const StyledDashSvg = styled__default.default(SvgDashFill).attrs({
|
|
710
901
|
'data-garden-id': COMPONENT_ID$k,
|
|
711
|
-
'data-garden-version': '9.
|
|
902
|
+
'data-garden-version': '9.16.0'
|
|
712
903
|
}).withConfig({
|
|
713
904
|
displayName: "StyledDashSvg",
|
|
714
905
|
componentId: "sc-z3vq71-0"
|
|
@@ -805,7 +996,7 @@ const sizeStyles$b = ({
|
|
|
805
996
|
};
|
|
806
997
|
const StyledFileUpload = styled__default.default.div.attrs({
|
|
807
998
|
'data-garden-id': COMPONENT_ID$j,
|
|
808
|
-
'data-garden-version': '9.
|
|
999
|
+
'data-garden-version': '9.16.0'
|
|
809
1000
|
}).withConfig({
|
|
810
1001
|
displayName: "StyledFileUpload",
|
|
811
1002
|
componentId: "sc-1rodjgn-0"
|
|
@@ -814,7 +1005,7 @@ const StyledFileUpload = styled__default.default.div.attrs({
|
|
|
814
1005
|
const COMPONENT_ID$i = 'forms.file.close';
|
|
815
1006
|
const StyledFileClose = styled__default.default.button.attrs({
|
|
816
1007
|
'data-garden-id': COMPONENT_ID$i,
|
|
817
|
-
'data-garden-version': '9.
|
|
1008
|
+
'data-garden-version': '9.16.0'
|
|
818
1009
|
}).withConfig({
|
|
819
1010
|
displayName: "StyledFileClose",
|
|
820
1011
|
componentId: "sc-1m31jbf-0"
|
|
@@ -898,7 +1089,7 @@ const sizeStyles$a = ({
|
|
|
898
1089
|
};
|
|
899
1090
|
const StyledFile = styled__default.default.div.attrs({
|
|
900
1091
|
'data-garden-id': COMPONENT_ID$h,
|
|
901
|
-
'data-garden-version': '9.
|
|
1092
|
+
'data-garden-version': '9.16.0'
|
|
902
1093
|
}).withConfig({
|
|
903
1094
|
displayName: "StyledFile",
|
|
904
1095
|
componentId: "sc-195lzp1-0"
|
|
@@ -907,7 +1098,7 @@ const StyledFile = styled__default.default.div.attrs({
|
|
|
907
1098
|
const COMPONENT_ID$g = 'forms.file.delete';
|
|
908
1099
|
const StyledFileDelete = styled__default.default(StyledFileClose).attrs({
|
|
909
1100
|
'data-garden-id': COMPONENT_ID$g,
|
|
910
|
-
'data-garden-version': '9.
|
|
1101
|
+
'data-garden-version': '9.16.0'
|
|
911
1102
|
}).withConfig({
|
|
912
1103
|
displayName: "StyledFileDelete",
|
|
913
1104
|
componentId: "sc-a8nnhx-0"
|
|
@@ -937,7 +1128,7 @@ const sizeStyles$9 = ({
|
|
|
937
1128
|
};
|
|
938
1129
|
const StyledFileIcon = styled__default.default(reactTheming.StyledBaseIcon).attrs({
|
|
939
1130
|
'data-garden-id': COMPONENT_ID$f,
|
|
940
|
-
'data-garden-version': '9.
|
|
1131
|
+
'data-garden-version': '9.16.0'
|
|
941
1132
|
}).withConfig({
|
|
942
1133
|
displayName: "StyledFileIcon",
|
|
943
1134
|
componentId: "sc-7b3q0c-0"
|
|
@@ -946,7 +1137,7 @@ const StyledFileIcon = styled__default.default(reactTheming.StyledBaseIcon).attr
|
|
|
946
1137
|
const COMPONENT_ID$e = 'forms.file_list';
|
|
947
1138
|
const StyledFileList = styled__default.default.ul.attrs({
|
|
948
1139
|
'data-garden-id': COMPONENT_ID$e,
|
|
949
|
-
'data-garden-version': '9.
|
|
1140
|
+
'data-garden-version': '9.16.0'
|
|
950
1141
|
}).withConfig({
|
|
951
1142
|
displayName: "StyledFileList",
|
|
952
1143
|
componentId: "sc-gbahjg-0"
|
|
@@ -955,7 +1146,7 @@ const StyledFileList = styled__default.default.ul.attrs({
|
|
|
955
1146
|
const COMPONENT_ID$d = 'forms.file_list.item';
|
|
956
1147
|
const StyledFileListItem = styled__default.default.li.attrs({
|
|
957
1148
|
'data-garden-id': COMPONENT_ID$d,
|
|
958
|
-
'data-garden-version': '9.
|
|
1149
|
+
'data-garden-version': '9.16.0'
|
|
959
1150
|
}).withConfig({
|
|
960
1151
|
displayName: "StyledFileListItem",
|
|
961
1152
|
componentId: "sc-1ova3lo-0"
|
|
@@ -982,7 +1173,7 @@ var SvgCircleSmFill$1 = function SvgCircleSmFill(props) {
|
|
|
982
1173
|
const COMPONENT_ID$c = 'forms.radio_svg';
|
|
983
1174
|
const StyledRadioSvg = styled__default.default(SvgCircleSmFill$1).attrs({
|
|
984
1175
|
'data-garden-id': COMPONENT_ID$c,
|
|
985
|
-
'data-garden-version': '9.
|
|
1176
|
+
'data-garden-version': '9.16.0'
|
|
986
1177
|
}).withConfig({
|
|
987
1178
|
displayName: "StyledRadioSvg",
|
|
988
1179
|
componentId: "sc-1r1qtr1-0"
|
|
@@ -996,7 +1187,7 @@ const sizeStyles$8 = props => {
|
|
|
996
1187
|
};
|
|
997
1188
|
const StyledToggleLabel = styled__default.default(StyledCheckLabel).attrs({
|
|
998
1189
|
'data-garden-id': COMPONENT_ID$b,
|
|
999
|
-
'data-garden-version': '9.
|
|
1190
|
+
'data-garden-version': '9.16.0'
|
|
1000
1191
|
}).withConfig({
|
|
1001
1192
|
displayName: "StyledToggleLabel",
|
|
1002
1193
|
componentId: "sc-e0asdk-0"
|
|
@@ -1005,7 +1196,7 @@ const StyledToggleLabel = styled__default.default(StyledCheckLabel).attrs({
|
|
|
1005
1196
|
const COMPONENT_ID$a = 'forms.toggle_hint';
|
|
1006
1197
|
const StyledToggleHint = styled__default.default(StyledHint).attrs({
|
|
1007
1198
|
'data-garden-id': COMPONENT_ID$a,
|
|
1008
|
-
'data-garden-version': '9.
|
|
1199
|
+
'data-garden-version': '9.16.0'
|
|
1009
1200
|
}).withConfig({
|
|
1010
1201
|
displayName: "StyledToggleHint",
|
|
1011
1202
|
componentId: "sc-nziggu-0"
|
|
@@ -1052,7 +1243,7 @@ const sizeStyles$7 = ({
|
|
|
1052
1243
|
};
|
|
1053
1244
|
const StyledToggleInput = styled__default.default(StyledCheckInput).attrs({
|
|
1054
1245
|
'data-garden-id': COMPONENT_ID$9,
|
|
1055
|
-
'data-garden-version': '9.
|
|
1246
|
+
'data-garden-version': '9.16.0'
|
|
1056
1247
|
}).withConfig({
|
|
1057
1248
|
displayName: "StyledToggleInput",
|
|
1058
1249
|
componentId: "sc-sgp47s-0"
|
|
@@ -1061,7 +1252,7 @@ const StyledToggleInput = styled__default.default(StyledCheckInput).attrs({
|
|
|
1061
1252
|
const COMPONENT_ID$8 = 'forms.toggle_message';
|
|
1062
1253
|
const StyledToggleMessage = styled__default.default(StyledMessage).attrs({
|
|
1063
1254
|
'data-garden-id': COMPONENT_ID$8,
|
|
1064
|
-
'data-garden-version': '9.
|
|
1255
|
+
'data-garden-version': '9.16.0'
|
|
1065
1256
|
}).withConfig({
|
|
1066
1257
|
displayName: "StyledToggleMessage",
|
|
1067
1258
|
componentId: "sc-13vuvl1-0"
|
|
@@ -1088,7 +1279,7 @@ var SvgCircleSmFill = function SvgCircleSmFill(props) {
|
|
|
1088
1279
|
const COMPONENT_ID$7 = 'forms.toggle_svg';
|
|
1089
1280
|
const StyledToggleSvg = styled__default.default(SvgCircleSmFill).attrs({
|
|
1090
1281
|
'data-garden-id': COMPONENT_ID$7,
|
|
1091
|
-
'data-garden-version': '9.
|
|
1282
|
+
'data-garden-version': '9.16.0'
|
|
1092
1283
|
}).withConfig({
|
|
1093
1284
|
displayName: "StyledToggleSvg",
|
|
1094
1285
|
componentId: "sc-162xbyx-0"
|
|
@@ -1126,7 +1317,7 @@ const sizeStyles$6 = ({
|
|
|
1126
1317
|
};
|
|
1127
1318
|
const StyledSelect = styled__default.default(StyledTextInput).attrs({
|
|
1128
1319
|
'data-garden-id': COMPONENT_ID$6,
|
|
1129
|
-
'data-garden-version': '9.
|
|
1320
|
+
'data-garden-version': '9.16.0',
|
|
1130
1321
|
as: 'select'
|
|
1131
1322
|
}).withConfig({
|
|
1132
1323
|
displayName: "StyledSelect",
|
|
@@ -1146,7 +1337,7 @@ const sizeStyles$5 = ({
|
|
|
1146
1337
|
};
|
|
1147
1338
|
const StyledSelectWrapper = styled__default.default(StyledTextFauxInput).attrs({
|
|
1148
1339
|
'data-garden-id': COMPONENT_ID$5,
|
|
1149
|
-
'data-garden-version': '9.
|
|
1340
|
+
'data-garden-version': '9.16.0'
|
|
1150
1341
|
}).withConfig({
|
|
1151
1342
|
displayName: "StyledSelectWrapper",
|
|
1152
1343
|
componentId: "sc-i7b6hw-0"
|
|
@@ -1313,7 +1504,7 @@ const sizeStyles$4 = ({
|
|
|
1313
1504
|
};
|
|
1314
1505
|
const StyledRangeInput = styled__default.default.input.attrs(props => ({
|
|
1315
1506
|
'data-garden-id': COMPONENT_ID$4,
|
|
1316
|
-
'data-garden-version': '9.
|
|
1507
|
+
'data-garden-version': '9.16.0',
|
|
1317
1508
|
type: 'range',
|
|
1318
1509
|
style: {
|
|
1319
1510
|
backgroundSize: props.$hasLowerTrack ?? true ? props.$backgroundSize ?? '0%' : undefined
|
|
@@ -1431,7 +1622,7 @@ const sizeStyles$3 = ({
|
|
|
1431
1622
|
};
|
|
1432
1623
|
const StyledTile = styled__default.default.label.attrs({
|
|
1433
1624
|
'data-garden-id': COMPONENT_ID$3,
|
|
1434
|
-
'data-garden-version': '9.
|
|
1625
|
+
'data-garden-version': '9.16.0'
|
|
1435
1626
|
}).withConfig({
|
|
1436
1627
|
displayName: "StyledTile",
|
|
1437
1628
|
componentId: "sc-1jjvmxs-0"
|
|
@@ -1450,7 +1641,7 @@ const sizeStyles$2 = ({
|
|
|
1450
1641
|
};
|
|
1451
1642
|
const StyledTileDescription = styled__default.default.span.attrs({
|
|
1452
1643
|
'data-garden-id': COMPONENT_ID$2,
|
|
1453
|
-
'data-garden-version': '9.
|
|
1644
|
+
'data-garden-version': '9.16.0'
|
|
1454
1645
|
}).withConfig({
|
|
1455
1646
|
displayName: "StyledTileDescription",
|
|
1456
1647
|
componentId: "sc-xfuu7u-0"
|
|
@@ -1510,7 +1701,7 @@ const sizeStyles$1 = ({
|
|
|
1510
1701
|
};
|
|
1511
1702
|
const StyledTileIcon = styled__default.default.span.attrs({
|
|
1512
1703
|
'data-garden-id': COMPONENT_ID$1,
|
|
1513
|
-
'data-garden-version': '9.
|
|
1704
|
+
'data-garden-version': '9.16.0'
|
|
1514
1705
|
}).withConfig({
|
|
1515
1706
|
displayName: "StyledTileIcon",
|
|
1516
1707
|
componentId: "sc-1wazhg4-0"
|
|
@@ -1534,7 +1725,7 @@ const sizeStyles = ({
|
|
|
1534
1725
|
};
|
|
1535
1726
|
const StyledTileLabel = styled__default.default.span.attrs({
|
|
1536
1727
|
'data-garden-id': COMPONENT_ID,
|
|
1537
|
-
'data-garden-version': '9.
|
|
1728
|
+
'data-garden-version': '9.16.0'
|
|
1538
1729
|
}).withConfig({
|
|
1539
1730
|
displayName: "StyledTileLabel",
|
|
1540
1731
|
componentId: "sc-1mypv27-0"
|
|
@@ -1747,6 +1938,13 @@ const Label$1 = React__namespace.default.forwardRef(({
|
|
|
1747
1938
|
const fieldContext = useFieldContext();
|
|
1748
1939
|
const fieldsetContext = useFieldsetContext();
|
|
1749
1940
|
const type = useInputContext();
|
|
1941
|
+
const {
|
|
1942
|
+
setHasLabel
|
|
1943
|
+
} = fieldContext || {};
|
|
1944
|
+
React.useEffect(() => {
|
|
1945
|
+
setHasLabel?.(true);
|
|
1946
|
+
return () => setHasLabel?.(false);
|
|
1947
|
+
}, [setHasLabel]);
|
|
1750
1948
|
const $isRegular = fieldsetContext && isRegular === undefined ? true : isRegular;
|
|
1751
1949
|
let combinedProps = other;
|
|
1752
1950
|
if (fieldContext) {
|
|
@@ -1819,6 +2017,7 @@ Label$1.propTypes = {
|
|
|
1819
2017
|
const FieldComponent = React__namespace.default.forwardRef((props, ref) => {
|
|
1820
2018
|
const [hasHint, setHasHint] = React.useState(false);
|
|
1821
2019
|
const [hasMessage, setHasMessage] = React.useState(false);
|
|
2020
|
+
const [hasLabel, setHasLabel] = React.useState(false);
|
|
1822
2021
|
const [isLabelActive, setIsLabelActive] = React.useState(false);
|
|
1823
2022
|
const [isLabelHovered, setIsLabelHovered] = React.useState(false);
|
|
1824
2023
|
const {
|
|
@@ -1841,8 +2040,10 @@ const FieldComponent = React__namespace.default.forwardRef((props, ref) => {
|
|
|
1841
2040
|
hasHint,
|
|
1842
2041
|
setHasHint,
|
|
1843
2042
|
hasMessage,
|
|
1844
|
-
setHasMessage
|
|
1845
|
-
|
|
2043
|
+
setHasMessage,
|
|
2044
|
+
hasLabel,
|
|
2045
|
+
setHasLabel
|
|
2046
|
+
}), [propGetters, getInputProps, getMessageProps, isLabelActive, isLabelHovered, hasHint, hasMessage, hasLabel]);
|
|
1846
2047
|
return React__namespace.default.createElement(FieldContext.Provider, {
|
|
1847
2048
|
value: fieldProps
|
|
1848
2049
|
}, React__namespace.default.createElement(StyledField, Object.assign({}, props, {
|
|
@@ -1924,11 +2125,6 @@ Checkbox.propTypes = {
|
|
|
1924
2125
|
indeterminate: PropTypes__default.default.bool
|
|
1925
2126
|
};
|
|
1926
2127
|
|
|
1927
|
-
const InputGroupContext = React.createContext(undefined);
|
|
1928
|
-
const useInputGroupContext = () => {
|
|
1929
|
-
return React.useContext(InputGroupContext);
|
|
1930
|
-
};
|
|
1931
|
-
|
|
1932
2128
|
const Input = React__namespace.default.forwardRef(({
|
|
1933
2129
|
onSelect,
|
|
1934
2130
|
isBare,
|
|
@@ -1939,6 +2135,7 @@ const Input = React__namespace.default.forwardRef(({
|
|
|
1939
2135
|
}, ref) => {
|
|
1940
2136
|
const fieldContext = useFieldContext();
|
|
1941
2137
|
const inputGroupContext = useInputGroupContext();
|
|
2138
|
+
usePublishInputGroupValidation(validation);
|
|
1942
2139
|
let combinedProps = other;
|
|
1943
2140
|
if (fieldContext) {
|
|
1944
2141
|
combinedProps = fieldContext.getInputProps(combinedProps);
|
|
@@ -1950,7 +2147,7 @@ const Input = React__namespace.default.forwardRef(({
|
|
|
1950
2147
|
ref: ref,
|
|
1951
2148
|
onSelect: onSelectHandler
|
|
1952
2149
|
}, combinedProps, {
|
|
1953
|
-
$isBare: isBare,
|
|
2150
|
+
$isBare: isBare === undefined && inputGroupContext?.isUnified ? true : isBare,
|
|
1954
2151
|
$isCompact: inputGroupContext ? inputGroupContext.isCompact : isCompact,
|
|
1955
2152
|
$focusInset: inputGroupContext && focusInset === undefined ? true : focusInset,
|
|
1956
2153
|
$validation: validation
|
|
@@ -2436,23 +2633,113 @@ Tiles.Icon = Icon;
|
|
|
2436
2633
|
Tiles.Label = Label;
|
|
2437
2634
|
Tiles.Tile = Tile;
|
|
2438
2635
|
|
|
2439
|
-
|
|
2636
|
+
var _path$j;
|
|
2637
|
+
function _extends$k() { return _extends$k = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$k.apply(null, arguments); }
|
|
2638
|
+
var SvgXStroke$1 = function SvgXStroke(props) {
|
|
2639
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$k({
|
|
2640
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2641
|
+
width: 16,
|
|
2642
|
+
height: 16,
|
|
2643
|
+
focusable: "false",
|
|
2644
|
+
viewBox: "0 0 16 16",
|
|
2645
|
+
"aria-hidden": "true"
|
|
2646
|
+
}, props), _path$j || (_path$j = /*#__PURE__*/React__namespace.createElement("path", {
|
|
2647
|
+
stroke: "currentColor",
|
|
2648
|
+
strokeLinecap: "round",
|
|
2649
|
+
d: "M3 13L13 3m0 10L3 3"
|
|
2650
|
+
})));
|
|
2651
|
+
};
|
|
2652
|
+
|
|
2653
|
+
const ClearableInput = React__namespace.default.forwardRef(({
|
|
2654
|
+
clearButtonLabel,
|
|
2655
|
+
wrapperProps,
|
|
2656
|
+
wrapperRef,
|
|
2657
|
+
buttonProps: _buttonProps = {},
|
|
2440
2658
|
isCompact,
|
|
2441
|
-
|
|
2659
|
+
focusInset,
|
|
2660
|
+
isBare,
|
|
2661
|
+
value,
|
|
2662
|
+
defaultValue,
|
|
2663
|
+
onChange,
|
|
2664
|
+
disabled,
|
|
2665
|
+
readOnly,
|
|
2666
|
+
...props
|
|
2442
2667
|
}, ref) => {
|
|
2443
|
-
const
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2668
|
+
const fieldContext = useFieldContext();
|
|
2669
|
+
const inputRef = React.useRef(null);
|
|
2670
|
+
const generatedId = containerUtilities.useId(props.id);
|
|
2671
|
+
const inputId = props.id ?? fieldContext?.getInputProps().id ?? generatedId;
|
|
2672
|
+
const ariaLabel = reactTheming.useText(ClearableInput, {
|
|
2673
|
+
clearButtonLabel
|
|
2674
|
+
}, 'clearButtonLabel', 'Clear');
|
|
2675
|
+
const isControlled = value !== undefined;
|
|
2676
|
+
const [uncontrolledHasValue, setUncontrolledHasValue] = React.useState(() => !!defaultValue);
|
|
2677
|
+
const hasValue = isControlled ? !!value : uncontrolledHasValue;
|
|
2678
|
+
const {
|
|
2679
|
+
onClick,
|
|
2680
|
+
onMouseDown,
|
|
2681
|
+
...buttonProps
|
|
2682
|
+
} = _buttonProps;
|
|
2683
|
+
const onClearButtonMouseDown = event => {
|
|
2684
|
+
event.preventDefault();
|
|
2685
|
+
};
|
|
2686
|
+
const onClearButtonClick = () => {
|
|
2687
|
+
const input = inputRef.current;
|
|
2688
|
+
if (input) {
|
|
2689
|
+
Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value')?.set?.call(input, '');
|
|
2690
|
+
input.dispatchEvent(new Event('input', {
|
|
2691
|
+
bubbles: true
|
|
2692
|
+
}));
|
|
2693
|
+
input.focus();
|
|
2694
|
+
}
|
|
2695
|
+
};
|
|
2696
|
+
const onInputChange = event => {
|
|
2697
|
+
if (!isControlled) {
|
|
2698
|
+
setUncontrolledHasValue(!!event.target.value);
|
|
2699
|
+
}
|
|
2700
|
+
};
|
|
2701
|
+
return React__namespace.default.createElement(StyledClearableInput, Object.assign({
|
|
2702
|
+
focusInset: focusInset
|
|
2703
|
+
}, wrapperProps, {
|
|
2704
|
+
isUnified: true,
|
|
2705
|
+
isCompact: isCompact,
|
|
2706
|
+
$isBare: isBare,
|
|
2707
|
+
onClick: containerUtilities.composeEventHandlers(wrapperProps?.onClick, () => {
|
|
2708
|
+
inputRef.current?.focus();
|
|
2709
|
+
}),
|
|
2710
|
+
ref: wrapperRef
|
|
2711
|
+
}), React__namespace.default.createElement(Input, Object.assign({
|
|
2712
|
+
ref: reactMergeRefs.mergeRefs([inputRef, ref])
|
|
2713
|
+
}, props, {
|
|
2714
|
+
disabled: disabled,
|
|
2715
|
+
readOnly: readOnly,
|
|
2716
|
+
value: value,
|
|
2717
|
+
defaultValue: defaultValue,
|
|
2718
|
+
onChange: containerUtilities.composeEventHandlers(onChange, onInputChange),
|
|
2719
|
+
id: inputId,
|
|
2720
|
+
"data-garden-id": "forms.clearable_input"
|
|
2721
|
+
})), hasValue && !disabled && !readOnly ? React__namespace.default.createElement(reactButtons.IconButton, Object.assign({
|
|
2722
|
+
"aria-label": ariaLabel,
|
|
2723
|
+
"aria-controls": inputId,
|
|
2724
|
+
isBasic: true
|
|
2725
|
+
}, buttonProps, {
|
|
2726
|
+
focusInset: !isCompact,
|
|
2727
|
+
onMouseDown: containerUtilities.composeEventHandlers(onMouseDown, onClearButtonMouseDown),
|
|
2728
|
+
onClick: containerUtilities.composeEventHandlers(onClick, onClearButtonClick)
|
|
2729
|
+
}), React__namespace.default.createElement(SvgXStroke$1, {
|
|
2730
|
+
"aria-hidden": "true"
|
|
2731
|
+
})) : null);
|
|
2452
2732
|
});
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
isCompact: PropTypes__default.default.bool
|
|
2733
|
+
ClearableInput.displayName = 'ClearableInput';
|
|
2734
|
+
ClearableInput.propTypes = {
|
|
2735
|
+
isCompact: PropTypes__default.default.bool,
|
|
2736
|
+
isBare: PropTypes__default.default.bool,
|
|
2737
|
+
focusInset: PropTypes__default.default.bool,
|
|
2738
|
+
validation: PropTypes__default.default.oneOf(VALIDATION),
|
|
2739
|
+
clearButtonLabel: PropTypes__default.default.string,
|
|
2740
|
+
wrapperProps: PropTypes__default.default.object,
|
|
2741
|
+
wrapperRef: PropTypes__default.default.any,
|
|
2742
|
+
buttonProps: PropTypes__default.default.object
|
|
2456
2743
|
};
|
|
2457
2744
|
|
|
2458
2745
|
const FileUpload = React__namespace.default.forwardRef(({
|
|
@@ -2496,37 +2783,20 @@ FileListComponent.displayName = 'FileList';
|
|
|
2496
2783
|
const FileList = FileListComponent;
|
|
2497
2784
|
FileList.Item = Item;
|
|
2498
2785
|
|
|
2499
|
-
var _path$j;
|
|
2500
|
-
function _extends$k() { return _extends$k = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$k.apply(null, arguments); }
|
|
2501
|
-
var SvgXStroke$1 = function SvgXStroke(props) {
|
|
2502
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$k({
|
|
2503
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2504
|
-
width: 12,
|
|
2505
|
-
height: 12,
|
|
2506
|
-
focusable: "false",
|
|
2507
|
-
viewBox: "0 0 12 12",
|
|
2508
|
-
"aria-hidden": "true"
|
|
2509
|
-
}, props), _path$j || (_path$j = /*#__PURE__*/React__namespace.createElement("path", {
|
|
2510
|
-
stroke: "currentColor",
|
|
2511
|
-
strokeLinecap: "round",
|
|
2512
|
-
d: "M3 9l6-6m0 6L3 3"
|
|
2513
|
-
})));
|
|
2514
|
-
};
|
|
2515
|
-
|
|
2516
2786
|
var _path$i;
|
|
2517
2787
|
function _extends$j() { return _extends$j = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$j.apply(null, arguments); }
|
|
2518
2788
|
var SvgXStroke = function SvgXStroke(props) {
|
|
2519
2789
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$j({
|
|
2520
2790
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2521
|
-
width:
|
|
2522
|
-
height:
|
|
2791
|
+
width: 12,
|
|
2792
|
+
height: 12,
|
|
2523
2793
|
focusable: "false",
|
|
2524
|
-
viewBox: "0 0
|
|
2794
|
+
viewBox: "0 0 12 12",
|
|
2525
2795
|
"aria-hidden": "true"
|
|
2526
2796
|
}, props), _path$i || (_path$i = /*#__PURE__*/React__namespace.createElement("path", {
|
|
2527
2797
|
stroke: "currentColor",
|
|
2528
2798
|
strokeLinecap: "round",
|
|
2529
|
-
d: "M3
|
|
2799
|
+
d: "M3 9l6-6m0 6L3 3"
|
|
2530
2800
|
})));
|
|
2531
2801
|
};
|
|
2532
2802
|
|
|
@@ -2547,7 +2817,7 @@ const CloseComponent = React__namespace.default.forwardRef((props, ref) => {
|
|
|
2547
2817
|
type: "button",
|
|
2548
2818
|
tabIndex: -1,
|
|
2549
2819
|
onMouseDown: onMouseDown
|
|
2550
|
-
}), fileContext && fileContext.isCompact ? React__namespace.default.createElement(SvgXStroke
|
|
2820
|
+
}), fileContext && fileContext.isCompact ? React__namespace.default.createElement(SvgXStroke, null) : React__namespace.default.createElement(SvgXStroke$1, null));
|
|
2551
2821
|
});
|
|
2552
2822
|
CloseComponent.displayName = 'File.Close';
|
|
2553
2823
|
const Close = CloseComponent;
|
|
@@ -3095,6 +3365,7 @@ MediaInput.propTypes = {
|
|
|
3095
3365
|
MediaInput.displayName = 'MediaInput';
|
|
3096
3366
|
|
|
3097
3367
|
exports.Checkbox = Checkbox;
|
|
3368
|
+
exports.ClearableInput = ClearableInput;
|
|
3098
3369
|
exports.FauxInput = FauxInput;
|
|
3099
3370
|
exports.Field = Field;
|
|
3100
3371
|
exports.Fieldset = Fieldset;
|