@cloudscape-design/components 3.0.65 → 3.0.67

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.
Files changed (121) hide show
  1. package/annotation-context/annotation/annotation-popover.d.ts.map +1 -1
  2. package/annotation-context/annotation/annotation-popover.js +2 -2
  3. package/annotation-context/annotation/annotation-popover.js.map +1 -1
  4. package/autosuggest/interfaces.d.ts +2 -2
  5. package/autosuggest/interfaces.d.ts.map +1 -1
  6. package/autosuggest/interfaces.js.map +1 -1
  7. package/button-dropdown/tooltip.js +2 -2
  8. package/button-dropdown/tooltip.js.map +1 -1
  9. package/calendar/interfaces.d.ts +2 -1
  10. package/calendar/interfaces.d.ts.map +1 -1
  11. package/calendar/interfaces.js.map +1 -1
  12. package/calendar/internal.d.ts +2 -1
  13. package/calendar/internal.d.ts.map +1 -1
  14. package/calendar/internal.js +8 -3
  15. package/calendar/internal.js.map +1 -1
  16. package/cards/index.d.ts.map +1 -1
  17. package/cards/index.js +15 -5
  18. package/cards/index.js.map +1 -1
  19. package/checkbox/base-checkbox.d.ts +1 -5
  20. package/checkbox/base-checkbox.d.ts.map +1 -1
  21. package/checkbox/base-checkbox.js.map +1 -1
  22. package/checkbox/internal.d.ts.map +1 -1
  23. package/checkbox/internal.js +3 -1
  24. package/checkbox/internal.js.map +1 -1
  25. package/container/internal.d.ts +2 -1
  26. package/container/internal.d.ts.map +1 -1
  27. package/container/internal.js +3 -2
  28. package/container/internal.js.map +1 -1
  29. package/date-input/index.d.ts.map +1 -1
  30. package/date-input/index.js +3 -4
  31. package/date-input/index.js.map +1 -1
  32. package/date-input/internal.d.ts.map +1 -1
  33. package/date-input/internal.js +2 -2
  34. package/date-input/internal.js.map +1 -1
  35. package/date-range-picker/calendar/index.js +2 -2
  36. package/date-range-picker/calendar/index.js.map +1 -1
  37. package/form-field/internal.d.ts.map +1 -1
  38. package/form-field/internal.js +2 -2
  39. package/form-field/internal.js.map +1 -1
  40. package/index.d.ts +2 -0
  41. package/index.d.ts.map +1 -1
  42. package/index.js +2 -0
  43. package/index.js.map +1 -1
  44. package/input/interfaces.d.ts +11 -9
  45. package/input/interfaces.d.ts.map +1 -1
  46. package/input/interfaces.js.map +1 -1
  47. package/input/internal.d.ts +2 -2
  48. package/input/internal.d.ts.map +1 -1
  49. package/input/internal.js +7 -0
  50. package/input/internal.js.map +1 -1
  51. package/internal/components/autosuggest-input/index.d.ts +2 -2
  52. package/internal/components/autosuggest-input/index.d.ts.map +1 -1
  53. package/internal/components/autosuggest-input/index.js.map +1 -1
  54. package/internal/components/chart-popover/index.js +2 -2
  55. package/internal/components/chart-popover/index.js.map +1 -1
  56. package/internal/components/dropdown-status/index.d.ts.map +1 -1
  57. package/internal/components/dropdown-status/index.js +1 -1
  58. package/internal/components/dropdown-status/index.js.map +1 -1
  59. package/internal/environment.js +1 -1
  60. package/link/interfaces.d.ts +1 -1
  61. package/link/interfaces.d.ts.map +1 -1
  62. package/link/interfaces.js.map +1 -1
  63. package/link/styles.css.js +20 -19
  64. package/link/styles.scoped.css +75 -70
  65. package/link/styles.selectors.js +20 -19
  66. package/package.json +3 -1
  67. package/popover/body.d.ts +1 -4
  68. package/popover/body.d.ts.map +1 -1
  69. package/popover/body.js +2 -4
  70. package/popover/body.js.map +1 -1
  71. package/popover/container.d.ts +4 -1
  72. package/popover/container.d.ts.map +1 -1
  73. package/popover/container.js +51 -37
  74. package/popover/container.js.map +1 -1
  75. package/popover/internal.js +2 -2
  76. package/popover/internal.js.map +1 -1
  77. package/popover/styles.css.js +49 -48
  78. package/popover/styles.scoped.css +209 -89
  79. package/popover/styles.selectors.js +49 -48
  80. package/popover/utils/positions.d.ts +1 -0
  81. package/popover/utils/positions.d.ts.map +1 -1
  82. package/popover/utils/positions.js +40 -14
  83. package/popover/utils/positions.js.map +1 -1
  84. package/radio-group/interfaces.d.ts +5 -0
  85. package/radio-group/interfaces.d.ts.map +1 -1
  86. package/radio-group/interfaces.js.map +1 -1
  87. package/split-panel/index.js +8 -8
  88. package/split-panel/index.js.map +1 -1
  89. package/split-panel/styles.css.js +58 -58
  90. package/split-panel/styles.scoped.css +81 -80
  91. package/split-panel/styles.selectors.js +58 -58
  92. package/split-panel/utils/use-pointer-events.d.ts +3 -0
  93. package/split-panel/utils/use-pointer-events.d.ts.map +1 -0
  94. package/split-panel/utils/{use-mouse-events.js → use-pointer-events.js} +12 -12
  95. package/split-panel/utils/use-pointer-events.js.map +1 -0
  96. package/tag-editor/interfaces.d.ts +1 -1
  97. package/tag-editor/interfaces.d.ts.map +1 -1
  98. package/tag-editor/interfaces.js.map +1 -1
  99. package/test-utils/dom/form-field/index.js +1 -1
  100. package/test-utils/dom/form-field/index.js.map +1 -1
  101. package/test-utils/dom/index.d.ts +6 -0
  102. package/test-utils/dom/index.js +18 -2
  103. package/test-utils/dom/index.js.map +1 -1
  104. package/test-utils/selectors/form-field/index.js +1 -1
  105. package/test-utils/selectors/form-field/index.js.map +1 -1
  106. package/test-utils/selectors/index.d.ts +6 -0
  107. package/test-utils/selectors/index.js +18 -2
  108. package/test-utils/selectors/index.js.map +1 -1
  109. package/test-utils/tsconfig.tsbuildinfo +1 -1
  110. package/textarea/interfaces.d.ts +2 -2
  111. package/textarea/interfaces.d.ts.map +1 -1
  112. package/textarea/interfaces.js.map +1 -1
  113. package/time-input/interfaces.d.ts +2 -2
  114. package/time-input/interfaces.d.ts.map +1 -1
  115. package/time-input/interfaces.js.map +1 -1
  116. package/toggle/internal.d.ts.map +1 -1
  117. package/toggle/internal.js +3 -1
  118. package/toggle/internal.js.map +1 -1
  119. package/split-panel/utils/use-mouse-events.d.ts +0 -3
  120. package/split-panel/utils/use-mouse-events.d.ts.map +0 -1
  121. package/split-panel/utils/use-mouse-events.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"annotation-popover.d.ts","sourceRoot":"","sources":["../../../../src/annotation-context/annotation/annotation-popover.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAS3C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAKvD,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IAEvB,SAAS,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IAErC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAE9B,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAElC,kBAAkB,EAAE,MAAM,CAAC;IAE3B,eAAe,EAAE,MAAM,CAAC;IAExB,gBAAgB,EAAE,OAAO,CAAC;IAE1B,SAAS,EAAE,MAAM,IAAI,CAAC;IAEtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAEvC,WAAW,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC;CACpD;AASD,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAO,EACP,KAAK,EAEL,SAAiB,EAEjB,kBAAkB,EAElB,eAAe,EAEf,kBAAkB,EAClB,gBAAgB,EAEhB,SAAS,EAET,iBAAiB,EACjB,iBAAiB,EAEjB,QAAQ,EAER,QAAQ,EAER,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,GACZ,EAAE,sBAAsB,eA6FxB"}
1
+ {"version":3,"file":"annotation-popover.d.ts","sourceRoot":"","sources":["../../../../src/annotation-context/annotation/annotation-popover.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAS3C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAKvD,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IAEvB,SAAS,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IAErC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAE9B,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAElC,kBAAkB,EAAE,MAAM,CAAC;IAE3B,eAAe,EAAE,MAAM,CAAC;IAExB,gBAAgB,EAAE,OAAO,CAAC;IAE1B,SAAS,EAAE,MAAM,IAAI,CAAC;IAEtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAEvC,WAAW,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC;CACpD;AASD,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAO,EACP,KAAK,EAEL,SAAiB,EAEjB,kBAAkB,EAElB,eAAe,EAEf,kBAAkB,EAClB,gBAAgB,EAEhB,SAAS,EAET,iBAAiB,EACjB,iBAAiB,EAEjB,QAAQ,EAER,QAAQ,EAER,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,GACZ,EAAE,sBAAsB,eA8FxB"}
@@ -23,8 +23,8 @@ export function AnnotationPopover(_a) {
23
23
  scrollElementIntoView((_a = trackRef.current) !== null && _a !== void 0 ? _a : undefined);
24
24
  }
25
25
  }, [trackRef]);
26
- return (React.createElement(PopoverContainer, { position: direction, trackRef: trackRef, trackKey: taskLocalStepIndex, arrow: arrow, zIndex: 1000 },
27
- React.createElement(PopoverBody, { size: "medium", fixedWidth: false, dismissButton: true, dismissAriaLabel: i18nStrings.labelDismissAnnotation, header: React.createElement(InternalBox, { color: "text-body-secondary", fontSize: "body-s", margin: { top: 'xxxs' }, className: styles.header }, title), onDismiss: onDismiss, className: styles.annotation, variant: "annotation", overflowVisible: "content", dismissButtonRef: dismissButtonRefCallback },
26
+ return (React.createElement(PopoverContainer, { size: "medium", fixedWidth: false, position: direction, trackRef: trackRef, trackKey: taskLocalStepIndex, variant: "annotation", arrow: arrow, zIndex: 1000 },
27
+ React.createElement(PopoverBody, { dismissButton: true, dismissAriaLabel: i18nStrings.labelDismissAnnotation, header: React.createElement(InternalBox, { color: "text-body-secondary", fontSize: "body-s", margin: { top: 'xxxs' }, className: styles.header }, title), onDismiss: onDismiss, className: styles.annotation, variant: "annotation", overflowVisible: "content", dismissButtonRef: dismissButtonRefCallback },
28
28
  React.createElement(InternalSpaceBetween, { size: "s" },
29
29
  React.createElement("div", { className: styles.description },
30
30
  React.createElement(InternalBox, { className: styles.content }, content)),
@@ -1 +1 @@
1
- {"version":3,"file":"annotation-popover.js","sourceRoot":"","sources":["../../../../src/annotation-context/annotation/annotation-popover.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAChE,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AACvD,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAG7C,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AA+BnF,IAAM,KAAK,GAAG,UAAC,QAAiC,IAAK,OAAA,CACnD,6BAAK,SAAS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AAW,CAAC,kBAAkB,EACzC,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,IAEnC,WAAW,CAAC,kBAAkB,CAChB,CAClB;4BAEA,gBAAgB,CAAC,CAAC,CAAC,CAClB,oBAAC,cAAc,IACb,OAAO,EAAE,QAAQ,EACjB,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,WAAW,CAAC,gBAAgB,EACvC,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,IAEjC,WAAW,CAAC,gBAAgB,CACd,CAClB,CAAC,CAAC,CAAC,CACF,oBAAC,cAAc,IACb,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,CAAC,iBAAiB,EAC5B,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,WAAW,CAAC,cAAc,EACrC,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC,IAE/B,WAAW,CAAC,cAAc,CACZ,CAClB,CACoB,CACnB,CACe,CACF,CACX,CACG,CACpB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback } from 'react';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport InternalBox from '../../box/internal';\nimport { ButtonProps } from '../../button/interfaces';\nimport { InternalButton } from '../../button/internal';\nimport InternalSpaceBetween from '../../space-between/internal';\nimport PopoverContainer from '../../popover/container';\nimport PopoverBody from '../../popover/body';\nimport { HotspotProps } from '../../hotspot/interfaces';\nimport { AnnotationContextProps } from '../interfaces';\nimport InternalAlert from '../../alert/internal';\nimport { InternalPosition } from '../../popover/interfaces';\nimport { scrollElementIntoView } from '../../internal/utils/scrollable-containers';\n\nexport interface AnnotationPopoverProps {\n title: string;\n content: React.ReactNode;\n alert: React.ReactNode;\n\n direction: HotspotProps['direction'];\n\n nextButtonEnabled: boolean;\n onNextButtonClick: () => void;\n\n onFinish: () => void;\n\n showPreviousButton: boolean;\n previousButtonEnabled: boolean;\n onPreviousButtonClick: () => void;\n\n taskLocalStepIndex: number;\n\n totalLocalSteps: number;\n\n showFinishButton: boolean;\n\n onDismiss: () => void;\n\n trackRef: React.RefObject<HTMLElement>;\n\n i18nStrings: AnnotationContextProps['i18nStrings'];\n}\n\nconst arrow = (position: InternalPosition | null) => (\n <div className={clsx(styles.arrow, styles[`arrow-position-${position}`])}>\n <div className={styles['arrow-outer']} />\n <div className={styles['arrow-inner']} />\n </div>\n);\n\nexport function AnnotationPopover({\n title,\n content,\n alert,\n\n direction = 'top',\n\n taskLocalStepIndex,\n\n totalLocalSteps,\n\n showPreviousButton,\n showFinishButton,\n\n onDismiss,\n\n nextButtonEnabled,\n onNextButtonClick,\n\n onFinish,\n\n trackRef,\n\n previousButtonEnabled,\n onPreviousButtonClick,\n i18nStrings,\n}: AnnotationPopoverProps) {\n const dismissButtonRefCallback = useCallback(\n (element: ButtonProps.Ref) => {\n if (element) {\n element.focus({ preventScroll: true });\n // Falls back to alignTop on IE11\n scrollElementIntoView(trackRef.current ?? undefined);\n }\n },\n [trackRef]\n );\n\n return (\n <PopoverContainer\n position={direction}\n trackRef={trackRef}\n trackKey={taskLocalStepIndex}\n arrow={arrow}\n zIndex={1000}\n >\n <PopoverBody\n size=\"medium\"\n fixedWidth={false}\n dismissButton={true}\n dismissAriaLabel={i18nStrings.labelDismissAnnotation}\n header={\n <InternalBox color=\"text-body-secondary\" fontSize=\"body-s\" margin={{ top: 'xxxs' }} className={styles.header}>\n {title}\n </InternalBox>\n }\n onDismiss={onDismiss}\n className={styles.annotation}\n variant=\"annotation\"\n overflowVisible=\"content\"\n dismissButtonRef={dismissButtonRefCallback}\n >\n <InternalSpaceBetween size=\"s\">\n <div className={styles.description}>\n <InternalBox className={styles.content}>{content}</InternalBox>\n </div>\n\n {alert && <InternalAlert type=\"warning\">{alert}</InternalAlert>}\n\n <InternalSpaceBetween size=\"s\">\n <div className={styles.divider} />\n\n <div className={styles.actionBar}>\n <div className={styles.stepCounter}>\n <InternalBox className={styles['step-counter-content']} color=\"text-body-secondary\" fontSize=\"body-s\">\n {i18nStrings.stepCounterText(taskLocalStepIndex ?? 0, totalLocalSteps ?? 0)}\n </InternalBox>\n </div>\n <InternalSpaceBetween size=\"xs\" direction=\"horizontal\">\n {showPreviousButton && (\n <InternalButton\n variant=\"link\"\n onClick={onPreviousButtonClick}\n disabled={!previousButtonEnabled}\n formAction=\"none\"\n ariaLabel={i18nStrings.previousButtonText}\n className={styles['previous-button']}\n >\n {i18nStrings.previousButtonText}\n </InternalButton>\n )}\n\n {showFinishButton ? (\n <InternalButton\n onClick={onFinish}\n formAction=\"none\"\n ariaLabel={i18nStrings.finishButtonText}\n className={styles['finish-button']}\n >\n {i18nStrings.finishButtonText}\n </InternalButton>\n ) : (\n <InternalButton\n onClick={onNextButtonClick}\n disabled={!nextButtonEnabled}\n formAction=\"none\"\n ariaLabel={i18nStrings.nextButtonText}\n className={styles['next-button']}\n >\n {i18nStrings.nextButtonText}\n </InternalButton>\n )}\n </InternalSpaceBetween>\n </div>\n </InternalSpaceBetween>\n </InternalSpaceBetween>\n </PopoverBody>\n </PopoverContainer>\n );\n}\n"]}
1
+ {"version":3,"file":"annotation-popover.js","sourceRoot":"","sources":["../../../../src/annotation-context/annotation/annotation-popover.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAChE,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AACvD,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAG7C,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,qB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IACb,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,qBAAqB,EAC9B,QAAQ,EAAE,CAAC,qBAAqB,EAChC,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,WAAW,CAAC,kBAAkB,EACzC,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,IAEnC,WAAW,CAAC,kBAAkB,CAChB,CAClB;4BAEA,gBAAgB,CAAC,CAAC,CAAC,CAClB,oBAAC,cAAc,IACb,OAAO,EAAE,QAAQ,EACjB,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,WAAW,CAAC,gBAAgB,EACvC,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,IAEjC,WAAW,CAAC,gBAAgB,CACd,CAClB,CAAC,CAAC,CAAC,CACF,oBAAC,cAAc,IACb,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,CAAC,iBAAiB,EAC5B,UAAU,EAAC,MAAM,EACjB,SAAS,EAAE,WAAW,CAAC,cAAc,EACrC,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC,IAE/B,WAAW,CAAC,cAAc,CACZ,CAClB,CACoB,CACnB,CACe,CACF,CACX,CACG,CACpB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback } from 'react';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport InternalBox from '../../box/internal';\nimport { ButtonProps } from '../../button/interfaces';\nimport { InternalButton } from '../../button/internal';\nimport InternalSpaceBetween from '../../space-between/internal';\nimport PopoverContainer from '../../popover/container';\nimport PopoverBody from '../../popover/body';\nimport { HotspotProps } from '../../hotspot/interfaces';\nimport { AnnotationContextProps } from '../interfaces';\nimport InternalAlert from '../../alert/internal';\nimport { InternalPosition } from '../../popover/interfaces';\nimport { scrollElementIntoView } from '../../internal/utils/scrollable-containers';\n\nexport interface AnnotationPopoverProps {\n title: string;\n content: React.ReactNode;\n alert: React.ReactNode;\n\n direction: HotspotProps['direction'];\n\n nextButtonEnabled: boolean;\n onNextButtonClick: () => void;\n\n onFinish: () => void;\n\n showPreviousButton: boolean;\n previousButtonEnabled: boolean;\n onPreviousButtonClick: () => void;\n\n taskLocalStepIndex: number;\n\n totalLocalSteps: number;\n\n showFinishButton: boolean;\n\n onDismiss: () => void;\n\n trackRef: React.RefObject<HTMLElement>;\n\n i18nStrings: AnnotationContextProps['i18nStrings'];\n}\n\nconst arrow = (position: InternalPosition | null) => (\n <div className={clsx(styles.arrow, styles[`arrow-position-${position}`])}>\n <div className={styles['arrow-outer']} />\n <div className={styles['arrow-inner']} />\n </div>\n);\n\nexport function AnnotationPopover({\n title,\n content,\n alert,\n\n direction = 'top',\n\n taskLocalStepIndex,\n\n totalLocalSteps,\n\n showPreviousButton,\n showFinishButton,\n\n onDismiss,\n\n nextButtonEnabled,\n onNextButtonClick,\n\n onFinish,\n\n trackRef,\n\n previousButtonEnabled,\n onPreviousButtonClick,\n i18nStrings,\n}: AnnotationPopoverProps) {\n const dismissButtonRefCallback = useCallback(\n (element: ButtonProps.Ref) => {\n if (element) {\n element.focus({ preventScroll: true });\n // Falls back to alignTop on IE11\n scrollElementIntoView(trackRef.current ?? undefined);\n }\n },\n [trackRef]\n );\n\n return (\n <PopoverContainer\n size=\"medium\"\n fixedWidth={false}\n position={direction}\n trackRef={trackRef}\n trackKey={taskLocalStepIndex}\n variant=\"annotation\"\n arrow={arrow}\n zIndex={1000}\n >\n <PopoverBody\n dismissButton={true}\n dismissAriaLabel={i18nStrings.labelDismissAnnotation}\n header={\n <InternalBox color=\"text-body-secondary\" fontSize=\"body-s\" margin={{ top: 'xxxs' }} className={styles.header}>\n {title}\n </InternalBox>\n }\n onDismiss={onDismiss}\n className={styles.annotation}\n variant=\"annotation\"\n overflowVisible=\"content\"\n dismissButtonRef={dismissButtonRefCallback}\n >\n <InternalSpaceBetween size=\"s\">\n <div className={styles.description}>\n <InternalBox className={styles.content}>{content}</InternalBox>\n </div>\n\n {alert && <InternalAlert type=\"warning\">{alert}</InternalAlert>}\n\n <InternalSpaceBetween size=\"s\">\n <div className={styles.divider} />\n\n <div className={styles.actionBar}>\n <div className={styles.stepCounter}>\n <InternalBox className={styles['step-counter-content']} color=\"text-body-secondary\" fontSize=\"body-s\">\n {i18nStrings.stepCounterText(taskLocalStepIndex ?? 0, totalLocalSteps ?? 0)}\n </InternalBox>\n </div>\n <InternalSpaceBetween size=\"xs\" direction=\"horizontal\">\n {showPreviousButton && (\n <InternalButton\n variant=\"link\"\n onClick={onPreviousButtonClick}\n disabled={!previousButtonEnabled}\n formAction=\"none\"\n ariaLabel={i18nStrings.previousButtonText}\n className={styles['previous-button']}\n >\n {i18nStrings.previousButtonText}\n </InternalButton>\n )}\n\n {showFinishButton ? (\n <InternalButton\n onClick={onFinish}\n formAction=\"none\"\n ariaLabel={i18nStrings.finishButtonText}\n className={styles['finish-button']}\n >\n {i18nStrings.finishButtonText}\n </InternalButton>\n ) : (\n <InternalButton\n onClick={onNextButtonClick}\n disabled={!nextButtonEnabled}\n formAction=\"none\"\n ariaLabel={i18nStrings.nextButtonText}\n className={styles['next-button']}\n >\n {i18nStrings.nextButtonText}\n </InternalButton>\n )}\n </InternalSpaceBetween>\n </div>\n </InternalSpaceBetween>\n </InternalSpaceBetween>\n </PopoverBody>\n </PopoverContainer>\n );\n}\n"]}
@@ -4,9 +4,9 @@ import { FormFieldValidationControlProps } from '../internal/context/form-field-
4
4
  import { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';
5
5
  import { BaseDropdownHostProps, OptionsLoadItemsDetail, OptionsFilteringType } from '../internal/components/dropdown/interfaces';
6
6
  import { DropdownStatusProps } from '../internal/components/dropdown-status';
7
- import { BaseInputProps, InputKeyEvents, InputProps } from '../input/interfaces';
7
+ import { BaseInputProps, InputAutoCorrect, InputKeyEvents, InputProps } from '../input/interfaces';
8
8
  import { NonCancelableEventHandler } from '../internal/events';
9
- export interface AutosuggestProps extends BaseComponentProps, BaseInputProps, BaseDropdownHostProps, InputKeyEvents, FormFieldValidationControlProps, DropdownStatusProps {
9
+ export interface AutosuggestProps extends BaseComponentProps, BaseInputProps, InputAutoCorrect, BaseDropdownHostProps, InputKeyEvents, FormFieldValidationControlProps, DropdownStatusProps {
10
10
  /**
11
11
  * Specifies an array of options that are displayed to the user as a dropdown list.
12
12
  * The options can be grouped using `OptionGroup` objects.
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/autosuggest/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,gBACf,SAAQ,kBAAkB,EACxB,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,+BAA+B,EAC/B,mBAAmB;IACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA6BI;IACJ,OAAO,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC;IACnC;;;;;;;;;;;;;;;QAeI;IACJ,aAAa,CAAC,EAAE,oBAAoB,CAAC;IAErC;;OAEG;IACH,gBAAgB,EAAE,gBAAgB,CAAC,gBAAgB,CAAC;IAEpD;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAExB;;;OAGG;IACH,QAAQ,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aAAa,GAAG,oBAAoB,CAAC;IACjD,KAAY,MAAM,GAAG,gBAAgB,CAAC;IACtC,KAAY,OAAO,GAAG,aAAa,CAAC,MAAM,GAAG,WAAW,CAAC,CAAC;IAC1D,KAAY,gBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACzD,UAAiB,WAAY,SAAQ,MAAM;QACzC,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;KAChC;IACD,KAAY,eAAe,GAAG,sBAAsB,CAAC;IACrD,KAAY,UAAU,GAAG,mBAAmB,CAAC,UAAU,CAAC;IACxD,UAAiB,YAAY;QAC3B,KAAK,EAAE,MAAM,CAAC;KACf;IAED,UAAiB,8BAA8B;QAC7C,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;KAC/C;CACF;AAGD,oBAAY,eAAe,GAAG,CAAC,gBAAgB,CAAC,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,GAAG;IACvF,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,aAAa,CAAC;IAC1C,MAAM,EAAE,gBAAgB,GAAG,WAAW,CAAC;CACxC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/autosuggest/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 { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport {\n BaseDropdownHostProps,\n OptionsLoadItemsDetail,\n OptionsFilteringType,\n} from '../internal/components/dropdown/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { BaseInputProps, InputKeyEvents, InputProps } from '../input/interfaces';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface AutosuggestProps\n extends BaseComponentProps,\n BaseInputProps,\n BaseDropdownHostProps,\n InputKeyEvents,\n FormFieldValidationControlProps,\n DropdownStatusProps {\n /**\n * Specifies an array of options that are displayed to the user as a dropdown list.\n * The options can be grouped using `OptionGroup` objects.\n *\n * #### Option\n * - `value` (string) - The returned value of the option when selected.\n * - `label` (string) - (Optional) Option text displayed to the user.\n * - `description` (string) - (Optional) Further information about the option that appears below the label.\n * - `disabled` (boolean) - (Optional) Determines whether the option is disabled.\n * - `labelTag` (string) - (Optional) A label tag that provides additional guidance, shown next to the label.\n * - `tags` [string[]] - (Optional) A list of tags giving further guidance about the option.\n * - `filteringTags` [string[]] - (Optional) A list of additional tags used for automatic filtering.\n * - `iconName` (string) - (Optional) Specifies the name of an [icon](/components/icon/) to display in the option.\n * - `iconAlt` (string) - (Optional) Specifies alternate text for a custom icon, for use with `iconUrl`.\n * - `iconUrl` (string) - (Optional) URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n *\n * #### OptionGroup\n * - `label` (string) - Option group text displayed to the user.\n * - `disabled` (boolean) - (Optional) Determines whether the option group is disabled.\n * - `options` (Option[]) - (Optional) The options under this group.\n *\n * Note: Only one level of option nesting is supported.\n *\n * If you want to use the built-in filtering capabilities of this component, provide\n * a list of all valid options here and they will be automatically filtered based on the user's filtering input.\n *\n * Alternatively, you can listen to the `onChange` or `onLoadItems` event and set new options\n * on your own.\n **/\n options?: AutosuggestProps.Options;\n /**\n * Determines how filtering is applied to the list of `options`:\n * * `auto` - The component will automatically filter options based on user input.\n * * `manual` - You will set up `onChange` or `onLoadItems` event listeners and filter options on your side or request\n * them from server.\n *\n * By default the component will filter the provided `options` based on the value of the filtering input field.\n * Only options that have a `value` or `label` that contains the input value as a substring\n * are displayed in the list of options.\n *\n * If you set this property to `manual`, this default filtering mechanism is disabled and all provided `options` are\n * displayed in the dropdown list. In that case make sure that you use the `onChange` or `onLoadItems` events in order\n * to set the `options` property to the options that are relevant for the user, given the filtering input value.\n *\n * Note: Manual filtering doesn't disable match highlighting.\n **/\n filteringType?: OptionsFilteringType;\n\n /**\n * Specifies a function that generates the custom value indicator (for example, `Use \"${value}\"`).\n */\n enteredTextLabel: AutosuggestProps.EnteredTextLabel;\n\n /**\n * Specifies the text that's displayed when there aren't any suggestions to display.\n * This is displayed when `statusType` is set to `finished` or it's not set at all.\n */\n empty?: React.ReactNode;\n\n /**\n * Called whenever a user selects an option in the dropdown. Don't use this event as the only way to handle user input.\n * Instead, use `onSelect` in combination with the `onChange` handler only as an optional convenience for the user.\n */\n onSelect?: NonCancelableEventHandler<AutosuggestProps.SelectDetail>;\n\n /**\n * Specifies the localized string that describes an option as being selected.\n * This is required to provide a good screen reader experience. For more information, see the\n * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).\n */\n selectedAriaLabel?: string;\n /**\n * Overrides the element that is announced to screen readers\n * when the highlighted option changes. By default, this announces\n * the option's name and properties, and its selected state if\n * the `selectedLabel` property is defined.\n * The highlighted option is provided, and its group (if groups\n * are used and it differs from the group of the previously highlighted option).\n *\n * For more information, see the\n * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).\n */\n renderHighlightedAriaLive?: AutosuggestProps.ContainingOptionAndGroupString;\n}\n\nexport namespace AutosuggestProps {\n export type ChangeDetail = InputProps.ChangeDetail;\n export type KeyDetail = InputProps.KeyDetail;\n export type FilteringType = OptionsFilteringType;\n export type Option = OptionDefinition;\n export type Options = ReadonlyArray<Option | OptionGroup>;\n export type EnteredTextLabel = (value: string) => string;\n export interface OptionGroup extends Option {\n label?: string;\n options: ReadonlyArray<Option>;\n }\n export type LoadItemsDetail = OptionsLoadItemsDetail;\n export type StatusType = DropdownStatusProps.StatusType;\n export interface SelectDetail {\n value: string;\n }\n\n export interface ContainingOptionAndGroupString {\n (option: Option, group?: OptionGroup): string;\n }\n}\n\n// TODO: use DropdownOption type same as in select and multiselect\nexport type AutosuggestItem = (AutosuggestProps.Option | AutosuggestProps.OptionGroup) & {\n type?: 'parent' | 'child' | 'use-entered';\n option: OptionDefinition | OptionGroup;\n};\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/autosuggest/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 { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport {\n BaseDropdownHostProps,\n OptionsLoadItemsDetail,\n OptionsFilteringType,\n} from '../internal/components/dropdown/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { BaseInputProps, InputAutoCorrect, InputKeyEvents, InputProps } from '../input/interfaces';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface AutosuggestProps\n extends BaseComponentProps,\n BaseInputProps,\n InputAutoCorrect,\n BaseDropdownHostProps,\n InputKeyEvents,\n FormFieldValidationControlProps,\n DropdownStatusProps {\n /**\n * Specifies an array of options that are displayed to the user as a dropdown list.\n * The options can be grouped using `OptionGroup` objects.\n *\n * #### Option\n * - `value` (string) - The returned value of the option when selected.\n * - `label` (string) - (Optional) Option text displayed to the user.\n * - `description` (string) - (Optional) Further information about the option that appears below the label.\n * - `disabled` (boolean) - (Optional) Determines whether the option is disabled.\n * - `labelTag` (string) - (Optional) A label tag that provides additional guidance, shown next to the label.\n * - `tags` [string[]] - (Optional) A list of tags giving further guidance about the option.\n * - `filteringTags` [string[]] - (Optional) A list of additional tags used for automatic filtering.\n * - `iconName` (string) - (Optional) Specifies the name of an [icon](/components/icon/) to display in the option.\n * - `iconAlt` (string) - (Optional) Specifies alternate text for a custom icon, for use with `iconUrl`.\n * - `iconUrl` (string) - (Optional) URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n *\n * #### OptionGroup\n * - `label` (string) - Option group text displayed to the user.\n * - `disabled` (boolean) - (Optional) Determines whether the option group is disabled.\n * - `options` (Option[]) - (Optional) The options under this group.\n *\n * Note: Only one level of option nesting is supported.\n *\n * If you want to use the built-in filtering capabilities of this component, provide\n * a list of all valid options here and they will be automatically filtered based on the user's filtering input.\n *\n * Alternatively, you can listen to the `onChange` or `onLoadItems` event and set new options\n * on your own.\n **/\n options?: AutosuggestProps.Options;\n /**\n * Determines how filtering is applied to the list of `options`:\n * * `auto` - The component will automatically filter options based on user input.\n * * `manual` - You will set up `onChange` or `onLoadItems` event listeners and filter options on your side or request\n * them from server.\n *\n * By default the component will filter the provided `options` based on the value of the filtering input field.\n * Only options that have a `value` or `label` that contains the input value as a substring\n * are displayed in the list of options.\n *\n * If you set this property to `manual`, this default filtering mechanism is disabled and all provided `options` are\n * displayed in the dropdown list. In that case make sure that you use the `onChange` or `onLoadItems` events in order\n * to set the `options` property to the options that are relevant for the user, given the filtering input value.\n *\n * Note: Manual filtering doesn't disable match highlighting.\n **/\n filteringType?: OptionsFilteringType;\n\n /**\n * Specifies a function that generates the custom value indicator (for example, `Use \"${value}\"`).\n */\n enteredTextLabel: AutosuggestProps.EnteredTextLabel;\n\n /**\n * Specifies the text that's displayed when there aren't any suggestions to display.\n * This is displayed when `statusType` is set to `finished` or it's not set at all.\n */\n empty?: React.ReactNode;\n\n /**\n * Called whenever a user selects an option in the dropdown. Don't use this event as the only way to handle user input.\n * Instead, use `onSelect` in combination with the `onChange` handler only as an optional convenience for the user.\n */\n onSelect?: NonCancelableEventHandler<AutosuggestProps.SelectDetail>;\n\n /**\n * Specifies the localized string that describes an option as being selected.\n * This is required to provide a good screen reader experience. For more information, see the\n * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).\n */\n selectedAriaLabel?: string;\n /**\n * Overrides the element that is announced to screen readers\n * when the highlighted option changes. By default, this announces\n * the option's name and properties, and its selected state if\n * the `selectedLabel` property is defined.\n * The highlighted option is provided, and its group (if groups\n * are used and it differs from the group of the previously highlighted option).\n *\n * For more information, see the\n * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).\n */\n renderHighlightedAriaLive?: AutosuggestProps.ContainingOptionAndGroupString;\n}\n\nexport namespace AutosuggestProps {\n export type ChangeDetail = InputProps.ChangeDetail;\n export type KeyDetail = InputProps.KeyDetail;\n export type FilteringType = OptionsFilteringType;\n export type Option = OptionDefinition;\n export type Options = ReadonlyArray<Option | OptionGroup>;\n export type EnteredTextLabel = (value: string) => string;\n export interface OptionGroup extends Option {\n label?: string;\n options: ReadonlyArray<Option>;\n }\n export type LoadItemsDetail = OptionsLoadItemsDetail;\n export type StatusType = DropdownStatusProps.StatusType;\n export interface SelectDetail {\n value: string;\n }\n\n export interface ContainingOptionAndGroupString {\n (option: Option, group?: OptionGroup): string;\n }\n}\n\n// TODO: use DropdownOption type same as in select and multiselect\nexport type AutosuggestItem = (AutosuggestProps.Option | AutosuggestProps.OptionGroup) & {\n type?: 'parent' | 'child' | 'use-entered';\n option: OptionDefinition | OptionGroup;\n};\n"]}
@@ -19,8 +19,8 @@ export default function Tooltip(_a) {
19
19
  children,
20
20
  open && (React.createElement(Portal, null,
21
21
  React.createElement("span", { className: portalClasses },
22
- React.createElement(PopoverContainer, { position: position, trackRef: ref, arrow: function (position) { return React.createElement(Arrow, { position: position }); }, renderWithPortal: true, zIndex: 7000 },
23
- React.createElement(PopoverBody, { size: "small", fixedWidth: false, dismissButton: false, dismissAriaLabel: undefined, header: null, onDismiss: function () { }, overflowVisible: "both" },
22
+ React.createElement(PopoverContainer, { size: "small", fixedWidth: false, position: position, trackRef: ref, arrow: function (position) { return React.createElement(Arrow, { position: position }); }, renderWithPortal: true, zIndex: 7000 },
23
+ React.createElement(PopoverBody, { dismissButton: false, dismissAriaLabel: undefined, header: null, onDismiss: function () { }, overflowVisible: "both" },
24
24
  React.createElement("span", { "data-testid": "button-dropdown-disabled-reason", role: "tooltip" }, content))))))));
25
25
  }
26
26
  function useTooltipOpen(timeout) {
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../../src/button-dropdown/tooltip.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAwB,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtE,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,MAAM,MAAM,+BAA+B,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAQrE,IAAM,0BAA0B,GAAG,GAAG,CAAC;AAEvC,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAuD;QAArD,QAAQ,cAAA,EAAE,OAAO,aAAA,EAAE,gBAAkB,EAAlB,QAAQ,mBAAG,OAAO,KAAA;IACrE,IAAM,GAAG,GAAG,MAAM,CAAyB,IAAI,CAAC,CAAC;IACjD,IAAM,eAAe,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACxC,IAAA,KAAyB,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,0BAA0B,CAAC,EAAvF,IAAI,UAAA,EAAE,YAAY,kBAAqE,CAAC;IAChG,IAAM,aAAa,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAEhD,OAAO,CACL,uCAAM,GAAG,EAAE,GAAG,IAAM,YAAY;QAC7B,QAAQ;QACR,IAAI,IAAI,CACP,oBAAC,MAAM;YACL,8BAAM,SAAS,EAAE,aAAa;gBAC5B,oBAAC,gBAAgB,IACf,QA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AO,GAAG,WAAW,CAAC;IAC5B,IAAM,MAAM,GAAG,KAAK,CAAC;IAErB,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,YAAY,EAAE;YACZ,MAAM,QAAA;YACN,OAAO,SAAA;YACP,SAAS,WAAA;SACV;KACF,CAAC;AACJ,CAAC;AAED,IAAM,QAAQ,GAAG,UAAC,GAAW,IAAK,OAAA,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,KAAK,EAAjC,CAAiC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { KeyboardEventHandler, useRef, useState } from 'react';\n\nimport Arrow from '../popover/arrow';\nimport PopoverContainer from '../popover/container';\nimport PopoverBody from '../popover/body';\nimport Portal from '../internal/components/portal';\nimport { usePortalModeClasses } from '../internal/hooks/use-portal-mode-classes';\nimport { useReducedMotion } from '../internal/hooks/use-visual-mode';\n\nexport interface TooltipProps {\n children?: React.ReactNode;\n content?: React.ReactNode;\n position?: 'top' | 'right' | 'bottom' | 'left';\n}\n\nconst DEFAULT_OPEN_TIMEOUT_IN_MS = 120;\n\nexport default function Tooltip({ children, content, position = 'right' }: TooltipProps) {\n const ref = useRef<HTMLSpanElement | null>(null);\n const isReducedMotion = useReducedMotion(ref);\n const { open, triggerProps } = useTooltipOpen(isReducedMotion ? 0 : DEFAULT_OPEN_TIMEOUT_IN_MS);\n const portalClasses = usePortalModeClasses(ref);\n\n return (\n <span ref={ref} {...triggerProps}>\n {children}\n {open && (\n <Portal>\n <span className={portalClasses}>\n <PopoverContainer\n position={position}\n trackRef={ref}\n arrow={position => <Arrow position={position} />}\n renderWithPortal={true}\n zIndex={7000}\n >\n <PopoverBody\n size=\"small\"\n fixedWidth={false}\n dismissButton={false}\n dismissAriaLabel={undefined}\n header={null}\n onDismiss={() => {}}\n overflowVisible=\"both\"\n >\n <span data-testid=\"button-dropdown-disabled-reason\" role=\"tooltip\">\n {content}\n </span>\n </PopoverBody>\n </PopoverContainer>\n </span>\n </Portal>\n )}\n </span>\n );\n}\n\nfunction useTooltipOpen(timeout: number) {\n const handle = useRef<number>();\n const [isOpen, setIsOpen] = useState(false);\n\n const close = () => {\n clearTimeout(handle.current);\n setIsOpen(false);\n };\n const open = () => setIsOpen(true);\n const openDelayed = () => {\n handle.current = setTimeout(open, timeout);\n };\n const onKeyDown: KeyboardEventHandler = e => {\n if (isOpen && isEscape(e.key)) {\n e.preventDefault();\n e.stopPropagation();\n close();\n }\n };\n\n const onFocus = openDelayed;\n const onBlur = close;\n\n return {\n open: isOpen,\n triggerProps: {\n onBlur,\n onFocus,\n onKeyDown,\n },\n };\n}\n\nconst isEscape = (key: string) => key === 'Escape' || key === 'Esc';\n"]}
1
+ {"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../../src/button-dropdown/tooltip.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAwB,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtE,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,MAAM,MAAM,+BAA+B,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAQrE,IAAM,0BAA0B,GAAG,GAAG,CAAC;AAEvC,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAuD;QAArD,QAAQ,cAAA,EAAE,OAAO,aAAA,EAAE,gBAAkB,EAAlB,QAAQ,mBAAG,OAAO,KAAA;IACrE,IAAM,GAAG,GAAG,MAAM,CAAyB,IAAI,CAAC,CAAC;IACjD,IAAM,eAAe,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACxC,IAAA,KAAyB,cAAc,CAAC,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G;QAClB,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC,CAAC;IACF,IAAM,SAAS,GAAyB,UAAA,CAAC;QACvC,IAAI,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;YAC7B,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,KAAK,EAAE,CAAC;SACT;IACH,CAAC,CAAC;IAEF,IAAM,OAAO,GAAG,WAAW,CAAC;IAC5B,IAAM,MAAM,GAAG,KAAK,CAAC;IAErB,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,YAAY,EAAE;YACZ,MAAM,QAAA;YACN,OAAO,SAAA;YACP,SAAS,WAAA;SACV;KACF,CAAC;AACJ,CAAC;AAED,IAAM,QAAQ,GAAG,UAAC,GAAW,IAAK,OAAA,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,KAAK,EAAjC,CAAiC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { KeyboardEventHandler, useRef, useState } from 'react';\n\nimport Arrow from '../popover/arrow';\nimport PopoverContainer from '../popover/container';\nimport PopoverBody from '../popover/body';\nimport Portal from '../internal/components/portal';\nimport { usePortalModeClasses } from '../internal/hooks/use-portal-mode-classes';\nimport { useReducedMotion } from '../internal/hooks/use-visual-mode';\n\nexport interface TooltipProps {\n children?: React.ReactNode;\n content?: React.ReactNode;\n position?: 'top' | 'right' | 'bottom' | 'left';\n}\n\nconst DEFAULT_OPEN_TIMEOUT_IN_MS = 120;\n\nexport default function Tooltip({ children, content, position = 'right' }: TooltipProps) {\n const ref = useRef<HTMLSpanElement | null>(null);\n const isReducedMotion = useReducedMotion(ref);\n const { open, triggerProps } = useTooltipOpen(isReducedMotion ? 0 : DEFAULT_OPEN_TIMEOUT_IN_MS);\n const portalClasses = usePortalModeClasses(ref);\n\n return (\n <span ref={ref} {...triggerProps}>\n {children}\n {open && (\n <Portal>\n <span className={portalClasses}>\n <PopoverContainer\n size=\"small\"\n fixedWidth={false}\n position={position}\n trackRef={ref}\n arrow={position => <Arrow position={position} />}\n renderWithPortal={true}\n zIndex={7000}\n >\n <PopoverBody\n dismissButton={false}\n dismissAriaLabel={undefined}\n header={null}\n onDismiss={() => {}}\n overflowVisible=\"both\"\n >\n <span data-testid=\"button-dropdown-disabled-reason\" role=\"tooltip\">\n {content}\n </span>\n </PopoverBody>\n </PopoverContainer>\n </span>\n </Portal>\n )}\n </span>\n );\n}\n\nfunction useTooltipOpen(timeout: number) {\n const handle = useRef<number>();\n const [isOpen, setIsOpen] = useState(false);\n\n const close = () => {\n clearTimeout(handle.current);\n setIsOpen(false);\n };\n const open = () => setIsOpen(true);\n const openDelayed = () => {\n handle.current = setTimeout(open, timeout);\n };\n const onKeyDown: KeyboardEventHandler = e => {\n if (isOpen && isEscape(e.key)) {\n e.preventDefault();\n e.stopPropagation();\n close();\n }\n };\n\n const onFocus = openDelayed;\n const onBlur = close;\n\n return {\n open: isOpen,\n triggerProps: {\n onBlur,\n onFocus,\n onKeyDown,\n },\n };\n}\n\nconst isEscape = (key: string) => key === 'Escape' || key === 'Esc';\n"]}
@@ -1,5 +1,6 @@
1
+ import { BaseComponentProps } from '../internal/base-component';
1
2
  import { NonCancelableEventHandler } from '../internal/events';
2
- export interface CalendarProps {
3
+ export interface CalendarProps extends BaseComponentProps {
3
4
  /**
4
5
  * The current input value, in YYYY-MM-DD format.
5
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/calendar/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,aA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AY;QAC3B;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;KACf;IAED,UAAiB,qBAAqB;QACpC,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;KACvB;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/calendar/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface CalendarProps {\n /**\n * The current input value, in YYYY-MM-DD format.\n */\n value: string;\n\n /**\n * Defines whether a particular date is enabled in the calendar or not.\n * If you disable a date in the calendar, users can still enter this date using a keyboard.\n * We recommend that you also validate these constraints on the client-side and server-side\n * as you would for other form elements.\n * @param date\n */\n isDateEnabled?: CalendarProps.IsDateEnabledFunction;\n\n /**\n * Specifies the locale to use to render month names and determine the starting day of the week.\n * If you don't provide this, the locale is determined by the page and browser locales.\n * Supported values and formats are listed in the\n * [JavaScript Intl API specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).\n */\n locale?: string;\n\n /**\n * Determines the starting day of the week. The values 0-6 map to Sunday-Saturday.\n * By default the starting day of the week is defined by the locale, but you can use this property to override it.\n */\n startOfWeek?: number;\n\n /**\n * Used as part of the `aria-label` for today's date in the calendar.\n */\n todayAriaLabel: string;\n\n /**\n * Specifies an `aria-label` for the 'next month' button.\n */\n nextMonthAriaLabel: string;\n\n /**\n * Specifies an `aria-label` for the 'previous month' button.\n */\n previousMonthAriaLabel: string;\n\n /**\n * Called whenever a user changes the input value (by typing, pasting, or selecting a value).\n * The event `detail` contains the current value of the field.\n */\n onChange?: NonCancelableEventHandler<CalendarProps.ChangeDetail>;\n}\n\nexport namespace CalendarProps {\n export interface ChangeDetail {\n /**\n * The new value of this component.\n */\n value: string;\n }\n\n export interface IsDateEnabledFunction {\n (date: Date): boolean;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/calendar/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface CalendarProps extends BaseComponentProps {\n /**\n * The current input value, in YYYY-MM-DD format.\n */\n value: string;\n\n /**\n * Defines whether a particular date is enabled in the calendar or not.\n * If you disable a date in the calendar, users can still enter this date using a keyboard.\n * We recommend that you also validate these constraints on the client-side and server-side\n * as you would for other form elements.\n * @param date\n */\n isDateEnabled?: CalendarProps.IsDateEnabledFunction;\n\n /**\n * Specifies the locale to use to render month names and determine the starting day of the week.\n * If you don't provide this, the locale is determined by the page and browser locales.\n * Supported values and formats are listed in the\n * [JavaScript Intl API specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).\n */\n locale?: string;\n\n /**\n * Determines the starting day of the week. The values 0-6 map to Sunday-Saturday.\n * By default the starting day of the week is defined by the locale, but you can use this property to override it.\n */\n startOfWeek?: number;\n\n /**\n * Used as part of the `aria-label` for today's date in the calendar.\n */\n todayAriaLabel: string;\n\n /**\n * Specifies an `aria-label` for the 'next month' button.\n */\n nextMonthAriaLabel: string;\n\n /**\n * Specifies an `aria-label` for the 'previous month' button.\n */\n previousMonthAriaLabel: string;\n\n /**\n * Called whenever a user changes the input value (by typing, pasting, or selecting a value).\n * The event `detail` contains the current value of the field.\n */\n onChange?: NonCancelableEventHandler<CalendarProps.ChangeDetail>;\n}\n\nexport namespace CalendarProps {\n export interface ChangeDetail {\n /**\n * The new value of this component.\n */\n value: string;\n }\n\n export interface IsDateEnabledFunction {\n (date: Date): boolean;\n }\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { CalendarProps } from './interfaces.js';
2
+ import { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';
2
3
  export declare type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;
3
- export default function Calendar({ value, locale, startOfWeek, isDateEnabled, todayAriaLabel, nextMonthAriaLabel, previousMonthAriaLabel, onChange, }: CalendarProps): JSX.Element;
4
+ export default function Calendar({ value, locale, startOfWeek, isDateEnabled, todayAriaLabel, nextMonthAriaLabel, previousMonthAriaLabel, onChange, __internalRootRef, ...rest }: CalendarProps & InternalBaseComponentProps): JSX.Element;
4
5
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/calendar/internal.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,oBAAY,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEjD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,KAAK,EACL,MAAW,EACX,WAAW,EACX,aAA0B,EAC1B,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,QAAQ,GACT,EAAE,aAAa,eAkHf"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/calendar/internal.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAG3F,oBAAY,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEjD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,KAAK,EACL,MAAW,EACX,WAAW,EACX,aAA0B,EAC1B,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,QAAQ,EACR,iBAAiB,EACjB,GAAG,IAAI,EACR,EAAE,aAAa,GAAG,0BAA0B,eAyH5C"}
@@ -1,5 +1,6 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+ import { __assign, __rest } from "tslib";
3
4
  import React, { useEffect, useRef, useState } from 'react';
4
5
  import { addDays, addMonths, getDaysInMonth, isSameMonth, startOfMonth } from 'date-fns';
5
6
  import styles from './styles.css.js';
@@ -13,14 +14,18 @@ import { formatDate } from '../internal/utils/date-time';
13
14
  import { fireNonCancelableEvent } from '../internal/events/index.js';
14
15
  import checkControlled from '../internal/hooks/check-controlled/index.js';
15
16
  import clsx from 'clsx';
17
+ import { getBaseProps } from '../internal/base-component';
18
+ import { useMergeRefs } from '../internal/hooks/use-merge-refs/index.js';
16
19
  export default function Calendar(_a) {
17
- var value = _a.value, _b = _a.locale, locale = _b === void 0 ? '' : _b, startOfWeek = _a.startOfWeek, _c = _a.isDateEnabled, isDateEnabled = _c === void 0 ? function () { return true; } : _c, todayAriaLabel = _a.todayAriaLabel, nextMonthAriaLabel = _a.nextMonthAriaLabel, previousMonthAriaLabel = _a.previousMonthAriaLabel, onChange = _a.onChange;
20
+ var value = _a.value, _b = _a.locale, locale = _b === void 0 ? '' : _b, startOfWeek = _a.startOfWeek, _c = _a.isDateEnabled, isDateEnabled = _c === void 0 ? function () { return true; } : _c, todayAriaLabel = _a.todayAriaLabel, nextMonthAriaLabel = _a.nextMonthAriaLabel, previousMonthAriaLabel = _a.previousMonthAriaLabel, onChange = _a.onChange, __internalRootRef = _a.__internalRootRef, rest = __rest(_a, ["value", "locale", "startOfWeek", "isDateEnabled", "todayAriaLabel", "nextMonthAriaLabel", "previousMonthAriaLabel", "onChange", "__internalRootRef"]);
18
21
  checkControlled('Calendar', 'value', value, 'onChange', onChange);
22
+ var baseProps = getBaseProps(rest);
19
23
  var normalizedLocale = normalizeLocale('Calendar', locale);
20
- var normalizedStartOfWeek = normalizeStartOfWeek(startOfWeek, locale);
24
+ var normalizedStartOfWeek = normalizeStartOfWeek(startOfWeek, normalizedLocale);
21
25
  var elementRef = useRef(null);
22
26
  var gridWrapperRef = useRef(null);
23
27
  var _d = useState(null), focusedDate = _d[0], setFocusedDate = _d[1];
28
+ var ref = useMergeRefs(elementRef, __internalRootRef);
24
29
  // Set displayed date to value if defined or to current date otherwise.
25
30
  var memoizedValue = memoizedDate('value', value);
26
31
  var defaultDisplayedDate = memoizedValue !== null && memoizedValue !== void 0 ? memoizedValue : new Date();
@@ -89,7 +94,7 @@ export default function Calendar(_a) {
89
94
  setFocusedDate(null);
90
95
  }
91
96
  };
92
- return (React.createElement("div", { className: clsx(styles.root, styles.calendar), ref: elementRef },
97
+ return (React.createElement("div", __assign({ ref: ref, role: "application" }, baseProps, { className: clsx(styles.root, styles.calendar, baseProps.className) }),
93
98
  React.createElement("div", { className: styles['calendar-inner'] },
94
99
  React.createElement(CalendarHeader, { baseDate: baseDate, locale: normalizedLocale, onChangeMonth: onHeaderChangeMonthHandler, previousMonthLabel: previousMonthAriaLabel, nextMonthLabel: nextMonthAriaLabel }),
95
100
  React.createElement("div", { onBlur: onGridBlur, ref: gridWrapperRef },
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/calendar/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACzF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,UAAU,CAAC;AACtC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,gBAAgB,MAAM,4BAA4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,CAAC,aAAa,KAAI,MAAA,cAAc,CAAC,OAAO,0CAAE,QAAQ,CAAC,KAAK,CAAC,aAAqB,CAAC,CAAA,CAAC;QACpH,IAAI,CAAC,sBAAsB,EAAE;YAC3B,cAAc,CAAC,IAAI,CAAC,CAAC;SACtB;IACH,CAAC,CAAC;IAEF,OAAO,CACL,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,UAAU;QACjE,6BAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC;YACtC,oBAAC,cAAc,IACb,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,gBAAgB,EACxB,aAAa,EAAE,0BAA0B,EACzC,kBAAkB,EAAE,sBAAsB,EAC1C,cAAc,EAAE,kBAAkB,GAClC;YACF,6BAAK,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,cAAc;gBAC1C,oBAAC,IAAI,IACH,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,qBAAqB,EAClC,YAAY,EAAE,uBAAuB,EACrC,WAAW,EAAE,sBAAsB,EACnC,aAAa,EAAE,wBAAwB,EACvC,WAAW,EAAE,qBAAqB,EAClC,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,aAAa,EAC3B,eAAe,EAAE,gBAAgB,GACjC,CACE,CACF,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useEffect, useRef, useState } from 'react';\nimport { addDays, addMonths, getDaysInMonth, isSameMonth, startOfMonth } from 'date-fns';\nimport styles from './styles.css.js';\nimport CalendarHeader from './header';\nimport Grid from './grid';\nimport moveFocusHandler from './utils/move-focus-handler';\nimport { memoizedDate } from './utils/memoized-date.js';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update.js';\nimport { normalizeLocale, normalizeStartOfWeek } from './utils/locales.js';\nimport { formatDate } from '../internal/utils/date-time';\nimport { fireNonCancelableEvent } from '../internal/events/index.js';\nimport checkControlled from '../internal/hooks/check-controlled/index.js';\nimport clsx from 'clsx';\nimport { CalendarProps } from './interfaces.js';\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\nexport default function Calendar({\n value,\n locale = '',\n startOfWeek,\n isDateEnabled = () => true,\n todayAriaLabel,\n nextMonthAriaLabel,\n previousMonthAriaLabel,\n onChange,\n}: CalendarProps) {\n checkControlled('Calendar', 'value', value, 'onChange', onChange);\n\n const normalizedLocale = normalizeLocale('Calendar', locale);\n const normalizedStartOfWeek = normalizeStartOfWeek(startOfWeek, locale);\n const elementRef = useRef<HTMLDivElement>(null);\n const gridWrapperRef = useRef<HTMLDivElement>(null);\n const [focusedDate, setFocusedDate] = useState<Date | null>(null);\n\n // Set displayed date to value if defined or to current date otherwise.\n const memoizedValue = memoizedDate('value', value);\n const defaultDisplayedDate = memoizedValue ?? new Date();\n const [displayedDate, setDisplayedDate] = useState(defaultDisplayedDate);\n\n // Update displayed date if value changes.\n useEffect(() => {\n memoizedValue && setDisplayedDate(prev => (prev.getTime() !== memoizedValue.getTime() ? memoizedValue : prev));\n }, [memoizedValue]);\n\n const selectFocusedDate = (selected: Date | null, baseDate: Date): Date | null => {\n if (selected && isDateEnabled(selected) && isSameMonth(selected, baseDate)) {\n return selected;\n }\n const today = new Date();\n if (isDateEnabled(today) && isSameMonth(today, baseDate)) {\n return today;\n }\n if (isDateEnabled(baseDate)) {\n return baseDate;\n }\n return null;\n };\n\n // Get the first enabled date of the month. If no day is enabled in the given month, return the first day of the month.\n // This is needed because `baseDate` is used as the first focusable date, for example when navigating to the calendar area.\n const getBaseDate = (date: Date) => {\n const startDate = startOfMonth(date);\n for (let i = 0; i < getDaysInMonth(date); i++) {\n const currentDate = addDays(startDate, i);\n if (isDateEnabled(currentDate)) {\n return currentDate;\n }\n }\n return startDate;\n };\n\n const baseDate: Date = getBaseDate(displayedDate);\n const focusedOrSelectedDate = focusedDate || selectFocusedDate(memoizedValue, baseDate);\n\n const onHeaderChangeMonthHandler = (isPreviousButtonClick?: boolean) => {\n setDisplayedDate(addMonths(baseDate, isPreviousButtonClick ? -1 : 1));\n setFocusedDate(null);\n };\n\n const onGridChangeMonthHandler = (newMonth: Date) => {\n setDisplayedDate(newMonth);\n setFocusedDate(null);\n };\n\n const onGridFocusDateHandler = (date: null | Date) => {\n if (date) {\n const value = memoizedDate('focused', formatDate(date));\n setFocusedDate(value);\n }\n };\n\n const onGridSelectDateHandler = (date: Date) => {\n fireNonCancelableEvent(onChange, { value: formatDate(date) });\n setFocusedDate(null);\n };\n\n // The focused date changes as a feedback to keyboard navigation in the grid.\n // Once changed, the corresponding day button needs to receive the actual focus.\n useEffectOnUpdate(() => {\n if (focusedDate) {\n (elementRef.current?.querySelector(`.${styles['calendar-day-focusable']}`) as HTMLDivElement)?.focus();\n }\n }, [focusedDate]);\n\n const onGridBlur = (event: React.FocusEvent) => {\n const newFocusTargetIsInGrid = event.relatedTarget && gridWrapperRef.current?.contains(event.relatedTarget as Node);\n if (!newFocusTargetIsInGrid) {\n setFocusedDate(null);\n }\n };\n\n return (\n <div className={clsx(styles.root, styles.calendar)} ref={elementRef}>\n <div className={styles['calendar-inner']}>\n <CalendarHeader\n baseDate={baseDate}\n locale={normalizedLocale}\n onChangeMonth={onHeaderChangeMonthHandler}\n previousMonthLabel={previousMonthAriaLabel}\n nextMonthLabel={nextMonthAriaLabel}\n />\n <div onBlur={onGridBlur} ref={gridWrapperRef}>\n <Grid\n locale={normalizedLocale}\n baseDate={baseDate}\n isDateEnabled={isDateEnabled}\n focusedDate={focusedOrSelectedDate}\n onSelectDate={onGridSelectDateHandler}\n onFocusDate={onGridFocusDateHandler}\n onChangeMonth={onGridChangeMonthHandler}\n startOfWeek={normalizedStartOfWeek}\n todayAriaLabel={todayAriaLabel}\n selectedDate={memoizedValue}\n handleFocusMove={moveFocusHandler}\n />\n </div>\n </div>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/calendar/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACzF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,UAAU,CAAC;AACtC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,gBAAgB,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,eAAe,MAAM,6CAA6C,CAAC;AAC1E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAIzE,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAWY;IAV3C,IAAA,KAAK,WAAA,EACL,cAAW,EAAX,MAAM,mBAAG,EAAE,KAAA,EACX,WAAW,iBAAA,EACX,qBAA0B,EAA1B,aAAa,mBAAG,cAAM,OAAA,IAAI,EAAJ,CAAI,KAAA,EAC1B,cAAc,oBAAA,EACd,kBAAkB,wBAAA,EAClB,sBAAsB,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,cAAc,IACb,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,gBAAgB,EACxB,aAAa,EAAE,0BAA0B,EACzC,kBAAkB,EAAE,sBAAsB,EAC1C,cAAc,EAAE,kBAAkB,GAClC;YACF,6BAAK,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,cAAc;gBAC1C,oBAAC,IAAI,IACH,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,qBAAqB,EAClC,YAAY,EAAE,uBAAuB,EACrC,WAAW,EAAE,sBAAsB,EACnC,aAAa,EAAE,wBAAwB,EACvC,WAAW,EAAE,qBAAqB,EAClC,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,aAAa,EAC3B,eAAe,EAAE,gBAAgB,GACjC,CACE,CACF,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useEffect, useRef, useState } from 'react';\nimport { addDays, addMonths, getDaysInMonth, isSameMonth, startOfMonth } from 'date-fns';\nimport styles from './styles.css.js';\nimport CalendarHeader from './header';\nimport Grid from './grid';\nimport moveFocusHandler from './utils/move-focus-handler';\nimport { memoizedDate } from './utils/memoized-date.js';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update.js';\nimport { normalizeLocale, normalizeStartOfWeek } from './utils/locales.js';\nimport { formatDate } from '../internal/utils/date-time';\nimport { fireNonCancelableEvent } from '../internal/events/index.js';\nimport checkControlled from '../internal/hooks/check-controlled/index.js';\nimport clsx from 'clsx';\nimport { CalendarProps } from './interfaces.js';\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs/index.js';\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\nexport default function Calendar({\n value,\n locale = '',\n startOfWeek,\n isDateEnabled = () => true,\n todayAriaLabel,\n nextMonthAriaLabel,\n previousMonthAriaLabel,\n onChange,\n __internalRootRef,\n ...rest\n}: CalendarProps & InternalBaseComponentProps) {\n checkControlled('Calendar', 'value', value, 'onChange', onChange);\n\n const baseProps = getBaseProps(rest);\n const normalizedLocale = normalizeLocale('Calendar', locale);\n const normalizedStartOfWeek = normalizeStartOfWeek(startOfWeek, normalizedLocale);\n const elementRef = useRef<HTMLDivElement>(null);\n const gridWrapperRef = useRef<HTMLDivElement>(null);\n const [focusedDate, setFocusedDate] = useState<Date | null>(null);\n const ref = useMergeRefs(elementRef, __internalRootRef);\n\n // Set displayed date to value if defined or to current date otherwise.\n const memoizedValue = memoizedDate('value', value);\n const defaultDisplayedDate = memoizedValue ?? new Date();\n const [displayedDate, setDisplayedDate] = useState(defaultDisplayedDate);\n\n // Update displayed date if value changes.\n useEffect(() => {\n memoizedValue && setDisplayedDate(prev => (prev.getTime() !== memoizedValue.getTime() ? memoizedValue : prev));\n }, [memoizedValue]);\n\n const selectFocusedDate = (selected: Date | null, baseDate: Date): Date | null => {\n if (selected && isDateEnabled(selected) && isSameMonth(selected, baseDate)) {\n return selected;\n }\n const today = new Date();\n if (isDateEnabled(today) && isSameMonth(today, baseDate)) {\n return today;\n }\n if (isDateEnabled(baseDate)) {\n return baseDate;\n }\n return null;\n };\n\n // Get the first enabled date of the month. If no day is enabled in the given month, return the first day of the month.\n // This is needed because `baseDate` is used as the first focusable date, for example when navigating to the calendar area.\n const getBaseDate = (date: Date) => {\n const startDate = startOfMonth(date);\n for (let i = 0; i < getDaysInMonth(date); i++) {\n const currentDate = addDays(startDate, i);\n if (isDateEnabled(currentDate)) {\n return currentDate;\n }\n }\n return startDate;\n };\n\n const baseDate: Date = getBaseDate(displayedDate);\n const focusedOrSelectedDate = focusedDate || selectFocusedDate(memoizedValue, baseDate);\n\n const onHeaderChangeMonthHandler = (isPreviousButtonClick?: boolean) => {\n setDisplayedDate(addMonths(baseDate, isPreviousButtonClick ? -1 : 1));\n setFocusedDate(null);\n };\n\n const onGridChangeMonthHandler = (newMonth: Date) => {\n setDisplayedDate(newMonth);\n setFocusedDate(null);\n };\n\n const onGridFocusDateHandler = (date: null | Date) => {\n if (date) {\n const value = memoizedDate('focused', formatDate(date));\n setFocusedDate(value);\n }\n };\n\n const onGridSelectDateHandler = (date: Date) => {\n fireNonCancelableEvent(onChange, { value: formatDate(date) });\n setFocusedDate(null);\n };\n\n // The focused date changes as a feedback to keyboard navigation in the grid.\n // Once changed, the corresponding day button needs to receive the actual focus.\n useEffectOnUpdate(() => {\n if (focusedDate) {\n (elementRef.current?.querySelector(`.${styles['calendar-day-focusable']}`) as HTMLDivElement)?.focus();\n }\n }, [focusedDate]);\n\n const onGridBlur = (event: React.FocusEvent) => {\n const newFocusTargetIsInGrid = event.relatedTarget && gridWrapperRef.current?.contains(event.relatedTarget as Node);\n if (!newFocusTargetIsInGrid) {\n setFocusedDate(null);\n }\n };\n\n return (\n <div\n ref={ref}\n role=\"application\"\n {...baseProps}\n className={clsx(styles.root, styles.calendar, baseProps.className)}\n >\n <div className={styles['calendar-inner']}>\n <CalendarHeader\n baseDate={baseDate}\n locale={normalizedLocale}\n onChangeMonth={onHeaderChangeMonthHandler}\n previousMonthLabel={previousMonthAriaLabel}\n nextMonthLabel={nextMonthAriaLabel}\n />\n <div onBlur={onGridBlur} ref={gridWrapperRef}>\n <Grid\n locale={normalizedLocale}\n baseDate={baseDate}\n isDateEnabled={isDateEnabled}\n focusedDate={focusedOrSelectedDate}\n onSelectDate={onGridSelectDateHandler}\n onFocusDate={onGridFocusDateHandler}\n onChangeMonth={onGridChangeMonthHandler}\n startOfWeek={normalizedStartOfWeek}\n todayAriaLabel={todayAriaLabel}\n selectedDate={memoizedValue}\n handleFocusMove={moveFocusHandler}\n />\n </div>\n </div>\n </div>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cards/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAkB/D,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,qBAwHc,CAAC;AAE1B,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cards/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAmB/D,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,qBA+Hc,CAAC;AAE1B,eAAe,KAAK,CAAC"}
package/cards/index.js CHANGED
@@ -19,12 +19,16 @@ import { useSupportsStickyHeader } from '../container/use-sticky-header';
19
19
  import useBaseComponent from '../internal/hooks/use-base-component';
20
20
  import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
21
21
  import { useMergeRefs } from '../internal/hooks/use-merge-refs';
22
+ import { useUniqueId } from '../internal/hooks/use-unique-id';
22
23
  var Cards = React.forwardRef(function (_a, ref) {
23
24
  var _b = _a.items, items = _b === void 0 ? [] : _b, cardDefinition = _a.cardDefinition, _c = _a.cardsPerRow, cardsPerRow = _c === void 0 ? [] : _c, header = _a.header, filter = _a.filter, pagination = _a.pagination, preferences = _a.preferences, empty = _a.empty, loading = _a.loading, loadingText = _a.loadingText, trackBy = _a.trackBy, selectedItems = _a.selectedItems, selectionType = _a.selectionType, isItemDisabled = _a.isItemDisabled, onSelectionChange = _a.onSelectionChange, ariaLabels = _a.ariaLabels, visibleSections = _a.visibleSections, stickyHeader = _a.stickyHeader, stickyHeaderVerticalOffset = _a.stickyHeaderVerticalOffset, _d = _a.variant, variant = _d === void 0 ? 'container' : _d, rest = __rest(_a, ["items", "cardDefinition", "cardsPerRow", "header", "filter", "pagination", "preferences", "empty", "loading", "loadingText", "trackBy", "selectedItems", "selectionType", "isItemDisabled", "onSelectionChange", "ariaLabels", "visibleSections", "stickyHeader", "stickyHeaderVerticalOffset", "variant"]);
24
25
  var __internalRootRef = useBaseComponent('Cards').__internalRootRef;
25
26
  var baseProps = getBaseProps(rest);
26
27
  var isRefresh = useVisualRefresh();
27
28
  var computedVariant = isRefresh ? variant : 'container';
29
+ var instanceUniqueId = useUniqueId('cards');
30
+ var cardsId = (baseProps === null || baseProps === void 0 ? void 0 : baseProps.id) || instanceUniqueId;
31
+ var cardsHeaderId = header ? "".concat(cardsId, "-header") : undefined;
28
32
  var _e = useContainerQuery(function (_a) {
29
33
  var width = _a.width;
30
34
  return getCardsPerRow(width, cardsPerRow);
@@ -66,24 +70,30 @@ var Cards = React.forwardRef(function (_a, ref) {
66
70
  }
67
71
  return (React.createElement("div", __assign({}, baseProps, { className: clsx(baseProps.className, styles.root), ref: mergedRef }),
68
72
  React.createElement(InternalContainer, { header: hasToolsHeader && (React.createElement("div", { className: clsx(styles.header, isRefresh && styles['header-refresh'], styles["header-variant-".concat(computedVariant)]) },
69
- React.createElement(ToolsHeader, { header: header, filter: filter, pagination: pagination, preferences: preferences }))), disableContentPaddings: true, disableHeaderPaddings: computedVariant === 'full-page', variant: computedVariant === 'container' ? 'cards' : computedVariant, __stickyHeader: stickyHeader, __stickyOffset: stickyHeaderVerticalOffset, __headerRef: headerRef },
70
- React.createElement("div", { className: clsx(hasToolsHeader && styles['has-header']) }, status !== null && status !== void 0 ? status : (React.createElement(CardsList, { items: items, cardDefinition: cardDefinition, trackBy: trackBy, selectionType: selectionType, columns: columns, isItemSelected: isItemSelected, getItemSelectionProps: getItemSelectionProps, visibleSections: visibleSections, updateShiftToggle: updateShiftToggle, onFocus: onCardFocus }))))));
73
+ React.createElement(ToolsHeader, { header: header, filter: filter, pagination: pagination, preferences: preferences }))), disableContentPaddings: true, disableHeaderPaddings: computedVariant === 'full-page', variant: computedVariant === 'container' ? 'cards' : computedVariant, __stickyHeader: stickyHeader, __stickyOffset: stickyHeaderVerticalOffset, __headerRef: headerRef, __headerId: cardsHeaderId },
74
+ React.createElement("div", { className: clsx(hasToolsHeader && styles['has-header']) }, status !== null && status !== void 0 ? status : (React.createElement(CardsList, { items: items, cardDefinition: cardDefinition, trackBy: trackBy, selectionType: selectionType, columns: columns, isItemSelected: isItemSelected, getItemSelectionProps: getItemSelectionProps, visibleSections: visibleSections, updateShiftToggle: updateShiftToggle, onFocus: onCardFocus, ariaDescribedby: cardsHeaderId, ariaLabelledby: cardsHeaderId }))))));
71
75
  });
72
76
  export default Cards;
73
77
  var CardsList = function (_a) {
74
- var items = _a.items, cardDefinition = _a.cardDefinition, trackBy = _a.trackBy, selectionType = _a.selectionType, columns = _a.columns, isItemSelected = _a.isItemSelected, getItemSelectionProps = _a.getItemSelectionProps, visibleSections = _a.visibleSections, updateShiftToggle = _a.updateShiftToggle, onFocus = _a.onFocus;
78
+ var items = _a.items, cardDefinition = _a.cardDefinition, trackBy = _a.trackBy, selectionType = _a.selectionType, columns = _a.columns, isItemSelected = _a.isItemSelected, getItemSelectionProps = _a.getItemSelectionProps, visibleSections = _a.visibleSections, updateShiftToggle = _a.updateShiftToggle, onFocus = _a.onFocus, ariaLabelledby = _a.ariaLabelledby, ariaDescribedby = _a.ariaDescribedby;
75
79
  var selectable = !!selectionType;
76
80
  var _b = useFocusMove(selectionType, items.length), moveFocusDown = _b.moveFocusDown, moveFocusUp = _b.moveFocusUp;
77
81
  var visibleSectionsDefinition = cardDefinition.sections || [];
78
82
  visibleSectionsDefinition = visibleSections
79
83
  ? visibleSectionsDefinition.filter(function (section) { return section.id && visibleSections.indexOf(section.id) !== -1; })
80
84
  : visibleSectionsDefinition;
81
- return (React.createElement("ol", __assign({ className: clsx(styles.list, styles["list-grid-".concat(columns || 1)]) }, (focusMarkers && focusMarkers.root)), items.map(function (item, index) {
85
+ var listRole = undefined;
86
+ var listItemRole = undefined;
87
+ if (selectable) {
88
+ listRole = 'group';
89
+ listItemRole = 'presentation';
90
+ }
91
+ return (React.createElement("ol", __assign({ className: clsx(styles.list, styles["list-grid-".concat(columns || 1)]), role: listRole, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby }, (focusMarkers && focusMarkers.root)), items.map(function (item, index) {
82
92
  var _a;
83
93
  return (React.createElement("li", __assign({ className: clsx(styles.card, (_a = {},
84
94
  _a[styles['card-selectable']] = selectable,
85
95
  _a[styles['card-selected']] = selectable && isItemSelected(item),
86
- _a)), key: getItemKey(trackBy, item, index), onFocus: onFocus }, (focusMarkers && focusMarkers.item)),
96
+ _a)), key: getItemKey(trackBy, item, index), onFocus: onFocus }, (focusMarkers && focusMarkers.item), { role: listItemRole }),
87
97
  React.createElement("div", { className: styles['card-inner'] },
88
98
  React.createElement("div", { className: styles['card-header'] },
89
99
  React.createElement("span", { className: styles['card-header-inner'] }, cardDefinition.header ? cardDefinition.header(item) : ''),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cards/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAqB,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE9E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,gBAA2C,MAAM,4BAA4B,CAAC;AACrF,OAAO,iBAAiB,MAAM,uBAAuB,CAAC;AACtD,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE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AkC3B,CAAC,CACC,CACN,CAAC;AACJ,CAAC,CAAC;AAEF,gBAAgB,CAAC,KAAK,EAAE,OAAO,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, { FocusEventHandler, useImperativeHandle, useRef } from 'react';\nimport { CardsForwardRefType, CardsProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { getCardsPerRow } from './cards-layout-helper';\nimport { getBaseProps } from '../internal/base-component';\nimport { useContainerQuery } from '../internal/hooks/container-queries/use-container-query';\nimport ToolsHeader from '../table/tools-header';\nimport { getItemKey } from '../table/utils';\nimport { focusMarkers, useFocusMove, useSelection } from '../table/use-selection';\nimport SelectionControl, { SelectionControlProps } from '../table/selection-control';\nimport InternalContainer from '../container/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport stickyScrolling from '../table/sticky-scrolling';\nimport { useSupportsStickyHeader } from '../container/use-sticky-header';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\n\nexport { CardsProps };\n\nconst Cards = React.forwardRef(function <T = any>(\n {\n items = [],\n cardDefinition,\n cardsPerRow = [],\n header,\n filter,\n pagination,\n preferences,\n empty,\n loading,\n loadingText,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels,\n visibleSections,\n stickyHeader,\n stickyHeaderVerticalOffset,\n variant = 'container',\n ...rest\n }: CardsProps<T>,\n ref: React.Ref<CardsProps.Ref>\n) {\n const { __internalRootRef } = useBaseComponent('Cards');\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n const computedVariant = isRefresh ? variant : 'container';\n\n const [columns, measureRef] = useContainerQuery<number>(\n ({ width }) => getCardsPerRow(width, cardsPerRow),\n [cardsPerRow]\n );\n const refObject = useRef(null);\n const mergedRef = useMergeRefs(measureRef, refObject, __internalRootRef);\n\n const { isItemSelected, getItemSelectionProps, updateShiftToggle } = useSelection({\n items,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels,\n });\n const hasToolsHeader = header || filter || pagination || preferences;\n const headerRef = useRef<HTMLDivElement>(null);\n const { scrollToTop, scrollToItem } = stickyScrolling(refObject, headerRef);\n stickyHeader = useSupportsStickyHeader() && stickyHeader;\n const onCardFocus: FocusEventHandler<HTMLElement> = event => {\n if (stickyHeader) {\n scrollToItem(event.currentTarget);\n }\n };\n useImperativeHandle(\n ref,\n () => ({\n scrollToTop: () => {\n if (stickyHeader) {\n scrollToTop();\n }\n },\n }),\n [stickyHeader, scrollToTop]\n );\n let status;\n if (loading) {\n status = (\n <div className={styles.loading}>\n <InternalStatusIndicator type=\"loading\">{loadingText}</InternalStatusIndicator>\n </div>\n );\n } else if (empty && !items.length) {\n status = <div className={styles.empty}>{empty}</div>;\n }\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRef}>\n <InternalContainer\n header={\n hasToolsHeader && (\n <div\n className={clsx(\n styles.header,\n isRefresh && styles['header-refresh'],\n styles[`header-variant-${computedVariant}`]\n )}\n >\n <ToolsHeader header={header} filter={filter} pagination={pagination} preferences={preferences} />\n </div>\n )\n }\n disableContentPaddings={true}\n disableHeaderPaddings={computedVariant === 'full-page'}\n variant={computedVariant === 'container' ? 'cards' : computedVariant}\n __stickyHeader={stickyHeader}\n __stickyOffset={stickyHeaderVerticalOffset}\n __headerRef={headerRef}\n >\n <div className={clsx(hasToolsHeader && styles['has-header'])}>\n {status ?? (\n <CardsList\n items={items}\n cardDefinition={cardDefinition}\n trackBy={trackBy}\n selectionType={selectionType}\n columns={columns}\n isItemSelected={isItemSelected}\n getItemSelectionProps={getItemSelectionProps}\n visibleSections={visibleSections}\n updateShiftToggle={updateShiftToggle}\n onFocus={onCardFocus}\n />\n )}\n </div>\n </InternalContainer>\n </div>\n );\n}) as CardsForwardRefType;\n\nexport default Cards;\n\nconst CardsList = <T,>({\n items,\n cardDefinition,\n trackBy,\n selectionType,\n columns,\n isItemSelected,\n getItemSelectionProps,\n visibleSections,\n updateShiftToggle,\n onFocus,\n}: Pick<CardsProps<T>, 'items' | 'cardDefinition' | 'trackBy' | 'selectionType' | 'visibleSections'> & {\n columns: number | null;\n isItemSelected: (item: T) => boolean;\n getItemSelectionProps: (item: T) => SelectionControlProps;\n updateShiftToggle: (state: boolean) => void;\n onFocus: FocusEventHandler<HTMLElement>;\n}) => {\n const selectable = !!selectionType;\n const { moveFocusDown, moveFocusUp } = useFocusMove(selectionType, items.length);\n\n let visibleSectionsDefinition = cardDefinition.sections || [];\n visibleSectionsDefinition = visibleSections\n ? visibleSectionsDefinition.filter(\n (section: CardsProps.SectionDefinition<T>) => section.id && visibleSections.indexOf(section.id) !== -1\n )\n : visibleSectionsDefinition;\n\n return (\n <ol className={clsx(styles.list, styles[`list-grid-${columns || 1}`])} {...(focusMarkers && focusMarkers.root)}>\n {items.map((item, index) => (\n <li\n className={clsx(styles.card, {\n [styles['card-selectable']]: selectable,\n [styles['card-selected']]: selectable && isItemSelected(item),\n })}\n key={getItemKey(trackBy, item, index)}\n onFocus={onFocus}\n {...(focusMarkers && focusMarkers.item)}\n >\n <div className={styles['card-inner']}>\n <div className={styles['card-header']}>\n <span className={styles['card-header-inner']}>\n {cardDefinition.header ? cardDefinition.header(item) : ''}\n </span>\n {selectable && (\n <div className={styles['selection-control']}>\n <SelectionControl\n onFocusDown={moveFocusDown}\n onFocusUp={moveFocusUp}\n onShiftToggle={updateShiftToggle}\n {...getItemSelectionProps(item)}\n />\n </div>\n )}\n </div>\n {visibleSectionsDefinition.map(({ width = 100, header, content, id }, index) => (\n <div key={id || index} className={styles.section} style={{ width: `${width}%` }}>\n {header ? <div className={styles['section-header']}>{header}</div> : ''}\n {content ? <div className={styles['section-content']}>{content(item)}</div> : ''}\n </div>\n ))}\n </div>\n </li>\n ))}\n </ol>\n );\n};\n\napplyDisplayName(Cards, 'Cards');\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cards/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAqB,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE9E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,gBAA2C,MAAM,4BAA4B,CAAC;AACrF,OAAO,iBAAiB,MAAM,uBAAuB,CAAC;AACtD,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,eAAe,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAI9D,IAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,UAC7B,EAsBgB,EAChB,GAA8B;IAtB5B,IAAA,aAAU,EAAV,KAAK,mB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,CAAC,CAAC,EAAE;wBACtE,OAAO,CAAC,CAAC,CAAC,6BAAK,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,IAAG,OAAO,CAAC,IAAI,CAAC,CAAO,CAAC,CAAC,CAAC,EAAE,CAC5E,CACP;gBAL+E,CAK/E,CAAC,CACE,CACH,CACN;IAnC2B,CAmC3B,CAAC,CACC,CACN,CAAC;AACJ,CAAC,CAAC;AAEF,gBAAgB,CAAC,KAAK,EAAE,OAAO,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, { FocusEventHandler, useImperativeHandle, useRef } from 'react';\nimport { CardsForwardRefType, CardsProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { getCardsPerRow } from './cards-layout-helper';\nimport { getBaseProps } from '../internal/base-component';\nimport { useContainerQuery } from '../internal/hooks/container-queries/use-container-query';\nimport ToolsHeader from '../table/tools-header';\nimport { getItemKey } from '../table/utils';\nimport { focusMarkers, useFocusMove, useSelection } from '../table/use-selection';\nimport SelectionControl, { SelectionControlProps } from '../table/selection-control';\nimport InternalContainer from '../container/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport stickyScrolling from '../table/sticky-scrolling';\nimport { useSupportsStickyHeader } from '../container/use-sticky-header';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\n\nexport { CardsProps };\n\nconst Cards = React.forwardRef(function <T = any>(\n {\n items = [],\n cardDefinition,\n cardsPerRow = [],\n header,\n filter,\n pagination,\n preferences,\n empty,\n loading,\n loadingText,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels,\n visibleSections,\n stickyHeader,\n stickyHeaderVerticalOffset,\n variant = 'container',\n ...rest\n }: CardsProps<T>,\n ref: React.Ref<CardsProps.Ref>\n) {\n const { __internalRootRef } = useBaseComponent('Cards');\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n const computedVariant = isRefresh ? variant : 'container';\n\n const instanceUniqueId = useUniqueId('cards');\n const cardsId = baseProps?.id || instanceUniqueId;\n const cardsHeaderId = header ? `${cardsId}-header` : undefined;\n\n const [columns, measureRef] = useContainerQuery<number>(\n ({ width }) => getCardsPerRow(width, cardsPerRow),\n [cardsPerRow]\n );\n const refObject = useRef(null);\n const mergedRef = useMergeRefs(measureRef, refObject, __internalRootRef);\n\n const { isItemSelected, getItemSelectionProps, updateShiftToggle } = useSelection({\n items,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels,\n });\n const hasToolsHeader = header || filter || pagination || preferences;\n const headerRef = useRef<HTMLDivElement>(null);\n const { scrollToTop, scrollToItem } = stickyScrolling(refObject, headerRef);\n stickyHeader = useSupportsStickyHeader() && stickyHeader;\n const onCardFocus: FocusEventHandler<HTMLElement> = event => {\n if (stickyHeader) {\n scrollToItem(event.currentTarget);\n }\n };\n useImperativeHandle(\n ref,\n () => ({\n scrollToTop: () => {\n if (stickyHeader) {\n scrollToTop();\n }\n },\n }),\n [stickyHeader, scrollToTop]\n );\n let status;\n if (loading) {\n status = (\n <div className={styles.loading}>\n <InternalStatusIndicator type=\"loading\">{loadingText}</InternalStatusIndicator>\n </div>\n );\n } else if (empty && !items.length) {\n status = <div className={styles.empty}>{empty}</div>;\n }\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRef}>\n <InternalContainer\n header={\n hasToolsHeader && (\n <div\n className={clsx(\n styles.header,\n isRefresh && styles['header-refresh'],\n styles[`header-variant-${computedVariant}`]\n )}\n >\n <ToolsHeader header={header} filter={filter} pagination={pagination} preferences={preferences} />\n </div>\n )\n }\n disableContentPaddings={true}\n disableHeaderPaddings={computedVariant === 'full-page'}\n variant={computedVariant === 'container' ? 'cards' : computedVariant}\n __stickyHeader={stickyHeader}\n __stickyOffset={stickyHeaderVerticalOffset}\n __headerRef={headerRef}\n __headerId={cardsHeaderId}\n >\n <div className={clsx(hasToolsHeader && styles['has-header'])}>\n {status ?? (\n <CardsList\n items={items}\n cardDefinition={cardDefinition}\n trackBy={trackBy}\n selectionType={selectionType}\n columns={columns}\n isItemSelected={isItemSelected}\n getItemSelectionProps={getItemSelectionProps}\n visibleSections={visibleSections}\n updateShiftToggle={updateShiftToggle}\n onFocus={onCardFocus}\n ariaDescribedby={cardsHeaderId}\n ariaLabelledby={cardsHeaderId}\n />\n )}\n </div>\n </InternalContainer>\n </div>\n );\n}) as CardsForwardRefType;\n\nexport default Cards;\n\nconst CardsList = <T,>({\n items,\n cardDefinition,\n trackBy,\n selectionType,\n columns,\n isItemSelected,\n getItemSelectionProps,\n visibleSections,\n updateShiftToggle,\n onFocus,\n ariaLabelledby,\n ariaDescribedby,\n}: Pick<CardsProps<T>, 'items' | 'cardDefinition' | 'trackBy' | 'selectionType' | 'visibleSections'> & {\n columns: number | null;\n isItemSelected: (item: T) => boolean;\n getItemSelectionProps: (item: T) => SelectionControlProps;\n updateShiftToggle: (state: boolean) => void;\n onFocus: FocusEventHandler<HTMLElement>;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n}) => {\n const selectable = !!selectionType;\n\n const { moveFocusDown, moveFocusUp } = useFocusMove(selectionType, items.length);\n\n let visibleSectionsDefinition = cardDefinition.sections || [];\n visibleSectionsDefinition = visibleSections\n ? visibleSectionsDefinition.filter(\n (section: CardsProps.SectionDefinition<T>) => section.id && visibleSections.indexOf(section.id) !== -1\n )\n : visibleSectionsDefinition;\n\n let listRole: 'group' | undefined = undefined;\n let listItemRole: 'presentation' | undefined = undefined;\n\n if (selectable) {\n listRole = 'group';\n listItemRole = 'presentation';\n }\n\n return (\n <ol\n className={clsx(styles.list, styles[`list-grid-${columns || 1}`])}\n role={listRole}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n {...(focusMarkers && focusMarkers.root)}\n >\n {items.map((item, index) => (\n <li\n className={clsx(styles.card, {\n [styles['card-selectable']]: selectable,\n [styles['card-selected']]: selectable && isItemSelected(item),\n })}\n key={getItemKey(trackBy, item, index)}\n onFocus={onFocus}\n {...(focusMarkers && focusMarkers.item)}\n role={listItemRole}\n >\n <div className={styles['card-inner']}>\n <div className={styles['card-header']}>\n <span className={styles['card-header-inner']}>\n {cardDefinition.header ? cardDefinition.header(item) : ''}\n </span>\n {selectable && (\n <div className={styles['selection-control']}>\n <SelectionControl\n onFocusDown={moveFocusDown}\n onFocusUp={moveFocusUp}\n onShiftToggle={updateShiftToggle}\n {...getItemSelectionProps(item)}\n />\n </div>\n )}\n </div>\n {visibleSectionsDefinition.map(({ width = 100, header, content, id }, index) => (\n <div key={id || index} className={styles.section} style={{ width: `${width}%` }}>\n {header ? <div className={styles['section-header']}>{header}</div> : ''}\n {content ? <div className={styles['section-content']}>{content(item)}</div> : ''}\n </div>\n ))}\n </div>\n </li>\n ))}\n </ol>\n );\n};\n\napplyDisplayName(Cards, 'Cards');\n"]}
@@ -19,11 +19,7 @@ export interface BaseCheckboxProps extends BaseComponentProps, FormFieldControlP
19
19
  */
20
20
  disabled?: boolean;
21
21
  /**
22
- * Specifies the ID of the native form element. You can use it to relate
23
- * a label element's `for` attribute to this control.
24
- *
25
- * It defaults to an automatically generated ID that
26
- * is provided by its parent form field component.
22
+ * Specifies the ID of the native form element. By default, it uses an automatically generated ID.
27
23
  */
28
24
  controlId?: string;
29
25
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"base-checkbox.d.ts","sourceRoot":"","sources":["../../../src/checkbox/base-checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAA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AyB,CAAC;IAEpC;;OAEG;IACH,MAAM,CAAC,EAAE,yBAAyB,CAAC;IAEnC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"base-checkbox.js","sourceRoot":"","sources":["../../../src/checkbox/base-checkbox.tsx"],"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';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\n\nexport interface BaseCheckboxProps extends BaseComponentProps, FormFieldControlProps {\n /**\n * Specifies if the component is selected.\n */\n checked: boolean;\n\n /**\n * Specifies the name of the control used in HTML forms.\n */\n name?: string;\n\n /**\n * Specifies if the control is disabled, which prevents the\n * user from modifying the value and prevents the value from\n * being included in a form submission. A disabled control can't\n * receive focus.\n */\n disabled?: boolean;\n\n /**\n * Specifies the ID of the native form element. You can use it to relate\n * a label element's `for` attribute to this control.\n *\n * It defaults to an automatically generated ID that\n * is provided by its parent form field component.\n */\n controlId?: string;\n\n /**\n * Adds an `aria-label` to the native control.\n *\n * Use this if you don't have a visible label for this control.\n */\n ariaLabel?: string;\n\n /**\n * Called when input focus is moved to the UI control.\n */\n onFocus?: NonCancelableEventHandler;\n\n /**\n * Called when input focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler;\n\n children?: React.ReactNode;\n\n /**\n * Description that appears below the label.\n */\n description?: React.ReactNode;\n}\n"]}
1
+ {"version":3,"file":"base-checkbox.js","sourceRoot":"","sources":["../../../src/checkbox/base-checkbox.tsx"],"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';\nimport { FormFieldControlProps } from '../internal/context/form-field-context';\n\nexport interface BaseCheckboxProps extends BaseComponentProps, FormFieldControlProps {\n /**\n * Specifies if the component is selected.\n */\n checked: boolean;\n\n /**\n * Specifies the name of the control used in HTML forms.\n */\n name?: string;\n\n /**\n * Specifies if the control is disabled, which prevents the\n * user from modifying the value and prevents the value from\n * being included in a form submission. A disabled control can't\n * receive focus.\n */\n disabled?: boolean;\n\n /**\n * Specifies the ID of the native form element. By default, it uses an automatically generated ID.\n */\n controlId?: string;\n\n /**\n * Adds an `aria-label` to the native control.\n *\n * Use this if you don't have a visible label for this control.\n */\n ariaLabel?: string;\n\n /**\n * Called when input focus is moved to the UI control.\n */\n onFocus?: NonCancelableEventHandler;\n\n /**\n * Called when input focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler;\n\n children?: React.ReactNode;\n\n /**\n * Description that appears below the label.\n */\n description?: React.ReactNode;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/checkbox/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAKjD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,UAAU,aAAc,SAAQ,aAAa,EAAE,0BAA0B;IACvE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;CACf;AAED,QAAA,MAAM,gBAAgB,yFA4ErB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/checkbox/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAKjD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,UAAU,aAAc,SAAQ,aAAa,EAAE,0BAA0B;IACvE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;CACf;AAED,QAAA,MAAM,gBAAgB,yFA2ErB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -9,8 +9,10 @@ import { getBaseProps } from '../internal/base-component';
9
9
  import AbstractSwitch from '../internal/components/abstract-switch';
10
10
  import styles from './styles.css.js';
11
11
  import CheckboxIcon from '../internal/components/checkbox-icon';
12
+ import { useFormFieldContext } from '../internal/context/form-field-context';
12
13
  var InternalCheckbox = React.forwardRef(function (_a, ref) {
13
- var controlId = _a.controlId, name = _a.name, checked = _a.checked, disabled = _a.disabled, indeterminate = _a.indeterminate, children = _a.children, description = _a.description, ariaLabel = _a.ariaLabel, ariaLabelledby = _a.ariaLabelledby, ariaDescribedby = _a.ariaDescribedby, onFocus = _a.onFocus, onBlur = _a.onBlur, onChange = _a.onChange, withoutLabel = _a.withoutLabel, tabIndex = _a.tabIndex, __internalRootRef = _a.__internalRootRef, rest = __rest(_a, ["controlId", "name", "checked", "disabled", "indeterminate", "children", "description", "ariaLabel", "ariaLabelledby", "ariaDescribedby", "onFocus", "onBlur", "onChange", "withoutLabel", "tabIndex", "__internalRootRef"]);
14
+ var controlId = _a.controlId, name = _a.name, checked = _a.checked, disabled = _a.disabled, indeterminate = _a.indeterminate, children = _a.children, description = _a.description, ariaLabel = _a.ariaLabel, onFocus = _a.onFocus, onBlur = _a.onBlur, onChange = _a.onChange, withoutLabel = _a.withoutLabel, tabIndex = _a.tabIndex, __internalRootRef = _a.__internalRootRef, rest = __rest(_a, ["controlId", "name", "checked", "disabled", "indeterminate", "children", "description", "ariaLabel", "onFocus", "onBlur", "onChange", "withoutLabel", "tabIndex", "__internalRootRef"]);
15
+ var _b = useFormFieldContext(rest), ariaDescribedby = _b.ariaDescribedby, ariaLabelledby = _b.ariaLabelledby;
14
16
  var baseProps = getBaseProps(rest);
15
17
  var checkboxRef = useRef(null);
16
18
  useForwardFocus(ref, checkboxRef);
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/checkbox/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,cAAc,MAAM,wCAAwC,CAAC;AAEpE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,YAAY,MAAM,sCAAsC,CAAC;AAQhE,IAAM,gBAAgB,GAAG,KAAK,CAAC,UAAU,CACvC,UACE,EAkBC,EACD,GAAG;IAlBD,IAAA,SAAS,eAAA,EACT,IAAI,UAAA,EACJ,OAAO,aAAA,EACP,QAAQ,cAAA,EACR,aAAa,mBAAA,EACb,QAAQ,cAAA,EACR,WAAW,iBAAA,EACX,SAAS,eAAA,EACT,cAAc,oBAAA,EACd,eAAe,qBAAA,EACf,OAAO,aAAA,EACP,MAAM,YAAA,EACN,QAAQ,cAAA,EACR,YAAY,kBAAA,EACZ,QAAQ,cAAA,EACR,iBAAiB,uBAAA,EACd,IAAI,cAjBT,4NAkBC,CADQ;IAIT,IAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACrC,IAAM,WAAW,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IACnD,eAAe,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IAClC,SAAS,CAAC;QACR,IAAI,WAAW,CAAC,OAAO,EAAE;YACvB,WAAW,CAAC,OAAO,CA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pC,EACD,aAAa,EAAE,oBAAC,YAAY,IAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,GAAI,EACnG,YAAY,EAAE,YAAY,EAC1B,iBAAiB,EAAE,iBAAiB,IACpC,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,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, { useEffect, useRef } from 'react';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { getBaseProps } from '../internal/base-component';\nimport AbstractSwitch from '../internal/components/abstract-switch';\nimport { CheckboxProps } from './interfaces';\nimport styles from './styles.css.js';\nimport CheckboxIcon from '../internal/components/checkbox-icon';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\ninterface InternalProps extends CheckboxProps, InternalBaseComponentProps {\n withoutLabel?: boolean;\n tabIndex?: -1;\n}\n\nconst InternalCheckbox = React.forwardRef<CheckboxProps.Ref, InternalProps>(\n (\n {\n controlId,\n name,\n checked,\n disabled,\n indeterminate,\n children,\n description,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n onFocus,\n onBlur,\n onChange,\n withoutLabel,\n tabIndex,\n __internalRootRef,\n ...rest\n },\n ref\n ) => {\n const baseProps = getBaseProps(rest);\n const checkboxRef = useRef<HTMLInputElement>(null);\n useForwardFocus(ref, checkboxRef);\n useEffect(() => {\n if (checkboxRef.current) {\n checkboxRef.current.indeterminate = Boolean(indeterminate);\n }\n });\n return (\n <AbstractSwitch\n {...baseProps}\n className={clsx(styles.root, baseProps.className)}\n controlClassName={styles['checkbox-control']}\n outlineClassName={styles.outline}\n controlId={controlId}\n disabled={disabled}\n label={children}\n description={description}\n descriptionBottomPadding={true}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n nativeControl={nativeControlProps => (\n <input\n {...nativeControlProps}\n ref={checkboxRef}\n type=\"checkbox\"\n checked={checked}\n name={name}\n tabIndex={tabIndex}\n onFocus={onFocus && (() => fireNonCancelableEvent(onFocus))}\n onBlur={onBlur && (() => fireNonCancelableEvent(onBlur))}\n // empty handler to suppress React controllability warning\n onChange={() => {}}\n onClick={\n // Using onClick because onChange does not fire in indeterminate state in Internet Explorer and Legacy Edge\n // https://stackoverflow.com/questions/33523130/ie-does-not-fire-change-event-on-indeterminate-checkbox-when-you-click-on-it\n onChange &&\n (() =>\n fireNonCancelableEvent(\n onChange,\n // for deterministic transitions \"indeterminate\" -> \"checked\" -> \"unchecked\"\n indeterminate ? { checked: true, indeterminate: false } : { checked: !checked, indeterminate: false }\n ))\n }\n />\n )}\n styledControl={<CheckboxIcon checked={checked} indeterminate={indeterminate} disabled={disabled} />}\n withoutLabel={withoutLabel}\n __internalRootRef={__internalRootRef}\n />\n );\n }\n);\n\nexport default InternalCheckbox;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/checkbox/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,cAAc,MAAM,wCAAwC,CAAC;AAEpE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,YAAY,MAAM,sCAAsC,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAO7E,IAAM,gBAAgB,GAAG,KAAK,CAAC,UAAU,CACvC,UACE,EAgBC,E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EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,IAAI,CAAC,cAAM,OAAA,sBAAsB,CAAC,OAAO,CAAC,EAA/B,CAA+B,CAAC,EAC3D,MAAM,EAAE,MAAM,IAAI,CAAC,cAAM,OAAA,sBAAsB,CAAC,MAAM,CAAC,EAA9B,CAA8B,CAAC;YACxD,0DAA0D;YAC1D,QAAQ,EAAE,cAAO,CAAC,EAClB,OAAO;YACL,2GAA2G;YAC3G,4HAA4H;YAC5H,QAAQ;gBACR,CAAC;oBACC,OAAA,sBAAsB,CACpB,QAAQ;oBACR,4EAA4E;oBAC5E,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CACtG;gBAJD,CAIC,CAAC,IAEN,CACH,EAxBoC,CAwBpC,EACD,aAAa,EAAE,oBAAC,YAAY,IAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,GAAI,EACnG,YAAY,EAAE,YAAY,EAC1B,iBAAiB,EAAE,iBAAiB,IACpC,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,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, { useEffect, useRef } from 'react';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { getBaseProps } from '../internal/base-component';\nimport AbstractSwitch from '../internal/components/abstract-switch';\nimport { CheckboxProps } from './interfaces';\nimport styles from './styles.css.js';\nimport CheckboxIcon from '../internal/components/checkbox-icon';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\n\ninterface InternalProps extends CheckboxProps, InternalBaseComponentProps {\n withoutLabel?: boolean;\n tabIndex?: -1;\n}\n\nconst InternalCheckbox = React.forwardRef<CheckboxProps.Ref, InternalProps>(\n (\n {\n controlId,\n name,\n checked,\n disabled,\n indeterminate,\n children,\n description,\n ariaLabel,\n onFocus,\n onBlur,\n onChange,\n withoutLabel,\n tabIndex,\n __internalRootRef,\n ...rest\n },\n ref\n ) => {\n const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(rest);\n const baseProps = getBaseProps(rest);\n const checkboxRef = useRef<HTMLInputElement>(null);\n useForwardFocus(ref, checkboxRef);\n useEffect(() => {\n if (checkboxRef.current) {\n checkboxRef.current.indeterminate = Boolean(indeterminate);\n }\n });\n return (\n <AbstractSwitch\n {...baseProps}\n className={clsx(styles.root, baseProps.className)}\n controlClassName={styles['checkbox-control']}\n outlineClassName={styles.outline}\n controlId={controlId}\n disabled={disabled}\n label={children}\n description={description}\n descriptionBottomPadding={true}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n nativeControl={nativeControlProps => (\n <input\n {...nativeControlProps}\n ref={checkboxRef}\n type=\"checkbox\"\n checked={checked}\n name={name}\n tabIndex={tabIndex}\n onFocus={onFocus && (() => fireNonCancelableEvent(onFocus))}\n onBlur={onBlur && (() => fireNonCancelableEvent(onBlur))}\n // empty handler to suppress React controllability warning\n onChange={() => {}}\n onClick={\n // Using onClick because onChange does not fire in indeterminate state in Internet Explorer and Legacy Edge\n // https://stackoverflow.com/questions/33523130/ie-does-not-fire-change-event-on-indeterminate-checkbox-when-you-click-on-it\n onChange &&\n (() =>\n fireNonCancelableEvent(\n onChange,\n // for deterministic transitions \"indeterminate\" -> \"checked\" -> \"unchecked\"\n indeterminate ? { checked: true, indeterminate: false } : { checked: !checked, indeterminate: false }\n ))\n }\n />\n )}\n styledControl={<CheckboxIcon checked={checked} indeterminate={indeterminate} disabled={disabled} />}\n withoutLabel={withoutLabel}\n __internalRootRef={__internalRootRef}\n />\n );\n }\n);\n\nexport default InternalCheckbox;\n"]}
@@ -8,6 +8,7 @@ export interface InternalContainerProps extends Omit<ContainerProps, 'variant'>,
8
8
  __disableFooterPaddings?: boolean;
9
9
  __hiddenContent?: boolean;
10
10
  __headerRef?: React.RefObject<HTMLDivElement>;
11
+ __headerId?: string;
11
12
  /**
12
13
  * Additional internal variant:
13
14
  * * `embedded` - Use this variant within a parent container (such as a modal,
@@ -16,5 +17,5 @@ export interface InternalContainerProps extends Omit<ContainerProps, 'variant'>,
16
17
  */
17
18
  variant?: ContainerProps['variant'] | 'embedded' | 'full-page' | 'cards';
18
19
  }
19
- export default function InternalContainer({ header, footer, children, variant, disableHeaderPaddings, disableContentPaddings, __stickyOffset, __stickyHeader, __internalRootRef, __disableFooterDivider, __disableFooterPaddings, __hiddenContent, __headerRef, ...restProps }: InternalContainerProps): JSX.Element;
20
+ export default function InternalContainer({ header, footer, children, variant, disableHeaderPaddings, disableContentPaddings, __stickyOffset, __stickyHeader, __internalRootRef, __disableFooterDivider, __disableFooterPaddings, __hiddenContent, __headerRef, __headerId, ...restProps }: InternalContainerProps): JSX.Element;
20
21
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/container/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAMlF,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,EAAE,0BAA0B;IACzG,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,uBAAuB,CAAC,EAAE,OAA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