@zendeskgarden/react-forms 9.0.0-next.7 → 9.0.0-next.9

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.
Files changed (118) hide show
  1. package/dist/esm/elements/Checkbox.js +97 -0
  2. package/dist/esm/elements/FileUpload.js +75 -0
  3. package/dist/esm/elements/Input.js +93 -0
  4. package/dist/esm/elements/MediaInput.js +156 -0
  5. package/dist/esm/elements/Radio.js +81 -0
  6. package/dist/esm/elements/Range.js +108 -0
  7. package/dist/esm/elements/Select.js +97 -0
  8. package/dist/esm/elements/Textarea.js +170 -0
  9. package/dist/esm/elements/Toggle.js +81 -0
  10. package/dist/esm/elements/common/Field.js +97 -0
  11. package/dist/esm/elements/common/Fieldset.js +73 -0
  12. package/dist/esm/elements/common/Hint.js +92 -0
  13. package/dist/esm/elements/common/Label.js +134 -0
  14. package/dist/esm/elements/common/Legend.js +63 -0
  15. package/dist/esm/elements/common/Message.js +113 -0
  16. package/dist/esm/elements/faux-input/FauxInput.js +100 -0
  17. package/dist/esm/elements/faux-input/components/EndIcon.js +68 -0
  18. package/dist/esm/elements/faux-input/components/StartIcon.js +68 -0
  19. package/dist/esm/elements/file-list/FileList.js +66 -0
  20. package/dist/esm/elements/file-list/components/Close.js +75 -0
  21. package/dist/esm/elements/file-list/components/Delete.js +75 -0
  22. package/dist/esm/elements/file-list/components/File.js +94 -0
  23. package/dist/esm/elements/file-list/components/Item.js +64 -0
  24. package/dist/esm/elements/file-list/utils.js +50 -0
  25. package/dist/esm/elements/input-group/InputGroup.js +75 -0
  26. package/dist/esm/elements/tiles/Tiles.js +64 -0
  27. package/dist/esm/elements/tiles/components/Description.js +64 -0
  28. package/dist/esm/elements/tiles/components/Icon.js +64 -0
  29. package/dist/esm/elements/tiles/components/Label.js +73 -0
  30. package/dist/esm/elements/tiles/components/Tile.js +91 -0
  31. package/dist/esm/index.js +26 -0
  32. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/check-circle-stroke.svg.js +33 -0
  33. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/check-sm-fill.svg.js +29 -0
  34. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/circle-sm-fill.svg.js +27 -0
  35. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/dash-fill.svg.js +27 -0
  36. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-document-stroke.svg.js +27 -0
  37. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-error-stroke.svg.js +27 -0
  38. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-generic-stroke.svg.js +26 -0
  39. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-image-stroke.svg.js +33 -0
  40. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-pdf-stroke.svg.js +35 -0
  41. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-presentation-stroke.svg.js +26 -0
  42. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-spreadsheet-stroke.svg.js +27 -0
  43. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-zip-stroke.svg.js +27 -0
  44. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/trash-stroke.svg.js +27 -0
  45. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/x-stroke.svg.js +26 -0
  46. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-error-stroke.svg.js +37 -0
  47. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-warning-stroke.svg.js +32 -0
  48. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/check-circle-stroke.svg.js +33 -0
  49. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg.js +25 -0
  50. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/circle-sm-fill.svg.js +27 -0
  51. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-document-stroke.svg.js +27 -0
  52. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-error-stroke.svg.js +27 -0
  53. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-generic-stroke.svg.js +26 -0
  54. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-image-stroke.svg.js +32 -0
  55. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-pdf-stroke.svg.js +35 -0
  56. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-presentation-stroke.svg.js +26 -0
  57. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-spreadsheet-stroke.svg.js +27 -0
  58. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-zip-stroke.svg.js +27 -0
  59. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/trash-stroke.svg.js +27 -0
  60. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js +26 -0
  61. package/dist/esm/styled/checkbox/StyledCheckHint.js +23 -0
  62. package/dist/esm/styled/checkbox/StyledCheckInput.js +34 -0
  63. package/dist/esm/styled/checkbox/StyledCheckLabel.js +23 -0
  64. package/dist/esm/styled/checkbox/StyledCheckMessage.js +23 -0
  65. package/dist/esm/styled/checkbox/StyledCheckSvg.js +25 -0
  66. package/dist/esm/styled/checkbox/StyledDashSvg.js +25 -0
  67. package/dist/esm/styled/common/StyledField.js +22 -0
  68. package/dist/esm/styled/common/StyledFieldset.js +24 -0
  69. package/dist/esm/styled/common/StyledHint.js +22 -0
  70. package/dist/esm/styled/common/StyledLabel.js +23 -0
  71. package/dist/esm/styled/common/StyledLegend.js +24 -0
  72. package/dist/esm/styled/common/StyledMessage.js +40 -0
  73. package/dist/esm/styled/common/StyledMessageIcon.js +45 -0
  74. package/dist/esm/styled/file-list/StyledFile.js +76 -0
  75. package/dist/esm/styled/file-list/StyledFileClose.js +22 -0
  76. package/dist/esm/styled/file-list/StyledFileDelete.js +23 -0
  77. package/dist/esm/styled/file-list/StyledFileIcon.js +22 -0
  78. package/dist/esm/styled/file-list/StyledFileList.js +22 -0
  79. package/dist/esm/styled/file-list/StyledFileListItem.js +24 -0
  80. package/dist/esm/styled/file-upload/StyledFileUpload.js +47 -0
  81. package/dist/esm/styled/input-group/StyledInputGroup.js +35 -0
  82. package/dist/esm/styled/radio/StyledRadioHint.js +24 -0
  83. package/dist/esm/styled/radio/StyledRadioInput.js +61 -0
  84. package/dist/esm/styled/radio/StyledRadioLabel.js +30 -0
  85. package/dist/esm/styled/radio/StyledRadioMessage.js +24 -0
  86. package/dist/esm/styled/radio/StyledRadioSvg.js +25 -0
  87. package/dist/esm/styled/range/StyledRangeInput.js +160 -0
  88. package/dist/esm/styled/select/StyledSelect.js +36 -0
  89. package/dist/esm/styled/select/StyledSelectWrapper.js +24 -0
  90. package/dist/esm/styled/text/StyledTextFauxInput.js +61 -0
  91. package/dist/esm/styled/text/StyledTextInput.js +107 -0
  92. package/dist/esm/styled/text/StyledTextMediaFigure.js +43 -0
  93. package/dist/esm/styled/text/StyledTextMediaInput.js +24 -0
  94. package/dist/esm/styled/text/StyledTextarea.js +33 -0
  95. package/dist/esm/styled/tiles/StyledTile.js +55 -0
  96. package/dist/esm/styled/tiles/StyledTileDescription.js +34 -0
  97. package/dist/esm/styled/tiles/StyledTileIcon.js +38 -0
  98. package/dist/esm/styled/tiles/StyledTileInput.js +18 -0
  99. package/dist/esm/styled/tiles/StyledTileLabel.js +36 -0
  100. package/dist/esm/styled/toggle/StyledToggleHint.js +24 -0
  101. package/dist/esm/styled/toggle/StyledToggleInput.js +40 -0
  102. package/dist/esm/styled/toggle/StyledToggleLabel.js +28 -0
  103. package/dist/esm/styled/toggle/StyledToggleMessage.js +25 -0
  104. package/dist/esm/styled/toggle/StyledToggleSvg.js +23 -0
  105. package/dist/esm/types/index.js +11 -0
  106. package/dist/esm/utils/useFieldContext.js +15 -0
  107. package/dist/esm/utils/useFieldsetContext.js +15 -0
  108. package/dist/esm/utils/useFileContext.js +14 -0
  109. package/dist/esm/utils/useInputContext.js +14 -0
  110. package/dist/esm/utils/useInputGroupContext.js +14 -0
  111. package/dist/esm/utils/useTilesContext.js +14 -0
  112. package/dist/index.cjs.js +121 -130
  113. package/dist/typings/elements/faux-input/components/EndIcon.d.ts +1 -1
  114. package/dist/typings/elements/faux-input/components/StartIcon.d.ts +1 -1
  115. package/dist/typings/styled/file-list/StyledFileIcon.d.ts +2 -2
  116. package/dist/typings/styled/text/StyledTextMediaFigure.d.ts +7 -7
  117. package/package.json +5 -5
  118. package/dist/index.esm.js +0 -2720
package/dist/index.esm.js DELETED
@@ -1,2720 +0,0 @@
1
- /**
2
- * Copyright Zendesk, Inc.
3
- *
4
- * Use of this source code is governed under the Apache License, Version 2.0
5
- * found at http://www.apache.org/licenses/LICENSE-2.0.
6
- */
7
-
8
- import * as React from 'react';
9
- import React__default, { createContext, useContext, Children, useEffect, useState, useMemo, forwardRef, useRef, useCallback, useLayoutEffect } from 'react';
10
- import { useField } from '@zendeskgarden/container-field';
11
- import styled, { css } from 'styled-components';
12
- import { retrieveComponentStyles, DEFAULT_THEME, getLineHeight, getColorV8, focusStyles, SELECTOR_FOCUS_VISIBLE, getFocusBoxShadow, useText } from '@zendeskgarden/react-theming';
13
- import { hideVisually, math, em, rgba } from 'polished';
14
- import PropTypes from 'prop-types';
15
- import { composeEventHandlers, getControlledValue } from '@zendeskgarden/container-utilities';
16
- import { mergeRefs } from 'react-merge-refs';
17
-
18
- function _extends$t() {
19
- _extends$t = Object.assign ? Object.assign.bind() : function (target) {
20
- for (var i = 1; i < arguments.length; i++) {
21
- var source = arguments[i];
22
- for (var key in source) {
23
- if (Object.prototype.hasOwnProperty.call(source, key)) {
24
- target[key] = source[key];
25
- }
26
- }
27
- }
28
- return target;
29
- };
30
- return _extends$t.apply(this, arguments);
31
- }
32
-
33
- const FieldContext = createContext(undefined);
34
- const useFieldContext = () => {
35
- const fieldContext = useContext(FieldContext);
36
- return fieldContext;
37
- };
38
-
39
- const COMPONENT_ID$G = 'forms.field';
40
- const StyledField = styled.div.attrs({
41
- 'data-garden-id': COMPONENT_ID$G,
42
- 'data-garden-version': '9.0.0-next.7'
43
- }).withConfig({
44
- displayName: "StyledField",
45
- componentId: "sc-12gzfsu-0"
46
- })(["position:relative;direction:", ";margin:0;border:0;padding:0;font-size:0;", ";"], props => props.theme.rtl ? 'rtl' : 'ltr', props => retrieveComponentStyles(COMPONENT_ID$G, props));
47
- StyledField.defaultProps = {
48
- theme: DEFAULT_THEME
49
- };
50
-
51
- const COMPONENT_ID$F = 'forms.fieldset';
52
- const StyledFieldset = styled(StyledField).attrs({
53
- as: 'fieldset',
54
- 'data-garden-id': COMPONENT_ID$F,
55
- 'data-garden-version': '9.0.0-next.7'
56
- }).withConfig({
57
- displayName: "StyledFieldset",
58
- componentId: "sc-1vr4mxv-0"
59
- })(["", "{margin-top:", "px;}", ";"], StyledField, props => props.theme.space.base * (props.isCompact ? 1 : 2), props => retrieveComponentStyles(COMPONENT_ID$F, props));
60
- StyledFieldset.defaultProps = {
61
- theme: DEFAULT_THEME
62
- };
63
-
64
- const COMPONENT_ID$E = 'forms.input_label';
65
- const StyledLabel = styled.label.attrs(props => ({
66
- 'data-garden-id': props['data-garden-id'] || COMPONENT_ID$E,
67
- 'data-garden-version': props['data-garden-version'] || '9.0.0-next.7'
68
- })).withConfig({
69
- displayName: "StyledLabel",
70
- componentId: "sc-2utmsz-0"
71
- })(["direction:", ";vertical-align:middle;line-height:", ";color:", ";font-size:", ";font-weight:", ";&[hidden]{display:", ";vertical-align:", ";text-indent:", ";font-size:", ";", ";}", ";"], props => props.theme.rtl && 'rtl', props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), props => getColorV8('foreground', 600 , props.theme), props => props.theme.fontSizes.md, props => props.isRegular ? props.theme.fontWeights.regular : props.theme.fontWeights.semibold, props => props.isRadio ? 'inline-block' : 'inline', props => props.isRadio && 'top', props => props.isRadio && '-100%', props => props.isRadio && '0', props => !props.isRadio && hideVisually(), props => retrieveComponentStyles(COMPONENT_ID$E, props));
72
- StyledLabel.defaultProps = {
73
- theme: DEFAULT_THEME
74
- };
75
-
76
- const COMPONENT_ID$D = 'forms.fieldset_legend';
77
- const StyledLegend = styled(StyledLabel).attrs({
78
- as: 'legend',
79
- 'data-garden-id': COMPONENT_ID$D,
80
- 'data-garden-version': '9.0.0-next.7'
81
- }).withConfig({
82
- displayName: "StyledLegend",
83
- componentId: "sc-6s0zwq-0"
84
- })(["padding:0;", ";"], props => retrieveComponentStyles(COMPONENT_ID$D, props));
85
- StyledLegend.defaultProps = {
86
- theme: DEFAULT_THEME
87
- };
88
-
89
- const COMPONENT_ID$C = 'forms.input_hint';
90
- const StyledHint = styled.div.attrs(props => ({
91
- 'data-garden-id': props['data-garden-id'] || COMPONENT_ID$C,
92
- 'data-garden-version': props['data-garden-version'] || '9.0.0-next.7'
93
- })).withConfig({
94
- displayName: "StyledHint",
95
- componentId: "sc-17c2wu8-0"
96
- })(["direction:", ";display:block;vertical-align:middle;line-height:", ";color:", ";font-size:", ";", ";"], props => props.theme.rtl && 'rtl', props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), props => getColorV8('neutralHue', 600, props.theme), props => props.theme.fontSizes.md, props => retrieveComponentStyles(COMPONENT_ID$C, props));
97
- StyledHint.defaultProps = {
98
- theme: DEFAULT_THEME
99
- };
100
-
101
- var _g$2, _circle$5;
102
- function _extends$s() { _extends$s = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$s.apply(this, arguments); }
103
- var SvgAlertErrorStroke = function SvgAlertErrorStroke(props) {
104
- return /*#__PURE__*/React.createElement("svg", _extends$s({
105
- xmlns: "http://www.w3.org/2000/svg",
106
- width: 16,
107
- height: 16,
108
- focusable: "false",
109
- viewBox: "0 0 16 16",
110
- "aria-hidden": "true"
111
- }, props), _g$2 || (_g$2 = /*#__PURE__*/React.createElement("g", {
112
- fill: "none",
113
- stroke: "currentColor"
114
- }, /*#__PURE__*/React.createElement("circle", {
115
- cx: 7.5,
116
- cy: 8.5,
117
- r: 7
118
- }), /*#__PURE__*/React.createElement("path", {
119
- strokeLinecap: "round",
120
- d: "M7.5 4.5V9"
121
- }))), _circle$5 || (_circle$5 = /*#__PURE__*/React.createElement("circle", {
122
- cx: 7.5,
123
- cy: 12,
124
- r: 1,
125
- fill: "currentColor"
126
- })));
127
- };
128
-
129
- var _path$n, _circle$4;
130
- function _extends$r() { _extends$r = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$r.apply(this, arguments); }
131
- var SvgAlertWarningStroke = function SvgAlertWarningStroke(props) {
132
- return /*#__PURE__*/React.createElement("svg", _extends$r({
133
- xmlns: "http://www.w3.org/2000/svg",
134
- width: 16,
135
- height: 16,
136
- focusable: "false",
137
- viewBox: "0 0 16 16",
138
- "aria-hidden": "true"
139
- }, props), _path$n || (_path$n = /*#__PURE__*/React.createElement("path", {
140
- fill: "none",
141
- stroke: "currentColor",
142
- strokeLinecap: "round",
143
- d: "M.88 13.77L7.06 1.86c.19-.36.7-.36.89 0l6.18 11.91c.17.33-.07.73-.44.73H1.32c-.37 0-.61-.4-.44-.73zM7.5 6v3.5"
144
- })), _circle$4 || (_circle$4 = /*#__PURE__*/React.createElement("circle", {
145
- cx: 7.5,
146
- cy: 12,
147
- r: 1,
148
- fill: "currentColor"
149
- })));
150
- };
151
-
152
- var _g$1;
153
- function _extends$q() { _extends$q = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$q.apply(this, arguments); }
154
- var SvgCheckCircleStroke$1 = function SvgCheckCircleStroke(props) {
155
- return /*#__PURE__*/React.createElement("svg", _extends$q({
156
- xmlns: "http://www.w3.org/2000/svg",
157
- width: 16,
158
- height: 16,
159
- focusable: "false",
160
- viewBox: "0 0 16 16",
161
- "aria-hidden": "true"
162
- }, props), _g$1 || (_g$1 = /*#__PURE__*/React.createElement("g", {
163
- fill: "none",
164
- stroke: "currentColor"
165
- }, /*#__PURE__*/React.createElement("path", {
166
- strokeLinecap: "round",
167
- strokeLinejoin: "round",
168
- d: "M4 9l2.5 2.5 5-5"
169
- }), /*#__PURE__*/React.createElement("circle", {
170
- cx: 7.5,
171
- cy: 8.5,
172
- r: 7
173
- }))));
174
- };
175
-
176
- const MessageIcon = _ref => {
177
- let {
178
- children,
179
- validation,
180
- ...props
181
- } = _ref;
182
- let retVal;
183
- if (validation === 'error') {
184
- retVal = React__default.createElement(SvgAlertErrorStroke, props);
185
- } else if (validation === 'success') {
186
- retVal = React__default.createElement(SvgCheckCircleStroke$1, props);
187
- } else if (validation === 'warning') {
188
- retVal = React__default.createElement(SvgAlertWarningStroke, props);
189
- } else {
190
- retVal = React__default.cloneElement(Children.only(children));
191
- }
192
- return retVal;
193
- };
194
- const COMPONENT_ID$B = 'forms.input_message_icon';
195
- const StyledMessageIcon = styled(MessageIcon).attrs({
196
- 'data-garden-id': COMPONENT_ID$B,
197
- 'data-garden-version': '9.0.0-next.7',
198
- 'aria-hidden': null
199
- }).withConfig({
200
- displayName: "StyledMessageIcon",
201
- componentId: "sc-1ph2gba-0"
202
- })(["width:", ";height:", ";", ";"], props => props.theme.iconSizes.md, props => props.theme.iconSizes.md, props => retrieveComponentStyles(COMPONENT_ID$B, props));
203
- StyledMessageIcon.defaultProps = {
204
- theme: DEFAULT_THEME
205
- };
206
-
207
- const validationStyles = props => {
208
- const rtl = props.theme.rtl;
209
- const padding = math(`${props.theme.space.base} * 2px + ${props.theme.iconSizes.md}`);
210
- let color;
211
- if (props.validation === 'error') {
212
- color = getColorV8('dangerHue', 600, props.theme);
213
- } else if (props.validation === 'success') {
214
- color = getColorV8('successHue', 600, props.theme);
215
- } else if (props.validation === 'warning') {
216
- color = getColorV8('warningHue', 700, props.theme);
217
- } else {
218
- color = getColorV8('neutralHue', 700, props.theme);
219
- }
220
- return css(["padding-", ":", ";color:", ";"], rtl ? 'right' : 'left', props.validation && padding, color);
221
- };
222
- const COMPONENT_ID$A = 'forms.input_message';
223
- const StyledMessage = styled.div.attrs(props => ({
224
- 'data-garden-id': props['data-garden-id'] || COMPONENT_ID$A,
225
- 'data-garden-version': props['data-garden-version'] || '9.0.0-next.7'
226
- })).withConfig({
227
- displayName: "StyledMessage",
228
- componentId: "sc-30hgg7-0"
229
- })(["direction:", ";display:inline-block;position:relative;vertical-align:middle;line-height:", ";font-size:", ";", ";& ", "{position:absolute;top:-1px;", ":0;}", ":not([hidden]) + &{display:block;margin-top:", ";}", ";"], props => props.theme.rtl && 'rtl', props => getLineHeight(props.theme.iconSizes.md, props.theme.fontSizes.sm), props => props.theme.fontSizes.sm, props => validationStyles(props), StyledMessageIcon, props => props.theme.rtl ? 'right' : 'left', StyledLabel, props => math(`${props.theme.space.base} * 1px`), props => retrieveComponentStyles(COMPONENT_ID$A, props));
230
- StyledMessage.defaultProps = {
231
- theme: DEFAULT_THEME
232
- };
233
-
234
- const COMPONENT_ID$z = 'forms.input';
235
- const isInvalid = validation => {
236
- return validation === 'warning' || validation === 'error';
237
- };
238
- const colorStyles$a = props => {
239
- const HUE = 'primaryHue';
240
- const SHADE = 600;
241
- const placeholderColor = getColorV8('neutralHue', SHADE - 200, props.theme);
242
- let borderColor;
243
- let hoverBorderColor;
244
- let focusBorderColor;
245
- let focusRingHue = HUE;
246
- let focusRingShade = SHADE;
247
- if (props.validation) {
248
- let hue = HUE;
249
- if (props.validation === 'success') {
250
- hue = 'successHue';
251
- } else if (props.validation === 'warning') {
252
- hue = 'warningHue';
253
- focusRingShade = 700;
254
- } else if (props.validation === 'error') {
255
- hue = 'dangerHue';
256
- }
257
- borderColor = getColorV8(hue, SHADE, props.theme);
258
- hoverBorderColor = borderColor;
259
- focusBorderColor = borderColor;
260
- focusRingHue = hue;
261
- } else {
262
- borderColor = getColorV8('neutralHue', SHADE - 300, props.theme);
263
- hoverBorderColor = getColorV8('primaryHue', SHADE, props.theme);
264
- focusBorderColor = hoverBorderColor;
265
- }
266
- const readOnlyBackgroundColor = getColorV8('neutralHue', SHADE - 500, props.theme);
267
- const readOnlyBorderColor = getColorV8('neutralHue', SHADE - 300, props.theme);
268
- const disabledBackgroundColor = readOnlyBackgroundColor;
269
- const disabledBorderColor = getColorV8('neutralHue', SHADE - 400, props.theme);
270
- const disabledForegroundColor = getColorV8('neutralHue', SHADE - 200, props.theme);
271
- let controlledBorderColor = borderColor;
272
- if (props.isFocused) {
273
- controlledBorderColor = focusBorderColor;
274
- }
275
- if (props.isHovered) {
276
- controlledBorderColor = hoverBorderColor;
277
- }
278
- return css(["border-color:", ";background-color:", ";color:", ";&::placeholder{color:", ";}&[readonly],&[aria-readonly='true']{border-color:", ";background-color:", ";}&:hover{border-color:", ";}", " &:disabled,&[aria-disabled='true']{border-color:", ";background-color:", ";color:", ";}"], controlledBorderColor, props.isBare ? 'transparent' : getColorV8('background', 600 , props.theme), getColorV8('foreground', 600 , props.theme), placeholderColor, readOnlyBorderColor, !props.isBare && readOnlyBackgroundColor, hoverBorderColor, focusStyles({
279
- theme: props.theme,
280
- inset: props.focusInset,
281
- condition: !props.isBare,
282
- hue: focusRingHue,
283
- shade: focusRingShade,
284
- styles: {
285
- borderColor: focusBorderColor
286
- }
287
- }), disabledBorderColor, !props.isBare && disabledBackgroundColor, disabledForegroundColor);
288
- };
289
- const sizeStyles$c = props => {
290
- const fontSize = props.theme.fontSizes.md;
291
- const paddingHorizontal = `${props.theme.space.base * 3}px`;
292
- let height;
293
- let paddingVertical;
294
- let browseFontSize;
295
- let swatchHeight;
296
- if (props.isCompact) {
297
- height = `${props.theme.space.base * 8}px`;
298
- paddingVertical = `${props.theme.space.base * 1.5}px`;
299
- browseFontSize = math(`${props.theme.fontSizes.sm} - 1`);
300
- swatchHeight = `${props.theme.space.base * 6}px`;
301
- } else {
302
- height = `${props.theme.space.base * 10}px`;
303
- paddingVertical = `${props.theme.space.base * 2.5}px`;
304
- browseFontSize = props.theme.fontSizes.sm;
305
- swatchHeight = `${props.theme.space.base * 7}px`;
306
- }
307
- const lineHeight = math(`${height} - (${paddingVertical} * 2) - (${props.theme.borderWidths.sm} * 2)`);
308
- const padding = props.isBare ? '0' : `${em(paddingVertical, fontSize)} ${em(paddingHorizontal, fontSize)}`;
309
- const swatchMarginVertical = math(`(${lineHeight} - ${swatchHeight}) / 2`);
310
- const swatchMarginHorizontal = math(`${paddingVertical} + ${swatchMarginVertical} - ${paddingHorizontal}`);
311
- return 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-color-swatch{margin:", " ", ";}", ":not([hidden]) + &&,", " + &&,", " + &&,&& + ", ",&& + ", "{margin-top:", "px;}"], padding, props.isBare ? '1em' : height, getLineHeight(lineHeight, fontSize), fontSize, browseFontSize, height, props.isCompact ? '0 2px' : '1px 3px', swatchMarginVertical, swatchMarginHorizontal, math(`${swatchMarginHorizontal} * -2`), swatchHeight, swatchMarginVertical, swatchMarginHorizontal, StyledLabel, StyledHint, StyledMessage, StyledHint, StyledMessage, props.theme.space.base * (props.isCompact ? 1 : 2));
312
- };
313
- const StyledTextInput = styled.input.attrs(props => ({
314
- 'data-garden-id': COMPONENT_ID$z,
315
- 'data-garden-version': '9.0.0-next.7',
316
- 'aria-invalid': isInvalid(props.validation)
317
- })).withConfig({
318
- displayName: "StyledTextInput",
319
- componentId: "sc-k12n8x-0"
320
- })(["appearance:none;transition:border-color 0.25s ease-in-out,box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out,color 0.25s ease-in-out,z-index 0.25s ease-in-out;direction:", ";border:", ";border-radius:", ";width:100%;box-sizing:border-box;vertical-align:middle;font-family:inherit;&::-ms-browse{border-radius:", ";}&::-ms-clear,&::-ms-reveal{display:none;}&::-moz-color-swatch{border:none;border-radius:", ";}&::-webkit-color-swatch{border:none;border-radius:", ";}&::-webkit-color-swatch-wrapper{padding:0;}&::-webkit-clear-button,&::-webkit-inner-spin-button,&::-webkit-search-cancel-button,&::-webkit-search-results-button{display:none;}&::-webkit-datetime-edit{direction:", ";line-height:1;}&::placeholder{opacity:1;}&:invalid{box-shadow:none;}&[type='file']::-ms-value{display:none;}@media screen and (min--moz-device-pixel-ratio:0){&[type='number']{appearance:textfield;}}", ";", ";&:disabled{cursor:default;}", ";"], props => props.theme.rtl && 'rtl', props => props.isBare ? 'none' : props.theme.borders.sm, props => props.isBare ? '0' : props.theme.borderRadii.md, props => props.theme.borderRadii.sm, props => props.theme.borderRadii.sm, props => props.theme.borderRadii.sm, props => props.theme.rtl && 'rtl', props => sizeStyles$c(props), props => colorStyles$a(props), props => retrieveComponentStyles(COMPONENT_ID$z, props));
321
- StyledTextInput.defaultProps = {
322
- theme: DEFAULT_THEME
323
- };
324
-
325
- const COMPONENT_ID$y = 'forms.textarea';
326
- const hiddenStyles = `
327
- visibility: hidden;
328
- position: absolute;
329
- overflow: hidden;
330
- height: 0;
331
- top: 0;
332
- left: 0;
333
- transform: translateZ(0);
334
- `;
335
- const StyledTextarea = styled(StyledTextInput).attrs({
336
- as: 'textarea',
337
- 'data-garden-id': COMPONENT_ID$y,
338
- 'data-garden-version': '9.0.0-next.7'
339
- }).withConfig({
340
- displayName: "StyledTextarea",
341
- componentId: "sc-wxschl-0"
342
- })(["resize:", ";overflow:auto;", ";", ";"], props => props.isResizable ? 'vertical' : 'none', props => props.isHidden && hiddenStyles, props => retrieveComponentStyles(COMPONENT_ID$y, props));
343
- StyledTextarea.defaultProps = {
344
- theme: DEFAULT_THEME
345
- };
346
-
347
- const COMPONENT_ID$x = 'forms.media_figure';
348
- const colorStyles$9 = props => {
349
- let shade = 600;
350
- if (props.isDisabled) {
351
- shade = 400;
352
- } else if (props.isHovered || props.isFocused) {
353
- shade = 700;
354
- }
355
- return css(["color:", ";"], getColorV8('neutralHue', shade, props.theme));
356
- };
357
- const sizeStyles$b = props => {
358
- const size = props.theme.iconSizes.md;
359
- const marginFirst = `1px ${props.theme.space.base * 2}px auto 0`;
360
- const marginLast = `1px 0 auto ${props.theme.space.base * 2}px`;
361
- let margin;
362
- if (props.position === 'start') {
363
- margin = props.theme.rtl ? marginLast : marginFirst;
364
- } else {
365
- margin = props.theme.rtl ? marginFirst : marginLast;
366
- }
367
- return css(["margin:", ";width:", ";height:", ";"], margin, size, size);
368
- };
369
- const StyledTextMediaFigure = styled(
370
- _ref => {
371
- let {
372
- children,
373
- position,
374
- isHovered,
375
- isFocused,
376
- isDisabled,
377
- isRotated,
378
- theme,
379
- ...props
380
- } = _ref;
381
- return React__default.cloneElement(Children.only(children), props);
382
- }).attrs({
383
- 'data-garden-id': COMPONENT_ID$x,
384
- 'data-garden-version': '9.0.0-next.7'
385
- }).withConfig({
386
- displayName: "StyledTextMediaFigure",
387
- componentId: "sc-1qepknj-0"
388
- })(["transform:", ";transition:transform 0.25s ease-in-out,color 0.25s ease-in-out;", ";", " ", ";"], props => props.isRotated && `rotate(${props.theme.rtl ? '-' : '+'}180deg)`, props => colorStyles$9(props), props => sizeStyles$b(props), props => retrieveComponentStyles(COMPONENT_ID$x, props));
389
- StyledTextMediaFigure.defaultProps = {
390
- theme: DEFAULT_THEME
391
- };
392
-
393
- const COMPONENT_ID$w = 'forms.faux_input';
394
- const VALIDATION_HUES = {
395
- success: 'successHue',
396
- warning: 'warningHue',
397
- error: 'dangerHue'
398
- };
399
- function getValidationHue(validation) {
400
- let defaultHue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'primaryHue';
401
- if (validation) {
402
- return VALIDATION_HUES[validation];
403
- }
404
- return defaultHue;
405
- }
406
- const colorStyles$8 = props => {
407
- const {
408
- theme,
409
- validation,
410
- focusInset,
411
- isBare,
412
- isFocused
413
- } = props;
414
- return css(["", ""], focusStyles({
415
- theme,
416
- inset: focusInset,
417
- condition: !isBare,
418
- hue: getValidationHue(validation),
419
- shade: validation === 'warning' ? 700 : 600,
420
- selector: isFocused ? '&' : '&:focus-within',
421
- styles: {
422
- borderColor: getColorV8(getValidationHue(validation), 600, theme)
423
- }
424
- }));
425
- };
426
- const StyledTextFauxInput = styled(StyledTextInput).attrs(props => ({
427
- as: 'div',
428
- 'aria-readonly': props.isReadOnly,
429
- 'aria-disabled': props.isDisabled,
430
- 'data-garden-id': COMPONENT_ID$w,
431
- 'data-garden-version': '9.0.0-next.7'
432
- })).withConfig({
433
- displayName: "StyledTextFauxInput",
434
- componentId: "sc-yqw7j9-0"
435
- })(["display:", ";align-items:", ";cursor:", ";overflow:hidden;", " & > ", "{vertical-align:", ";", "{box-shadow:unset;}}& > ", "{flex-shrink:", ";}", ";"], props => props.mediaLayout ? 'inline-flex' : 'inline-block', props => props.mediaLayout && 'baseline', props => props.mediaLayout && !props.isDisabled ? 'text' : 'default', colorStyles$8, StyledTextInput, props => !props.mediaLayout && 'baseline', SELECTOR_FOCUS_VISIBLE, StyledTextMediaFigure, props => props.mediaLayout && '0', props => retrieveComponentStyles(COMPONENT_ID$w, props));
436
- StyledTextFauxInput.defaultProps = {
437
- theme: DEFAULT_THEME
438
- };
439
-
440
- const COMPONENT_ID$v = 'forms.media_input';
441
- const StyledTextMediaInput = styled(StyledTextInput).attrs({
442
- 'data-garden-id': COMPONENT_ID$v,
443
- 'data-garden-version': '9.0.0-next.7',
444
- isBare: true
445
- }).withConfig({
446
- displayName: "StyledTextMediaInput",
447
- componentId: "sc-12i9xfi-0"
448
- })(["flex-grow:1;", ";"], props => retrieveComponentStyles(COMPONENT_ID$v, props));
449
- StyledTextMediaInput.defaultProps = {
450
- theme: DEFAULT_THEME
451
- };
452
-
453
- const COMPONENT_ID$u = 'forms.input_group';
454
- const positionStyles = props => {
455
- const topMargin = `${props.theme.space.base * (props.isCompact ? 1 : 2)}px`;
456
- return 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);
457
- };
458
- const itemStyles = props => {
459
- const startDirection = props.theme.rtl ? 'right' : 'left';
460
- const endDirection = props.theme.rtl ? 'left' : 'right';
461
- return 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);
462
- };
463
- const StyledInputGroup = styled.div.attrs({
464
- 'data-garden-id': COMPONENT_ID$u,
465
- 'data-garden-version': '9.0.0-next.7'
466
- }).withConfig({
467
- displayName: "StyledInputGroup",
468
- componentId: "sc-kjh1f0-0"
469
- })(["display:inline-flex;position:relative;flex-wrap:nowrap;align-items:stretch;z-index:0;width:100%;", ";", ";", ";"], props => positionStyles(props), props => itemStyles(props), props => retrieveComponentStyles(COMPONENT_ID$u, props));
470
- StyledInputGroup.defaultProps = {
471
- theme: DEFAULT_THEME
472
- };
473
-
474
- const COMPONENT_ID$t = 'forms.radio_label';
475
- const sizeStyles$a = props => {
476
- const size = props.theme.space.base * 4;
477
- const padding = size + props.theme.space.base * 2;
478
- const lineHeight = props.theme.space.base * 5;
479
- return css(["padding-", ":", "px;&[hidden]{padding-", ":", "px;line-height:", "px;}"], props.theme.rtl ? 'right' : 'left', padding, props.theme.rtl ? 'right' : 'left', size, lineHeight);
480
- };
481
- const StyledRadioLabel = styled(StyledLabel).attrs({
482
- 'data-garden-id': COMPONENT_ID$t,
483
- 'data-garden-version': '9.0.0-next.7',
484
- isRadio: true
485
- }).withConfig({
486
- displayName: "StyledRadioLabel",
487
- componentId: "sc-1aq2e5t-0"
488
- })(["display:inline-block;position:relative;cursor:pointer;", ";", ";"], props => sizeStyles$a(props), props => retrieveComponentStyles(COMPONENT_ID$t, props));
489
- StyledRadioLabel.defaultProps = {
490
- theme: DEFAULT_THEME
491
- };
492
-
493
- const COMPONENT_ID$s = 'forms.checkbox_label';
494
- const StyledCheckLabel = styled(StyledRadioLabel).attrs({
495
- 'data-garden-id': COMPONENT_ID$s,
496
- 'data-garden-version': '9.0.0-next.7'
497
- }).withConfig({
498
- displayName: "StyledCheckLabel",
499
- componentId: "sc-x7nr1-0"
500
- })(["", ";"], props => retrieveComponentStyles(COMPONENT_ID$s, props));
501
- StyledCheckLabel.defaultProps = {
502
- theme: DEFAULT_THEME
503
- };
504
-
505
- const COMPONENT_ID$r = 'forms.radio_hint';
506
- const StyledRadioHint = styled(StyledHint).attrs({
507
- 'data-garden-id': COMPONENT_ID$r,
508
- 'data-garden-version': '9.0.0-next.7'
509
- }).withConfig({
510
- displayName: "StyledRadioHint",
511
- componentId: "sc-eo8twg-0"
512
- })(["padding-", ":", ";", ";"], props => props.theme.rtl ? 'right' : 'left', props => math(`${props.theme.space.base} * 6px`), props => retrieveComponentStyles(COMPONENT_ID$r, props));
513
- StyledRadioHint.defaultProps = {
514
- theme: DEFAULT_THEME
515
- };
516
-
517
- const COMPONENT_ID$q = 'forms.checkbox_hint';
518
- const StyledCheckHint = styled(StyledRadioHint).attrs({
519
- 'data-garden-id': COMPONENT_ID$q,
520
- 'data-garden-version': '9.0.0-next.7'
521
- }).withConfig({
522
- displayName: "StyledCheckHint",
523
- componentId: "sc-1kl8e8c-0"
524
- })(["", ";"], props => retrieveComponentStyles(COMPONENT_ID$q, props));
525
- StyledCheckHint.defaultProps = {
526
- theme: DEFAULT_THEME
527
- };
528
-
529
- const COMPONENT_ID$p = 'forms.radio';
530
- const colorStyles$7 = props => {
531
- const SHADE = 600;
532
- const borderColor = getColorV8('neutralHue', SHADE - 300, props.theme);
533
- const backgroundColor = getColorV8('background', 600 , props.theme);
534
- const iconColor = backgroundColor;
535
- const hoverBackgroundColor = getColorV8('primaryHue', SHADE, props.theme, 0.08);
536
- const hoverBorderColor = getColorV8('primaryHue', SHADE, props.theme);
537
- const focusBorderColor = hoverBorderColor;
538
- const activeBackgroundColor = getColorV8('primaryHue', SHADE, props.theme, 0.2);
539
- const activeBorderColor = focusBorderColor;
540
- const checkedBorderColor = focusBorderColor;
541
- const checkedBackgroundColor = checkedBorderColor;
542
- const checkedHoverBorderColor = getColorV8('primaryHue', SHADE + 100, props.theme);
543
- const checkedHoverBackgroundColor = checkedHoverBorderColor;
544
- const checkedActiveBorderColor = getColorV8('primaryHue', SHADE + 200, props.theme);
545
- const checkedActiveBackgroundColor = checkedActiveBorderColor;
546
- const disabledBackgroundColor = getColorV8('neutralHue', SHADE - 400, props.theme);
547
- return css(["& ~ ", "::before{border-color:", ";background-color:", ";}& ~ ", " > svg{color:", ";}& ~ ", ":hover::before{border-color:", ";background-color:", ";}", " & ~ ", ":active::before{border-color:", ";background-color:", ";}&:checked ~ ", "::before{border-color:", ";background-color:", ";}&:enabled:checked ~ ", ":hover::before{border-color:", ";background-color:", ";}&:enabled:checked ~ ", ":active::before{border-color:", ";background-color:", ";}&:disabled ~ ", "::before{border-color:transparent;background-color:", ";}"], StyledRadioLabel, borderColor, backgroundColor, StyledRadioLabel, iconColor, StyledRadioLabel, hoverBorderColor, hoverBackgroundColor, focusStyles({
548
- theme: props.theme,
549
- styles: {
550
- borderColor: focusBorderColor
551
- },
552
- selector: `&:focus-visible ~ ${StyledRadioLabel}::before`
553
- }), StyledRadioLabel, activeBorderColor, activeBackgroundColor, StyledRadioLabel, checkedBorderColor, checkedBackgroundColor, StyledRadioLabel, checkedHoverBorderColor, checkedHoverBackgroundColor, StyledRadioLabel, checkedActiveBorderColor, checkedActiveBackgroundColor, StyledRadioLabel, disabledBackgroundColor);
554
- };
555
- const sizeStyles$9 = props => {
556
- const lineHeight = `${props.theme.space.base * 5}px`;
557
- const size = `${props.theme.space.base * 4}px`;
558
- const top = math(`(${lineHeight} - ${size}) / 2`);
559
- const iconSize = props.theme.iconSizes.sm;
560
- const iconPosition = math(`(${size} - ${iconSize}) / 2`);
561
- const iconTop = math(`${iconPosition} + ${top}`);
562
- const marginTop = `${props.theme.space.base * (props.isCompact ? 1 : 2)}px`;
563
- return css(["top:", ";width:", ";height:", ";& ~ ", "::before{top:", ";background-size:", ";width:", ";height:", ";box-sizing:border-box;}& ~ ", " > svg{top:", ";", ":", ";width:", ";height:", ";}&& ~ ", " ~ ", "{margin-top:", ";}"], top, size, size, StyledRadioLabel, top, props.theme.iconSizes.sm, size, size, StyledRadioLabel, iconTop, props.theme.rtl ? 'right' : 'left', iconPosition, iconSize, iconSize, StyledRadioLabel, StyledMessage, marginTop);
564
- };
565
- const StyledRadioInput = styled.input.attrs({
566
- 'data-garden-id': COMPONENT_ID$p,
567
- 'data-garden-version': '9.0.0-next.7',
568
- type: 'radio'
569
- }).withConfig({
570
- displayName: "StyledRadioInput",
571
- componentId: "sc-qsavpv-0"
572
- })(["position:absolute;opacity:0;margin:0;& ~ ", "::before{position:absolute;", ":0;transition:border-color .25s ease-in-out,box-shadow .1s ease-in-out,background-color .25s ease-in-out,color .25s ease-in-out;border:", ";border-radius:50%;background-repeat:no-repeat;background-position:center;content:'';}& ~ ", " > svg{position:absolute;}", ";&:focus ~ ", "::before{outline:none;}& ~ ", ":active::before{transition:border-color 0.1s ease-in-out,background-color 0.1s ease-in-out,color 0.1s ease-in-out;}", ";&:disabled ~ ", "{cursor:default;}", ";"], StyledRadioLabel, props => props.theme.rtl ? 'right' : 'left', props => props.theme.borders.sm, StyledRadioLabel, props => sizeStyles$9(props), StyledRadioLabel, StyledRadioLabel, props => colorStyles$7(props), StyledRadioLabel, props => retrieveComponentStyles(COMPONENT_ID$p, props));
573
- StyledRadioInput.defaultProps = {
574
- theme: DEFAULT_THEME
575
- };
576
-
577
- const COMPONENT_ID$o = 'forms.checkbox';
578
- const colorStyles$6 = props => {
579
- const SHADE = 600;
580
- const indeterminateBorderColor = getColorV8('primaryHue', SHADE, props.theme);
581
- const indeterminateBackgroundColor = indeterminateBorderColor;
582
- const indeterminateActiveBorderColor = getColorV8('primaryHue', SHADE + 100, props.theme);
583
- const indeterminateActiveBackgroundColor = indeterminateActiveBorderColor;
584
- const indeterminateDisabledBackgroundColor = getColorV8('neutralHue', SHADE - 400, props.theme);
585
- return css(["&:indeterminate ~ ", "::before{border-color:", ";background-color:", ";}&:enabled:indeterminate ~ ", ":active::before{border-color:", ";background-color:", ";}&:disabled:indeterminate ~ ", "::before{border-color:transparent;background-color:", ";}"], StyledCheckLabel, indeterminateBorderColor, indeterminateBackgroundColor, StyledCheckLabel, indeterminateActiveBorderColor, indeterminateActiveBackgroundColor, StyledCheckLabel, indeterminateDisabledBackgroundColor);
586
- };
587
- const StyledCheckInput = styled(StyledRadioInput).attrs({
588
- 'data-garden-id': COMPONENT_ID$o,
589
- 'data-garden-version': '9.0.0-next.7',
590
- type: 'checkbox'
591
- }).withConfig({
592
- displayName: "StyledCheckInput",
593
- componentId: "sc-176jxxe-0"
594
- })(["& ~ ", "::before{border-radius:", ";}", ";", ";"], StyledCheckLabel, props => props.theme.borderRadii.md, props => colorStyles$6(props), props => retrieveComponentStyles(COMPONENT_ID$o, props));
595
- StyledCheckInput.defaultProps = {
596
- theme: DEFAULT_THEME
597
- };
598
-
599
- const COMPONENT_ID$n = 'forms.radio_message';
600
- const StyledRadioMessage = styled(StyledMessage).attrs({
601
- 'data-garden-id': COMPONENT_ID$n,
602
- 'data-garden-version': '9.0.0-next.7'
603
- }).withConfig({
604
- displayName: "StyledRadioMessage",
605
- componentId: "sc-1pmi0q8-0"
606
- })(["padding-", ":", ";", ";"], props => props.theme.rtl ? 'right' : 'left', props => math(`${props.theme.space.base} * 6px`), props => retrieveComponentStyles(COMPONENT_ID$n, props));
607
- StyledRadioMessage.defaultProps = {
608
- theme: DEFAULT_THEME
609
- };
610
-
611
- const COMPONENT_ID$m = 'forms.checkbox_message';
612
- const StyledCheckMessage = styled(StyledRadioMessage).attrs({
613
- 'data-garden-id': COMPONENT_ID$m,
614
- 'data-garden-version': '9.0.0-next.7'
615
- }).withConfig({
616
- displayName: "StyledCheckMessage",
617
- componentId: "sc-s4p6kd-0"
618
- })(["", ";"], props => retrieveComponentStyles(COMPONENT_ID$m, props));
619
- StyledCheckMessage.defaultProps = {
620
- theme: DEFAULT_THEME
621
- };
622
-
623
- var _path$m;
624
- function _extends$p() { _extends$p = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$p.apply(this, arguments); }
625
- var SvgCheckSmFill = function SvgCheckSmFill(props) {
626
- return /*#__PURE__*/React.createElement("svg", _extends$p({
627
- xmlns: "http://www.w3.org/2000/svg",
628
- width: 12,
629
- height: 12,
630
- focusable: "false",
631
- viewBox: "0 0 12 12",
632
- "aria-hidden": "true"
633
- }, props), _path$m || (_path$m = /*#__PURE__*/React.createElement("path", {
634
- fill: "none",
635
- stroke: "currentColor",
636
- strokeLinecap: "round",
637
- strokeLinejoin: "round",
638
- strokeWidth: 2,
639
- d: "M3 6l2 2 4-4"
640
- })));
641
- };
642
-
643
- const COMPONENT_ID$l = 'forms.check_svg';
644
- const StyledCheckSvg = styled(SvgCheckSmFill).attrs({
645
- 'data-garden-id': COMPONENT_ID$l,
646
- 'data-garden-version': '9.0.0-next.7'
647
- }).withConfig({
648
- displayName: "StyledCheckSvg",
649
- componentId: "sc-fvxetk-0"
650
- })(["transition:opacity 0.25s ease-in-out;opacity:0;pointer-events:none;", ":checked ~ ", " > &{opacity:1;}", ":indeterminate ~ ", " > &{opacity:0;}", ";"], StyledCheckInput, StyledCheckLabel, StyledCheckInput, StyledCheckLabel, props => retrieveComponentStyles(COMPONENT_ID$l, props));
651
- StyledCheckSvg.defaultProps = {
652
- theme: DEFAULT_THEME
653
- };
654
-
655
- var _path$l;
656
- function _extends$o() { _extends$o = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$o.apply(this, arguments); }
657
- var SvgDashFill = function SvgDashFill(props) {
658
- return /*#__PURE__*/React.createElement("svg", _extends$o({
659
- xmlns: "http://www.w3.org/2000/svg",
660
- width: 12,
661
- height: 12,
662
- focusable: "false",
663
- viewBox: "0 0 12 12",
664
- "aria-hidden": "true"
665
- }, props), _path$l || (_path$l = /*#__PURE__*/React.createElement("path", {
666
- stroke: "currentColor",
667
- strokeLinecap: "round",
668
- strokeWidth: 2,
669
- d: "M3 6h6"
670
- })));
671
- };
672
-
673
- const COMPONENT_ID$k = 'forms.dash_svg';
674
- const StyledDashSvg = styled(SvgDashFill).attrs({
675
- 'data-garden-id': COMPONENT_ID$k,
676
- 'data-garden-version': '9.0.0-next.7'
677
- }).withConfig({
678
- displayName: "StyledDashSvg",
679
- componentId: "sc-z3vq71-0"
680
- })(["transition:opacity 0.25s ease-in-out;opacity:0;pointer-events:none;", ":indeterminate ~ ", " > &{opacity:1;}", ";"], StyledCheckInput, StyledCheckLabel, props => retrieveComponentStyles(COMPONENT_ID$k, props));
681
- StyledDashSvg.defaultProps = {
682
- theme: DEFAULT_THEME
683
- };
684
-
685
- const COMPONENT_ID$j = 'forms.file_upload';
686
- const colorStyles$5 = props => {
687
- const baseColor = getColorV8('primaryHue', 600, props.theme);
688
- const hoverColor = getColorV8('primaryHue', 700, props.theme);
689
- const activeColor = getColorV8('primaryHue', 800, props.theme);
690
- const disabledBackgroundColor = getColorV8('neutralHue', 200, props.theme);
691
- const disabledForegroundColor = getColorV8('neutralHue', 400, props.theme);
692
- return css(["border-color:", ";background-color:", ";color:", ";&:hover{border-color:", ";background-color:", ";color:", ";}", " &:active{border-color:", ";background-color:", ";color:", ";}&[aria-disabled='true']{border-color:", ";background-color:", ";color:", ";}"], props.isDragging ? activeColor : getColorV8('neutralHue', 600, props.theme), props.isDragging && rgba(baseColor, 0.2), props.isDragging ? activeColor : baseColor, hoverColor, rgba(baseColor, 0.08), hoverColor, focusStyles({
693
- theme: props.theme,
694
- hue: baseColor
695
- }), activeColor, rgba(baseColor, 0.2), activeColor, disabledForegroundColor, disabledBackgroundColor, disabledForegroundColor);
696
- };
697
- const sizeStyles$8 = props => {
698
- const marginTop = `${props.theme.space.base * (props.isCompact ? 1 : 2)}px`;
699
- const paddingHorizontal = `${props.isCompact ? 2 : 4}em`;
700
- const paddingVertical = math(`${props.theme.space.base * (props.isCompact ? 2.5 : 5)} - ${props.theme.borderWidths.sm}`);
701
- const fontSize = props.theme.fontSizes.md;
702
- const lineHeight = getLineHeight(props.theme.space.base * 5, fontSize);
703
- return css(["padding:", " ", ";min-width:4em;line-height:", ";font-size:", ";", ":not([hidden]) + &&,", " + &&,", " + &&,&& + ", ",&& + ", "{margin-top:", ";}"], paddingVertical, paddingHorizontal, lineHeight, fontSize, StyledLabel, StyledHint, StyledMessage, StyledHint, StyledMessage, marginTop);
704
- };
705
- const StyledFileUpload = styled.div.attrs({
706
- 'data-garden-id': COMPONENT_ID$j,
707
- 'data-garden-version': '9.0.0-next.7'
708
- }).withConfig({
709
- displayName: "StyledFileUpload",
710
- componentId: "sc-1rodjgn-0"
711
- })(["display:flex;align-items:center;justify-content:center;box-sizing:border-box;direction:", ";transition:border-color 0.25s ease-in-out,box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out,color 0.25s ease-in-out;border:dashed ", ";border-radius:", ";cursor:pointer;text-align:center;user-select:none;", ";&[aria-disabled='true']{cursor:default;}", ";", ";"], props => props.theme.rtl ? 'rtl' : 'ltr', props => props.theme.borderWidths.sm, props => props.theme.borderRadii.md, sizeStyles$8, colorStyles$5, props => retrieveComponentStyles(COMPONENT_ID$j, props));
712
- StyledFileUpload.defaultProps = {
713
- theme: DEFAULT_THEME
714
- };
715
-
716
- const COMPONENT_ID$i = 'forms.file.close';
717
- const StyledFileClose = styled.button.attrs({
718
- 'data-garden-id': COMPONENT_ID$i,
719
- 'data-garden-version': '9.0.0-next.7'
720
- }).withConfig({
721
- displayName: "StyledFileClose",
722
- componentId: "sc-1m31jbf-0"
723
- })(["display:flex;flex-shrink:0;align-items:center;justify-content:center;transition:opacity 0.25s ease-in-out;opacity:0.8;border:none;background:transparent;cursor:pointer;color:", ";appearance:none;&:hover{opacity:0.9;}&:focus{outline:none;}", ";"], props => getColorV8('foreground', 600 , props.theme), props => retrieveComponentStyles(COMPONENT_ID$i, props));
724
- StyledFileClose.defaultProps = {
725
- theme: DEFAULT_THEME
726
- };
727
-
728
- const COMPONENT_ID$h = 'forms.file';
729
- const colorStyles$4 = props => {
730
- let borderColor;
731
- let focusBorderColor;
732
- let foregroundColor;
733
- if (props.validation === 'success') {
734
- borderColor = getColorV8('successHue', 600, props.theme);
735
- focusBorderColor = borderColor;
736
- foregroundColor = borderColor;
737
- } else if (props.validation === 'error') {
738
- borderColor = getColorV8('dangerHue', 600, props.theme);
739
- focusBorderColor = borderColor;
740
- foregroundColor = borderColor;
741
- } else {
742
- borderColor = getColorV8('neutralHue', 300, props.theme);
743
- focusBorderColor = getColorV8('primaryHue', 600, props.theme);
744
- foregroundColor = getColorV8('foreground', 600 , props.theme);
745
- }
746
- return css(["border-color:", ";color:", ";", ""], borderColor, foregroundColor, focusStyles({
747
- theme: props.theme,
748
- inset: props.focusInset,
749
- hue: focusBorderColor,
750
- styles: {
751
- borderColor: focusBorderColor
752
- }
753
- }));
754
- };
755
- const sizeStyles$7 = props => {
756
- const size = `${props.theme.space.base * (props.isCompact ? 7 : 10)}px`;
757
- const spacing = `${props.theme.space.base * (props.isCompact ? 2 : 3)}px`;
758
- const fontSize = props.theme.fontSizes.md;
759
- const lineHeight = getLineHeight(props.theme.space.base * 5, fontSize);
760
- return `
761
- box-sizing: border-box;
762
- border: ${props.theme.borders.sm};
763
- border-radius: ${props.theme.borderRadii.md};
764
- padding: 0 ${spacing};
765
- height: ${size};
766
- line-height: ${lineHeight};
767
- font-size: ${fontSize};
768
-
769
- & > span {
770
- width: 100%;
771
- }
772
-
773
- & > ${StyledFileClose} {
774
- width: ${size};
775
- height: ${size};
776
- margin-${props.theme.rtl ? 'left' : 'right'}: -${spacing};
777
- }
778
- `;
779
- };
780
- const StyledFile = styled.div.attrs({
781
- 'data-garden-id': COMPONENT_ID$h,
782
- 'data-garden-version': '9.0.0-next.7'
783
- }).withConfig({
784
- displayName: "StyledFile",
785
- componentId: "sc-195lzp1-0"
786
- })(["display:flex;position:relative;flex-wrap:nowrap;align-items:center;transition:box-shadow 0.1s ease-in-out;", ";", ";& > span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}& > [role='progressbar']{position:absolute;bottom:0;left:0;transition:opacity 0.2s ease-in-out;margin:0;border-top-left-radius:0;border-top-right-radius:0;width:100%;& > div{border-top-", "-radius:0;}}& > [role='progressbar'][aria-valuenow='0'],& > [role='progressbar'][aria-valuenow='100']{opacity:0;}", ";"], sizeStyles$7, colorStyles$4, props => props.theme.rtl ? 'right' : 'left', props => retrieveComponentStyles(COMPONENT_ID$h, props));
787
- StyledFile.defaultProps = {
788
- theme: DEFAULT_THEME
789
- };
790
-
791
- const COMPONENT_ID$g = 'forms.file.delete';
792
- const StyledFileDelete = styled(StyledFileClose).attrs({
793
- 'data-garden-id': COMPONENT_ID$g,
794
- 'data-garden-version': '9.0.0-next.7'
795
- }).withConfig({
796
- displayName: "StyledFileDelete",
797
- componentId: "sc-a8nnhx-0"
798
- })(["color:", ";", ";"], props => getColorV8('dangerHue', 600, props.theme), props => retrieveComponentStyles(COMPONENT_ID$g, props));
799
- StyledFileDelete.defaultProps = {
800
- theme: DEFAULT_THEME
801
- };
802
-
803
- const COMPONENT_ID$f = 'forms.file.icon';
804
- const StyledFileIcon = styled(_ref => {
805
- let {
806
- children,
807
- isCompact,
808
- theme,
809
- ...props
810
- } = _ref;
811
- return React__default.cloneElement(Children.only(children), props);
812
- }).attrs({
813
- 'data-garden-id': COMPONENT_ID$f,
814
- 'data-garden-version': '9.0.0-next.7'
815
- }).withConfig({
816
- displayName: "StyledFileIcon",
817
- componentId: "sc-7b3q0c-0"
818
- })(["flex-shrink:0;width:", ";margin-", ":", "px;", ";"], props => props.isCompact ? props.theme.iconSizes.sm : props.theme.iconSizes.md, props => props.theme.rtl ? 'left' : 'right', props => props.theme.space.base * 2, props => retrieveComponentStyles(COMPONENT_ID$f, props));
819
- StyledFileIcon.defaultProps = {
820
- theme: DEFAULT_THEME
821
- };
822
-
823
- const COMPONENT_ID$e = 'forms.file_list';
824
- const StyledFileList = styled.ul.attrs({
825
- 'data-garden-id': COMPONENT_ID$e,
826
- 'data-garden-version': '9.0.0-next.7'
827
- }).withConfig({
828
- displayName: "StyledFileList",
829
- componentId: "sc-gbahjg-0"
830
- })(["margin:0;padding:0;list-style:none;", ";"], props => retrieveComponentStyles(COMPONENT_ID$e, props));
831
- StyledFileList.defaultProps = {
832
- theme: DEFAULT_THEME
833
- };
834
-
835
- const COMPONENT_ID$d = 'forms.file_list.item';
836
- const StyledFileListItem = styled.li.attrs({
837
- 'data-garden-id': COMPONENT_ID$d,
838
- 'data-garden-version': '9.0.0-next.7'
839
- }).withConfig({
840
- displayName: "StyledFileListItem",
841
- componentId: "sc-1ova3lo-0"
842
- })(["&:not(:first-child),", " ~ ", " > &:first-child{margin-top:", "px;}", ";"], StyledFileUpload, StyledFileList, props => props.theme.space.base * 2, props => retrieveComponentStyles(COMPONENT_ID$d, props));
843
- StyledFileListItem.defaultProps = {
844
- theme: DEFAULT_THEME
845
- };
846
-
847
- var _circle$3;
848
- function _extends$n() { _extends$n = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$n.apply(this, arguments); }
849
- var SvgCircleSmFill$1 = function SvgCircleSmFill(props) {
850
- return /*#__PURE__*/React.createElement("svg", _extends$n({
851
- xmlns: "http://www.w3.org/2000/svg",
852
- width: 12,
853
- height: 12,
854
- focusable: "false",
855
- viewBox: "0 0 12 12",
856
- "aria-hidden": "true"
857
- }, props), _circle$3 || (_circle$3 = /*#__PURE__*/React.createElement("circle", {
858
- cx: 6,
859
- cy: 6,
860
- r: 2,
861
- fill: "currentColor"
862
- })));
863
- };
864
-
865
- const COMPONENT_ID$c = 'forms.radio_svg';
866
- const StyledRadioSvg = styled(SvgCircleSmFill$1).attrs({
867
- 'data-garden-id': COMPONENT_ID$c,
868
- 'data-garden-version': '9.0.0-next.7'
869
- }).withConfig({
870
- displayName: "StyledRadioSvg",
871
- componentId: "sc-1r1qtr1-0"
872
- })(["transition:opacity 0.25s ease-in-out;opacity:0;", ":checked ~ ", " > &{opacity:1;}", ";"], StyledRadioInput, StyledRadioLabel, props => retrieveComponentStyles(COMPONENT_ID$c, props));
873
- StyledRadioSvg.defaultProps = {
874
- theme: DEFAULT_THEME
875
- };
876
-
877
- const COMPONENT_ID$b = 'forms.toggle_label';
878
- const sizeStyles$6 = props => {
879
- const size = props.theme.space.base * 10;
880
- const padding = size + props.theme.space.base * 2;
881
- return css(["padding-", ":", "px;&[hidden]{padding-", ":", "px;}"], props.theme.rtl ? 'right' : 'left', padding, props.theme.rtl ? 'right' : 'left', size);
882
- };
883
- const StyledToggleLabel = styled(StyledCheckLabel).attrs({
884
- 'data-garden-id': COMPONENT_ID$b,
885
- 'data-garden-version': '9.0.0-next.7'
886
- }).withConfig({
887
- displayName: "StyledToggleLabel",
888
- componentId: "sc-e0asdk-0"
889
- })(["", ";", ";"], props => sizeStyles$6(props), props => retrieveComponentStyles(COMPONENT_ID$b, props));
890
- StyledToggleLabel.defaultProps = {
891
- theme: DEFAULT_THEME
892
- };
893
-
894
- const COMPONENT_ID$a = 'forms.toggle_hint';
895
- const StyledToggleHint = styled(StyledHint).attrs({
896
- 'data-garden-id': COMPONENT_ID$a,
897
- 'data-garden-version': '9.0.0-next.7'
898
- }).withConfig({
899
- displayName: "StyledToggleHint",
900
- componentId: "sc-nziggu-0"
901
- })(["padding-", ":", ";", ";"], props => props.theme.rtl ? 'right' : 'left', props => math(`${props.theme.space.base} * 12px`), props => retrieveComponentStyles(COMPONENT_ID$a, props));
902
- StyledToggleHint.defaultProps = {
903
- theme: DEFAULT_THEME
904
- };
905
-
906
- const COMPONENT_ID$9 = 'forms.toggle';
907
- const colorStyles$3 = props => {
908
- const SHADE = 600;
909
- const backgroundColor = getColorV8('neutralHue', SHADE - 100, props.theme);
910
- const hoverBackgroundColor = getColorV8('neutralHue', SHADE, props.theme);
911
- const activeBackgroundColor = getColorV8('neutralHue', SHADE + 100, props.theme);
912
- return css(["& ~ ", "::before{background-color:", ";}&:enabled ~ ", ":hover::before{background-color:", ";}&:enabled ~ ", ":active::before{background-color:", ";}"], StyledToggleLabel, backgroundColor, StyledToggleLabel, hoverBackgroundColor, StyledToggleLabel, activeBackgroundColor);
913
- };
914
- const sizeStyles$5 = props => {
915
- const height = `${props.theme.space.base * 5}px`;
916
- const width = `${props.theme.space.base * 10}px`;
917
- const iconSize = props.theme.iconSizes.md;
918
- const iconPosition = math(`(${height} - ${iconSize}) / 2`);
919
- const checkedIconPosition = math(`${width} - ${iconSize} - ${iconPosition}`);
920
- return css(["top:0;width:", ";height:", ";& ~ ", "::before{width:", ";height:", ";}& ~ ", " > svg{top:", ";", ":", ";width:", ";height:", ";}&:checked ~ ", " > svg{", ":", ";}"], width, height, StyledToggleLabel, width, height, StyledToggleLabel, iconPosition, props.theme.rtl ? 'right' : 'left', iconPosition, iconSize, iconSize, StyledToggleLabel, props.theme.rtl ? 'right' : 'left', checkedIconPosition);
921
- };
922
- const StyledToggleInput = styled(StyledCheckInput).attrs({
923
- 'data-garden-id': COMPONENT_ID$9,
924
- 'data-garden-version': '9.0.0-next.7'
925
- }).withConfig({
926
- displayName: "StyledToggleInput",
927
- componentId: "sc-sgp47s-0"
928
- })(["& ~ ", "::before{top:0;transition:box-shadow .1s ease-in-out,background-color .15s ease-in-out,color .25s ease-in-out;border:none;border-radius:100px;}", ";", ";", ";"], StyledToggleLabel, props => sizeStyles$5(props), props => colorStyles$3(props), props => retrieveComponentStyles(COMPONENT_ID$9, props));
929
- StyledToggleInput.defaultProps = {
930
- theme: DEFAULT_THEME
931
- };
932
-
933
- const COMPONENT_ID$8 = 'forms.toggle_message';
934
- const StyledToggleMessage = styled(StyledMessage).attrs({
935
- 'data-garden-id': COMPONENT_ID$8,
936
- 'data-garden-version': '9.0.0-next.7'
937
- }).withConfig({
938
- displayName: "StyledToggleMessage",
939
- componentId: "sc-13vuvl1-0"
940
- })(["padding-", ":", ";& ", "{", ":", ";}", ";"], props => props.theme.rtl ? 'right' : 'left', props => math(`${props.theme.space.base} * 12px`), StyledMessageIcon, props => props.theme.rtl ? 'right' : 'left', props => math(`${props.theme.space.base} * 10px - ${props.theme.iconSizes.md}`), props => retrieveComponentStyles(COMPONENT_ID$8, props));
941
- StyledToggleMessage.defaultProps = {
942
- theme: DEFAULT_THEME
943
- };
944
-
945
- var _circle$2;
946
- function _extends$m() { _extends$m = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$m.apply(this, arguments); }
947
- var SvgCircleSmFill = function SvgCircleSmFill(props) {
948
- return /*#__PURE__*/React.createElement("svg", _extends$m({
949
- xmlns: "http://www.w3.org/2000/svg",
950
- width: 16,
951
- height: 16,
952
- focusable: "false",
953
- viewBox: "0 0 16 16",
954
- "aria-hidden": "true"
955
- }, props), _circle$2 || (_circle$2 = /*#__PURE__*/React.createElement("circle", {
956
- cx: 8,
957
- cy: 8,
958
- r: 6,
959
- fill: "currentColor"
960
- })));
961
- };
962
-
963
- const COMPONENT_ID$7 = 'forms.toggle_svg';
964
- const StyledToggleSvg = styled(SvgCircleSmFill).attrs({
965
- 'data-garden-id': COMPONENT_ID$7,
966
- 'data-garden-version': '9.0.0-next.7'
967
- }).withConfig({
968
- displayName: "StyledToggleSvg",
969
- componentId: "sc-162xbyx-0"
970
- })(["transition:all 0.15s ease-in-out;", ";"], props => retrieveComponentStyles(COMPONENT_ID$7, props));
971
- StyledToggleSvg.defaultProps = {
972
- theme: DEFAULT_THEME
973
- };
974
-
975
- const COMPONENT_ID$6 = 'forms.select';
976
- const colorStyles$2 = props => {
977
- const color = getColorV8('neutralHue', 700, props.theme);
978
- return css(["&:hover + ", ",&:focus + ", ",&:focus-visible + ", "{color:", ";}"], StyledTextMediaFigure, StyledTextMediaFigure, StyledTextMediaFigure, color);
979
- };
980
- const sizeStyles$4 = props => {
981
- const padding = math(`${props.theme.iconSizes.md} + ${props.theme.space.base * 5}`);
982
- const iconVerticalPosition = `${props.theme.space.base * (props.isCompact ? 1.5 : 2.5) + 1}px`;
983
- const iconHorizontalPosition = `${props.theme.space.base * 3}px`;
984
- return css(["padding-", ":", ";& + ", "{top:", ";", ":", ";}"], props.theme.rtl ? 'left' : 'right', !props.isBare && padding, StyledTextMediaFigure, iconVerticalPosition, props.theme.rtl ? 'left' : 'right', iconHorizontalPosition);
985
- };
986
- const StyledSelect = styled(StyledTextInput).attrs({
987
- 'data-garden-id': COMPONENT_ID$6,
988
- 'data-garden-version': '9.0.0-next.7',
989
- as: 'select'
990
- }).withConfig({
991
- displayName: "StyledSelect",
992
- componentId: "sc-8xdxpt-0"
993
- })(["cursor:pointer;text-overflow:ellipsis;", ";", ";&::-ms-expand{display:none;}&::-ms-value{background-color:transparent;color:inherit;}&:-moz-focusring{transition:none;text-shadow:0 0 0 ", ";color:transparent;}& + ", "{position:absolute;pointer-events:none;}"], props => sizeStyles$4(props), props => colorStyles$2(props), props => getColorV8('foreground', 600 , props.theme), StyledTextMediaFigure);
994
- StyledSelect.defaultProps = {
995
- theme: DEFAULT_THEME
996
- };
997
-
998
- const COMPONENT_ID$5 = 'forms.select_wrapper';
999
- const StyledSelectWrapper = styled(StyledTextFauxInput).attrs({
1000
- 'data-garden-id': COMPONENT_ID$5,
1001
- 'data-garden-version': '9.0.0-next.7'
1002
- }).withConfig({
1003
- displayName: "StyledSelectWrapper",
1004
- componentId: "sc-i7b6hw-0"
1005
- })(["position:relative;padding:0;overflow:visible;& > ", "{border-color:transparent;background-color:transparent;", "{box-shadow:unset;}}"], StyledSelect, SELECTOR_FOCUS_VISIBLE);
1006
- StyledSelectWrapper.defaultProps = {
1007
- theme: DEFAULT_THEME
1008
- };
1009
-
1010
- const COMPONENT_ID$4 = 'forms.range';
1011
- const thumbStyles = function (styles) {
1012
- let modifier = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
1013
- return `
1014
- &${modifier}::-moz-range-thumb {
1015
- ${styles}
1016
- }
1017
-
1018
- &${modifier}::-ms-thumb {
1019
- ${styles}
1020
- }
1021
-
1022
- &${modifier}::-webkit-slider-thumb {
1023
- ${styles}
1024
- }
1025
- `;
1026
- };
1027
- const trackStyles = function (styles) {
1028
- let modifier = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
1029
- return `
1030
- &${modifier}::-moz-range-track {
1031
- ${styles}
1032
- }
1033
-
1034
- &${modifier}::-ms-track {
1035
- ${styles}
1036
- }
1037
-
1038
- &${modifier}::-webkit-slider-runnable-track {
1039
- ${styles}
1040
- }
1041
- `;
1042
- };
1043
- const trackLowerStyles = function (styles) {
1044
- let modifier = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
1045
- return `
1046
- &${modifier}::-moz-range-progress {
1047
- ${styles}
1048
- }
1049
-
1050
- &${modifier}::-ms-fill-lower {
1051
- ${styles}
1052
- }
1053
- `;
1054
- };
1055
- const colorStyles$1 = props => {
1056
- const SHADE = 600;
1057
- const thumbBackgroundColor = getColorV8('primaryHue', SHADE, props.theme);
1058
- const thumbBorderColor = thumbBackgroundColor;
1059
- const thumbBoxShadow = props.theme.shadows.lg(math(`${props.theme.space.base} * 1px`), math(`${props.theme.space.base} * 2px`), getColorV8('neutralHue', SHADE + 200, props.theme, 0.24));
1060
- const thumbFocusBoxShadow = getFocusBoxShadow({
1061
- theme: props.theme
1062
- });
1063
- const thumbActiveBackgroundColor = getColorV8('primaryHue', SHADE + 100, props.theme);
1064
- const thumbActiveBorderColor = thumbBorderColor;
1065
- const thumbDisabledBackgroundColor = getColorV8('neutralHue', SHADE - 300, props.theme);
1066
- const thumbDisabledBorderColor = thumbDisabledBackgroundColor;
1067
- const thumbHoverBackgroundColor = thumbActiveBackgroundColor;
1068
- const thumbHoverBorderColor = thumbHoverBackgroundColor;
1069
- const trackBackgroundColor = getColorV8('neutralHue', SHADE - 400, props.theme);
1070
- const trackLowerBackgroundColor = props.hasLowerTrack ? thumbBackgroundColor : '';
1071
- const trackBackgroundImage = props.hasLowerTrack ? `linear-gradient(${trackLowerBackgroundColor}, ${trackLowerBackgroundColor})` : '';
1072
- const trackDisabledLowerBackgroundColor = props.hasLowerTrack ? thumbDisabledBackgroundColor : '';
1073
- const trackDisabledBackgroundImage = props.hasLowerTrack ? `linear-gradient(${trackDisabledLowerBackgroundColor}, ${trackDisabledLowerBackgroundColor})` : '';
1074
- return css(["", " ", " ", " ", " ", " ", " ", " ", " ", ""], trackStyles(`
1075
- background-color: ${trackBackgroundColor};
1076
- background-image: ${trackBackgroundImage}; /* provide means for styling lower range on WebKit */
1077
- `), thumbStyles(`
1078
- border-color: ${thumbBorderColor};
1079
- box-shadow: ${thumbBoxShadow};
1080
- background-color: ${thumbBackgroundColor};
1081
- `), trackLowerStyles(`
1082
- background-color: ${trackLowerBackgroundColor};
1083
- `), thumbStyles(`
1084
- transition:
1085
- border-color .25s ease-in-out,
1086
- background-color .25s ease-in-out;
1087
- border-color: ${thumbHoverBorderColor};
1088
- background-color: ${thumbHoverBackgroundColor};
1089
- `, ':hover'), thumbStyles(`
1090
- box-shadow: ${thumbFocusBoxShadow};
1091
- `, ':focus-visible'), thumbStyles(`
1092
- border-color: ${thumbActiveBorderColor};
1093
- background-color: ${thumbActiveBackgroundColor};
1094
- `, ':active'), trackStyles(`
1095
- background-image: ${trackDisabledBackgroundImage};
1096
- `, ':disabled'), thumbStyles(`
1097
- border-color: ${thumbDisabledBorderColor};
1098
- box-shadow: none;
1099
- background-color: ${thumbDisabledBackgroundColor};
1100
- `, ':disabled'), trackLowerStyles(`
1101
- background-color: ${trackDisabledLowerBackgroundColor};
1102
- `, ':disabled'));
1103
- };
1104
- const sizeStyles$3 = props => {
1105
- const thumbSize = math(`${props.theme.space.base} * 5px`);
1106
- const trackHeight = math(`${props.theme.space.base} * 1.5px`);
1107
- const trackBorderRadius = trackHeight;
1108
- const trackMargin = math(`(${thumbSize} - ${trackHeight}) / 2 + ${props.theme.shadowWidths.md}`);
1109
- const thumbMargin = math(`(${trackHeight} - ${thumbSize}) / 2`);
1110
- return css(["", ":not([hidden]) + &,", " + &,", " + &,& + ", ",& + ", "{margin-top:", ";}", ";", " ", ""], StyledLabel, StyledHint, StyledMessage, StyledHint, StyledMessage, math(`${props.theme.space.base} * 2px`), trackStyles(`
1111
- margin: ${trackMargin} 0;
1112
- border-radius: ${trackBorderRadius};
1113
- height: ${trackHeight};
1114
- `), thumbStyles(`
1115
- margin: ${thumbMargin} 0; /* reset for IE */
1116
- width: ${thumbSize};
1117
- height: ${thumbSize};
1118
- `), trackLowerStyles(`
1119
- border-top-${props.theme.rtl ? 'right' : 'left'}-radius: ${trackBorderRadius};
1120
- border-bottom-${props.theme.rtl ? 'right' : 'left'}-radius: ${trackBorderRadius};
1121
- height: ${trackHeight};
1122
- `));
1123
- };
1124
- const StyledRangeInput = styled.input.attrs(props => ({
1125
- 'data-garden-id': COMPONENT_ID$4,
1126
- 'data-garden-version': '9.0.0-next.7',
1127
- type: 'range',
1128
- style: {
1129
- backgroundSize: props.hasLowerTrack && props.backgroundSize
1130
- }
1131
- })).withConfig({
1132
- displayName: "StyledRangeInput",
1133
- componentId: "sc-1iv2yqp-0"
1134
- })(["appearance:none;direction:", ";margin:0;background-color:inherit;cursor:pointer;padding:0;width:100%;vertical-align:middle;", " &::-webkit-slider-container,&::-webkit-slider-runnable-track{background-size:inherit;}", ";", " ", ";&::-moz-focus-outer{border:0;}&::-ms-tooltip{display:none;}&:focus{outline:none;}&:disabled{cursor:default;}", ";"], props => props.theme.rtl && 'rtl', props => trackStyles(`
1135
- appearance: none;
1136
- border-color: transparent; /* reset for IE */
1137
- background-repeat: repeat-y;
1138
- background-size: 0;
1139
- background-position: ${props.theme.rtl ? '100% 100%' : '0% 0%'};
1140
- width: 99.8%; /* fix for IE which cuts off the upper track's border radius */
1141
- color: transparent; /* reset for IE */
1142
- box-sizing: border-box; /* reset for IE */
1143
- `), props => sizeStyles$3(props), props => thumbStyles(`
1144
- appearance: none;
1145
- transition: box-shadow .1s ease-in-out;
1146
- border: ${props.theme.borders.md};
1147
- border-radius: 100%;
1148
- box-sizing: border-box;
1149
- `), props => colorStyles$1(props), props => retrieveComponentStyles(COMPONENT_ID$4, props));
1150
- StyledRangeInput.defaultProps = {
1151
- backgroundSize: '0%',
1152
- hasLowerTrack: true,
1153
- theme: DEFAULT_THEME
1154
- };
1155
-
1156
- const COMPONENT_ID$3 = 'forms.tile_icon';
1157
- const sizeStyles$2 = props => {
1158
- const iconSize = math(`${props.theme.iconSizes.md} * 2`);
1159
- let position;
1160
- let top;
1161
- let horizontalValue;
1162
- if (!props.isCentered) {
1163
- position = 'absolute';
1164
- top = `${props.theme.space.base * 6}px`;
1165
- horizontalValue = `left: ${props.theme.space.base * 5}px`;
1166
- if (props.theme.rtl) {
1167
- horizontalValue = `right: ${props.theme.space.base * 5}px`;
1168
- }
1169
- }
1170
- return css(["position:", ";top:", ";", ";& > *{width:", ";height:", ";}"], position, top, horizontalValue, iconSize, iconSize);
1171
- };
1172
- const StyledTileIcon = styled.span.attrs({
1173
- 'data-garden-id': COMPONENT_ID$3,
1174
- 'data-garden-version': '9.0.0-next.7'
1175
- }).withConfig({
1176
- displayName: "StyledTileIcon",
1177
- componentId: "sc-1wazhg4-0"
1178
- })(["display:block;transition:color 0.25s ease-in-out;text-align:center;line-height:0;", ";", ";"], props => sizeStyles$2(props), props => retrieveComponentStyles(COMPONENT_ID$3, props));
1179
- StyledTileIcon.defaultProps = {
1180
- theme: DEFAULT_THEME
1181
- };
1182
-
1183
- const COMPONENT_ID$2 = 'forms.tile';
1184
- const colorStyles = props => {
1185
- const SHADE = 600;
1186
- const iconColor = getColorV8('neutralHue', SHADE, props.theme);
1187
- const color = getColorV8('neutralHue', SHADE + 200, props.theme);
1188
- const borderColor = getColorV8('neutralHue', SHADE - 300, props.theme);
1189
- const hoverBackgroundColor = getColorV8('primaryHue', SHADE, props.theme, 0.08);
1190
- const hoverBorderColor = getColorV8('primaryHue', SHADE, props.theme);
1191
- const focusBorderColor = hoverBorderColor;
1192
- const activeBackgroundColor = getColorV8('primaryHue', SHADE, props.theme, 0.2);
1193
- const activeBorderColor = focusBorderColor;
1194
- const disabledBackgroundColor = getColorV8('neutralHue', SHADE - 500, props.theme);
1195
- const disabledBorderColor = getColorV8('neutralHue', SHADE - 400, props.theme);
1196
- const disabledColor = getColorV8('neutralHue', SHADE - 200, props.theme);
1197
- const selectedBorderColor = focusBorderColor;
1198
- const selectedBackgroundColor = selectedBorderColor;
1199
- const selectedHoverBorderColor = getColorV8('primaryHue', SHADE + 100, props.theme);
1200
- const selectedHoverBackgroundColor = selectedHoverBorderColor;
1201
- const selectedActiveBorderColor = getColorV8('primaryHue', SHADE + 200, props.theme);
1202
- const selectedActiveBackgroundColor = selectedActiveBorderColor;
1203
- const selectedDisabledBackgroundColor = disabledBorderColor;
1204
- return css(["border:", " ", ";border-color:", ";background-color:", ";color:", ";", "{color:", ";}&:hover:not([aria-disabled='true']){border-color:", ";background-color:", ";", "{color:", ";}}", " &:active:not([aria-disabled='true']){border-color:", ";background-color:", ";", "{color:", ";}}&[data-garden-selected='true']{border-color:", ";background-color:", ";color:", ";", "{color:", ";}}&[data-garden-selected='true']:not([aria-disabled='true']):hover{border-color:", ";background-color:", ";color:", ";", "{color:", ";}}&[data-garden-selected='true']:not([aria-disabled='true']):active{border-color:", ";background-color:", ";color:", ";", "{color:", ";}}&[aria-disabled='true']{border-color:", ";background-color:", ";color:", ";", "{color:", ";}}&[data-garden-selected='true'][aria-disabled='true']{background-color:", ";color:", ";", "{color:", ";}}"], props.theme.borders.sm, getColorV8('neutralHue', SHADE - 300, props.theme), borderColor, getColorV8('background', 600 , props.theme), color, StyledTileIcon, iconColor, hoverBorderColor, hoverBackgroundColor, StyledTileIcon, color, focusStyles({
1205
- theme: props.theme,
1206
- hue: focusBorderColor,
1207
- styles: {
1208
- borderColor: focusBorderColor
1209
- },
1210
- selector: `&:focus-within`
1211
- }), activeBorderColor, activeBackgroundColor, StyledTileIcon, color, selectedBorderColor, selectedBackgroundColor, getColorV8('background', 600 , props.theme), StyledTileIcon, getColorV8('background', 600 , props.theme), selectedHoverBorderColor, selectedHoverBackgroundColor, getColorV8('background', 600 , props.theme), StyledTileIcon, getColorV8('background', 600 , props.theme), selectedActiveBorderColor, selectedActiveBackgroundColor, getColorV8('background', 600 , props.theme), StyledTileIcon, getColorV8('background', 600 , props.theme), disabledBorderColor, disabledBackgroundColor, disabledColor, StyledTileIcon, disabledColor, selectedDisabledBackgroundColor, disabledColor, StyledTileIcon, disabledColor);
1212
- };
1213
- const StyledTile = styled.label.attrs(props => ({
1214
- 'data-garden-id': COMPONENT_ID$2,
1215
- 'data-garden-version': '9.0.0-next.7',
1216
- 'data-garden-selected': props.isSelected
1217
- })).withConfig({
1218
- displayName: "StyledTile",
1219
- componentId: "sc-1jjvmxs-0"
1220
- })(["display:block;position:relative;transition:border-color .25s ease-in-out,box-shadow .1s ease-in-out,background-color .25s ease-in-out,color .25s ease-in-out;border-radius:", ";cursor:", ";padding:", "px;direction:", ";min-width:132px;word-break:break-word;", ";", ";"], props => props.theme.borderRadii.md, props => !props.isDisabled && 'pointer', props => props.theme.space.base * 5, props => props.theme.rtl && 'rtl', props => colorStyles(props), props => retrieveComponentStyles(COMPONENT_ID$2, props));
1221
- StyledTile.defaultProps = {
1222
- theme: DEFAULT_THEME
1223
- };
1224
-
1225
- const COMPONENT_ID$1 = 'forms.tile_description';
1226
- const sizeStyles$1 = props => {
1227
- let marginDirection = 'left';
1228
- let marginValue;
1229
- if (props.theme.rtl) {
1230
- marginDirection = 'right';
1231
- }
1232
- if (!props.isCentered) {
1233
- marginValue = math(`(${props.theme.iconSizes.md} * 2) + ${props.theme.space.base * 5}px`);
1234
- }
1235
- return css(["margin-top:", "px;margin-", ":", ";"], props.theme.space.base, marginDirection, marginValue);
1236
- };
1237
- const StyledTileDescription = styled.span.attrs({
1238
- 'data-garden-id': COMPONENT_ID$1,
1239
- 'data-garden-version': '9.0.0-next.7'
1240
- }).withConfig({
1241
- displayName: "StyledTileDescription",
1242
- componentId: "sc-xfuu7u-0"
1243
- })(["display:block;text-align:", ";line-height:", ";font-size:", ";", ";", ";"], props => props.isCentered && 'center', props => getLineHeight(props.theme.space.base * 4, props.theme.fontSizes.sm), props => props.theme.fontSizes.sm, props => sizeStyles$1(props), props => retrieveComponentStyles(COMPONENT_ID$1, props));
1244
- StyledTileDescription.defaultProps = {
1245
- theme: DEFAULT_THEME
1246
- };
1247
-
1248
- const StyledTileInput = styled.input.withConfig({
1249
- displayName: "StyledTileInput",
1250
- componentId: "sc-1nq2m6q-0"
1251
- })(["position:absolute;border:0;clip:rect(1px,1px,1px,1px);padding:0;width:1px;height:1px;overflow:hidden;white-space:nowrap;"]);
1252
- StyledTileInput.defaultProps = {
1253
- theme: DEFAULT_THEME
1254
- };
1255
-
1256
- const COMPONENT_ID = 'forms.tile_label';
1257
- const sizeStyles = props => {
1258
- let marginDirection = 'left';
1259
- let marginTop = `${props.theme.space.base * 2}px`;
1260
- let marginValue;
1261
- if (props.theme.rtl) {
1262
- marginDirection = 'right';
1263
- }
1264
- if (!props.isCentered) {
1265
- marginValue = math(`(${props.theme.iconSizes.md} * 2) + ${props.theme.space.base * 5}px`);
1266
- marginTop = '0';
1267
- }
1268
- return css(["margin-top:", ";margin-", ":", ";"], marginTop, marginDirection, marginValue);
1269
- };
1270
- const StyledTileLabel = styled.span.attrs({
1271
- 'data-garden-id': COMPONENT_ID,
1272
- 'data-garden-version': '9.0.0-next.7'
1273
- }).withConfig({
1274
- displayName: "StyledTileLabel",
1275
- componentId: "sc-1mypv27-0"
1276
- })(["display:block;text-align:", ";line-height:", ";font-size:", ";font-weight:", ";", ";", ";"], props => props.isCentered && 'center', props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), props => props.theme.fontSizes.md, props => props.theme.fontWeights.semibold, props => sizeStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
1277
- StyledTileLabel.defaultProps = {
1278
- theme: DEFAULT_THEME
1279
- };
1280
-
1281
- const InputContext = createContext(undefined);
1282
- const useInputContext = () => {
1283
- return useContext(InputContext);
1284
- };
1285
-
1286
- const Hint = React__default.forwardRef((props, ref) => {
1287
- const {
1288
- hasHint,
1289
- setHasHint,
1290
- getHintProps
1291
- } = useFieldContext() || {};
1292
- const type = useInputContext();
1293
- useEffect(() => {
1294
- if (!hasHint && setHasHint) {
1295
- setHasHint(true);
1296
- }
1297
- return () => {
1298
- if (hasHint && setHasHint) {
1299
- setHasHint(false);
1300
- }
1301
- };
1302
- }, [hasHint, setHasHint]);
1303
- let HintComponent;
1304
- if (type === 'checkbox') {
1305
- HintComponent = StyledCheckHint;
1306
- } else if (type === 'radio') {
1307
- HintComponent = StyledRadioHint;
1308
- } else if (type === 'toggle') {
1309
- HintComponent = StyledToggleHint;
1310
- } else {
1311
- HintComponent = StyledHint;
1312
- }
1313
- let combinedProps = props;
1314
- if (getHintProps) {
1315
- combinedProps = getHintProps(combinedProps);
1316
- }
1317
- return React__default.createElement(HintComponent, _extends$t({
1318
- ref: ref
1319
- }, combinedProps));
1320
- });
1321
- Hint.displayName = 'Hint';
1322
-
1323
- const VALIDATION = ['success', 'warning', 'error'];
1324
- const FILE_VALIDATION = ['success', 'error'];
1325
- const FILE_TYPE = ['pdf', 'zip', 'image', 'document', 'spreadsheet', 'presentation', 'generic'];
1326
-
1327
- const Message = React__default.forwardRef((_ref, ref) => {
1328
- let {
1329
- validation,
1330
- validationLabel,
1331
- children,
1332
- ...props
1333
- } = _ref;
1334
- const {
1335
- hasMessage,
1336
- setHasMessage,
1337
- getMessageProps
1338
- } = useFieldContext() || {};
1339
- const type = useInputContext();
1340
- useEffect(() => {
1341
- if (!hasMessage && setHasMessage) {
1342
- setHasMessage(true);
1343
- }
1344
- return () => {
1345
- if (hasMessage && setHasMessage) {
1346
- setHasMessage(false);
1347
- }
1348
- };
1349
- }, [hasMessage, setHasMessage]);
1350
- let MessageComponent;
1351
- if (type === 'checkbox') {
1352
- MessageComponent = StyledCheckMessage;
1353
- } else if (type === 'radio') {
1354
- MessageComponent = StyledRadioMessage;
1355
- } else if (type === 'toggle') {
1356
- MessageComponent = StyledToggleMessage;
1357
- } else {
1358
- MessageComponent = StyledMessage;
1359
- }
1360
- let combinedProps = {
1361
- validation,
1362
- validationLabel,
1363
- ...props
1364
- };
1365
- if (getMessageProps) {
1366
- combinedProps = getMessageProps(combinedProps);
1367
- }
1368
- const ariaLabel = useText(Message, combinedProps, 'validationLabel', validation, validation !== undefined);
1369
- return React__default.createElement(MessageComponent, _extends$t({
1370
- ref: ref
1371
- }, combinedProps), validation && React__default.createElement(StyledMessageIcon, {
1372
- validation: validation,
1373
- "aria-label": ariaLabel
1374
- }), children);
1375
- });
1376
- Message.displayName = 'Message';
1377
- Message.propTypes = {
1378
- validation: PropTypes.oneOf(VALIDATION),
1379
- validationLabel: PropTypes.string
1380
- };
1381
-
1382
- const FieldsetContext = createContext(undefined);
1383
- const useFieldsetContext = () => {
1384
- const fieldsetContext = useContext(FieldsetContext);
1385
- return fieldsetContext;
1386
- };
1387
-
1388
- const Label$1 = React__default.forwardRef((props, ref) => {
1389
- const fieldContext = useFieldContext();
1390
- const fieldsetContext = useFieldsetContext();
1391
- const type = useInputContext();
1392
- let combinedProps = props;
1393
- if (fieldContext) {
1394
- combinedProps = fieldContext.getLabelProps(combinedProps);
1395
- if (type === undefined) {
1396
- const {
1397
- setIsLabelActive,
1398
- setIsLabelHovered
1399
- } = fieldContext;
1400
- combinedProps = {
1401
- ...combinedProps,
1402
- onMouseUp: composeEventHandlers(props.onMouseUp, () => {
1403
- setIsLabelActive(false);
1404
- }),
1405
- onMouseDown: composeEventHandlers(props.onMouseDown, () => {
1406
- setIsLabelActive(true);
1407
- }),
1408
- onMouseEnter: composeEventHandlers(props.onMouseEnter, () => {
1409
- setIsLabelHovered(true);
1410
- }),
1411
- onMouseLeave: composeEventHandlers(props.onMouseLeave, () => {
1412
- setIsLabelHovered(false);
1413
- })
1414
- };
1415
- }
1416
- }
1417
- if (fieldsetContext) {
1418
- combinedProps = {
1419
- ...combinedProps,
1420
- isRegular: combinedProps.isRegular === undefined ? true : combinedProps.isRegular
1421
- };
1422
- }
1423
- if (type === 'radio') {
1424
- return React__default.createElement(StyledRadioLabel, _extends$t({
1425
- ref: ref
1426
- }, combinedProps), React__default.createElement(StyledRadioSvg, null), props.children);
1427
- } else if (type === 'checkbox') {
1428
- const onLabelSelect = e => {
1429
- const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
1430
- if (fieldContext && isFirefox && e.target instanceof Element) {
1431
- const inputId = e.target.getAttribute('for');
1432
- if (!inputId) return;
1433
- const input = document.getElementById(inputId);
1434
- if (input && input.type === 'checkbox') {
1435
- if (e.shiftKey) {
1436
- input.click();
1437
- input.checked = true;
1438
- }
1439
- input.focus();
1440
- }
1441
- }
1442
- };
1443
- combinedProps = {
1444
- ...combinedProps,
1445
- onClick: composeEventHandlers(combinedProps.onClick, onLabelSelect)
1446
- };
1447
- return React__default.createElement(StyledCheckLabel, _extends$t({
1448
- ref: ref
1449
- }, combinedProps), React__default.createElement(StyledCheckSvg, null), React__default.createElement(StyledDashSvg, null), props.children);
1450
- } else if (type === 'toggle') {
1451
- return React__default.createElement(StyledToggleLabel, _extends$t({
1452
- ref: ref
1453
- }, combinedProps), React__default.createElement(StyledToggleSvg, null), props.children);
1454
- }
1455
- return React__default.createElement(StyledLabel, _extends$t({
1456
- ref: ref
1457
- }, combinedProps));
1458
- });
1459
- Label$1.displayName = 'Label';
1460
- Label$1.propTypes = {
1461
- isRegular: PropTypes.bool
1462
- };
1463
-
1464
- const FieldComponent = React__default.forwardRef((props, ref) => {
1465
- const [hasHint, setHasHint] = useState(false);
1466
- const [hasMessage, setHasMessage] = useState(false);
1467
- const [isLabelActive, setIsLabelActive] = useState(false);
1468
- const [isLabelHovered, setIsLabelHovered] = useState(false);
1469
- const {
1470
- getInputProps,
1471
- getMessageProps,
1472
- ...propGetters
1473
- } = useField({
1474
- idPrefix: props.id,
1475
- hasHint,
1476
- hasMessage
1477
- });
1478
- const fieldProps = useMemo(() => ({
1479
- ...propGetters,
1480
- getInputProps,
1481
- getMessageProps,
1482
- isLabelActive,
1483
- setIsLabelActive,
1484
- isLabelHovered,
1485
- setIsLabelHovered,
1486
- hasHint,
1487
- setHasHint,
1488
- hasMessage,
1489
- setHasMessage
1490
- }), [propGetters, getInputProps, getMessageProps, isLabelActive, isLabelHovered, hasHint, hasMessage]);
1491
- return React__default.createElement(FieldContext.Provider, {
1492
- value: fieldProps
1493
- }, React__default.createElement(StyledField, _extends$t({}, props, {
1494
- ref: ref
1495
- })));
1496
- });
1497
- FieldComponent.displayName = 'Field';
1498
- const Field = FieldComponent;
1499
- Field.Hint = Hint;
1500
- Field.Label = Label$1;
1501
- Field.Message = Message;
1502
-
1503
- const LegendComponent = forwardRef((props, ref) => {
1504
- const fieldsetContext = useFieldsetContext();
1505
- return React__default.createElement(StyledLegend, _extends$t({}, props, fieldsetContext, {
1506
- ref: ref
1507
- }));
1508
- });
1509
- LegendComponent.displayName = 'Fieldset.Legend';
1510
- const Legend = LegendComponent;
1511
-
1512
- const FieldsetComponent = forwardRef((props, ref) => {
1513
- const fieldsetContext = useMemo(() => ({
1514
- isCompact: props.isCompact
1515
- }), [props.isCompact]);
1516
- return React__default.createElement(FieldsetContext.Provider, {
1517
- value: fieldsetContext
1518
- }, React__default.createElement(StyledFieldset, _extends$t({}, props, {
1519
- ref: ref
1520
- })));
1521
- });
1522
- FieldsetComponent.displayName = 'Fieldset';
1523
- FieldsetComponent.propTypes = {
1524
- isCompact: PropTypes.bool
1525
- };
1526
- const Fieldset = FieldsetComponent;
1527
- Fieldset.Legend = Legend;
1528
-
1529
- const Checkbox = React__default.forwardRef((_ref, ref) => {
1530
- let {
1531
- indeterminate,
1532
- children,
1533
- ...props
1534
- } = _ref;
1535
- const fieldsetContext = useFieldsetContext();
1536
- const fieldContext = useFieldContext();
1537
- const inputRef = inputElement => {
1538
- inputElement && (inputElement.indeterminate = indeterminate);
1539
- };
1540
- const combinedRef = inputElement => {
1541
- [inputRef, ref].forEach(targetRef => {
1542
- if (targetRef) {
1543
- if (typeof targetRef === 'function') {
1544
- targetRef(inputElement);
1545
- } else {
1546
- targetRef.current = inputElement;
1547
- }
1548
- }
1549
- });
1550
- };
1551
- let combinedProps = {
1552
- ref: combinedRef,
1553
- ...props,
1554
- ...fieldsetContext
1555
- };
1556
- if (fieldContext) {
1557
- combinedProps = fieldContext.getInputProps(combinedProps);
1558
- }
1559
- return React__default.createElement(InputContext.Provider, {
1560
- value: "checkbox"
1561
- }, React__default.createElement(StyledCheckInput, combinedProps), children);
1562
- });
1563
- Checkbox.displayName = 'Checkbox';
1564
- Checkbox.propTypes = {
1565
- isCompact: PropTypes.bool,
1566
- indeterminate: PropTypes.bool
1567
- };
1568
-
1569
- const InputGroupContext = createContext(undefined);
1570
- const useInputGroupContext = () => {
1571
- return useContext(InputGroupContext);
1572
- };
1573
-
1574
- const Input = React__default.forwardRef((_ref, ref) => {
1575
- let {
1576
- onSelect,
1577
- ...props
1578
- } = _ref;
1579
- const fieldContext = useFieldContext();
1580
- const inputGroupContext = useInputGroupContext();
1581
- const onSelectHandler = props.readOnly ? composeEventHandlers(onSelect, event => {
1582
- event.currentTarget.select();
1583
- }) : onSelect;
1584
- let combinedProps = {
1585
- ref,
1586
- onSelect: onSelectHandler,
1587
- ...props
1588
- };
1589
- if (inputGroupContext) {
1590
- combinedProps = {
1591
- ...combinedProps,
1592
- isCompact: inputGroupContext.isCompact || combinedProps.isCompact,
1593
- focusInset: props.focusInset === undefined ? true : props.focusInset
1594
- };
1595
- }
1596
- if (fieldContext) {
1597
- combinedProps = fieldContext.getInputProps(combinedProps);
1598
- }
1599
- return React__default.createElement(StyledTextInput, combinedProps);
1600
- });
1601
- Input.propTypes = {
1602
- isCompact: PropTypes.bool,
1603
- isBare: PropTypes.bool,
1604
- focusInset: PropTypes.bool,
1605
- validation: PropTypes.oneOf(VALIDATION)
1606
- };
1607
- Input.displayName = 'Input';
1608
-
1609
- const Radio = React__default.forwardRef((_ref, ref) => {
1610
- let {
1611
- children,
1612
- ...props
1613
- } = _ref;
1614
- const fieldsetContext = useFieldsetContext();
1615
- const fieldContext = useFieldContext();
1616
- let combinedProps = {
1617
- ref,
1618
- ...props,
1619
- ...fieldsetContext
1620
- };
1621
- if (fieldContext) {
1622
- combinedProps = fieldContext.getInputProps(combinedProps);
1623
- }
1624
- return React__default.createElement(InputContext.Provider, {
1625
- value: "radio"
1626
- }, React__default.createElement(StyledRadioInput, combinedProps), children);
1627
- });
1628
- Radio.displayName = 'Radio';
1629
- Radio.propTypes = {
1630
- isCompact: PropTypes.bool
1631
- };
1632
-
1633
- const Range = React__default.forwardRef((_ref, ref) => {
1634
- let {
1635
- hasLowerTrack,
1636
- min,
1637
- max,
1638
- step,
1639
- ...props
1640
- } = _ref;
1641
- const [backgroundSize, setBackgroundSize] = useState('0');
1642
- const rangeRef = useRef();
1643
- const fieldContext = useFieldContext();
1644
- const updateBackgroundWidthFromInput = useCallback(rangeTarget => {
1645
- let relativeMax = max;
1646
- const {
1647
- value
1648
- } = rangeTarget;
1649
- if (parseFloat(relativeMax) < parseFloat(min)) {
1650
- relativeMax = 100;
1651
- }
1652
- const percentage = 100 * (value - min) / (relativeMax - min);
1653
- setBackgroundSize(`${percentage}%`);
1654
- },
1655
- [max, min, step]);
1656
- useEffect(() => {
1657
- updateBackgroundWidthFromInput(rangeRef.current);
1658
- }, [rangeRef, updateBackgroundWidthFromInput, props.value]);
1659
- const onChange = hasLowerTrack ? composeEventHandlers(props.onChange, event => {
1660
- updateBackgroundWidthFromInput(event.target);
1661
- }) : props.onChange;
1662
- let combinedProps = {
1663
- ref: mergeRefs([rangeRef, ref]),
1664
- hasLowerTrack,
1665
- min,
1666
- max,
1667
- step,
1668
- backgroundSize,
1669
- ...props,
1670
- onChange
1671
- };
1672
- if (fieldContext) {
1673
- combinedProps = fieldContext.getInputProps(combinedProps);
1674
- }
1675
- return React__default.createElement(StyledRangeInput, combinedProps);
1676
- });
1677
- Range.defaultProps = {
1678
- hasLowerTrack: true,
1679
- min: 0,
1680
- max: 100,
1681
- step: 1
1682
- };
1683
- Range.displayName = 'Range';
1684
-
1685
- const parseStyleValue = value => {
1686
- return parseInt(value, 10) || 0;
1687
- };
1688
- const Textarea = React__default.forwardRef((_ref, ref) => {
1689
- let {
1690
- minRows,
1691
- maxRows,
1692
- style,
1693
- onChange,
1694
- onSelect,
1695
- ...props
1696
- } = _ref;
1697
- const fieldContext = useFieldContext();
1698
- const textAreaRef = useRef();
1699
- const shadowTextAreaRef = useRef(null);
1700
- const [state, setState] = useState({
1701
- overflow: false,
1702
- height: 0
1703
- });
1704
- const isControlled = props.value !== null && props.value !== undefined;
1705
- const isAutoResizable = (minRows !== undefined || maxRows !== undefined) && !props.isResizable;
1706
- const calculateHeight = useCallback(() => {
1707
- if (!isAutoResizable) {
1708
- return;
1709
- }
1710
- const textarea = textAreaRef.current;
1711
- const computedStyle = window.getComputedStyle(textarea);
1712
- const shadowTextArea = shadowTextAreaRef.current;
1713
- shadowTextArea.style.width = computedStyle.width;
1714
- shadowTextArea.value = textarea.value || textarea.placeholder || ' ';
1715
- const boxSizing = computedStyle.boxSizing;
1716
- const padding = parseStyleValue(computedStyle.paddingBottom) + parseStyleValue(computedStyle.paddingTop);
1717
- const border = parseStyleValue(computedStyle.borderTopWidth) + parseStyleValue(computedStyle.borderBottomWidth);
1718
- const innerHeight = shadowTextArea.scrollHeight - padding;
1719
- shadowTextArea.value = 'x';
1720
- const singleRowHeight = shadowTextArea.scrollHeight - padding;
1721
- let outerHeight = innerHeight;
1722
- if (minRows) {
1723
- outerHeight = Math.max(Number(minRows) * singleRowHeight, outerHeight);
1724
- }
1725
- if (maxRows) {
1726
- outerHeight = Math.min(Number(maxRows) * singleRowHeight, outerHeight);
1727
- }
1728
- outerHeight = Math.max(outerHeight, singleRowHeight);
1729
- const updatedHeight = outerHeight + (boxSizing === 'border-box' ? padding + border : 0);
1730
- const overflow = Math.abs(outerHeight - innerHeight) <= 1;
1731
- setState(prevState => {
1732
- if (updatedHeight > 0 && Math.abs((prevState.height || 0) - updatedHeight) > 1 || prevState.overflow !== overflow) {
1733
- return {
1734
- overflow,
1735
- height: updatedHeight
1736
- };
1737
- }
1738
- return prevState;
1739
- });
1740
- }, [maxRows, minRows, textAreaRef, isAutoResizable]);
1741
- const onChangeHandler = useCallback(e => {
1742
- if (!isControlled) {
1743
- calculateHeight();
1744
- }
1745
- if (onChange) {
1746
- onChange(e);
1747
- }
1748
- }, [calculateHeight, isControlled, onChange]);
1749
- useLayoutEffect(() => {
1750
- calculateHeight();
1751
- });
1752
- const computedStyle = {};
1753
- if (isAutoResizable) {
1754
- computedStyle.height = state.height;
1755
- computedStyle.overflow = state.overflow ? 'hidden' : undefined;
1756
- }
1757
- const onSelectHandler = props.readOnly ? composeEventHandlers(onSelect, event => {
1758
- event.currentTarget.select();
1759
- }) : onSelect;
1760
- let combinedProps = {
1761
- ref: mergeRefs([textAreaRef, ref]),
1762
- rows: minRows,
1763
- onChange: onChangeHandler,
1764
- onSelect: onSelectHandler,
1765
- style: {
1766
- ...computedStyle,
1767
- ...style
1768
- },
1769
- ...props
1770
- };
1771
- if (fieldContext) {
1772
- combinedProps = fieldContext.getInputProps(combinedProps);
1773
- }
1774
- return React__default.createElement(React__default.Fragment, null, React__default.createElement(StyledTextarea, combinedProps), isAutoResizable && React__default.createElement(StyledTextarea, {
1775
- "aria-hidden": true,
1776
- readOnly: true,
1777
- isHidden: true,
1778
- className: props.className,
1779
- ref: shadowTextAreaRef,
1780
- tabIndex: -1,
1781
- isBare: props.isBare,
1782
- isCompact: props.isCompact,
1783
- style: style
1784
- }));
1785
- });
1786
- Textarea.propTypes = {
1787
- isCompact: PropTypes.bool,
1788
- isBare: PropTypes.bool,
1789
- focusInset: PropTypes.bool,
1790
- isResizable: PropTypes.bool,
1791
- minRows: PropTypes.number,
1792
- maxRows: PropTypes.number,
1793
- validation: PropTypes.oneOf(VALIDATION)
1794
- };
1795
- Textarea.displayName = 'Textarea';
1796
-
1797
- const Toggle = React__default.forwardRef((_ref, ref) => {
1798
- let {
1799
- children,
1800
- ...props
1801
- } = _ref;
1802
- const fieldsetContext = useFieldsetContext();
1803
- const fieldContext = useFieldContext();
1804
- let combinedProps = {
1805
- ref,
1806
- ...props,
1807
- ...fieldsetContext
1808
- };
1809
- if (fieldContext) {
1810
- combinedProps = fieldContext.getInputProps(combinedProps);
1811
- }
1812
- return React__default.createElement(InputContext.Provider, {
1813
- value: "toggle"
1814
- }, React__default.createElement(StyledToggleInput, combinedProps), children);
1815
- });
1816
- Toggle.displayName = 'Toggle';
1817
- Toggle.propTypes = {
1818
- isCompact: PropTypes.bool
1819
- };
1820
-
1821
- var _path$k;
1822
- function _extends$l() { _extends$l = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$l.apply(this, arguments); }
1823
- var SvgChevronDownStroke = function SvgChevronDownStroke(props) {
1824
- return /*#__PURE__*/React.createElement("svg", _extends$l({
1825
- xmlns: "http://www.w3.org/2000/svg",
1826
- width: 16,
1827
- height: 16,
1828
- focusable: "false",
1829
- viewBox: "0 0 16 16",
1830
- "aria-hidden": "true"
1831
- }, props), _path$k || (_path$k = /*#__PURE__*/React.createElement("path", {
1832
- fill: "currentColor",
1833
- d: "M12.688 5.61a.5.5 0 01.69.718l-.066.062-5 4a.5.5 0 01-.542.054l-.082-.054-5-4a.5.5 0 01.55-.83l.074.05L8 9.359l4.688-3.75z"
1834
- })));
1835
- };
1836
-
1837
- const StartIconComponent = props => React__default.createElement(StyledTextMediaFigure, _extends$t({
1838
- position: "start"
1839
- }, props));
1840
- StartIconComponent.displayName = 'FauxInput.StartIcon';
1841
- const StartIcon = StartIconComponent;
1842
-
1843
- const EndIconComponent = props => React__default.createElement(StyledTextMediaFigure, _extends$t({
1844
- position: "end"
1845
- }, props));
1846
- EndIconComponent.displayName = 'FauxInput.EndIcon';
1847
- const EndIcon = EndIconComponent;
1848
-
1849
- const FauxInputComponent = forwardRef((_ref, ref) => {
1850
- let {
1851
- onFocus,
1852
- onBlur,
1853
- disabled,
1854
- readOnly,
1855
- isFocused: controlledIsFocused,
1856
- ...props
1857
- } = _ref;
1858
- const [isFocused, setIsFocused] = useState(false);
1859
- const onFocusHandler = composeEventHandlers(onFocus, () => {
1860
- setIsFocused(true);
1861
- });
1862
- const onBlurHandler = composeEventHandlers(onBlur, () => {
1863
- setIsFocused(false);
1864
- });
1865
- return React__default.createElement(StyledTextFauxInput, _extends$t({
1866
- onFocus: onFocusHandler,
1867
- onBlur: onBlurHandler,
1868
- isFocused: controlledIsFocused === undefined ? isFocused : controlledIsFocused,
1869
- isReadOnly: readOnly,
1870
- isDisabled: disabled,
1871
- tabIndex: disabled ? undefined : 0
1872
- }, props, {
1873
- ref: ref
1874
- }));
1875
- });
1876
- FauxInputComponent.displayName = 'FauxInput';
1877
- FauxInputComponent.propTypes = {
1878
- isCompact: PropTypes.bool,
1879
- isBare: PropTypes.bool,
1880
- focusInset: PropTypes.bool,
1881
- disabled: PropTypes.bool,
1882
- readOnly: PropTypes.bool,
1883
- validation: PropTypes.oneOf(VALIDATION),
1884
- isFocused: PropTypes.bool,
1885
- isHovered: PropTypes.bool
1886
- };
1887
- const FauxInput = FauxInputComponent;
1888
- FauxInput.EndIcon = EndIcon;
1889
- FauxInput.StartIcon = StartIcon;
1890
-
1891
- const Select = React__default.forwardRef((_ref, ref) => {
1892
- let {
1893
- disabled,
1894
- isCompact,
1895
- validation,
1896
- focusInset,
1897
- isBare,
1898
- ...props
1899
- } = _ref;
1900
- const fieldContext = useFieldContext();
1901
- let combinedProps = {
1902
- disabled,
1903
- isBare,
1904
- isCompact,
1905
- validation,
1906
- focusInset,
1907
- ref,
1908
- ...props
1909
- };
1910
- if (fieldContext) {
1911
- combinedProps = fieldContext.getInputProps(combinedProps);
1912
- }
1913
- return React__default.createElement(StyledSelectWrapper, {
1914
- isCompact: isCompact,
1915
- isBare: isBare,
1916
- validation: validation,
1917
- focusInset: focusInset
1918
- }, React__default.createElement(StyledSelect, combinedProps), !isBare && React__default.createElement(FauxInput.EndIcon, {
1919
- isDisabled: disabled
1920
- }, React__default.createElement(SvgChevronDownStroke, null)));
1921
- });
1922
- Select.propTypes = {
1923
- isCompact: PropTypes.bool,
1924
- isBare: PropTypes.bool,
1925
- focusInset: PropTypes.bool,
1926
- validation: PropTypes.oneOf(VALIDATION)
1927
- };
1928
- Select.displayName = 'Select';
1929
-
1930
- const TilesContext = createContext(undefined);
1931
- const useTilesContext = () => {
1932
- return useContext(TilesContext);
1933
- };
1934
-
1935
- const TileComponent = React__default.forwardRef((_ref, ref) => {
1936
- let {
1937
- children,
1938
- value,
1939
- disabled,
1940
- ...props
1941
- } = _ref;
1942
- const tilesContext = useTilesContext();
1943
- const inputRef = useRef(null);
1944
- let inputProps;
1945
- if (tilesContext) {
1946
- inputProps = {
1947
- name: tilesContext.name,
1948
- checked: tilesContext.value === value,
1949
- onChange: tilesContext.onChange
1950
- };
1951
- }
1952
- return React__default.createElement(StyledTile, _extends$t({
1953
- ref: ref,
1954
- "aria-disabled": disabled,
1955
- isDisabled: disabled,
1956
- isSelected: tilesContext && tilesContext.value === value
1957
- }, props), children, React__default.createElement(StyledTileInput, _extends$t({}, inputProps, {
1958
- disabled: disabled,
1959
- value: value,
1960
- type: "radio",
1961
- ref: inputRef
1962
- })));
1963
- });
1964
- TileComponent.displayName = 'Tiles.Tile';
1965
- TileComponent.propTypes = {
1966
- value: PropTypes.string,
1967
- disabled: PropTypes.bool
1968
- };
1969
- const Tile = TileComponent;
1970
-
1971
- const DescriptionComponent = forwardRef((props, ref) => {
1972
- const tilesContext = useTilesContext();
1973
- return React__default.createElement(StyledTileDescription, _extends$t({
1974
- ref: ref,
1975
- isCentered: tilesContext && tilesContext.isCentered
1976
- }, props));
1977
- });
1978
- DescriptionComponent.displayName = 'Tiles.Description';
1979
- const Description = DescriptionComponent;
1980
-
1981
- const IconComponent = forwardRef((props, ref) => {
1982
- const tileContext = useTilesContext();
1983
- return React__default.createElement(StyledTileIcon, _extends$t({
1984
- ref: ref,
1985
- isCentered: tileContext && tileContext.isCentered
1986
- }, props));
1987
- });
1988
- IconComponent.displayName = 'Tiles.Icon';
1989
- const Icon = IconComponent;
1990
-
1991
- const LabelComponent = forwardRef((props, forwardedRef) => {
1992
- const [title, setTitle] = useState('');
1993
- const ref = useRef();
1994
- const tilesContext = useTilesContext();
1995
- useEffect(() => {
1996
- if (ref.current) {
1997
- setTitle(ref.current.textContent || undefined);
1998
- }
1999
- }, [ref]);
2000
- return React__default.createElement(StyledTileLabel, _extends$t({
2001
- ref: mergeRefs([ref, forwardedRef]),
2002
- title: title,
2003
- isCentered: tilesContext && tilesContext.isCentered
2004
- }, props));
2005
- });
2006
- LabelComponent.displayName = 'Tiles.Label';
2007
- const Label = LabelComponent;
2008
-
2009
- const TilesComponent = forwardRef((_ref, ref) => {
2010
- let {
2011
- onChange,
2012
- value: controlledValue,
2013
- name,
2014
- isCentered,
2015
- ...props
2016
- } = _ref;
2017
- const [value, setValue] = useState(controlledValue);
2018
- const handleOnChange = useCallback(function () {
2019
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2020
- args[_key] = arguments[_key];
2021
- }
2022
- setValue(args[0].target.value);
2023
- if (onChange) {
2024
- onChange(...args);
2025
- }
2026
- }, [onChange]);
2027
- const selectedValue = getControlledValue(controlledValue, value);
2028
- const tileContext = useMemo(() => ({
2029
- onChange: handleOnChange,
2030
- value: selectedValue,
2031
- name,
2032
- isCentered
2033
- }), [handleOnChange, selectedValue, name, isCentered]);
2034
- return React__default.createElement(TilesContext.Provider, {
2035
- value: tileContext
2036
- }, React__default.createElement("div", _extends$t({
2037
- ref: ref,
2038
- role: "radiogroup"
2039
- }, props)));
2040
- });
2041
- TilesComponent.displayName = 'Tiles';
2042
- TilesComponent.propTypes = {
2043
- value: PropTypes.string,
2044
- onChange: PropTypes.func,
2045
- name: PropTypes.string.isRequired,
2046
- isCentered: PropTypes.bool
2047
- };
2048
- TilesComponent.defaultProps = {
2049
- isCentered: true
2050
- };
2051
- const Tiles = TilesComponent;
2052
- Tiles.Description = Description;
2053
- Tiles.Icon = Icon;
2054
- Tiles.Label = Label;
2055
- Tiles.Tile = Tile;
2056
-
2057
- const InputGroup = React__default.forwardRef((_ref, ref) => {
2058
- let {
2059
- isCompact,
2060
- ...props
2061
- } = _ref;
2062
- const contextValue = useMemo(() => ({
2063
- isCompact
2064
- }), [isCompact]);
2065
- return React__default.createElement(InputGroupContext.Provider, {
2066
- value: contextValue
2067
- }, React__default.createElement(StyledInputGroup, _extends$t({
2068
- ref: ref,
2069
- isCompact: isCompact
2070
- }, props)));
2071
- });
2072
- InputGroup.displayName = 'InputGroup';
2073
- InputGroup.propTypes = {
2074
- isCompact: PropTypes.bool
2075
- };
2076
-
2077
- const FileUpload = React__default.forwardRef((_ref, ref) => {
2078
- let {
2079
- disabled,
2080
- ...props
2081
- } = _ref;
2082
- return (
2083
- React__default.createElement(StyledFileUpload, _extends$t({
2084
- ref: ref,
2085
- "aria-disabled": disabled
2086
- }, props, {
2087
- role: "button"
2088
- }))
2089
- );
2090
- });
2091
- FileUpload.propTypes = {
2092
- isDragging: PropTypes.bool,
2093
- isCompact: PropTypes.bool,
2094
- disabled: PropTypes.bool
2095
- };
2096
- FileUpload.displayName = 'FileUpload';
2097
-
2098
- const ItemComponent = forwardRef((_ref, ref) => {
2099
- let {
2100
- ...props
2101
- } = _ref;
2102
- return React__default.createElement(StyledFileListItem, _extends$t({}, props, {
2103
- ref: ref
2104
- }));
2105
- });
2106
- ItemComponent.displayName = 'FileList.Item';
2107
- const Item = ItemComponent;
2108
-
2109
- const FileListComponent = forwardRef((_ref, ref) => {
2110
- let {
2111
- ...props
2112
- } = _ref;
2113
- return React__default.createElement(StyledFileList, _extends$t({}, props, {
2114
- ref: ref
2115
- }));
2116
- });
2117
- FileListComponent.displayName = 'FileList';
2118
- const FileList = FileListComponent;
2119
- FileList.Item = Item;
2120
-
2121
- var _path$j;
2122
- function _extends$k() { _extends$k = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$k.apply(this, arguments); }
2123
- var SvgXStroke$1 = function SvgXStroke(props) {
2124
- return /*#__PURE__*/React.createElement("svg", _extends$k({
2125
- xmlns: "http://www.w3.org/2000/svg",
2126
- width: 12,
2127
- height: 12,
2128
- focusable: "false",
2129
- viewBox: "0 0 12 12",
2130
- "aria-hidden": "true"
2131
- }, props), _path$j || (_path$j = /*#__PURE__*/React.createElement("path", {
2132
- stroke: "currentColor",
2133
- strokeLinecap: "round",
2134
- d: "M3 9l6-6m0 6L3 3"
2135
- })));
2136
- };
2137
-
2138
- var _path$i;
2139
- function _extends$j() { _extends$j = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$j.apply(this, arguments); }
2140
- var SvgXStroke = function SvgXStroke(props) {
2141
- return /*#__PURE__*/React.createElement("svg", _extends$j({
2142
- xmlns: "http://www.w3.org/2000/svg",
2143
- width: 16,
2144
- height: 16,
2145
- focusable: "false",
2146
- viewBox: "0 0 16 16",
2147
- "aria-hidden": "true"
2148
- }, props), _path$i || (_path$i = /*#__PURE__*/React.createElement("path", {
2149
- stroke: "currentColor",
2150
- strokeLinecap: "round",
2151
- d: "M3 13L13 3m0 10L3 3"
2152
- })));
2153
- };
2154
-
2155
- const FileContext = createContext(undefined);
2156
- const useFileContext = () => {
2157
- return useContext(FileContext);
2158
- };
2159
-
2160
- const CloseComponent = React__default.forwardRef((props, ref) => {
2161
- const fileContext = useFileContext();
2162
- const onMouseDown = composeEventHandlers(props.onMouseDown, event => event.preventDefault()
2163
- );
2164
- const ariaLabel = useText(CloseComponent, props, 'aria-label', 'Close');
2165
- return React__default.createElement(StyledFileClose, _extends$t({
2166
- ref: ref,
2167
- "aria-label": ariaLabel
2168
- }, props, {
2169
- type: "button",
2170
- tabIndex: -1,
2171
- onMouseDown: onMouseDown
2172
- }), fileContext && fileContext.isCompact ? React__default.createElement(SvgXStroke$1, null) : React__default.createElement(SvgXStroke, null));
2173
- });
2174
- CloseComponent.displayName = 'File.Close';
2175
- const Close = CloseComponent;
2176
-
2177
- var _path$h;
2178
- function _extends$i() { _extends$i = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$i.apply(this, arguments); }
2179
- var SvgTrashStroke$1 = function SvgTrashStroke(props) {
2180
- return /*#__PURE__*/React.createElement("svg", _extends$i({
2181
- xmlns: "http://www.w3.org/2000/svg",
2182
- width: 12,
2183
- height: 12,
2184
- focusable: "false",
2185
- viewBox: "0 0 12 12",
2186
- "aria-hidden": "true"
2187
- }, props), _path$h || (_path$h = /*#__PURE__*/React.createElement("path", {
2188
- fill: "none",
2189
- stroke: "currentColor",
2190
- strokeLinecap: "round",
2191
- d: "M4.5 2.5V1c0-.3.2-.5.5-.5h2c.3 0 .5.2.5.5v1.5M2 2.5h8m-5.5 7V5m3 4.5V5m-5-.5V11c0 .3.2.5.5.5h6c.3 0 .5-.2.5-.5V4.5"
2192
- })));
2193
- };
2194
-
2195
- var _path$g;
2196
- function _extends$h() { _extends$h = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$h.apply(this, arguments); }
2197
- var SvgTrashStroke = function SvgTrashStroke(props) {
2198
- return /*#__PURE__*/React.createElement("svg", _extends$h({
2199
- xmlns: "http://www.w3.org/2000/svg",
2200
- width: 16,
2201
- height: 16,
2202
- focusable: "false",
2203
- viewBox: "0 0 16 16",
2204
- "aria-hidden": "true"
2205
- }, props), _path$g || (_path$g = /*#__PURE__*/React.createElement("path", {
2206
- fill: "none",
2207
- stroke: "currentColor",
2208
- strokeLinecap: "round",
2209
- d: "M6.5 2.5V1c0-.3.2-.5.5-.5h2c.3 0 .5.2.5.5v1.5M3 2.5h10m-6.5 11v-8m3 8v-8m-6-1V15c0 .3.2.5.5.5h8c.3 0 .5-.2.5-.5V4.5"
2210
- })));
2211
- };
2212
-
2213
- const DeleteComponent = React__default.forwardRef((props, ref) => {
2214
- const fileContext = useFileContext();
2215
- const onMouseDown = composeEventHandlers(props.onMouseDown, event => event.preventDefault()
2216
- );
2217
- const ariaLabel = useText(DeleteComponent, props, 'aria-label', 'Delete');
2218
- return React__default.createElement(StyledFileDelete, _extends$t({
2219
- ref: ref,
2220
- "aria-label": ariaLabel
2221
- }, props, {
2222
- type: "button",
2223
- tabIndex: -1,
2224
- onMouseDown: onMouseDown
2225
- }), fileContext && fileContext.isCompact ? React__default.createElement(SvgTrashStroke$1, null) : React__default.createElement(SvgTrashStroke, null));
2226
- });
2227
- DeleteComponent.displayName = 'File.Delete';
2228
- const Delete = DeleteComponent;
2229
-
2230
- var _path$f, _rect$1;
2231
- function _extends$g() { _extends$g = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$g.apply(this, arguments); }
2232
- var SvgFilePdfStroke$1 = function SvgFilePdfStroke(props) {
2233
- return /*#__PURE__*/React.createElement("svg", _extends$g({
2234
- xmlns: "http://www.w3.org/2000/svg",
2235
- width: 12,
2236
- height: 12,
2237
- focusable: "false",
2238
- viewBox: "0 0 12 12",
2239
- "aria-hidden": "true"
2240
- }, props), _path$f || (_path$f = /*#__PURE__*/React.createElement("path", {
2241
- fill: "none",
2242
- stroke: "currentColor",
2243
- strokeLinecap: "round",
2244
- d: "M10.5 3.21V11a.5.5 0 01-.5.5H2a.5.5 0 01-.5-.5V1A.5.5 0 012 .5h5.79a.5.5 0 01.35.15l2.21 2.21a.5.5 0 01.15.35zM7.5.5V3a.5.5 0 00.5.5h2.5m-7 6h5"
2245
- })), _rect$1 || (_rect$1 = /*#__PURE__*/React.createElement("rect", {
2246
- width: 6,
2247
- height: 3,
2248
- x: 3,
2249
- y: 5,
2250
- fill: "currentColor",
2251
- rx: 0.5,
2252
- ry: 0.5
2253
- })));
2254
- };
2255
-
2256
- var _path$e;
2257
- function _extends$f() { _extends$f = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$f.apply(this, arguments); }
2258
- var SvgFileZipStroke$1 = function SvgFileZipStroke(props) {
2259
- return /*#__PURE__*/React.createElement("svg", _extends$f({
2260
- xmlns: "http://www.w3.org/2000/svg",
2261
- width: 12,
2262
- height: 12,
2263
- focusable: "false",
2264
- viewBox: "0 0 12 12",
2265
- "aria-hidden": "true"
2266
- }, props), _path$e || (_path$e = /*#__PURE__*/React.createElement("path", {
2267
- fill: "none",
2268
- stroke: "currentColor",
2269
- strokeLinecap: "round",
2270
- d: "M4.5.5v8m0-6h1m-2 1h1m0 1h1m-2 1h1m0 1h1m-2 1h1m6-4.29V11c0 .28-.22.5-.5.5H2c-.28 0-.5-.22-.5-.5V1c0-.28.22-.5.5-.5h5.79c.13 0 .26.05.35.15l2.21 2.21c.1.09.15.21.15.35zM7.5.5V3c0 .28.22.5.5.5h2.5"
2271
- })));
2272
- };
2273
-
2274
- var _path$d, _circle$1;
2275
- function _extends$e() { _extends$e = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$e.apply(this, arguments); }
2276
- var SvgFileImageStroke$1 = function SvgFileImageStroke(props) {
2277
- return /*#__PURE__*/React.createElement("svg", _extends$e({
2278
- xmlns: "http://www.w3.org/2000/svg",
2279
- width: 12,
2280
- height: 12,
2281
- focusable: "false",
2282
- viewBox: "0 0 12 12",
2283
- "aria-hidden": "true"
2284
- }, props), _path$d || (_path$d = /*#__PURE__*/React.createElement("path", {
2285
- fill: "none",
2286
- stroke: "currentColor",
2287
- strokeLinecap: "round",
2288
- strokeLinejoin: "round",
2289
- d: "M10.5 3.21V11c0 .28-.22.5-.5.5H2c-.28 0-.5-.22-.5-.5V1c0-.28.22-.5.5-.5h5.79c.13 0 .26.05.35.15l2.21 2.21c.1.09.15.21.15.35zM7.5.5V3c0 .28.22.5.5.5h2.5m-7 6L5 8l1.5 1.5 1-1 1 1"
2290
- })), _circle$1 || (_circle$1 = /*#__PURE__*/React.createElement("circle", {
2291
- cx: 8,
2292
- cy: 6,
2293
- r: 1,
2294
- fill: "currentColor"
2295
- })));
2296
- };
2297
-
2298
- var _path$c;
2299
- function _extends$d() { _extends$d = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$d.apply(this, arguments); }
2300
- var SvgFileDocumentStroke$1 = function SvgFileDocumentStroke(props) {
2301
- return /*#__PURE__*/React.createElement("svg", _extends$d({
2302
- xmlns: "http://www.w3.org/2000/svg",
2303
- width: 12,
2304
- height: 12,
2305
- focusable: "false",
2306
- viewBox: "0 0 12 12",
2307
- "aria-hidden": "true"
2308
- }, props), _path$c || (_path$c = /*#__PURE__*/React.createElement("path", {
2309
- fill: "none",
2310
- stroke: "currentColor",
2311
- strokeLinecap: "round",
2312
- d: "M3.5 5.5h5m-5 2h5m-5 2h5m2-6.29V11c0 .28-.22.5-.5.5H2c-.28 0-.5-.22-.5-.5V1c0-.28.22-.5.5-.5h5.79c.13 0 .26.05.35.15l2.21 2.21c.1.09.15.21.15.35zM7.5.5V3c0 .28.22.5.5.5h2.5"
2313
- })));
2314
- };
2315
-
2316
- var _path$b;
2317
- function _extends$c() { _extends$c = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$c.apply(this, arguments); }
2318
- var SvgFileSpreadsheetStroke$1 = function SvgFileSpreadsheetStroke(props) {
2319
- return /*#__PURE__*/React.createElement("svg", _extends$c({
2320
- xmlns: "http://www.w3.org/2000/svg",
2321
- width: 12,
2322
- height: 12,
2323
- focusable: "false",
2324
- viewBox: "0 0 12 12",
2325
- "aria-hidden": "true"
2326
- }, props), _path$b || (_path$b = /*#__PURE__*/React.createElement("path", {
2327
- fill: "none",
2328
- stroke: "currentColor",
2329
- strokeLinecap: "round",
2330
- d: "M3.5 5.5h1m-1 2h1m-1 2h1m2-4h2m-2 2h2m-2 2h2m2-6.29V11c0 .28-.22.5-.5.5H2c-.28 0-.5-.22-.5-.5V1c0-.28.22-.5.5-.5h5.79c.13 0 .26.05.35.15l2.21 2.21c.1.09.15.21.15.35zM7.5.5V3c0 .28.22.5.5.5h2.5"
2331
- })));
2332
- };
2333
-
2334
- var _path$a;
2335
- function _extends$b() { _extends$b = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
2336
- var SvgFilePresentationStroke$1 = function SvgFilePresentationStroke(props) {
2337
- return /*#__PURE__*/React.createElement("svg", _extends$b({
2338
- xmlns: "http://www.w3.org/2000/svg",
2339
- width: 12,
2340
- height: 12,
2341
- focusable: "false",
2342
- viewBox: "0 0 12 12",
2343
- "aria-hidden": "true"
2344
- }, props), _path$a || (_path$a = /*#__PURE__*/React.createElement("path", {
2345
- fill: "none",
2346
- stroke: "currentColor",
2347
- d: "M10.5 3.21V11c0 .28-.22.5-.5.5H2c-.28 0-.5-.22-.5-.5V1c0-.28.22-.5.5-.5h5.79c.13 0 .26.05.35.15l2.21 2.21c.1.09.15.21.15.35zM6 9.5h2c.28 0 .5-.22.5-.5V8c0-.28-.22-.5-.5-.5H6c-.28 0-.5.22-.5.5v1c0 .28.22.5.5.5zm-2-2h2c.28 0 .5-.22.5-.5V6c0-.28-.22-.5-.5-.5H4c-.28 0-.5.22-.5.5v1c0 .28.22.5.5.5zm3.5-7V3c0 .28.22.5.5.5h2.5"
2348
- })));
2349
- };
2350
-
2351
- var _path$9;
2352
- function _extends$a() { _extends$a = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); }
2353
- var SvgFileGenericStroke$1 = function SvgFileGenericStroke(props) {
2354
- return /*#__PURE__*/React.createElement("svg", _extends$a({
2355
- xmlns: "http://www.w3.org/2000/svg",
2356
- width: 12,
2357
- height: 12,
2358
- focusable: "false",
2359
- viewBox: "0 0 12 12",
2360
- "aria-hidden": "true"
2361
- }, props), _path$9 || (_path$9 = /*#__PURE__*/React.createElement("path", {
2362
- fill: "none",
2363
- stroke: "currentColor",
2364
- d: "M10.5 3.21V11c0 .28-.22.5-.5.5H2c-.28 0-.5-.22-.5-.5V1c0-.28.22-.5.5-.5h5.79c.13 0 .26.05.35.15l2.21 2.21c.1.09.15.21.15.35zM7.5.5V3c0 .28.22.5.5.5h2.5"
2365
- })));
2366
- };
2367
-
2368
- var _g;
2369
- function _extends$9() { _extends$9 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
2370
- var SvgCheckCircleStroke = function SvgCheckCircleStroke(props) {
2371
- return /*#__PURE__*/React.createElement("svg", _extends$9({
2372
- xmlns: "http://www.w3.org/2000/svg",
2373
- width: 12,
2374
- height: 12,
2375
- focusable: "false",
2376
- viewBox: "0 0 12 12",
2377
- "aria-hidden": "true"
2378
- }, props), _g || (_g = /*#__PURE__*/React.createElement("g", {
2379
- fill: "none",
2380
- stroke: "currentColor"
2381
- }, /*#__PURE__*/React.createElement("path", {
2382
- strokeLinecap: "round",
2383
- strokeLinejoin: "round",
2384
- d: "M3.5 6l2 2L9 4.5"
2385
- }), /*#__PURE__*/React.createElement("circle", {
2386
- cx: 6,
2387
- cy: 6,
2388
- r: 5.5
2389
- }))));
2390
- };
2391
-
2392
- var _path$8;
2393
- function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
2394
- var SvgFileErrorStroke$1 = function SvgFileErrorStroke(props) {
2395
- return /*#__PURE__*/React.createElement("svg", _extends$8({
2396
- xmlns: "http://www.w3.org/2000/svg",
2397
- width: 12,
2398
- height: 12,
2399
- focusable: "false",
2400
- viewBox: "0 0 12 12",
2401
- "aria-hidden": "true"
2402
- }, props), _path$8 || (_path$8 = /*#__PURE__*/React.createElement("path", {
2403
- fill: "none",
2404
- stroke: "currentColor",
2405
- strokeLinecap: "round",
2406
- d: "M10.5 3.21V11c0 .28-.22.5-.5.5H2c-.28 0-.5-.22-.5-.5V1c0-.28.22-.5.5-.5h5.79c.13 0 .26.05.35.15l2.21 2.21c.1.09.15.21.15.35zM7.5.5V3c0 .28.22.5.5.5h2.5M4 9.5l4-4m0 4l-4-4"
2407
- })));
2408
- };
2409
-
2410
- var _path$7, _rect;
2411
- function _extends$7() { _extends$7 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
2412
- var SvgFilePdfStroke = function SvgFilePdfStroke(props) {
2413
- return /*#__PURE__*/React.createElement("svg", _extends$7({
2414
- xmlns: "http://www.w3.org/2000/svg",
2415
- width: 16,
2416
- height: 16,
2417
- focusable: "false",
2418
- viewBox: "0 0 16 16",
2419
- "aria-hidden": "true"
2420
- }, props), _path$7 || (_path$7 = /*#__PURE__*/React.createElement("path", {
2421
- fill: "none",
2422
- stroke: "currentColor",
2423
- strokeLinecap: "round",
2424
- d: "M14.5 4.2V15a.5.5 0 01-.5.5H2a.5.5 0 01-.5-.5V1A.5.5 0 012 .5h8.85a.5.5 0 01.36.15l3.15 3.2a.5.5 0 01.14.35zm-10 8.3h7m-7-2h7m-1-10V4a.5.5 0 00.5.5h3.5"
2425
- })), _rect || (_rect = /*#__PURE__*/React.createElement("rect", {
2426
- width: 8,
2427
- height: 2,
2428
- x: 4,
2429
- y: 7,
2430
- fill: "currentColor",
2431
- rx: 0.5,
2432
- ry: 0.5
2433
- })));
2434
- };
2435
-
2436
- var _path$6;
2437
- function _extends$6() { _extends$6 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
2438
- var SvgFileZipStroke = function SvgFileZipStroke(props) {
2439
- return /*#__PURE__*/React.createElement("svg", _extends$6({
2440
- xmlns: "http://www.w3.org/2000/svg",
2441
- width: 16,
2442
- height: 16,
2443
- focusable: "false",
2444
- viewBox: "0 0 16 16",
2445
- "aria-hidden": "true"
2446
- }, props), _path$6 || (_path$6 = /*#__PURE__*/React.createElement("path", {
2447
- fill: "none",
2448
- stroke: "currentColor",
2449
- strokeLinecap: "round",
2450
- d: "M6.5.5v11M5 2.5h1.5m0 1H8m-3 1h1.5m0 1H8m-3 1h1.5m0 1H8m-3 1h1.5m0 1H8m-3 1h1.5m8-6.3V15c0 .28-.22.5-.5.5H2c-.28 0-.5-.22-.5-.5V1c0-.28.22-.5.5-.5h8.85c.13 0 .26.05.36.15l3.15 3.2c.09.1.14.22.14.35zm-4-3.7V4c0 .28.22.5.5.5h3.5"
2451
- })));
2452
- };
2453
-
2454
- var _path$5, _circle;
2455
- function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
2456
- var SvgFileImageStroke = function SvgFileImageStroke(props) {
2457
- return /*#__PURE__*/React.createElement("svg", _extends$5({
2458
- xmlns: "http://www.w3.org/2000/svg",
2459
- width: 16,
2460
- height: 16,
2461
- focusable: "false",
2462
- viewBox: "0 0 16 16",
2463
- "aria-hidden": "true"
2464
- }, props), _path$5 || (_path$5 = /*#__PURE__*/React.createElement("path", {
2465
- fill: "none",
2466
- stroke: "currentColor",
2467
- strokeLinecap: "round",
2468
- d: "M14.5 4.2V15c0 .28-.22.5-.5.5H2c-.28 0-.5-.22-.5-.5V1c0-.28.22-.5.5-.5h8.85c.13 0 .26.05.36.15l3.15 3.2c.09.1.14.22.14.35zm-4-3.7V4c0 .28.22.5.5.5h3.5m-11 9l2.65-2.65c.2-.2.51-.2.71 0l1.79 1.79c.2.2.51.2.71 0l.79-.79c.2-.2.51-.2.71 0l1.65 1.65"
2469
- })), _circle || (_circle = /*#__PURE__*/React.createElement("circle", {
2470
- cx: 10.5,
2471
- cy: 8.5,
2472
- r: 1.5,
2473
- fill: "currentColor"
2474
- })));
2475
- };
2476
-
2477
- var _path$4;
2478
- function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
2479
- var SvgFileDocumentStroke = function SvgFileDocumentStroke(props) {
2480
- return /*#__PURE__*/React.createElement("svg", _extends$4({
2481
- xmlns: "http://www.w3.org/2000/svg",
2482
- width: 16,
2483
- height: 16,
2484
- focusable: "false",
2485
- viewBox: "0 0 16 16",
2486
- "aria-hidden": "true"
2487
- }, props), _path$4 || (_path$4 = /*#__PURE__*/React.createElement("path", {
2488
- fill: "none",
2489
- stroke: "currentColor",
2490
- strokeLinecap: "round",
2491
- d: "M4.5 7.5h7m-7 1.97h7m-7 2h7m3-7.27V15c0 .28-.22.5-.5.5H2c-.28 0-.5-.22-.5-.5V1c0-.28.22-.5.5-.5h8.85c.13 0 .26.05.36.15l3.15 3.2c.09.1.14.22.14.35zm-4-3.7V4c0 .28.22.5.5.5h3.5"
2492
- })));
2493
- };
2494
-
2495
- var _path$3;
2496
- function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
2497
- var SvgFileSpreadsheetStroke = function SvgFileSpreadsheetStroke(props) {
2498
- return /*#__PURE__*/React.createElement("svg", _extends$3({
2499
- xmlns: "http://www.w3.org/2000/svg",
2500
- width: 16,
2501
- height: 16,
2502
- focusable: "false",
2503
- viewBox: "0 0 16 16",
2504
- "aria-hidden": "true"
2505
- }, props), _path$3 || (_path$3 = /*#__PURE__*/React.createElement("path", {
2506
- fill: "none",
2507
- stroke: "currentColor",
2508
- strokeLinecap: "round",
2509
- d: "M4.5 7.5h2m-2 2h2m-2 2h2m2-4h3m-3 2h3m-3 2h3m3-7.3V15c0 .28-.22.5-.5.5H2c-.28 0-.5-.22-.5-.5V1c0-.28.22-.5.5-.5h8.85c.13 0 .26.05.36.15l3.15 3.2c.09.1.14.22.14.35zm-4-3.7V4c0 .28.22.5.5.5h3.5"
2510
- })));
2511
- };
2512
-
2513
- var _path$2;
2514
- function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
2515
- var SvgFilePresentationStroke = function SvgFilePresentationStroke(props) {
2516
- return /*#__PURE__*/React.createElement("svg", _extends$2({
2517
- xmlns: "http://www.w3.org/2000/svg",
2518
- width: 16,
2519
- height: 16,
2520
- focusable: "false",
2521
- viewBox: "0 0 16 16",
2522
- "aria-hidden": "true"
2523
- }, props), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
2524
- fill: "none",
2525
- stroke: "currentColor",
2526
- d: "M14.5 4.2V15c0 .28-.22.5-.5.5H2c-.28 0-.5-.22-.5-.5V1c0-.28.22-.5.5-.5h8.85c.13 0 .26.05.36.15l3.15 3.2c.09.1.14.22.14.35zm-4-3.7V4c0 .28.22.5.5.5h3.5M7 9.5h4c.28 0 .5.22.5.5v3c0 .28-.22.5-.5.5H7c-.28 0-.5-.22-.5-.5v-3c0-.28.22-.5.5-.5zm-.5 2H5c-.28 0-.5-.22-.5-.5V8c0-.28.22-.5.5-.5h4c.28 0 .5.22.5.5v1.5"
2527
- })));
2528
- };
2529
-
2530
- var _path$1;
2531
- function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
2532
- var SvgFileGenericStroke = function SvgFileGenericStroke(props) {
2533
- return /*#__PURE__*/React.createElement("svg", _extends$1({
2534
- xmlns: "http://www.w3.org/2000/svg",
2535
- width: 16,
2536
- height: 16,
2537
- focusable: "false",
2538
- viewBox: "0 0 16 16",
2539
- "aria-hidden": "true"
2540
- }, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
2541
- fill: "none",
2542
- stroke: "currentColor",
2543
- d: "M14.5 4.2V15c0 .28-.22.5-.5.5H2c-.28 0-.5-.22-.5-.5V1c0-.28.22-.5.5-.5h8.85c.13 0 .26.05.36.15l3.15 3.2c.09.1.14.22.14.35zm-4-3.7V4c0 .28.22.5.5.5h3.5"
2544
- })));
2545
- };
2546
-
2547
- var _path;
2548
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2549
- var SvgFileErrorStroke = function SvgFileErrorStroke(props) {
2550
- return /*#__PURE__*/React.createElement("svg", _extends({
2551
- xmlns: "http://www.w3.org/2000/svg",
2552
- width: 16,
2553
- height: 16,
2554
- focusable: "false",
2555
- viewBox: "0 0 16 16",
2556
- "aria-hidden": "true"
2557
- }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
2558
- fill: "none",
2559
- stroke: "currentColor",
2560
- strokeLinecap: "round",
2561
- d: "M14.5 4.205V15a.5.5 0 01-.5.5H2a.5.5 0 01-.5-.5V1A.5.5 0 012 .5h8.853a.5.5 0 01.356.15l3.148 3.204a.5.5 0 01.143.35zM10.5.5V4a.5.5 0 00.5.5h3.5m-9 8l5-5m0 5l-5-5"
2562
- })));
2563
- };
2564
-
2565
- const fileIconsDefault = {
2566
- pdf: React__default.createElement(SvgFilePdfStroke, null),
2567
- zip: React__default.createElement(SvgFileZipStroke, null),
2568
- image: React__default.createElement(SvgFileImageStroke, null),
2569
- document: React__default.createElement(SvgFileDocumentStroke, null),
2570
- spreadsheet: React__default.createElement(SvgFileSpreadsheetStroke, null),
2571
- presentation: React__default.createElement(SvgFilePresentationStroke, null),
2572
- generic: React__default.createElement(SvgFileGenericStroke, null),
2573
- success: React__default.createElement(SvgCheckCircleStroke$1, null),
2574
- error: React__default.createElement(SvgFileErrorStroke, null)
2575
- };
2576
- const fileIconsCompact = {
2577
- pdf: React__default.createElement(SvgFilePdfStroke$1, null),
2578
- zip: React__default.createElement(SvgFileZipStroke$1, null),
2579
- image: React__default.createElement(SvgFileImageStroke$1, null),
2580
- document: React__default.createElement(SvgFileDocumentStroke$1, null),
2581
- spreadsheet: React__default.createElement(SvgFileSpreadsheetStroke$1, null),
2582
- presentation: React__default.createElement(SvgFilePresentationStroke$1, null),
2583
- generic: React__default.createElement(SvgFileGenericStroke$1, null),
2584
- success: React__default.createElement(SvgCheckCircleStroke, null),
2585
- error: React__default.createElement(SvgFileErrorStroke$1, null)
2586
- };
2587
-
2588
- const FileComponent = forwardRef((_ref, ref) => {
2589
- let {
2590
- children,
2591
- type,
2592
- isCompact,
2593
- focusInset,
2594
- validation,
2595
- ...props
2596
- } = _ref;
2597
- const fileContextValue = useMemo(() => ({
2598
- isCompact
2599
- }), [isCompact]);
2600
- const validationType = validation || type;
2601
- return React__default.createElement(FileContext.Provider, {
2602
- value: fileContextValue
2603
- }, React__default.createElement(StyledFile, _extends$t({}, props, {
2604
- isCompact: isCompact,
2605
- focusInset: focusInset,
2606
- validation: validation,
2607
- ref: ref
2608
- }), validationType && React__default.createElement(StyledFileIcon, {
2609
- isCompact: isCompact
2610
- }, isCompact ? fileIconsCompact[validationType] : fileIconsDefault[validationType]), Children.map(children, child => typeof child === 'string' ? React__default.createElement("span", null, child) : child)));
2611
- });
2612
- FileComponent.displayName = 'File';
2613
- FileComponent.propTypes = {
2614
- focusInset: PropTypes.bool,
2615
- isCompact: PropTypes.bool,
2616
- type: PropTypes.oneOf(FILE_TYPE),
2617
- validation: PropTypes.oneOf(FILE_VALIDATION)
2618
- };
2619
- const File = FileComponent;
2620
- File.Close = Close;
2621
- File.Delete = Delete;
2622
-
2623
- const MediaInput = React__default.forwardRef((_ref, ref) => {
2624
- let {
2625
- start,
2626
- end,
2627
- disabled,
2628
- isCompact,
2629
- isBare,
2630
- focusInset,
2631
- readOnly,
2632
- validation,
2633
- wrapperProps = {},
2634
- wrapperRef,
2635
- onSelect,
2636
- ...props
2637
- } = _ref;
2638
- const fieldContext = useFieldContext();
2639
- const inputRef = useRef();
2640
- const [isFocused, setIsFocused] = useState(false);
2641
- const [isHovered, setIsHovered] = useState(false);
2642
- const {
2643
- onClick,
2644
- onFocus,
2645
- onBlur,
2646
- onMouseOver,
2647
- onMouseOut,
2648
- ...otherWrapperProps
2649
- } = wrapperProps;
2650
- const onFauxInputClickHandler = composeEventHandlers(onClick, () => {
2651
- inputRef.current && inputRef.current.focus();
2652
- });
2653
- const onFauxInputFocusHandler = composeEventHandlers(onFocus, () => {
2654
- setIsFocused(true);
2655
- });
2656
- const onFauxInputBlurHandler = composeEventHandlers(onBlur, () => {
2657
- setIsFocused(false);
2658
- });
2659
- const onFauxInputMouseOverHandler = composeEventHandlers(onMouseOver, () => {
2660
- setIsHovered(true);
2661
- });
2662
- const onFauxInputMouseOutHandler = composeEventHandlers(onMouseOut, () => {
2663
- setIsHovered(false);
2664
- });
2665
- const onSelectHandler = readOnly ? composeEventHandlers(onSelect, event => {
2666
- event.currentTarget.select();
2667
- }) : onSelect;
2668
- let combinedProps = {
2669
- disabled,
2670
- readOnly,
2671
- ref: mergeRefs([inputRef, ref]),
2672
- onSelect: onSelectHandler,
2673
- ...props
2674
- };
2675
- let isLabelHovered;
2676
- if (fieldContext) {
2677
- combinedProps = fieldContext.getInputProps(combinedProps);
2678
- isLabelHovered = fieldContext.isLabelHovered;
2679
- }
2680
- return React__default.createElement(FauxInput, _extends$t({
2681
- tabIndex: null,
2682
- onClick: onFauxInputClickHandler,
2683
- onFocus: onFauxInputFocusHandler,
2684
- onBlur: onFauxInputBlurHandler,
2685
- onMouseOver: onFauxInputMouseOverHandler,
2686
- onMouseOut: onFauxInputMouseOutHandler,
2687
- disabled: disabled,
2688
- isFocused: isFocused,
2689
- isHovered: isHovered || isLabelHovered,
2690
- isCompact: isCompact,
2691
- isBare: isBare,
2692
- focusInset: focusInset,
2693
- readOnly: readOnly,
2694
- validation: validation,
2695
- mediaLayout: true
2696
- }, otherWrapperProps, {
2697
- ref: wrapperRef
2698
- }), start && React__default.createElement(FauxInput.StartIcon, {
2699
- isDisabled: disabled,
2700
- isFocused: isFocused,
2701
- isHovered: isHovered || isLabelHovered
2702
- }, start), React__default.createElement(StyledTextMediaInput, combinedProps), end && React__default.createElement(FauxInput.EndIcon, {
2703
- isDisabled: disabled,
2704
- isFocused: isFocused,
2705
- isHovered: isHovered || isLabelHovered
2706
- }, end));
2707
- });
2708
- MediaInput.propTypes = {
2709
- isCompact: PropTypes.bool,
2710
- isBare: PropTypes.bool,
2711
- focusInset: PropTypes.bool,
2712
- validation: PropTypes.oneOf(VALIDATION),
2713
- start: PropTypes.any,
2714
- end: PropTypes.any,
2715
- wrapperProps: PropTypes.object,
2716
- wrapperRef: PropTypes.any
2717
- };
2718
- MediaInput.displayName = 'MediaInput';
2719
-
2720
- export { Checkbox, FauxInput, Field, Fieldset, File, FileList, FileUpload, Hint, Input, InputGroup, Label$1 as Label, MediaInput, Message, Radio, Range, Select, Textarea, Tiles, Toggle, VALIDATION };