@alto-avios/alto-ui 4.3.0-experimental.1 → 4.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/assets/ButtonGroup.css +1 -1
- package/dist/assets/DetailsDisclosure.css +1 -1
- package/dist/assets/FieldError.css +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.js +8 -8
- package/dist/components/DetailsDisclosure/DetailsDisclosure.js +3 -3
- package/dist/components/FieldError/FieldError.d.ts +5 -6
- package/dist/components/FieldError/FieldError.js +16 -29
- package/dist/components/FieldError/FieldError.js.map +1 -1
- package/dist/components/FieldHeader/FieldHeader.d.ts +1 -3
- package/dist/components/FieldHeader/FieldHeader.js +2 -4
- package/dist/components/FieldHeader/FieldHeader.js.map +1 -1
- package/dist/components/MonthYearField/MonthYearField.js +2 -4
- package/dist/components/MonthYearField/MonthYearField.js.map +1 -1
- package/dist/components/PasswordField/PasswordField.js +9 -4
- package/dist/components/PasswordField/PasswordField.js.map +1 -1
- package/dist/components/_base/Field/Field.d.ts +2 -11
- package/dist/components/_base/Field/Field.js +6 -15
- package/dist/components/_base/Field/Field.js.map +1 -1
- package/package.json +1 -1
- package/dist/utils/stories/storybookAction.d.ts +0 -10
- package/dist/utils/stories/storybookAction.js +0 -46868
- package/dist/utils/stories/storybookAction.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._buttonGroup_53q76_2{align-items:center;display:flex;flex-wrap:wrap;gap:var(--alto-sem-space-sm) var(--alto-sem-space-2xs)}._alignStart_53q76_10{justify-content:flex-start}._alignCenter_53q76_14{justify-content:center}._alignEnd_53q76_18{justify-content:flex-end}._alignJustify_53q76_22{justify-content:space-between}._alignJustify_53q76_22>*{flex-grow:1}._alignSplit_53q76_30{justify-content:space-between}._alignSplit_53q76_30>:first-child{margin-right:auto}._alignSplit_53q76_30>:not(:first-child){display:flex;justify-content:flex-end}._alignStack_53q76_43{align-items:stretch;flex-direction:column}._alignStackFlip_53q76_48{align-items:stretch;flex-direction:column-reverse}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._detailsDisclosure_1jv4t_1{display:flex;flex-direction:column;gap:var(--alto-sem-space-2xs);width:100%}._detailsDisclosureIcon_1jv4t_8{rotate:0deg;transition:rotate .2s}._detailsDisclosure_1jv4t_1[data-expanded] ._detailsDisclosureIcon_1jv4t_8{rotate:90deg}._detailsDisclosure_1jv4t_1 button[slot=trigger]{all:unset;border-radius:var(--alto-sem-radius-circle);color:var(--alto-sem-color-fg-accent-primary);cursor:pointer;display:flex;flex-direction:row;font-family:var(--alto-sem-text-body-font-family);font-size:var(--alto-sem-text-body-md-font-size);font-weight:var(--alto-sem-text-body-bold-font-weight);gap:var(--alto-sem-space-xs)}._detailsDisclosure_1jv4t_1 button[slot=trigger][data-focus-visible]{color:var(--alto-sem-color-fg-accent-secondary);outline-offset:var(--alto-sem-border-width-md);outline-style:solid;outline-width:var(--alto-sem-border-width-md)}._detailsDisclosure_1jv4t_1 button[slot=trigger][data-hovered],._detailsDisclosure_1jv4t_1 button[slot=trigger][data-pressed]{color:var(--alto-sem-color-fg-accent-secondary)}._detailsDisclosureDetails_1jv4t_41{padding-left:20px;position:relative}._detailsDisclosureDetails_1jv4t_41:before{background:var(--alto-sem-color-border-primary-default);border-radius:var(--alto-sem-radius-circle);content:"";height:100%;left:0;margin-left:3px;position:absolute;top:0;width:4px}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._fieldError_1tsix_1{align-items:center;align-self:stretch;color:var(--alto-sem-color-fg-critical-primary);display:flex;font-family:var(--alto-sem-text-body-font-family);font-size:var(--alto-sem-text-body-sm-font-size);gap:var(--alto-sem-space-4xs);letter-spacing:var(--alto-sem-text-body-sm-letter-spacing);line-height:var(--alto-sem-text-body-sm-line-height)}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import React__default from "react";
|
|
3
3
|
import { c as cva } from "../../index-DdUYounA.js";
|
|
4
|
-
import '../../assets/ButtonGroup.css';const buttonGroup = "
|
|
5
|
-
const alignStart = "
|
|
6
|
-
const alignCenter = "
|
|
7
|
-
const alignEnd = "
|
|
8
|
-
const alignJustify = "
|
|
9
|
-
const alignSplit = "
|
|
10
|
-
const alignStack = "
|
|
11
|
-
const alignStackFlip = "
|
|
4
|
+
import '../../assets/ButtonGroup.css';const buttonGroup = "_buttonGroup_53q76_2";
|
|
5
|
+
const alignStart = "_alignStart_53q76_10";
|
|
6
|
+
const alignCenter = "_alignCenter_53q76_14";
|
|
7
|
+
const alignEnd = "_alignEnd_53q76_18";
|
|
8
|
+
const alignJustify = "_alignJustify_53q76_22";
|
|
9
|
+
const alignSplit = "_alignSplit_53q76_30";
|
|
10
|
+
const alignStack = "_alignStack_53q76_43";
|
|
11
|
+
const alignStackFlip = "_alignStackFlip_53q76_48";
|
|
12
12
|
const styles = {
|
|
13
13
|
buttonGroup,
|
|
14
14
|
alignStart,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Disclosure, DisclosurePanel, Button } from "react-aria-components";
|
|
3
3
|
import { Icon } from "../Icon/Icon.js";
|
|
4
|
-
import '../../assets/DetailsDisclosure.css';const detailsDisclosure = "
|
|
5
|
-
const detailsDisclosureIcon = "
|
|
6
|
-
const detailsDisclosureDetails = "
|
|
4
|
+
import '../../assets/DetailsDisclosure.css';const detailsDisclosure = "_detailsDisclosure_1jv4t_1";
|
|
5
|
+
const detailsDisclosureIcon = "_detailsDisclosureIcon_1jv4t_8";
|
|
6
|
+
const detailsDisclosureDetails = "_detailsDisclosureDetails_1jv4t_41";
|
|
7
7
|
const styles = {
|
|
8
8
|
detailsDisclosure,
|
|
9
9
|
detailsDisclosureIcon,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { FieldErrorProps as AriaFieldErrorProps
|
|
1
|
+
import { FieldErrorProps as AriaFieldErrorProps } from 'react-aria-components';
|
|
2
2
|
export interface FieldErrorProps extends AriaFieldErrorProps {
|
|
3
|
-
children?: React.ReactNode |
|
|
3
|
+
children?: React.ReactNode | any;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @default 'Error:'
|
|
5
|
+
* Whether the field is invalid.
|
|
7
6
|
*/
|
|
8
|
-
|
|
7
|
+
isInvalid?: boolean;
|
|
9
8
|
}
|
|
10
|
-
export declare const FieldError: ({ children,
|
|
9
|
+
export declare const FieldError: ({ children, isInvalid: isInvalidProp, ...props }: FieldErrorProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
10
|
export default FieldError;
|
|
@@ -1,41 +1,28 @@
|
|
|
1
|
-
import { jsx,
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { FieldError as FieldError$1 } from "react-aria-components";
|
|
3
3
|
import { Icon } from "../Icon/Icon.js";
|
|
4
|
-
import '../../assets/FieldError.css';const fieldError = "
|
|
4
|
+
import '../../assets/FieldError.css';const fieldError = "_fieldError_1tsix_1";
|
|
5
5
|
const styles = {
|
|
6
|
-
fieldError
|
|
7
|
-
"sr-only": "_sr-only_1bhog_13"
|
|
6
|
+
fieldError
|
|
8
7
|
};
|
|
9
8
|
const FieldError = ({
|
|
10
9
|
children,
|
|
11
|
-
|
|
10
|
+
isInvalid: isInvalidProp,
|
|
12
11
|
...props
|
|
13
12
|
}) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
if (children && isInvalidProp) {
|
|
14
|
+
return /* @__PURE__ */ jsxs("div", { id: props.id, className: styles.fieldError, role: "alert", "aria-live": "polite", children: [
|
|
15
|
+
/* @__PURE__ */ jsx(Icon, { iconName: "triangle-exclamation", iconPrefix: "fas" }),
|
|
16
|
+
children
|
|
17
|
+
] });
|
|
18
|
+
}
|
|
19
|
+
return /* @__PURE__ */ jsx(FieldError$1, { className: styles.fieldError, ...props, children: ({
|
|
20
|
+
validationErrors
|
|
17
21
|
}) => {
|
|
18
|
-
const errorMessage =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
badInput: false,
|
|
23
|
-
customError: false,
|
|
24
|
-
patternMismatch: false,
|
|
25
|
-
rangeOverflow: false,
|
|
26
|
-
rangeUnderflow: false,
|
|
27
|
-
stepMismatch: false,
|
|
28
|
-
tooLong: false,
|
|
29
|
-
tooShort: false,
|
|
30
|
-
typeMismatch: false,
|
|
31
|
-
valid: !isInvalid,
|
|
32
|
-
valueMissing: false
|
|
33
|
-
}
|
|
34
|
-
}) : children || (validationErrors == null ? void 0 : validationErrors[0]);
|
|
35
|
-
if (!errorMessage || !isInvalid) return null;
|
|
36
|
-
return /* @__PURE__ */ jsxs("span", { className: styles.fieldError, role: "alert", "aria-live": "assertive", "aria-atomic": "true", children: [
|
|
37
|
-
/* @__PURE__ */ jsx("span", { className: styles["sr-only"], children: errorPrefix }),
|
|
38
|
-
/* @__PURE__ */ jsx(Icon, { iconName: "triangle-exclamation", iconPrefix: "fas", "aria-hidden": "true" }),
|
|
22
|
+
const errorMessage = children || (validationErrors == null ? void 0 : validationErrors[0]);
|
|
23
|
+
if (!errorMessage) return null;
|
|
24
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25
|
+
/* @__PURE__ */ jsx(Icon, { iconName: "triangle-exclamation", iconPrefix: "fas", "aria-label": "error-icon" }),
|
|
39
26
|
errorMessage
|
|
40
27
|
] });
|
|
41
28
|
} });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldError.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FieldError.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -9,8 +9,6 @@ export interface FieldHeaderProps {
|
|
|
9
9
|
descriptionId?: string;
|
|
10
10
|
errorId?: string;
|
|
11
11
|
optionalTranslation?: string;
|
|
12
|
-
showError?: boolean;
|
|
13
|
-
errorPrefix?: string;
|
|
14
12
|
}
|
|
15
|
-
export declare const FieldHeader: ({ label, description, isInvalid, isRequired, errorMessage, labelFor, descriptionId, errorId, optionalTranslation,
|
|
13
|
+
export declare const FieldHeader: ({ label, description, isInvalid, isRequired, errorMessage, labelFor, descriptionId, errorId, optionalTranslation, }: FieldHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
14
|
export default FieldHeader;
|
|
@@ -16,9 +16,7 @@ const FieldHeader = ({
|
|
|
16
16
|
labelFor,
|
|
17
17
|
descriptionId,
|
|
18
18
|
errorId,
|
|
19
|
-
optionalTranslation = "Optional"
|
|
20
|
-
showError = true,
|
|
21
|
-
errorPrefix
|
|
19
|
+
optionalTranslation = "Optional"
|
|
22
20
|
}) => {
|
|
23
21
|
return /* @__PURE__ */ jsxs("div", { className: styles.fieldHeader, "data-invalid": isInvalid ? true : void 0, children: [
|
|
24
22
|
/* @__PURE__ */ jsx("div", { className: styles["label-container"], children: label && /* @__PURE__ */ jsxs(FieldLabel, { required: isRequired ? true : void 0, htmlFor: labelFor, children: [
|
|
@@ -26,7 +24,7 @@ const FieldHeader = ({
|
|
|
26
24
|
!isRequired && ` (${optionalTranslation})`
|
|
27
25
|
] }) }),
|
|
28
26
|
description && /* @__PURE__ */ jsx(FieldDescription, { id: descriptionId, children: description }),
|
|
29
|
-
|
|
27
|
+
/* @__PURE__ */ jsx(FieldError, { isInvalid, id: errorId, children: errorMessage })
|
|
30
28
|
] });
|
|
31
29
|
};
|
|
32
30
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldHeader.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FieldHeader.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -77,8 +77,6 @@ const MonthYearField = forwardRef((props, ref) => {
|
|
|
77
77
|
placeholderYear = yearFormat === 4 ? "YYYY" : "YY",
|
|
78
78
|
id: providedId,
|
|
79
79
|
name,
|
|
80
|
-
errorMessage,
|
|
81
|
-
isInvalid,
|
|
82
80
|
...fieldProps
|
|
83
81
|
} = props;
|
|
84
82
|
const monthRef = useRef(null);
|
|
@@ -315,9 +313,9 @@ const MonthYearField = forwardRef((props, ref) => {
|
|
|
315
313
|
onFocus == null ? void 0 : onFocus(e);
|
|
316
314
|
}, [onFocus]);
|
|
317
315
|
const combinedValue = monthValue && yearValue ? `${monthValue.padStart(2, "0")}/${yearValue}` : "";
|
|
318
|
-
return /* @__PURE__ */ jsxs(Field, { as: FieldWrapper, ...fieldProps, isDisabled, isRequired,
|
|
316
|
+
return /* @__PURE__ */ jsxs(Field, { as: FieldWrapper, ...fieldProps, isDisabled, isRequired, labelFor: id, className: styles.monthYearField, children: [
|
|
319
317
|
name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: combinedValue }),
|
|
320
|
-
/* @__PURE__ */ jsxs("div", { className: styles.inputsContainer, ...!!errorMessage || isInvalid ? {
|
|
318
|
+
/* @__PURE__ */ jsxs("div", { className: styles.inputsContainer, ...!!(props == null ? void 0 : props.errorMessage) || (props == null ? void 0 : props.isInvalid) ? {
|
|
321
319
|
"data-invalid": true
|
|
322
320
|
} : {}, children: [
|
|
323
321
|
/* @__PURE__ */ jsx(Input, { ref: monthRef, id: `${id}-month`, name: `${id}-month`, inputMode: "numeric", "aria-label": labelMonth, placeholder: placeholderMonth, value: monthValue, onChange: handleMonthChange, onBlur: handleMonthBlur, onFocus: handleMonthFocus, onKeyDown: handleMonthKeyDown, maxLength: 2, className: styles.input, autoComplete: autoCompleteMonth, "data-segment": "month", type: "text" }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonthYearField.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MonthYearField.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -39,22 +39,27 @@ const PasswordField = forwardRef(({
|
|
|
39
39
|
const [internalValue, setInternalValue] = useState(props == null ? void 0 : props.defaultValue);
|
|
40
40
|
const value = (props == null ? void 0 : props.value) ?? internalValue;
|
|
41
41
|
const isVisibleState = (props == null ? void 0 : props.isVisible) ?? internalVisible;
|
|
42
|
+
const inputId = React__default.useId();
|
|
43
|
+
const descriptionId = React__default.useId();
|
|
44
|
+
const errorId = React__default.useId();
|
|
42
45
|
const requirementsId = React__default.useId();
|
|
46
|
+
const hasDescription = !!props.description;
|
|
43
47
|
const hasValidations = !!((_a = props.strengthValidations) == null ? void 0 : _a.length);
|
|
44
|
-
const
|
|
48
|
+
const hasError = !!props.isInvalid;
|
|
49
|
+
const ariaDescribedBy = [hasDescription && descriptionId, hasValidations && requirementsId, props["aria-describedby"]].filter(Boolean).join(" ");
|
|
45
50
|
const handleChange = React__default.useCallback((e) => {
|
|
46
51
|
var _a2;
|
|
47
52
|
setInternalValue(e.target.value);
|
|
48
53
|
(_a2 = props == null ? void 0 : props.onChange) == null ? void 0 : _a2.call(props, e.target.value);
|
|
49
|
-
}, [props.onChange]);
|
|
54
|
+
}, [props == null ? void 0 : props.onChange]);
|
|
50
55
|
const srLabels = useMemo(() => ({
|
|
51
56
|
...DEFAULT_SR_LABELS,
|
|
52
57
|
...screenReaderStrengthLabels ?? {}
|
|
53
58
|
}), [screenReaderStrengthLabels]);
|
|
54
59
|
const tooltipLabel = isVisibleState ? tooltipLabelHidePassword : tooltipLabelShowPassword;
|
|
55
60
|
return /* @__PURE__ */ jsxs("div", { className: styles["passwordField__wrapper"], children: [
|
|
56
|
-
/* @__PURE__ */ jsx(Field, { as: TextField, className: styles.passwordField, label: "Password", hasEndIcon: true, ...props, children: /* @__PURE__ */ jsx("div", { className: styles["passwordField"], children: /* @__PURE__ */ jsxs(Group, { children: [
|
|
57
|
-
/* @__PURE__ */ jsx(Input, { ref, type: isVisibleState ? "text" : "password", value, onChange: handleChange, "aria-describedby": ariaDescribedBy }),
|
|
61
|
+
/* @__PURE__ */ jsx(Field, { as: TextField, className: styles.passwordField, label: "Password", hasEndIcon: true, labelFor: (props == null ? void 0 : props.labelFor) ?? inputId, descriptionId: hasDescription ? descriptionId : void 0, errorId: hasError ? errorId : void 0, ...props, children: /* @__PURE__ */ jsx("div", { className: styles["passwordField"], children: /* @__PURE__ */ jsxs(Group, { children: [
|
|
62
|
+
/* @__PURE__ */ jsx(Input, { id: (props == null ? void 0 : props.labelFor) ?? inputId, ref, type: isVisibleState ? "text" : "password", value, onChange: handleChange, "aria-describedby": ariaDescribedBy, "aria-errormessage": hasError ? errorId : void 0, "aria-invalid": hasError || void 0 }),
|
|
58
63
|
/* @__PURE__ */ jsx(IconButton, { size: "sm", iconProps: isVisibleState ? {
|
|
59
64
|
iconName: "eye",
|
|
60
65
|
iconPrefix: "fas"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordField.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PasswordField.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FieldHeaderProps } from '../../FieldHeader';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
3
|
import { FieldVariants } from '../../../utils/forms/field';
|
|
4
|
-
export interface FieldCommonProps extends
|
|
4
|
+
export interface FieldCommonProps extends FieldHeaderProps {
|
|
5
5
|
/**
|
|
6
6
|
* Whether the Field is disabled
|
|
7
7
|
*/
|
|
@@ -28,15 +28,6 @@ export interface FieldCommonProps extends Omit<FieldHeaderProps, 'labelFor' | 'd
|
|
|
28
28
|
* @default 'Optional'
|
|
29
29
|
*/
|
|
30
30
|
optionalTranslation?: string;
|
|
31
|
-
/**
|
|
32
|
-
* The id of the error message element
|
|
33
|
-
*/
|
|
34
|
-
errorId?: string;
|
|
35
|
-
/**
|
|
36
|
-
* Prefix text for screen readers only in error messages
|
|
37
|
-
* @default 'Error:'
|
|
38
|
-
*/
|
|
39
|
-
errorPrefix?: string;
|
|
40
31
|
}
|
|
41
32
|
export type FieldProps<T extends object = object> = T & FieldCommonProps;
|
|
42
33
|
type FieldBaseProps<T extends object> = FieldProps<T> & Pick<FieldVariants, 'hasEndIcon' | 'hasStartIcon'> & {
|
|
@@ -53,5 +44,5 @@ type FieldBaseProps<T extends object> = FieldProps<T> & Pick<FieldVariants, 'has
|
|
|
53
44
|
*/
|
|
54
45
|
className?: React.ComponentProps<React.ElementType>['className'];
|
|
55
46
|
};
|
|
56
|
-
export declare function Field<T extends object>({ as, children, className, columns, maxWidthByChars, hasStartIcon, hasEndIcon, errorPlacement,
|
|
47
|
+
export declare function Field<T extends object>({ as, children, className, columns, maxWidthByChars, hasStartIcon, hasEndIcon, errorPlacement, ...props }: FieldBaseProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
57
48
|
export default Field;
|
|
@@ -28,31 +28,22 @@ function Field({
|
|
|
28
28
|
hasStartIcon,
|
|
29
29
|
hasEndIcon,
|
|
30
30
|
errorPlacement = "top",
|
|
31
|
-
|
|
32
|
-
description,
|
|
33
|
-
isRequired,
|
|
34
|
-
optionalTranslation,
|
|
35
|
-
isDisabled,
|
|
36
|
-
errorMessage,
|
|
37
|
-
isInvalid,
|
|
38
|
-
errorId,
|
|
39
|
-
errorPrefix,
|
|
40
|
-
...restProps
|
|
31
|
+
...props
|
|
41
32
|
}) {
|
|
42
33
|
React__default.useEffect(() => {
|
|
43
|
-
if (label === void 0) {
|
|
34
|
+
if ((props == null ? void 0 : props.label) === void 0) {
|
|
44
35
|
console.warn("@alto/ui: Field expects a label prop for accessibility compliance");
|
|
45
36
|
}
|
|
46
|
-
}, [label]);
|
|
47
|
-
return /* @__PURE__ */ jsxs(PolymorphicField, { as, isDisabled
|
|
48
|
-
label ? /* @__PURE__ */ jsx(FieldHeader, { label, description,
|
|
37
|
+
}, [props == null ? void 0 : props.label]);
|
|
38
|
+
return /* @__PURE__ */ jsxs(PolymorphicField, { as, isDisabled: props == null ? void 0 : props.isDisabled, className, ...props, children: [
|
|
39
|
+
(props == null ? void 0 : props.label) ? /* @__PURE__ */ jsx(FieldHeader, { label: props == null ? void 0 : props.label, description: props == null ? void 0 : props.description, isInvalid: props == null ? void 0 : props.isInvalid, isRequired: props == null ? void 0 : props.isRequired, labelFor: props == null ? void 0 : props.labelFor, descriptionId: props == null ? void 0 : props.descriptionId, errorId: props == null ? void 0 : props.errorId, errorMessage: errorPlacement === "top" ? props == null ? void 0 : props.errorMessage : void 0, optionalTranslation: props == null ? void 0 : props.optionalTranslation }) : null,
|
|
49
40
|
/* @__PURE__ */ jsx("div", { className: styles.fieldGrid, children: /* @__PURE__ */ jsx("div", { className: fieldVariants({
|
|
50
41
|
columns,
|
|
51
42
|
maxWidthByChars,
|
|
52
43
|
hasStartIcon,
|
|
53
44
|
hasEndIcon
|
|
54
45
|
}), children }) }),
|
|
55
|
-
errorPlacement === "bottom" && errorMessage ? /* @__PURE__ */ jsx("div", { className: styles.fieldError, children: /* @__PURE__ */ jsx(FieldError, {
|
|
46
|
+
errorPlacement === "bottom" && (props == null ? void 0 : props.errorMessage) ? /* @__PURE__ */ jsx("div", { className: styles.fieldError, children: /* @__PURE__ */ jsx(FieldError, { children: props.errorMessage }) }) : null
|
|
56
47
|
] });
|
|
57
48
|
}
|
|
58
49
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Field.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `action` function can be used but in the Actions tab it will display like a variable
|
|
3
|
-
* e.g.
|
|
4
|
-
* <Accordion onExpandedChange={action('onExpandedChange')} /> => onExpandedChange: true|false
|
|
5
|
-
*
|
|
6
|
-
* Doing the below, displays the `args` passed to the callback as an array (the way shown in the Storybook docs)
|
|
7
|
-
* e.g.
|
|
8
|
-
* <Accordion onExpandedChange={storybookAction('onExpandedChange')} /> => onExpandedChange: (1) [true|false]
|
|
9
|
-
*/
|
|
10
|
-
export declare const storybookAction: (callbackName: string) => (...args: unknown[]) => void;
|