@entur/form 6.0.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/form.cjs.development.js +173 -90
- package/dist/form.cjs.development.js.map +1 -1
- package/dist/form.cjs.production.min.js +1 -1
- package/dist/form.cjs.production.min.js.map +1 -1
- package/dist/form.esm.js +176 -94
- package/dist/form.esm.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/inputPanel/CheckboxPanel.d.ts +30 -0
- package/dist/inputPanel/InputPanelBase.d.ts +33 -0
- package/dist/{RadioPanel.d.ts → inputPanel/RadioPanel.d.ts} +9 -10
- package/dist/inputPanel/index.d.ts +2 -0
- package/dist/styles.css +435 -380
- package/package.json +5 -5
package/dist/form.esm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useRandomId, useOnMount, warnAboutMissingStyles } from '@entur/utils';
|
|
1
|
+
import { mergeRefs, useRandomId, useForceUpdate, useOnMount, warnAboutMissingStyles } from '@entur/utils';
|
|
2
2
|
import { Tooltip } from '@entur/tooltip';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import React__default from 'react';
|
|
5
|
+
import React__default, { useRef } from 'react';
|
|
6
6
|
import { ValidationExclamationIcon, ValidationErrorIcon, ValidationCheckIcon, QuestionIcon, CheckIcon, CloseSmallIcon } from '@entur/icons';
|
|
7
|
-
import { SubLabel, Paragraph, Label } from '@entur/typography';
|
|
7
|
+
import { SubLabel, Paragraph, Heading5, Label } from '@entur/typography';
|
|
8
8
|
import { colors } from '@entur/tokens';
|
|
9
9
|
|
|
10
10
|
function _extends() {
|
|
@@ -34,7 +34,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
34
34
|
return target;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
var _excluded$
|
|
37
|
+
var _excluded$g = ["children", "hideIcon", "variant", "className"];
|
|
38
38
|
var AlertIcon = function AlertIcon(_ref) {
|
|
39
39
|
var variant = _ref.variant;
|
|
40
40
|
var iconClass = "eds-feedback-text__icon eds-feedback-text__icon--" + variant;
|
|
@@ -63,7 +63,7 @@ var FeedbackText = function FeedbackText(_ref2) {
|
|
|
63
63
|
hideIcon = _ref2$hideIcon === void 0 ? false : _ref2$hideIcon,
|
|
64
64
|
variant = _ref2.variant,
|
|
65
65
|
className = _ref2.className,
|
|
66
|
-
rest = _objectWithoutPropertiesLoose(_ref2, _excluded$
|
|
66
|
+
rest = _objectWithoutPropertiesLoose(_ref2, _excluded$g);
|
|
67
67
|
return React__default.createElement(SubLabel, _extends({
|
|
68
68
|
className: classNames('eds-feedback-text', {
|
|
69
69
|
'eds-feedback-text--info': variant === 'info'
|
|
@@ -97,14 +97,14 @@ var useInputGroupContext = function useInputGroupContext() {
|
|
|
97
97
|
return React.useContext(InputGroupContext);
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
var _excluded$
|
|
100
|
+
var _excluded$f = ["label", "required", "labelId", "staticAnimation"];
|
|
101
101
|
var InputGroupLabel = function InputGroupLabel(_ref) {
|
|
102
102
|
var label = _ref.label,
|
|
103
103
|
required = _ref.required,
|
|
104
104
|
labelId = _ref.labelId,
|
|
105
105
|
_ref$staticAnimation = _ref.staticAnimation,
|
|
106
106
|
staticAnimation = _ref$staticAnimation === void 0 ? false : _ref$staticAnimation,
|
|
107
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
107
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$f);
|
|
108
108
|
var _useInputGroupContext = useInputGroupContext(),
|
|
109
109
|
isFilled = _useInputGroupContext.isFilled;
|
|
110
110
|
var filler = staticAnimation || isFilled;
|
|
@@ -134,7 +134,7 @@ var useVariant = function useVariant() {
|
|
|
134
134
|
return context;
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
-
var _excluded$
|
|
137
|
+
var _excluded$e = ["children", "className", "dark", "disabled", "readOnly", "variant", "prepend", "append", "size", "isFilled", "label", "required", "labelTooltip", "feedback", "labelId", "labelProps", "style", "disableLabelAnimation", "ariaAlertOnFeedback"];
|
|
138
138
|
var BaseFormControl = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
139
139
|
var children = _ref.children,
|
|
140
140
|
className = _ref.className,
|
|
@@ -161,7 +161,7 @@ var BaseFormControl = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
|
161
161
|
disableLabelAnimation = _ref$disableLabelAnim === void 0 ? false : _ref$disableLabelAnim,
|
|
162
162
|
_ref$ariaAlertOnFeedb = _ref.ariaAlertOnFeedback,
|
|
163
163
|
ariaAlertOnFeedback = _ref$ariaAlertOnFeedb === void 0 ? false : _ref$ariaAlertOnFeedb,
|
|
164
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
164
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$e);
|
|
165
165
|
var contextVariant = useVariant();
|
|
166
166
|
var currentVariant = variant || contextVariant;
|
|
167
167
|
return React__default.createElement(InputGroupContextProvider, null, React__default.createElement("div", _extends({
|
|
@@ -197,7 +197,7 @@ var BaseFormControl = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
|
197
197
|
}, feedback));
|
|
198
198
|
});
|
|
199
199
|
|
|
200
|
-
var _excluded$
|
|
200
|
+
var _excluded$d = ["checked", "className", "children", "style", "disabled", "reduceClickArea"];
|
|
201
201
|
var Checkbox = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
202
202
|
var checked = _ref.checked,
|
|
203
203
|
className = _ref.className,
|
|
@@ -206,19 +206,13 @@ var Checkbox = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
206
206
|
_ref$disabled = _ref.disabled,
|
|
207
207
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
208
208
|
reduceClickArea = _ref.reduceClickArea,
|
|
209
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
210
|
-
|
|
211
|
-
// Read more at https://reactjs.org/docs/hooks-reference.html#useimperativehandle
|
|
212
|
-
var innerRef = React__default.useRef(null);
|
|
213
|
-
//eslint-disable-next-line
|
|
214
|
-
React__default.useImperativeHandle(ref, function () {
|
|
215
|
-
return innerRef.current;
|
|
216
|
-
});
|
|
209
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$d);
|
|
210
|
+
var inputRef = React__default.useRef(null);
|
|
217
211
|
var isIndeterminate = checked === 'indeterminate';
|
|
218
212
|
var isControlled = checked !== undefined;
|
|
219
213
|
React__default.useEffect(function () {
|
|
220
|
-
if (
|
|
221
|
-
|
|
214
|
+
if (inputRef && inputRef.current) {
|
|
215
|
+
inputRef.current.indeterminate = isIndeterminate;
|
|
222
216
|
}
|
|
223
217
|
}, [isIndeterminate]);
|
|
224
218
|
return React__default.createElement("label", {
|
|
@@ -229,7 +223,7 @@ var Checkbox = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
229
223
|
style: style
|
|
230
224
|
}, React__default.createElement("input", _extends({
|
|
231
225
|
type: "checkbox",
|
|
232
|
-
ref:
|
|
226
|
+
ref: mergeRefs(ref, inputRef),
|
|
233
227
|
checked: isControlled ? checked === true : undefined,
|
|
234
228
|
disabled: disabled
|
|
235
229
|
}, rest)), React__default.createElement("span", {
|
|
@@ -260,23 +254,21 @@ var CheckboxIcon = function CheckboxIcon(_ref2) {
|
|
|
260
254
|
height: "5",
|
|
261
255
|
fill: "white"
|
|
262
256
|
}) : React__default.createElement("path", {
|
|
263
|
-
className: "eds-checkbox-icon__path",
|
|
264
257
|
d: "M14.1 27.2l7.1 7.2 14.6-14.8",
|
|
265
258
|
fill: "none"
|
|
266
259
|
}));
|
|
267
260
|
};
|
|
268
261
|
|
|
269
|
-
var _excluded$
|
|
262
|
+
var _excluded$c = ["children", "className", "label"];
|
|
270
263
|
var Fieldset = function Fieldset(_ref) {
|
|
271
264
|
var children = _ref.children,
|
|
272
265
|
className = _ref.className,
|
|
273
266
|
label = _ref.label,
|
|
274
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
267
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$c);
|
|
275
268
|
return React__default.createElement("fieldset", _extends({
|
|
276
269
|
className: classNames('eds-fieldset', className)
|
|
277
|
-
}, rest), label && React__default.createElement(
|
|
278
|
-
as: "legend"
|
|
279
|
-
className: "eds-legend"
|
|
270
|
+
}, rest), label && React__default.createElement(Heading5, {
|
|
271
|
+
as: "legend"
|
|
280
272
|
}, label), children);
|
|
281
273
|
};
|
|
282
274
|
|
|
@@ -290,13 +282,14 @@ var useRadioGroupContext = function useRadioGroupContext() {
|
|
|
290
282
|
return context;
|
|
291
283
|
};
|
|
292
284
|
|
|
293
|
-
var _excluded$
|
|
285
|
+
var _excluded$b = ["className", "children", "value", "disabled"];
|
|
294
286
|
var Radio = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
287
|
+
var _rest$name, _rest$checked, _rest$onChange;
|
|
295
288
|
var className = _ref.className,
|
|
296
289
|
children = _ref.children,
|
|
297
290
|
value = _ref.value,
|
|
298
291
|
disabled = _ref.disabled,
|
|
299
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
292
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$b);
|
|
300
293
|
var classList = classNames(className, 'eds-form-component--radio__radio', {
|
|
301
294
|
'eds-form-component--radio__radio--disabled': disabled
|
|
302
295
|
});
|
|
@@ -308,11 +301,11 @@ var Radio = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
308
301
|
className: "eds-form-component--radio__container"
|
|
309
302
|
}, React__default.createElement("input", _extends({
|
|
310
303
|
type: "radio",
|
|
311
|
-
name: name,
|
|
304
|
+
name: (_rest$name = rest.name) != null ? _rest$name : name,
|
|
312
305
|
ref: ref,
|
|
313
306
|
value: value,
|
|
314
|
-
checked: selectedValue === value,
|
|
315
|
-
onChange: onChange,
|
|
307
|
+
checked: (_rest$checked = rest.checked) != null ? _rest$checked : selectedValue === value,
|
|
308
|
+
onChange: (_rest$onChange = rest.onChange) != null ? _rest$onChange : onChange,
|
|
316
309
|
disabled: disabled
|
|
317
310
|
}, rest)), React__default.createElement("span", {
|
|
318
311
|
className: classList
|
|
@@ -325,30 +318,9 @@ var Radio = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
325
318
|
}, children));
|
|
326
319
|
});
|
|
327
320
|
|
|
328
|
-
var _excluded$
|
|
329
|
-
var
|
|
330
|
-
var
|
|
331
|
-
value = _ref.value,
|
|
332
|
-
children = _ref.children,
|
|
333
|
-
onChange = _ref.onChange,
|
|
334
|
-
label = _ref.label,
|
|
335
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$8);
|
|
336
|
-
var contextValue = React__default.useMemo(function () {
|
|
337
|
-
return {
|
|
338
|
-
name: name,
|
|
339
|
-
value: value,
|
|
340
|
-
onChange: onChange
|
|
341
|
-
};
|
|
342
|
-
}, [name, value, onChange]);
|
|
343
|
-
return React__default.createElement(RadioGroupContextProvider, {
|
|
344
|
-
value: contextValue
|
|
345
|
-
}, label ? React__default.createElement(Fieldset, _extends({
|
|
346
|
-
label: label
|
|
347
|
-
}, rest), children) : children);
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
var _excluded$7 = ["className", "children", "value", "title", "secondaryLabel", "size", "hideCheckbox", "style", "id", "disabled"];
|
|
351
|
-
var RadioPanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
321
|
+
var _excluded$a = ["className", "children", "value", "title", "secondaryLabel", "size", "hideSelectionIndicator", "style", "id", "disabled", "type", "onChange", "checked", "name"];
|
|
322
|
+
var InputPanelBase = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
323
|
+
var _ref2, _inputRef$current, _ref3, _inputRef$current2;
|
|
352
324
|
var className = _ref.className,
|
|
353
325
|
children = _ref.children,
|
|
354
326
|
value = _ref.value,
|
|
@@ -356,60 +328,170 @@ var RadioPanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
356
328
|
secondaryLabel = _ref.secondaryLabel,
|
|
357
329
|
_ref$size = _ref.size,
|
|
358
330
|
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
359
|
-
_ref$
|
|
360
|
-
|
|
331
|
+
_ref$hideSelectionInd = _ref.hideSelectionIndicator,
|
|
332
|
+
hideSelectionIndicator = _ref$hideSelectionInd === void 0 ? false : _ref$hideSelectionInd,
|
|
361
333
|
style = _ref.style,
|
|
362
334
|
id = _ref.id,
|
|
363
335
|
_ref$disabled = _ref.disabled,
|
|
364
336
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
var
|
|
374
|
-
var
|
|
337
|
+
_ref$type = _ref.type,
|
|
338
|
+
type = _ref$type === void 0 ? 'radio' : _ref$type,
|
|
339
|
+
onChange = _ref.onChange,
|
|
340
|
+
checked = _ref.checked,
|
|
341
|
+
name = _ref.name,
|
|
342
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
|
343
|
+
var classList = classNames(className, 'eds-input-panel__container', "eds-input-panel--" + size);
|
|
344
|
+
var inputRef = useRef(null);
|
|
345
|
+
var defaultId = useRandomId('eds-inputpanel');
|
|
346
|
+
var inputPanelId = id || defaultId;
|
|
347
|
+
var forceUpdate = useForceUpdate();
|
|
348
|
+
var handleOnChange = function handleOnChange(e) {
|
|
349
|
+
if (onChange === undefined) forceUpdate();
|
|
350
|
+
onChange == null ? void 0 : onChange(e);
|
|
351
|
+
};
|
|
375
352
|
return React__default.createElement("label", {
|
|
376
|
-
className: "eds-
|
|
377
|
-
htmlFor:
|
|
353
|
+
className: "eds-input-panel",
|
|
354
|
+
htmlFor: inputPanelId
|
|
378
355
|
}, React__default.createElement("input", _extends({
|
|
379
|
-
type:
|
|
356
|
+
type: type,
|
|
380
357
|
name: name,
|
|
381
|
-
ref: ref,
|
|
358
|
+
ref: mergeRefs(ref, inputRef),
|
|
382
359
|
value: value,
|
|
383
|
-
checked:
|
|
384
|
-
onChange:
|
|
385
|
-
id:
|
|
360
|
+
checked: checked,
|
|
361
|
+
onChange: handleOnChange,
|
|
362
|
+
id: inputPanelId,
|
|
386
363
|
disabled: disabled
|
|
387
364
|
}, rest)), React__default.createElement("div", {
|
|
388
365
|
className: classList,
|
|
389
366
|
style: style
|
|
390
367
|
}, React__default.createElement("div", {
|
|
391
|
-
className: "eds-
|
|
368
|
+
className: "eds-input-panel__title-wrapper"
|
|
392
369
|
}, React__default.createElement("div", {
|
|
393
|
-
className: "eds-
|
|
370
|
+
className: "eds-input-panel__title"
|
|
394
371
|
}, title), React__default.createElement("div", {
|
|
395
|
-
className: "eds-
|
|
396
|
-
}, secondaryLabel && React__default.createElement(
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
372
|
+
className: "eds-input-panel__secondary-label-and-icon-wrapper"
|
|
373
|
+
}, secondaryLabel !== undefined && React__default.createElement(React__default.Fragment, null, secondaryLabel), React__default.createElement("span", {
|
|
374
|
+
style: {
|
|
375
|
+
pointerEvents: 'none'
|
|
376
|
+
}
|
|
377
|
+
}, !(disabled || hideSelectionIndicator) && (type === 'radio' ? React__default.createElement(Radio, {
|
|
378
|
+
name: "",
|
|
379
|
+
value: "",
|
|
380
|
+
checked: (_ref2 = checked != null ? checked : (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.checked) != null ? _ref2 : false,
|
|
381
|
+
onChange: function onChange() {
|
|
382
|
+
return;
|
|
383
|
+
},
|
|
384
|
+
"aria-hidden": "true",
|
|
385
|
+
tabIndex: -1
|
|
386
|
+
}) : React__default.createElement(Checkbox, {
|
|
387
|
+
checked: (_ref3 = checked != null ? checked : (_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.checked) != null ? _ref3 : false,
|
|
388
|
+
onChange: function onChange() {
|
|
389
|
+
return null;
|
|
390
|
+
},
|
|
391
|
+
"aria-hidden": "true",
|
|
392
|
+
tabIndex: -1
|
|
393
|
+
}))))), children && React__default.createElement("div", {
|
|
394
|
+
className: "eds-input-panel__additional-content"
|
|
400
395
|
}, children)));
|
|
401
396
|
});
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
397
|
+
|
|
398
|
+
var _excluded$9 = ["className", "children", "value", "title", "secondaryLabel", "size", "hideRadioButton", "style", "id", "disabled"];
|
|
399
|
+
var RadioPanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
400
|
+
var className = _ref.className,
|
|
401
|
+
children = _ref.children,
|
|
402
|
+
value = _ref.value,
|
|
403
|
+
title = _ref.title,
|
|
404
|
+
secondaryLabel = _ref.secondaryLabel,
|
|
405
|
+
_ref$size = _ref.size,
|
|
406
|
+
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
407
|
+
_ref$hideRadioButton = _ref.hideRadioButton,
|
|
408
|
+
hideRadioButton = _ref$hideRadioButton === void 0 ? false : _ref$hideRadioButton,
|
|
409
|
+
style = _ref.style,
|
|
410
|
+
id = _ref.id,
|
|
411
|
+
_ref$disabled = _ref.disabled,
|
|
412
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
413
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$9);
|
|
414
|
+
var _useRadioGroupContext = useRadioGroupContext(),
|
|
415
|
+
name = _useRadioGroupContext.name,
|
|
416
|
+
selected = _useRadioGroupContext.value,
|
|
417
|
+
onChange = _useRadioGroupContext.onChange;
|
|
418
|
+
return React__default.createElement(InputPanelBase, _extends({
|
|
419
|
+
type: "radio",
|
|
420
|
+
name: name,
|
|
421
|
+
title: title,
|
|
422
|
+
value: value,
|
|
423
|
+
checked: selected === value,
|
|
424
|
+
onChange: onChange,
|
|
425
|
+
className: className,
|
|
426
|
+
secondaryLabel: secondaryLabel,
|
|
427
|
+
size: size,
|
|
428
|
+
hideSelectionIndicator: hideRadioButton,
|
|
429
|
+
style: style,
|
|
430
|
+
id: id,
|
|
431
|
+
disabled: disabled
|
|
432
|
+
}, rest, {
|
|
433
|
+
ref: ref
|
|
434
|
+
}), children);
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
var _excluded$8 = ["name", "checked", "onChange", "className", "children", "value", "title", "secondaryLabel", "size", "hideCheckbox", "style", "id", "disabled"];
|
|
438
|
+
var CheckboxPanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
439
|
+
var name = _ref.name,
|
|
440
|
+
checked = _ref.checked,
|
|
441
|
+
onChange = _ref.onChange,
|
|
442
|
+
className = _ref.className,
|
|
443
|
+
children = _ref.children,
|
|
444
|
+
value = _ref.value,
|
|
445
|
+
title = _ref.title,
|
|
446
|
+
secondaryLabel = _ref.secondaryLabel,
|
|
447
|
+
_ref$size = _ref.size,
|
|
448
|
+
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
449
|
+
_ref$hideCheckbox = _ref.hideCheckbox,
|
|
450
|
+
hideCheckbox = _ref$hideCheckbox === void 0 ? false : _ref$hideCheckbox,
|
|
451
|
+
style = _ref.style,
|
|
452
|
+
id = _ref.id,
|
|
453
|
+
_ref$disabled = _ref.disabled,
|
|
454
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
455
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$8);
|
|
456
|
+
return React__default.createElement(InputPanelBase, _extends({
|
|
457
|
+
type: "checkbox",
|
|
458
|
+
name: name,
|
|
459
|
+
title: title,
|
|
460
|
+
value: value,
|
|
461
|
+
checked: checked,
|
|
462
|
+
onChange: onChange,
|
|
463
|
+
className: className,
|
|
464
|
+
secondaryLabel: secondaryLabel,
|
|
465
|
+
size: size,
|
|
466
|
+
hideSelectionIndicator: hideCheckbox,
|
|
467
|
+
style: style,
|
|
468
|
+
id: id,
|
|
469
|
+
disabled: disabled
|
|
470
|
+
}, rest, {
|
|
471
|
+
ref: ref
|
|
472
|
+
}), children);
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
var _excluded$7 = ["name", "value", "children", "onChange", "label"];
|
|
476
|
+
var RadioGroup = function RadioGroup(_ref) {
|
|
477
|
+
var name = _ref.name,
|
|
478
|
+
value = _ref.value,
|
|
479
|
+
children = _ref.children,
|
|
480
|
+
onChange = _ref.onChange,
|
|
481
|
+
label = _ref.label,
|
|
482
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
483
|
+
var contextValue = React__default.useMemo(function () {
|
|
484
|
+
return {
|
|
485
|
+
name: name,
|
|
486
|
+
value: value,
|
|
487
|
+
onChange: onChange
|
|
488
|
+
};
|
|
489
|
+
}, [name, value, onChange]);
|
|
490
|
+
return React__default.createElement(RadioGroupContextProvider, {
|
|
491
|
+
value: contextValue
|
|
492
|
+
}, label ? React__default.createElement(Fieldset, _extends({
|
|
493
|
+
label: label
|
|
494
|
+
}, rest), children) : children);
|
|
413
495
|
};
|
|
414
496
|
|
|
415
497
|
var _excluded$6 = ["className", "children", "labelPlacement", "icon", "hideIcon", "color", "contrastColor", "size", "checked"];
|
|
@@ -815,5 +897,5 @@ var MultipleSegmentedControl = function MultipleSegmentedControl(_ref) {
|
|
|
815
897
|
|
|
816
898
|
warnAboutMissingStyles('form', 'icons', 'typography');
|
|
817
899
|
|
|
818
|
-
export { BaseFormControl, Checkbox, FeedbackText, Fieldset, InputGroupContextProvider, InputGroupLabel, MultipleSegmentedControl, Radio, RadioGroup, RadioPanel, SegmentedChoice, SegmentedControl, Switch, TextArea, TextField, VariantProvider, hasValue, isFilled, useInputGroupContext, useVariant };
|
|
900
|
+
export { BaseFormControl, Checkbox, CheckboxPanel, FeedbackText, Fieldset, InputGroupContextProvider, InputGroupLabel, MultipleSegmentedControl, Radio, RadioGroup, RadioPanel, SegmentedChoice, SegmentedControl, Switch, TextArea, TextField, VariantProvider, hasValue, isFilled, useInputGroupContext, useVariant };
|
|
819
901
|
//# sourceMappingURL=form.esm.js.map
|