@cloudscape-design/components-themeable 3.0.1095 → 3.0.1097
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/button/styles.scss +4 -0
- package/lib/internal/scss/button/test-classes/styles.scss +4 -4
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/template/app-layout/runtime-drawer/index.d.ts +3 -0
- package/lib/internal/template/app-layout/runtime-drawer/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/runtime-drawer/index.js +19 -2
- package/lib/internal/template/app-layout/runtime-drawer/index.js.map +1 -1
- package/lib/internal/template/app-layout/utils/use-ai-drawer.d.ts +2 -0
- package/lib/internal/template/app-layout/utils/use-ai-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.js +49 -11
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.js +52 -9
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/interfaces.d.ts +4 -0
- package/lib/internal/template/app-layout/visual-refresh-toolbar/interfaces.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/interfaces.js.map +1 -1
- package/lib/internal/template/button/icon-helper.d.ts.map +1 -1
- package/lib/internal/template/button/icon-helper.js +1 -2
- package/lib/internal/template/button/icon-helper.js.map +1 -1
- package/lib/internal/template/button/internal.d.ts +0 -2
- package/lib/internal/template/button/internal.d.ts.map +1 -1
- package/lib/internal/template/button/internal.js +2 -3
- package/lib/internal/template/button/internal.js.map +1 -1
- package/lib/internal/template/button/styles.css.js +22 -21
- package/lib/internal/template/button/styles.scoped.css +72 -68
- package/lib/internal/template/button/styles.selectors.js +22 -21
- package/lib/internal/template/button/test-classes/styles.css.js +2 -5
- package/lib/internal/template/button/test-classes/styles.scoped.css +5 -5
- package/lib/internal/template/button/test-classes/styles.selectors.js +2 -5
- package/lib/internal/template/button-group/icon-button-item.d.ts +2 -2
- package/lib/internal/template/button-group/icon-button-item.d.ts.map +1 -1
- package/lib/internal/template/button-group/icon-button-item.js +1 -1
- package/lib/internal/template/button-group/icon-button-item.js.map +1 -1
- package/lib/internal/template/button-group/interfaces.d.ts +6 -0
- package/lib/internal/template/button-group/interfaces.d.ts.map +1 -1
- package/lib/internal/template/button-group/interfaces.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/internal/plugins/controllers/drawers.d.ts +3 -0
- package/lib/internal/template/internal/plugins/controllers/drawers.d.ts.map +1 -1
- package/lib/internal/template/internal/plugins/controllers/drawers.js +0 -2
- package/lib/internal/template/internal/plugins/controllers/drawers.js.map +1 -1
- package/lib/internal/template/internal/plugins/widget/interfaces.d.ts +3 -0
- package/lib/internal/template/internal/plugins/widget/interfaces.d.ts.map +1 -1
- package/lib/internal/template/internal/plugins/widget/interfaces.js.map +1 -1
- package/lib/internal/template/select/parts/filter.d.ts +1 -1
- package/lib/internal/template/test-utils/dom/button/index.js +5 -4
- package/lib/internal/template/test-utils/dom/button/index.js.map +1 -1
- package/lib/internal/template/test-utils/dom/toggle-button/index.js +4 -3
- package/lib/internal/template/test-utils/dom/toggle-button/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/button/index.js +5 -4
- package/lib/internal/template/test-utils/selectors/button/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/toggle-button/index.js +2 -2
- package/lib/internal/template/test-utils/selectors/toggle-button/index.js.map +1 -1
- package/lib/internal/template/toggle-button/internal.d.ts.map +1 -1
- package/lib/internal/template/toggle-button/internal.js +2 -3
- package/lib/internal/template/toggle-button/internal.js.map +1 -1
- package/package.json +1 -1
- package/lib/internal/scss/toggle-button/test-classes/styles.scss +0 -9
- package/lib/internal/template/toggle-button/test-classes/styles.css.js +0 -7
- package/lib/internal/template/toggle-button/test-classes/styles.scoped.css +0 -8
- package/lib/internal/template/toggle-button/test-classes/styles.selectors.js +0 -8
|
@@ -17,7 +17,7 @@ const IconButtonItem = forwardRef(({ item, showTooltip, showFeedback, onTooltipD
|
|
|
17
17
|
const canShowTooltip = Boolean(showTooltip && !item.disabled && !item.loading);
|
|
18
18
|
const canShowFeedback = Boolean(showTooltip && showFeedback && item.popoverFeedback);
|
|
19
19
|
return (React.createElement("div", { ref: containerRef },
|
|
20
|
-
React.createElement(InternalButton, { variant: "icon", loading: item.loading, loadingText: item.loadingText, disabled: item.disabled, disabledReason: showFeedback ? undefined : item.disabledReason, __focusable: canShowFeedback, iconName: hasIcon ? item.iconName : 'close', iconUrl: item.iconUrl, iconSvg: item.iconSvg, iconAlt: item.text, ariaLabel: item.text, onClick: event => fireCancelableEvent(onItemClick, { id: item.id }, event), ref: ref, "data-testid": item.id, "data-itemid": item.id, className: clsx(testUtilStyles.item, testUtilStyles['button-group-item']), __title: "" }, item.text),
|
|
20
|
+
React.createElement(InternalButton, { variant: "icon", loading: item.loading, loadingText: item.loadingText, disabled: item.disabled, disabledReason: showFeedback ? undefined : item.disabledReason, __focusable: canShowFeedback, iconName: hasIcon ? item.iconName : 'close', iconUrl: item.iconUrl, iconSvg: item.iconSvg, iconAlt: item.text, ariaLabel: item.text, onClick: event => fireCancelableEvent(onItemClick, { id: item.id }, event), ref: ref, "data-testid": item.id, "data-itemid": item.id, className: clsx(testUtilStyles.item, testUtilStyles['button-group-item']), analyticsAction: item.analyticsAction, __title: "" }, item.text),
|
|
21
21
|
(canShowTooltip || canShowFeedback) && (React.createElement(Tooltip, { trackRef: containerRef, trackKey: item.id, value: (showFeedback && React.createElement(InternalLiveRegion, { tagName: "span" }, item.popoverFeedback)) ||
|
|
22
22
|
item.text, className: clsx(testUtilStyles.tooltip, testUtilStyles['button-group-tooltip']), onDismiss: onTooltipDismiss }))));
|
|
23
23
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button-item.js","sourceRoot":"","sources":["../../../src/button-group/icon-button-item.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAGzE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,OAAO,MAAM,yCAAyC,CAAC;AAC9D,OAAO,EAA0B,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAC1F,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAG5D,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAU1D,MAAM,cAAc,GAAG,UAAU,CAC/B,CACE,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAuB,EACvF,GAA+B,EAC/B,EAAE;IACF,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IACxD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;IAE9D,IAAI,CAAC,OAAO,EAAE;QACZ,QAAQ,CAAC,aAAa,EAAE,kCAAkC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;KACtE;IAED,MAAM,cAAc,GAAG,OAAO,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;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EX,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC,sBAAsB,CAAC,CAAC,EAC/E,SAAS,EAAE,gBAAgB,GAC3B,CACH,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef } from 'react';\nimport clsx from 'clsx';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { ButtonProps } from '../button/interfaces.js';\nimport { InternalButton } from '../button/internal.js';\nimport Tooltip from '../internal/components/tooltip/index.js';\nimport { CancelableEventHandler, fireCancelableEvent } from '../internal/events/index.js';\nimport InternalLiveRegion from '../live-region/internal.js';\nimport { ButtonGroupProps } from './interfaces.js';\n\nimport testUtilStyles from './test-classes/styles.css.js';\n\ninterface IconButtonItemProps {\n item:
|
|
1
|
+
{"version":3,"file":"icon-button-item.js","sourceRoot":"","sources":["../../../src/button-group/icon-button-item.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAGzE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,OAAO,MAAM,yCAAyC,CAAC;AAC9D,OAAO,EAA0B,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAC1F,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAG5D,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAU1D,MAAM,cAAc,GAAG,UAAU,CAC/B,CACE,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAuB,EACvF,GAA+B,EAC/B,EAAE;IACF,MA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,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAAC,EACzE,eAAe,EAAE,IAAI,CAAC,eAAe,EACrC,OAAO,EAAC,EAAE,IAET,IAAI,CAAC,IAAI,CACK;QAChB,CAAC,cAAc,IAAI,eAAe,CAAC,IAAI,CACtC,oBAAC,OAAO,IACN,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,IAAI,CAAC,EAAE,EACjB,KAAK,EACH,CAAC,YAAY,IAAI,oBAAC,kBAAkB,IAAC,OAAO,EAAC,MAAM,IAAE,IAAI,CAAC,eAAe,CAAsB,CAAC;gBAChG,IAAI,CAAC,IAAI,EAEX,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC,sBAAsB,CAAC,CAAC,EAC/E,SAAS,EAAE,gBAAgB,GAC3B,CACH,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef } from 'react';\nimport clsx from 'clsx';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { ButtonProps } from '../button/interfaces.js';\nimport { InternalButton } from '../button/internal.js';\nimport Tooltip from '../internal/components/tooltip/index.js';\nimport { CancelableEventHandler, fireCancelableEvent } from '../internal/events/index.js';\nimport InternalLiveRegion from '../live-region/internal.js';\nimport { ButtonGroupProps, InternalIconButton } from './interfaces.js';\n\nimport testUtilStyles from './test-classes/styles.css.js';\n\ninterface IconButtonItemProps {\n item: InternalIconButton;\n showTooltip: boolean;\n showFeedback: boolean;\n onTooltipDismiss: () => void;\n onItemClick?: CancelableEventHandler<ButtonGroupProps.ItemClickDetails>;\n}\n\nconst IconButtonItem = forwardRef(\n (\n { item, showTooltip, showFeedback, onTooltipDismiss, onItemClick }: IconButtonItemProps,\n ref: React.Ref<ButtonProps.Ref>\n ) => {\n const containerRef = React.useRef<HTMLDivElement>(null);\n const hasIcon = item.iconName || item.iconUrl || item.iconSvg;\n\n if (!hasIcon) {\n warnOnce('ButtonGroup', `Missing icon for item with id: ${item.id}`);\n }\n\n const canShowTooltip = Boolean(showTooltip && !item.disabled && !item.loading);\n const canShowFeedback = Boolean(showTooltip && showFeedback && item.popoverFeedback);\n return (\n <div ref={containerRef}>\n <InternalButton\n variant=\"icon\"\n loading={item.loading}\n loadingText={item.loadingText}\n disabled={item.disabled}\n disabledReason={showFeedback ? undefined : item.disabledReason} // don't show disabled reason when popover feedback is shown\n __focusable={canShowFeedback}\n iconName={hasIcon ? item.iconName : 'close'}\n iconUrl={item.iconUrl}\n iconSvg={item.iconSvg}\n iconAlt={item.text}\n ariaLabel={item.text}\n onClick={event => fireCancelableEvent(onItemClick, { id: item.id }, event)}\n ref={ref}\n data-testid={item.id}\n data-itemid={item.id}\n className={clsx(testUtilStyles.item, testUtilStyles['button-group-item'])}\n analyticsAction={item.analyticsAction}\n __title=\"\"\n >\n {item.text}\n </InternalButton>\n {(canShowTooltip || canShowFeedback) && (\n <Tooltip\n trackRef={containerRef}\n trackKey={item.id}\n value={\n (showFeedback && <InternalLiveRegion tagName=\"span\">{item.popoverFeedback}</InternalLiveRegion>) ||\n item.text\n }\n className={clsx(testUtilStyles.tooltip, testUtilStyles['button-group-tooltip'])}\n onDismiss={onTooltipDismiss}\n />\n )}\n </div>\n );\n }\n);\n\nexport default IconButtonItem;\n"]}
|
|
@@ -101,8 +101,14 @@ export interface ButtonGroupProps extends BaseComponentProps {
|
|
|
101
101
|
*/
|
|
102
102
|
style?: ButtonGroupProps.Style;
|
|
103
103
|
}
|
|
104
|
+
export interface InternalIconButton extends ButtonGroupProps.IconButton {
|
|
105
|
+
analyticsAction?: string;
|
|
106
|
+
}
|
|
107
|
+
export type InternalItemOrGroup = InternalItem | ButtonGroupProps.Group;
|
|
108
|
+
export type InternalItem = InternalIconButton | ButtonGroupProps.IconToggleButton | ButtonGroupProps.IconFileInput | ButtonGroupProps.MenuDropdown;
|
|
104
109
|
export interface InternalButtonGroupProps extends SomeRequired<ButtonGroupProps, 'dropdownExpandToViewport'>, InternalBaseComponentProps {
|
|
105
110
|
style?: ButtonGroupProps.Style;
|
|
111
|
+
items: ReadonlyArray<InternalItemOrGroup>;
|
|
106
112
|
}
|
|
107
113
|
export declare namespace ButtonGroupProps {
|
|
108
114
|
type Variant = 'icon';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/button-group/interfaces.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;IAC1D;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC;IAClC;;;;;;;;;;;;OAYG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwDG;IACH,KAAK,EAAE,aAAa,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACnD;;OAEG;IACH,WAAW,CAAC,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAC3E;;OAEG;IACH,aAAa,CAAC,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;IAC/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gBACtB,WAAW,CAAC,EAAE,MAAM,CAAC;aACtB,CAAC;SACH,CAAC;KACH;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/button-group/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 { ButtonDropdownProps } from '../button-dropdown/interfaces';\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { SomeRequired } from '../internal/types';\n\nexport interface ButtonGroupProps extends BaseComponentProps {\n /**\n * Adds `aria-label` to the button group toolbar element.\n * Use this to provide a unique accessible name for each button group on the page.\n */\n ariaLabel?: string;\n /**\n * Determines the general styling of the button dropdown.\n * * `icon` for icon buttons.\n */\n variant: ButtonGroupProps.Variant;\n /**\n * Use this property to determine dropdown placement strategy for all menu dropdown items.\n *\n * By default, the dropdown height is constrained to fit inside the height of its next scrollable container element.\n * Enabling this property will allow the dropdown to extend beyond that container by using fixed positioning and\n * [React Portals](https://reactjs.org/docs/portals.html).\n *\n * Set this property if the dropdown would otherwise be constrained by a scrollable container,\n * for example inside table and split view layouts.\n *\n * We recommend you use discretion, and don't enable this property unless necessary\n * because fixed positioning results in a slight, visible lag when scrolling complex pages.\n */\n dropdownExpandToViewport?: boolean;\n /**\n * Array of objects with a number of supported types.\n *\n * ### icon-button\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onItemClick` handler and to focus the button using `ref.focus(id)`.\n * * `text` (string) - The name shown as a tooltip for this button.\n * * `disabled` (optional, boolean) - The disabled state indication for this button.\n * * `disabledReason` (optional, boolean) - Provides a reason why the button is disabled (only when `disabled` is `true`). If provided, the button becomes focusable.\n * * `loading` (optional, boolean) - The loading state indication for this button.\n * * `loadingText` (optional, string) - The loading text announced to screen readers.\n * * `iconName` (optional, string) - Specifies the name of the icon, used with the [icon component](/components/icon/).\n * * `iconAlt` (optional, string) - Specifies alternate text for the icon when using `iconUrl`.\n * * `iconUrl` (optional, string) - Specifies the URL of a custom icon.\n * * `iconSvg` (optional, ReactNode) - Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * * `popoverFeedback` (optional, ReactNode) - Text that appears when the user clicks the button. Use to provide feedback to the user.\n *\n * ### icon-toggle-button\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onItemClick` handler and to focus the button using `ref.focus(id)`.\n * * `pressed` (boolean) - The toggle button pressed state.\n * * `text` (string) - The name shown as a tooltip for this button.\n * * `disabled` (optional, boolean) - The disabled state indication for this button.\n * * `disabledReason` (optional, boolean) - Provides a reason why the button is disabled (only when `disabled` is `true`). If provided, the button becomes focusable.\n * * `loading` (optional, boolean) - The loading state indication for this button.\n * * `loadingText` (optional, string) - The loading text announced to screen readers.\n * * `iconName` (optional, string) - Specifies the name of the icon, used with the [icon component](/components/icon/).\n * * `iconUrl` (optional, string) - Specifies the URL of a custom icon.\n * * `iconSvg` (optional, ReactNode) - Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * * `pressedIconName` (optional, string) - Specifies the name of the icon in pressed state, used with the [icon component](/components/icon/).\n * * `pressedIconUrl` (optional, string) - Specifies the URL of a custom icon in pressed state.\n * * `pressedIconSvg` (optional, ReactNode) - Custom SVG icon in pressed state. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * * `popoverFeedback` (optional, ReactNode) - Text that appears when the user clicks the button. Use to provide feedback to the user.\n * * `pressedPopoverFeedback` (optional, ReactNode) - Text that appears when the user clicks the button in pressed state. Defaults to `popoverFeedback`.\n *\n * * ### file-input\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onFilesChange`.\n * * `text` (string) - The name of the menu button shown as a tooltip.\n * * `accept` (optional, string) - Specifies the native file input `accept` attribute to describe the allow-list of file types.\n * * `multiple` (optional, string) - Specifies the native file input `multiple` attribute to allow users entering more than one file.\n *\n * ### menu-dropdown\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onItemClick`.\n * * `text` (string) - The name of the menu button shown as a tooltip.\n * * `disabled` (optional, boolean) - The disabled state indication for the menu button.\n * * `disabledReason` (optional, boolean) - Provides a reason why the button is disabled (only when `disabled` is `true`). If provided, the button becomes focusable.\n * * `loading` (optional, boolean) - The loading state indication for the menu button.\n * * `loadingText` (optional, string) - The loading text announced to screen readers.\n * * `items` (ButtonDropdownProps.ItemOrGroup[]) - The array of dropdown items that belong to this menu.\n *\n * ### group\n *\n * * `text` (string) - The name of the group rendered as ARIA label for this group.\n * * `items` ((ButtonGroupProps.IconButton | ButtonGroupProps.MenuDropdown)[]) - The array of items that belong to this group.\n */\n items: ReadonlyArray<ButtonGroupProps.ItemOrGroup>;\n /**\n * Called when the user clicks on an item, and the item is not disabled. The event detail object contains the id of the clicked item.\n */\n onItemClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;\n /**\n * Called when the user uploads files. The event detail object contains the id and files from the file input item.\n */\n onFilesChange?: NonCancelableEventHandler<ButtonGroupProps.FilesChangeDetails>;\n /**\n * @awsuiSystem core\n */\n style?: ButtonGroupProps.Style;\n}\n\nexport interface InternalButtonGroupProps\n extends SomeRequired<ButtonGroupProps, 'dropdownExpandToViewport'>,\n InternalBaseComponentProps {\n style?: ButtonGroupProps.Style;\n}\n\nexport namespace ButtonGroupProps {\n export type Variant = 'icon';\n\n export type ItemOrGroup = Item | Group;\n export type Item = IconButton | IconToggleButton | IconFileInput | MenuDropdown;\n\n export interface IconButton {\n type: 'icon-button';\n id: string;\n text: string;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n iconName?: IconProps.Name;\n iconAlt?: string;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n popoverFeedback?: React.ReactNode;\n }\n\n export interface IconToggleButton {\n type: 'icon-toggle-button';\n id: string;\n text: string;\n pressed: boolean;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n pressedIconName?: IconProps.Name;\n pressedIconUrl?: string;\n pressedIconSvg?: React.ReactNode;\n popoverFeedback?: React.ReactNode;\n pressedPopoverFeedback?: React.ReactNode;\n }\n\n export interface IconFileInput {\n type: 'icon-file-input';\n id: string;\n text: string;\n accept?: string;\n multiple?: boolean;\n }\n\n export interface MenuDropdown {\n type: 'menu-dropdown';\n id: string;\n text: string;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n items: ReadonlyArray<ButtonDropdownProps.ItemOrGroup>;\n }\n\n export interface Group {\n type: 'group';\n text: string;\n items: ReadonlyArray<ButtonGroupProps.Item>;\n }\n\n export interface ItemClickDetails {\n id: string;\n pressed?: boolean;\n checked?: boolean;\n }\n\n export interface FilesChangeDetails {\n id: string;\n files: File[];\n }\n\n export interface Ref {\n /**\n * Focuses button group item by id.\n */\n focus(itemId: string): void;\n }\n export interface Style {\n root?: {\n background?: string;\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n paddingBlock?: string;\n paddingInline?: string;\n boxShadow?: string;\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n item?: {\n color?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n boxShadow?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/button-group/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 { ButtonDropdownProps } from '../button-dropdown/interfaces';\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { SomeRequired } from '../internal/types';\n\nexport interface ButtonGroupProps extends BaseComponentProps {\n /**\n * Adds `aria-label` to the button group toolbar element.\n * Use this to provide a unique accessible name for each button group on the page.\n */\n ariaLabel?: string;\n /**\n * Determines the general styling of the button dropdown.\n * * `icon` for icon buttons.\n */\n variant: ButtonGroupProps.Variant;\n /**\n * Use this property to determine dropdown placement strategy for all menu dropdown items.\n *\n * By default, the dropdown height is constrained to fit inside the height of its next scrollable container element.\n * Enabling this property will allow the dropdown to extend beyond that container by using fixed positioning and\n * [React Portals](https://reactjs.org/docs/portals.html).\n *\n * Set this property if the dropdown would otherwise be constrained by a scrollable container,\n * for example inside table and split view layouts.\n *\n * We recommend you use discretion, and don't enable this property unless necessary\n * because fixed positioning results in a slight, visible lag when scrolling complex pages.\n */\n dropdownExpandToViewport?: boolean;\n /**\n * Array of objects with a number of supported types.\n *\n * ### icon-button\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onItemClick` handler and to focus the button using `ref.focus(id)`.\n * * `text` (string) - The name shown as a tooltip for this button.\n * * `disabled` (optional, boolean) - The disabled state indication for this button.\n * * `disabledReason` (optional, boolean) - Provides a reason why the button is disabled (only when `disabled` is `true`). If provided, the button becomes focusable.\n * * `loading` (optional, boolean) - The loading state indication for this button.\n * * `loadingText` (optional, string) - The loading text announced to screen readers.\n * * `iconName` (optional, string) - Specifies the name of the icon, used with the [icon component](/components/icon/).\n * * `iconAlt` (optional, string) - Specifies alternate text for the icon when using `iconUrl`.\n * * `iconUrl` (optional, string) - Specifies the URL of a custom icon.\n * * `iconSvg` (optional, ReactNode) - Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * * `popoverFeedback` (optional, ReactNode) - Text that appears when the user clicks the button. Use to provide feedback to the user.\n *\n * ### icon-toggle-button\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onItemClick` handler and to focus the button using `ref.focus(id)`.\n * * `pressed` (boolean) - The toggle button pressed state.\n * * `text` (string) - The name shown as a tooltip for this button.\n * * `disabled` (optional, boolean) - The disabled state indication for this button.\n * * `disabledReason` (optional, boolean) - Provides a reason why the button is disabled (only when `disabled` is `true`). If provided, the button becomes focusable.\n * * `loading` (optional, boolean) - The loading state indication for this button.\n * * `loadingText` (optional, string) - The loading text announced to screen readers.\n * * `iconName` (optional, string) - Specifies the name of the icon, used with the [icon component](/components/icon/).\n * * `iconUrl` (optional, string) - Specifies the URL of a custom icon.\n * * `iconSvg` (optional, ReactNode) - Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * * `pressedIconName` (optional, string) - Specifies the name of the icon in pressed state, used with the [icon component](/components/icon/).\n * * `pressedIconUrl` (optional, string) - Specifies the URL of a custom icon in pressed state.\n * * `pressedIconSvg` (optional, ReactNode) - Custom SVG icon in pressed state. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * * `popoverFeedback` (optional, ReactNode) - Text that appears when the user clicks the button. Use to provide feedback to the user.\n * * `pressedPopoverFeedback` (optional, ReactNode) - Text that appears when the user clicks the button in pressed state. Defaults to `popoverFeedback`.\n *\n * * ### file-input\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onFilesChange`.\n * * `text` (string) - The name of the menu button shown as a tooltip.\n * * `accept` (optional, string) - Specifies the native file input `accept` attribute to describe the allow-list of file types.\n * * `multiple` (optional, string) - Specifies the native file input `multiple` attribute to allow users entering more than one file.\n *\n * ### menu-dropdown\n *\n * * `id` (string) - The unique identifier of the button, used as detail in `onItemClick`.\n * * `text` (string) - The name of the menu button shown as a tooltip.\n * * `disabled` (optional, boolean) - The disabled state indication for the menu button.\n * * `disabledReason` (optional, boolean) - Provides a reason why the button is disabled (only when `disabled` is `true`). If provided, the button becomes focusable.\n * * `loading` (optional, boolean) - The loading state indication for the menu button.\n * * `loadingText` (optional, string) - The loading text announced to screen readers.\n * * `items` (ButtonDropdownProps.ItemOrGroup[]) - The array of dropdown items that belong to this menu.\n *\n * ### group\n *\n * * `text` (string) - The name of the group rendered as ARIA label for this group.\n * * `items` ((ButtonGroupProps.IconButton | ButtonGroupProps.MenuDropdown)[]) - The array of items that belong to this group.\n */\n items: ReadonlyArray<ButtonGroupProps.ItemOrGroup>;\n /**\n * Called when the user clicks on an item, and the item is not disabled. The event detail object contains the id of the clicked item.\n */\n onItemClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;\n /**\n * Called when the user uploads files. The event detail object contains the id and files from the file input item.\n */\n onFilesChange?: NonCancelableEventHandler<ButtonGroupProps.FilesChangeDetails>;\n /**\n * @awsuiSystem core\n */\n style?: ButtonGroupProps.Style;\n}\n\nexport interface InternalIconButton extends ButtonGroupProps.IconButton {\n analyticsAction?: string;\n}\n\nexport type InternalItemOrGroup = InternalItem | ButtonGroupProps.Group;\nexport type InternalItem =\n | InternalIconButton\n | ButtonGroupProps.IconToggleButton\n | ButtonGroupProps.IconFileInput\n | ButtonGroupProps.MenuDropdown;\n\nexport interface InternalButtonGroupProps\n extends SomeRequired<ButtonGroupProps, 'dropdownExpandToViewport'>,\n InternalBaseComponentProps {\n style?: ButtonGroupProps.Style;\n items: ReadonlyArray<InternalItemOrGroup>;\n}\n\nexport namespace ButtonGroupProps {\n export type Variant = 'icon';\n\n export type ItemOrGroup = Item | Group;\n export type Item = IconButton | IconToggleButton | IconFileInput | MenuDropdown;\n\n export interface IconButton {\n type: 'icon-button';\n id: string;\n text: string;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n iconName?: IconProps.Name;\n iconAlt?: string;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n popoverFeedback?: React.ReactNode;\n }\n\n export interface IconToggleButton {\n type: 'icon-toggle-button';\n id: string;\n text: string;\n pressed: boolean;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n pressedIconName?: IconProps.Name;\n pressedIconUrl?: string;\n pressedIconSvg?: React.ReactNode;\n popoverFeedback?: React.ReactNode;\n pressedPopoverFeedback?: React.ReactNode;\n }\n\n export interface IconFileInput {\n type: 'icon-file-input';\n id: string;\n text: string;\n accept?: string;\n multiple?: boolean;\n }\n\n export interface MenuDropdown {\n type: 'menu-dropdown';\n id: string;\n text: string;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n items: ReadonlyArray<ButtonDropdownProps.ItemOrGroup>;\n }\n\n export interface Group {\n type: 'group';\n text: string;\n items: ReadonlyArray<ButtonGroupProps.Item>;\n }\n\n export interface ItemClickDetails {\n id: string;\n pressed?: boolean;\n checked?: boolean;\n }\n\n export interface FilesChangeDetails {\n id: string;\n files: File[];\n }\n\n export interface Ref {\n /**\n * Focuses button group item by id.\n */\n focus(itemId: string): void;\n }\n export interface Style {\n root?: {\n background?: string;\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n paddingBlock?: string;\n paddingInline?: string;\n boxShadow?: string;\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n item?: {\n color?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n boxShadow?: {\n active?: string;\n default?: string;\n disabled?: string;\n hover?: string;\n };\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export var PACKAGE_SOURCE = "components";
|
|
2
|
-
export var PACKAGE_VERSION = "3.0.0 (
|
|
3
|
-
export var GIT_SHA = "
|
|
2
|
+
export var PACKAGE_VERSION = "3.0.0 (979d2709)";
|
|
3
|
+
export var GIT_SHA = "979d2709";
|
|
4
4
|
export var THEME = "open-source-visual-refresh";
|
|
5
5
|
export var SYSTEM = "console";
|
|
6
6
|
export var ALWAYS_VISUAL_REFRESH = true;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ButtonGroupProps } from '../../../button-group/interfaces';
|
|
1
2
|
import { NonCancelableEventHandler } from '../../events';
|
|
2
3
|
type DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;
|
|
3
4
|
interface MountContentContext {
|
|
@@ -35,6 +36,8 @@ export interface DrawerConfig {
|
|
|
35
36
|
unmountContent: (container: HTMLElement) => void;
|
|
36
37
|
preserveInactiveContent?: boolean;
|
|
37
38
|
onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;
|
|
39
|
+
headerActions?: ReadonlyArray<ButtonGroupProps.Item>;
|
|
40
|
+
onHeaderActionClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;
|
|
38
41
|
}
|
|
39
42
|
declare const updatableProperties: readonly ["badge", "resizable", "defaultSize", "orderPriority", "defaultActive", "onResize"];
|
|
40
43
|
export type UpdateDrawerConfig = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawers.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/drawers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"drawers.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/drawers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAGzD,KAAK,sBAAsB,GAAG,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,KAAK,IAAI,CAAC;AAE/E,UAAU,mBAAmB;IAC3B,kBAAkB,EAAE,sBAAsB,CAAC;CAC5C;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,OAAO,CAAC;IAChB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,YAAY;I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AC,QAAQ,EAAE,qBAAqB,GAAG,MAAM,IAAI,CAAC;IAC5D,gBAAgB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI,CAAC;IACxD,eAAe,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;CACxC;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,2BAA2B,CAA4C;IAC/E,OAAO,CAAC,oBAAoB,CAAuC;IACnE,OAAO,CAAC,oBAAoB,CAAuC;IACnE,OAAO,CAAC,sBAAsB,CAAoC;IAClE,OAAO,CAAC,oBAAoB,CAAsC;IAElE,cAAc,aAKR;IAEN,cAAc,WAAY,YAAY,UAMpC;IAEF,YAAY,8BAA+B,kBAAkB,UAgB3D;IAEF,mBAAmB,aAAc,2BAA2B,gBAa1D;IAEF,sBAAsB,aAEpB;IAEF,cAAc,aAAc,sBAAsB,gBAahD;IAEF,cAAc,aAAc,sBAAsB,gBAahD;IAEF,UAAU,aAAc,MAAM,WAAW,qBAAqB,UAE5D;IAEF,WAAW,aAAc,MAAM,WAAW,qBAAqB,UAE7D;IAEF,gBAAgB,aAAc,qBAAqB,gBAMjD;IAEF,cAAc,aAAc,qBAAqB,gBAa/C;IAEF,YAAY,aAAc,MAAM,QAAQ,MAAM,UAE5C;IAEF,eAAe,uBAEb;IAEF,aAAa,CAAC,GAAG,GAAE,OAAO,CAAC,gBAAgB,CAAM,GAAG,gBAAgB;IASpE,eAAe,CAAC,WAAW,GAAE,OAAO,CAAC,kBAAkB,CAAM,GAAG,kBAAkB;CAUnF"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
2
|
import debounce from '../../debounce';
|
|
5
3
|
import { reportRuntimeApiWarning } from '../helpers/metrics';
|
|
6
4
|
const updatableProperties = [
|
|
@@ -1 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WAAW,CAAC,sBAAsB,oCAAlC,WAAW,CAAC,sBAAsB,GAAK,IAAI,CAAC,sBAAsB,EAAC;QACnE,MAAA,WAAW,CAAC,mBAAmB,oCAA/B,WAAW,CAAC,mBAAmB,GAAK,IAAI,CAAC,mBAAmB,EAAC;QAC7D,MAAA,WAAW,CAAC,cAAc,oCAA1B,WAAW,CAAC,cAAc,GAAK,IAAI,CAAC,cAAc,EAAC;QACnD,MAAA,WAAW,CAAC,cAAc,oCAA1B,WAAW,CAAC,cAAc,GAAK,IAAI,CAAC,cAAc,EAAC;QACnD,MAAA,WAAW,CAAC,cAAc,oCAA1B,WAAW,CAAC,cAAc,GAAK,IAAI,CAAC,cAAc,EAAC;QACnD,MAAA,WAAW,CAAC,gBAAgB,oCAA5B,WAAW,CAAC,gBAAgB,GAAK,IAAI,CAAC,gBAAgB,EAAC;QACvD,MAAA,WAAW,CAAC,eAAe,oCAA3B,WAAW,CAAC,eAAe,GAAK,IAAI,CAAC,eAAe,EAAC;QACrD,OAAO,WAAiC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport debounce from '../../debounce';\nimport { NonCancelableEventHandler } from '../../events';\nimport { reportRuntimeApiWarning } from '../helpers/metrics';\n\ntype DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\ninterface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\nexport interface DrawerStateChangeParams {\n isOpen: boolean;\n initiatedByUserAction?: boolean;\n}\n\nexport interface DrawerConfig {\n id: string;\n type?: 'local' | 'global';\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n resizeHandleTooltipText?: string;\n expandedModeButton?: string;\n };\n isExpandable?: boolean;\n badge?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n orderPriority?: number;\n defaultActive?: boolean;\n trigger?: {\n iconSvg: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n}\n\nconst updatableProperties = [\n 'badge',\n 'resizable',\n 'defaultSize',\n 'orderPriority',\n 'defaultActive',\n 'onResize',\n] as const;\n\nexport type UpdateDrawerConfig = { id: DrawerConfig['id'] } & Partial<\n Pick<DrawerConfig, (typeof updatableProperties)[number]>\n>;\n\ntype DrawersRegistrationListener = (drawers: Array<DrawerConfig>) => void;\ntype DrawersUpdateListener = (drawers: Array<DrawerConfig>) => void;\n\nexport type DrawersToggledListener = (drawerId: string, params?: OpenCloseDrawerParams) => void;\ntype DrawersResizeListener = (drawerId: string, size: number) => void;\n\ninterface OpenCloseDrawerParams {\n initiatedByUserAction: boolean;\n}\n\nexport interface DrawersApiPublic {\n registerDrawer(config: DrawerConfig): void;\n updateDrawer(config: UpdateDrawerConfig): void;\n openDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n closeDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n resizeDrawer(drawerId: string, size: number): void;\n}\n\nexport interface DrawersApiInternal {\n clearRegisteredDrawers(): void;\n onDrawersRegistered(listener: DrawersRegistrationListener): () => void;\n onDrawerOpened(listener: DrawersToggledListener): () => void;\n onDrawerClosed(listener: DrawersToggledListener): () => void;\n onDrawerResize(listener: DrawersResizeListener): () => void;\n onDrawersUpdated(listener: DrawersUpdateListener): void;\n getDrawersState(): Array<DrawerConfig>;\n}\n\nexport class DrawersController {\n private drawers: Array<DrawerConfig> = [];\n private drawersRegistrationListener: DrawersRegistrationListener | null = null;\n private drawerOpenedListener: DrawersToggledListener | null = null;\n private drawerClosedListener: DrawersToggledListener | null = null;\n private drawersUpdateListeners: Array<DrawersUpdateListener> = [];\n private drawerResizeListener: DrawersResizeListener | null = null;\n\n scheduleUpdate = debounce(() => {\n this.drawersRegistrationListener?.(this.drawers);\n this.drawersUpdateListeners.forEach(drawersUpdateListeners => {\n drawersUpdateListeners?.(this.drawers);\n });\n }, 0);\n\n registerDrawer = (config: DrawerConfig) => {\n if (this.drawers.find(drawer => drawer.id === config.id)) {\n reportRuntimeApiWarning('app-layout-drawers', `drawer with id \"${config.id}\" is already registered`);\n }\n this.drawers = this.drawers.concat(config);\n this.scheduleUpdate();\n };\n\n updateDrawer = ({ id: drawerId, ...rest }: UpdateDrawerConfig) => {\n const drawerIndex = this.drawers.findIndex(({ id }) => id === drawerId);\n const oldDrawerConfig = this.drawers?.[drawerIndex];\n if (!oldDrawerConfig) {\n throw new Error(`[AwsUi] [runtime drawers] drawer with id ${drawerId} not found`);\n }\n const drawers = this.drawers.slice();\n const updatedDrawer = { ...oldDrawerConfig };\n for (const key of updatableProperties) {\n if (key in rest) {\n updatedDrawer[key] = (rest as any)[key];\n }\n }\n drawers[drawerIndex] = updatedDrawer;\n this.drawers = drawers;\n this.scheduleUpdate();\n };\n\n onDrawersRegistered = (listener: DrawersRegistrationListener) => {\n if (this.drawersRegistrationListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawersRegistered'\n );\n }\n this.drawersRegistrationListener = listener;\n this.scheduleUpdate();\n return () => {\n this.drawersRegistrationListener = null;\n this.drawersUpdateListeners = [];\n };\n };\n\n clearRegisteredDrawers = () => {\n this.drawers = [];\n };\n\n onDrawerOpened = (listener: DrawersToggledListener) => {\n if (this.drawerOpenedListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerOpened'\n );\n }\n\n this.drawerOpenedListener = listener;\n\n return () => {\n this.drawerOpenedListener = null;\n };\n };\n\n onDrawerClosed = (listener: DrawersToggledListener) => {\n if (this.drawerClosedListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerClosed'\n );\n }\n\n this.drawerClosedListener = listener;\n\n return () => {\n this.drawerClosedListener = null;\n };\n };\n\n openDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerOpenedListener?.(drawerId, params);\n };\n\n closeDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerClosedListener?.(drawerId, params);\n };\n\n onDrawersUpdated = (listener: DrawersUpdateListener) => {\n this.drawersUpdateListeners.push(listener);\n\n return () => {\n this.drawersUpdateListeners = this.drawersUpdateListeners.filter(item => item !== listener);\n };\n };\n\n onDrawerResize = (listener: DrawersResizeListener) => {\n if (this.drawerResizeListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerResize'\n );\n }\n\n this.drawerResizeListener = listener;\n\n return () => {\n this.drawerResizeListener = null;\n };\n };\n\n resizeDrawer = (drawerId: string, size: number) => {\n this.drawerResizeListener?.(drawerId, size);\n };\n\n getDrawersState = () => {\n return this.drawers;\n };\n\n installPublic(api: Partial<DrawersApiPublic> = {}): DrawersApiPublic {\n api.registerDrawer ??= this.registerDrawer;\n api.updateDrawer ??= this.updateDrawer;\n api.openDrawer ??= this.openDrawer;\n api.closeDrawer ??= this.closeDrawer;\n api.resizeDrawer ??= this.resizeDrawer;\n return api as DrawersApiPublic;\n }\n\n installInternal(internalApi: Partial<DrawersApiInternal> = {}): DrawersApiInternal {\n internalApi.clearRegisteredDrawers ??= this.clearRegisteredDrawers;\n internalApi.onDrawersRegistered ??= this.onDrawersRegistered;\n internalApi.onDrawerOpened ??= this.onDrawerOpened;\n internalApi.onDrawerClosed ??= this.onDrawerClosed;\n internalApi.onDrawerResize ??= this.onDrawerResize;\n internalApi.onDrawersUpdated ??= this.onDrawersUpdated;\n internalApi.getDrawersState ??= this.getDrawersState;\n return internalApi as DrawersApiInternal;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"drawers.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/controllers/drawers.ts"],"names":[],"mappings":";AAGA,OAAO,QAAQ,MAA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I,CAAC,mBAAmB,EAAC;QAC7D,MAAA,WAAW,CAAC,cAAc,oCAA1B,WAAW,CAAC,cAAc,GAAK,IAAI,CAAC,cAAc,EAAC;QACnD,MAAA,WAAW,CAAC,cAAc,oCAA1B,WAAW,CAAC,cAAc,GAAK,IAAI,CAAC,cAAc,EAAC;QACnD,MAAA,WAAW,CAAC,cAAc,oCAA1B,WAAW,CAAC,cAAc,GAAK,IAAI,CAAC,cAAc,EAAC;QACnD,MAAA,WAAW,CAAC,gBAAgB,oCAA5B,WAAW,CAAC,gBAAgB,GAAK,IAAI,CAAC,gBAAgB,EAAC;QACvD,MAAA,WAAW,CAAC,eAAe,oCAA3B,WAAW,CAAC,eAAe,GAAK,IAAI,CAAC,eAAe,EAAC;QACrD,OAAO,WAAiC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonGroupProps } from '../../../button-group/interfaces';\nimport debounce from '../../debounce';\nimport { NonCancelableEventHandler } from '../../events';\nimport { reportRuntimeApiWarning } from '../helpers/metrics';\n\ntype DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\ninterface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\nexport interface DrawerStateChangeParams {\n isOpen: boolean;\n initiatedByUserAction?: boolean;\n}\n\nexport interface DrawerConfig {\n id: string;\n type?: 'local' | 'global';\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n resizeHandleTooltipText?: string;\n expandedModeButton?: string;\n };\n isExpandable?: boolean;\n badge?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n orderPriority?: number;\n defaultActive?: boolean;\n trigger?: {\n iconSvg: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n headerActions?: ReadonlyArray<ButtonGroupProps.Item>;\n onHeaderActionClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;\n}\n\nconst updatableProperties = [\n 'badge',\n 'resizable',\n 'defaultSize',\n 'orderPriority',\n 'defaultActive',\n 'onResize',\n] as const;\n\nexport type UpdateDrawerConfig = { id: DrawerConfig['id'] } & Partial<\n Pick<DrawerConfig, (typeof updatableProperties)[number]>\n>;\n\ntype DrawersRegistrationListener = (drawers: Array<DrawerConfig>) => void;\ntype DrawersUpdateListener = (drawers: Array<DrawerConfig>) => void;\n\nexport type DrawersToggledListener = (drawerId: string, params?: OpenCloseDrawerParams) => void;\ntype DrawersResizeListener = (drawerId: string, size: number) => void;\n\ninterface OpenCloseDrawerParams {\n initiatedByUserAction: boolean;\n}\n\nexport interface DrawersApiPublic {\n registerDrawer(config: DrawerConfig): void;\n updateDrawer(config: UpdateDrawerConfig): void;\n openDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n closeDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;\n resizeDrawer(drawerId: string, size: number): void;\n}\n\nexport interface DrawersApiInternal {\n clearRegisteredDrawers(): void;\n onDrawersRegistered(listener: DrawersRegistrationListener): () => void;\n onDrawerOpened(listener: DrawersToggledListener): () => void;\n onDrawerClosed(listener: DrawersToggledListener): () => void;\n onDrawerResize(listener: DrawersResizeListener): () => void;\n onDrawersUpdated(listener: DrawersUpdateListener): void;\n getDrawersState(): Array<DrawerConfig>;\n}\n\nexport class DrawersController {\n private drawers: Array<DrawerConfig> = [];\n private drawersRegistrationListener: DrawersRegistrationListener | null = null;\n private drawerOpenedListener: DrawersToggledListener | null = null;\n private drawerClosedListener: DrawersToggledListener | null = null;\n private drawersUpdateListeners: Array<DrawersUpdateListener> = [];\n private drawerResizeListener: DrawersResizeListener | null = null;\n\n scheduleUpdate = debounce(() => {\n this.drawersRegistrationListener?.(this.drawers);\n this.drawersUpdateListeners.forEach(drawersUpdateListeners => {\n drawersUpdateListeners?.(this.drawers);\n });\n }, 0);\n\n registerDrawer = (config: DrawerConfig) => {\n if (this.drawers.find(drawer => drawer.id === config.id)) {\n reportRuntimeApiWarning('app-layout-drawers', `drawer with id \"${config.id}\" is already registered`);\n }\n this.drawers = this.drawers.concat(config);\n this.scheduleUpdate();\n };\n\n updateDrawer = ({ id: drawerId, ...rest }: UpdateDrawerConfig) => {\n const drawerIndex = this.drawers.findIndex(({ id }) => id === drawerId);\n const oldDrawerConfig = this.drawers?.[drawerIndex];\n if (!oldDrawerConfig) {\n throw new Error(`[AwsUi] [runtime drawers] drawer with id ${drawerId} not found`);\n }\n const drawers = this.drawers.slice();\n const updatedDrawer = { ...oldDrawerConfig };\n for (const key of updatableProperties) {\n if (key in rest) {\n updatedDrawer[key] = (rest as any)[key];\n }\n }\n drawers[drawerIndex] = updatedDrawer;\n this.drawers = drawers;\n this.scheduleUpdate();\n };\n\n onDrawersRegistered = (listener: DrawersRegistrationListener) => {\n if (this.drawersRegistrationListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawersRegistered'\n );\n }\n this.drawersRegistrationListener = listener;\n this.scheduleUpdate();\n return () => {\n this.drawersRegistrationListener = null;\n this.drawersUpdateListeners = [];\n };\n };\n\n clearRegisteredDrawers = () => {\n this.drawers = [];\n };\n\n onDrawerOpened = (listener: DrawersToggledListener) => {\n if (this.drawerOpenedListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerOpened'\n );\n }\n\n this.drawerOpenedListener = listener;\n\n return () => {\n this.drawerOpenedListener = null;\n };\n };\n\n onDrawerClosed = (listener: DrawersToggledListener) => {\n if (this.drawerClosedListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerClosed'\n );\n }\n\n this.drawerClosedListener = listener;\n\n return () => {\n this.drawerClosedListener = null;\n };\n };\n\n openDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerOpenedListener?.(drawerId, params);\n };\n\n closeDrawer = (drawerId: string, params?: OpenCloseDrawerParams) => {\n this.drawerClosedListener?.(drawerId, params);\n };\n\n onDrawersUpdated = (listener: DrawersUpdateListener) => {\n this.drawersUpdateListeners.push(listener);\n\n return () => {\n this.drawersUpdateListeners = this.drawersUpdateListeners.filter(item => item !== listener);\n };\n };\n\n onDrawerResize = (listener: DrawersResizeListener) => {\n if (this.drawerResizeListener !== null) {\n reportRuntimeApiWarning(\n 'app-layout-drawers',\n 'multiple app layout instances detected when calling onDrawerResize'\n );\n }\n\n this.drawerResizeListener = listener;\n\n return () => {\n this.drawerResizeListener = null;\n };\n };\n\n resizeDrawer = (drawerId: string, size: number) => {\n this.drawerResizeListener?.(drawerId, size);\n };\n\n getDrawersState = () => {\n return this.drawers;\n };\n\n installPublic(api: Partial<DrawersApiPublic> = {}): DrawersApiPublic {\n api.registerDrawer ??= this.registerDrawer;\n api.updateDrawer ??= this.updateDrawer;\n api.openDrawer ??= this.openDrawer;\n api.closeDrawer ??= this.closeDrawer;\n api.resizeDrawer ??= this.resizeDrawer;\n return api as DrawersApiPublic;\n }\n\n installInternal(internalApi: Partial<DrawersApiInternal> = {}): DrawersApiInternal {\n internalApi.clearRegisteredDrawers ??= this.clearRegisteredDrawers;\n internalApi.onDrawersRegistered ??= this.onDrawersRegistered;\n internalApi.onDrawerOpened ??= this.onDrawerOpened;\n internalApi.onDrawerClosed ??= this.onDrawerClosed;\n internalApi.onDrawerResize ??= this.onDrawerResize;\n internalApi.onDrawersUpdated ??= this.onDrawersUpdated;\n internalApi.getDrawersState ??= this.getDrawersState;\n return internalApi as DrawersApiInternal;\n }\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ButtonGroupProps } from '../../../button-group/interfaces';
|
|
1
2
|
import { NonCancelableEventHandler } from '../../events';
|
|
2
3
|
interface Message<Type, Payload> {
|
|
3
4
|
type: Type;
|
|
@@ -40,6 +41,8 @@ export interface DrawerPayload {
|
|
|
40
41
|
onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;
|
|
41
42
|
mountHeader?: (container: HTMLElement) => void;
|
|
42
43
|
unmountHeader?: (container: HTMLElement) => void;
|
|
44
|
+
headerActions?: ReadonlyArray<ButtonGroupProps.Item>;
|
|
45
|
+
onHeaderActionClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;
|
|
43
46
|
}
|
|
44
47
|
export type RegisterDrawerMessage = Message<'registerLeftDrawer', DrawerPayload>;
|
|
45
48
|
export type UpdateDrawerConfigMessage = Message<'updateDrawerConfig', Omit<DrawerPayload, 'mountContent' | 'unmountContent' | 'mountHeader' | 'unmountHeader'>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/widget/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAEzD,UAAU,OAAO,CAAC,IAAI,EAAE,OAAO;IAC7B,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,KAAK,sBAAsB,GAAG,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,KAAK,IAAI,CAAC;AAE/E,UAAU,mBAAmB;IAC3B,kBAAkB,EAAE,sBAAsB,CAAC;CAC5C;AAED,UAAU,uBAAuB;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE;QACV,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,YAAY,CAAC,EAAE,MAAM,CAAC;QAC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;IAC/C,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,WAAW,KAAK,IAAI,CAAC;IACjD,aAAa,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACrD,mBAAmB,CAAC,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CACpF;AAED,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,EAAE,aAAa,CAAC,CAAC;AACjF,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAC7C,oBAAoB,EACpB,IAAI,CAAC,aAAa,EAAE,cAAc,GAAG,gBAAgB,GAAG,aAAa,GAAG,eAAe,CAAC,CACzF,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,YAAY,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AACtE,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,aAAa,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AACxE,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAExF,MAAM,MAAM,sBAAsB,GAC9B,yBAAyB,GACzB,iBAAiB,GACjB,kBAAkB,GAClB,mBAAmB,CAAC;AAExB,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,GAAG,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/widget/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { NonCancelableEventHandler } from '../../events';\n\ninterface Message<Type, Payload> {\n type: Type;\n payload: Payload;\n}\n\ntype DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\ninterface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\ninterface DrawerStateChangeParams {\n isOpen: boolean;\n initiatedByUserAction?: boolean;\n}\n\nexport interface DrawerPayload {\n id: string;\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n resizeHandleTooltipText?: string;\n expandedModeButton?: string;\n exitExpandedModeButton?: string;\n };\n isExpandable?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n defaultActive?: boolean;\n trigger?: {\n iconSvg?: string;\n customIcon?: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n mountHeader?: (container: HTMLElement) => void;\n unmountHeader?: (container: HTMLElement) => void;\n}\n\nexport type RegisterDrawerMessage = Message<'registerLeftDrawer', DrawerPayload>;\nexport type UpdateDrawerConfigMessage = Message<\n 'updateDrawerConfig',\n Omit<DrawerPayload, 'mountContent' | 'unmountContent' | 'mountHeader' | 'unmountHeader'>\n>;\nexport type OpenDrawerMessage = Message<'openDrawer', { id: string }>;\nexport type CloseDrawerMessage = Message<'closeDrawer', { id: string }>;\nexport type ResizeDrawerMessage = Message<'resizeDrawer', { id: string; size: number }>;\n\nexport type AppLayoutUpdateMessage =\n | UpdateDrawerConfigMessage\n | OpenDrawerMessage\n | CloseDrawerMessage\n | ResizeDrawerMessage;\n\nexport type AppLayoutMessage = RegisterDrawerMessage | AppLayoutUpdateMessage;\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/widget/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonGroupProps } from '../../../button-group/interfaces';\nimport { NonCancelableEventHandler } from '../../events';\n\ninterface Message<Type, Payload> {\n type: Type;\n payload: Payload;\n}\n\ntype DrawerVisibilityChange = (callback: (isVisible: boolean) => void) => void;\n\ninterface MountContentContext {\n onVisibilityChange: DrawerVisibilityChange;\n}\n\ninterface DrawerStateChangeParams {\n isOpen: boolean;\n initiatedByUserAction?: boolean;\n}\n\nexport interface DrawerPayload {\n id: string;\n ariaLabels: {\n content?: string;\n closeButton?: string;\n triggerButton?: string;\n resizeHandle?: string;\n resizeHandleTooltipText?: string;\n expandedModeButton?: string;\n exitExpandedModeButton?: string;\n };\n isExpandable?: boolean;\n resizable?: boolean;\n defaultSize?: number;\n onResize?: NonCancelableEventHandler<{ size: number; id: string }>;\n defaultActive?: boolean;\n trigger?: {\n iconSvg?: string;\n customIcon?: string;\n };\n mountContent: (container: HTMLElement, mountContext: MountContentContext) => void;\n unmountContent: (container: HTMLElement) => void;\n preserveInactiveContent?: boolean;\n onToggle?: NonCancelableEventHandler<DrawerStateChangeParams>;\n mountHeader?: (container: HTMLElement) => void;\n unmountHeader?: (container: HTMLElement) => void;\n headerActions?: ReadonlyArray<ButtonGroupProps.Item>;\n onHeaderActionClick?: NonCancelableEventHandler<ButtonGroupProps.ItemClickDetails>;\n}\n\nexport type RegisterDrawerMessage = Message<'registerLeftDrawer', DrawerPayload>;\nexport type UpdateDrawerConfigMessage = Message<\n 'updateDrawerConfig',\n Omit<DrawerPayload, 'mountContent' | 'unmountContent' | 'mountHeader' | 'unmountHeader'>\n>;\nexport type OpenDrawerMessage = Message<'openDrawer', { id: string }>;\nexport type CloseDrawerMessage = Message<'closeDrawer', { id: string }>;\nexport type ResizeDrawerMessage = Message<'resizeDrawer', { id: string; size: number }>;\n\nexport type AppLayoutUpdateMessage =\n | UpdateDrawerConfigMessage\n | OpenDrawerMessage\n | CloseDrawerMessage\n | ResizeDrawerMessage;\n\nexport type AppLayoutMessage = RegisterDrawerMessage | AppLayoutUpdateMessage;\n"]}
|
|
@@ -5,6 +5,6 @@ export interface FilterProps extends InternalInputProps {
|
|
|
5
5
|
ref?: React.Ref<HTMLInputElement>;
|
|
6
6
|
filteringType: SelectProps.FilteringType;
|
|
7
7
|
}
|
|
8
|
-
declare const Filter: React.ForwardRefExoticComponent<Pick<FilterProps, "disabled" | "autoComplete" | "autoFocus" | "name" | "className" | "id" | "placeholder" | "inputMode" | "type" | "readOnly" | "step" | "value" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "onKeyUp" | "warning" | "clearAriaLabel" | "ariaLabel" | "__internalRootRef" | "ariaLabelledby" | "ariaDescribedby" | "__injectAnalyticsComponentMetadata" | "__skipNativeAttributesWarnings" | "invalid" | "controlId" | "
|
|
8
|
+
declare const Filter: React.ForwardRefExoticComponent<Pick<FilterProps, "disabled" | "autoComplete" | "autoFocus" | "name" | "className" | "id" | "placeholder" | "inputMode" | "type" | "readOnly" | "step" | "value" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "onKeyUp" | "warning" | "clearAriaLabel" | "ariaLabel" | "__internalRootRef" | "ariaLabelledby" | "ariaDescribedby" | "__injectAnalyticsComponentMetadata" | "__skipNativeAttributesWarnings" | "invalid" | "controlId" | "ariaRequired" | "filteringType" | "nativeInputAttributes" | "disableBrowserAutocorrect" | "spellcheck" | "__leftIcon" | "__leftIconVariant" | "__onLeftIconClick" | "__rightIcon" | "__onRightIconClick" | "__noBorderRadius" | "__onDelayedInput" | "__onBlurWithDetail" | "__inheritFormFieldProps"> & React.RefAttributes<HTMLInputElement>>;
|
|
9
9
|
export default Filter;
|
|
10
10
|
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -9,11 +9,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
10
10
|
// SPDX-License-Identifier: Apache-2.0
|
|
11
11
|
const dom_1 = require("@cloudscape-design/test-utils-core/dom");
|
|
12
|
-
const styles_selectors_js_1 = require("../../../button/
|
|
13
|
-
const styles_selectors_js_2 = require("../../../
|
|
12
|
+
const styles_selectors_js_1 = require("../../../button/styles.selectors.js");
|
|
13
|
+
const styles_selectors_js_2 = require("../../../button/test-classes/styles.selectors.js");
|
|
14
|
+
const styles_selectors_js_3 = require("../../../spinner/styles.selectors.js");
|
|
14
15
|
class ButtonWrapper extends dom_1.ComponentWrapper {
|
|
15
16
|
findLoadingIndicator() {
|
|
16
|
-
return this.find(`.${styles_selectors_js_1.default['icon-left']}.${
|
|
17
|
+
return this.find(`.${styles_selectors_js_1.default['icon-left']}.${styles_selectors_js_3.default.root}`);
|
|
17
18
|
}
|
|
18
19
|
findTextRegion() {
|
|
19
20
|
return this.find(`.${styles_selectors_js_1.default.content}`);
|
|
@@ -22,7 +23,7 @@ class ButtonWrapper extends dom_1.ComponentWrapper {
|
|
|
22
23
|
return this.element.disabled || this.element.getAttribute('aria-disabled') === 'true';
|
|
23
24
|
}
|
|
24
25
|
findDisabledReason() {
|
|
25
|
-
return (0, dom_1.createWrapper)().find(`.${
|
|
26
|
+
return (0, dom_1.createWrapper)().find(`.${styles_selectors_js_2.default['disabled-reason-tooltip']}`);
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
ButtonWrapper.rootSelector = styles_selectors_js_1.default.button;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/dom/button/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,gEAAkH;AAElH,0FAAqF;AACrF,8EAAiE;AAEjE,MAAqB,aAAc,SAAQ,sBAAmC;IAG5E,oBAAoB;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/dom/button/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,gEAAkH;AAElH,6EAAyD;AACzD,0FAAqF;AACrF,8EAAiE;AAEjE,MAAqB,aAAc,SAAQ,sBAAmC;IAG5E,oBAAoB;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,6BAAM,CAAC,WAAW,CAAC,IAAI,6BAAa,CAAC,IAAI,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,6BAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IACzC,CAAC;IAGD,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,KAAK,MAAM,CAAC;IACxF,CAAC;IAED,kBAAkB;QAChB,OAAO,IAAA,mBAAa,GAAE,CAAC,IAAI,CAAC,IAAI,6BAAqB,CAAC,yBAAyB,CAAC,EAAE,CAAC,CAAC;IACtF,CAAC;;AAjBM,0BAAY,GAAW,6BAAM,CAAC,MAAM,CAAC;AAW5C;IADC,aAAO;+CAGP;AAdH,gCAmBC"}
|
|
@@ -10,13 +10,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
// SPDX-License-Identifier: Apache-2.0
|
|
11
11
|
const dom_1 = require("@cloudscape-design/test-utils-core/dom");
|
|
12
12
|
const button_1 = require("../button");
|
|
13
|
-
const styles_selectors_js_1 = require("../../../
|
|
13
|
+
const styles_selectors_js_1 = require("../../../button/styles.selectors.js");
|
|
14
|
+
const styles_selectors_js_2 = require("../../../toggle-button/styles.selectors.js");
|
|
14
15
|
class ToggleButtonWrapper extends button_1.default {
|
|
15
16
|
isPressed() {
|
|
16
|
-
return this.element.classList.contains(
|
|
17
|
+
return this.element.classList.contains(styles_selectors_js_2.default.pressed);
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
|
-
ToggleButtonWrapper.rootSelector = styles_selectors_js_1.default.
|
|
20
|
+
ToggleButtonWrapper.rootSelector = styles_selectors_js_1.default.button;
|
|
20
21
|
__decorate([
|
|
21
22
|
dom_1.usesDom
|
|
22
23
|
], ToggleButtonWrapper.prototype, "isPressed", null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/dom/toggle-button/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,gEAAiE;AAEjE,sCAAsC;AAEtC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/dom/toggle-button/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,gEAAiE;AAEjE,sCAAsC;AAEtC,6EAA+D;AAC/D,oFAAgE;AAEhE,MAAqB,mBAAoB,SAAQ,gBAAa;IAI5D,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,6BAAM,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;;AALM,gCAAY,GAAW,6BAAY,CAAC,MAAM,CAAC;AAGlD;IADC,aAAO;oDAGP;AANH,sCAOC"}
|
|
@@ -3,17 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
const selectors_1 = require("@cloudscape-design/test-utils-core/selectors");
|
|
6
|
-
const styles_selectors_js_1 = require("../../../button/
|
|
7
|
-
const styles_selectors_js_2 = require("../../../
|
|
6
|
+
const styles_selectors_js_1 = require("../../../button/styles.selectors.js");
|
|
7
|
+
const styles_selectors_js_2 = require("../../../button/test-classes/styles.selectors.js");
|
|
8
|
+
const styles_selectors_js_3 = require("../../../spinner/styles.selectors.js");
|
|
8
9
|
class ButtonWrapper extends selectors_1.ComponentWrapper {
|
|
9
10
|
findLoadingIndicator() {
|
|
10
|
-
return this.find(`.${styles_selectors_js_1.default['icon-left']}.${
|
|
11
|
+
return this.find(`.${styles_selectors_js_1.default['icon-left']}.${styles_selectors_js_3.default.root}`);
|
|
11
12
|
}
|
|
12
13
|
findTextRegion() {
|
|
13
14
|
return this.find(`.${styles_selectors_js_1.default.content}`);
|
|
14
15
|
}
|
|
15
16
|
findDisabledReason() {
|
|
16
|
-
return (0, selectors_1.createWrapper)().find(`.${
|
|
17
|
+
return (0, selectors_1.createWrapper)().find(`.${styles_selectors_js_2.default['disabled-reason-tooltip']}`);
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
exports.default = ButtonWrapper;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/selectors/button/index.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,4EAA+G;AAC/G,0FAAqF;AACrF,8EAAiE;AACjE,MAAqB,aAAc,SAAQ,4BAAgB;IAEzD,oBAAoB;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/selectors/button/index.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,4EAA+G;AAC/G,6EAAyD;AACzD,0FAAqF;AACrF,8EAAiE;AACjE,MAAqB,aAAc,SAAQ,4BAAgB;IAEzD,oBAAoB;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,6BAAM,CAAC,WAAW,CAAC,IAAI,6BAAa,CAAC,IAAI,EAAE,CAAC,CAAC;IACpE,CAAC;IACD,cAAc;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,6BAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IACzC,CAAC;IACD,kBAAkB;QAChB,OAAO,IAAA,yBAAa,GAAE,CAAC,IAAI,CAAC,IAAI,6BAAqB,CAAC,yBAAyB,CAAC,EAAE,CAAC,CAAC;IACtF,CAAC;;AAVH,gCAWC;AAVQ,0BAAY,GAAW,6BAAM,CAAC,MAAM,CAAC"}
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
require("@cloudscape-design/test-utils-core/selectors");
|
|
6
6
|
const button_1 = require("../button");
|
|
7
|
-
const styles_selectors_js_1 = require("../../../
|
|
7
|
+
const styles_selectors_js_1 = require("../../../button/styles.selectors.js");
|
|
8
8
|
class ToggleButtonWrapper extends button_1.default {
|
|
9
9
|
}
|
|
10
10
|
exports.default = ToggleButtonWrapper;
|
|
11
|
-
ToggleButtonWrapper.rootSelector = styles_selectors_js_1.default.
|
|
11
|
+
ToggleButtonWrapper.rootSelector = styles_selectors_js_1.default.button;
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/selectors/toggle-button/index.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,wDAAsD;AACtD,sCAAsC;AACtC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/selectors/toggle-button/index.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,wDAAsD;AACtD,sCAAsC;AACtC,6EAA+D;AAE/D,MAAqB,mBAAoB,SAAQ,gBAAa;;AAA9D,sCAEC;AADQ,gCAAY,GAAW,6BAAY,CAAC,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/toggle-button/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/toggle-button/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAKjD,eAAO,MAAM,oBAAoB;;+CAkDhC,CAAC"}
|
|
@@ -9,7 +9,6 @@ import { fireNonCancelableEvent } from '../internal/events';
|
|
|
9
9
|
import { isDevelopment } from '../internal/is-development';
|
|
10
10
|
import { getToggleIcon } from './util';
|
|
11
11
|
import styles from './styles.css.js';
|
|
12
|
-
import testStyles from './test-classes/styles.css.js';
|
|
13
12
|
export const InternalToggleButton = React.forwardRef((_a, ref) => {
|
|
14
13
|
var { pressed, iconName: defaultIconName, pressedIconName, iconSvg: defaultIconSvg, pressedIconSvg, iconUrl: defaultIconUrl, pressedIconUrl, variant, onChange, className } = _a, rest = __rest(_a, ["pressed", "iconName", "pressedIconName", "iconSvg", "pressedIconSvg", "iconUrl", "pressedIconUrl", "variant", "onChange", "className"]);
|
|
15
14
|
if (isDevelopment) {
|
|
@@ -23,9 +22,9 @@ export const InternalToggleButton = React.forwardRef((_a, ref) => {
|
|
|
23
22
|
warnOnce('ToggleButton', '`pressedIconUrl` must be provided for `pressed` state.');
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
|
-
return (React.createElement(InternalButton, Object.assign({ className: clsx(className,
|
|
25
|
+
return (React.createElement(InternalButton, Object.assign({ className: clsx(className, styles[`variant-${variant}`], { [styles.pressed]: pressed }), variant: variant, formAction: "none", iconName: getToggleIcon(pressed, defaultIconName, pressedIconName), iconUrl: getToggleIcon(pressed, defaultIconUrl, pressedIconUrl), iconSvg: getToggleIcon(pressed, defaultIconSvg, pressedIconSvg), "aria-pressed": pressed, onClick: event => {
|
|
27
26
|
event.preventDefault();
|
|
28
27
|
fireNonCancelableEvent(onChange, { pressed: !pressed });
|
|
29
|
-
} }, rest, { ref: ref
|
|
28
|
+
} }, rest, { ref: ref })));
|
|
30
29
|
});
|
|
31
30
|
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/toggle-button/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,OAAO,MAAM,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/toggle-button/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC,UAAU,CAClD,CACE,EAY2C,EAC3C,GAAqC,EACrC,EAAE;QAdF,EACE,OAAO,EACP,QAAQ,EAAE,eAAe,EACzB,eAAe,EACf,OAAO,EAAE,cAAc,EACvB,cAAc,EACd,OAAO,EAAE,cAAc,EACvB,cAAc,EACd,OAAO,EACP,QAAQ,EACR,SAAS,OAEgC,EADtC,IAAI,cAXT,wIAYC,CADQ;IAIT,IAAI,aAAa,EAAE;QACjB,IAAI,eAAe,IAAI,CAAC,eAAe,EAAE;YACvC,QAAQ,CAAC,cAAc,EAAE,yDAAyD,CAAC,CAAC;SACrF;QAED,IAAI,cAAc,IAAI,CAAC,cAAc,EAAE;YACrC,QAAQ,CAAC,cAAc,EAAE,wDAAwD,CAAC,CAAC;SACpF;QAED,IAAI,cAAc,IAAI,CAAC,cAAc,EAAE;YACrC,QAAQ,CAAC,cAAc,EAAE,wDAAwD,CAAC,CAAC;SACpF;KACF;IAED,OAAO,CACL,oBAAC,cAAc,kBACb,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EACvF,OAAO,EAAE,OAAO,EAChB,UAAU,EAAC,MAAM,EACjB,QAAQ,EAAE,aAAa,CAAC,OAAO,EAAE,eAAe,EAAE,eAAe,CAAC,EAClE,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,cAAc,CAAC,EAC/D,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,cAAc,CAAC,kBACjD,OAAO,EACrB,OAAO,EAAE,KAAK,CAAC,EAAE;YACf,KAAK,CAAC,cAAc,EAAE,CAAC;YAEvB,sBAAsB,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1D,CAAC,IACG,IAAI,IACR,GAAG,EAAE,GAAG,IACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalButton from '../button/internal';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { isDevelopment } from '../internal/is-development';\nimport { ToggleButtonProps } from './interfaces';\nimport { getToggleIcon } from './util';\n\nimport styles from './styles.css.js';\n\nexport const InternalToggleButton = React.forwardRef(\n (\n {\n pressed,\n iconName: defaultIconName,\n pressedIconName,\n iconSvg: defaultIconSvg,\n pressedIconSvg,\n iconUrl: defaultIconUrl,\n pressedIconUrl,\n variant,\n onChange,\n className,\n ...rest\n }: ToggleButtonProps & { __title?: string },\n ref: React.Ref<ToggleButtonProps.Ref>\n ) => {\n if (isDevelopment) {\n if (defaultIconName && !pressedIconName) {\n warnOnce('ToggleButton', '`pressedIconName` must be provided for `pressed` state.');\n }\n\n if (defaultIconSvg && !pressedIconSvg) {\n warnOnce('ToggleButton', '`pressedIconSvg` must be provided for `pressed` state.');\n }\n\n if (defaultIconUrl && !pressedIconUrl) {\n warnOnce('ToggleButton', '`pressedIconUrl` must be provided for `pressed` state.');\n }\n }\n\n return (\n <InternalButton\n className={clsx(className, styles[`variant-${variant}`], { [styles.pressed]: pressed })}\n variant={variant}\n formAction=\"none\"\n iconName={getToggleIcon(pressed, defaultIconName, pressedIconName)}\n iconUrl={getToggleIcon(pressed, defaultIconUrl, pressedIconUrl)}\n iconSvg={getToggleIcon(pressed, defaultIconSvg, pressedIconSvg)}\n aria-pressed={pressed}\n onClick={event => {\n event.preventDefault();\n\n fireNonCancelableEvent(onChange, { pressed: !pressed });\n }}\n {...rest}\n ref={ref}\n />\n );\n }\n);\n"]}
|
package/package.json
CHANGED