@cloudscape-design/components 3.0.1092 → 3.0.1094
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app-layout/utils/use-ai-drawer.d.ts +0 -1
- package/app-layout/utils/use-ai-drawer.d.ts.map +1 -1
- package/app-layout/utils/use-ai-drawer.js +1 -1
- package/app-layout/utils/use-ai-drawer.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.js +2 -2
- package/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/global-drawers.d.ts +0 -1
- package/app-layout/visual-refresh-toolbar/drawer/global-drawers.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/global-drawers.js +0 -2
- package/app-layout/visual-refresh-toolbar/drawer/global-drawers.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/index.d.ts +2 -2
- package/app-layout/visual-refresh-toolbar/drawer/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/index.js +2 -2
- package/app-layout/visual-refresh-toolbar/drawer/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/local-drawer.d.ts +0 -1
- package/app-layout/visual-refresh-toolbar/drawer/local-drawer.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/local-drawer.js +0 -2
- package/app-layout/visual-refresh-toolbar/drawer/local-drawer.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/drawer/styles.css.js +25 -24
- package/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +74 -66
- package/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +25 -24
- package/app-layout/visual-refresh-toolbar/internal.d.ts +0 -7
- package/app-layout/visual-refresh-toolbar/internal.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/internal.js +0 -14
- package/app-layout/visual-refresh-toolbar/internal.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/navigation/index.d.ts +0 -1
- package/app-layout/visual-refresh-toolbar/navigation/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/navigation/index.js +0 -3
- package/app-layout/visual-refresh-toolbar/navigation/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/notifications/index.d.ts +1 -2
- package/app-layout/visual-refresh-toolbar/notifications/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/notifications/index.js +0 -3
- package/app-layout/visual-refresh-toolbar/notifications/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/split-panel/index.d.ts +0 -2
- package/app-layout/visual-refresh-toolbar/split-panel/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/split-panel/index.js +0 -3
- package/app-layout/visual-refresh-toolbar/split-panel/index.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/index.d.ts +1 -2
- package/app-layout/visual-refresh-toolbar/toolbar/index.d.ts.map +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/index.js +0 -3
- package/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
- package/date-range-picker/calendar/index.d.ts +4 -17
- package/date-range-picker/calendar/index.d.ts.map +1 -1
- package/date-range-picker/calendar/index.js +2 -2
- package/date-range-picker/calendar/index.js.map +1 -1
- package/date-range-picker/calendar/interfaces.d.ts +21 -0
- package/date-range-picker/calendar/interfaces.d.ts.map +1 -0
- package/date-range-picker/calendar/interfaces.js +2 -0
- package/date-range-picker/calendar/interfaces.js.map +1 -0
- package/date-range-picker/calendar/range-inputs.d.ts +3 -20
- package/date-range-picker/calendar/range-inputs.d.ts.map +1 -1
- package/date-range-picker/calendar/range-inputs.js +11 -13
- package/date-range-picker/calendar/range-inputs.js.map +1 -1
- package/date-range-picker/calendar/utils.d.ts +5 -1
- package/date-range-picker/calendar/utils.d.ts.map +1 -1
- package/date-range-picker/calendar/utils.js +40 -0
- package/date-range-picker/calendar/utils.js.map +1 -1
- package/date-range-picker/dropdown.d.ts +4 -1
- package/date-range-picker/dropdown.d.ts.map +1 -1
- package/date-range-picker/dropdown.js +2 -2
- package/date-range-picker/dropdown.js.map +1 -1
- package/date-range-picker/index.d.ts.map +1 -1
- package/date-range-picker/index.js +3 -2
- package/date-range-picker/index.js.map +1 -1
- package/date-range-picker/interfaces.d.ts +54 -12
- package/date-range-picker/interfaces.d.ts.map +1 -1
- package/date-range-picker/interfaces.js.map +1 -1
- package/internal/base-component/styles.scoped.css +1 -1
- package/internal/environment.js +2 -2
- package/internal/environment.json +2 -2
- package/internal/manifest.json +1 -1
- package/internal/plugins/widget/internal.d.ts +4 -0
- package/internal/plugins/widget/internal.d.ts.map +1 -1
- package/internal/plugins/widget/internal.js +16 -0
- package/internal/plugins/widget/internal.js.map +1 -1
- package/internal/plugins/widget.d.ts +1 -1
- package/internal/plugins/widget.d.ts.map +1 -1
- package/internal/plugins/widget.js +1 -1
- package/internal/plugins/widget.js.map +1 -1
- package/internal/utils/date-time/format-date-time-with-offset.d.ts.map +1 -1
- package/internal/utils/date-time/format-date-time-with-offset.js +4 -0
- package/internal/utils/date-time/format-date-time-with-offset.js.map +1 -1
- package/link/index.js +1 -1
- package/link/interfaces.d.ts +15 -0
- package/link/interfaces.d.ts.map +1 -1
- package/link/interfaces.js.map +1 -1
- package/link/internal.d.ts.map +1 -1
- package/link/internal.js +4 -3
- package/link/internal.js.map +1 -1
- package/mixed-line-bar-chart/bar-groups.d.ts.map +1 -1
- package/mixed-line-bar-chart/bar-groups.js +4 -1
- package/mixed-line-bar-chart/bar-groups.js.map +1 -1
- package/package.json +1 -1
- package/status-indicator/index.d.ts +1 -1
- package/status-indicator/index.d.ts.map +1 -1
- package/status-indicator/index.js +13 -12
- package/status-indicator/interfaces.d.ts +44 -0
- package/status-indicator/interfaces.d.ts.map +1 -0
- package/status-indicator/interfaces.js +2 -0
- package/status-indicator/interfaces.js.map +1 -0
- package/status-indicator/internal-do-not-use-core.js +17 -0
- package/status-indicator/{index.js.map → internal-do-not-use-core.js.map} +1 -1
- package/status-indicator/internal.d.ts +3 -30
- package/status-indicator/internal.d.ts.map +1 -1
- package/status-indicator/internal.js +6 -2
- package/status-indicator/internal.js.map +1 -1
- package/steps/interfaces.d.ts +1 -1
- package/steps/interfaces.d.ts.map +1 -1
- package/steps/interfaces.js.map +1 -1
- package/table/internal.js +2 -2
- package/table/internal.js.map +1 -1
- package/toggle/index.js +1 -1
- package/toggle/interfaces.d.ts +15 -0
- package/toggle/interfaces.d.ts.map +1 -1
- package/toggle/interfaces.js.map +1 -1
- package/toggle/internal.d.ts.map +1 -1
- package/toggle/internal.js +3 -2
- package/toggle/internal.js.map +1 -1
- package/toggle-button/index.d.ts.map +1 -1
- package/toggle-button/index.js +1 -1
- package/toggle-button/interfaces.d.ts +1 -1
- package/toggle-button/interfaces.d.ts.map +1 -1
- package/toggle-button/interfaces.js.map +1 -1
- package/toggle-button/internal-do-not-use-core.js +2 -2
- package/toggle-button/internal-do-not-use-core.js.map +1 -1
- package/toggle-button/internal.d.ts.map +1 -1
- package/toggle-button/internal.js +2 -2
- package/toggle-button/internal.js.map +1 -1
package/toggle/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/toggle/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAEL,6BAA6B,GAC9B,MAAM,kEAAkE,CAAC;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.js","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EAAE,WAAW,EAChB,IAAI,EAAC,UAAU,EACf,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,mBACK,QAAQ,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EACzD,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAC9C,MAAM,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,MAAM,CAAC;YAC5C,0DAA0D;YAC1D,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC,IAClB,CACH,EACD,OAAO,EAAE,GAAG,EAAE;;YACZ,MAAA,WAAW,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;YAC7B,sBAAsB,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1D,CAAC,EACD,aAAa;QACX,yCAAyC;QACzC,8BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE;gBACvC,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC,EAAE,OAAO;gBAC1C,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,EAAE,QAAQ;gBAC5C,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,EAAE,QAAQ;aAC7C,CAAC,EACF,KAAK,EAAE,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAChE,EAEJ,KAAK,EAAE,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAClE,iBAAiB,EAAE,iBAAiB,IAChC,6BAA6B,CAAC,iBAAiB,CAAC,EACpD,CACH,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, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport {\n GeneratedAnalyticsMetadataFragment,\n getAnalyticsMetadataAttribute,\n} from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { getBaseProps } from '../internal/base-component';\nimport AbstractSwitch from '../internal/components/abstract-switch';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport WithNativeAttributes from '../internal/utils/with-native-attributes';\nimport { GeneratedAnalyticsMetadataToggleComponent } from './analytics-metadata/interfaces';\nimport { ToggleProps } from './interfaces';\nimport { getAbstractSwitchStyles, getStyledControlStyle } from './style';\n\nimport styles from './styles.css.js';\n\ninterface InternalToggleProps extends ToggleProps, InternalBaseComponentProps {\n __injectAnalyticsComponentMetadata?: boolean;\n}\n\nconst InternalToggle = React.forwardRef<ToggleProps.Ref, InternalToggleProps>(\n (\n {\n controlId,\n checked,\n name,\n disabled,\n readOnly,\n children,\n description,\n ariaLabel,\n ariaControls,\n onFocus,\n onBlur,\n onChange,\n nativeInputAttributes,\n __internalRootRef,\n style,\n __injectAnalyticsComponentMetadata,\n ...rest\n },\n ref\n ) => {\n const { ariaDescribedby, ariaLabelledby } = useFormFieldContext(rest);\n const baseProps = getBaseProps(rest);\n const checkboxRef = useRef<HTMLInputElement>(null);\n\n const analyticsMetadata: GeneratedAnalyticsMetadataFragment = {};\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataToggleComponent = {\n name: 'awsui.Toggle',\n label: { root: 'self' },\n properties: {\n checked: `${!!checked}`,\n },\n };\n\n if (__injectAnalyticsComponentMetadata) {\n analyticsMetadata.component = analyticsComponentMetadata;\n }\n\n if (!disabled && !readOnly) {\n analyticsMetadata.action = !checked ? 'select' : 'deselect';\n }\n useForwardFocus(ref, checkboxRef);\n\n return (\n <AbstractSwitch\n {...baseProps}\n className={clsx(styles.root, baseProps.className)}\n controlClassName={clsx(styles['toggle-control'], {\n [styles['toggle-control-checked']]: checked,\n [styles['toggle-control-disabled']]: disabled,\n [styles['toggle-control-readonly']]: readOnly,\n })}\n outlineClassName={styles.outline}\n controlId={controlId}\n disabled={disabled}\n readOnly={readOnly}\n label={children}\n description={description}\n descriptionBottomPadding={true}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n ariaControls={ariaControls}\n nativeControl={nativeControlProps => (\n <WithNativeAttributes\n {...nativeControlProps}\n tag=\"input\"\n componentName=\"Toggle\"\n nativeAttributes={nativeInputAttributes}\n ref={checkboxRef}\n type=\"checkbox\"\n checked={checked}\n name={name}\n aria-disabled={readOnly && !disabled ? 'true' : undefined}\n onFocus={() => fireNonCancelableEvent(onFocus)}\n onBlur={() => fireNonCancelableEvent(onBlur)}\n // empty handler to suppress React controllability warning\n onChange={() => {}}\n />\n )}\n onClick={() => {\n checkboxRef.current?.focus();\n fireNonCancelableEvent(onChange, { checked: !checked });\n }}\n styledControl={\n /*Using span, not div for HTML validity*/\n <span\n className={clsx(styles['toggle-handle'], {\n [styles['toggle-handle-checked']]: checked,\n [styles['toggle-handle-disabled']]: disabled,\n [styles['toggle-handle-readonly']]: readOnly,\n })}\n style={getStyledControlStyle(style, checked, disabled, readOnly)}\n />\n }\n style={getAbstractSwitchStyles(style, checked, disabled, readOnly)}\n __internalRootRef={__internalRootRef}\n {...getAnalyticsMetadataAttribute(analyticsMetadata)}\n />\n );\n }\n);\n\nexport default InternalToggle;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/toggle-button/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAE7B,QAAA,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/toggle-button/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAE7B,QAAA,MAAM,YAAY,iGA8DjB,CAAC;AAGF,eAAe,YAAY,CAAC"}
|
package/toggle-button/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { validateProps } from '@cloudscape-design/component-toolkit/internal';
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
const ToggleButton = React.forwardRef((props, ref) => {
|
|
12
|
-
validateProps('ToggleButton', props, ["
|
|
12
|
+
validateProps('ToggleButton', props, ["nativeButtonAttributes"], {}, 'console');
|
|
13
13
|
return React.createElement(CoreComponent, {ref,...props});
|
|
14
14
|
});
|
|
15
15
|
|
|
@@ -3,7 +3,7 @@ import { BaseButtonProps } from '../button/interfaces';
|
|
|
3
3
|
import { IconProps } from '../icon/interfaces';
|
|
4
4
|
import { BaseComponentProps } from '../internal/base-component';
|
|
5
5
|
import { NonCancelableEventHandler } from '../internal/events';
|
|
6
|
-
export interface ToggleButtonProps extends BaseComponentProps, BaseButtonProps {
|
|
6
|
+
export interface ToggleButtonProps extends BaseComponentProps, Omit<BaseButtonProps, 'nativeAnchorAttributes'> {
|
|
7
7
|
/** Determines the general styling of the toggle button as follows:
|
|
8
8
|
* * `normal` for secondary buttons.
|
|
9
9
|
* * `icon` to display an icon only (no text).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/toggle-button/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4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C,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;KACrC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/toggle-button/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';\n\nimport { BaseButtonProps } from '../button/interfaces';\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface ToggleButtonProps extends BaseComponentProps, BaseButtonProps {\n /** Determines the general styling of the toggle button as follows:\n * * `normal` for secondary buttons.\n * * `icon` to display an icon only (no text).\n *\n * Defaults to `normal` if not specified.\n */\n variant?: ToggleButtonProps.Variant;\n\n /**\n * Displays an icon next to the text.\n */\n iconName?: IconProps.Name;\n\n /**\n * Displays an icon next to the text in pressed state.\n */\n pressedIconName?: IconProps.Name;\n\n /**\n * Specifies the URL of a custom icon in pressed state. Use this property if the icon needed for your use case isn't available.\n *\n * `pressedIconSvg` will take precedence if you set both `pressedIconUrl` and `pressedIconSvg`.\n */\n pressedIconUrl?: string;\n /**\n * Specifies the SVG of a custom icon in pressed state.\n *\n * Use this property if you want your custom icon to inherit colors dictated by variant or hover states.\n * When this property is set, the component will be decorated with `aria-hidden=\"true\"`. Ensure that the `svg` element:\n * - has attribute `focusable=\"false\"`\n * - has `viewBox=\"0 0 16 16\"`\n *\n * If you set the `svg` element as the root node of the slot, the component will automatically:\n * - set `stroke=\"currentColor\"`, `fill=\"none\"`, and `vertical-align=\"top\"`.\n * - set the stroke width based on the size of the icon.\n * - set the width and height of the SVG element based on the size of the icon.\n *\n * If you don't want these styles to be automatically set, wrap the `svg` element into a `span`.\n * You can still set the stroke to `currentColor` to inherit the color of the surrounding elements.\n *\n * If you set both `pressedIconUrl` and `pressedIconSvg`, `pressedIconSvg` will take precedence.\n *\n * *Note:* Remember to remove any additional elements (for example: `defs`) and related CSS classes from SVG files exported from design software.\n * In most cases, they aren't needed, as the `svg` element inherits styles from the icon component.\n */\n pressedIconSvg?: React.ReactNode;\n\n /**\n * Sets the toggle button to pressed state.\n */\n pressed: boolean;\n\n /**\n * Provides a reason why the button is disabled (only when `disabled` is `true`).\n * If provided, the button becomes focusable.\n * Applicable only for the normal variant.\n */\n disabledReason?: string;\n\n /**\n * Called when the user changes their selection.\n * The event `detail` contains the current value for the `pressed` property.\n */\n onChange?: NonCancelableEventHandler<ToggleButtonProps.ChangeDetail>;\n}\n\nexport namespace ToggleButtonProps {\n export type Variant = 'normal' | 'icon';\n\n export interface ChangeDetail {\n pressed: boolean;\n }\n\n export interface Ref {\n /**\n * Focuses the underlying native button.\n */\n focus(options?: FocusOptions): void;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/toggle-button/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';\n\nimport { BaseButtonProps } from '../button/interfaces';\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface ToggleButtonProps extends BaseComponentProps, Omit<BaseButtonProps, 'nativeAnchorAttributes'> {\n /** Determines the general styling of the toggle button as follows:\n * * `normal` for secondary buttons.\n * * `icon` to display an icon only (no text).\n *\n * Defaults to `normal` if not specified.\n */\n variant?: ToggleButtonProps.Variant;\n\n /**\n * Displays an icon next to the text.\n */\n iconName?: IconProps.Name;\n\n /**\n * Displays an icon next to the text in pressed state.\n */\n pressedIconName?: IconProps.Name;\n\n /**\n * Specifies the URL of a custom icon in pressed state. Use this property if the icon needed for your use case isn't available.\n *\n * `pressedIconSvg` will take precedence if you set both `pressedIconUrl` and `pressedIconSvg`.\n */\n pressedIconUrl?: string;\n /**\n * Specifies the SVG of a custom icon in pressed state.\n *\n * Use this property if you want your custom icon to inherit colors dictated by variant or hover states.\n * When this property is set, the component will be decorated with `aria-hidden=\"true\"`. Ensure that the `svg` element:\n * - has attribute `focusable=\"false\"`\n * - has `viewBox=\"0 0 16 16\"`\n *\n * If you set the `svg` element as the root node of the slot, the component will automatically:\n * - set `stroke=\"currentColor\"`, `fill=\"none\"`, and `vertical-align=\"top\"`.\n * - set the stroke width based on the size of the icon.\n * - set the width and height of the SVG element based on the size of the icon.\n *\n * If you don't want these styles to be automatically set, wrap the `svg` element into a `span`.\n * You can still set the stroke to `currentColor` to inherit the color of the surrounding elements.\n *\n * If you set both `pressedIconUrl` and `pressedIconSvg`, `pressedIconSvg` will take precedence.\n *\n * *Note:* Remember to remove any additional elements (for example: `defs`) and related CSS classes from SVG files exported from design software.\n * In most cases, they aren't needed, as the `svg` element inherits styles from the icon component.\n */\n pressedIconSvg?: React.ReactNode;\n\n /**\n * Sets the toggle button to pressed state.\n */\n pressed: boolean;\n\n /**\n * Provides a reason why the button is disabled (only when `disabled` is `true`).\n * If provided, the button becomes focusable.\n * Applicable only for the normal variant.\n */\n disabledReason?: string;\n\n /**\n * Called when the user changes their selection.\n * The event `detail` contains the current value for the `pressed` property.\n */\n onChange?: NonCancelableEventHandler<ToggleButtonProps.ChangeDetail>;\n}\n\nexport namespace ToggleButtonProps {\n export type Variant = 'normal' | 'icon';\n\n export interface ChangeDetail {\n pressed: boolean;\n }\n\n export interface Ref {\n /**\n * Focuses the underlying native button.\n */\n focus(options?: FocusOptions): void;\n }\n}\n"]}
|
|
@@ -8,7 +8,7 @@ import useBaseComponent from '../internal/hooks/use-base-component';
|
|
|
8
8
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
9
9
|
import { InternalToggleButton } from './internal';
|
|
10
10
|
const ToggleButton = React.forwardRef((_a, ref) => {
|
|
11
|
-
var { children, iconName, pressedIconName, iconUrl, pressedIconUrl, iconSvg, pressedIconSvg, variant = 'normal', loading = false, loadingText, disabled = false, disabledReason, wrapText = true, ariaLabel, ariaDescribedby, ariaControls, pressed = false, onChange } = _a, props = __rest(_a, ["children", "iconName", "pressedIconName", "iconUrl", "pressedIconUrl", "iconSvg", "pressedIconSvg", "variant", "loading", "loadingText", "disabled", "disabledReason", "wrapText", "ariaLabel", "ariaDescribedby", "ariaControls", "pressed", "onChange"]);
|
|
11
|
+
var { children, iconName, pressedIconName, iconUrl, pressedIconUrl, iconSvg, pressedIconSvg, variant = 'normal', loading = false, loadingText, disabled = false, disabledReason, wrapText = true, ariaLabel, ariaDescribedby, ariaControls, pressed = false, nativeButtonAttributes, onChange } = _a, props = __rest(_a, ["children", "iconName", "pressedIconName", "iconUrl", "pressedIconUrl", "iconSvg", "pressedIconSvg", "variant", "loading", "loadingText", "disabled", "disabledReason", "wrapText", "ariaLabel", "ariaDescribedby", "ariaControls", "pressed", "nativeButtonAttributes", "onChange"]);
|
|
12
12
|
const baseComponentProps = useBaseComponent('ToggleButton', {
|
|
13
13
|
props: { iconName, pressedIconName, pressed, variant, wrapText },
|
|
14
14
|
metadata: {
|
|
@@ -16,7 +16,7 @@ const ToggleButton = React.forwardRef((_a, ref) => {
|
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
18
|
const baseProps = getBaseProps(props);
|
|
19
|
-
return (React.createElement(InternalToggleButton, Object.assign({}, baseProps, baseComponentProps, { ref: ref, iconName: iconName, iconUrl: iconUrl, iconSvg: iconSvg, variant: variant, loading: loading, loadingText: loadingText, disabled: disabled, disabledReason: disabledReason, wrapText: wrapText, ariaLabel: ariaLabel, ariaDescribedby: ariaDescribedby, ariaControls: ariaControls, pressedIconName: pressedIconName, pressedIconUrl: pressedIconUrl, pressedIconSvg: pressedIconSvg, pressed: pressed, onChange: onChange }), children));
|
|
19
|
+
return (React.createElement(InternalToggleButton, Object.assign({}, baseProps, baseComponentProps, { ref: ref, iconName: iconName, iconUrl: iconUrl, iconSvg: iconSvg, variant: variant, loading: loading, loadingText: loadingText, disabled: disabled, disabledReason: disabledReason, wrapText: wrapText, ariaLabel: ariaLabel, ariaDescribedby: ariaDescribedby, ariaControls: ariaControls, pressedIconName: pressedIconName, pressedIconUrl: pressedIconUrl, pressedIconSvg: pressedIconSvg, pressed: pressed, nativeButtonAttributes: nativeButtonAttributes, onChange: onChange }), children));
|
|
20
20
|
});
|
|
21
21
|
applyDisplayName(ToggleButton, 'ToggleButton');
|
|
22
22
|
export default ToggleButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/toggle-button/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAIlD,MAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CACnC,CACE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/toggle-button/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAIlD,MAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CACnC,CACE,EAqBoB,EACpB,GAAqC,EACrC,EAAE;QAvBF,EACE,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,OAAO,EACP,cAAc,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c. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport { getBaseProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { ToggleButtonProps } from './interfaces';\nimport { InternalToggleButton } from './internal';\n\nexport { ToggleButtonProps };\n\nconst ToggleButton = React.forwardRef(\n (\n {\n children,\n iconName,\n pressedIconName,\n iconUrl,\n pressedIconUrl,\n iconSvg,\n pressedIconSvg,\n variant = 'normal',\n loading = false,\n loadingText,\n disabled = false,\n disabledReason,\n wrapText = true,\n ariaLabel,\n ariaDescribedby,\n ariaControls,\n pressed = false,\n nativeButtonAttributes,\n onChange,\n ...props\n }: ToggleButtonProps,\n ref: React.Ref<ToggleButtonProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('ToggleButton', {\n props: { iconName, pressedIconName, pressed, variant, wrapText },\n metadata: {\n hasDisabledReason: Boolean(disabledReason),\n },\n });\n const baseProps = getBaseProps(props);\n\n return (\n <InternalToggleButton\n {...baseProps}\n {...baseComponentProps}\n ref={ref}\n iconName={iconName}\n iconUrl={iconUrl}\n iconSvg={iconSvg}\n variant={variant}\n loading={loading}\n loadingText={loadingText}\n disabled={disabled}\n disabledReason={disabledReason}\n wrapText={wrapText}\n ariaLabel={ariaLabel}\n ariaDescribedby={ariaDescribedby}\n ariaControls={ariaControls}\n pressedIconName={pressedIconName}\n pressedIconUrl={pressedIconUrl}\n pressedIconSvg={pressedIconSvg}\n pressed={pressed}\n nativeButtonAttributes={nativeButtonAttributes}\n onChange={onChange}\n >\n {children}\n </InternalToggleButton>\n );\n }\n);\n\napplyDisplayName(ToggleButton, 'ToggleButton');\nexport default ToggleButton;\n"]}
|
|
@@ -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;AAKjD,eAAO,MAAM,oBAAoB;;+
|
|
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;;+CAoDhC,CAAC"}
|
|
@@ -10,7 +10,7 @@ import { isDevelopment } from '../internal/is-development';
|
|
|
10
10
|
import { getToggleIcon } from './util';
|
|
11
11
|
import styles from './styles.css.js';
|
|
12
12
|
export const InternalToggleButton = React.forwardRef((_a, ref) => {
|
|
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"]);
|
|
13
|
+
var { pressed, iconName: defaultIconName, pressedIconName, iconSvg: defaultIconSvg, pressedIconSvg, iconUrl: defaultIconUrl, pressedIconUrl, variant, nativeButtonAttributes, onChange, className } = _a, rest = __rest(_a, ["pressed", "iconName", "pressedIconName", "iconSvg", "pressedIconSvg", "iconUrl", "pressedIconUrl", "variant", "nativeButtonAttributes", "onChange", "className"]);
|
|
14
14
|
if (isDevelopment) {
|
|
15
15
|
if (defaultIconName && !pressedIconName) {
|
|
16
16
|
warnOnce('ToggleButton', '`pressedIconName` must be provided for `pressed` state.');
|
|
@@ -25,6 +25,6 @@ export const InternalToggleButton = React.forwardRef((_a, ref) => {
|
|
|
25
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 => {
|
|
26
26
|
event.preventDefault();
|
|
27
27
|
fireNonCancelableEvent(onChange, { pressed: !pressed });
|
|
28
|
-
} }, rest, { ref: ref })));
|
|
28
|
+
} }, rest, { ref: ref, nativeButtonAttributes: nativeButtonAttributes })));
|
|
29
29
|
});
|
|
30
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;AAErC,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC,UAAU,CAClD,CACE,
|
|
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,4BAA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AAE,CAAC;YAEvB,sBAAsB,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1D,CAAC,IACG,IAAI,IACR,GAAG,EAAE,GAAG,EACR,sBAAsB,EAAE,sBAAsB,IAC9C,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 nativeButtonAttributes,\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 nativeButtonAttributes={nativeButtonAttributes}\n />\n );\n }\n);\n"]}
|