@cloudscape-design/components 3.0.235 → 3.0.237
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/app-layout/drawer/index.d.ts +2 -5
- package/app-layout/drawer/index.d.ts.map +1 -1
- package/app-layout/drawer/index.js.map +1 -1
- package/app-layout/index.d.ts.map +1 -1
- package/app-layout/index.js +20 -15
- package/app-layout/index.js.map +1 -1
- package/app-layout/utils/use-focus-control.d.ts +8 -6
- package/app-layout/utils/use-focus-control.d.ts.map +1 -1
- package/app-layout/utils/use-focus-control.js +21 -10
- package/app-layout/utils/use-focus-control.js.map +1 -1
- package/app-layout/utils/use-split-panel-focus-control.d.ts +21 -0
- package/app-layout/utils/use-split-panel-focus-control.d.ts.map +1 -0
- package/app-layout/utils/use-split-panel-focus-control.js +32 -0
- package/app-layout/utils/use-split-panel-focus-control.js.map +1 -0
- package/app-layout/visual-refresh/app-bar.d.ts.map +1 -1
- package/app-layout/visual-refresh/app-bar.js +3 -6
- package/app-layout/visual-refresh/app-bar.js.map +1 -1
- package/app-layout/visual-refresh/context.d.ts +6 -2
- package/app-layout/visual-refresh/context.d.ts.map +1 -1
- package/app-layout/visual-refresh/context.js +24 -11
- package/app-layout/visual-refresh/context.js.map +1 -1
- package/app-layout/visual-refresh/navigation.d.ts.map +1 -1
- package/app-layout/visual-refresh/navigation.js +3 -5
- package/app-layout/visual-refresh/navigation.js.map +1 -1
- package/app-layout/visual-refresh/split-panel.d.ts.map +1 -1
- package/app-layout/visual-refresh/split-panel.js +4 -8
- package/app-layout/visual-refresh/split-panel.js.map +1 -1
- package/app-layout/visual-refresh/tools.js +5 -6
- package/app-layout/visual-refresh/tools.js.map +1 -1
- package/autosuggest/internal.d.ts.map +1 -1
- package/autosuggest/internal.js +10 -4
- package/autosuggest/internal.js.map +1 -1
- package/breadcrumb-group/internal.d.ts.map +1 -1
- package/breadcrumb-group/internal.js +2 -2
- package/breadcrumb-group/internal.js.map +1 -1
- package/breadcrumb-group/styles.css.js +7 -6
- package/breadcrumb-group/styles.scoped.css +14 -11
- package/breadcrumb-group/styles.selectors.js +7 -6
- package/button/index.d.ts.map +1 -1
- package/button/index.js +2 -2
- package/button/index.js.map +1 -1
- package/button/interfaces.d.ts +4 -0
- package/button/interfaces.d.ts.map +1 -1
- package/button/interfaces.js.map +1 -1
- package/calendar/grid/index.d.ts +1 -1
- package/calendar/grid/index.d.ts.map +1 -1
- package/calendar/grid/index.js.map +1 -1
- package/calendar/header/header-button.d.ts +1 -1
- package/calendar/header/header-button.d.ts.map +1 -1
- package/calendar/header/header-button.js.map +1 -1
- package/calendar/header/index.d.ts +2 -2
- package/calendar/header/index.d.ts.map +1 -1
- package/calendar/header/index.js.map +1 -1
- package/calendar/interfaces.d.ts +3 -3
- package/calendar/interfaces.d.ts.map +1 -1
- package/calendar/interfaces.js.map +1 -1
- package/calendar/internal.d.ts +1 -1
- package/calendar/internal.d.ts.map +1 -1
- package/calendar/internal.js +6 -1
- package/calendar/internal.js.map +1 -1
- package/date-picker/index.d.ts.map +1 -1
- package/date-picker/index.js +6 -4
- package/date-picker/index.js.map +1 -1
- package/internal/context/split-panel-context.d.ts +2 -8
- package/internal/context/split-panel-context.d.ts.map +1 -1
- package/internal/context/split-panel-context.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/i18n/context.d.ts +6 -1
- package/internal/i18n/context.d.ts.map +1 -1
- package/internal/i18n/context.js +8 -2
- package/internal/i18n/context.js.map +1 -1
- package/internal/i18n/messages/all.all.js +219 -210
- package/internal/i18n/messages/all.all.json +231 -231
- package/internal/i18n/messages/all.de.js +20 -20
- package/internal/i18n/messages/all.de.json +20 -20
- package/internal/i18n/messages/all.en-GB.js +20 -20
- package/internal/i18n/messages/all.en-GB.json +20 -20
- package/internal/i18n/messages/all.en.js +20 -20
- package/internal/i18n/messages/all.en.json +20 -20
- package/internal/i18n/messages/all.es.js +20 -20
- package/internal/i18n/messages/all.es.json +20 -20
- package/internal/i18n/messages/all.fr.js +20 -20
- package/internal/i18n/messages/all.fr.json +20 -20
- package/internal/i18n/messages/all.id.js +20 -20
- package/internal/i18n/messages/all.id.json +20 -20
- package/internal/i18n/messages/all.it.js +20 -20
- package/internal/i18n/messages/all.it.json +20 -20
- package/internal/i18n/messages/all.ja.js +20 -20
- package/internal/i18n/messages/all.ja.json +20 -20
- package/internal/i18n/messages/all.ko.js +22 -19
- package/internal/i18n/messages/all.ko.json +20 -20
- package/internal/i18n/messages/all.pt-BR.js +20 -20
- package/internal/i18n/messages/all.pt-BR.json +20 -20
- package/internal/i18n/messages/all.zh-CN.js +24 -21
- package/internal/i18n/messages/all.zh-CN.json +22 -22
- package/internal/i18n/messages/all.zh-TW.js +23 -20
- package/internal/i18n/messages/all.zh-TW.json +21 -21
- package/internal/i18n/provider.js +1 -1
- package/internal/i18n/provider.js.map +1 -1
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/property-filter/index.js.map +1 -1
- package/select/parts/styles.css.js +9 -9
- package/select/parts/styles.scoped.css +9 -27
- package/select/parts/styles.selectors.js +9 -9
- package/split-panel/index.d.ts.map +1 -1
- package/split-panel/index.js +6 -24
- package/split-panel/index.js.map +1 -1
- package/table/body-cell/use-stable-scroll-position.d.ts.map +1 -1
- package/table/body-cell/use-stable-scroll-position.js +10 -4
- package/table/body-cell/use-stable-scroll-position.js.map +1 -1
- package/table/header-cell/index.js +2 -3
- package/table/header-cell/index.js.map +1 -1
- package/table/use-table-focus-navigation.d.ts +1 -1
- package/table/use-table-focus-navigation.d.ts.map +1 -1
- package/table/use-table-focus-navigation.js +4 -4
- package/table/use-table-focus-navigation.js.map +1 -1
- package/tutorial-panel/components/tutorial-list/index.d.ts +0 -1
- package/tutorial-panel/components/tutorial-list/index.d.ts.map +1 -1
- package/tutorial-panel/components/tutorial-list/index.js +3 -15
- package/tutorial-panel/components/tutorial-list/index.js.map +1 -1
- package/tutorial-panel/index.d.ts.map +1 -1
- package/tutorial-panel/index.js +2 -14
- package/tutorial-panel/index.js.map +1 -1
- package/tutorial-panel/interfaces.d.ts +1 -1
- package/tutorial-panel/interfaces.d.ts.map +1 -1
- package/tutorial-panel/interfaces.js.map +1 -1
- package/wizard/index.d.ts +1 -1
- package/wizard/index.d.ts.map +1 -1
- package/wizard/index.js +4 -1
- package/wizard/index.js.map +1 -1
- package/wizard/interfaces.d.ts +5 -5
- package/wizard/interfaces.d.ts.map +1 -1
- package/wizard/interfaces.js.map +1 -1
- package/wizard/wizard-actions.d.ts +3 -3
- package/wizard/wizard-actions.d.ts.map +1 -1
- package/wizard/wizard-actions.js.map +1 -1
- package/wizard/wizard-form.js +2 -1
- package/wizard/wizard-form.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/tutorial-panel/components/tutorial-list/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,uBAAuB,MAAM,oCAAoC,CAAC;AACzE,OAAO,oBAAoB,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,eAAe,MAAM,gDAAgD,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MA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W,IAAC,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;4BACpC,oBAAC,cAAc,IACb,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,MAAA,QAAQ,CAAC,mBAAmB,mCAAI,KAAK,EAC/C,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,MAAM,CAAC,KAAK,IAEtB,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC,CAAC,WAAW,CAAC,uBAAuB,CAClF,CACL,CACO,CACnB,CACQ,CACZ,CACH,CACN,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useState } from 'react';\nimport styles from './styles.css.js';\nimport { TutorialPanelProps } from '../../interfaces';\nimport InternalBox from '../../../box/internal';\nimport { InternalButton } from '../../../button/internal';\nimport InternalStatusIndicator from '../../../status-indicator/internal';\nimport InternalSpaceBetween from '../../../space-between/internal';\nimport { fireNonCancelableEvent } from '../../../internal/events/index.js';\nimport clsx from 'clsx';\nimport InternalAlert from '../../../alert/internal';\nimport InternalLink from '../../../link/internal';\nimport { useUniqueId } from '../../../internal/hooks/use-unique-id/index.js';\nimport { CSSTransition } from 'react-transition-group';\nimport { HotspotContext } from '../../../annotation-context/context.js';\nimport InternalIcon from '../../../icon/internal';\nimport useFocusVisible from '../../../internal/hooks/focus-visible/index.js';\nimport { useVisualRefresh } from '../../../internal/hooks/use-visual-mode';\nimport { checkSafeUrl } from '../../../internal/utils/check-safe-url';\nimport LiveRegion from '../../../internal/components/live-region/index.js';\n\nexport interface TutorialListProps {\n loading?: boolean;\n tutorials: TutorialPanelProps['tutorials'];\n onStartTutorial: HotspotContext['onStartTutorial'];\n filteringFunction: (tutorial: TutorialPanelProps.Tutorial, searchTerm: string) => boolean;\n i18nStrings: TutorialPanelProps['i18nStrings'];\n downloadUrl: TutorialPanelProps['downloadUrl'];\n}\n\nexport default function TutorialList({\n i18nStrings,\n tutorials,\n loading = false,\n onStartTutorial,\n downloadUrl,\n}: TutorialListProps) {\n checkSafeUrl('TutorialPanel', downloadUrl);\n\n /*\n // Filtering is not available in the Beta release.\n\n const [searchTerm, setSearchTerm] = useState('');\n\n const onSearchChangeCallback: InputProps['onChange'] = useCallback(event => setSearchTerm(event.detail.value), [\n setSearchTerm\n ]);\n\n const filteredTutorials = tutorials.filter(tutorial => filteringFunction(tutorial, searchTerm))\n */\n\n const focusVisible = useFocusVisible();\n const isRefresh = useVisualRefresh();\n\n return (\n <>\n <InternalSpaceBetween size=\"s\">\n <InternalSpaceBetween size=\"m\">\n <InternalBox variant=\"h2\" fontSize={isRefresh ? 'heading-m' : 'heading-l'} padding={{ bottom: 'n' }}>\n {i18nStrings.tutorialListTitle}\n </InternalBox>\n <InternalBox variant=\"p\" color=\"text-body-secondary\" padding=\"n\">\n {i18nStrings.tutorialListDescription}\n </InternalBox>\n </InternalSpaceBetween>\n <InternalSpaceBetween size=\"l\">\n <a\n {...focusVisible}\n href={downloadUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={styles['download-link']}\n aria-label={i18nStrings.labelTutorialListDownloadLink}\n >\n <InternalIcon name=\"download\" />\n <InternalBox padding={{ left: 'xs' }} color=\"inherit\" fontWeight=\"bold\" display=\"inline\">\n {i18nStrings.tutorialListDownloadLinkText}\n </InternalBox>\n </a>\n\n {/*\n <FormField label=\"Filter tutorials\">\n <Input type=\"search\" value={searchTerm} placeholder=\"Filter tutorials\" onChange={onSearchChangeCallback} />\n </FormField>\n */}\n {loading ? (\n <InternalStatusIndicator type=\"loading\">\n <LiveRegion visible={true}>{i18nStrings.loadingText}</LiveRegion>\n </InternalStatusIndicator>\n ) : (\n <>\n <ul className={styles['tutorial-list']} role=\"list\">\n {tutorials.map((tutorial, index) => (\n <Tutorial\n tutorial={tutorial}\n key={index}\n onStartTutorial={onStartTutorial}\n i18nStrings={i18nStrings}\n />\n ))}\n </ul>\n {/* {filteredTutorials.length === 0 && searchTerm && <Box>No tutorials match this search filter.</Box>} */}\n </>\n )}\n </InternalSpaceBetween>\n </InternalSpaceBetween>\n </>\n );\n}\n\nfunction Tutorial({\n tutorial,\n onStartTutorial: onStartTutorialEventHandler,\n i18nStrings,\n}: {\n tutorial: TutorialPanelProps.Tutorial;\n onStartTutorial: HotspotContext['onStartTutorial'];\n i18nStrings: TutorialPanelProps['i18nStrings'];\n}) {\n checkSafeUrl('TutorialPanel', tutorial.learnMoreUrl);\n const controlId = useUniqueId();\n const triggerControldId = useUniqueId();\n const headerId = useUniqueId();\n\n const isRefresh = useVisualRefresh();\n\n const onStartTutorial = useCallback(() => {\n fireNonCancelableEvent(onStartTutorialEventHandler, { tutorial });\n }, [onStartTutorialEventHandler, tutorial]);\n\n const [expanded, setExpanded] = useState(!tutorial.prerequisitesNeeded && !tutorial.completed);\n\n const onClick = useCallback(() => {\n setExpanded(expanded => !expanded);\n }, []);\n\n return (\n <li className={styles['tutorial-box']} role=\"listitem\">\n <InternalSpaceBetween size=\"xs\">\n <div className={styles['tutorial-box-title']}>\n <InternalBox\n variant=\"h3\"\n fontSize={isRefresh ? 'heading-s' : 'heading-m'}\n id={headerId}\n margin={{ right: 'xs' }}\n padding=\"n\"\n className={styles.title}\n >\n {tutorial.title}\n </InternalBox>\n <div className={styles['button-wrapper']}>\n <InternalButton\n id={triggerControldId}\n variant=\"icon\"\n ariaExpanded={expanded}\n __nativeAttributes={{\n 'aria-controls': controlId,\n 'aria-labelledby': headerId,\n }}\n formAction=\"none\"\n onClick={onClick}\n className={expanded ? styles['collapse-button'] : styles['expand-button']}\n iconName={expanded ? 'angle-up' : 'angle-down'}\n />\n </div>\n </div>\n\n {tutorial.completed ? (\n <InternalStatusIndicator __size=\"inherit\" type=\"success\" className={styles.completed} wrapText={true}>\n {i18nStrings.tutorialCompletedText}\n </InternalStatusIndicator>\n ) : null}\n </InternalSpaceBetween>\n\n <div aria-live=\"polite\">\n <CSSTransition in={expanded} timeout={30} classNames={{ enter: styles['content-enter'] }}>\n <div className={clsx(styles['expandable-section'], expanded && styles.expanded)} id={controlId}>\n <InternalSpaceBetween size=\"l\">\n <InternalSpaceBetween size=\"m\">\n {tutorial.prerequisitesNeeded && tutorial.prerequisitesAlert && (\n <InternalAlert type=\"info\" className={styles['prerequisites-alert']}>\n {tutorial.prerequisitesAlert}\n </InternalAlert>\n )}\n <InternalSpaceBetween size=\"s\">\n <InternalBox color=\"text-body-secondary\">\n <div\n className={clsx(\n styles['tutorial-description'],\n typeof tutorial.description === 'string' && styles['tutorial-description-plaintext']\n )}\n >\n {tutorial.description}\n </div>\n </InternalBox>\n {tutorial.learnMoreUrl && (\n <InternalLink\n href={tutorial.learnMoreUrl}\n className={styles['learn-more-link']}\n externalIconAriaLabel={i18nStrings.labelLearnMoreExternalIcon}\n ariaLabel={i18nStrings.labelLearnMoreLink}\n external={true}\n >\n {i18nStrings.learnMoreLinkText}\n </InternalLink>\n )}\n </InternalSpaceBetween>\n </InternalSpaceBetween>\n\n <InternalBox margin={{ bottom: 'xxs' }}>\n <InternalButton\n onClick={onStartTutorial}\n disabled={tutorial.prerequisitesNeeded ?? false}\n formAction=\"none\"\n className={styles.start}\n >\n {tutorial.completed ? i18nStrings.restartTutorialButtonText : i18nStrings.startTutorialButtonText}\n </InternalButton>\n </InternalBox>\n </InternalSpaceBetween>\n </div>\n </CSSTransition>\n </div>\n </li>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/tutorial-panel/components/tutorial-list/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OA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C,sBAAsB,CAAC,EAC9B,OAAO,QAAQ,CAAC,WAAW,KAAK,QAAQ,IAAI,MAAM,CAAC,gCAAgC,CAAC,CACrF,IAEA,QAAQ,CAAC,WAAW,CACjB,CACM;gCACb,QAAQ,CAAC,YAAY,IAAI,CACxB,oBAAC,YAAY,IACX,IAAI,EAAE,QAAQ,CAAC,YAAY,EAC3B,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,EACpC,qBAAqB,EAAE,WAAW,CAAC,0BAA0B,EAC7D,SAAS,EAAE,WAAW,CAAC,kBAAkB,EACzC,QAAQ,EAAE,IAAI,IAEb,WAAW,CAAC,iBAAiB,CACjB,CAChB,CACoB,CACF;wBAEvB,oBAAC,WAAW,IAAC,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;4BACpC,oBAAC,cAAc,IACb,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,MAAA,QAAQ,CAAC,mBAAmB,mCAAI,KAAK,EAC/C,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,MAAM,CAAC,KAAK,IAEtB,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC,CAAC,WAAW,CAAC,uBAAuB,CAClF,CACL,CACO,CACnB,CACQ,CACZ,CACH,CACN,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useState } from 'react';\nimport styles from './styles.css.js';\nimport { TutorialPanelProps } from '../../interfaces';\nimport InternalBox from '../../../box/internal';\nimport { InternalButton } from '../../../button/internal';\nimport InternalStatusIndicator from '../../../status-indicator/internal';\nimport InternalSpaceBetween from '../../../space-between/internal';\nimport { fireNonCancelableEvent } from '../../../internal/events/index.js';\nimport clsx from 'clsx';\nimport InternalAlert from '../../../alert/internal';\nimport InternalLink from '../../../link/internal';\nimport { useUniqueId } from '../../../internal/hooks/use-unique-id/index.js';\nimport { CSSTransition } from 'react-transition-group';\nimport { HotspotContext } from '../../../annotation-context/context.js';\nimport InternalIcon from '../../../icon/internal';\nimport useFocusVisible from '../../../internal/hooks/focus-visible/index.js';\nimport { useVisualRefresh } from '../../../internal/hooks/use-visual-mode';\nimport { checkSafeUrl } from '../../../internal/utils/check-safe-url';\nimport LiveRegion from '../../../internal/components/live-region/index.js';\n\nexport interface TutorialListProps {\n loading?: boolean;\n tutorials: TutorialPanelProps['tutorials'];\n onStartTutorial: HotspotContext['onStartTutorial'];\n i18nStrings: TutorialPanelProps['i18nStrings'];\n downloadUrl: TutorialPanelProps['downloadUrl'];\n}\n\nexport default function TutorialList({\n i18nStrings,\n tutorials,\n loading = false,\n onStartTutorial,\n downloadUrl,\n}: TutorialListProps) {\n checkSafeUrl('TutorialPanel', downloadUrl);\n\n const focusVisible = useFocusVisible();\n const isRefresh = useVisualRefresh();\n\n return (\n <>\n <InternalSpaceBetween size=\"s\">\n <InternalSpaceBetween size=\"m\">\n <InternalBox variant=\"h2\" fontSize={isRefresh ? 'heading-m' : 'heading-l'} padding={{ bottom: 'n' }}>\n {i18nStrings.tutorialListTitle}\n </InternalBox>\n <InternalBox variant=\"p\" color=\"text-body-secondary\" padding=\"n\">\n {i18nStrings.tutorialListDescription}\n </InternalBox>\n </InternalSpaceBetween>\n <InternalSpaceBetween size=\"l\">\n {downloadUrl && (\n <a\n {...focusVisible}\n href={downloadUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={styles['download-link']}\n aria-label={i18nStrings.labelTutorialListDownloadLink}\n >\n <InternalIcon name=\"download\" />\n <InternalBox padding={{ left: 'xs' }} color=\"inherit\" fontWeight=\"bold\" display=\"inline\">\n {i18nStrings.tutorialListDownloadLinkText}\n </InternalBox>\n </a>\n )}\n {loading ? (\n <InternalStatusIndicator type=\"loading\">\n <LiveRegion visible={true}>{i18nStrings.loadingText}</LiveRegion>\n </InternalStatusIndicator>\n ) : (\n <ul className={styles['tutorial-list']} role=\"list\">\n {tutorials.map((tutorial, index) => (\n <Tutorial tutorial={tutorial} key={index} onStartTutorial={onStartTutorial} i18nStrings={i18nStrings} />\n ))}\n </ul>\n )}\n </InternalSpaceBetween>\n </InternalSpaceBetween>\n </>\n );\n}\n\nfunction Tutorial({\n tutorial,\n onStartTutorial: onStartTutorialEventHandler,\n i18nStrings,\n}: {\n tutorial: TutorialPanelProps.Tutorial;\n onStartTutorial: HotspotContext['onStartTutorial'];\n i18nStrings: TutorialPanelProps['i18nStrings'];\n}) {\n checkSafeUrl('TutorialPanel', tutorial.learnMoreUrl);\n const controlId = useUniqueId();\n const triggerControldId = useUniqueId();\n const headerId = useUniqueId();\n\n const isRefresh = useVisualRefresh();\n\n const onStartTutorial = useCallback(() => {\n fireNonCancelableEvent(onStartTutorialEventHandler, { tutorial });\n }, [onStartTutorialEventHandler, tutorial]);\n\n const [expanded, setExpanded] = useState(!tutorial.prerequisitesNeeded && !tutorial.completed);\n\n const onClick = useCallback(() => {\n setExpanded(expanded => !expanded);\n }, []);\n\n return (\n <li className={styles['tutorial-box']} role=\"listitem\">\n <InternalSpaceBetween size=\"xs\">\n <div className={styles['tutorial-box-title']}>\n <InternalBox\n variant=\"h3\"\n fontSize={isRefresh ? 'heading-s' : 'heading-m'}\n id={headerId}\n margin={{ right: 'xs' }}\n padding=\"n\"\n className={styles.title}\n >\n {tutorial.title}\n </InternalBox>\n <div className={styles['button-wrapper']}>\n <InternalButton\n id={triggerControldId}\n variant=\"icon\"\n ariaExpanded={expanded}\n __nativeAttributes={{\n 'aria-controls': controlId,\n 'aria-labelledby': headerId,\n }}\n formAction=\"none\"\n onClick={onClick}\n className={expanded ? styles['collapse-button'] : styles['expand-button']}\n iconName={expanded ? 'angle-up' : 'angle-down'}\n />\n </div>\n </div>\n\n {tutorial.completed ? (\n <InternalStatusIndicator __size=\"inherit\" type=\"success\" className={styles.completed} wrapText={true}>\n {i18nStrings.tutorialCompletedText}\n </InternalStatusIndicator>\n ) : null}\n </InternalSpaceBetween>\n\n <div aria-live=\"polite\">\n <CSSTransition in={expanded} timeout={30} classNames={{ enter: styles['content-enter'] }}>\n <div className={clsx(styles['expandable-section'], expanded && styles.expanded)} id={controlId}>\n <InternalSpaceBetween size=\"l\">\n <InternalSpaceBetween size=\"m\">\n {tutorial.prerequisitesNeeded && tutorial.prerequisitesAlert && (\n <InternalAlert type=\"info\" className={styles['prerequisites-alert']}>\n {tutorial.prerequisitesAlert}\n </InternalAlert>\n )}\n <InternalSpaceBetween size=\"s\">\n <InternalBox color=\"text-body-secondary\">\n <div\n className={clsx(\n styles['tutorial-description'],\n typeof tutorial.description === 'string' && styles['tutorial-description-plaintext']\n )}\n >\n {tutorial.description}\n </div>\n </InternalBox>\n {tutorial.learnMoreUrl && (\n <InternalLink\n href={tutorial.learnMoreUrl}\n className={styles['learn-more-link']}\n externalIconAriaLabel={i18nStrings.labelLearnMoreExternalIcon}\n ariaLabel={i18nStrings.labelLearnMoreLink}\n external={true}\n >\n {i18nStrings.learnMoreLinkText}\n </InternalLink>\n )}\n </InternalSpaceBetween>\n </InternalSpaceBetween>\n\n <InternalBox margin={{ bottom: 'xxs' }}>\n <InternalButton\n onClick={onStartTutorial}\n disabled={tutorial.prerequisitesNeeded ?? false}\n formAction=\"none\"\n className={styles.start}\n >\n {tutorial.completed ? i18nStrings.restartTutorialButtonText : i18nStrings.startTutorialButtonText}\n </InternalButton>\n </InternalBox>\n </InternalSpaceBetween>\n </div>\n </CSSTransition>\n </div>\n </li>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tutorial-panel/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAOlD,OAAO,EAAE,kBAAkB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tutorial-panel/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAOlD,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,WAAW,EACX,OAAO,EACP,SAAS,EACT,eAAe,EACf,WAAW,EACX,GAAG,SAAS,EACb,EAAE,kBAAkB,eA6BpB"}
|
package/tutorial-panel/index.js
CHANGED
|
@@ -10,25 +10,13 @@ import TutorialDetailView from './components/tutorial-detail-view';
|
|
|
10
10
|
import { hotspotContext } from '../annotation-context/context';
|
|
11
11
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
12
12
|
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
13
|
-
const defaultFilteringFunction = (tutorial, searchTerm) => {
|
|
14
|
-
var _a;
|
|
15
|
-
if (searchTerm === '') {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
return ((_a = tutorial.title) === null || _a === void 0 ? void 0 : _a.toLowerCase().indexOf(searchTerm.toLowerCase())) !== -1;
|
|
19
|
-
};
|
|
20
13
|
export default function TutorialPanel(_a) {
|
|
21
|
-
var { i18nStrings, loading, tutorials, onFeedbackClick, downloadUrl } = _a,
|
|
22
|
-
// Filtering is not available in the Beta release.
|
|
23
|
-
//filteringFunction: customFilteringFunction,
|
|
24
|
-
restProps = __rest(_a, ["i18nStrings", "loading", "tutorials", "onFeedbackClick", "downloadUrl"]);
|
|
14
|
+
var { i18nStrings, loading, tutorials, onFeedbackClick, downloadUrl } = _a, restProps = __rest(_a, ["i18nStrings", "loading", "tutorials", "onFeedbackClick", "downloadUrl"]);
|
|
25
15
|
const { __internalRootRef } = useBaseComponent('TutorialPanel');
|
|
26
16
|
const baseProps = getBaseProps(restProps);
|
|
27
17
|
const context = useContext(hotspotContext);
|
|
28
|
-
//const filteringFunction = customFilteringFunction ?? defaultFilteringFunction;
|
|
29
|
-
const filteringFunction = defaultFilteringFunction;
|
|
30
18
|
return (React.createElement(React.Fragment, null,
|
|
31
|
-
React.createElement("div", Object.assign({}, baseProps, { className: clsx(baseProps.className, styles['tutorial-panel']), ref: __internalRootRef }), context.currentTutorial ? (React.createElement(TutorialDetailView, { i18nStrings: i18nStrings, tutorial: context.currentTutorial, onExitTutorial: context.onExitTutorial, currentStepIndex: context.currentStepIndex, onFeedbackClick: onFeedbackClick })) : (React.createElement(TutorialList, { i18nStrings: i18nStrings, tutorials: tutorials, loading: loading, onStartTutorial: context.onStartTutorial,
|
|
19
|
+
React.createElement("div", Object.assign({}, baseProps, { className: clsx(baseProps.className, styles['tutorial-panel']), ref: __internalRootRef }), context.currentTutorial ? (React.createElement(TutorialDetailView, { i18nStrings: i18nStrings, tutorial: context.currentTutorial, onExitTutorial: context.onExitTutorial, currentStepIndex: context.currentStepIndex, onFeedbackClick: onFeedbackClick })) : (React.createElement(TutorialList, { i18nStrings: i18nStrings, tutorials: tutorials, loading: loading, onStartTutorial: context.onStartTutorial, downloadUrl: downloadUrl })))));
|
|
32
20
|
}
|
|
33
21
|
applyDisplayName(TutorialPanel, 'TutorialPanel');
|
|
34
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tutorial-panel/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAGrC,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,kBAAkB,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AA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Ae,EAAE,eAAe,GAChC,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,YAAY,IACX,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,OAAO,CAAC,eAAe,EACxC,WAAW,EAAE,WAAW,GACxB,CACH,CACG,CACL,CACJ,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,aAAa,EAAE,eAAe,CAAC,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, { useContext } from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport styles from './styles.css.js';\n\nimport { TutorialPanelProps } from './interfaces';\nimport TutorialList from './components/tutorial-list';\nimport TutorialDetailView from './components/tutorial-detail-view';\nimport { hotspotContext } from '../annotation-context/context';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\n\nexport { TutorialPanelProps };\n\nexport default function TutorialPanel({\n i18nStrings,\n loading,\n tutorials,\n onFeedbackClick,\n downloadUrl,\n ...restProps\n}: TutorialPanelProps) {\n const { __internalRootRef } = useBaseComponent('TutorialPanel');\n\n const baseProps = getBaseProps(restProps);\n const context = useContext(hotspotContext);\n\n return (\n <>\n <div {...baseProps} className={clsx(baseProps.className, styles['tutorial-panel'])} ref={__internalRootRef}>\n {context.currentTutorial ? (\n <TutorialDetailView\n i18nStrings={i18nStrings}\n tutorial={context.currentTutorial}\n onExitTutorial={context.onExitTutorial}\n currentStepIndex={context.currentStepIndex}\n onFeedbackClick={onFeedbackClick}\n />\n ) : (\n <TutorialList\n i18nStrings={i18nStrings}\n tutorials={tutorials}\n loading={loading}\n onStartTutorial={context.onStartTutorial}\n downloadUrl={downloadUrl}\n />\n )}\n </div>\n </>\n );\n}\n\napplyDisplayName(TutorialPanel, 'TutorialPanel');\n"]}
|
|
@@ -54,7 +54,7 @@ export interface TutorialPanelProps extends BaseComponentProps {
|
|
|
54
54
|
/**
|
|
55
55
|
* The link to a file documenting all tutorials (usually a PDF).
|
|
56
56
|
*/
|
|
57
|
-
downloadUrl
|
|
57
|
+
downloadUrl?: string;
|
|
58
58
|
/**
|
|
59
59
|
* An object containing all the necessary localized strings required by the component.
|
|
60
60
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/tutorial-panel/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC5D;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;IACH,SAAS,EAAE,aAAa,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAEtD;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/tutorial-panel/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC5D;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;IACH,SAAS,EAAE,aAAa,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAEtD;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CA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,CAAC;QAErC,qBAAqB,EAAE,MAAM,CAAC;QAC9B,iBAAiB,EAAE,MAAM,CAAC;QAE1B,uBAAuB,EAAE,MAAM,CAAC;QAChC,yBAAyB,EAAE,MAAM,CAAC;QAElC,qBAAqB,EAAE,MAAM,CAAC;QAE9B,gBAAgB,EAAE,MAAM,CAAC;QACzB,yBAAyB,EAAE,MAAM,CAAC;QAElC,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;QAC5D,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;QAE5D,iBAAiB,EAAE,MAAM,CAAC;QAC1B,eAAe,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,MAAM,CAAC;QACpD,0BAA0B,EAAE,MAAM,CAAC;QAEnC,gBAAgB,EAAE;YAChB,OAAO,EAAE,MAAM,CAAC;YAChB,aAAa,EAAE,MAAM,CAAC;YACtB,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;QAEF,6BAA6B,CAAC,EAAE,MAAM,CAAC;QACvC,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/tutorial-panel/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface TutorialPanelProps extends BaseComponentProps {\n /**\n * Whether the content of the panel is currently loading. If this property\n * is set to `true`, the panel displays a spinner and the loadingText that is\n * specified in the `i18nStrings` property.\n */\n loading?: boolean;\n\n /**\n * List of all available tutorials. An array of objects with the following properties:\n *\n * * `title` (string) - Name of the tutorial\n *\n * * `description` (ReactNode) - Short description of the tutorial's content.\n *\n * * `tasks` - Array of tasks (in intended order). Each Task has the following properties:\n * * `title` (string) - Name of this task. This is shown in the task list overview of the tutorial's detail view.\n * * `steps` - Array of steps in this task (in intended order). Each step has the following properties:\n * * `title` (string) - Title of this step. This is shown in the step list in the tutorial's detail view.\n * * `content` (ReactNode) - Content to be shown in the popover of this step. Can be JSX or plain text.\n * * `warningAlert` (ReactNode) - (Optional) If this field is present, a warning alert will be displayed\n * inside the step's popover, showing this field's content. Can be JSX or plain text.\n * * `hotspotId` (string) - ID of the hotspot that this tutorial step points to.\n *\n * A hotspot with this ID needs to be added manually to the code of the application and represents a location\n * in the application that a tutorial step can be attached to. It can be re-used by multiple tutorials. Hotspot\n * IDs need to be unique in the scope of the whole application that uses this tutorial.\n *\n * * `completedScreenDescription` (ReactNode) - Description to be shown on the last page of the tutorial, when the\n * user has successfully completed the tutorial.\n *\n * * `prerequisitesAlert` (ReactNode) - (Optional) If the application determines that the user cannot start the tutorial\n * yet (by specifying the property `prerequisitesNeeded` on the tutorial object), the content of `prerequisitesAlert`\n * will be shown in the tutorial list underneath the tutorial title.\n *\n * Example: `<><Link>Create a bucket first</Link> to complete this tutorial.</>`\n *\n * * `prerequisitesNeeded` (boolean) - (Optional) If this property is set to `true`, the tutorial list will disable the\n * `Start tutorial` button for this tutorial, and it will show the contents of the tutorial's `prerequisitesAlert` field\n * in an alert underneath the tutorial title.\n *\n * * `learnMoreUrl` (string | null) - (Optional) If present, the tutorial list will show a \"Learn More\" link pointing to\n * this URL underneath the tutorial's description.\n *\n * * `completed` (boolean) - Whether the user has already completed this tutorial.\n *\n * If this property is set to `true`, the tutorial list will show a status indicator underneath the tutorial title with\n * a message that indicates that this tutorial has already been completed by the user (e.g. \"Tutorial completed\"), and\n * the \"Start tutorial\" button will be replaced by a \"Restart tutorial\" button.\n */\n tutorials: ReadonlyArray<TutorialPanelProps.Tutorial>;\n\n /**\n * The link to a file documenting all tutorials (usually a PDF).\n */\n downloadUrl
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/tutorial-panel/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface TutorialPanelProps extends BaseComponentProps {\n /**\n * Whether the content of the panel is currently loading. If this property\n * is set to `true`, the panel displays a spinner and the loadingText that is\n * specified in the `i18nStrings` property.\n */\n loading?: boolean;\n\n /**\n * List of all available tutorials. An array of objects with the following properties:\n *\n * * `title` (string) - Name of the tutorial\n *\n * * `description` (ReactNode) - Short description of the tutorial's content.\n *\n * * `tasks` - Array of tasks (in intended order). Each Task has the following properties:\n * * `title` (string) - Name of this task. This is shown in the task list overview of the tutorial's detail view.\n * * `steps` - Array of steps in this task (in intended order). Each step has the following properties:\n * * `title` (string) - Title of this step. This is shown in the step list in the tutorial's detail view.\n * * `content` (ReactNode) - Content to be shown in the popover of this step. Can be JSX or plain text.\n * * `warningAlert` (ReactNode) - (Optional) If this field is present, a warning alert will be displayed\n * inside the step's popover, showing this field's content. Can be JSX or plain text.\n * * `hotspotId` (string) - ID of the hotspot that this tutorial step points to.\n *\n * A hotspot with this ID needs to be added manually to the code of the application and represents a location\n * in the application that a tutorial step can be attached to. It can be re-used by multiple tutorials. Hotspot\n * IDs need to be unique in the scope of the whole application that uses this tutorial.\n *\n * * `completedScreenDescription` (ReactNode) - Description to be shown on the last page of the tutorial, when the\n * user has successfully completed the tutorial.\n *\n * * `prerequisitesAlert` (ReactNode) - (Optional) If the application determines that the user cannot start the tutorial\n * yet (by specifying the property `prerequisitesNeeded` on the tutorial object), the content of `prerequisitesAlert`\n * will be shown in the tutorial list underneath the tutorial title.\n *\n * Example: `<><Link>Create a bucket first</Link> to complete this tutorial.</>`\n *\n * * `prerequisitesNeeded` (boolean) - (Optional) If this property is set to `true`, the tutorial list will disable the\n * `Start tutorial` button for this tutorial, and it will show the contents of the tutorial's `prerequisitesAlert` field\n * in an alert underneath the tutorial title.\n *\n * * `learnMoreUrl` (string | null) - (Optional) If present, the tutorial list will show a \"Learn More\" link pointing to\n * this URL underneath the tutorial's description.\n *\n * * `completed` (boolean) - Whether the user has already completed this tutorial.\n *\n * If this property is set to `true`, the tutorial list will show a status indicator underneath the tutorial title with\n * a message that indicates that this tutorial has already been completed by the user (e.g. \"Tutorial completed\"), and\n * the \"Start tutorial\" button will be replaced by a \"Restart tutorial\" button.\n */\n tutorials: ReadonlyArray<TutorialPanelProps.Tutorial>;\n\n /**\n * The link to a file documenting all tutorials (usually a PDF).\n */\n downloadUrl?: string;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n */\n i18nStrings: TutorialPanelProps.I18nStrings;\n\n /**\n * Fired when the user clicks on the feedback link at the end of a tutorial.\n */\n onFeedbackClick: NonCancelableEventHandler<TutorialPanelProps.TutorialDetail>;\n}\n\nexport namespace TutorialPanelProps {\n export interface TutorialDetail {\n tutorial: Tutorial;\n }\n\n export interface Tutorial {\n /**\n * Title of the tutorial\n * */\n title: string;\n\n /**\n * Short description of the tutorial's content. This is displayed in the tutorial list.\n */\n description: React.ReactNode;\n\n /**\n * List of tasks (in intended order)\n */\n tasks: ReadonlyArray<Task>;\n\n /**\n * Description to be shown on the last page of the tutorial, when the user has\n * successfully completed the tutorial.\n */\n completedScreenDescription: React.ReactNode;\n\n /**\n * If the application determines that the user cannot start\n * the tutorial yet (by specifying the property `prerequisitesNeeded` on the\n * tutorial object), the content of `prerequisitesAlert` will be shown in the\n * tutorial list underneath the tutorial title.\n *\n * @deprecated Use alert component inside description property directly.\n */\n prerequisitesAlert?: React.ReactNode;\n\n /**\n * If this property is set to `true`, the tutorial list\n * will disable the `Start tutorial` button for this\n * tutorial, and it will show the contents of the\n * tutorial's `prerequisitesAlert` field in an alert underneath\n * the tutorial title.\n */\n prerequisitesNeeded?: boolean;\n\n /**\n * If present, the tutorial list will show a \"Learn More\" link pointing to\n * this URL underneath the tutorial's description.\n */\n learnMoreUrl?: string | null;\n\n /**\n * Whether the user has already completed this tutorial.\n *\n * If this property is set to `true`, the tutorial list\n * will show a status indicator underneath the tutorial\n * title with a message that indicates that this tutorial\n * has already been completed by the user (e.g.\n * \"Tutorial completed\"), and the \"Start tutorial\" button\n * will be replaced by a \"Restart tutorial\" button.\n *\n */\n completed: boolean;\n }\n\n export interface Task {\n /**\n * Title of this task. This is shown in the task list overview of the tutorial's\n * detail view.\n */\n title: string;\n\n /**\n * Steps in this task (in intended order)\n */\n steps: ReadonlyArray<Step>;\n }\n\n export interface Step {\n /**\n * Title of this step. This is shown in the step list in the tutorial's\n * detail view.\n */\n title: string;\n\n /**\n * Content to be shown in the popover of this step. Can be JSX or plain text.\n */\n content: React.ReactNode;\n\n /**\n * If this field is present, a warning alert will be displayed inside\n * the step's popover, showing this field's content. Can be JSX or plain text.\n * @deprecated Use alert component inside content property directly.\n */\n warningAlert?: React.ReactNode;\n\n /**\n * ID of the hotspot that this tutorial step points to.\n *\n * A hotspot with this ID needs to be added manually to the code of the application\n * and represents a location in the application that a tutorial step can be\n * attached to. It can be re-used by multiple tutorials. Hotspot IDs need\n * to be unique in the scope of the whole application that uses this tutorial.\n */\n hotspotId: string;\n }\n\n export interface I18nStrings {\n loadingText: string;\n\n tutorialListTitle: string;\n tutorialListDescription: React.ReactNode;\n tutorialListDownloadLinkText: string;\n\n tutorialCompletedText: string;\n learnMoreLinkText: string;\n\n startTutorialButtonText: string;\n restartTutorialButtonText: string;\n\n completionScreenTitle: string;\n\n feedbackLinkText: string;\n dismissTutorialButtonText: string;\n\n taskTitle: (taskIndex: number, taskTitle: string) => string;\n stepTitle: (stepIndex: number, stepTitle: string) => string;\n\n labelExitTutorial: string;\n labelTotalSteps: (totalStepCount: number) => string;\n labelLearnMoreExternalIcon: string;\n\n labelsTaskStatus: {\n pending: string;\n 'in-progress': string;\n success: string;\n };\n\n labelTutorialListDownloadLink?: string;\n labelLearnMoreLink?: string;\n }\n}\n"]}
|
package/wizard/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { WizardProps } from './interfaces';
|
|
3
3
|
export { WizardProps };
|
|
4
|
-
export default function Wizard({ steps, activeStepIndex: controlledActiveStepIndex,
|
|
4
|
+
export default function Wizard({ steps, activeStepIndex: controlledActiveStepIndex, isLoadingNextStep, allowSkipTo, secondaryActions, onCancel, onSubmit, onNavigate, ...rest }: WizardProps): JSX.Element;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/wizard/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/wizard/index.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/wizard/index.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAiB3C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,KAAK,EACL,eAAe,EAAE,yBAAyB,EAC1C,iBAAyB,EACzB,WAAmB,EACnB,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,GAAG,IAAI,EACR,EAAE,WAAW,eA4Hb"}
|
package/wizard/index.js
CHANGED
|
@@ -16,8 +16,9 @@ import useBaseComponent from '../internal/hooks/use-base-component';
|
|
|
16
16
|
import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
17
17
|
import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
18
18
|
import { trackStartStep, trackNavigate, trackSubmit, trackStartWizard, trackEndWizard, trackCancel, } from './internal/analytics';
|
|
19
|
+
import { useInternalI18n } from '../internal/i18n/context';
|
|
19
20
|
export default function Wizard(_a) {
|
|
20
|
-
var { steps, activeStepIndex: controlledActiveStepIndex,
|
|
21
|
+
var { steps, activeStepIndex: controlledActiveStepIndex, isLoadingNextStep = false, allowSkipTo = false, secondaryActions, onCancel, onSubmit, onNavigate } = _a, rest = __rest(_a, ["steps", "activeStepIndex", "isLoadingNextStep", "allowSkipTo", "secondaryActions", "onCancel", "onSubmit", "onNavigate"]);
|
|
21
22
|
const { __internalRootRef } = useBaseComponent('Wizard');
|
|
22
23
|
const baseProps = getBaseProps(rest);
|
|
23
24
|
const funnelId = baseProps.id;
|
|
@@ -55,6 +56,8 @@ export default function Wizard(_a) {
|
|
|
55
56
|
navigationEvent(actualActiveStepIndex + 1, 'next');
|
|
56
57
|
}
|
|
57
58
|
};
|
|
59
|
+
const i18n = useInternalI18n('wizard');
|
|
60
|
+
const i18nStrings = Object.assign(Object.assign({}, rest.i18nStrings), { stepNumberLabel: i18n('i18nStrings.stepNumberLabel', rest.i18nStrings.stepNumberLabel), collapsedStepsLabel: i18n('i18nStrings.collapsedStepsLabel', rest.i18nStrings.collapsedStepsLabel), cancelButton: i18n('i18nStrings.cancelButton', rest.i18nStrings.cancelButton), previousButton: i18n('i18nStrings.previousButton', rest.i18nStrings.previousButton), nextButton: i18n('i18nStrings.nextButton', rest.i18nStrings.nextButton), optional: i18n('i18nStrings.optional', rest.i18nStrings.optional) });
|
|
58
61
|
if (activeStepIndex && activeStepIndex >= steps.length) {
|
|
59
62
|
warnOnce('Wizard', `You have set \`activeStepIndex\` to ${activeStepIndex} but you have provided only ${steps.length} steps. Its value is ignored and the component uses ${steps.length - 1} instead.`);
|
|
60
63
|
}
|
package/wizard/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/wizard/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;A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,EAAE,GAAG,EAAE,GAAG;QAC7E,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,IAAI,MAAM,CAAC,OAAO,EAAE,cAAc,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC;YAE9G,oBAAC,gBAAgB,IACf,eAAe,EAAE,qBAAqB,EACtC,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,EAC5C,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,cAAc,EACtB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,EAChC,iBAAiB,EAAE,iBAAiB,EACpC,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,KAAK,GACZ;YACF,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,IAAI,MAAM,CAAC,OAAO,EAAE,cAAc,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC;gBAE3G,eAAe,IAAI,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,8BAA8B,CAAC,GAAI;gBAE/F,oBAAC,UAAU,IACT,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,eAAe,EAChC,kBAAkB,EAAE,cAAc,EAClC,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,qBAAqB,EACtC,gBAAgB,EAAE,iBAAiB,EACnC,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,GAC9B,CACE,CACF,CACF,CACP,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,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';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { warnOnce } from '../internal/logging';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport WizardForm from './wizard-form';\nimport WizardNavigation from './wizard-navigation';\nimport { WizardProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\n\nimport {\n trackStartStep,\n trackNavigate,\n trackSubmit,\n trackStartWizard,\n trackEndWizard,\n trackCancel,\n} from './internal/analytics';\n\nexport { WizardProps };\n\nexport default function Wizard({\n steps,\n activeStepIndex: controlledActiveStepIndex,\n i18nStrings,\n isLoadingNextStep = false,\n allowSkipTo = false,\n secondaryActions,\n onCancel,\n onSubmit,\n onNavigate,\n ...rest\n}: WizardProps) {\n const { __internalRootRef } = useBaseComponent('Wizard');\n const baseProps = getBaseProps(rest);\n const funnelId = baseProps.id;\n\n const [breakpoint, breakpointsRef] = useContainerBreakpoints(['xs']);\n const ref = useMergeRefs(breakpointsRef, __internalRootRef);\n\n const smallContainer = breakpoint === 'default';\n\n const [activeStepIndex, setActiveStepIndex] = useControllable(controlledActiveStepIndex, onNavigate, 0, {\n componentName: 'Wizard',\n controlledProp: 'activeStepIndex',\n changeHandler: 'onNavigate',\n });\n const actualActiveStepIndex = activeStepIndex ? Math.min(activeStepIndex, steps.length - 1) : 0;\n\n const farthestStepIndex = useRef<number>(actualActiveStepIndex);\n farthestStepIndex.current = Math.max(farthestStepIndex.current, actualActiveStepIndex);\n\n const isVisualRefresh = useVisualRefresh();\n const isLastStep = actualActiveStepIndex >= steps.length - 1;\n\n const navigationEvent = (requestedStepIndex: number, reason: WizardProps.NavigationReason) => {\n trackNavigate(actualActiveStepIndex, requestedStepIndex, reason, funnelId);\n setActiveStepIndex(requestedStepIndex);\n fireNonCancelableEvent(onNavigate, { requestedStepIndex, reason });\n };\n const onStepClick = (stepIndex: number) => navigationEvent(stepIndex, 'step');\n const onSkipToClick = (stepIndex: number) => navigationEvent(stepIndex, 'skip');\n const onCancelClick = () => {\n trackCancel(actualActiveStepIndex, funnelId);\n fireNonCancelableEvent(onCancel);\n };\n const onPreviousClick = () => navigationEvent(actualActiveStepIndex - 1, 'previous');\n const onPrimaryClick = () => {\n if (isLastStep) {\n trackSubmit(actualActiveStepIndex, funnelId);\n fireNonCancelableEvent(onSubmit);\n } else {\n navigationEvent(actualActiveStepIndex + 1, 'next');\n }\n };\n\n if (activeStepIndex && activeStepIndex >= steps.length) {\n warnOnce(\n 'Wizard',\n `You have set \\`activeStepIndex\\` to ${activeStepIndex} but you have provided only ${\n steps.length\n } steps. Its value is ignored and the component uses ${steps.length - 1} instead.`\n );\n }\n\n if (allowSkipTo && !i18nStrings.skipToButtonLabel) {\n warnOnce(\n 'Wizard',\n `You have set \\`allowSkipTo\\` but you have not provided \\`i18nStrings.skipToButtonLabel\\`. The skip-to button will not be rendered.`\n );\n }\n\n useEffect(() => {\n trackStartWizard();\n\n return () => {\n trackEndWizard(funnelId);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- this is intentional\n }, []);\n\n useEffect(() => {\n trackStartStep(actualActiveStepIndex, funnelId);\n }, [actualActiveStepIndex, funnelId]);\n\n return (\n <div {...baseProps} className={clsx(styles.root, baseProps.className)} ref={ref}>\n <div\n className={clsx(styles.wizard, isVisualRefresh && styles.refresh, smallContainer && styles['small-container'])}\n >\n <WizardNavigation\n activeStepIndex={actualActiveStepIndex}\n farthestStepIndex={farthestStepIndex.current}\n allowSkipTo={allowSkipTo}\n hidden={smallContainer}\n i18nStrings={i18nStrings}\n isVisualRefresh={isVisualRefresh}\n isLoadingNextStep={isLoadingNextStep}\n onStepClick={onStepClick}\n onSkipToClick={onSkipToClick}\n steps={steps}\n />\n <div\n className={clsx(styles.form, isVisualRefresh && styles.refresh, smallContainer && styles['small-container'])}\n >\n {isVisualRefresh && <div className={clsx(styles.background, 'awsui-context-content-header')} />}\n\n <WizardForm\n steps={steps}\n isVisualRefresh={isVisualRefresh}\n showCollapsedSteps={smallContainer}\n i18nStrings={i18nStrings}\n activeStepIndex={actualActiveStepIndex}\n isPrimaryLoading={isLoadingNextStep}\n allowSkipTo={allowSkipTo}\n secondaryActions={secondaryActions}\n onCancelClick={onCancelClick}\n onPreviousClick={onPreviousClick}\n onSkipToClick={onSkipToClick}\n onPrimaryClick={onPrimaryClick}\n />\n </div>\n </div>\n </div>\n );\n}\n\napplyDisplayName(Wizard, 'Wizard');\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/wizard/index.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;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AAEnD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAA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S,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,GAAG;QAC7E,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,IAAI,MAAM,CAAC,OAAO,EAAE,cAAc,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC;YAE9G,oBAAC,gBAAgB,IACf,eAAe,EAAE,qBAAqB,EACtC,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,EAC5C,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,cAAc,EACtB,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,eAAe,EAChC,iBAAiB,EAAE,iBAAiB,EACpC,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,KAAK,GACZ;YACF,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,IAAI,MAAM,CAAC,OAAO,EAAE,cAAc,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC;gBAE3G,eAAe,IAAI,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,8BAA8B,CAAC,GAAI;gBAE/F,oBAAC,UAAU,IACT,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,eAAe,EAChC,kBAAkB,EAAE,cAAc,EAClC,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,qBAAqB,EACtC,gBAAgB,EAAE,iBAAiB,EACnC,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,GAC9B,CACE,CACF,CACF,CACP,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,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';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { warnOnce } from '../internal/logging';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport WizardForm from './wizard-form';\nimport WizardNavigation from './wizard-navigation';\nimport { WizardProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\n\nimport {\n trackStartStep,\n trackNavigate,\n trackSubmit,\n trackStartWizard,\n trackEndWizard,\n trackCancel,\n} from './internal/analytics';\nimport { useInternalI18n } from '../internal/i18n/context';\n\nexport { WizardProps };\n\nexport default function Wizard({\n steps,\n activeStepIndex: controlledActiveStepIndex,\n isLoadingNextStep = false,\n allowSkipTo = false,\n secondaryActions,\n onCancel,\n onSubmit,\n onNavigate,\n ...rest\n}: WizardProps) {\n const { __internalRootRef } = useBaseComponent('Wizard');\n const baseProps = getBaseProps(rest);\n const funnelId = baseProps.id;\n\n const [breakpoint, breakpointsRef] = useContainerBreakpoints(['xs']);\n const ref = useMergeRefs(breakpointsRef, __internalRootRef);\n\n const smallContainer = breakpoint === 'default';\n\n const [activeStepIndex, setActiveStepIndex] = useControllable(controlledActiveStepIndex, onNavigate, 0, {\n componentName: 'Wizard',\n controlledProp: 'activeStepIndex',\n changeHandler: 'onNavigate',\n });\n const actualActiveStepIndex = activeStepIndex ? Math.min(activeStepIndex, steps.length - 1) : 0;\n\n const farthestStepIndex = useRef<number>(actualActiveStepIndex);\n farthestStepIndex.current = Math.max(farthestStepIndex.current, actualActiveStepIndex);\n\n const isVisualRefresh = useVisualRefresh();\n const isLastStep = actualActiveStepIndex >= steps.length - 1;\n\n const navigationEvent = (requestedStepIndex: number, reason: WizardProps.NavigationReason) => {\n trackNavigate(actualActiveStepIndex, requestedStepIndex, reason, funnelId);\n setActiveStepIndex(requestedStepIndex);\n fireNonCancelableEvent(onNavigate, { requestedStepIndex, reason });\n };\n const onStepClick = (stepIndex: number) => navigationEvent(stepIndex, 'step');\n const onSkipToClick = (stepIndex: number) => navigationEvent(stepIndex, 'skip');\n const onCancelClick = () => {\n trackCancel(actualActiveStepIndex, funnelId);\n fireNonCancelableEvent(onCancel);\n };\n const onPreviousClick = () => navigationEvent(actualActiveStepIndex - 1, 'previous');\n const onPrimaryClick = () => {\n if (isLastStep) {\n trackSubmit(actualActiveStepIndex, funnelId);\n fireNonCancelableEvent(onSubmit);\n } else {\n navigationEvent(actualActiveStepIndex + 1, 'next');\n }\n };\n\n const i18n = useInternalI18n('wizard');\n const i18nStrings: WizardProps.I18nStrings = {\n ...rest.i18nStrings,\n stepNumberLabel: i18n('i18nStrings.stepNumberLabel', rest.i18nStrings.stepNumberLabel),\n collapsedStepsLabel: i18n('i18nStrings.collapsedStepsLabel', rest.i18nStrings.collapsedStepsLabel),\n cancelButton: i18n('i18nStrings.cancelButton', rest.i18nStrings.cancelButton),\n previousButton: i18n('i18nStrings.previousButton', rest.i18nStrings.previousButton),\n nextButton: i18n('i18nStrings.nextButton', rest.i18nStrings.nextButton),\n optional: i18n('i18nStrings.optional', rest.i18nStrings.optional),\n };\n\n if (activeStepIndex && activeStepIndex >= steps.length) {\n warnOnce(\n 'Wizard',\n `You have set \\`activeStepIndex\\` to ${activeStepIndex} but you have provided only ${\n steps.length\n } steps. Its value is ignored and the component uses ${steps.length - 1} instead.`\n );\n }\n\n if (allowSkipTo && !i18nStrings.skipToButtonLabel) {\n warnOnce(\n 'Wizard',\n `You have set \\`allowSkipTo\\` but you have not provided \\`i18nStrings.skipToButtonLabel\\`. The skip-to button will not be rendered.`\n );\n }\n\n useEffect(() => {\n trackStartWizard();\n\n return () => {\n trackEndWizard(funnelId);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- this is intentional\n }, []);\n\n useEffect(() => {\n trackStartStep(actualActiveStepIndex, funnelId);\n }, [actualActiveStepIndex, funnelId]);\n\n return (\n <div {...baseProps} className={clsx(styles.root, baseProps.className)} ref={ref}>\n <div\n className={clsx(styles.wizard, isVisualRefresh && styles.refresh, smallContainer && styles['small-container'])}\n >\n <WizardNavigation\n activeStepIndex={actualActiveStepIndex}\n farthestStepIndex={farthestStepIndex.current}\n allowSkipTo={allowSkipTo}\n hidden={smallContainer}\n i18nStrings={i18nStrings}\n isVisualRefresh={isVisualRefresh}\n isLoadingNextStep={isLoadingNextStep}\n onStepClick={onStepClick}\n onSkipToClick={onSkipToClick}\n steps={steps}\n />\n <div\n className={clsx(styles.form, isVisualRefresh && styles.refresh, smallContainer && styles['small-container'])}\n >\n {isVisualRefresh && <div className={clsx(styles.background, 'awsui-context-content-header')} />}\n\n <WizardForm\n steps={steps}\n isVisualRefresh={isVisualRefresh}\n showCollapsedSteps={smallContainer}\n i18nStrings={i18nStrings}\n activeStepIndex={actualActiveStepIndex}\n isPrimaryLoading={isLoadingNextStep}\n allowSkipTo={allowSkipTo}\n secondaryActions={secondaryActions}\n onCancelClick={onCancelClick}\n onPreviousClick={onPreviousClick}\n onSkipToClick={onSkipToClick}\n onPrimaryClick={onPrimaryClick}\n />\n </div>\n </div>\n </div>\n );\n}\n\napplyDisplayName(Wizard, 'Wizard');\n"]}
|
package/wizard/interfaces.d.ts
CHANGED
|
@@ -99,14 +99,14 @@ export declare namespace WizardProps {
|
|
|
99
99
|
isOptional?: boolean;
|
|
100
100
|
}
|
|
101
101
|
interface I18nStrings {
|
|
102
|
-
stepNumberLabel(stepNumber: number): string;
|
|
103
|
-
collapsedStepsLabel(stepNumber: number, stepsCount: number): string;
|
|
102
|
+
stepNumberLabel?(stepNumber: number): string;
|
|
103
|
+
collapsedStepsLabel?(stepNumber: number, stepsCount: number): string;
|
|
104
104
|
skipToButtonLabel?(targetStep: WizardProps.Step, targetStepNumber: number): string;
|
|
105
105
|
navigationAriaLabel?: string;
|
|
106
106
|
errorIconAriaLabel?: string;
|
|
107
|
-
cancelButton
|
|
108
|
-
previousButton
|
|
109
|
-
nextButton
|
|
107
|
+
cancelButton?: string;
|
|
108
|
+
previousButton?: string;
|
|
109
|
+
nextButton?: string;
|
|
110
110
|
submitButton: string;
|
|
111
111
|
optional?: string;
|
|
112
112
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/wizard/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,WAAY,SAAQ,kBAAkB;IACrD;;;;;;;;;;;;OAYG;IACH,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAEvC;;;;;;;;;;OAUG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;;;;;;;;;;;;;OAiBG;IACH,WAAW,EAAE,WAAW,CAAC,WAAW,CAAC;IAErC;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEnC;;;OAGG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IAErC;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,yBAAyB,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;CACpE;AAED,yBAAiB,WAAW,CAAC;IAC3B,UAAiB,IAAI;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QACv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S,CAAC;QACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QAC9B,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;QACzB,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QAC5B,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB;IAED,UAAiB,WAAW;QAC1B,eAAe,CAAC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;QAC7C,mBAAmB,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;QACrE,iBAAiB,CAAC,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,EAAE,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAAC;QACnF,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;IAED,UAAiB,cAAc;QAC7B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,MAAM,EAAE,WAAW,CAAC,gBAAgB,CAAC;KACtC;IAED,KAAY,gBAAgB,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;CACtE"}
|
package/wizard/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/wizard/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface WizardProps extends BaseComponentProps {\n /**\n * Array of step objects. Each object represents a step in the wizard with the following properties:\n *\n * - `title` (string) - Text that's displayed as the title in the navigation pane and form header.\n * - `info` (ReactNode) - (Optional) Area for a page level info link that's displayed in the form header.\n * The page level info link should trigger the default help panel content for the step. Use the [link component](/components/link/) to display the link.\n * - `description` (ReactNode) - (Optional) Area below the form header for a page level description text to further explain the purpose, goal, or main actions of the step.\n * - `content` (ReactNode) - Main content area to display form sections, form fields, and controls.\n * - `errorText` (ReactNode) - (Optional) Error text that's displayed in a page level error alert.\n * Use this for rendering actionable server-side validation failure messages.\n * - `isOptional` (boolean) - Specifies whether the step is optional or required. If set to `true`, the text from `i18nStrings.optional`\n * is rendered next to the `title` in the navigation step label and the form header title.\n */\n steps: ReadonlyArray<WizardProps.Step>;\n\n /**\n * Index of the step that's currently displayed. The first step has an index of zero (0).\n *\n * If you don't set this property, the component starts on the first step and switches step automatically\n * when a user navigates using the buttons or an enabled step link in the navigation pane (that is, uncontrolled behavior).\n *\n * If you provide a value for this property, you must also set an `onNavigate` listener to update the property when\n * a user navigates (that is, controlled behavior).\n *\n * If you set it to a value that exceeds the maximum value (that is, the number of steps minus 1), its value is ignored and the component uses the maximum value.\n */\n activeStepIndex?: number;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n *\n * - `stepNumberLabel` ((stepNumber: number) => string) - A function that accepts a number (1-based indexing),\n * and returns a human-readable, localized string displaying the step number in the navigation pane. For example, \"Step 1\" or \"Step 2\".\n * - `collapsedStepsLabel` ((stepNumber: number, stepsCount: number) => string) - A function that accepts two number parameters (1-based indexing),\n * and returns a string responsible for the navigation summary on smaller screens. For example, \"Step 1 of 3\". The parameters are as follows:\n * - `stepNumber` (number) - The step number that the user is currently on.\n * - `stepsCount` (number) - The total number of steps in the wizard.\n * - `skipToButtonLabel`: ((targetStep: WizardProps.Step, targetStepNumber: number) => string) - An optional function that accepts the target step object\n * and the target step number (1-based indexing), and returns a string to be used as the *skip-to* button label. For example, \"Skip to Step 2\" or \"Skip to end\".\n * - `navigationAriaLabel` (string) - The aria label for the navigation pane.\n * - `cancelButton` (string) - The text of the button that enables the user to exit the flow.\n * - `previousButton` (string) - The text of the button that enables the user to return to the previous step.\n * - `nextButton` (string) - The text of the button that enables the user to move to the next step.\n * - `submitButton` (string) - The text of the button that enables the user to submit the form.\n * - `optional` (string) - The text displayed next to the step title and form header title when a step is declared optional.\n */\n i18nStrings: WizardProps.I18nStrings;\n\n /**\n * Renders the *next* or *submit* button in a loading state.\n *\n * Use this if you need to wait for a response from the server before the user can proceed to the next step, such as during server-side validation or retrieving the next step's information.\n */\n isLoadingNextStep?: boolean;\n\n /**\n * When set to `false`, the *skip-to* button is never shown.\n * When set to `true`, the *skip-to* button may appear to offer faster navigation for the user.\n *\n * The *skip-to* button only allows to skip optional steps. It is shown when there is one or more optional\n * steps ahead having no required steps in-between.\n *\n * Note: the *skip-to* button requires the function i18nStrings.skipToButtonLabel to be defined.\n *\n * Defaults to `false`.\n */\n allowSkipTo?: boolean;\n\n /**\n * Specifies left-aligned secondary actions for the wizard. Use a button dropdown if multiple actions are required.\n */\n secondaryActions?: React.ReactNode;\n\n /**\n * Called when a user clicks the *cancel* button.\n * If a user has entered data in the form, you should prompt the user with a modal before exiting the wizard flow.\n */\n onCancel?: NonCancelableEventHandler;\n\n /**\n * Called when a user clicks the *submit* button.\n */\n onSubmit?: NonCancelableEventHandler;\n\n /**\n * Called when a user clicks the *next* button, the *previous* button, or an enabled step link in the navigation pane.\n *\n * The event `detail` includes the following:\n * - `requestedStepIndex` - The index of the requested step.\n * - `reason` - The user action that triggered the navigation event. It can be `next` (when the user clicks the *next* button),\n * `previous` (when the user clicks the *previous* button), `step` (an enabled step link in the navigation pane),\n * or `skip` (when navigated using navigation pane or the *skip-to* button to the previously unvisited step).\n */\n onNavigate?: NonCancelableEventHandler<WizardProps.NavigateDetail>;\n}\n\nexport namespace WizardProps {\n export interface Step {\n title: string;\n info?: React.ReactNode;\n description?: React.ReactNode;\n content: React.ReactNode;\n errorText?: React.ReactNode;\n isOptional?: boolean;\n }\n\n export interface I18nStrings {\n stepNumberLabel(stepNumber: number): string;\n collapsedStepsLabel(stepNumber: number, stepsCount: number): string;\n skipToButtonLabel?(targetStep: WizardProps.Step, targetStepNumber: number): string;\n navigationAriaLabel?: string;\n errorIconAriaLabel?: string;\n cancelButton
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/wizard/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface WizardProps extends BaseComponentProps {\n /**\n * Array of step objects. Each object represents a step in the wizard with the following properties:\n *\n * - `title` (string) - Text that's displayed as the title in the navigation pane and form header.\n * - `info` (ReactNode) - (Optional) Area for a page level info link that's displayed in the form header.\n * The page level info link should trigger the default help panel content for the step. Use the [link component](/components/link/) to display the link.\n * - `description` (ReactNode) - (Optional) Area below the form header for a page level description text to further explain the purpose, goal, or main actions of the step.\n * - `content` (ReactNode) - Main content area to display form sections, form fields, and controls.\n * - `errorText` (ReactNode) - (Optional) Error text that's displayed in a page level error alert.\n * Use this for rendering actionable server-side validation failure messages.\n * - `isOptional` (boolean) - Specifies whether the step is optional or required. If set to `true`, the text from `i18nStrings.optional`\n * is rendered next to the `title` in the navigation step label and the form header title.\n */\n steps: ReadonlyArray<WizardProps.Step>;\n\n /**\n * Index of the step that's currently displayed. The first step has an index of zero (0).\n *\n * If you don't set this property, the component starts on the first step and switches step automatically\n * when a user navigates using the buttons or an enabled step link in the navigation pane (that is, uncontrolled behavior).\n *\n * If you provide a value for this property, you must also set an `onNavigate` listener to update the property when\n * a user navigates (that is, controlled behavior).\n *\n * If you set it to a value that exceeds the maximum value (that is, the number of steps minus 1), its value is ignored and the component uses the maximum value.\n */\n activeStepIndex?: number;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n *\n * - `stepNumberLabel` ((stepNumber: number) => string) - A function that accepts a number (1-based indexing),\n * and returns a human-readable, localized string displaying the step number in the navigation pane. For example, \"Step 1\" or \"Step 2\".\n * - `collapsedStepsLabel` ((stepNumber: number, stepsCount: number) => string) - A function that accepts two number parameters (1-based indexing),\n * and returns a string responsible for the navigation summary on smaller screens. For example, \"Step 1 of 3\". The parameters are as follows:\n * - `stepNumber` (number) - The step number that the user is currently on.\n * - `stepsCount` (number) - The total number of steps in the wizard.\n * - `skipToButtonLabel`: ((targetStep: WizardProps.Step, targetStepNumber: number) => string) - An optional function that accepts the target step object\n * and the target step number (1-based indexing), and returns a string to be used as the *skip-to* button label. For example, \"Skip to Step 2\" or \"Skip to end\".\n * - `navigationAriaLabel` (string) - The aria label for the navigation pane.\n * - `cancelButton` (string) - The text of the button that enables the user to exit the flow.\n * - `previousButton` (string) - The text of the button that enables the user to return to the previous step.\n * - `nextButton` (string) - The text of the button that enables the user to move to the next step.\n * - `submitButton` (string) - The text of the button that enables the user to submit the form.\n * - `optional` (string) - The text displayed next to the step title and form header title when a step is declared optional.\n */\n i18nStrings: WizardProps.I18nStrings;\n\n /**\n * Renders the *next* or *submit* button in a loading state.\n *\n * Use this if you need to wait for a response from the server before the user can proceed to the next step, such as during server-side validation or retrieving the next step's information.\n */\n isLoadingNextStep?: boolean;\n\n /**\n * When set to `false`, the *skip-to* button is never shown.\n * When set to `true`, the *skip-to* button may appear to offer faster navigation for the user.\n *\n * The *skip-to* button only allows to skip optional steps. It is shown when there is one or more optional\n * steps ahead having no required steps in-between.\n *\n * Note: the *skip-to* button requires the function i18nStrings.skipToButtonLabel to be defined.\n *\n * Defaults to `false`.\n */\n allowSkipTo?: boolean;\n\n /**\n * Specifies left-aligned secondary actions for the wizard. Use a button dropdown if multiple actions are required.\n */\n secondaryActions?: React.ReactNode;\n\n /**\n * Called when a user clicks the *cancel* button.\n * If a user has entered data in the form, you should prompt the user with a modal before exiting the wizard flow.\n */\n onCancel?: NonCancelableEventHandler;\n\n /**\n * Called when a user clicks the *submit* button.\n */\n onSubmit?: NonCancelableEventHandler;\n\n /**\n * Called when a user clicks the *next* button, the *previous* button, or an enabled step link in the navigation pane.\n *\n * The event `detail` includes the following:\n * - `requestedStepIndex` - The index of the requested step.\n * - `reason` - The user action that triggered the navigation event. It can be `next` (when the user clicks the *next* button),\n * `previous` (when the user clicks the *previous* button), `step` (an enabled step link in the navigation pane),\n * or `skip` (when navigated using navigation pane or the *skip-to* button to the previously unvisited step).\n */\n onNavigate?: NonCancelableEventHandler<WizardProps.NavigateDetail>;\n}\n\nexport namespace WizardProps {\n export interface Step {\n title: string;\n info?: React.ReactNode;\n description?: React.ReactNode;\n content: React.ReactNode;\n errorText?: React.ReactNode;\n isOptional?: boolean;\n }\n\n export interface I18nStrings {\n stepNumberLabel?(stepNumber: number): string;\n collapsedStepsLabel?(stepNumber: number, stepsCount: number): string;\n skipToButtonLabel?(targetStep: WizardProps.Step, targetStepNumber: number): string;\n navigationAriaLabel?: string;\n errorIconAriaLabel?: string;\n cancelButton?: string;\n previousButton?: string;\n nextButton?: string;\n submitButton: string;\n optional?: string;\n }\n\n export interface NavigateDetail {\n requestedStepIndex: number;\n reason: WizardProps.NavigationReason;\n }\n\n export type NavigationReason = 'next' | 'previous' | 'step' | 'skip';\n}\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
interface WizardActionsProps {
|
|
3
|
-
cancelButtonText
|
|
3
|
+
cancelButtonText?: string;
|
|
4
4
|
onCancelClick: () => void;
|
|
5
5
|
isPrimaryLoading: boolean;
|
|
6
|
-
primaryButtonText
|
|
6
|
+
primaryButtonText?: string;
|
|
7
7
|
onPrimaryClick: () => void;
|
|
8
8
|
showPrevious: boolean;
|
|
9
|
-
previousButtonText
|
|
9
|
+
previousButtonText?: string;
|
|
10
10
|
onPreviousClick: () => void;
|
|
11
11
|
showSkipTo: boolean;
|
|
12
12
|
skipToButtonText?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wizard-actions.d.ts","sourceRoot":"","sources":["../../../src/wizard/wizard-actions.tsx"],"names":[],"mappings":";AASA,UAAU,kBAAkB;IAC1B,gBAAgB,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"wizard-actions.d.ts","sourceRoot":"","sources":["../../../src/wizard/wizard-actions.tsx"],"names":[],"mappings":";AASA,UAAU,kBAAkB;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,YAAY,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,aAAa,GACd,EAAE,kBAAkB,eA2DpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wizard-actions.js","sourceRoot":"","sources":["../../../src/wizard/wizard-actions.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,OA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oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EACnC,OAAO,EAAE,aAAa,EACtB,UAAU,EAAC,MAAM,EACjB,QAAQ,EAAE,gBAAgB,IAEzB,gBAAgB,CACF,CACT,CACX;YACA,YAAY,IAAI,CACf,oBAAC,OAAO,IAAC,SAAS,EAAE,iBAAiB;gBACnC,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,EACpC,OAAO,EAAE,eAAe,EACxB,UAAU,EAAC,MAAM,EACjB,QAAQ,EAAE,gBAAgB,IAEzB,kBAAkB,CACJ,CACT,CACX;YACD,oBAAC,cAAc,IACb,GAAG,EAAE,gBAAgB,EACrB,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EACnC,OAAO,EAAC,SAAS,EACjB,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,gBAAgB,IAExB,iBAAiB,CACH,CACI,CACnB,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport { InternalButton } from '../button/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport styles from './styles.css.js';\nimport { ButtonProps } from '../button/interfaces';\nimport Unmount from './unmount';\n\ninterface WizardActionsProps {\n cancelButtonText
|
|
1
|
+
{"version":3,"file":"wizard-actions.js","sourceRoot":"","sources":["../../../src/wizard/wizard-actions.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,OAAO,MAAM,WAAW,CAAC;AAgBhC,MAAM,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CAAC,gBAAgB,CAAC,EACnC,OAAO,EAAE,aAAa,EACtB,UAAU,EAAC,MAAM,EACjB,QAAQ,EAAE,gBAAgB,IAEzB,gBAAgB,CACF,CACT,CACX;YACA,YAAY,IAAI,CACf,oBAAC,OAAO,IAAC,SAAS,EAAE,iBAAiB;gBACnC,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,EACpC,OAAO,EAAE,eAAe,EACxB,UAAU,EAAC,MAAM,EACjB,QAAQ,EAAE,gBAAgB,IAEzB,kBAAkB,CACJ,CACT,CACX;YACD,oBAAC,cAAc,IACb,GAAG,EAAE,gBAAgB,EACrB,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EACnC,OAAO,EAAC,SAAS,EACjB,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,gBAAgB,IAExB,iBAAiB,CACH,CACI,CACnB,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport { InternalButton } from '../button/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport styles from './styles.css.js';\nimport { ButtonProps } from '../button/interfaces';\nimport Unmount from './unmount';\n\ninterface WizardActionsProps {\n cancelButtonText?: string;\n onCancelClick: () => void;\n isPrimaryLoading: boolean;\n primaryButtonText?: string;\n onPrimaryClick: () => void;\n showPrevious: boolean;\n previousButtonText?: string;\n onPreviousClick: () => void;\n showSkipTo: boolean;\n skipToButtonText?: string;\n onSkipToClick: () => void;\n}\n\nexport default function WizardActions({\n cancelButtonText,\n onCancelClick,\n isPrimaryLoading,\n primaryButtonText,\n onPrimaryClick,\n showPrevious,\n previousButtonText,\n onPreviousClick,\n showSkipTo,\n skipToButtonText,\n onSkipToClick,\n}: WizardActionsProps) {\n const containerRef = useRef<HTMLDivElement>(null);\n const primaryButtonRef = useRef<ButtonProps.Ref>(null);\n\n const onPreviousUnmount = () => {\n if (containerRef.current?.querySelector(`.${styles['previous-button']}`) === document.activeElement) {\n primaryButtonRef.current?.focus();\n }\n };\n\n const onSkipUnmount = () => {\n if (containerRef.current?.querySelector(`.${styles['skip-to-button']}`) === document.activeElement) {\n primaryButtonRef.current?.focus();\n }\n };\n\n return (\n <div ref={containerRef}>\n <InternalSpaceBetween direction=\"horizontal\" size=\"xs\" className={styles['action-buttons']}>\n <InternalButton className={styles['cancel-button']} variant=\"link\" formAction=\"none\" onClick={onCancelClick}>\n {cancelButtonText}\n </InternalButton>\n {showSkipTo && skipToButtonText && (\n <Unmount onUnmount={onSkipUnmount}>\n <InternalButton\n className={styles['skip-to-button']}\n onClick={onSkipToClick}\n formAction=\"none\"\n disabled={isPrimaryLoading}\n >\n {skipToButtonText}\n </InternalButton>\n </Unmount>\n )}\n {showPrevious && (\n <Unmount onUnmount={onPreviousUnmount}>\n <InternalButton\n className={styles['previous-button']}\n onClick={onPreviousClick}\n formAction=\"none\"\n disabled={isPrimaryLoading}\n >\n {previousButtonText}\n </InternalButton>\n </Unmount>\n )}\n <InternalButton\n ref={primaryButtonRef}\n className={styles['primary-button']}\n variant=\"primary\"\n formAction=\"none\"\n onClick={onPrimaryClick}\n loading={isPrimaryLoading}\n >\n {primaryButtonText}\n </InternalButton>\n </InternalSpaceBetween>\n </div>\n );\n}\n"]}
|
package/wizard/wizard-form.js
CHANGED
|
@@ -11,6 +11,7 @@ import styles from './styles.css.js';
|
|
|
11
11
|
import useFocusVisible from '../internal/hooks/focus-visible';
|
|
12
12
|
import { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update';
|
|
13
13
|
export default function WizardForm({ steps, activeStepIndex, isVisualRefresh, showCollapsedSteps, i18nStrings, isPrimaryLoading, allowSkipTo, secondaryActions, onCancelClick, onPreviousClick, onPrimaryClick, onSkipToClick, }) {
|
|
14
|
+
var _a;
|
|
14
15
|
const { title, info, description, content, errorText, isOptional } = steps[activeStepIndex] || {};
|
|
15
16
|
const isLastStep = activeStepIndex >= steps.length - 1;
|
|
16
17
|
const skipToTargetIndex = findSkipToTargetIndex(steps, activeStepIndex);
|
|
@@ -29,7 +30,7 @@ export default function WizardForm({ steps, activeStepIndex, isVisualRefresh, sh
|
|
|
29
30
|
: undefined;
|
|
30
31
|
return (React.createElement(React.Fragment, null,
|
|
31
32
|
React.createElement(WizardFormHeader, { isMobile: isMobile || showCollapsedSteps, isVisualRefresh: isVisualRefresh },
|
|
32
|
-
React.createElement("div", { className: clsx(styles['collapsed-steps'], !showCollapsedSteps && styles['collapsed-steps-hidden'], isVisualRefresh && isMobile && styles['collapsed-steps-extra-padding']) }, i18nStrings.collapsedStepsLabel(activeStepIndex + 1, steps.length)),
|
|
33
|
+
React.createElement("div", { className: clsx(styles['collapsed-steps'], !showCollapsedSteps && styles['collapsed-steps-hidden'], isVisualRefresh && isMobile && styles['collapsed-steps-extra-padding']) }, (_a = i18nStrings.collapsedStepsLabel) === null || _a === void 0 ? void 0 : _a.call(i18nStrings, activeStepIndex + 1, steps.length)),
|
|
33
34
|
React.createElement(InternalHeader, { className: styles['form-header-component'], variant: "h1", description: description, info: info },
|
|
34
35
|
React.createElement("span", Object.assign({ className: styles['form-header-component-wrapper'], tabIndex: -1, ref: stepHeaderRef }, focusVisible),
|
|
35
36
|
title,
|
|
@@ -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,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C,OAAO,gB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,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, { useRef } from 'react';\nimport clsx from 'clsx';\nimport InternalForm from '../form/internal';\nimport InternalHeader from '../header/internal';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport WizardActions from './wizard-actions';\nimport { WizardProps } from './interfaces';\nimport WizardFormHeader from './wizard-form-header';\nimport styles from './styles.css.js';\nimport useFocusVisible from '../internal/hooks/focus-visible';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update';\n\ninterface WizardFormProps {\n steps: ReadonlyArray<WizardProps.Step>;\n activeStepIndex: number;\n isVisualRefresh: boolean;\n showCollapsedSteps: boolean;\n i18nStrings: WizardProps.I18nStrings;\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 default function WizardForm({\n steps,\n activeStepIndex,\n isVisualRefresh,\n showCollapsedSteps,\n i18nStrings,\n isPrimaryLoading,\n allowSkipTo,\n secondaryActions,\n onCancelClick,\n onPreviousClick,\n onPrimaryClick,\n onSkipToClick,\n}: WizardFormProps) {\n const { title, info, description, content, errorText, isOptional } = steps[activeStepIndex] || {};\n const isLastStep = activeStepIndex >= steps.length - 1;\n const skipToTargetIndex = findSkipToTargetIndex(steps, activeStepIndex);\n const isMobile = useMobile();\n const stepHeaderRef = useRef<HTMLDivElement | null>(null);\n\n useEffectOnUpdate(() => {\n if (stepHeaderRef && stepHeaderRef.current) {\n stepHeaderRef.current?.focus();\n }\n }, [activeStepIndex]);\n\n const focusVisible = useFocusVisible();\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 return (\n <>\n <WizardFormHeader isMobile={isMobile || showCollapsedSteps} isVisualRefresh={isVisualRefresh}>\n <div\n className={clsx(\n styles['collapsed-steps'],\n !showCollapsedSteps && styles['collapsed-steps-hidden'],\n isVisualRefresh && isMobile && styles['collapsed-steps-extra-padding']\n )}\n >\n {i18nStrings.collapsedStepsLabel?.(activeStepIndex + 1, steps.length)}\n </div>\n <InternalHeader className={styles['form-header-component']} variant=\"h1\" description={description} info={info}>\n <span className={styles['form-header-component-wrapper']} tabIndex={-1} ref={stepHeaderRef} {...focusVisible}>\n {title}\n {isOptional && <i>{` - ${i18nStrings.optional}`}</i>}\n </span>\n </InternalHeader>\n </WizardFormHeader>\n <InternalForm\n className={clsx(styles['form-component'])}\n actions={\n <WizardActions\n cancelButtonText={i18nStrings.cancelButton}\n primaryButtonText={isLastStep ? i18nStrings.submitButton : i18nStrings.nextButton}\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 />\n }\n secondaryActions={secondaryActions}\n errorText={errorText}\n errorIconAriaLabel={i18nStrings.errorIconAriaLabel}\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"]}
|