@cloudscape-design/components-themeable 3.0.1094 → 3.0.1095
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/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/template/calendar/grid/index.js +1 -1
- package/lib/internal/template/calendar/grid/index.js.map +1 -1
- package/lib/internal/template/input/index.d.ts.map +1 -1
- package/lib/internal/template/input/index.js +3 -2
- package/lib/internal/template/input/index.js.map +1 -1
- package/lib/internal/template/input/interfaces.d.ts +16 -0
- package/lib/internal/template/input/interfaces.d.ts.map +1 -1
- package/lib/internal/template/input/interfaces.js.map +1 -1
- package/lib/internal/template/input/internal.d.ts +2 -1
- package/lib/internal/template/input/internal.d.ts.map +1 -1
- package/lib/internal/template/input/internal.js +24 -9
- package/lib/internal/template/input/internal.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/components/autosuggest-input/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/autosuggest-input/index.js +3 -2
- package/lib/internal/template/internal/components/autosuggest-input/index.js.map +1 -1
- package/lib/internal/template/internal/components/masked-input/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/masked-input/index.js +4 -3
- package/lib/internal/template/internal/components/masked-input/index.js.map +1 -1
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/internal/hooks/{use-effect-on-update.d.ts → use-effect-on-update/index.d.ts} +1 -1
- package/lib/internal/template/internal/hooks/use-effect-on-update/index.d.ts.map +1 -0
- package/lib/internal/template/internal/hooks/use-effect-on-update/index.js +37 -0
- package/lib/internal/template/internal/hooks/use-effect-on-update/index.js.map +1 -0
- package/lib/internal/template/internal/utils/with-native-attributes.d.ts +3 -1
- package/lib/internal/template/internal/utils/with-native-attributes.d.ts.map +1 -1
- package/lib/internal/template/internal/utils/with-native-attributes.js +10 -7
- package/lib/internal/template/internal/utils/with-native-attributes.js.map +1 -1
- package/lib/internal/template/prompt-input/interfaces.d.ts +16 -1
- package/lib/internal/template/prompt-input/interfaces.d.ts.map +1 -1
- package/lib/internal/template/prompt-input/interfaces.js.map +1 -1
- package/lib/internal/template/prompt-input/internal.d.ts.map +1 -1
- package/lib/internal/template/prompt-input/internal.js +3 -2
- package/lib/internal/template/prompt-input/internal.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/filter.js +1 -1
- package/lib/internal/template/select/parts/filter.js.map +1 -1
- package/lib/internal/template/select/utils/use-select.js +1 -1
- package/lib/internal/template/select/utils/use-select.js.map +1 -1
- package/lib/internal/template/textarea/index.d.ts.map +1 -1
- package/lib/internal/template/textarea/index.js +3 -2
- package/lib/internal/template/textarea/index.js.map +1 -1
- package/lib/internal/template/textarea/interfaces.d.ts +17 -1
- package/lib/internal/template/textarea/interfaces.d.ts.map +1 -1
- package/lib/internal/template/textarea/interfaces.js.map +1 -1
- package/lib/internal/template/wizard/wizard-form.d.ts.map +1 -1
- package/lib/internal/template/wizard/wizard-form.js +1 -3
- package/lib/internal/template/wizard/wizard-form.js.map +1 -1
- package/package.json +1 -1
- package/lib/internal/template/internal/hooks/use-effect-on-update.d.ts.map +0 -1
- package/lib/internal/template/internal/hooks/use-effect-on-update.js +0 -18
- package/lib/internal/template/internal/hooks/use-effect-on-update.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/textarea/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;;AACb,OAAO,KAAK,EAAE,EAAO,MAAM,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEj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AG,EAAE,iBAAiB,IAClB,6BAA6B,CAAC,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAAC;QAE5E,oBAAC,oBAAoB,oBACf,UAAU,IACd,GAAG,EAAC,UAAU,EACd,aAAa,EAAC,UAAU,EACxB,gBAAgB,EAAE,wBAAwB,EAC1C,GAAG,EAAE,WAAW,EAChB,EAAE,EAAE,SAAS,IACb,CACG,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AACvC,eAAe,QAAQ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React, { Ref, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { convertAutoComplete } from '../input/utils';\nimport { getBaseProps } from '../internal/base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireKeyboardEvent, fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport WithNativeAttributes from '../internal/utils/with-native-attributes';\nimport { GeneratedAnalyticsMetadataTextareaComponent } from './analytics-metadata/interfaces';\nimport { TextareaProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\nexport { TextareaProps };\n\nconst Textarea = React.forwardRef(\n (\n {\n value,\n autoComplete = true,\n disabled,\n readOnly,\n disableBrowserAutocorrect,\n disableBrowserSpellcheck,\n spellcheck,\n onKeyDown,\n onKeyUp,\n onChange,\n onBlur,\n onFocus,\n ariaRequired,\n name,\n rows,\n placeholder,\n autoFocus,\n ariaLabel,\n nativeTextareaAttributes,\n ...rest\n }: TextareaProps,\n ref: Ref<TextareaProps.Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('Textarea', {\n props: { autoComplete, autoFocus, disableBrowserAutocorrect, disableBrowserSpellcheck, readOnly, spellcheck },\n });\n const { ariaLabelledby, ariaDescribedby, controlId, invalid, warning } = useFormFieldContext(rest);\n\n const baseProps = getBaseProps(rest);\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n useForwardFocus(ref, textareaRef);\n\n const attributes: React.TextareaHTMLAttributes<HTMLTextAreaElement> = {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-required': ariaRequired ? 'true' : undefined,\n 'aria-invalid': invalid ? 'true' : undefined,\n name,\n placeholder,\n autoFocus,\n className: clsx(styles.textarea, {\n [styles['textarea-readonly']]: readOnly,\n [styles['textarea-invalid']]: invalid,\n [styles['textarea-warning']]: warning && !invalid,\n }),\n autoComplete: convertAutoComplete(autoComplete),\n spellCheck: spellcheck,\n disabled,\n readOnly: readOnly ? true : undefined,\n rows: rows || 3,\n onKeyDown: onKeyDown && (event => fireKeyboardEvent(onKeyDown, event)),\n onKeyUp: onKeyUp && (event => fireKeyboardEvent(onKeyUp, event)),\n // We set a default value on the component in order to force it into the controlled mode.\n value: value || '',\n onChange: onChange && (event => fireNonCancelableEvent(onChange, { value: event.target.value })),\n onBlur: onBlur && (() => fireNonCancelableEvent(onBlur)),\n onFocus: onFocus && (() => fireNonCancelableEvent(onFocus)),\n };\n\n if (disableBrowserAutocorrect) {\n attributes.autoCorrect = 'off';\n attributes.autoCapitalize = 'off';\n }\n\n if (disableBrowserSpellcheck) {\n attributes.spellCheck = 'false';\n }\n\n const componentAnalyticsMetadata: GeneratedAnalyticsMetadataTextareaComponent = {\n name: 'awsui.Textarea',\n label: 'textarea',\n properties: {\n value: value || '',\n },\n };\n\n return (\n <span\n {...baseProps}\n className={clsx(styles.root, baseProps.className)}\n ref={__internalRootRef}\n {...getAnalyticsMetadataAttribute({ component: componentAnalyticsMetadata })}\n >\n <WithNativeAttributes\n {...attributes}\n tag=\"textarea\"\n componentName=\"Textarea\"\n nativeAttributes={nativeTextareaAttributes}\n ref={textareaRef}\n id={controlId}\n />\n </span>\n );\n }\n);\n\napplyDisplayName(Textarea, 'Textarea');\nexport default Textarea;\n"]}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { BaseInputProps, InputAutoComplete, InputAutoCorrect, InputKeyEvents, InputSpellcheck } from '../input/interfaces';
|
|
2
3
|
import { BaseComponentProps } from '../internal/base-component';
|
|
3
4
|
import { FormFieldValidationControlProps } from '../internal/context/form-field-context';
|
|
4
5
|
import { BaseKeyDetail } from '../internal/events';
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @awsuiSystem core
|
|
8
|
+
*/
|
|
9
|
+
import { NativeAttributes } from '../internal/utils/with-native-attributes';
|
|
10
|
+
export interface TextareaProps extends Omit<BaseInputProps, 'nativeInputAttributes'>, InputKeyEvents, InputAutoCorrect, InputAutoComplete, InputSpellcheck, BaseComponentProps, FormFieldValidationControlProps {
|
|
6
11
|
/**
|
|
7
12
|
* Specifies the number of lines of text to set the height to.
|
|
8
13
|
*/
|
|
@@ -17,6 +22,17 @@ export interface TextareaProps extends BaseInputProps, InputKeyEvents, InputAuto
|
|
|
17
22
|
* @deprecated Use the `spellcheck` property instead.
|
|
18
23
|
*/
|
|
19
24
|
disableBrowserSpellcheck?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Attributes to add to the native `textarea` element.
|
|
27
|
+
* Some attributes will be automatically combined with internal attribute values:
|
|
28
|
+
* - `className` will be appended.
|
|
29
|
+
* - Event handlers will be chained, unless the default is prevented.
|
|
30
|
+
*
|
|
31
|
+
* We do not support using this attribute to apply custom styling.
|
|
32
|
+
*
|
|
33
|
+
* @awsuiSystem core
|
|
34
|
+
*/
|
|
35
|
+
nativeTextareaAttributes?: NativeAttributes<React.TextareaHTMLAttributes<HTMLTextAreaElement>>;
|
|
20
36
|
}
|
|
21
37
|
export declare namespace TextareaProps {
|
|
22
38
|
type KeyDetail = BaseKeyDetail;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/textarea/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/textarea/interfaces.ts"],"names":[],"mappings":";AAEA,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAE5E,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,cAAc,EAAE,uBAAuB,CAAC,EACnD,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,+BAA+B;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;;;;OAQG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAEnC;;;;;;;;;OASG;IACH,wBAAwB,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,CAAC,CAAC;CAChG;AAED,yBAAiB,aAAa,CAAC;IAC7B,KAAY,SAAS,GAAG,aAAa,CAAC;IAEtC,UAAiB,YAAY;QAC3B;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;KACf;IACD,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/textarea/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport {\n BaseInputProps,\n InputAutoComplete,\n InputAutoCorrect,\n InputKeyEvents,\n InputSpellcheck,\n} from '../input/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { BaseKeyDetail } from '../internal/events';\n\nexport interface TextareaProps\n extends BaseInputProps
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/textarea/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport {\n BaseInputProps,\n InputAutoComplete,\n InputAutoCorrect,\n InputKeyEvents,\n InputSpellcheck,\n} from '../input/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { BaseKeyDetail } from '../internal/events';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../internal/utils/with-native-attributes';\n\nexport interface TextareaProps\n extends Omit<BaseInputProps, 'nativeInputAttributes'>,\n InputKeyEvents,\n InputAutoCorrect,\n InputAutoComplete,\n InputSpellcheck,\n BaseComponentProps,\n FormFieldValidationControlProps {\n /**\n * Specifies the number of lines of text to set the height to.\n */\n rows?: number;\n\n /**\n * Specifies whether to disable browser spellcheck feature.\n * If you set this to `true`, it disables native browser capability\n * that checks for spelling/grammar errors.\n * If you don't set it, the behavior follows the default behavior\n * of the user's browser.\n *\n * @deprecated Use the `spellcheck` property instead.\n */\n disableBrowserSpellcheck?: boolean;\n\n /**\n * Attributes to add to the native `textarea` element.\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeTextareaAttributes?: NativeAttributes<React.TextareaHTMLAttributes<HTMLTextAreaElement>>;\n}\n\nexport namespace TextareaProps {\n export type KeyDetail = BaseKeyDetail;\n\n export interface ChangeDetail {\n /**\n * The new value of this textarea.\n */\n value: string;\n }\n export interface Ref {\n /**\n * Sets input focus on the textarea control.\n */\n focus(): void;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wizard-form.d.ts","sourceRoot":"","sources":["../../../src/wizard/wizard-form.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wizard-form.d.ts","sourceRoot":"","sources":["../../../src/wizard/wizard-form.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA8C,MAAM,OAAO,CAAC;AAmBnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,UAAU,eAAgB,SAAQ,0BAA0B;IAC1D,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACvC,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,WAAW,EAAE,WAAW,CAAC,WAAW,CAAC;IACrC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,eAAO,MAAM,kBAAkB,QAAwD,CAAC;AAExF,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,KAAK,EAAE,eAAe,eAsBrE"}
|
|
@@ -22,9 +22,7 @@ export default function WizardFormWithAnalytics(props) {
|
|
|
22
22
|
const stepHeaderRef = useRef(null);
|
|
23
23
|
useEffectOnUpdate(() => {
|
|
24
24
|
var _a;
|
|
25
|
-
|
|
26
|
-
(_a = stepHeaderRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
27
|
-
}
|
|
25
|
+
(_a = stepHeaderRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
28
26
|
}, [props.activeStepIndex]);
|
|
29
27
|
return (React.createElement(AnalyticsFunnelStep, { stepIdentifier: analyticsMetadata === null || analyticsMetadata === void 0 ? void 0 : analyticsMetadata.instanceIdentifier, stepErrorContext: analyticsMetadata === null || analyticsMetadata === void 0 ? void 0 : analyticsMetadata.errorContext, stepNameSelector: STEP_NAME_SELECTOR, stepNumber: props.activeStepIndex + 1 },
|
|
30
28
|
React.createElement(WizardForm, Object.assign({ stepHeaderRef: stepHeaderRef, __internalRootRef: __internalRootRef }, props))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wizard-form.js","sourceRoot":"","sources":["../../../src/wizard/wizard-form.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAoB,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACnE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAGhH,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE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,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,WAAW,EAC1B,kBAAkB,EAAE,WAAW,CAAC,kBAAkB,IAC9C,cAAc,CAAC,OAAO,CAAC,eAAe,GAEzC,OAAO,CACK,CACd,CACJ,CAAC;AACJ,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAsC,EAAE,eAAuB;IAC5F,IAAI,qBAAqB,GAAG,eAAe,CAAC;IAC5C,GAAG;QACD,qBAAqB,EAAE,CAAC;KACzB,QAAQ,qBAAqB,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC,UAAU,EAAE;IAE9F,OAAO,qBAAqB,GAAG,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { MutableRefObject, useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useComponentMetadata, useMergeRefs, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\nimport { AnalyticsMetadata } from '@cloudscape-design/component-toolkit/internal/base-component/metrics/interfaces';\n\nimport InternalForm from '../form/internal';\nimport InternalHeader from '../header/internal';\nimport { FunnelMetrics } from '../internal/analytics';\nimport { AnalyticsFunnelStep } from '../internal/analytics/components/analytics-funnel';\nimport { useFunnel, useFunnelStepRef } from '../internal/analytics/hooks/use-funnel';\nimport {\n DATA_ATTR_FUNNEL_KEY,\n FUNNEL_KEY_STEP_NAME,\n getSubStepAllSelector,\n getTextFromSelector,\n} from '../internal/analytics/selectors';\nimport { BasePropsWithAnalyticsMetadata, getAnalyticsMetadataProps } from '../internal/base-component';\nimport { PACKAGE_VERSION } from '../internal/environment';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update';\nimport { WizardProps } from './interfaces';\nimport WizardActions from './wizard-actions';\nimport WizardFormHeader from './wizard-form-header';\n\nimport styles from './styles.css.js';\n\ninterface WizardFormProps extends InternalBaseComponentProps {\n steps: ReadonlyArray<WizardProps.Step>;\n activeStepIndex: number;\n showCollapsedSteps: boolean;\n i18nStrings: WizardProps.I18nStrings;\n submitButtonText?: string;\n isPrimaryLoading: boolean;\n allowSkipTo: boolean;\n secondaryActions?: React.ReactNode;\n onCancelClick: () => void;\n onPreviousClick: () => void;\n onPrimaryClick: () => void;\n onSkipToClick: (stepIndex: number) => void;\n}\n\nexport const STEP_NAME_SELECTOR = `[${DATA_ATTR_FUNNEL_KEY}=\"${FUNNEL_KEY_STEP_NAME}\"]`;\n\nexport default function WizardFormWithAnalytics(props: WizardFormProps) {\n const analyticsMetadata = getAnalyticsMetadataProps(\n props.steps[props.activeStepIndex] as BasePropsWithAnalyticsMetadata\n );\n\n const __internalRootRef = useComponentMetadata('WizardForm', PACKAGE_VERSION, analyticsMetadata as AnalyticsMetadata);\n const stepHeaderRef = useRef<HTMLDivElement | null>(null);\n\n useEffectOnUpdate(() => {\n if (stepHeaderRef && stepHeaderRef.current) {\n stepHeaderRef.current?.focus();\n }\n }, [props.activeStepIndex]);\n\n return (\n <AnalyticsFunnelStep\n stepIdentifier={analyticsMetadata?.instanceIdentifier}\n stepErrorContext={analyticsMetadata?.errorContext}\n stepNameSelector={STEP_NAME_SELECTOR}\n stepNumber={props.activeStepIndex + 1}\n >\n <WizardForm stepHeaderRef={stepHeaderRef} __internalRootRef={__internalRootRef} {...props} />\n </AnalyticsFunnelStep>\n );\n}\n\nfunction WizardForm({\n __internalRootRef,\n stepHeaderRef,\n steps,\n activeStepIndex,\n showCollapsedSteps,\n i18nStrings,\n submitButtonText,\n isPrimaryLoading,\n allowSkipTo,\n secondaryActions,\n onCancelClick,\n onPreviousClick,\n onPrimaryClick,\n onSkipToClick,\n}: WizardFormProps & { stepHeaderRef: MutableRefObject<HTMLDivElement | null> }) {\n const rootRef = useRef<HTMLElement>();\n const ref = useMergeRefs(rootRef, __internalRootRef);\n const { title, info, description, content, errorText, isOptional } = steps[activeStepIndex] || {};\n const isLastStep = activeStepIndex >= steps.length - 1;\n const skipToTargetIndex = findSkipToTargetIndex(steps, activeStepIndex);\n\n const { funnelInteractionId, funnelIdentifier } = useFunnel();\n\n const funnelStepInfo = useFunnelStepRef();\n\n const errorSlotId = useUniqueId('wizard-error-');\n\n const showSkipTo = allowSkipTo && skipToTargetIndex !== -1;\n const skipToButtonText =\n skipToTargetIndex !== -1 && i18nStrings.skipToButtonLabel\n ? i18nStrings.skipToButtonLabel(steps[skipToTargetIndex], skipToTargetIndex + 1)\n : undefined;\n\n useEffect(() => {\n if (funnelInteractionId && errorText) {\n const stepName = getTextFromSelector(funnelStepInfo.current.stepNameSelector);\n\n FunnelMetrics.funnelStepError({\n funnelInteractionId,\n stepNumber: funnelStepInfo.current.stepNumber,\n stepNameSelector: funnelStepInfo.current.stepNameSelector,\n stepName,\n stepIdentifier: funnelStepInfo.current.stepIdentifier,\n currentDocument: rootRef.current?.ownerDocument,\n totalSubSteps: funnelStepInfo.current.subStepCount.current,\n funnelIdentifier,\n subStepAllSelector: getSubStepAllSelector(),\n errorContext: funnelStepInfo.current.stepErrorContext,\n subStepConfiguration: funnelStepInfo.current.subStepConfiguration.current?.get(\n funnelStepInfo.current.stepNumber\n ),\n stepErrorSelector: '#' + errorSlotId,\n });\n }\n }, [funnelInteractionId, funnelIdentifier, isLastStep, errorText, __internalRootRef, errorSlotId, funnelStepInfo]);\n\n return (\n <>\n <WizardFormHeader>\n <div className={clsx(styles['collapsed-steps'], !showCollapsedSteps && styles['collapsed-steps-hidden'])}>\n {i18nStrings.collapsedStepsLabel?.(activeStepIndex + 1, steps.length)}\n </div>\n <InternalHeader\n className={styles['form-header-component']}\n variant=\"h1\"\n description={description}\n info={info}\n __headingTagRef={stepHeaderRef}\n __headingTagTabIndex={-1}\n >\n <span className={styles['form-header-component-wrapper']}>\n <span {...{ [DATA_ATTR_FUNNEL_KEY]: FUNNEL_KEY_STEP_NAME }}>{title}</span>\n {isOptional && <i>{` - ${i18nStrings.optional}`}</i>}\n </span>\n </InternalHeader>\n </WizardFormHeader>\n\n <InternalForm\n __internalRootRef={ref}\n className={styles['form-component']}\n actions={\n <WizardActions\n cancelButtonText={i18nStrings.cancelButton}\n primaryButtonText={isLastStep ? (submitButtonText ?? i18nStrings.submitButton) : i18nStrings.nextButton}\n primaryButtonLoadingText={\n isLastStep ? i18nStrings.submitButtonLoadingAnnouncement : i18nStrings.nextButtonLoadingAnnouncement\n }\n previousButtonText={i18nStrings.previousButton}\n onCancelClick={onCancelClick}\n onPreviousClick={onPreviousClick}\n onPrimaryClick={onPrimaryClick}\n onSkipToClick={() => onSkipToClick(skipToTargetIndex)}\n showPrevious={activeStepIndex !== 0}\n isPrimaryLoading={isPrimaryLoading}\n showSkipTo={showSkipTo}\n skipToButtonText={skipToButtonText}\n isLastStep={isLastStep}\n activeStepIndex={activeStepIndex}\n skipToStepIndex={skipToTargetIndex}\n />\n }\n secondaryActions={secondaryActions}\n errorText={errorText}\n __errorSlotId={errorSlotId}\n errorIconAriaLabel={i18nStrings.errorIconAriaLabel}\n {...funnelStepInfo.current.funnelStepProps}\n >\n {content}\n </InternalForm>\n </>\n );\n}\n\nfunction findSkipToTargetIndex(steps: ReadonlyArray<WizardProps.Step>, activeStepIndex: number): number {\n let nextRequiredStepIndex = activeStepIndex;\n do {\n nextRequiredStepIndex++;\n } while (nextRequiredStepIndex < steps.length - 1 && steps[nextRequiredStepIndex].isOptional);\n\n return nextRequiredStepIndex > activeStepIndex + 1 ? nextRequiredStepIndex : -1;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"wizard-form.js","sourceRoot":"","sources":["../../../src/wizard/wizard-form.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAoB,SAAS,EAAE,MAAM,EAAE,MAAM,OAA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,gBAAgB,EAClC,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,eAAe,EAChC,eAAe,EAAE,iBAAiB,GAClC,EAEJ,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,WAAW,EAC1B,kBAAkB,EAAE,WAAW,CAAC,kBAAkB,IAC9C,cAAc,CAAC,OAAO,CAAC,eAAe,GAEzC,OAAO,CACK,CACd,CACJ,CAAC;AACJ,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAsC,EAAE,eAAuB;IAC5F,IAAI,qBAAqB,GAAG,eAAe,CAAC;IAC5C,GAAG;QACD,qBAAqB,EAAE,CAAC;KACzB,QAAQ,qBAAqB,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC,UAAU,EAAE;IAE9F,OAAO,qBAAqB,GAAG,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { MutableRefObject, useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useComponentMetadata, useMergeRefs, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\nimport { AnalyticsMetadata } from '@cloudscape-design/component-toolkit/internal/base-component/metrics/interfaces';\n\nimport InternalForm from '../form/internal';\nimport InternalHeader from '../header/internal';\nimport { FunnelMetrics } from '../internal/analytics';\nimport { AnalyticsFunnelStep } from '../internal/analytics/components/analytics-funnel';\nimport { useFunnel, useFunnelStepRef } from '../internal/analytics/hooks/use-funnel';\nimport {\n DATA_ATTR_FUNNEL_KEY,\n FUNNEL_KEY_STEP_NAME,\n getSubStepAllSelector,\n getTextFromSelector,\n} from '../internal/analytics/selectors';\nimport { BasePropsWithAnalyticsMetadata, getAnalyticsMetadataProps } from '../internal/base-component';\nimport { PACKAGE_VERSION } from '../internal/environment';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update';\nimport { WizardProps } from './interfaces';\nimport WizardActions from './wizard-actions';\nimport WizardFormHeader from './wizard-form-header';\n\nimport styles from './styles.css.js';\n\ninterface WizardFormProps extends InternalBaseComponentProps {\n steps: ReadonlyArray<WizardProps.Step>;\n activeStepIndex: number;\n showCollapsedSteps: boolean;\n i18nStrings: WizardProps.I18nStrings;\n submitButtonText?: string;\n isPrimaryLoading: boolean;\n allowSkipTo: boolean;\n secondaryActions?: React.ReactNode;\n onCancelClick: () => void;\n onPreviousClick: () => void;\n onPrimaryClick: () => void;\n onSkipToClick: (stepIndex: number) => void;\n}\n\nexport const STEP_NAME_SELECTOR = `[${DATA_ATTR_FUNNEL_KEY}=\"${FUNNEL_KEY_STEP_NAME}\"]`;\n\nexport default function WizardFormWithAnalytics(props: WizardFormProps) {\n const analyticsMetadata = getAnalyticsMetadataProps(\n props.steps[props.activeStepIndex] as BasePropsWithAnalyticsMetadata\n );\n\n const __internalRootRef = useComponentMetadata('WizardForm', PACKAGE_VERSION, analyticsMetadata as AnalyticsMetadata);\n const stepHeaderRef = useRef<HTMLDivElement | null>(null);\n\n useEffectOnUpdate(() => {\n stepHeaderRef.current?.focus();\n }, [props.activeStepIndex]);\n\n return (\n <AnalyticsFunnelStep\n stepIdentifier={analyticsMetadata?.instanceIdentifier}\n stepErrorContext={analyticsMetadata?.errorContext}\n stepNameSelector={STEP_NAME_SELECTOR}\n stepNumber={props.activeStepIndex + 1}\n >\n <WizardForm stepHeaderRef={stepHeaderRef} __internalRootRef={__internalRootRef} {...props} />\n </AnalyticsFunnelStep>\n );\n}\n\nfunction WizardForm({\n __internalRootRef,\n stepHeaderRef,\n steps,\n activeStepIndex,\n showCollapsedSteps,\n i18nStrings,\n submitButtonText,\n isPrimaryLoading,\n allowSkipTo,\n secondaryActions,\n onCancelClick,\n onPreviousClick,\n onPrimaryClick,\n onSkipToClick,\n}: WizardFormProps & { stepHeaderRef: MutableRefObject<HTMLDivElement | null> }) {\n const rootRef = useRef<HTMLElement>();\n const ref = useMergeRefs(rootRef, __internalRootRef);\n const { title, info, description, content, errorText, isOptional } = steps[activeStepIndex] || {};\n const isLastStep = activeStepIndex >= steps.length - 1;\n const skipToTargetIndex = findSkipToTargetIndex(steps, activeStepIndex);\n\n const { funnelInteractionId, funnelIdentifier } = useFunnel();\n\n const funnelStepInfo = useFunnelStepRef();\n\n const errorSlotId = useUniqueId('wizard-error-');\n\n const showSkipTo = allowSkipTo && skipToTargetIndex !== -1;\n const skipToButtonText =\n skipToTargetIndex !== -1 && i18nStrings.skipToButtonLabel\n ? i18nStrings.skipToButtonLabel(steps[skipToTargetIndex], skipToTargetIndex + 1)\n : undefined;\n\n useEffect(() => {\n if (funnelInteractionId && errorText) {\n const stepName = getTextFromSelector(funnelStepInfo.current.stepNameSelector);\n\n FunnelMetrics.funnelStepError({\n funnelInteractionId,\n stepNumber: funnelStepInfo.current.stepNumber,\n stepNameSelector: funnelStepInfo.current.stepNameSelector,\n stepName,\n stepIdentifier: funnelStepInfo.current.stepIdentifier,\n currentDocument: rootRef.current?.ownerDocument,\n totalSubSteps: funnelStepInfo.current.subStepCount.current,\n funnelIdentifier,\n subStepAllSelector: getSubStepAllSelector(),\n errorContext: funnelStepInfo.current.stepErrorContext,\n subStepConfiguration: funnelStepInfo.current.subStepConfiguration.current?.get(\n funnelStepInfo.current.stepNumber\n ),\n stepErrorSelector: '#' + errorSlotId,\n });\n }\n }, [funnelInteractionId, funnelIdentifier, isLastStep, errorText, __internalRootRef, errorSlotId, funnelStepInfo]);\n\n return (\n <>\n <WizardFormHeader>\n <div className={clsx(styles['collapsed-steps'], !showCollapsedSteps && styles['collapsed-steps-hidden'])}>\n {i18nStrings.collapsedStepsLabel?.(activeStepIndex + 1, steps.length)}\n </div>\n <InternalHeader\n className={styles['form-header-component']}\n variant=\"h1\"\n description={description}\n info={info}\n __headingTagRef={stepHeaderRef}\n __headingTagTabIndex={-1}\n >\n <span className={styles['form-header-component-wrapper']}>\n <span {...{ [DATA_ATTR_FUNNEL_KEY]: FUNNEL_KEY_STEP_NAME }}>{title}</span>\n {isOptional && <i>{` - ${i18nStrings.optional}`}</i>}\n </span>\n </InternalHeader>\n </WizardFormHeader>\n\n <InternalForm\n __internalRootRef={ref}\n className={styles['form-component']}\n actions={\n <WizardActions\n cancelButtonText={i18nStrings.cancelButton}\n primaryButtonText={isLastStep ? (submitButtonText ?? i18nStrings.submitButton) : i18nStrings.nextButton}\n primaryButtonLoadingText={\n isLastStep ? i18nStrings.submitButtonLoadingAnnouncement : i18nStrings.nextButtonLoadingAnnouncement\n }\n previousButtonText={i18nStrings.previousButton}\n onCancelClick={onCancelClick}\n onPreviousClick={onPreviousClick}\n onPrimaryClick={onPrimaryClick}\n onSkipToClick={() => onSkipToClick(skipToTargetIndex)}\n showPrevious={activeStepIndex !== 0}\n isPrimaryLoading={isPrimaryLoading}\n showSkipTo={showSkipTo}\n skipToButtonText={skipToButtonText}\n isLastStep={isLastStep}\n activeStepIndex={activeStepIndex}\n skipToStepIndex={skipToTargetIndex}\n />\n }\n secondaryActions={secondaryActions}\n errorText={errorText}\n __errorSlotId={errorSlotId}\n errorIconAriaLabel={i18nStrings.errorIconAriaLabel}\n {...funnelStepInfo.current.funnelStepProps}\n >\n {content}\n </InternalForm>\n </>\n );\n}\n\nfunction findSkipToTargetIndex(steps: ReadonlyArray<WizardProps.Step>, activeStepIndex: number): number {\n let nextRequiredStepIndex = activeStepIndex;\n do {\n nextRequiredStepIndex++;\n } while (nextRequiredStepIndex < steps.length - 1 && steps[nextRequiredStepIndex].isOptional);\n\n return nextRequiredStepIndex > activeStepIndex + 1 ? nextRequiredStepIndex : -1;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-effect-on-update.d.ts","sourceRoot":"","sources":["../../../../src/internal/hooks/use-effect-on-update.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAqB,MAAM,OAAO,CAAC;AAG1E,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,QAY/E"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { useEffect, useRef } from 'react';
|
|
4
|
-
// useEffect, which skips the initial render
|
|
5
|
-
export function useEffectOnUpdate(callback, deps) {
|
|
6
|
-
const isFirstRender = useRef(true);
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
if (isFirstRender.current) {
|
|
9
|
-
isFirstRender.current = false;
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
return callback();
|
|
13
|
-
}
|
|
14
|
-
// This is a useEffect extension, will be validated at the call site
|
|
15
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
|
-
}, deps);
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=use-effect-on-update.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-effect-on-update.js","sourceRoot":"","sources":["../../../../src/internal/hooks/use-effect-on-update.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAkC,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1E,4CAA4C;AAC5C,MAAM,UAAU,iBAAiB,CAAC,QAAwB,EAAE,IAAoB;IAC9E,MAAM,aAAa,GAAG,MAAM,CAAU,IAAI,CAAC,CAAC;IAE5C,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,aAAa,CAAC,OAAO,EAAE;YACzB,aAAa,CAAC,OAAO,GAAG,KAAK,CAAC;SAC/B;aAAM;YACL,OAAO,QAAQ,EAAE,CAAC;SACnB;QACD,oEAAoE;QACpE,uDAAuD;IACzD,CAAC,EAAE,IAAI,CAAC,CAAC;AACX,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { DependencyList, EffectCallback, useEffect, useRef } from 'react';\n\n// useEffect, which skips the initial render\nexport function useEffectOnUpdate(callback: EffectCallback, deps: DependencyList) {\n const isFirstRender = useRef<boolean>(true);\n\n useEffect(() => {\n if (isFirstRender.current) {\n isFirstRender.current = false;\n } else {\n return callback();\n }\n // This is a useEffect extension, will be validated at the call site\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n}\n"]}
|