@arc-ui/components 11.2.0 → 11.3.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/Checkbox/Checkbox.cjs.js +8 -27
- package/dist/Checkbox/Checkbox.esm.js +3 -22
- package/dist/FormControl/FormControl.cjs.d.ts +1 -1
- package/dist/FormControl/FormControl.cjs.js +1 -1
- package/dist/FormControl/FormControl.esm.d.ts +1 -1
- package/dist/FormControl/FormControl.esm.js +1 -1
- package/dist/RadioGroup/RadioGroup.cjs.d.ts +2 -2
- package/dist/RadioGroup/RadioGroup.cjs.js +2 -2
- package/dist/RadioGroup/RadioGroup.esm.d.ts +2 -2
- package/dist/RadioGroup/RadioGroup.esm.js +2 -2
- package/dist/Select/Select.cjs.d.ts +2 -2
- package/dist/Select/Select.cjs.js +75 -74
- package/dist/Select/Select.esm.d.ts +2 -2
- package/dist/Select/Select.esm.js +3 -2
- package/dist/Switch/Switch.cjs.d.ts +1 -1
- package/dist/Switch/Switch.cjs.js +12 -11
- package/dist/Switch/Switch.esm.d.ts +1 -1
- package/dist/Switch/Switch.esm.js +3 -2
- package/dist/TextInput/TextInput.cjs.d.ts +2 -2
- package/dist/TextInput/TextInput.cjs.js +1 -1
- package/dist/TextInput/TextInput.esm.d.ts +2 -2
- package/dist/TextInput/TextInput.esm.js +1 -1
- package/dist/_shared/cjs/BtIconTickAlt2Px-bdf06f8c.js +29 -0
- package/dist/_shared/{esm/FormControl-84c9ace6.d.ts → cjs/FormControl-d4d9c665.d.ts} +4 -0
- package/dist/_shared/cjs/{FormControl-e6b7d7c5.js → FormControl-d4d9c665.js} +6 -5
- package/dist/_shared/cjs/VerticalSpace-65ad083c.d.ts +1 -1
- package/dist/_shared/cjs/index-c81c9401.d.ts +1 -1
- package/dist/_shared/cjs/{BtIconTickAlt2Px-b12ecc78.js → index.module-af7c85f2.js} +34 -59
- package/dist/_shared/esm/BtIconTickAlt2Px-da97e9ae.js +23 -0
- package/dist/_shared/{cjs/FormControl-e6b7d7c5.d.ts → esm/FormControl-2cb96de7.d.ts} +4 -0
- package/dist/_shared/esm/{FormControl-84c9ace6.js → FormControl-2cb96de7.js} +6 -5
- package/dist/_shared/esm/VerticalSpace-6b4f5e50.d.ts +1 -1
- package/dist/_shared/esm/index-c81c9401.d.ts +1 -1
- package/dist/_shared/esm/{BtIconTickAlt2Px-2c4ec3be.js → index.module-599b86dd.js} +2 -22
- package/dist/index.es.js +77 -96
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +305 -324
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/components/FormControl/FormControl.d.ts +4 -0
- package/dist/types/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/types/components/Select/Select.d.ts +1 -1
- package/dist/types/components/TextInput/TextInput.d.ts +1 -1
- package/dist/types/components/VerticalSpace/VerticalSpace.d.ts +1 -1
- package/package.json +4 -4
|
@@ -4,10 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var index = require('../_shared/cjs/index-45bfb67b.js');
|
|
7
|
-
var
|
|
7
|
+
var index_module = require('../_shared/cjs/index.module-af7c85f2.js');
|
|
8
8
|
var Icon = require('../_shared/cjs/Icon-719d13d4.js');
|
|
9
|
+
var BtIconTickAlt2Px = require('../_shared/cjs/BtIconTickAlt2Px-bdf06f8c.js');
|
|
9
10
|
var Surface = require('../_shared/cjs/Surface-d6b8010e.js');
|
|
10
|
-
var FormControl = require('../_shared/cjs/FormControl-
|
|
11
|
+
var FormControl = require('../_shared/cjs/FormControl-d4d9c665.js');
|
|
11
12
|
var VerticalSpace = require('../_shared/cjs/VerticalSpace-65ad083c.js');
|
|
12
13
|
var Text = require('../_shared/cjs/Text-1d3844be.js');
|
|
13
14
|
require('react-dom');
|
|
@@ -21,7 +22,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
21
22
|
|
|
22
23
|
function $db6c3485150b8e66$export$1ab7ae714698c4b8(element) {
|
|
23
24
|
const [size, setSize] = React.useState(undefined);
|
|
24
|
-
|
|
25
|
+
index_module.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
25
26
|
if (element) {
|
|
26
27
|
// provide size as early as possible
|
|
27
28
|
setSize({
|
|
@@ -69,16 +70,16 @@ function $db6c3485150b8e66$export$1ab7ae714698c4b8(element) {
|
|
|
69
70
|
/* -------------------------------------------------------------------------------------------------
|
|
70
71
|
* Switch
|
|
71
72
|
* -----------------------------------------------------------------------------------------------*/ const $6be4966fd9bbc698$var$SWITCH_NAME = 'Switch';
|
|
72
|
-
const [$6be4966fd9bbc698$var$createSwitchContext, $6be4966fd9bbc698$export$cf7f5f17f69cbd43] =
|
|
73
|
+
const [$6be4966fd9bbc698$var$createSwitchContext, $6be4966fd9bbc698$export$cf7f5f17f69cbd43] = index_module.$c512c27ab02ef895$export$50c7b4e9d9f19c1($6be4966fd9bbc698$var$SWITCH_NAME);
|
|
73
74
|
const [$6be4966fd9bbc698$var$SwitchProvider, $6be4966fd9bbc698$var$useSwitchContext] = $6be4966fd9bbc698$var$createSwitchContext($6be4966fd9bbc698$var$SWITCH_NAME);
|
|
74
75
|
const $6be4966fd9bbc698$export$b5d5cf8927ab7262 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
75
76
|
const { __scopeSwitch: __scopeSwitch , name: name , checked: checkedProp , defaultChecked: defaultChecked , required: required , disabled: disabled , value: value = 'on' , onCheckedChange: onCheckedChange , ...switchProps } = props;
|
|
76
77
|
const [button, setButton] = React.useState(null);
|
|
77
|
-
const composedRefs =
|
|
78
|
+
const composedRefs = index_module.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setButton(node)
|
|
78
79
|
);
|
|
79
80
|
const hasConsumerStoppedPropagationRef = React.useRef(false); // We set this to true by default so that events bubble to forms without JS (SSR)
|
|
80
81
|
const isFormControl = button ? Boolean(button.closest('form')) : true;
|
|
81
|
-
const [checked = false, setChecked] =
|
|
82
|
+
const [checked = false, setChecked] = index_module.$71cd76cc60e0454e$export$6f32135080cb4c3({
|
|
82
83
|
prop: checkedProp,
|
|
83
84
|
defaultProp: defaultChecked,
|
|
84
85
|
onChange: onCheckedChange
|
|
@@ -87,7 +88,7 @@ const $6be4966fd9bbc698$export$b5d5cf8927ab7262 = /*#__PURE__*/ React.forwardRef
|
|
|
87
88
|
scope: __scopeSwitch,
|
|
88
89
|
checked: checked,
|
|
89
90
|
disabled: disabled
|
|
90
|
-
}, /*#__PURE__*/ React.createElement(
|
|
91
|
+
}, /*#__PURE__*/ React.createElement(index_module.$8927f6f2acc4f386$export$250ffa63cdc0d034.button, index_module._extends({
|
|
91
92
|
type: "button",
|
|
92
93
|
role: "switch",
|
|
93
94
|
"aria-checked": checked,
|
|
@@ -98,7 +99,7 @@ const $6be4966fd9bbc698$export$b5d5cf8927ab7262 = /*#__PURE__*/ React.forwardRef
|
|
|
98
99
|
value: value
|
|
99
100
|
}, switchProps, {
|
|
100
101
|
ref: composedRefs,
|
|
101
|
-
onClick:
|
|
102
|
+
onClick: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, (event)=>{
|
|
102
103
|
setChecked((prevChecked)=>!prevChecked
|
|
103
104
|
);
|
|
104
105
|
if (isFormControl) {
|
|
@@ -128,7 +129,7 @@ const $6be4966fd9bbc698$export$b5d5cf8927ab7262 = /*#__PURE__*/ React.forwardRef
|
|
|
128
129
|
const $6be4966fd9bbc698$export$4d07bf653ea69106 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
129
130
|
const { __scopeSwitch: __scopeSwitch , ...thumbProps } = props;
|
|
130
131
|
const context = $6be4966fd9bbc698$var$useSwitchContext($6be4966fd9bbc698$var$THUMB_NAME, __scopeSwitch);
|
|
131
|
-
return /*#__PURE__*/ React.createElement(
|
|
132
|
+
return /*#__PURE__*/ React.createElement(index_module.$8927f6f2acc4f386$export$250ffa63cdc0d034.span, index_module._extends({
|
|
132
133
|
"data-state": $6be4966fd9bbc698$var$getState(context.checked),
|
|
133
134
|
"data-disabled": context.disabled ? '' : undefined
|
|
134
135
|
}, thumbProps, {
|
|
@@ -138,7 +139,7 @@ const $6be4966fd9bbc698$export$4d07bf653ea69106 = /*#__PURE__*/ React.forwardRef
|
|
|
138
139
|
/* ---------------------------------------------------------------------------------------------- */ const $6be4966fd9bbc698$var$BubbleInput = (props)=>{
|
|
139
140
|
const { control: control , checked: checked , bubbles: bubbles = true , ...inputProps } = props;
|
|
140
141
|
const ref = React.useRef(null);
|
|
141
|
-
const prevChecked =
|
|
142
|
+
const prevChecked = index_module.$010c2913dbd2fe3d$export$5cae361ad82dce8b(checked);
|
|
142
143
|
const controlSize = $db6c3485150b8e66$export$1ab7ae714698c4b8(control); // Bubble checked change to parents (e.g form change event)
|
|
143
144
|
React.useEffect(()=>{
|
|
144
145
|
const input = ref.current;
|
|
@@ -157,7 +158,7 @@ const $6be4966fd9bbc698$export$4d07bf653ea69106 = /*#__PURE__*/ React.forwardRef
|
|
|
157
158
|
checked,
|
|
158
159
|
bubbles
|
|
159
160
|
]);
|
|
160
|
-
return /*#__PURE__*/ React.createElement("input",
|
|
161
|
+
return /*#__PURE__*/ React.createElement("input", index_module._extends({
|
|
161
162
|
type: "checkbox",
|
|
162
163
|
"aria-hidden": true,
|
|
163
164
|
defaultChecked: checked
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
2
|
import { SwitchProps as RadixSwitchProps } from "@radix-ui/react-switch";
|
|
3
|
-
import { FormControlProps } from "../_shared/esm/FormControl-
|
|
3
|
+
import { FormControlProps } from "../_shared/esm/FormControl-2cb96de7";
|
|
4
4
|
/** Use `Switch` to toggle between checked and not checked. */
|
|
5
5
|
declare const Switch: FC<SwitchProps>;
|
|
6
6
|
interface SwitchProps extends Omit<FormControlProps, "children" | "elementType" | "htmlFor" | "requirementStatus" | "disclosureText" | "disclosureTitle" | "onClickDisclosure" | "helper"> {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React__default, { useState, forwardRef, useRef, createElement, useEffect, useContext } from 'react';
|
|
2
2
|
import { c as classNames } from '../_shared/esm/index-2ae58626.js';
|
|
3
|
-
import { g as $9f79659886946c16$export$e5c5a5f917a5871c, $ as $c512c27ab02ef895$export$50c7b4e9d9f19c1, a as $6ed0406888f73fc4$export$c7b2cbe3552a0d05, h as $71cd76cc60e0454e$export$6f32135080cb4c3, d as $8927f6f2acc4f386$export$250ffa63cdc0d034, _ as _extends, e as $e42e1063c40fb3ef$export$b9ecd428b558ff10, i as $010c2913dbd2fe3d$export$5cae361ad82dce8b
|
|
3
|
+
import { g as $9f79659886946c16$export$e5c5a5f917a5871c, $ as $c512c27ab02ef895$export$50c7b4e9d9f19c1, a as $6ed0406888f73fc4$export$c7b2cbe3552a0d05, h as $71cd76cc60e0454e$export$6f32135080cb4c3, d as $8927f6f2acc4f386$export$250ffa63cdc0d034, _ as _extends, e as $e42e1063c40fb3ef$export$b9ecd428b558ff10, i as $010c2913dbd2fe3d$export$5cae361ad82dce8b } from '../_shared/esm/index.module-599b86dd.js';
|
|
4
4
|
import { I as Icon } from '../_shared/esm/Icon-61f7237a.js';
|
|
5
|
+
import { B as BtIconTickAlt2Px_2 } from '../_shared/esm/BtIconTickAlt2Px-da97e9ae.js';
|
|
5
6
|
import { C as Context } from '../_shared/esm/Surface-bf201530.js';
|
|
6
|
-
import { F as FormControl } from '../_shared/esm/FormControl-
|
|
7
|
+
import { F as FormControl } from '../_shared/esm/FormControl-2cb96de7.js';
|
|
7
8
|
import { V as VerticalSpace } from '../_shared/esm/VerticalSpace-6b4f5e50.js';
|
|
8
9
|
import { T as Text } from '../_shared/esm/Text-6b958ad8.js';
|
|
9
10
|
import 'react-dom';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { FC } from "react";
|
|
4
|
-
import { FormControlProps } from "../_shared/cjs/FormControl-
|
|
4
|
+
import { FormControlProps } from "../_shared/cjs/FormControl-d4d9c665";
|
|
5
5
|
type EventType = React.ChangeEvent<HTMLInputElement>;
|
|
6
6
|
/**
|
|
7
7
|
* Use `TextInput` to allow custom user text entry with a keyboard.
|
|
8
8
|
*/
|
|
9
9
|
declare const TextInput: FC<TextInputProps>;
|
|
10
|
-
interface TextInputProps extends Omit<FormControlProps, "children" | "elementType" | "htmlFor" | "requirementStatus"> {
|
|
10
|
+
interface TextInputProps extends Omit<FormControlProps, "children" | "elementType" | "htmlFor" | "requirementStatus" | "helperUnderLabel"> {
|
|
11
11
|
/**
|
|
12
12
|
* Uncontrolled default value of the TextInput. If the TextInput is controlled
|
|
13
13
|
* via `value`/`onChange`, `defaultValue` will be ignored.
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var index = require('../_shared/cjs/index-78b35bc1.js');
|
|
6
6
|
var index$1 = require('../_shared/cjs/index-45bfb67b.js');
|
|
7
7
|
var React = require('react');
|
|
8
|
-
var FormControl = require('../_shared/cjs/FormControl-
|
|
8
|
+
var FormControl = require('../_shared/cjs/FormControl-d4d9c665.js');
|
|
9
9
|
var Surface = require('../_shared/cjs/Surface-d6b8010e.js');
|
|
10
10
|
var VisuallyHidden = require('../_shared/cjs/VisuallyHidden-e2c8b291.js');
|
|
11
11
|
require('../_shared/cjs/Text-1d3844be.js');
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { FC } from "react";
|
|
4
|
-
import { FormControlProps } from "../_shared/esm/FormControl-
|
|
4
|
+
import { FormControlProps } from "../_shared/esm/FormControl-2cb96de7";
|
|
5
5
|
type EventType = React.ChangeEvent<HTMLInputElement>;
|
|
6
6
|
/**
|
|
7
7
|
* Use `TextInput` to allow custom user text entry with a keyboard.
|
|
8
8
|
*/
|
|
9
9
|
declare const TextInput: FC<TextInputProps>;
|
|
10
|
-
interface TextInputProps extends Omit<FormControlProps, "children" | "elementType" | "htmlFor" | "requirementStatus"> {
|
|
10
|
+
interface TextInputProps extends Omit<FormControlProps, "children" | "elementType" | "htmlFor" | "requirementStatus" | "helperUnderLabel"> {
|
|
11
11
|
/**
|
|
12
12
|
* Uncontrolled default value of the TextInput. If the TextInput is controlled
|
|
13
13
|
* via `value`/`onChange`, `defaultValue` will be ignored.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ as __rest, a as __assign, f as filterDataAttrs } from '../_shared/esm/index-229fc864.js';
|
|
2
2
|
import { c as classNames } from '../_shared/esm/index-2ae58626.js';
|
|
3
3
|
import React__default, { forwardRef, useContext, useState } from 'react';
|
|
4
|
-
import { u as useAriaDescribedby, F as FormControl } from '../_shared/esm/FormControl-
|
|
4
|
+
import { u as useAriaDescribedby, F as FormControl } from '../_shared/esm/FormControl-2cb96de7.js';
|
|
5
5
|
import { C as Context } from '../_shared/esm/Surface-bf201530.js';
|
|
6
6
|
import { V as VisuallyHidden } from '../_shared/esm/VisuallyHidden-b9eebf71.js';
|
|
7
7
|
import '../_shared/esm/Text-6b958ad8.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React$1 = require('react');
|
|
4
|
+
|
|
5
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
6
|
+
|
|
7
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React$1);
|
|
8
|
+
|
|
9
|
+
const React = React__default["default"];
|
|
10
|
+
const BtIconTickAlt2Px = props =>
|
|
11
|
+
/*#__PURE__*/ React.createElement(
|
|
12
|
+
"svg",
|
|
13
|
+
Object.assign(
|
|
14
|
+
{
|
|
15
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
16
|
+
viewBox: "0 0 32 32"
|
|
17
|
+
},
|
|
18
|
+
props
|
|
19
|
+
),
|
|
20
|
+
/*#__PURE__*/ React.createElement("defs", null),
|
|
21
|
+
/*#__PURE__*/ React.createElement("path", {
|
|
22
|
+
d:
|
|
23
|
+
"M13.49963,21.91418l-4.707-4.707a1.0014,1.0014,0,0,1,0-1.41406,1.02353,1.02353,0,0,1,1.41406,0l3.293,3.293,8.293-8.293a.99989.99989,0,1,1,1.41406,1.41406Z",
|
|
24
|
+
fill: "currentColor"
|
|
25
|
+
})
|
|
26
|
+
);
|
|
27
|
+
var BtIconTickAlt2Px_2 = BtIconTickAlt2Px;
|
|
28
|
+
|
|
29
|
+
exports.BtIconTickAlt2Px_2 = BtIconTickAlt2Px_2;
|
|
@@ -114,5 +114,9 @@ interface FormControlProps {
|
|
|
114
114
|
* onClick handler for FormControlDisclosure
|
|
115
115
|
*/
|
|
116
116
|
onClickDisclosure?: () => void;
|
|
117
|
+
/**
|
|
118
|
+
* Position helper text under label. This is set to `false` by default.
|
|
119
|
+
*/
|
|
120
|
+
helperUnderLabel?: boolean;
|
|
117
121
|
}
|
|
118
122
|
export { FormControlDisclosure, FormControlDisclosureProps, useAriaDescribedby, FormControl, FormControlProps, Context as FormControlContext };
|
|
@@ -101,14 +101,14 @@ var Provider = Context.Provider;
|
|
|
101
101
|
* Use `FormControl` to provide inputs with labels, helper text and error messages
|
|
102
102
|
*/
|
|
103
103
|
var FormControl = function (_a) {
|
|
104
|
-
var children = _a.children, _b = _a.elementType, ElementType = _b === void 0 ? "div" : _b, errorMessage = _a.errorMessage, helper = _a.helper, htmlFor = _a.htmlFor, id = _a.id, label = _a.label, _c = _a.labelSize, labelSize = _c === void 0 ? "l" : _c, _d = _a.requirementStatus, requirementStatus = _d === void 0 ? "optional" : _d, isDisabled = _a.isDisabled, disclosureTitle = _a.disclosureTitle, disclosureText = _a.disclosureText, onClickDisclosure = _a.onClickDisclosure, props = index.__rest(_a, ["children", "elementType", "errorMessage", "helper", "htmlFor", "id", "label", "labelSize", "requirementStatus", "isDisabled", "disclosureTitle", "disclosureText", "onClickDisclosure"]);
|
|
104
|
+
var children = _a.children, _b = _a.elementType, ElementType = _b === void 0 ? "div" : _b, errorMessage = _a.errorMessage, helper = _a.helper, htmlFor = _a.htmlFor, id = _a.id, label = _a.label, _c = _a.labelSize, labelSize = _c === void 0 ? "l" : _c, _d = _a.requirementStatus, requirementStatus = _d === void 0 ? "optional" : _d, _e = _a.helperUnderLabel, helperUnderLabel = _e === void 0 ? false : _e, isDisabled = _a.isDisabled, disclosureTitle = _a.disclosureTitle, disclosureText = _a.disclosureText, onClickDisclosure = _a.onClickDisclosure, props = index.__rest(_a, ["children", "elementType", "errorMessage", "helper", "htmlFor", "id", "label", "labelSize", "requirementStatus", "helperUnderLabel", "isDisabled", "disclosureTitle", "disclosureText", "onClickDisclosure"]);
|
|
105
105
|
var surface = React$1.useContext(Surface.Context).surface;
|
|
106
|
-
var
|
|
106
|
+
var _f = useAriaDescribedby({
|
|
107
107
|
disclosureText: disclosureText,
|
|
108
108
|
errorMessage: errorMessage,
|
|
109
109
|
helper: helper,
|
|
110
110
|
id: htmlFor || id // `htmlFor` is preference to keep this deterministic with TextInput
|
|
111
|
-
}), ariaDescribedby =
|
|
111
|
+
}), ariaDescribedby = _f.ariaDescribedby, idError = _f.idError, idHelper = _f.idHelper, idDisclosure = _f.idDisclosure;
|
|
112
112
|
var LabelType = ElementType === "div" ? "label" : "legend";
|
|
113
113
|
var elementProps = {};
|
|
114
114
|
var labelProps = {};
|
|
@@ -134,11 +134,12 @@ var FormControl = function (_a) {
|
|
|
134
134
|
React__default["default"].createElement(LabelType, index.__assign({ className: "arc-FormControl-label" }, labelProps),
|
|
135
135
|
label,
|
|
136
136
|
requirementStatus === "optional" && (React__default["default"].createElement("span", { className: "arc-FormControl-labelOptional" }, "(optional)"))),
|
|
137
|
+
helperUnderLabel && (React__default["default"].createElement(React__default["default"].Fragment, null, helper && (React__default["default"].createElement("div", { className: "arc-FormControl-helper arc-FormControl-helper--underLabel", id: idHelper }, helper)))),
|
|
137
138
|
children,
|
|
138
|
-
errorMessage ? (React__default["default"].createElement("div", { className: "arc-FormControl-error", id: idError },
|
|
139
|
+
!helperUnderLabel && (React__default["default"].createElement(React__default["default"].Fragment, null, errorMessage ? (React__default["default"].createElement("div", { className: "arc-FormControl-error", id: idError },
|
|
139
140
|
React__default["default"].createElement("span", { className: "arc-FormControl-error--icon" },
|
|
140
141
|
React__default["default"].createElement(BtIconAlert_2, null)),
|
|
141
|
-
errorMessage)) : disclosureTitle ? (React__default["default"].createElement(FormControlDisclosure, { onClick: onClickDisclosure, summary: disclosureTitle, size: labelSize, id: idDisclosure }, disclosureText)) : (helper && (React__default["default"].createElement("div", { className: "arc-FormControl-helper", id: idHelper }, helper))))));
|
|
142
|
+
errorMessage)) : disclosureTitle ? (React__default["default"].createElement(FormControlDisclosure, { onClick: onClickDisclosure, summary: disclosureTitle, size: labelSize, id: idDisclosure }, disclosureText)) : (helper && (React__default["default"].createElement("div", { className: "arc-FormControl-helper", id: idHelper }, helper))))))));
|
|
142
143
|
};
|
|
143
144
|
|
|
144
145
|
exports.BtIconAlert_2 = BtIconAlert_2;
|
|
@@ -3,7 +3,7 @@ import { FC } from "react";
|
|
|
3
3
|
* Use `VerticalSpace` to create vertical space between components.
|
|
4
4
|
*/
|
|
5
5
|
declare const VerticalSpace: FC<VerticalSpaceProps>;
|
|
6
|
-
type VerticalSpaceSize = "4" | "8" | "12" | "16" | "24" | "32" | "48" | "64" | "96" | "128";
|
|
6
|
+
type VerticalSpaceSize = "4" | "8" | "12" | "16" | "20" | "24" | "28" | "32" | "40" | "48" | "64" | "96" | "128";
|
|
7
7
|
interface VerticalSpaceProps {
|
|
8
8
|
/**
|
|
9
9
|
* Should the VerticalSpace be visible for debugging and documentation
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var React
|
|
3
|
+
var React = require('react');
|
|
4
4
|
var $7SXl2$reactdom = require('react-dom');
|
|
5
5
|
|
|
6
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
7
|
-
|
|
8
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React$1);
|
|
9
|
-
|
|
10
6
|
function _extends() {
|
|
11
7
|
_extends = Object.assign || function (target) {
|
|
12
8
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -39,7 +35,7 @@ function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEven
|
|
|
39
35
|
/* -----------------------------------------------------------------------------------------------
|
|
40
36
|
* createContext
|
|
41
37
|
* ---------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
|
|
42
|
-
const BaseContext = /*#__PURE__*/ React
|
|
38
|
+
const BaseContext = /*#__PURE__*/ React.createContext(defaultContext);
|
|
43
39
|
const index = defaultContexts.length;
|
|
44
40
|
defaultContexts = [
|
|
45
41
|
...defaultContexts,
|
|
@@ -49,15 +45,15 @@ function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEven
|
|
|
49
45
|
const { scope: scope , children: children , ...context } = props;
|
|
50
46
|
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext; // Only re-memoize when prop values change
|
|
51
47
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
-
const value = React
|
|
48
|
+
const value = React.useMemo(()=>context
|
|
53
49
|
, Object.values(context));
|
|
54
|
-
return /*#__PURE__*/ React
|
|
50
|
+
return /*#__PURE__*/ React.createElement(Context.Provider, {
|
|
55
51
|
value: value
|
|
56
52
|
}, children);
|
|
57
53
|
}
|
|
58
54
|
function useContext(consumerName, scope) {
|
|
59
55
|
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext;
|
|
60
|
-
const context = React
|
|
56
|
+
const context = React.useContext(Context);
|
|
61
57
|
if (context) return context;
|
|
62
58
|
if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context.
|
|
63
59
|
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
@@ -72,11 +68,11 @@ function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEven
|
|
|
72
68
|
* createScope
|
|
73
69
|
* ---------------------------------------------------------------------------------------------*/ const createScope = ()=>{
|
|
74
70
|
const scopeContexts = defaultContexts.map((defaultContext)=>{
|
|
75
|
-
return /*#__PURE__*/ React
|
|
71
|
+
return /*#__PURE__*/ React.createContext(defaultContext);
|
|
76
72
|
});
|
|
77
73
|
return function useScope(scope) {
|
|
78
74
|
const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
|
|
79
|
-
return React
|
|
75
|
+
return React.useMemo(()=>({
|
|
80
76
|
[`__scope${scopeName}`]: {
|
|
81
77
|
...scope,
|
|
82
78
|
[scopeName]: contexts
|
|
@@ -117,7 +113,7 @@ function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEven
|
|
|
117
113
|
...currentScope
|
|
118
114
|
};
|
|
119
115
|
}, {});
|
|
120
|
-
return React
|
|
116
|
+
return React.useMemo(()=>({
|
|
121
117
|
[`__scope${baseScope.scopeName}`]: nextScopes1
|
|
122
118
|
})
|
|
123
119
|
, [
|
|
@@ -149,14 +145,14 @@ function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEven
|
|
|
149
145
|
* Accepts callback refs and RefObject(s)
|
|
150
146
|
*/ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {
|
|
151
147
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
152
|
-
return React
|
|
148
|
+
return React.useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);
|
|
153
149
|
}
|
|
154
150
|
|
|
155
151
|
/* -------------------------------------------------------------------------------------------------
|
|
156
152
|
* Slot
|
|
157
|
-
* -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /*#__PURE__*/ React
|
|
153
|
+
* -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
158
154
|
const { children: children , ...slotProps } = props;
|
|
159
|
-
const childrenArray = React
|
|
155
|
+
const childrenArray = React.Children.toArray(children);
|
|
160
156
|
const slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable);
|
|
161
157
|
if (slottable) {
|
|
162
158
|
// the new element to render is the one passed as a child of `Slottable`
|
|
@@ -165,37 +161,37 @@ function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEven
|
|
|
165
161
|
if (child === slottable) {
|
|
166
162
|
// because the new element will be the one rendered, we are only interested
|
|
167
163
|
// in grabbing its children (`newElement.props.children`)
|
|
168
|
-
if (React
|
|
169
|
-
return /*#__PURE__*/ React
|
|
164
|
+
if (React.Children.count(newElement) > 1) return React.Children.only(null);
|
|
165
|
+
return /*#__PURE__*/ React.isValidElement(newElement) ? newElement.props.children : null;
|
|
170
166
|
} else return child;
|
|
171
167
|
});
|
|
172
|
-
return /*#__PURE__*/ React
|
|
168
|
+
return /*#__PURE__*/ React.createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
|
|
173
169
|
ref: forwardedRef
|
|
174
|
-
}), /*#__PURE__*/ React
|
|
170
|
+
}), /*#__PURE__*/ React.isValidElement(newElement) ? /*#__PURE__*/ React.cloneElement(newElement, undefined, newChildren) : null);
|
|
175
171
|
}
|
|
176
|
-
return /*#__PURE__*/ React
|
|
172
|
+
return /*#__PURE__*/ React.createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
|
|
177
173
|
ref: forwardedRef
|
|
178
174
|
}), children);
|
|
179
175
|
});
|
|
180
176
|
$5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = 'Slot';
|
|
181
177
|
/* -------------------------------------------------------------------------------------------------
|
|
182
178
|
* SlotClone
|
|
183
|
-
* -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$var$SlotClone = /*#__PURE__*/ React
|
|
179
|
+
* -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$var$SlotClone = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
184
180
|
const { children: children , ...slotProps } = props;
|
|
185
|
-
if (/*#__PURE__*/ React
|
|
181
|
+
if (/*#__PURE__*/ React.isValidElement(children)) return /*#__PURE__*/ React.cloneElement(children, {
|
|
186
182
|
...$5e63c961fc1ce211$var$mergeProps(slotProps, children.props),
|
|
187
183
|
ref: $6ed0406888f73fc4$export$43e446d32b3d21af(forwardedRef, children.ref)
|
|
188
184
|
});
|
|
189
|
-
return React
|
|
185
|
+
return React.Children.count(children) > 1 ? React.Children.only(null) : null;
|
|
190
186
|
});
|
|
191
187
|
$5e63c961fc1ce211$var$SlotClone.displayName = 'SlotClone';
|
|
192
188
|
/* -------------------------------------------------------------------------------------------------
|
|
193
189
|
* Slottable
|
|
194
190
|
* -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = ({ children: children })=>{
|
|
195
|
-
return /*#__PURE__*/ React
|
|
191
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, children);
|
|
196
192
|
};
|
|
197
193
|
/* ---------------------------------------------------------------------------------------------- */ function $5e63c961fc1ce211$var$isSlottable(child) {
|
|
198
|
-
return /*#__PURE__*/ React
|
|
194
|
+
return /*#__PURE__*/ React.isValidElement(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45;
|
|
199
195
|
}
|
|
200
196
|
function $5e63c961fc1ce211$var$mergeProps(slotProps, childProps) {
|
|
201
197
|
// all child props should override
|
|
@@ -249,13 +245,13 @@ const $8927f6f2acc4f386$var$NODES = [
|
|
|
249
245
|
/* -------------------------------------------------------------------------------------------------
|
|
250
246
|
* Primitive
|
|
251
247
|
* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node)=>{
|
|
252
|
-
const Node = /*#__PURE__*/ React
|
|
248
|
+
const Node = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
253
249
|
const { asChild: asChild , ...primitiveProps } = props;
|
|
254
250
|
const Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : node;
|
|
255
|
-
React
|
|
251
|
+
React.useEffect(()=>{
|
|
256
252
|
window[Symbol.for('radix-ui')] = true;
|
|
257
253
|
}, []);
|
|
258
|
-
return /*#__PURE__*/ React
|
|
254
|
+
return /*#__PURE__*/ React.createElement(Comp, _extends({}, primitiveProps, {
|
|
259
255
|
ref: forwardedRef
|
|
260
256
|
}));
|
|
261
257
|
});
|
|
@@ -311,11 +307,11 @@ const $8927f6f2acc4f386$var$NODES = [
|
|
|
311
307
|
* A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
|
|
312
308
|
* prop or avoid re-executing effects when passed as a dependency
|
|
313
309
|
*/ function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) {
|
|
314
|
-
const callbackRef = React
|
|
315
|
-
React
|
|
310
|
+
const callbackRef = React.useRef(callback);
|
|
311
|
+
React.useEffect(()=>{
|
|
316
312
|
callbackRef.current = callback;
|
|
317
313
|
}); // https://github.com/facebook/react/issues/19240
|
|
318
|
-
return React
|
|
314
|
+
return React.useMemo(()=>(...args)=>{
|
|
319
315
|
var _callbackRef$current;
|
|
320
316
|
return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
|
|
321
317
|
}
|
|
@@ -328,7 +324,7 @@ const $8927f6f2acc4f386$var$NODES = [
|
|
|
328
324
|
* We use this safe version which suppresses the warning by replacing it with a noop on the server.
|
|
329
325
|
*
|
|
330
326
|
* See: https://reactjs.org/docs/hooks-reference.html#uselayouteffect
|
|
331
|
-
*/ const $9f79659886946c16$export$e5c5a5f917a5871c = Boolean(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) ? React
|
|
327
|
+
*/ const $9f79659886946c16$export$e5c5a5f917a5871c = Boolean(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) ? React.useLayoutEffect : ()=>{};
|
|
332
328
|
|
|
333
329
|
function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop: prop , defaultProp: defaultProp , onChange: onChange = ()=>{} }) {
|
|
334
330
|
const [uncontrolledProp, setUncontrolledProp] = $71cd76cc60e0454e$var$useUncontrolledState({
|
|
@@ -338,7 +334,7 @@ function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop: prop , defaultProp: de
|
|
|
338
334
|
const isControlled = prop !== undefined;
|
|
339
335
|
const value1 = isControlled ? prop : uncontrolledProp;
|
|
340
336
|
const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
|
|
341
|
-
const setValue = React
|
|
337
|
+
const setValue = React.useCallback((nextValue)=>{
|
|
342
338
|
if (isControlled) {
|
|
343
339
|
const setter = nextValue;
|
|
344
340
|
const value = typeof nextValue === 'function' ? setter(prop) : nextValue;
|
|
@@ -356,11 +352,11 @@ function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop: prop , defaultProp: de
|
|
|
356
352
|
];
|
|
357
353
|
}
|
|
358
354
|
function $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp: defaultProp , onChange: onChange }) {
|
|
359
|
-
const uncontrolledState = React
|
|
355
|
+
const uncontrolledState = React.useState(defaultProp);
|
|
360
356
|
const [value] = uncontrolledState;
|
|
361
|
-
const prevValueRef = React
|
|
357
|
+
const prevValueRef = React.useRef(value);
|
|
362
358
|
const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
|
|
363
|
-
React
|
|
359
|
+
React.useEffect(()=>{
|
|
364
360
|
if (prevValueRef.current !== value) {
|
|
365
361
|
handleChange(value);
|
|
366
362
|
prevValueRef.current = value;
|
|
@@ -374,13 +370,13 @@ function $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp: defaultProp ,
|
|
|
374
370
|
}
|
|
375
371
|
|
|
376
372
|
function $010c2913dbd2fe3d$export$5cae361ad82dce8b(value) {
|
|
377
|
-
const ref = React
|
|
373
|
+
const ref = React.useRef({
|
|
378
374
|
value: value,
|
|
379
375
|
previous: value
|
|
380
376
|
}); // We compare values before making an update to ensure that
|
|
381
377
|
// a change has been made. This ensures the previous value is
|
|
382
378
|
// persisted correctly between renders.
|
|
383
|
-
return React
|
|
379
|
+
return React.useMemo(()=>{
|
|
384
380
|
if (ref.current.value !== value) {
|
|
385
381
|
ref.current.previous = ref.current.value;
|
|
386
382
|
ref.current.value = value;
|
|
@@ -391,26 +387,6 @@ function $010c2913dbd2fe3d$export$5cae361ad82dce8b(value) {
|
|
|
391
387
|
]);
|
|
392
388
|
}
|
|
393
389
|
|
|
394
|
-
const React = React__default["default"];
|
|
395
|
-
const BtIconTickAlt2Px = props =>
|
|
396
|
-
/*#__PURE__*/ React.createElement(
|
|
397
|
-
"svg",
|
|
398
|
-
Object.assign(
|
|
399
|
-
{
|
|
400
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
401
|
-
viewBox: "0 0 32 32"
|
|
402
|
-
},
|
|
403
|
-
props
|
|
404
|
-
),
|
|
405
|
-
/*#__PURE__*/ React.createElement("defs", null),
|
|
406
|
-
/*#__PURE__*/ React.createElement("path", {
|
|
407
|
-
d:
|
|
408
|
-
"M13.49963,21.91418l-4.707-4.707a1.0014,1.0014,0,0,1,0-1.41406,1.02353,1.02353,0,0,1,1.41406,0l3.293,3.293,8.293-8.293a.99989.99989,0,1,1,1.41406,1.41406Z",
|
|
409
|
-
fill: "currentColor"
|
|
410
|
-
})
|
|
411
|
-
);
|
|
412
|
-
var BtIconTickAlt2Px_2 = BtIconTickAlt2Px;
|
|
413
|
-
|
|
414
390
|
exports.$010c2913dbd2fe3d$export$5cae361ad82dce8b = $010c2913dbd2fe3d$export$5cae361ad82dce8b;
|
|
415
391
|
exports.$5e63c961fc1ce211$export$8c6ed5c666ac1360 = $5e63c961fc1ce211$export$8c6ed5c666ac1360;
|
|
416
392
|
exports.$6ed0406888f73fc4$export$c7b2cbe3552a0d05 = $6ed0406888f73fc4$export$c7b2cbe3552a0d05;
|
|
@@ -421,5 +397,4 @@ exports.$9f79659886946c16$export$e5c5a5f917a5871c = $9f79659886946c16$export$e5c
|
|
|
421
397
|
exports.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a;
|
|
422
398
|
exports.$c512c27ab02ef895$export$50c7b4e9d9f19c1 = $c512c27ab02ef895$export$50c7b4e9d9f19c1;
|
|
423
399
|
exports.$e42e1063c40fb3ef$export$b9ecd428b558ff10 = $e42e1063c40fb3ef$export$b9ecd428b558ff10;
|
|
424
|
-
exports.BtIconTickAlt2Px_2 = BtIconTickAlt2Px_2;
|
|
425
400
|
exports._extends = _extends;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
const React = React__default;
|
|
4
|
+
const BtIconTickAlt2Px = props =>
|
|
5
|
+
/*#__PURE__*/ React.createElement(
|
|
6
|
+
"svg",
|
|
7
|
+
Object.assign(
|
|
8
|
+
{
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
viewBox: "0 0 32 32"
|
|
11
|
+
},
|
|
12
|
+
props
|
|
13
|
+
),
|
|
14
|
+
/*#__PURE__*/ React.createElement("defs", null),
|
|
15
|
+
/*#__PURE__*/ React.createElement("path", {
|
|
16
|
+
d:
|
|
17
|
+
"M13.49963,21.91418l-4.707-4.707a1.0014,1.0014,0,0,1,0-1.41406,1.02353,1.02353,0,0,1,1.41406,0l3.293,3.293,8.293-8.293a.99989.99989,0,1,1,1.41406,1.41406Z",
|
|
18
|
+
fill: "currentColor"
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
var BtIconTickAlt2Px_2 = BtIconTickAlt2Px;
|
|
22
|
+
|
|
23
|
+
export { BtIconTickAlt2Px_2 as B };
|
|
@@ -114,5 +114,9 @@ interface FormControlProps {
|
|
|
114
114
|
* onClick handler for FormControlDisclosure
|
|
115
115
|
*/
|
|
116
116
|
onClickDisclosure?: () => void;
|
|
117
|
+
/**
|
|
118
|
+
* Position helper text under label. This is set to `false` by default.
|
|
119
|
+
*/
|
|
120
|
+
helperUnderLabel?: boolean;
|
|
117
121
|
}
|
|
118
122
|
export { FormControlDisclosure, FormControlDisclosureProps, useAriaDescribedby, FormControl, FormControlProps, Context as FormControlContext };
|
|
@@ -95,14 +95,14 @@ var Provider = Context.Provider;
|
|
|
95
95
|
* Use `FormControl` to provide inputs with labels, helper text and error messages
|
|
96
96
|
*/
|
|
97
97
|
var FormControl = function (_a) {
|
|
98
|
-
var children = _a.children, _b = _a.elementType, ElementType = _b === void 0 ? "div" : _b, errorMessage = _a.errorMessage, helper = _a.helper, htmlFor = _a.htmlFor, id = _a.id, label = _a.label, _c = _a.labelSize, labelSize = _c === void 0 ? "l" : _c, _d = _a.requirementStatus, requirementStatus = _d === void 0 ? "optional" : _d, isDisabled = _a.isDisabled, disclosureTitle = _a.disclosureTitle, disclosureText = _a.disclosureText, onClickDisclosure = _a.onClickDisclosure, props = __rest(_a, ["children", "elementType", "errorMessage", "helper", "htmlFor", "id", "label", "labelSize", "requirementStatus", "isDisabled", "disclosureTitle", "disclosureText", "onClickDisclosure"]);
|
|
98
|
+
var children = _a.children, _b = _a.elementType, ElementType = _b === void 0 ? "div" : _b, errorMessage = _a.errorMessage, helper = _a.helper, htmlFor = _a.htmlFor, id = _a.id, label = _a.label, _c = _a.labelSize, labelSize = _c === void 0 ? "l" : _c, _d = _a.requirementStatus, requirementStatus = _d === void 0 ? "optional" : _d, _e = _a.helperUnderLabel, helperUnderLabel = _e === void 0 ? false : _e, isDisabled = _a.isDisabled, disclosureTitle = _a.disclosureTitle, disclosureText = _a.disclosureText, onClickDisclosure = _a.onClickDisclosure, props = __rest(_a, ["children", "elementType", "errorMessage", "helper", "htmlFor", "id", "label", "labelSize", "requirementStatus", "helperUnderLabel", "isDisabled", "disclosureTitle", "disclosureText", "onClickDisclosure"]);
|
|
99
99
|
var surface = useContext(Context$1).surface;
|
|
100
|
-
var
|
|
100
|
+
var _f = useAriaDescribedby({
|
|
101
101
|
disclosureText: disclosureText,
|
|
102
102
|
errorMessage: errorMessage,
|
|
103
103
|
helper: helper,
|
|
104
104
|
id: htmlFor || id // `htmlFor` is preference to keep this deterministic with TextInput
|
|
105
|
-
}), ariaDescribedby =
|
|
105
|
+
}), ariaDescribedby = _f.ariaDescribedby, idError = _f.idError, idHelper = _f.idHelper, idDisclosure = _f.idDisclosure;
|
|
106
106
|
var LabelType = ElementType === "div" ? "label" : "legend";
|
|
107
107
|
var elementProps = {};
|
|
108
108
|
var labelProps = {};
|
|
@@ -128,11 +128,12 @@ var FormControl = function (_a) {
|
|
|
128
128
|
React__default.createElement(LabelType, __assign({ className: "arc-FormControl-label" }, labelProps),
|
|
129
129
|
label,
|
|
130
130
|
requirementStatus === "optional" && (React__default.createElement("span", { className: "arc-FormControl-labelOptional" }, "(optional)"))),
|
|
131
|
+
helperUnderLabel && (React__default.createElement(React__default.Fragment, null, helper && (React__default.createElement("div", { className: "arc-FormControl-helper arc-FormControl-helper--underLabel", id: idHelper }, helper)))),
|
|
131
132
|
children,
|
|
132
|
-
errorMessage ? (React__default.createElement("div", { className: "arc-FormControl-error", id: idError },
|
|
133
|
+
!helperUnderLabel && (React__default.createElement(React__default.Fragment, null, errorMessage ? (React__default.createElement("div", { className: "arc-FormControl-error", id: idError },
|
|
133
134
|
React__default.createElement("span", { className: "arc-FormControl-error--icon" },
|
|
134
135
|
React__default.createElement(BtIconAlert_2, null)),
|
|
135
|
-
errorMessage)) : disclosureTitle ? (React__default.createElement(FormControlDisclosure, { onClick: onClickDisclosure, summary: disclosureTitle, size: labelSize, id: idDisclosure }, disclosureText)) : (helper && (React__default.createElement("div", { className: "arc-FormControl-helper", id: idHelper }, helper))))));
|
|
136
|
+
errorMessage)) : disclosureTitle ? (React__default.createElement(FormControlDisclosure, { onClick: onClickDisclosure, summary: disclosureTitle, size: labelSize, id: idDisclosure }, disclosureText)) : (helper && (React__default.createElement("div", { className: "arc-FormControl-helper", id: idHelper }, helper))))))));
|
|
136
137
|
};
|
|
137
138
|
|
|
138
139
|
export { BtIconAlert_2 as B, Context as C, FormControl as F, useAriaDescribedby as u };
|
|
@@ -3,7 +3,7 @@ import { FC } from "react";
|
|
|
3
3
|
* Use `VerticalSpace` to create vertical space between components.
|
|
4
4
|
*/
|
|
5
5
|
declare const VerticalSpace: FC<VerticalSpaceProps>;
|
|
6
|
-
type VerticalSpaceSize = "4" | "8" | "12" | "16" | "24" | "32" | "48" | "64" | "96" | "128";
|
|
6
|
+
type VerticalSpaceSize = "4" | "8" | "12" | "16" | "20" | "24" | "28" | "32" | "40" | "48" | "64" | "96" | "128";
|
|
7
7
|
interface VerticalSpaceProps {
|
|
8
8
|
/**
|
|
9
9
|
* Should the VerticalSpace be visible for debugging and documentation
|