@cloudscape-design/components 3.0.634 → 3.0.636
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/form-field/internal.js +1 -1
- package/form-field/internal.js.map +1 -1
- package/form-field/styles.css.js +24 -23
- package/form-field/styles.scoped.css +40 -37
- package/form-field/styles.selectors.js +24 -23
- package/internal/components/live-region/index.js +2 -2
- package/internal/components/live-region/index.js.map +1 -1
- package/internal/components/live-region/styles.css.js +2 -1
- package/internal/components/live-region/styles.scoped.css +5 -1
- package/internal/components/live-region/styles.selectors.js +2 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/progress-bar/index.js +1 -1
- package/progress-bar/index.js.map +1 -1
- package/progress-bar/internal.d.ts +2 -2
- package/progress-bar/internal.d.ts.map +1 -1
- package/progress-bar/internal.js +2 -2
- package/progress-bar/internal.js.map +1 -1
- package/progress-bar/styles.css.js +19 -18
- package/progress-bar/styles.scoped.css +36 -32
- package/progress-bar/styles.selectors.js +19 -18
- package/table/body-cell/styles.css.js +45 -44
- package/table/body-cell/styles.scoped.css +186 -165
- package/table/body-cell/styles.selectors.js +45 -44
- package/table/body-cell/td-element.js +2 -2
- package/table/body-cell/td-element.js.map +1 -1
- package/table/expandable-rows/expandable-rows-utils.d.ts +5 -3
- package/table/expandable-rows/expandable-rows-utils.d.ts.map +1 -1
- package/table/expandable-rows/expandable-rows-utils.js +10 -10
- package/table/expandable-rows/expandable-rows-utils.js.map +1 -1
- package/table/interfaces.d.ts +40 -1
- package/table/interfaces.d.ts.map +1 -1
- package/table/interfaces.js.map +1 -1
- package/table/internal.d.ts.map +1 -1
- package/table/internal.js +56 -32
- package/table/internal.js.map +1 -1
- package/table/progressive-loading/items-loader.d.ts +13 -0
- package/table/progressive-loading/items-loader.d.ts.map +1 -0
- package/table/progressive-loading/items-loader.js +26 -0
- package/table/progressive-loading/items-loader.js.map +1 -0
- package/table/progressive-loading/progressive-loading-utils.d.ts +14 -0
- package/table/progressive-loading/progressive-loading-utils.d.ts.map +1 -0
- package/table/progressive-loading/progressive-loading-utils.js +42 -0
- package/table/progressive-loading/progressive-loading-utils.js.map +1 -0
- package/table/progressive-loading/styles.css.js +6 -0
- package/table/progressive-loading/styles.scoped.css +7 -0
- package/table/progressive-loading/styles.selectors.js +7 -0
- package/test-utils/dom/progress-bar/index.js +1 -1
- package/test-utils/dom/progress-bar/index.js.map +1 -1
- package/test-utils/selectors/progress-bar/index.js +1 -1
- package/test-utils/selectors/progress-bar/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
package/form-field/internal.js
CHANGED
|
@@ -110,7 +110,7 @@ export default function InternalFormField(_a) {
|
|
|
110
110
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
111
111
|
}, [funnelInteractionId, errorText, submissionAttempt, errorCount]);
|
|
112
112
|
return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(baseProps.className, styles.root), ref: __internalRootRef }, analyticsAttributes),
|
|
113
|
-
React.createElement("div", { className: clsx(__hideLabel && styles['visually-hidden']) },
|
|
113
|
+
React.createElement("div", { className: clsx(styles['label-wrapper'], __hideLabel && styles['visually-hidden']) },
|
|
114
114
|
label && (React.createElement("label", { className: styles.label, id: slotIds.label, htmlFor: generatedControlId }, label)),
|
|
115
115
|
React.createElement(InfoLinkLabelContext.Provider, { value: slotIds.label }, !__hideLabel && info && React.createElement("span", { className: styles.info }, info))),
|
|
116
116
|
description && (React.createElement("div", { className: styles.description, id: slotIds.description }, description)),
|
|
@@ -1 +1 @@
|
|
|
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,E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AS,IAAI,WAAW,CAAC,IAAI,CAC/C,6BAAK,SAAS,EAAE,MAAM,CAAC,KAAK;YACzB,SAAS,IAAI,CACZ,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,CAAC,KAAK,EAAE,kBAAkB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,kBAAkB,IACnF,SAAS,CACK,CAClB;YACA,WAAW,IAAI,CACd,oBAAC,gBAAgB,IAAC,EAAE,EAAE,OAAO,CAAC,OAAO,EAAE,oBAAoB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,oBAAoB,IAC3F,WAAW,CACK,CACpB;YACA,cAAc,IAAI,CACjB,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,CAAC,UAAU,EAAE,iBAAiB,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,WAAW,IACpF,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';\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
|
+
{"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,C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cAAc,IAAC,EAAE,EAAE,OAAO,CAAC,UAAU,EAAE,iBAAiB,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,WAAW,IACpF,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';\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(styles['label-wrapper'], __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"]}
|
package/form-field/styles.css.js
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"error-icon-shake-wrapper": "awsui_error-icon-shake-
|
|
5
|
-
"warning-icon-shake-wrapper": "awsui_warning-icon-shake-
|
|
6
|
-
"awsui-motion-shake-horizontally": "awsui_awsui-motion-shake-
|
|
7
|
-
"error-icon-scale-wrapper": "awsui_error-icon-scale-
|
|
8
|
-
"warning-icon-scale-wrapper": "awsui_warning-icon-scale-
|
|
9
|
-
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-
|
|
10
|
-
"warning": "
|
|
11
|
-
"error": "
|
|
12
|
-
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-
|
|
13
|
-
"root": "
|
|
14
|
-
"label": "
|
|
15
|
-
"info": "
|
|
16
|
-
"description": "
|
|
17
|
-
"constraint": "
|
|
18
|
-
"hints": "
|
|
19
|
-
"constraint-has-validation-text": "awsui_constraint-has-validation-
|
|
20
|
-
"secondary-control": "awsui_secondary-
|
|
21
|
-
"controls": "
|
|
22
|
-
"label-hidden": "awsui_label-
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
4
|
+
"error-icon-shake-wrapper": "awsui_error-icon-shake-wrapper_14mhv_3lyk6_103",
|
|
5
|
+
"warning-icon-shake-wrapper": "awsui_warning-icon-shake-wrapper_14mhv_3lyk6_104",
|
|
6
|
+
"awsui-motion-shake-horizontally": "awsui_awsui-motion-shake-horizontally_14mhv_3lyk6_1",
|
|
7
|
+
"error-icon-scale-wrapper": "awsui_error-icon-scale-wrapper_14mhv_3lyk6_134",
|
|
8
|
+
"warning-icon-scale-wrapper": "awsui_warning-icon-scale-wrapper_14mhv_3lyk6_135",
|
|
9
|
+
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-popup_14mhv_3lyk6_1",
|
|
10
|
+
"warning": "awsui_warning_14mhv_3lyk6_104",
|
|
11
|
+
"error": "awsui_error_14mhv_3lyk6_103",
|
|
12
|
+
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_14mhv_3lyk6_1",
|
|
13
|
+
"root": "awsui_root_14mhv_3lyk6_186",
|
|
14
|
+
"label": "awsui_label_14mhv_3lyk6_222",
|
|
15
|
+
"info": "awsui_info_14mhv_3lyk6_236",
|
|
16
|
+
"description": "awsui_description_14mhv_3lyk6_242",
|
|
17
|
+
"constraint": "awsui_constraint_14mhv_3lyk6_243",
|
|
18
|
+
"hints": "awsui_hints_14mhv_3lyk6_250",
|
|
19
|
+
"constraint-has-validation-text": "awsui_constraint-has-validation-text_14mhv_3lyk6_251",
|
|
20
|
+
"secondary-control": "awsui_secondary-control_14mhv_3lyk6_255",
|
|
21
|
+
"controls": "awsui_controls_14mhv_3lyk6_259",
|
|
22
|
+
"label-hidden": "awsui_label-hidden_14mhv_3lyk6_259",
|
|
23
|
+
"label-wrapper": "awsui_label-wrapper_14mhv_3lyk6_262",
|
|
24
|
+
"control": "awsui_control_14mhv_3lyk6_259",
|
|
25
|
+
"error__message": "awsui_error__message_14mhv_3lyk6_289",
|
|
26
|
+
"warning__message": "awsui_warning__message_14mhv_3lyk6_290",
|
|
27
|
+
"visually-hidden": "awsui_visually-hidden_14mhv_3lyk6_294"
|
|
27
28
|
};
|
|
28
29
|
|
|
@@ -100,11 +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
|
-
.awsui_warning-icon-shake-
|
|
105
|
-
animation: awsui_awsui-motion-shake-
|
|
103
|
+
.awsui_error-icon-shake-wrapper_14mhv_3lyk6_103:not(#\9),
|
|
104
|
+
.awsui_warning-icon-shake-wrapper_14mhv_3lyk6_104:not(#\9) {
|
|
105
|
+
animation: awsui_awsui-motion-shake-horizontally_14mhv_3lyk6_1 var(--motion-duration-refresh-only-medium-nf6485, 165ms);
|
|
106
106
|
}
|
|
107
|
-
@keyframes awsui_awsui-motion-shake-
|
|
107
|
+
@keyframes awsui_awsui-motion-shake-horizontally_14mhv_3lyk6_1 {
|
|
108
108
|
0% {
|
|
109
109
|
transform: translateX(-5px);
|
|
110
110
|
animation-timing-function: linear;
|
|
@@ -118,22 +118,22 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
@media (prefers-reduced-motion: reduce) {
|
|
121
|
-
.awsui_error-icon-shake-
|
|
122
|
-
.awsui_warning-icon-shake-
|
|
121
|
+
.awsui_error-icon-shake-wrapper_14mhv_3lyk6_103:not(#\9),
|
|
122
|
+
.awsui_warning-icon-shake-wrapper_14mhv_3lyk6_104:not(#\9) {
|
|
123
123
|
animation: none;
|
|
124
124
|
transition: none;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
.awsui-motion-disabled .awsui_error-icon-shake-
|
|
127
|
+
.awsui-motion-disabled .awsui_error-icon-shake-wrapper_14mhv_3lyk6_103:not(#\9), .awsui-mode-entering .awsui_error-icon-shake-wrapper_14mhv_3lyk6_103:not(#\9), .awsui-motion-disabled .awsui_warning-icon-shake-wrapper_14mhv_3lyk6_104:not(#\9), .awsui-mode-entering .awsui_warning-icon-shake-wrapper_14mhv_3lyk6_104:not(#\9) {
|
|
128
128
|
animation: none;
|
|
129
129
|
transition: none;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
.awsui_error-icon-scale-
|
|
133
|
-
.awsui_warning-icon-scale-
|
|
134
|
-
animation: awsui_awsui-motion-scale-
|
|
132
|
+
.awsui_error-icon-scale-wrapper_14mhv_3lyk6_134:not(#\9),
|
|
133
|
+
.awsui_warning-icon-scale-wrapper_14mhv_3lyk6_135:not(#\9) {
|
|
134
|
+
animation: awsui_awsui-motion-scale-popup_14mhv_3lyk6_1 var(--motion-duration-refresh-only-medium-nf6485, 165ms) var(--motion-easing-refresh-only-a-8flf9q, cubic-bezier(0, 0, 0, 1));
|
|
135
135
|
}
|
|
136
|
-
@keyframes awsui_awsui-motion-scale-
|
|
136
|
+
@keyframes awsui_awsui-motion-scale-popup_14mhv_3lyk6_1 {
|
|
137
137
|
0% {
|
|
138
138
|
transform: scale(0.95);
|
|
139
139
|
}
|
|
@@ -142,22 +142,22 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
@media (prefers-reduced-motion: reduce) {
|
|
145
|
-
.awsui_error-icon-scale-
|
|
146
|
-
.awsui_warning-icon-scale-
|
|
145
|
+
.awsui_error-icon-scale-wrapper_14mhv_3lyk6_134:not(#\9),
|
|
146
|
+
.awsui_warning-icon-scale-wrapper_14mhv_3lyk6_135:not(#\9) {
|
|
147
147
|
animation: none;
|
|
148
148
|
transition: none;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
.awsui-motion-disabled .awsui_error-icon-scale-
|
|
151
|
+
.awsui-motion-disabled .awsui_error-icon-scale-wrapper_14mhv_3lyk6_134:not(#\9), .awsui-mode-entering .awsui_error-icon-scale-wrapper_14mhv_3lyk6_134:not(#\9), .awsui-motion-disabled .awsui_warning-icon-scale-wrapper_14mhv_3lyk6_135:not(#\9), .awsui-mode-entering .awsui_warning-icon-scale-wrapper_14mhv_3lyk6_135:not(#\9) {
|
|
152
152
|
animation: none;
|
|
153
153
|
transition: none;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
.
|
|
157
|
-
.
|
|
158
|
-
animation: awsui_awsui-motion-fade-in-
|
|
156
|
+
.awsui_warning_14mhv_3lyk6_104:not(#\9),
|
|
157
|
+
.awsui_error_14mhv_3lyk6_103:not(#\9) {
|
|
158
|
+
animation: awsui_awsui-motion-fade-in-0_14mhv_3lyk6_1 var(--motion-duration-refresh-only-medium-nf6485, 165ms) var(--motion-easing-refresh-only-a-8flf9q, cubic-bezier(0, 0, 0, 1));
|
|
159
159
|
}
|
|
160
|
-
@keyframes awsui_awsui-motion-fade-in-
|
|
160
|
+
@keyframes awsui_awsui-motion-fade-in-0_14mhv_3lyk6_1 {
|
|
161
161
|
from {
|
|
162
162
|
opacity: 0;
|
|
163
163
|
}
|
|
@@ -166,18 +166,18 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
@media (prefers-reduced-motion: reduce) {
|
|
169
|
-
.
|
|
170
|
-
.
|
|
169
|
+
.awsui_warning_14mhv_3lyk6_104:not(#\9),
|
|
170
|
+
.awsui_error_14mhv_3lyk6_103:not(#\9) {
|
|
171
171
|
animation: none;
|
|
172
172
|
transition: none;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
.awsui-motion-disabled .
|
|
175
|
+
.awsui-motion-disabled .awsui_warning_14mhv_3lyk6_104:not(#\9), .awsui-mode-entering .awsui_warning_14mhv_3lyk6_104:not(#\9), .awsui-motion-disabled .awsui_error_14mhv_3lyk6_103:not(#\9), .awsui-mode-entering .awsui_error_14mhv_3lyk6_103:not(#\9) {
|
|
176
176
|
animation: none;
|
|
177
177
|
transition: none;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
.
|
|
180
|
+
.awsui_root_14mhv_3lyk6_186:not(#\9) {
|
|
181
181
|
border-collapse: separate;
|
|
182
182
|
border-spacing: 0;
|
|
183
183
|
box-sizing: border-box;
|
|
@@ -214,7 +214,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
214
214
|
box-sizing: border-box;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
.
|
|
217
|
+
.awsui_label_14mhv_3lyk6_222:not(#\9) {
|
|
218
218
|
box-sizing: border-box;
|
|
219
219
|
color: var(--color-text-form-label-ktbzsd, #000716);
|
|
220
220
|
display: inline;
|
|
@@ -223,44 +223,47 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
223
223
|
font-weight: var(--font-display-label-weight-815ja9, 700);
|
|
224
224
|
margin-inline-end: var(--space-xs-zb16t3, 8px);
|
|
225
225
|
}
|
|
226
|
-
.
|
|
226
|
+
.awsui_label_14mhv_3lyk6_222:not(#\9):only-child {
|
|
227
227
|
margin-block: 0;
|
|
228
228
|
margin-inline: 0;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
.
|
|
231
|
+
.awsui_info_14mhv_3lyk6_236:not(#\9) {
|
|
232
232
|
display: inline-flex;
|
|
233
233
|
padding-inline-start: var(--space-xs-zb16t3, 8px);
|
|
234
234
|
border-inline-start: var(--border-divider-section-width-1061zr, 1px) solid var(--color-border-divider-default-j74lyz, #b6bec9);
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
.
|
|
238
|
-
.
|
|
237
|
+
.awsui_description_14mhv_3lyk6_242:not(#\9),
|
|
238
|
+
.awsui_constraint_14mhv_3lyk6_243:not(#\9) {
|
|
239
239
|
color: var(--color-text-form-secondary-dxc248, #5f6b7a);
|
|
240
240
|
font-size: var(--font-size-body-s-asqx2i, 12px);
|
|
241
241
|
line-height: var(--line-height-body-s-7zv1j5, 16px);
|
|
242
242
|
letter-spacing: var(--letter-spacing-body-s-z9jkwp, 0.005em);
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
.
|
|
246
|
-
.awsui_constraint-has-validation-
|
|
245
|
+
.awsui_hints_14mhv_3lyk6_250:not(#\9),
|
|
246
|
+
.awsui_constraint-has-validation-text_14mhv_3lyk6_251:not(#\9) {
|
|
247
247
|
padding-block-start: var(--space-xxs-p8yyaw, 4px);
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
.awsui_secondary-
|
|
250
|
+
.awsui_secondary-control_14mhv_3lyk6_255:not(#\9) {
|
|
251
251
|
/* used in test-utils */
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
.
|
|
254
|
+
.awsui_controls_14mhv_3lyk6_259:not(#\9):not(.awsui_label-hidden_14mhv_3lyk6_259) {
|
|
255
255
|
padding-block-start: var(--space-xxs-p8yyaw, 4px);
|
|
256
256
|
}
|
|
257
|
+
.awsui_label-wrapper_14mhv_3lyk6_262:not(#\9):empty + .awsui_controls_14mhv_3lyk6_259 {
|
|
258
|
+
padding-block-start: 0;
|
|
259
|
+
}
|
|
257
260
|
|
|
258
|
-
.
|
|
261
|
+
.awsui_control_14mhv_3lyk6_259:not(#\9) {
|
|
259
262
|
min-inline-size: 0;
|
|
260
263
|
word-break: break-word;
|
|
261
264
|
}
|
|
262
265
|
|
|
263
|
-
.
|
|
266
|
+
.awsui_error_14mhv_3lyk6_103:not(#\9) {
|
|
264
267
|
color: var(--color-text-status-error-wdvepn, #d91515);
|
|
265
268
|
font-size: var(--font-size-body-s-asqx2i, 12px);
|
|
266
269
|
line-height: var(--line-height-body-s-7zv1j5, 16px);
|
|
@@ -269,7 +272,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
269
272
|
align-items: flex-start;
|
|
270
273
|
}
|
|
271
274
|
|
|
272
|
-
.
|
|
275
|
+
.awsui_warning_14mhv_3lyk6_104:not(#\9) {
|
|
273
276
|
color: var(--color-text-status-warning-yik8vi, #8d6605);
|
|
274
277
|
font-size: var(--font-size-body-s-asqx2i, 12px);
|
|
275
278
|
line-height: var(--line-height-body-s-7zv1j5, 16px);
|
|
@@ -278,12 +281,12 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
278
281
|
align-items: flex-start;
|
|
279
282
|
}
|
|
280
283
|
|
|
281
|
-
.
|
|
282
|
-
.
|
|
284
|
+
.awsui_error__message_14mhv_3lyk6_289:not(#\9),
|
|
285
|
+
.awsui_warning__message_14mhv_3lyk6_290:not(#\9) {
|
|
283
286
|
margin-inline-start: var(--space-xxs-p8yyaw, 4px);
|
|
284
287
|
}
|
|
285
288
|
|
|
286
|
-
.awsui_visually-
|
|
289
|
+
.awsui_visually-hidden_14mhv_3lyk6_294:not(#\9) {
|
|
287
290
|
position: absolute !important;
|
|
288
291
|
inset-block-start: -9999px !important;
|
|
289
292
|
inset-inline-start: -9999px !important;
|
|
@@ -2,28 +2,29 @@
|
|
|
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
|
-
"warning-icon-shake-wrapper": "awsui_warning-icon-shake-
|
|
7
|
-
"awsui-motion-shake-horizontally": "awsui_awsui-motion-shake-
|
|
8
|
-
"error-icon-scale-wrapper": "awsui_error-icon-scale-
|
|
9
|
-
"warning-icon-scale-wrapper": "awsui_warning-icon-scale-
|
|
10
|
-
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-
|
|
11
|
-
"warning": "
|
|
12
|
-
"error": "
|
|
13
|
-
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-
|
|
14
|
-
"root": "
|
|
15
|
-
"label": "
|
|
16
|
-
"info": "
|
|
17
|
-
"description": "
|
|
18
|
-
"constraint": "
|
|
19
|
-
"hints": "
|
|
20
|
-
"constraint-has-validation-text": "awsui_constraint-has-validation-
|
|
21
|
-
"secondary-control": "awsui_secondary-
|
|
22
|
-
"controls": "
|
|
23
|
-
"label-hidden": "awsui_label-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
5
|
+
"error-icon-shake-wrapper": "awsui_error-icon-shake-wrapper_14mhv_3lyk6_103",
|
|
6
|
+
"warning-icon-shake-wrapper": "awsui_warning-icon-shake-wrapper_14mhv_3lyk6_104",
|
|
7
|
+
"awsui-motion-shake-horizontally": "awsui_awsui-motion-shake-horizontally_14mhv_3lyk6_1",
|
|
8
|
+
"error-icon-scale-wrapper": "awsui_error-icon-scale-wrapper_14mhv_3lyk6_134",
|
|
9
|
+
"warning-icon-scale-wrapper": "awsui_warning-icon-scale-wrapper_14mhv_3lyk6_135",
|
|
10
|
+
"awsui-motion-scale-popup": "awsui_awsui-motion-scale-popup_14mhv_3lyk6_1",
|
|
11
|
+
"warning": "awsui_warning_14mhv_3lyk6_104",
|
|
12
|
+
"error": "awsui_error_14mhv_3lyk6_103",
|
|
13
|
+
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_14mhv_3lyk6_1",
|
|
14
|
+
"root": "awsui_root_14mhv_3lyk6_186",
|
|
15
|
+
"label": "awsui_label_14mhv_3lyk6_222",
|
|
16
|
+
"info": "awsui_info_14mhv_3lyk6_236",
|
|
17
|
+
"description": "awsui_description_14mhv_3lyk6_242",
|
|
18
|
+
"constraint": "awsui_constraint_14mhv_3lyk6_243",
|
|
19
|
+
"hints": "awsui_hints_14mhv_3lyk6_250",
|
|
20
|
+
"constraint-has-validation-text": "awsui_constraint-has-validation-text_14mhv_3lyk6_251",
|
|
21
|
+
"secondary-control": "awsui_secondary-control_14mhv_3lyk6_255",
|
|
22
|
+
"controls": "awsui_controls_14mhv_3lyk6_259",
|
|
23
|
+
"label-hidden": "awsui_label-hidden_14mhv_3lyk6_259",
|
|
24
|
+
"label-wrapper": "awsui_label-wrapper_14mhv_3lyk6_262",
|
|
25
|
+
"control": "awsui_control_14mhv_3lyk6_259",
|
|
26
|
+
"error__message": "awsui_error__message_14mhv_3lyk6_289",
|
|
27
|
+
"warning__message": "awsui_warning__message_14mhv_3lyk6_290",
|
|
28
|
+
"visually-hidden": "awsui_visually-hidden_14mhv_3lyk6_294"
|
|
28
29
|
};
|
|
29
30
|
|
|
@@ -114,9 +114,9 @@ function LiveRegion(_a) {
|
|
|
114
114
|
};
|
|
115
115
|
});
|
|
116
116
|
return (React.createElement(React.Fragment, null,
|
|
117
|
-
visible && !source && (React.createElement(TagName, { ref: sourceRef, id: id }, children)),
|
|
117
|
+
visible && !source && (React.createElement(TagName, { ref: sourceRef, id: id, className: styles.source }, children)),
|
|
118
118
|
React.createElement(ScreenreaderOnly, Object.assign({}, restProps, { className: clsx(styles.root, restProps.className) }),
|
|
119
|
-
!visible && !source && (React.createElement(TagName, { ref: sourceRef, "aria-hidden": "true" }, children)),
|
|
119
|
+
!visible && !source && (React.createElement(TagName, { ref: sourceRef, "aria-hidden": "true", className: styles.source }, children)),
|
|
120
120
|
React.createElement("span", { ref: targetRef, "aria-atomic": "true", "aria-live": assertive ? 'assertive' : 'polite' }))));
|
|
121
121
|
}
|
|
122
122
|
// This only extracts text content from the node including all its children which is enough for now.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/live-region/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,0DAA0D;AAE1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,gBAA2C,MAAM,sBAAsB,CAAC;AAC/E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAkBrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,eAAe,IAAI,CAAC,UAAU,CAAC,CAAC;AAEhC,SAAS,UAAU,CAAC,EASF;QATE,EAClB,SAAS,GAAG,KAAK,EACjB,KAAK,GAAG,EAAE,EACV,OAAO,GAAG,KAAK,EACf,OAAO,EAAE,OAAO,GAAG,MAAM,EACzB,QAAQ,EACR,EAAE,EACF,MAAM,OAEU,EADb,SAAS,cARM,wEASnB,CADa;IAEZ,M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S,EAAE;gBACb,YAAY,CAAC,SAAS,CAAC,CAAC;aACzB;QACH,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,CACL;QACG,OAAO,IAAI,CAAC,MAAM,IAAI,CACrB,oBAAC,OAAO,IAAC,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/live-region/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,0DAA0D;AAE1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,gBAA2C,MAAM,sBAAsB,CAAC;AAC/E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAkBrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,eAAe,IAAI,CAAC,UAAU,CAAC,CAAC;AAEhC,SAAS,UAAU,CAAC,EASF;QATE,EAClB,SAAS,GAAG,KAAK,EACjB,KAAK,GAAG,EAAE,EACV,OAAO,GAAG,KAAK,EACf,OAAO,EAAE,OAAO,GAAG,MAAM,EACzB,QAAQ,EACR,EAAE,EACF,MAAM,OAEU,EADb,SAAS,cARM,wEASnB,CADa;IAEZ,MAAM,SAAS,GAAG,MAAM,CAAmC,IAAI,CAAC,CAAC;IACjE,MAAM,SAAS,GAAG,MAAM,CAAmC,IAAI,CAAC,CAAC;IAEjE;;;;;;;;;;MAUE;IACF,SAAS,CAAC,GAAG,EAAE;QACb,SAAS,gBAAgB;YACvB,IAAI,MAAM,EAAE;gBACV,OAAO,MAAM;qBACV,GAAG,CAAC,IAAI,CAAC,EAAE;oBACV,IAAI,CAAC,IAAI,EAAE;wBACT,OAAO,SAAS,CAAC;qBAClB;oBACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;wBA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,CAAC,SAAS,CAAC;YAC/E,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CACtB,oBAAC,OAAO,IAAC,GAAG,EAAE,SAAS,iBAAc,MAAM,EAAC,SAAS,EAAE,MAAM,CAAC,MAAM,IACjE,QAAQ,CACD,CACX;YAED,8BAAM,GAAG,EAAE,SAAS,iBAAc,MAAM,eAAY,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,GAAS,CAC9E,CAClB,CACJ,CAAC;AACJ,CAAC;AAED,oGAAoG;AACpG,oGAAoG;AACpG,0FAA0F;AAC1F,SAAS,gBAAgB,CAAC,IAAiB;IACzC,OAAO,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC5D,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @cloudscape-design/prefer-live-region */\n\nimport clsx from 'clsx';\nimport React, { memo, useEffect, useRef } from 'react';\nimport ScreenreaderOnly, { ScreenreaderOnlyProps } from '../screenreader-only';\nimport styles from './styles.css.js';\n\nexport interface LiveRegionProps extends ScreenreaderOnlyProps {\n assertive?: boolean;\n delay?: number;\n visible?: boolean;\n tagName?: 'span' | 'div';\n id?: string;\n /**\n * Use a list of strings and/or existing DOM elements for building the\n * announcement text. This avoids rendering separate content just for this\n * LiveRegion.\n *\n * If this property is set, the `children` will be ignored.\n */\n source?: Array<string | React.RefObject<HTMLElement> | undefined>;\n}\n\n/**\n * The live region is hidden in the layout, but visible for screen readers.\n * It's purpose it to announce changes e.g. when custom navigation logic is used.\n *\n * The way live region works differently in different browsers and screen readers and\n * it is recommended to manually test every new implementation.\n *\n * If you notice there are different words being merged together,\n * check if there are text nodes not being wrapped in elements, like:\n * ```\n * <LiveRegion>\n * {title}\n * <span><Details /></span>\n * </LiveRegion>\n * ```\n *\n * To fix, wrap \"title\" in an element:\n * ```\n * <LiveRegion>\n * <span>{title}</span>\n * <span><Details /></span>\n * </LiveRegion>\n * ```\n *\n * Or create a single text node if possible:\n * ```\n * <LiveRegion>\n * {`${title} ${details}`}\n * </LiveRegion>\n * ```\n *\n * The live region is always atomic, because non-atomic regions can be treated by screen readers\n * differently and produce unexpected results. To imitate non-atomic announcements simply use\n * multiple live regions:\n * ```\n * <>\n * <LiveRegion>{title}</LiveRegion>\n * <LiveRegion><Details /></LiveRegion>\n * </>\n * ```\n *\n * If you place interactive content inside the LiveRegion, the content will still be\n * interactive (e.g. as a tab stop). Consider using the `source` property instead.\n */\nexport default memo(LiveRegion);\n\nfunction LiveRegion({\n assertive = false,\n delay = 10,\n visible = false,\n tagName: TagName = 'span',\n children,\n id,\n source,\n ...restProps\n}: LiveRegionProps) {\n const sourceRef = useRef<HTMLSpanElement & HTMLDivElement>(null);\n const targetRef = useRef<HTMLSpanElement & HTMLDivElement>(null);\n\n /*\n When React state changes, React often produces too many DOM updates, causing NVDA to\n issue many announcements for the same logical event (See https://github.com/nvaccess/nvda/issues/7996).\n\n The code below imitates a debouncing, scheduling a callback every time new React state\n update is detected. When a callback resolves, it copies content from a muted element\n to the live region, which is recognized by screen readers as an update.\n\n If the use case requires no announcement to be ignored, use delay = 0, but ensure it\n does not impact the performance. If it does, prefer using a string as children prop.\n */\n useEffect(() => {\n function getSourceContent() {\n if (source) {\n return source\n .map(item => {\n if (!item) {\n return undefined;\n }\n if (typeof item === 'string') {\n return item;\n }\n if (item.current) {\n return extractInnerText(item.current);\n }\n })\n .filter(Boolean)\n .join(' ');\n }\n\n if (sourceRef.current) {\n return extractInnerText(sourceRef.current);\n }\n }\n function updateLiveRegion() {\n const sourceContent = getSourceContent();\n\n if (targetRef.current && sourceContent) {\n const targetContent = extractInnerText(targetRef.current);\n if (targetContent !== sourceContent) {\n // The aria-atomic does not work properly in Voice Over, causing\n // certain parts of the content to be ignored. To fix that,\n // we assign the source text content as a single node.\n targetRef.current.innerText = sourceContent;\n }\n }\n }\n\n let timeoutId: null | number;\n if (delay) {\n timeoutId = setTimeout(updateLiveRegion, delay);\n } else {\n updateLiveRegion();\n }\n\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n });\n\n return (\n <>\n {visible && !source && (\n <TagName ref={sourceRef} id={id} className={styles.source}>\n {children}\n </TagName>\n )}\n\n <ScreenreaderOnly {...restProps} className={clsx(styles.root, restProps.className)}>\n {!visible && !source && (\n <TagName ref={sourceRef} aria-hidden=\"true\" className={styles.source}>\n {children}\n </TagName>\n )}\n\n <span ref={targetRef} aria-atomic=\"true\" aria-live={assertive ? 'assertive' : 'polite'}></span>\n </ScreenreaderOnly>\n </>\n );\n}\n\n// This only extracts text content from the node including all its children which is enough for now.\n// To make it more powerful, it is possible to create a more sophisticated extractor with respect to\n// ARIA properties to ignore aria-hidden nodes and read ARIA labels from the live content.\nfunction extractInnerText(node: HTMLElement) {\n return (node.innerText || '').replace(/\\s+/g, ' ').trim();\n}\n"]}
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
.
|
|
5
|
+
.awsui_root_3bgfn_64bxr_5:not(#\9) {
|
|
6
|
+
/* used in test-utils */
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.awsui_source_3bgfn_64bxr_9:not(#\9) {
|
|
6
10
|
/* used in test-utils */
|
|
7
11
|
}
|
package/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED
package/package.json
CHANGED
package/progress-bar/index.js
CHANGED
|
@@ -49,7 +49,7 @@ export default function ProgressBar(_a) {
|
|
|
49
49
|
announcedValue))) : (React.createElement(ResultState, { resultText: resultText, isInFlash: isInFlash, resultButtonText: resultButtonText, status: status, onClick: () => {
|
|
50
50
|
fireNonCancelableEvent(onResultButtonClick);
|
|
51
51
|
} })))),
|
|
52
|
-
additionalInfo && (React.createElement(SmallText, {
|
|
52
|
+
additionalInfo && (React.createElement(SmallText, { className: styles['additional-info'], color: isInFlash ? 'inherit' : undefined }, additionalInfo))));
|
|
53
53
|
}
|
|
54
54
|
applyDisplayName(ProgressBar, 'ProgressBar');
|
|
55
55
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/progress-bar/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,UAAU,MAAM,oCAAoC,CAAC;AAE5D,MAAM,mBAAmB,GAAG,IAAI,CAAC,CAAC,gDAAgD;AAIlF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAajB;QAbiB,EAClC,KAAK,GAAG,CAAC,EACT,MAAM,GAAG,aAAa,EACtB,OAAO,GAAG,YAAY,EACtB,gBAAgB,EAChB,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AE,cAAc,CAAC,EACpD,SAAS,EAAE,SAAS,GACpB;gBACF,oBAAC,UAAU,IAAC,KAAK,EAAE,CAAC;oBACjB,KAAK;oBACL,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;oBACnB,cAAc,CACJ,CACZ,CACJ,CAAC,CAAC,CAAC,CACF,oBAAC,WAAW,IACV,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,GAAG,EAAE;oBACZ,sBAAsB,CAAC,mBAAmB,CAAC,CAAC;gBAC9C,CAAC,GACD,CACH,CACG,CACF;QACL,cAAc,IAAI,CACjB,oBAAC,SAAS,IAAC,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,IACtF,cAAc,CACL,CACb,CACG,CACP,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useMemo, useState } from 'react';\nimport clsx from 'clsx';\n\nimport styles from './styles.css.js';\nimport { getBaseProps } from '../internal/base-component';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { ProgressBarProps } from './interfaces';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { Progress, ResultState, SmallText } from './internal';\nimport { joinStrings } from '../internal/utils/strings';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { throttle } from '../internal/utils/throttle';\nimport LiveRegion from '../internal/components/live-region';\n\nconst ASSERTION_FREQUENCY = 5000; // interval in ms between progress announcements\n\nexport { ProgressBarProps };\n\nexport default function ProgressBar({\n value = 0,\n status = 'in-progress',\n variant = 'standalone',\n resultButtonText,\n label,\n ariaLabel,\n ariaLabelledby,\n description,\n additionalInfo,\n resultText,\n onResultButtonClick,\n ...rest\n}: ProgressBarProps) {\n const { __internalRootRef } = useBaseComponent('ProgressBar', {\n props: { variant },\n });\n const baseProps = getBaseProps(rest);\n const generatedName = useUniqueId('awsui-progress-bar-');\n\n const labelId = `${generatedName}-label`;\n const isInFlash = variant === 'flash';\n const isInProgressState = status === 'in-progress';\n\n const [announcedValue, setAnnouncedValue] = useState('');\n const throttledAssertion = useMemo(() => {\n return throttle((value: ProgressBarProps['value']) => {\n setAnnouncedValue(`${value}%`);\n }, ASSERTION_FREQUENCY);\n }, []);\n\n useEffect(() => {\n throttledAssertion(value);\n }, [throttledAssertion, value]);\n\n if (isInFlash && resultButtonText) {\n warnOnce(\n 'ProgressBar',\n 'The `resultButtonText` is ignored if you set `variant=\"flash\"`, and the result button is not displayed. Use the `buttonText` property and the `onButtonClick` event listener of the flashbar item in which the progress bar component is embedded.'\n );\n }\n\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.root, variant && styles[variant])}\n ref={__internalRootRef}\n >\n <div className={isInFlash ? styles['flash-container'] : undefined}>\n <div className={clsx(styles['word-wrap'], styles[`label-${variant}`])} id={labelId}>\n {label}\n </div>\n {description && <SmallText color={isInFlash ? 'inherit' : undefined}>{description}</SmallText>}\n <div>\n {isInProgressState ? (\n <>\n <Progress\n value={value}\n ariaLabel={ariaLabel}\n ariaLabelledby={joinStrings(labelId, ariaLabelledby)}\n isInFlash={isInFlash}\n />\n <LiveRegion delay={0}>\n {label}\n {label ? ': ' : null}\n {announcedValue}\n </LiveRegion>\n </>\n ) : (\n <ResultState\n resultText={resultText}\n isInFlash={isInFlash}\n resultButtonText={resultButtonText}\n status={status}\n onClick={() => {\n fireNonCancelableEvent(onResultButtonClick);\n }}\n />\n )}\n </div>\n </div>\n {additionalInfo && (\n <SmallText className={styles['additional-info']} color={isInFlash ? 'inherit' : undefined}>\n {additionalInfo}\n </SmallText>\n )}\n </div>\n );\n}\n\napplyDisplayName(ProgressBar, 'ProgressBar');\n"]}
|
|
@@ -11,9 +11,9 @@ export declare const Progress: ({ value, isInFlash, ariaLabel, ariaLabelledby }:
|
|
|
11
11
|
interface SmallTextProps {
|
|
12
12
|
color?: BoxProps.Color;
|
|
13
13
|
children: React.ReactNode;
|
|
14
|
-
|
|
14
|
+
className?: string;
|
|
15
15
|
}
|
|
16
|
-
export declare const SmallText: ({ color, children,
|
|
16
|
+
export declare const SmallText: ({ color, children, className }: SmallTextProps) => JSX.Element;
|
|
17
17
|
interface ResultStateProps {
|
|
18
18
|
isInFlash: boolean;
|
|
19
19
|
resultText: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/progress-bar/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAM7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAShD,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AACD,eAAO,MAAM,QAAQ,oDAAqD,aAAa,gBAyBtF,CAAC;AAEF,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/progress-bar/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAM7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAShD,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AACD,eAAO,MAAM,QAAQ,oDAAqD,aAAa,gBAyBtF,CAAC;AAEF,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,mCAAoC,cAAc,gBAMvE,CAAC;AAYF,UAAU,gBAAgB;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC;IAChC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,WAAW,iEAAkE,gBAAgB,gBAqBzG,CAAC"}
|
package/progress-bar/internal.js
CHANGED
|
@@ -18,8 +18,8 @@ export const Progress = ({ value, isInFlash, ariaLabel, ariaLabelledby }) => {
|
|
|
18
18
|
React.createElement("span", { "aria-hidden": "true", className: styles['percentage-container'] },
|
|
19
19
|
React.createElement(InternalBox, { className: styles.percentage, variant: "small", color: isInFlash ? 'inherit' : undefined }, `${progressValue}%`))));
|
|
20
20
|
};
|
|
21
|
-
export const SmallText = ({ color, children,
|
|
22
|
-
return (React.createElement(InternalBox, { className: styles['word-wrap'], variant: "small", display: "block", color: color
|
|
21
|
+
export const SmallText = ({ color, children, className }) => {
|
|
22
|
+
return (React.createElement(InternalBox, { className: clsx(styles['word-wrap'], className), variant: "small", display: "block", color: color }, children));
|
|
23
23
|
};
|
|
24
24
|
const ResultButton = ({ onClick, children }) => {
|
|
25
25
|
return (React.createElement("div", { className: styles['result-button'] },
|