@cloudscape-design/components-themeable 3.0.639 → 3.0.640
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/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/form-field/motion.scss +5 -2
- package/lib/internal/scss/form-field/styles.scss +11 -2
- package/lib/internal/scss/input/styles.scss +9 -0
- package/lib/internal/scss/internal/components/button-trigger/styles.scss +5 -0
- package/lib/internal/scss/internal/styles/forms/mixins.scss +11 -0
- package/lib/internal/scss/slider/mixins.scss +9 -4
- package/lib/internal/scss/textarea/styles.scss +4 -0
- package/lib/internal/scss/token-group/styles.scss +9 -2
- package/lib/internal/template/alert/index.d.ts.map +1 -1
- package/lib/internal/template/alert/index.js +9 -5
- package/lib/internal/template/alert/index.js.map +1 -1
- package/lib/internal/template/attribute-editor/interfaces.d.ts +4 -0
- package/lib/internal/template/attribute-editor/interfaces.d.ts.map +1 -1
- package/lib/internal/template/attribute-editor/interfaces.js.map +1 -1
- package/lib/internal/template/attribute-editor/row.d.ts.map +1 -1
- package/lib/internal/template/attribute-editor/row.js +4 -1
- package/lib/internal/template/attribute-editor/row.js.map +1 -1
- package/lib/internal/template/container/index.js +1 -1
- package/lib/internal/template/container/index.js.map +1 -1
- package/lib/internal/template/date-picker/index.d.ts.map +1 -1
- package/lib/internal/template/date-picker/index.js +2 -2
- package/lib/internal/template/date-picker/index.js.map +1 -1
- package/lib/internal/template/date-range-picker/index.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/index.js +2 -2
- package/lib/internal/template/date-range-picker/index.js.map +1 -1
- package/lib/internal/template/file-upload/interfaces.d.ts +14 -4
- package/lib/internal/template/file-upload/interfaces.d.ts.map +1 -1
- package/lib/internal/template/file-upload/interfaces.js.map +1 -1
- package/lib/internal/template/file-upload/internal.js +13 -7
- package/lib/internal/template/file-upload/internal.js.map +1 -1
- package/lib/internal/template/form/index.d.ts.map +1 -1
- package/lib/internal/template/form/index.js +17 -6
- package/lib/internal/template/form/index.js.map +1 -1
- package/lib/internal/template/form/internal.d.ts.map +1 -1
- package/lib/internal/template/form/internal.js +1 -14
- package/lib/internal/template/form/internal.js.map +1 -1
- package/lib/internal/template/form-field/index.d.ts.map +1 -1
- package/lib/internal/template/form-field/index.js +3 -2
- package/lib/internal/template/form-field/index.js.map +1 -1
- package/lib/internal/template/form-field/interfaces.d.ts +12 -1
- package/lib/internal/template/form-field/interfaces.d.ts.map +1 -1
- package/lib/internal/template/form-field/interfaces.js.map +1 -1
- package/lib/internal/template/form-field/internal.d.ts +9 -3
- package/lib/internal/template/form-field/internal.d.ts.map +1 -1
- package/lib/internal/template/form-field/internal.js +36 -11
- package/lib/internal/template/form-field/internal.js.map +1 -1
- package/lib/internal/template/form-field/styles.css.js +23 -19
- package/lib/internal/template/form-field/styles.scoped.css +45 -29
- package/lib/internal/template/form-field/styles.selectors.js +23 -19
- package/lib/internal/template/form-field/util.d.ts +3 -2
- package/lib/internal/template/form-field/util.d.ts.map +1 -1
- package/lib/internal/template/form-field/util.js +4 -3
- package/lib/internal/template/form-field/util.js.map +1 -1
- package/lib/internal/template/input/index.d.ts.map +1 -1
- package/lib/internal/template/input/index.js +2 -1
- package/lib/internal/template/input/index.js.map +1 -1
- package/lib/internal/template/input/internal.d.ts.map +1 -1
- package/lib/internal/template/input/internal.js +4 -1
- package/lib/internal/template/input/internal.js.map +1 -1
- package/lib/internal/template/input/styles.css.js +13 -12
- package/lib/internal/template/input/styles.scoped.css +46 -30
- package/lib/internal/template/input/styles.selectors.js +13 -12
- package/lib/internal/template/internal/analytics/components/analytics-funnel.d.ts +12 -12
- package/lib/internal/template/internal/analytics/components/analytics-funnel.d.ts.map +1 -1
- package/lib/internal/template/internal/analytics/components/analytics-funnel.js +38 -25
- package/lib/internal/template/internal/analytics/components/analytics-funnel.js.map +1 -1
- package/lib/internal/template/internal/analytics/context/analytics-context.d.ts +7 -2
- package/lib/internal/template/internal/analytics/context/analytics-context.d.ts.map +1 -1
- package/lib/internal/template/internal/analytics/context/analytics-context.js.map +1 -1
- package/lib/internal/template/internal/analytics/hooks/use-funnel.d.ts +5 -1
- package/lib/internal/template/internal/analytics/hooks/use-funnel.d.ts.map +1 -1
- package/lib/internal/template/internal/analytics/hooks/use-funnel.js +9 -5
- package/lib/internal/template/internal/analytics/hooks/use-funnel.js.map +1 -1
- package/lib/internal/template/internal/analytics/interfaces.d.ts +23 -37
- package/lib/internal/template/internal/analytics/interfaces.d.ts.map +1 -1
- package/lib/internal/template/internal/analytics/interfaces.js.map +1 -1
- package/lib/internal/template/internal/base-component/index.d.ts +1 -1
- package/lib/internal/template/internal/base-component/index.d.ts.map +1 -1
- package/lib/internal/template/internal/base-component/index.js +1 -1
- package/lib/internal/template/internal/base-component/index.js.map +1 -1
- package/lib/internal/template/internal/components/button-trigger/index.d.ts +1 -0
- package/lib/internal/template/internal/components/button-trigger/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/button-trigger/index.js +2 -2
- package/lib/internal/template/internal/components/button-trigger/index.js.map +1 -1
- package/lib/internal/template/internal/components/button-trigger/styles.css.js +11 -10
- package/lib/internal/template/internal/components/button-trigger/styles.scoped.css +35 -24
- package/lib/internal/template/internal/components/button-trigger/styles.selectors.js +11 -10
- package/lib/internal/template/internal/context/form-field-context.d.ts +14 -1
- package/lib/internal/template/internal/context/form-field-context.d.ts.map +1 -1
- package/lib/internal/template/internal/context/form-field-context.js +1 -1
- package/lib/internal/template/internal/context/form-field-context.js.map +1 -1
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/internal/environment.json +1 -1
- package/lib/internal/template/link/internal.d.ts.map +1 -1
- package/lib/internal/template/link/internal.js +9 -3
- package/lib/internal/template/link/internal.js.map +1 -1
- package/lib/internal/template/modal/body-scroll.d.ts.map +1 -1
- package/lib/internal/template/modal/body-scroll.js +5 -0
- package/lib/internal/template/modal/body-scroll.js.map +1 -1
- package/lib/internal/template/select/parts/filter.d.ts +1 -1
- package/lib/internal/template/select/parts/filter.d.ts.map +1 -1
- package/lib/internal/template/select/parts/trigger.d.ts.map +1 -1
- package/lib/internal/template/select/parts/trigger.js +2 -2
- package/lib/internal/template/select/parts/trigger.js.map +1 -1
- package/lib/internal/template/test-utils/dom/file-upload/index.d.ts +2 -0
- package/lib/internal/template/test-utils/dom/file-upload/index.js +6 -0
- package/lib/internal/template/test-utils/dom/file-upload/index.js.map +1 -1
- package/lib/internal/template/test-utils/dom/form-field/index.d.ts +1 -0
- package/lib/internal/template/test-utils/dom/form-field/index.js +3 -0
- package/lib/internal/template/test-utils/dom/form-field/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/file-upload/index.d.ts +2 -0
- package/lib/internal/template/test-utils/selectors/file-upload/index.js +6 -0
- package/lib/internal/template/test-utils/selectors/file-upload/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/form-field/index.d.ts +1 -0
- package/lib/internal/template/test-utils/selectors/form-field/index.js +3 -0
- package/lib/internal/template/test-utils/selectors/form-field/index.js.map +1 -1
- package/lib/internal/template/test-utils/tsconfig.tsbuildinfo +1 -1
- package/lib/internal/template/textarea/index.d.ts.map +1 -1
- package/lib/internal/template/textarea/index.js +2 -1
- package/lib/internal/template/textarea/index.js.map +1 -1
- package/lib/internal/template/textarea/styles.css.js +5 -4
- package/lib/internal/template/textarea/styles.scoped.css +23 -12
- package/lib/internal/template/textarea/styles.selectors.js +5 -4
- package/lib/internal/template/token-group/styles.css.js +9 -8
- package/lib/internal/template/token-group/styles.scoped.css +27 -16
- package/lib/internal/template/token-group/styles.selectors.js +9 -8
- package/lib/internal/template/token-group/token.d.ts +3 -1
- package/lib/internal/template/token-group/token.d.ts.map +1 -1
- package/lib/internal/template/token-group/token.js +8 -5
- package/lib/internal/template/token-group/token.js.map +1 -1
- package/lib/internal/template/wizard/analytics.d.ts +2 -1
- package/lib/internal/template/wizard/analytics.d.ts.map +1 -1
- package/lib/internal/template/wizard/analytics.js +7 -3
- package/lib/internal/template/wizard/analytics.js.map +1 -1
- package/lib/internal/template/wizard/index.js +1 -1
- package/lib/internal/template/wizard/index.js.map +1 -1
- package/lib/internal/template/wizard/internal.d.ts.map +1 -1
- package/lib/internal/template/wizard/internal.js +2 -2
- package/lib/internal/template/wizard/internal.js.map +1 -1
- package/lib/internal/template/wizard/wizard-form.d.ts +4 -2
- package/lib/internal/template/wizard/wizard-form.d.ts.map +1 -1
- package/lib/internal/template/wizard/wizard-form.js +31 -19
- package/lib/internal/template/wizard/wizard-form.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,12 +5,18 @@ interface FormFieldErrorProps {
|
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
errorIconAriaLabel?: string;
|
|
7
7
|
}
|
|
8
|
+
interface FormFieldWarningProps {
|
|
9
|
+
id?: string;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
warningIconAriaLabel?: string;
|
|
12
|
+
}
|
|
8
13
|
export declare function FormFieldError({ id, children, errorIconAriaLabel }: FormFieldErrorProps): JSX.Element;
|
|
9
|
-
export declare function
|
|
14
|
+
export declare function FormFieldWarning({ id, children, warningIconAriaLabel }: FormFieldWarningProps): JSX.Element;
|
|
15
|
+
export declare function ConstraintText({ id, hasValidationText, children, }: {
|
|
10
16
|
id?: string;
|
|
11
|
-
|
|
17
|
+
hasValidationText: boolean;
|
|
12
18
|
children: React.ReactNode;
|
|
13
19
|
}): JSX.Element;
|
|
14
|
-
export default function InternalFormField({ controlId, stretch, label, info, i18nStrings, children, secondaryControl, description, constraintText, errorText, __hideLabel, __internalRootRef, __disableGutters, ...rest }: InternalFormFieldProps): JSX.Element;
|
|
20
|
+
export default function InternalFormField({ controlId, stretch, label, info, i18nStrings, children, secondaryControl, description, constraintText, errorText, warningText, __hideLabel, __internalRootRef, __disableGutters, __analyticsMetadata, ...rest }: InternalFormFieldProps): JSX.Element;
|
|
15
21
|
export {};
|
|
16
22
|
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/form-field/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/form-field/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAcjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAgBtD,UAAU,mBAAmB;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,UAAU,qBAAqB;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,kBAAkB,EAAE,EAAE,mBAAmB,eAqBvF;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,oBAAoB,EAAE,EAAE,qBAAqB,eAqB7F;AAED,wBAAgB,cAAc,CAAC,EAC7B,EAAE,EACF,iBAAiB,EACjB,QAAQ,GACT,EAAE;IACD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,eAMA;AAED,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,SAAS,EACT,OAAe,EACf,KAAK,EACL,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,SAAS,EACT,WAAW,EACX,WAAW,EACX,iBAAwB,EACxB,gBAAwB,EACxB,mBAA+B,EAC/B,GAAG,IAAI,EACR,EAAE,sBAAsB,eA0JxB"}
|
|
@@ -7,6 +7,7 @@ import { getBaseProps } from '../internal/base-component';
|
|
|
7
7
|
import { FormFieldContext, useFormFieldContext } from '../internal/context/form-field-context';
|
|
8
8
|
import { useUniqueId } from '../internal/hooks/use-unique-id';
|
|
9
9
|
import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
10
|
+
import { warnOnce } from '@cloudscape-design/component-toolkit/internal';
|
|
10
11
|
import InternalGrid from '../grid/internal';
|
|
11
12
|
import InternalIcon from '../icon/internal';
|
|
12
13
|
import { getAriaDescribedBy, getGridDefinition, getSlotIds } from './util';
|
|
@@ -26,31 +27,48 @@ export function FormFieldError({ id, children, errorIconAriaLabel }) {
|
|
|
26
27
|
React.createElement("div", { id: id, className: styles.error },
|
|
27
28
|
React.createElement("div", { className: styles['error-icon-shake-wrapper'] },
|
|
28
29
|
React.createElement("div", { role: "img", "aria-label": i18nErrorIconAriaLabel, className: styles['error-icon-scale-wrapper'] },
|
|
29
|
-
React.createElement(InternalIcon, { name: "status-
|
|
30
|
+
React.createElement(InternalIcon, { name: "status-negative", size: "small" }))),
|
|
30
31
|
React.createElement("span", { className: styles.error__message, ref: contentRef }, children)),
|
|
31
32
|
React.createElement(LiveRegion, { assertive: true, source: [i18nErrorIconAriaLabel, contentRef] })));
|
|
32
33
|
}
|
|
33
|
-
export function
|
|
34
|
-
|
|
34
|
+
export function FormFieldWarning({ id, children, warningIconAriaLabel }) {
|
|
35
|
+
const i18n = useInternalI18n('form-field');
|
|
36
|
+
const contentRef = useRef(null);
|
|
37
|
+
const i18nWarningIconAriaLabel = i18n('i18nStrings.warningIconAriaLabel', warningIconAriaLabel);
|
|
38
|
+
return (React.createElement(React.Fragment, null,
|
|
39
|
+
React.createElement("div", { id: id, className: styles.warning },
|
|
40
|
+
React.createElement("div", { className: styles['warning-icon-shake-wrapper'] },
|
|
41
|
+
React.createElement("div", { role: "img", "aria-label": i18nWarningIconAriaLabel, className: styles['warning-icon-scale-wrapper'] },
|
|
42
|
+
React.createElement(InternalIcon, { name: "status-warning", size: "small" }))),
|
|
43
|
+
React.createElement("span", { className: styles.warning__message, ref: contentRef }, children)),
|
|
44
|
+
React.createElement(LiveRegion, { assertive: true, source: [i18nWarningIconAriaLabel, contentRef] })));
|
|
45
|
+
}
|
|
46
|
+
export function ConstraintText({ id, hasValidationText, children, }) {
|
|
47
|
+
return (React.createElement("div", { id: id, className: clsx(styles.constraint, hasValidationText && styles['constraint-has-validation-text']) }, children));
|
|
35
48
|
}
|
|
36
49
|
export default function InternalFormField(_a) {
|
|
37
|
-
var { controlId, stretch = false, label, info, i18nStrings, children, secondaryControl, description, constraintText, errorText, __hideLabel, __internalRootRef = null, __disableGutters = false } = _a, rest = __rest(_a, ["controlId", "stretch", "label", "info", "i18nStrings", "children", "secondaryControl", "description", "constraintText", "errorText", "__hideLabel", "__internalRootRef", "__disableGutters"]);
|
|
50
|
+
var { controlId, stretch = false, label, info, i18nStrings, children, secondaryControl, description, constraintText, errorText, warningText, __hideLabel, __internalRootRef = null, __disableGutters = false, __analyticsMetadata = undefined } = _a, rest = __rest(_a, ["controlId", "stretch", "label", "info", "i18nStrings", "children", "secondaryControl", "description", "constraintText", "errorText", "warningText", "__hideLabel", "__internalRootRef", "__disableGutters", "__analyticsMetadata"]);
|
|
38
51
|
const baseProps = getBaseProps(rest);
|
|
39
52
|
const isRefresh = useVisualRefresh();
|
|
40
53
|
const instanceUniqueId = useUniqueId('formField');
|
|
41
54
|
const generatedControlId = controlId || instanceUniqueId;
|
|
42
55
|
const formFieldId = controlId || generatedControlId;
|
|
43
|
-
const { funnelInteractionId, submissionAttempt, funnelState, errorCount } = useFunnel();
|
|
44
|
-
const { stepNumber, stepNameSelector } = useFunnelStep();
|
|
45
|
-
const { subStepSelector, subStepNameSelector } = useFunnelSubStep();
|
|
46
|
-
const
|
|
56
|
+
const { funnelIdentifier, funnelInteractionId, submissionAttempt, funnelState, errorCount } = useFunnel();
|
|
57
|
+
const { stepIdentifier, stepNumber, stepNameSelector } = useFunnelStep();
|
|
58
|
+
const { subStepErrorContext, subStepIdentifier, subStepSelector, subStepNameSelector } = useFunnelSubStep();
|
|
59
|
+
const showWarning = warningText && !errorText;
|
|
60
|
+
if (warningText && errorText) {
|
|
61
|
+
warnOnce('FileUpload', 'Both `errorText` and `warningText` exist. `warningText` will not be shown.');
|
|
62
|
+
}
|
|
63
|
+
const slotIds = getSlotIds(formFieldId, label, description, constraintText, errorText, showWarning ? warningText : undefined);
|
|
47
64
|
const ariaDescribedBy = getAriaDescribedBy(slotIds);
|
|
48
65
|
const gridDefinition = getGridDefinition(stretch, !!secondaryControl, isRefresh);
|
|
49
|
-
const { ariaLabelledby: parentAriaLabelledby, ariaDescribedby: parentAriaDescribedby, invalid: parentInvalid, } = useFormFieldContext({});
|
|
66
|
+
const { ariaLabelledby: parentAriaLabelledby, ariaDescribedby: parentAriaDescribedby, invalid: parentInvalid, warning: parentWarning, } = useFormFieldContext({});
|
|
50
67
|
const contextValuesWithoutControlId = {
|
|
51
68
|
ariaLabelledby: joinStrings(parentAriaLabelledby, slotIds.label) || undefined,
|
|
52
69
|
ariaDescribedby: joinStrings(parentAriaDescribedby, ariaDescribedBy) || undefined,
|
|
53
70
|
invalid: !!errorText || !!parentInvalid,
|
|
71
|
+
warning: (!!warningText && !errorText) || (!!parentWarning && !parentInvalid),
|
|
54
72
|
};
|
|
55
73
|
const analyticsAttributes = {
|
|
56
74
|
[DATA_ATTR_FIELD_LABEL]: slotIds.label ? getFieldSlotSeletor(slotIds.label) : undefined,
|
|
@@ -67,15 +85,21 @@ export default function InternalFormField(_a) {
|
|
|
67
85
|
if (errorIsVisible) {
|
|
68
86
|
FunnelMetrics.funnelSubStepError({
|
|
69
87
|
funnelInteractionId,
|
|
88
|
+
funnelIdentifier,
|
|
70
89
|
subStepSelector,
|
|
71
90
|
subStepName,
|
|
72
91
|
subStepNameSelector,
|
|
92
|
+
subStepIdentifier,
|
|
73
93
|
stepNumber,
|
|
74
94
|
stepName,
|
|
75
95
|
stepNameSelector,
|
|
96
|
+
stepIdentifier,
|
|
97
|
+
subStepErrorContext,
|
|
76
98
|
fieldErrorSelector: `${getFieldSlotSeletor(slotIds.error)} .${styles.error__message}`,
|
|
77
99
|
fieldLabelSelector: getFieldSlotSeletor(slotIds.label),
|
|
78
100
|
subStepAllSelector: getSubStepAllSelector(),
|
|
101
|
+
fieldIdentifier: __analyticsMetadata === null || __analyticsMetadata === void 0 ? void 0 : __analyticsMetadata.instanceIdentifier,
|
|
102
|
+
fieldErrorContext: __analyticsMetadata === null || __analyticsMetadata === void 0 ? void 0 : __analyticsMetadata.errorContext,
|
|
79
103
|
});
|
|
80
104
|
}
|
|
81
105
|
return () => {
|
|
@@ -95,8 +119,9 @@ export default function InternalFormField(_a) {
|
|
|
95
119
|
React.createElement(FormFieldContext.Provider, { value: Object.assign({ controlId: generatedControlId }, contextValuesWithoutControlId) }, children && React.createElement("div", { className: styles.control }, children)),
|
|
96
120
|
secondaryControl && (React.createElement(FormFieldContext.Provider, { value: contextValuesWithoutControlId },
|
|
97
121
|
React.createElement("div", { className: styles['secondary-control'] }, secondaryControl))))),
|
|
98
|
-
(constraintText || errorText) && (React.createElement("div", { className: styles.hints },
|
|
122
|
+
(constraintText || errorText || warningText) && (React.createElement("div", { className: styles.hints },
|
|
99
123
|
errorText && (React.createElement(FormFieldError, { id: slotIds.error, errorIconAriaLabel: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.errorIconAriaLabel }, errorText)),
|
|
100
|
-
|
|
124
|
+
showWarning && (React.createElement(FormFieldWarning, { id: slotIds.warning, warningIconAriaLabel: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.warningIconAriaLabel }, warningText)),
|
|
125
|
+
constraintText && (React.createElement(ConstraintText, { id: slotIds.constraint, hasValidationText: !!errorText || !!warningText }, constraintText))))));
|
|
101
126
|
}
|
|
102
127
|
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,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I,CACZ,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,CAAC,KAAK,EAAE,kBAAkB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,kBAAkB,IACnF,SAAS,CACK,CAClB;YACA,cAAc,IAAI,CACjB,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,CAAC,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC,SAAS,IAC1D,cAAc,CACA,CAClB,CACG,CACP,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { FormFieldContext, useFormFieldContext } from '../internal/context/form-field-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\n\nimport InternalGrid from '../grid/internal';\nimport InternalIcon from '../icon/internal';\nimport { getAriaDescribedBy, getGridDefinition, getSlotIds } from './util';\n\nimport styles from './styles.css.js';\nimport { InternalFormFieldProps } from './interfaces';\nimport { joinStrings } from '../internal/utils/strings';\nimport { useInternalI18n } from '../i18n/context';\nimport { InfoLinkLabelContext } from '../internal/context/info-link-label-context';\n\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport {\n DATA_ATTR_FIELD_ERROR,\n DATA_ATTR_FIELD_LABEL,\n getFieldSlotSeletor,\n getNameFromSelector,\n getSubStepAllSelector,\n} from '../internal/analytics/selectors';\nimport LiveRegion from '../internal/components/live-region';\n\ninterface FormFieldErrorProps {\n id?: string;\n children?: React.ReactNode;\n errorIconAriaLabel?: string;\n}\n\nexport function FormFieldError({ id, children, errorIconAriaLabel }: FormFieldErrorProps) {\n const i18n = useInternalI18n('form-field');\n const contentRef = useRef<HTMLDivElement | null>(null);\n const i18nErrorIconAriaLabel = i18n('i18nStrings.errorIconAriaLabel', errorIconAriaLabel);\n\n return (\n <>\n <div id={id} className={styles.error}>\n <div className={styles['error-icon-shake-wrapper']}>\n <div role=\"img\" aria-label={i18nErrorIconAriaLabel} className={styles['error-icon-scale-wrapper']}>\n <InternalIcon name=\"status-warning\" size=\"small\" />\n </div>\n </div>\n <span className={styles.error__message} ref={contentRef}>\n {children}\n </span>\n </div>\n\n <LiveRegion assertive={true} source={[i18nErrorIconAriaLabel, contentRef]} />\n </>\n );\n}\n\nexport function ConstraintText({\n id,\n hasError,\n children,\n}: {\n id?: string;\n hasError: boolean;\n children: React.ReactNode;\n}) {\n return (\n <div id={id} className={clsx(styles.constraint, hasError && styles['constraint-has-error'])}>\n {children}\n </div>\n );\n}\n\nexport default function InternalFormField({\n controlId,\n stretch = false,\n label,\n info,\n i18nStrings,\n children,\n secondaryControl,\n description,\n constraintText,\n errorText,\n __hideLabel,\n __internalRootRef = null,\n __disableGutters = false,\n ...rest\n}: InternalFormFieldProps) {\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n\n const instanceUniqueId = useUniqueId('formField');\n const generatedControlId = controlId || instanceUniqueId;\n const formFieldId = controlId || generatedControlId;\n\n const { funnelInteractionId, submissionAttempt, funnelState, errorCount } = useFunnel();\n const { stepNumber, stepNameSelector } = useFunnelStep();\n const { subStepSelector, subStepNameSelector } = useFunnelSubStep();\n\n const slotIds = getSlotIds(formFieldId, label, description, constraintText, errorText);\n\n const ariaDescribedBy = getAriaDescribedBy(slotIds);\n\n const gridDefinition = getGridDefinition(stretch, !!secondaryControl, isRefresh);\n\n const {\n ariaLabelledby: parentAriaLabelledby,\n ariaDescribedby: parentAriaDescribedby,\n invalid: parentInvalid,\n } = useFormFieldContext({});\n\n const contextValuesWithoutControlId = {\n ariaLabelledby: joinStrings(parentAriaLabelledby, slotIds.label) || undefined,\n ariaDescribedby: joinStrings(parentAriaDescribedby, ariaDescribedBy) || undefined,\n invalid: !!errorText || !!parentInvalid,\n };\n\n const analyticsAttributes = {\n [DATA_ATTR_FIELD_LABEL]: slotIds.label ? getFieldSlotSeletor(slotIds.label) : undefined,\n [DATA_ATTR_FIELD_ERROR]: slotIds.error ? getFieldSlotSeletor(slotIds.error) : undefined,\n };\n\n useEffect(() => {\n if (funnelInteractionId && errorText && funnelState.current !== 'complete') {\n const stepName = getNameFromSelector(stepNameSelector);\n const subStepName = getNameFromSelector(subStepNameSelector);\n\n errorCount.current++;\n\n // We don't want to report an error if it is hidden, e.g. inside an Expandable Section.\n const errorIsVisible = (__internalRootRef?.current?.getBoundingClientRect()?.width ?? 0) > 0;\n\n if (errorIsVisible) {\n FunnelMetrics.funnelSubStepError({\n funnelInteractionId,\n subStepSelector,\n subStepName,\n subStepNameSelector,\n stepNumber,\n stepName,\n stepNameSelector,\n fieldErrorSelector: `${getFieldSlotSeletor(slotIds.error)} .${styles.error__message}`,\n fieldLabelSelector: getFieldSlotSeletor(slotIds.label),\n subStepAllSelector: getSubStepAllSelector(),\n });\n }\n\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n errorCount.current--;\n };\n }\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [funnelInteractionId, errorText, submissionAttempt, errorCount]);\n\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.root)}\n ref={__internalRootRef}\n {...analyticsAttributes}\n >\n <div className={clsx(__hideLabel && styles['visually-hidden'])}>\n {label && (\n <label className={styles.label} id={slotIds.label} htmlFor={generatedControlId}>\n {label}\n </label>\n )}\n <InfoLinkLabelContext.Provider value={slotIds.label}>\n {!__hideLabel && info && <span className={styles.info}>{info}</span>}\n </InfoLinkLabelContext.Provider>\n </div>\n\n {description && (\n <div className={styles.description} id={slotIds.description}>\n {description}\n </div>\n )}\n\n <div className={clsx(styles.controls, __hideLabel && styles['label-hidden'])}>\n <InternalGrid gridDefinition={gridDefinition} disableGutters={__disableGutters}>\n <FormFieldContext.Provider\n value={{\n controlId: generatedControlId,\n ...contextValuesWithoutControlId,\n }}\n >\n {children && <div className={styles.control}>{children}</div>}\n </FormFieldContext.Provider>\n\n {secondaryControl && (\n <FormFieldContext.Provider value={contextValuesWithoutControlId}>\n <div className={styles['secondary-control']}>{secondaryControl}</div>\n </FormFieldContext.Provider>\n )}\n </InternalGrid>\n </div>\n\n {(constraintText || errorText) && (\n <div className={styles.hints}>\n {errorText && (\n <FormFieldError id={slotIds.error} errorIconAriaLabel={i18nStrings?.errorIconAriaLabel}>\n {errorText}\n </FormFieldError>\n )}\n {constraintText && (\n <ConstraintText id={slotIds.constraint} hasError={!!errorText}>\n {constraintText}\n </ConstraintText>\n )}\n </div>\n )}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/form-field/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE3E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;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P,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { FormFieldContext, useFormFieldContext } from '../internal/context/form-field-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalGrid from '../grid/internal';\nimport InternalIcon from '../icon/internal';\nimport { getAriaDescribedBy, getGridDefinition, getSlotIds } from './util';\n\nimport styles from './styles.css.js';\nimport { InternalFormFieldProps } from './interfaces';\nimport { joinStrings } from '../internal/utils/strings';\nimport { useInternalI18n } from '../i18n/context';\nimport { InfoLinkLabelContext } from '../internal/context/info-link-label-context';\n\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport {\n DATA_ATTR_FIELD_ERROR,\n DATA_ATTR_FIELD_LABEL,\n getFieldSlotSeletor,\n getNameFromSelector,\n getSubStepAllSelector,\n} from '../internal/analytics/selectors';\nimport LiveRegion from '../internal/components/live-region';\n\ninterface FormFieldErrorProps {\n id?: string;\n children?: React.ReactNode;\n errorIconAriaLabel?: string;\n}\n\ninterface FormFieldWarningProps {\n id?: string;\n children?: React.ReactNode;\n warningIconAriaLabel?: string;\n}\n\nexport function FormFieldError({ id, children, errorIconAriaLabel }: FormFieldErrorProps) {\n const i18n = useInternalI18n('form-field');\n const contentRef = useRef<HTMLDivElement | null>(null);\n const i18nErrorIconAriaLabel = i18n('i18nStrings.errorIconAriaLabel', errorIconAriaLabel);\n\n return (\n <>\n <div id={id} className={styles.error}>\n <div className={styles['error-icon-shake-wrapper']}>\n <div role=\"img\" aria-label={i18nErrorIconAriaLabel} className={styles['error-icon-scale-wrapper']}>\n <InternalIcon name=\"status-negative\" size=\"small\" />\n </div>\n </div>\n <span className={styles.error__message} ref={contentRef}>\n {children}\n </span>\n </div>\n\n <LiveRegion assertive={true} source={[i18nErrorIconAriaLabel, contentRef]} />\n </>\n );\n}\n\nexport function FormFieldWarning({ id, children, warningIconAriaLabel }: FormFieldWarningProps) {\n const i18n = useInternalI18n('form-field');\n const contentRef = useRef<HTMLDivElement | null>(null);\n const i18nWarningIconAriaLabel = i18n('i18nStrings.warningIconAriaLabel', warningIconAriaLabel);\n\n return (\n <>\n <div id={id} className={styles.warning}>\n <div className={styles['warning-icon-shake-wrapper']}>\n <div role=\"img\" aria-label={i18nWarningIconAriaLabel} className={styles['warning-icon-scale-wrapper']}>\n <InternalIcon name=\"status-warning\" size=\"small\" />\n </div>\n </div>\n <span className={styles.warning__message} ref={contentRef}>\n {children}\n </span>\n </div>\n\n <LiveRegion assertive={true} source={[i18nWarningIconAriaLabel, contentRef]} />\n </>\n );\n}\n\nexport function ConstraintText({\n id,\n hasValidationText,\n children,\n}: {\n id?: string;\n hasValidationText: boolean;\n children: React.ReactNode;\n}) {\n return (\n <div id={id} className={clsx(styles.constraint, hasValidationText && styles['constraint-has-validation-text'])}>\n {children}\n </div>\n );\n}\n\nexport default function InternalFormField({\n controlId,\n stretch = false,\n label,\n info,\n i18nStrings,\n children,\n secondaryControl,\n description,\n constraintText,\n errorText,\n warningText,\n __hideLabel,\n __internalRootRef = null,\n __disableGutters = false,\n __analyticsMetadata = undefined,\n ...rest\n}: InternalFormFieldProps) {\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n\n const instanceUniqueId = useUniqueId('formField');\n const generatedControlId = controlId || instanceUniqueId;\n const formFieldId = controlId || generatedControlId;\n\n const { funnelIdentifier, funnelInteractionId, submissionAttempt, funnelState, errorCount } = useFunnel();\n const { stepIdentifier, stepNumber, stepNameSelector } = useFunnelStep();\n const { subStepErrorContext, subStepIdentifier, subStepSelector, subStepNameSelector } = useFunnelSubStep();\n\n const showWarning = warningText && !errorText;\n\n if (warningText && errorText) {\n warnOnce('FileUpload', 'Both `errorText` and `warningText` exist. `warningText` will not be shown.');\n }\n\n const slotIds = getSlotIds(\n formFieldId,\n label,\n description,\n constraintText,\n errorText,\n showWarning ? warningText : undefined\n );\n\n const ariaDescribedBy = getAriaDescribedBy(slotIds);\n\n const gridDefinition = getGridDefinition(stretch, !!secondaryControl, isRefresh);\n\n const {\n ariaLabelledby: parentAriaLabelledby,\n ariaDescribedby: parentAriaDescribedby,\n invalid: parentInvalid,\n warning: parentWarning,\n } = useFormFieldContext({});\n\n const contextValuesWithoutControlId = {\n ariaLabelledby: joinStrings(parentAriaLabelledby, slotIds.label) || undefined,\n ariaDescribedby: joinStrings(parentAriaDescribedby, ariaDescribedBy) || undefined,\n invalid: !!errorText || !!parentInvalid,\n warning: (!!warningText && !errorText) || (!!parentWarning && !parentInvalid),\n };\n\n const analyticsAttributes = {\n [DATA_ATTR_FIELD_LABEL]: slotIds.label ? getFieldSlotSeletor(slotIds.label) : undefined,\n [DATA_ATTR_FIELD_ERROR]: slotIds.error ? getFieldSlotSeletor(slotIds.error) : undefined,\n };\n\n useEffect(() => {\n if (funnelInteractionId && errorText && funnelState.current !== 'complete') {\n const stepName = getNameFromSelector(stepNameSelector);\n const subStepName = getNameFromSelector(subStepNameSelector);\n\n errorCount.current++;\n\n // We don't want to report an error if it is hidden, e.g. inside an Expandable Section.\n const errorIsVisible = (__internalRootRef?.current?.getBoundingClientRect()?.width ?? 0) > 0;\n\n if (errorIsVisible) {\n FunnelMetrics.funnelSubStepError({\n funnelInteractionId,\n funnelIdentifier,\n subStepSelector,\n subStepName,\n subStepNameSelector,\n subStepIdentifier,\n stepNumber,\n stepName,\n stepNameSelector,\n stepIdentifier,\n subStepErrorContext,\n fieldErrorSelector: `${getFieldSlotSeletor(slotIds.error)} .${styles.error__message}`,\n fieldLabelSelector: getFieldSlotSeletor(slotIds.label),\n subStepAllSelector: getSubStepAllSelector(),\n fieldIdentifier: __analyticsMetadata?.instanceIdentifier,\n fieldErrorContext: __analyticsMetadata?.errorContext,\n });\n }\n\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n errorCount.current--;\n };\n }\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [funnelInteractionId, errorText, submissionAttempt, errorCount]);\n\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.root)}\n ref={__internalRootRef}\n {...analyticsAttributes}\n >\n <div className={clsx(__hideLabel && styles['visually-hidden'])}>\n {label && (\n <label className={styles.label} id={slotIds.label} htmlFor={generatedControlId}>\n {label}\n </label>\n )}\n <InfoLinkLabelContext.Provider value={slotIds.label}>\n {!__hideLabel && info && <span className={styles.info}>{info}</span>}\n </InfoLinkLabelContext.Provider>\n </div>\n\n {description && (\n <div className={styles.description} id={slotIds.description}>\n {description}\n </div>\n )}\n\n <div className={clsx(styles.controls, __hideLabel && styles['label-hidden'])}>\n <InternalGrid gridDefinition={gridDefinition} disableGutters={__disableGutters}>\n <FormFieldContext.Provider\n value={{\n controlId: generatedControlId,\n ...contextValuesWithoutControlId,\n }}\n >\n {children && <div className={styles.control}>{children}</div>}\n </FormFieldContext.Provider>\n\n {secondaryControl && (\n <FormFieldContext.Provider value={contextValuesWithoutControlId}>\n <div className={styles['secondary-control']}>{secondaryControl}</div>\n </FormFieldContext.Provider>\n )}\n </InternalGrid>\n </div>\n\n {(constraintText || errorText || warningText) && (\n <div className={styles.hints}>\n {errorText && (\n <FormFieldError id={slotIds.error} errorIconAriaLabel={i18nStrings?.errorIconAriaLabel}>\n {errorText}\n </FormFieldError>\n )}\n {showWarning && (\n <FormFieldWarning id={slotIds.warning} warningIconAriaLabel={i18nStrings?.warningIconAriaLabel}>\n {warningText}\n </FormFieldWarning>\n )}\n {constraintText && (\n <ConstraintText id={slotIds.constraint} hasValidationText={!!errorText || !!warningText}>\n {constraintText}\n </ConstraintText>\n )}\n </div>\n )}\n </div>\n );\n}\n"]}
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"error-icon-shake-wrapper": "awsui_error-icon-shake-
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"awsui-motion-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"control": "
|
|
21
|
-
"
|
|
22
|
-
"
|
|
4
|
+
"error-icon-shake-wrapper": "awsui_error-icon-shake-wrapper_14mhv_3pp2p_103",
|
|
5
|
+
"warning-icon-shake-wrapper": "awsui_warning-icon-shake-wrapper_14mhv_3pp2p_104",
|
|
6
|
+
"awsui-motion-shake-horizontally": "awsui_awsui-motion-shake-horizontally_14mhv_3pp2p_1",
|
|
7
|
+
"error-icon-scale-wrapper": "awsui_error-icon-scale-wrapper_14mhv_3pp2p_134",
|
|
8
|
+
"warning-icon-scale-wrapper": "awsui_warning-icon-scale-wrapper_14mhv_3pp2p_135",
|
|
9
|
+
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-popup_14mhv_3pp2p_1",
|
|
10
|
+
"warning": "awsui_warning_14mhv_3pp2p_104",
|
|
11
|
+
"error": "awsui_error_14mhv_3pp2p_103",
|
|
12
|
+
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_14mhv_3pp2p_1",
|
|
13
|
+
"root": "awsui_root_14mhv_3pp2p_186",
|
|
14
|
+
"label": "awsui_label_14mhv_3pp2p_222",
|
|
15
|
+
"info": "awsui_info_14mhv_3pp2p_236",
|
|
16
|
+
"description": "awsui_description_14mhv_3pp2p_241",
|
|
17
|
+
"constraint": "awsui_constraint_14mhv_3pp2p_242",
|
|
18
|
+
"hints": "awsui_hints_14mhv_3pp2p_249",
|
|
19
|
+
"constraint-has-validation-text": "awsui_constraint-has-validation-text_14mhv_3pp2p_250",
|
|
20
|
+
"secondary-control": "awsui_secondary-control_14mhv_3pp2p_254",
|
|
21
|
+
"controls": "awsui_controls_14mhv_3pp2p_258",
|
|
22
|
+
"label-hidden": "awsui_label-hidden_14mhv_3pp2p_258",
|
|
23
|
+
"control": "awsui_control_14mhv_3pp2p_258",
|
|
24
|
+
"error__message": "awsui_error__message_14mhv_3pp2p_285",
|
|
25
|
+
"warning__message": "awsui_warning__message_14mhv_3pp2p_286",
|
|
26
|
+
"visually-hidden": "awsui_visually-hidden_14mhv_3pp2p_290"
|
|
23
27
|
};
|
|
24
28
|
|
|
@@ -100,10 +100,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
100
100
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
101
101
|
SPDX-License-Identifier: Apache-2.0
|
|
102
102
|
*/
|
|
103
|
-
.awsui_error-icon-shake-
|
|
104
|
-
|
|
103
|
+
.awsui_error-icon-shake-wrapper_14mhv_3pp2p_103:not(#\9),
|
|
104
|
+
.awsui_warning-icon-shake-wrapper_14mhv_3pp2p_104:not(#\9) {
|
|
105
|
+
animation: awsui_awsui-motion-shake-horizontally_14mhv_3pp2p_1 var(--motion-duration-refresh-only-medium-0rwzu1, 165ms);
|
|
105
106
|
}
|
|
106
|
-
@keyframes awsui_awsui-motion-shake-
|
|
107
|
+
@keyframes awsui_awsui-motion-shake-horizontally_14mhv_3pp2p_1 {
|
|
107
108
|
0% {
|
|
108
109
|
transform: translateX(-5px);
|
|
109
110
|
animation-timing-function: linear;
|
|
@@ -117,20 +118,22 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
120
|
@media (prefers-reduced-motion: reduce) {
|
|
120
|
-
.awsui_error-icon-shake-
|
|
121
|
+
.awsui_error-icon-shake-wrapper_14mhv_3pp2p_103:not(#\9),
|
|
122
|
+
.awsui_warning-icon-shake-wrapper_14mhv_3pp2p_104:not(#\9) {
|
|
121
123
|
animation: none;
|
|
122
124
|
transition: none;
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
|
-
.awsui-motion-disabled .awsui_error-icon-shake-
|
|
127
|
+
.awsui-motion-disabled .awsui_error-icon-shake-wrapper_14mhv_3pp2p_103:not(#\9), .awsui-mode-entering .awsui_error-icon-shake-wrapper_14mhv_3pp2p_103:not(#\9), .awsui-motion-disabled .awsui_warning-icon-shake-wrapper_14mhv_3pp2p_104:not(#\9), .awsui-mode-entering .awsui_warning-icon-shake-wrapper_14mhv_3pp2p_104:not(#\9) {
|
|
126
128
|
animation: none;
|
|
127
129
|
transition: none;
|
|
128
130
|
}
|
|
129
131
|
|
|
130
|
-
.awsui_error-icon-scale-
|
|
131
|
-
|
|
132
|
+
.awsui_error-icon-scale-wrapper_14mhv_3pp2p_134:not(#\9),
|
|
133
|
+
.awsui_warning-icon-scale-wrapper_14mhv_3pp2p_135:not(#\9) {
|
|
134
|
+
animation: awsui_awsui-motion-scale-popup_14mhv_3pp2p_1 var(--motion-duration-refresh-only-medium-0rwzu1, 165ms) var(--motion-easing-refresh-only-a-liv5su, cubic-bezier(0, 0, 0, 1));
|
|
132
135
|
}
|
|
133
|
-
@keyframes awsui_awsui-motion-scale-
|
|
136
|
+
@keyframes awsui_awsui-motion-scale-popup_14mhv_3pp2p_1 {
|
|
134
137
|
0% {
|
|
135
138
|
transform: scale(0.95);
|
|
136
139
|
}
|
|
@@ -139,20 +142,22 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
139
142
|
}
|
|
140
143
|
}
|
|
141
144
|
@media (prefers-reduced-motion: reduce) {
|
|
142
|
-
.awsui_error-icon-scale-
|
|
145
|
+
.awsui_error-icon-scale-wrapper_14mhv_3pp2p_134:not(#\9),
|
|
146
|
+
.awsui_warning-icon-scale-wrapper_14mhv_3pp2p_135:not(#\9) {
|
|
143
147
|
animation: none;
|
|
144
148
|
transition: none;
|
|
145
149
|
}
|
|
146
150
|
}
|
|
147
|
-
.awsui-motion-disabled .awsui_error-icon-scale-
|
|
151
|
+
.awsui-motion-disabled .awsui_error-icon-scale-wrapper_14mhv_3pp2p_134:not(#\9), .awsui-mode-entering .awsui_error-icon-scale-wrapper_14mhv_3pp2p_134:not(#\9), .awsui-motion-disabled .awsui_warning-icon-scale-wrapper_14mhv_3pp2p_135:not(#\9), .awsui-mode-entering .awsui_warning-icon-scale-wrapper_14mhv_3pp2p_135:not(#\9) {
|
|
148
152
|
animation: none;
|
|
149
153
|
transition: none;
|
|
150
154
|
}
|
|
151
155
|
|
|
152
|
-
.
|
|
153
|
-
|
|
156
|
+
.awsui_warning_14mhv_3pp2p_104:not(#\9),
|
|
157
|
+
.awsui_error_14mhv_3pp2p_103:not(#\9) {
|
|
158
|
+
animation: awsui_awsui-motion-fade-in-0_14mhv_3pp2p_1 var(--motion-duration-refresh-only-medium-0rwzu1, 165ms) var(--motion-easing-refresh-only-a-liv5su, cubic-bezier(0, 0, 0, 1));
|
|
154
159
|
}
|
|
155
|
-
@keyframes awsui_awsui-motion-fade-in-
|
|
160
|
+
@keyframes awsui_awsui-motion-fade-in-0_14mhv_3pp2p_1 {
|
|
156
161
|
from {
|
|
157
162
|
opacity: 0;
|
|
158
163
|
}
|
|
@@ -161,17 +166,18 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
161
166
|
}
|
|
162
167
|
}
|
|
163
168
|
@media (prefers-reduced-motion: reduce) {
|
|
164
|
-
.
|
|
169
|
+
.awsui_warning_14mhv_3pp2p_104:not(#\9),
|
|
170
|
+
.awsui_error_14mhv_3pp2p_103:not(#\9) {
|
|
165
171
|
animation: none;
|
|
166
172
|
transition: none;
|
|
167
173
|
}
|
|
168
174
|
}
|
|
169
|
-
.awsui-motion-disabled .
|
|
175
|
+
.awsui-motion-disabled .awsui_warning_14mhv_3pp2p_104:not(#\9), .awsui-mode-entering .awsui_warning_14mhv_3pp2p_104:not(#\9), .awsui-motion-disabled .awsui_error_14mhv_3pp2p_103:not(#\9), .awsui-mode-entering .awsui_error_14mhv_3pp2p_103:not(#\9) {
|
|
170
176
|
animation: none;
|
|
171
177
|
transition: none;
|
|
172
178
|
}
|
|
173
179
|
|
|
174
|
-
.
|
|
180
|
+
.awsui_root_14mhv_3pp2p_186:not(#\9) {
|
|
175
181
|
border-collapse: separate;
|
|
176
182
|
border-spacing: 0;
|
|
177
183
|
box-sizing: border-box;
|
|
@@ -208,7 +214,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
208
214
|
box-sizing: border-box;
|
|
209
215
|
}
|
|
210
216
|
|
|
211
|
-
.
|
|
217
|
+
.awsui_label_14mhv_3pp2p_222:not(#\9) {
|
|
212
218
|
box-sizing: border-box;
|
|
213
219
|
color: var(--color-text-form-label-3ubxwt, #16191f);
|
|
214
220
|
display: inline;
|
|
@@ -217,43 +223,43 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
217
223
|
font-weight: var(--font-display-label-weight-2njs7q, 400);
|
|
218
224
|
margin-inline-end: var(--space-xs-xf5ch3, 8px);
|
|
219
225
|
}
|
|
220
|
-
.
|
|
226
|
+
.awsui_label_14mhv_3pp2p_222:not(#\9):only-child {
|
|
221
227
|
margin-block: 0;
|
|
222
228
|
margin-inline: 0;
|
|
223
229
|
}
|
|
224
230
|
|
|
225
|
-
.
|
|
231
|
+
.awsui_info_14mhv_3pp2p_236:not(#\9) {
|
|
226
232
|
padding-inline-start: var(--space-xs-xf5ch3, 8px);
|
|
227
233
|
border-inline-start: var(--border-divider-section-width-wl9k66, 1px) solid var(--color-border-divider-default-in8dkg, #eaeded);
|
|
228
234
|
}
|
|
229
235
|
|
|
230
|
-
.
|
|
231
|
-
.
|
|
236
|
+
.awsui_description_14mhv_3pp2p_241:not(#\9),
|
|
237
|
+
.awsui_constraint_14mhv_3pp2p_242:not(#\9) {
|
|
232
238
|
color: var(--color-text-form-secondary-rh78tu, #687078);
|
|
233
239
|
font-size: var(--font-size-body-s-533prh, 12px);
|
|
234
240
|
line-height: var(--line-height-body-s-n0pazd, 16px);
|
|
235
241
|
letter-spacing: var(--letter-spacing-body-s-nkvets, normal);
|
|
236
242
|
}
|
|
237
243
|
|
|
238
|
-
.
|
|
239
|
-
.awsui_constraint-has-
|
|
244
|
+
.awsui_hints_14mhv_3pp2p_249:not(#\9),
|
|
245
|
+
.awsui_constraint-has-validation-text_14mhv_3pp2p_250:not(#\9) {
|
|
240
246
|
padding-block-start: var(--space-xxs-9rrxti, 4px);
|
|
241
247
|
}
|
|
242
248
|
|
|
243
|
-
.awsui_secondary-
|
|
249
|
+
.awsui_secondary-control_14mhv_3pp2p_254:not(#\9) {
|
|
244
250
|
/* used in test-utils */
|
|
245
251
|
}
|
|
246
252
|
|
|
247
|
-
.
|
|
253
|
+
.awsui_controls_14mhv_3pp2p_258:not(#\9):not(.awsui_label-hidden_14mhv_3pp2p_258) {
|
|
248
254
|
padding-block-start: var(--space-xxs-9rrxti, 4px);
|
|
249
255
|
}
|
|
250
256
|
|
|
251
|
-
.
|
|
257
|
+
.awsui_control_14mhv_3pp2p_258:not(#\9) {
|
|
252
258
|
min-inline-size: 0;
|
|
253
259
|
word-break: break-word;
|
|
254
260
|
}
|
|
255
261
|
|
|
256
|
-
.
|
|
262
|
+
.awsui_error_14mhv_3pp2p_103:not(#\9) {
|
|
257
263
|
color: var(--color-text-status-error-ofc4yr, #d13212);
|
|
258
264
|
font-size: var(--font-size-body-s-533prh, 12px);
|
|
259
265
|
line-height: var(--line-height-body-s-n0pazd, 16px);
|
|
@@ -262,11 +268,21 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
262
268
|
align-items: flex-start;
|
|
263
269
|
}
|
|
264
270
|
|
|
265
|
-
.
|
|
271
|
+
.awsui_warning_14mhv_3pp2p_104:not(#\9) {
|
|
272
|
+
color: var(--color-text-status-warning-azn00c, #906806);
|
|
273
|
+
font-size: var(--font-size-body-s-533prh, 12px);
|
|
274
|
+
line-height: var(--line-height-body-s-n0pazd, 16px);
|
|
275
|
+
letter-spacing: var(--letter-spacing-body-s-nkvets, normal);
|
|
276
|
+
display: flex;
|
|
277
|
+
align-items: flex-start;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.awsui_error__message_14mhv_3pp2p_285:not(#\9),
|
|
281
|
+
.awsui_warning__message_14mhv_3pp2p_286:not(#\9) {
|
|
266
282
|
margin-inline-start: var(--space-xxs-9rrxti, 4px);
|
|
267
283
|
}
|
|
268
284
|
|
|
269
|
-
.awsui_visually-
|
|
285
|
+
.awsui_visually-hidden_14mhv_3pp2p_290:not(#\9) {
|
|
270
286
|
position: absolute !important;
|
|
271
287
|
inset-block-start: -9999px !important;
|
|
272
288
|
inset-inline-start: -9999px !important;
|
|
@@ -2,24 +2,28 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"error-icon-shake-wrapper": "awsui_error-icon-shake-
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"awsui-motion-
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"control": "
|
|
22
|
-
"
|
|
23
|
-
"
|
|
5
|
+
"error-icon-shake-wrapper": "awsui_error-icon-shake-wrapper_14mhv_3pp2p_103",
|
|
6
|
+
"warning-icon-shake-wrapper": "awsui_warning-icon-shake-wrapper_14mhv_3pp2p_104",
|
|
7
|
+
"awsui-motion-shake-horizontally": "awsui_awsui-motion-shake-horizontally_14mhv_3pp2p_1",
|
|
8
|
+
"error-icon-scale-wrapper": "awsui_error-icon-scale-wrapper_14mhv_3pp2p_134",
|
|
9
|
+
"warning-icon-scale-wrapper": "awsui_warning-icon-scale-wrapper_14mhv_3pp2p_135",
|
|
10
|
+
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-popup_14mhv_3pp2p_1",
|
|
11
|
+
"warning": "awsui_warning_14mhv_3pp2p_104",
|
|
12
|
+
"error": "awsui_error_14mhv_3pp2p_103",
|
|
13
|
+
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_14mhv_3pp2p_1",
|
|
14
|
+
"root": "awsui_root_14mhv_3pp2p_186",
|
|
15
|
+
"label": "awsui_label_14mhv_3pp2p_222",
|
|
16
|
+
"info": "awsui_info_14mhv_3pp2p_236",
|
|
17
|
+
"description": "awsui_description_14mhv_3pp2p_241",
|
|
18
|
+
"constraint": "awsui_constraint_14mhv_3pp2p_242",
|
|
19
|
+
"hints": "awsui_hints_14mhv_3pp2p_249",
|
|
20
|
+
"constraint-has-validation-text": "awsui_constraint-has-validation-text_14mhv_3pp2p_250",
|
|
21
|
+
"secondary-control": "awsui_secondary-control_14mhv_3pp2p_254",
|
|
22
|
+
"controls": "awsui_controls_14mhv_3pp2p_258",
|
|
23
|
+
"label-hidden": "awsui_label-hidden_14mhv_3pp2p_258",
|
|
24
|
+
"control": "awsui_control_14mhv_3pp2p_258",
|
|
25
|
+
"error__message": "awsui_error__message_14mhv_3pp2p_285",
|
|
26
|
+
"warning__message": "awsui_warning__message_14mhv_3pp2p_286",
|
|
27
|
+
"visually-hidden": "awsui_visually-hidden_14mhv_3pp2p_290"
|
|
24
28
|
};
|
|
25
29
|
|
|
@@ -5,9 +5,10 @@ interface FormFieldIds {
|
|
|
5
5
|
description?: string;
|
|
6
6
|
constraint?: string;
|
|
7
7
|
error?: string;
|
|
8
|
+
warning?: string;
|
|
8
9
|
}
|
|
9
|
-
export declare function getSlotIds(formFieldId: string, label?: React.ReactNode, description?: React.ReactNode, constraintText?: React.ReactNode, errorText?: React.ReactNode): FormFieldIds;
|
|
10
|
-
export declare function getAriaDescribedBy({ error, description, constraint }: FormFieldIds): string | undefined;
|
|
10
|
+
export declare function getSlotIds(formFieldId: string, label?: React.ReactNode, description?: React.ReactNode, constraintText?: React.ReactNode, errorText?: React.ReactNode, warningText?: React.ReactNode): FormFieldIds;
|
|
11
|
+
export declare function getAriaDescribedBy({ error, warning, description, constraint }: FormFieldIds): string | undefined;
|
|
11
12
|
export declare function getGridDefinition(stretch: boolean, secondaryControlPresent: boolean, isRefresh: boolean): {
|
|
12
13
|
colspan: GridProps.BreakpointMapping | number;
|
|
13
14
|
}[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/form-field/util.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,UAAU,YAAY;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/form-field/util.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,UAAU,YAAY;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAUD,wBAAgB,UAAU,CACxB,WAAW,EAAE,MAAM,EACnB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,EACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,EAC7B,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,EAChC,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,EAC3B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,gBAW9B;AAED,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,YAAY,sBAI3F;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,uBAAuB,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO;aACxE,UAAU,iBAAiB,GAAG,MAAM;IAenE"}
|
|
@@ -4,17 +4,18 @@ function makeSlotId(prop, formFieldId, propName) {
|
|
|
4
4
|
}
|
|
5
5
|
return `${formFieldId}-${propName}`;
|
|
6
6
|
}
|
|
7
|
-
export function getSlotIds(formFieldId, label, description, constraintText, errorText) {
|
|
7
|
+
export function getSlotIds(formFieldId, label, description, constraintText, errorText, warningText) {
|
|
8
8
|
const ids = {
|
|
9
9
|
label: makeSlotId(label, formFieldId, 'label'),
|
|
10
10
|
description: makeSlotId(description, formFieldId, 'description'),
|
|
11
11
|
constraint: makeSlotId(constraintText, formFieldId, 'constraint'),
|
|
12
12
|
error: makeSlotId(errorText, formFieldId, 'error'),
|
|
13
|
+
warning: makeSlotId(warningText, formFieldId, 'warning'),
|
|
13
14
|
};
|
|
14
15
|
return ids;
|
|
15
16
|
}
|
|
16
|
-
export function getAriaDescribedBy({ error, description, constraint }) {
|
|
17
|
-
const describedByAttributes = [error, description, constraint].filter(e => !!e);
|
|
17
|
+
export function getAriaDescribedBy({ error, warning, description, constraint }) {
|
|
18
|
+
const describedByAttributes = [error, warning, description, constraint].filter(e => !!e);
|
|
18
19
|
const describedBy = describedByAttributes.length ? describedByAttributes.join(' ') : undefined;
|
|
19
20
|
return describedBy;
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/form-field/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util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,CAAC;IAEtE,IAAI,OAAO,EAAE;QACX,OAAO,GAAG,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;KAC9C;SAAM,IAAI,SAAS,EAAE;QACpB,OAAO,GAAG,CAAC,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;KACtF;SAAM;QACL,OAAO,GAAG,CAAC,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;KACtF;IAED,IAAI,CAAC,uBAAuB,EAAE;QAC5B,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;KACrB;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { GridProps } from '../grid/interfaces';\n\ninterface FormFieldIds {\n label?: string;\n description?: string;\n constraint?: string;\n error?: string;\n warning?: string;\n}\n\nfunction makeSlotId(prop: React.ReactNode, formFieldId: string, propName: string): string | undefined {\n if (!prop) {\n return undefined;\n }\n\n return `${formFieldId}-${propName}`;\n}\n\nexport function getSlotIds(\n formFieldId: string,\n label?: React.ReactNode,\n description?: React.ReactNode,\n constraintText?: React.ReactNode,\n errorText?: React.ReactNode,\n warningText?: React.ReactNode\n) {\n const ids: FormFieldIds = {\n label: makeSlotId(label, formFieldId, 'label'),\n description: makeSlotId(description, formFieldId, 'description'),\n constraint: makeSlotId(constraintText, formFieldId, 'constraint'),\n error: makeSlotId(errorText, formFieldId, 'error'),\n warning: makeSlotId(warningText, formFieldId, 'warning'),\n };\n\n return ids;\n}\n\nexport function getAriaDescribedBy({ error, warning, description, constraint }: FormFieldIds) {\n const describedByAttributes = [error, warning, description, constraint].filter(e => !!e);\n const describedBy = describedByAttributes.length ? describedByAttributes.join(' ') : undefined;\n return describedBy;\n}\n\nexport function getGridDefinition(stretch: boolean, secondaryControlPresent: boolean, isRefresh: boolean) {\n let columns: Array<{ colspan: GridProps.BreakpointMapping | number }>;\n\n if (stretch) {\n columns = [{ colspan: 12 }, { colspan: 12 }];\n } else if (isRefresh) {\n columns = [{ colspan: { default: 12, xs: 8 } }, { colspan: { default: 12, xs: 4 } }];\n } else {\n columns = [{ colspan: { default: 12, xs: 9 } }, { colspan: { default: 12, xs: 3 } }];\n }\n\n if (!secondaryControlPresent) {\n return [columns[0]];\n }\n\n return columns;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/input/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAGhE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/input/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAGhE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,mFAyFV,CAAC;AAGF,eAAe,KAAK,CAAC"}
|
|
@@ -9,7 +9,7 @@ import styles from './styles.css.js';
|
|
|
9
9
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
10
10
|
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
11
11
|
const Input = React.forwardRef((_a, ref) => {
|
|
12
|
-
var { value, type = 'text', step, inputMode, autoComplete = true, spellcheck, disabled, readOnly, disableBrowserAutocorrect, onKeyDown, onKeyUp, onChange, onBlur, onFocus, ariaRequired, name, placeholder, autoFocus, ariaLabel, ariaLabelledby, ariaDescribedby, invalid, controlId, clearAriaLabel } = _a, rest = __rest(_a, ["value", "type", "step", "inputMode", "autoComplete", "spellcheck", "disabled", "readOnly", "disableBrowserAutocorrect", "onKeyDown", "onKeyUp", "onChange", "onBlur", "onFocus", "ariaRequired", "name", "placeholder", "autoFocus", "ariaLabel", "ariaLabelledby", "ariaDescribedby", "invalid", "controlId", "clearAriaLabel"]);
|
|
12
|
+
var { value, type = 'text', step, inputMode, autoComplete = true, spellcheck, disabled, readOnly, disableBrowserAutocorrect, onKeyDown, onKeyUp, onChange, onBlur, onFocus, ariaRequired, name, placeholder, autoFocus, ariaLabel, ariaLabelledby, ariaDescribedby, invalid, warning, controlId, clearAriaLabel } = _a, rest = __rest(_a, ["value", "type", "step", "inputMode", "autoComplete", "spellcheck", "disabled", "readOnly", "disableBrowserAutocorrect", "onKeyDown", "onKeyUp", "onChange", "onBlur", "onFocus", "ariaRequired", "name", "placeholder", "autoFocus", "ariaLabel", "ariaLabelledby", "ariaDescribedby", "invalid", "warning", "controlId", "clearAriaLabel"]);
|
|
13
13
|
const baseComponentProps = useBaseComponent('Input', {
|
|
14
14
|
props: { autoComplete, autoFocus, disableBrowserAutocorrect, inputMode, readOnly, spellcheck, type },
|
|
15
15
|
});
|
|
@@ -47,6 +47,7 @@ const Input = React.forwardRef((_a, ref) => {
|
|
|
47
47
|
ariaDescribedby,
|
|
48
48
|
ariaLabelledby,
|
|
49
49
|
invalid,
|
|
50
|
+
warning,
|
|
50
51
|
controlId,
|
|
51
52
|
clearAriaLabel }), { className: clsx(styles.root, baseProps.className), __inheritFormFieldProps: true })));
|
|
52
53
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/input/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAO,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,aAAa,MAAM,YAAY,CAAC;AAEvC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AAIpE,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAC5B,CACE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/input/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAO,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,aAAa,MAAM,YAAY,CAAC;AAEvC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AAIpE,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAC5B,CACE,EA2Ba,EACb,GAAwB,EACxB,EAAE;QA7BF,EACE,KAAK,EACL,IAAI,GAAG,MAAM,EACb,IAAI,EACJ,SAAS,EACT,YAAY,GAAG,IAAI,EACnB,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,yBAAyB,EACzB,SAAS,EACT,OAAO,EACP,QAAQ,EACR,MAAM,EACN,OAAO,EACP,YAAY,EACZ,IAAI,EACJ,WAAW,EACX,SAAS,EACT,SAAS,EACT,cAAc,EACd,eAAe,EACf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CAAC;AACjC,eAAe,KAAK,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { Ref, useImperativeHandle, useRef } from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport InternalInput from './internal';\nimport { InputProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\n\nexport { InputProps };\n\nconst Input = React.forwardRef(\n (\n {\n value,\n type = 'text',\n step,\n inputMode,\n autoComplete = true,\n spellcheck,\n disabled,\n readOnly,\n disableBrowserAutocorrect,\n onKeyDown,\n onKeyUp,\n onChange,\n onBlur,\n onFocus,\n ariaRequired,\n name,\n placeholder,\n autoFocus,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n invalid,\n warning,\n controlId,\n clearAriaLabel,\n ...rest\n }: InputProps,\n ref: Ref<InputProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('Input', {\n props: { autoComplete, autoFocus, disableBrowserAutocorrect, inputMode, readOnly, spellcheck, type },\n });\n const baseProps = getBaseProps(rest);\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n useImperativeHandle(\n ref,\n () => ({\n focus(...args: Parameters<HTMLElement['focus']>) {\n inputRef.current?.focus(...args);\n },\n select() {\n inputRef.current?.select();\n },\n }),\n [inputRef]\n );\n\n return (\n <InternalInput\n ref={inputRef}\n {...{\n ...baseProps,\n ...baseComponentProps,\n autoComplete,\n ariaLabel,\n ariaRequired,\n autoFocus,\n disabled,\n disableBrowserAutocorrect,\n name,\n onKeyDown,\n onKeyUp,\n onChange,\n onBlur,\n onFocus,\n placeholder,\n readOnly,\n type,\n step,\n inputMode,\n spellcheck,\n value,\n ariaDescribedby,\n ariaLabelledby,\n invalid,\n warning,\n controlId,\n clearAriaLabel,\n }}\n className={clsx(styles.root, baseProps.className)}\n __inheritFormFieldProps={true}\n />\n );\n }\n);\n\napplyDisplayName(Input, 'Input');\nexport default Input;\n"]}
|