@cloudscape-design/components-themeable 3.0.1209 → 3.0.1210
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/template/button-dropdown/interfaces.d.ts +2 -0
- package/lib/internal/template/button-dropdown/interfaces.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/interfaces.js.map +1 -1
- package/lib/internal/template/button-dropdown/item-element/index.d.ts.map +1 -1
- package/lib/internal/template/button-dropdown/item-element/index.js +2 -1
- package/lib/internal/template/button-dropdown/item-element/index.js.map +1 -1
- package/lib/internal/template/input/styles.d.ts +9 -1
- package/lib/internal/template/input/styles.d.ts.map +1 -1
- package/lib/internal/template/input/styles.js +2 -39
- package/lib/internal/template/input/styles.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/utils/data-attributes.d.ts +2 -0
- package/lib/internal/template/internal/utils/data-attributes.d.ts.map +1 -0
- package/lib/internal/template/internal/utils/data-attributes.js +21 -0
- package/lib/internal/template/internal/utils/data-attributes.js.map +1 -0
- package/lib/internal/template/internal/utils/input-styles.d.ts +90 -0
- package/lib/internal/template/internal/utils/input-styles.d.ts.map +1 -0
- package/lib/internal/template/internal/utils/input-styles.js +54 -0
- package/lib/internal/template/internal/utils/input-styles.js.map +1 -0
- package/lib/internal/template/text-filter/styles.d.ts +9 -1
- package/lib/internal/template/text-filter/styles.d.ts.map +1 -1
- package/lib/internal/template/text-filter/styles.js +2 -39
- package/lib/internal/template/text-filter/styles.js.map +1 -1
- package/lib/internal/template/textarea/styles.d.ts +9 -1
- package/lib/internal/template/textarea/styles.d.ts.map +1 -1
- package/lib/internal/template/textarea/styles.js +2 -49
- package/lib/internal/template/textarea/styles.js.map +1 -1
- package/package.json +1 -1
|
@@ -24,6 +24,7 @@ export interface ButtonDropdownProps extends BaseComponentProps, ExpandToViewpor
|
|
|
24
24
|
* - `disabledReason` (string) - (Optional) Displays text near the `text` property when item is disabled. Use to provide additional context.
|
|
25
25
|
* - `description` (string) - additional data that will be passed to a `data-description` attribute. **Deprecated**, has no effect.
|
|
26
26
|
* - `ariaLabel` (string) - (Optional) - ARIA label of the item element.
|
|
27
|
+
* - `dataAttributes` (Record<string, string>) - (Optional) Custom data attributes for the item element. Attribute names are automatically prefixed with "data-". The "testid" key is reserved.
|
|
27
28
|
*
|
|
28
29
|
* ### action
|
|
29
30
|
*
|
|
@@ -269,6 +270,7 @@ export declare namespace ButtonDropdownProps {
|
|
|
269
270
|
iconUrl?: string;
|
|
270
271
|
iconSvg?: React.ReactNode;
|
|
271
272
|
labelTag?: string;
|
|
273
|
+
dataAttributes?: Record<string, string>;
|
|
272
274
|
}
|
|
273
275
|
interface CheckboxItem extends Omit<ButtonDropdownProps.Item, 'href' | 'download' | 'external' | 'externalIconAriaLabel' | 'itemType'> {
|
|
274
276
|
itemType: 'checkbox';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/button-dropdown/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,kCAAkC,EAAE,MAAM,kEAAkE,CAAC;AAEtH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC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aces.js","sourceRoot":"","sources":["../../../src/button-dropdown/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { ReactNode } from 'react';\n\nimport { GeneratedAnalyticsMetadataFragment } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { ButtonProps } from '../button/interfaces';\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport { BaseNavigationDetail, CancelableEventHandler } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../internal/utils/with-native-attributes';\n\nexport interface ButtonDropdownProps extends BaseComponentProps, ExpandToViewport {\n /**\n * Array of objects with a number of supported types.\n *\n * The following properties are supported across all types:\n *\n * - `type` (string) - The type of the item. Can be `action`, `group`, `checkbox`. Defaults to `action` if `items` undefined and `group` otherwise.\n * - `id` (string) - allows to identify the item that the user clicked on. Mandatory for individual items, optional for categories.\n * - `text` (string) - description shown in the menu for this item. Mandatory for individual items, optional for categories.\n * - `lang` (string) - (Optional) The language of the item, provided as a BCP 47 language tag.\n * - `disabled` (boolean) - whether the item is disabled. Disabled items are not clickable, but they can be highlighted with the keyboard to make them accessible.\n * - `disabledReason` (string) - (Optional) Displays text near the `text` property when item is disabled. Use to provide additional context.\n * - `description` (string) - additional data that will be passed to a `data-description` attribute. **Deprecated**, has no effect.\n * - `ariaLabel` (string) - (Optional) - ARIA label of the item element.\n *\n * ### action\n *\n * - `href` (string) - (Optional) Defines the target URL of the menu item, turning it into a link.\n * - `download` (boolean | string) - (Optional) Indicates that the link should be downloaded when clicked. Only works when `href` is also provided. If set to `true`, the browser will use the filename from the URL. If set to a string, that string will be used as the suggested filename.\n * - `external` (boolean) - Marks a menu item as external by adding an icon after the menu item text. The link will open in a new tab when clicked. Note that this only works when `href` is also provided.\n * - `externalIconAriaLabel` (string) - Adds an `aria-label` to the external icon.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * - `secondaryText` (string) - (Optional) Further information about the action that appears below the label.\n * - `labelTag` (string) - (Optional) - A label tag that provides additional guidance, shown next to the label.\n *\n * ### checkbox\n *\n * When `type` is set to \"checkbox\", the values set to `href`, `external` and `externalIconAriaLabel` will be ignored.\n *\n * - `checked` (boolean) - Controls the state of the checkbox item.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * - `secondaryText` (string) - (Optional) Further information about the action that appears below the label.\n * - `labelTag` (string) - (Optional) - A label tag that provides additional guidance, shown next to the label.\n *\n * ### group\n *\n * - `items` (ReadonlyArray<Item>) - an array of item objects. Items will be rendered as nested menu items but only for the first nesting level, multi-nesting is not supported.\n * An item which belongs to nested group has the following properties: `id`, `text`, `disabled`, and `description`.\n *\n */\n items: ReadonlyArray<ButtonDropdownProps.ItemOrGroup>;\n\n /**\n * Specifies a render function to render custom options in the dropdown menu.\n *\n * The item inside the props has a different shape depending on its type:\n *\n *\n * ### action\n *\n * - `type` ('action') - The item type.\n * - `index` (number) - The item's position relative to its parent.\n * - `option` (Item) - The original item configuration.\n * - `highlighted` (boolean) - Whether the item is currently highlighted.\n * - `disabled` (boolean) - Whether the item is disabled.\n * - `parent` (GroupRenderItem | null) - The parent group item, if any.\n *\n * ### checkbox\n *\n * - `type` ('checkbox') - The item type.\n * - `index` (number) - The item's position relative to its parent.\n * - `option` (CheckboxItem) - The original item configuration.\n * - `disabled` (boolean) - Whether the item is disabled.\n * - `highlighted` (boolean) - Whether the item is currently highlighted.\n * - `checked` (boolean) - Controls the state of the checkbox item.\n * - `parent` (GroupRenderItem | null) - The parent group item, if any.\n *\n * ### group\n *\n * - `type` ('group') - The item type.\n * - `index` (number) - The item's position in the list.\n * - `option` (ItemGroup) - The original item configuration.\n * - `disabled` (boolean) - Whether the item is disabled.\n * - `highlighted` (boolean) - Whether the item is currently highlighted.\n * - `expanded` (boolean) - Whether the group is expanded.\n * - `expandDirection` ('vertical' | 'horizontal') - The direction in which the group expands.\n *\n * When providing a custom `renderItem` implementation, it fully replaces the default visual rendering and content for that item.\n * The component still manages focus, keyboard interactions, and selection state, but it no longer applies its default item layout or typography.\n *\n * When returning `null`, the default styling will be applied.\n *\n * @awsuiSystem core\n */\n renderItem?: ButtonDropdownProps.ItemRenderer;\n\n /**\n * Determines whether the button dropdown is disabled. Users cannot interact with the control if it's disabled.\n */\n disabled?: boolean;\n /**\n * Provides a reason why the button dropdown is disabled (only when `disabled` is `true`).\n * If provided, the disabled button becomes focusable.\n */\n disabledReason?: string;\n /**\n * Renders the button as being in a loading state. It takes precedence over the `disabled` if both are set to `true`.\n * It prevents clicks.\n */\n loading?: boolean;\n /**\n * Specifies the text that screen reader announces when the button dropdown is in a loading state.\n */\n loadingText?: string;\n /** Determines the general styling of the button dropdown.\n * * `primary` for primary buttons\n * * `normal` for secondary buttons\n * * `icon` for icon buttons\n * * `inline-icon` for icon buttons with no outer padding\n */\n variant?: ButtonDropdownProps.Variant;\n /**\n * Controls expandability of the item groups.\n */\n expandableGroups?: boolean;\n /**\n * Adds `aria-label` to the button dropdown trigger.\n * Use this to provide an accessible name for buttons that don't have visible text.\n */\n ariaLabel?: string;\n /**\n * Text displayed in the button dropdown trigger.\n * @displayname text\n */\n children?: React.ReactNode;\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?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n /**\n * Called when the user clicks on an item with the left mouse button without pressing\n * modifier keys (that is, CTRL, ALT, SHIFT, META), and the item has an `href` set.\n */\n onItemFollow?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n /**\n * A standalone action that is shown prior to the dropdown trigger.\n * Use it with \"primary\" and \"normal\" variant only.\n *\n * Main action properties:\n * * `text` (string) - Specifies the text shown in the main action.\n * * `external` (boolean) - Marks the main action as external by adding an icon after the text. The link will open in a new tab when clicked. Note that this only works when `href` is also provided.\n * * `externalIconAriaLabel` (string) - Adds an ARIA label to the external icon.\n *\n * The main action also supports the following properties of the [button](/components/button/?tabId=api) component:\n * `ariaLabel`, `disabled`, `loading`, `loadingText`, `href`, `target`, `rel`, `download`, `iconAlt`, `iconName`, `iconUrl`, `iconSvg`, `onClick`, `onFollow`.\n */\n mainAction?: ButtonDropdownProps.MainAction;\n\n /**\n * Sets the button width to be 100% of the parent container width. Button content is centered.\n */\n fullWidth?: boolean;\n\n /**\n * Attributes to add to the native `button` element.\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeTriggerAttributes?: NativeAttributes<React.ButtonHTMLAttributes<HTMLButtonElement>>;\n\n /**\n * Attributes to add to the native element of the `mainAction`.\n *\n * Specify either `button` for a standard main action, or `anchor` if `html` is set.\n *\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeMainActionAttributes?: {\n button?: NativeAttributes<React.ButtonHTMLAttributes<HTMLButtonElement>>;\n anchor?: NativeAttributes<React.AnchorHTMLAttributes<HTMLAnchorElement>>;\n };\n}\n\nexport namespace ButtonDropdownProps {\n export type Variant = 'normal' | 'primary' | 'icon' | 'inline-icon';\n export type ItemType = 'action' | 'group';\n\n export interface ActionRenderItem {\n type: 'action';\n index: number;\n option: Item;\n highlighted: boolean;\n disabled: boolean;\n parent: GroupRenderItem | null;\n }\n export interface CheckboxRenderItem {\n type: 'checkbox';\n index: number;\n option: CheckboxItem;\n disabled: boolean;\n highlighted: boolean;\n checked: boolean;\n parent: GroupRenderItem | null;\n }\n export interface GroupRenderItem {\n type: 'group';\n index: number;\n option: ItemGroup;\n disabled: boolean;\n highlighted: boolean;\n expanded: boolean;\n expandDirection: 'vertical' | 'horizontal';\n }\n\n export type RenderItem = ActionRenderItem | CheckboxRenderItem | GroupRenderItem;\n export type ItemRenderer = (props: { item: ButtonDropdownProps.RenderItem }) => ReactNode | null;\n\n export interface MainAction {\n text?: string;\n ariaLabel?: string;\n onClick?: CancelableEventHandler<ButtonProps.ClickDetail>;\n onFollow?: CancelableEventHandler<ButtonProps.FollowDetail>;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n href?: string;\n target?: string;\n rel?: string;\n download?: boolean | string;\n external?: boolean;\n externalIconAriaLabel?: string;\n iconAlt?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n }\n\n export interface Item {\n itemType?: ItemType;\n id: string;\n text: string;\n secondaryText?: string;\n ariaLabel?: string;\n lang?: string;\n disabled?: boolean;\n disabledReason?: string;\n /**\n * @deprecated Has no effect.\n */\n description?: string;\n href?: string;\n download?: boolean | string;\n external?: boolean;\n externalIconAriaLabel?: string;\n iconAlt?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n labelTag?: string;\n }\n\n export interface CheckboxItem\n extends Omit<ButtonDropdownProps.Item, 'href' | 'download' | 'external' | 'externalIconAriaLabel' | 'itemType'> {\n itemType: 'checkbox';\n checked: boolean;\n }\n\n export interface ItemGroup extends Omit<Item, 'id' | 'text' | 'itemType' | 'secondaryText' | 'labelTag'> {\n itemType?: 'group';\n id?: string;\n text?: string;\n items: Items;\n }\n\n export type ItemOrGroup = Item | CheckboxItem | ItemGroup;\n\n export type Items = ReadonlyArray<ItemOrGroup>;\n\n export interface ItemClickDetails extends BaseNavigationDetail {\n id: string;\n checked?: boolean;\n }\n\n export interface Ref {\n /**\n * Focuses the underlying native button. If a main action is defined this will focus that button.\n */\n focus(options?: FocusOptions): void;\n /**\n * Focuses the underlying native button for the dropdown.\n */\n focusDropdownTrigger(options?: FocusOptions): void;\n }\n}\n\nexport interface ButtonDropdownSettings {\n // this means whether action is required to make group expand\n hasExpandableGroups: boolean;\n // on smaller screens expandable groups are integrated into parent dropdown\n // this changes keyboard navigation, highlight and activation behavior for parent dropdown\n isInRestrictedView?: boolean;\n}\n\nexport interface HighlightProps {\n targetItem: ButtonDropdownProps.ItemOrGroup | null;\n isHighlighted: (item: ButtonDropdownProps.ItemOrGroup) => boolean;\n isKeyboardHighlight: (item: ButtonDropdownProps.ItemOrGroup) => boolean;\n isExpanded: (group: ButtonDropdownProps.ItemGroup) => boolean;\n highlightItem: (item: ButtonDropdownProps.ItemOrGroup) => void;\n}\n\nexport type GroupToggle = (item: ButtonDropdownProps.ItemGroup, event: React.SyntheticEvent) => void;\nexport type ItemActivate = (\n item: ButtonDropdownProps.Item | ButtonDropdownProps.CheckboxItem,\n event: React.MouseEvent | React.KeyboardEvent\n) => void;\n\nexport interface CategoryProps extends HighlightProps {\n index?: number;\n item: ButtonDropdownProps.ItemGroup;\n onGroupToggle: GroupToggle;\n onItemActivate: ItemActivate;\n disabled: boolean;\n lastInDropdown: boolean;\n expandToViewport?: boolean;\n variant?: ItemListProps['variant'];\n position?: string;\n renderItem?: ButtonDropdownProps.ItemRenderer;\n}\n\nexport interface ItemListProps extends HighlightProps {\n items: ButtonDropdownProps.Items;\n onGroupToggle: GroupToggle;\n onItemActivate: ItemActivate;\n categoryDisabled?: boolean;\n hasExpandableGroups?: boolean;\n hasCategoryHeader?: boolean;\n lastInDropdown: boolean;\n expandToViewport?: boolean;\n variant?: InternalButtonDropdownProps['variant'];\n position?: string;\n analyticsMetadataTransformer?: InternalButtonDropdownProps['analyticsMetadataTransformer'];\n linkStyle?: boolean;\n renderItem?: ButtonDropdownProps.ItemRenderer;\n parentProps?: ButtonDropdownProps.GroupRenderItem;\n}\n\nexport interface LinkItem extends ButtonDropdownProps.Item {\n href: string;\n}\n\nexport interface ItemProps {\n index?: number;\n item: ButtonDropdownProps.Item | ButtonDropdownProps.CheckboxItem | LinkItem;\n disabled: boolean;\n highlighted: boolean;\n onItemActivate: ItemActivate;\n highlightItem: (item: ButtonDropdownProps.ItemOrGroup) => void;\n showDivider: boolean;\n hasCategoryHeader: boolean;\n isKeyboardHighlighted?: boolean;\n variant?: ItemListProps['variant'];\n position?: string;\n analyticsMetadataTransformer?: InternalButtonDropdownProps['analyticsMetadataTransformer'];\n linkStyle?: boolean;\n renderItem?: ButtonDropdownProps.ItemRenderer;\n parentProps?: ButtonDropdownProps.GroupRenderItem;\n}\n\nexport interface InternalItem extends ButtonDropdownProps.Item {\n badge?: boolean;\n /**\n * Used in breadcrumb-group: indicates that this breadcrumb item is the current page\n */\n isCurrentBreadcrumb?: boolean;\n}\n\nexport interface InternalCheckboxItem extends ButtonDropdownProps.CheckboxItem {\n badge?: boolean;\n}\n\ninterface InternalItemGroup extends Omit<ButtonDropdownProps.ItemGroup, 'items'> {\n items: InternalItems;\n}\n\ntype InternalItems = ReadonlyArray<InternalItemOrGroup>;\n\nexport type InternalItemOrGroup = InternalItem | InternalCheckboxItem | InternalItemGroup;\n\nexport interface InternalButtonDropdownProps\n extends Omit<ButtonDropdownProps, 'variant' | 'items'>,\n InternalBaseComponentProps {\n customTriggerBuilder?: (props: CustomTriggerProps) => React.ReactNode;\n variant?: ButtonDropdownProps['variant'] | 'navigation';\n items: ReadonlyArray<InternalItemOrGroup>;\n\n /**\n * Optional text that is displayed as the title at the top of the dropdown.\n */\n title?: string;\n\n /**\n * Optional text that is displayed underneath the title at the top of the dropdown.\n */\n description?: string;\n\n /**\n * Only show main action button as a regular, non-split button.\n * That is needed so that button dropdown test utils wrapper can still be used.\n */\n showMainActionOnly?: boolean;\n\n /**\n * Determines that the dropdown should preferably be aligned to the center of the trigger\n * instead of dropping left or right.\n */\n preferCenter?: boolean;\n\n /**\n * Determines whether simple items should be displayed with the link styles.\n * Used in Breadcrumb group component for collapsed breadcrumbs\n */\n linkStyle?: boolean;\n\n /**\n * Determines whether the dropdown should take up the full available width.\n * Used in Breadcrumb group component for collapsed breadcrumbs\n */\n fullWidth?: boolean;\n\n analyticsMetadataTransformer?: (input: GeneratedAnalyticsMetadataFragment) => GeneratedAnalyticsMetadataFragment;\n\n /**\n * Position of the button dropdown inside a list of elements, for example a button group\n */\n position?: string;\n}\n\nexport interface CustomTriggerProps {\n triggerRef: React.Ref<HTMLElement>;\n testUtilsClass: string;\n ariaLabel: string | undefined;\n disabled: boolean;\n disabledReason?: string;\n isOpen: boolean;\n onClick: () => void;\n ariaExpanded: boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/button-dropdown/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { ReactNode } from 'react';\n\nimport { GeneratedAnalyticsMetadataFragment } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { ButtonProps } from '../button/interfaces';\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport { BaseNavigationDetail, CancelableEventHandler } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../internal/utils/with-native-attributes';\n\nexport interface ButtonDropdownProps extends BaseComponentProps, ExpandToViewport {\n /**\n * Array of objects with a number of supported types.\n *\n * The following properties are supported across all types:\n *\n * - `type` (string) - The type of the item. Can be `action`, `group`, `checkbox`. Defaults to `action` if `items` undefined and `group` otherwise.\n * - `id` (string) - allows to identify the item that the user clicked on. Mandatory for individual items, optional for categories.\n * - `text` (string) - description shown in the menu for this item. Mandatory for individual items, optional for categories.\n * - `lang` (string) - (Optional) The language of the item, provided as a BCP 47 language tag.\n * - `disabled` (boolean) - whether the item is disabled. Disabled items are not clickable, but they can be highlighted with the keyboard to make them accessible.\n * - `disabledReason` (string) - (Optional) Displays text near the `text` property when item is disabled. Use to provide additional context.\n * - `description` (string) - additional data that will be passed to a `data-description` attribute. **Deprecated**, has no effect.\n * - `ariaLabel` (string) - (Optional) - ARIA label of the item element.\n * - `dataAttributes` (Record<string, string>) - (Optional) Custom data attributes for the item element. Attribute names are automatically prefixed with \"data-\". The \"testid\" key is reserved.\n *\n * ### action\n *\n * - `href` (string) - (Optional) Defines the target URL of the menu item, turning it into a link.\n * - `download` (boolean | string) - (Optional) Indicates that the link should be downloaded when clicked. Only works when `href` is also provided. If set to `true`, the browser will use the filename from the URL. If set to a string, that string will be used as the suggested filename.\n * - `external` (boolean) - Marks a menu item as external by adding an icon after the menu item text. The link will open in a new tab when clicked. Note that this only works when `href` is also provided.\n * - `externalIconAriaLabel` (string) - Adds an `aria-label` to the external icon.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * - `secondaryText` (string) - (Optional) Further information about the action that appears below the label.\n * - `labelTag` (string) - (Optional) - A label tag that provides additional guidance, shown next to the label.\n *\n * ### checkbox\n *\n * When `type` is set to \"checkbox\", the values set to `href`, `external` and `externalIconAriaLabel` will be ignored.\n *\n * - `checked` (boolean) - Controls the state of the checkbox item.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * - `secondaryText` (string) - (Optional) Further information about the action that appears below the label.\n * - `labelTag` (string) - (Optional) - A label tag that provides additional guidance, shown next to the label.\n *\n * ### group\n *\n * - `items` (ReadonlyArray<Item>) - an array of item objects. Items will be rendered as nested menu items but only for the first nesting level, multi-nesting is not supported.\n * An item which belongs to nested group has the following properties: `id`, `text`, `disabled`, and `description`.\n *\n */\n items: ReadonlyArray<ButtonDropdownProps.ItemOrGroup>;\n\n /**\n * Specifies a render function to render custom options in the dropdown menu.\n *\n * The item inside the props has a different shape depending on its type:\n *\n *\n * ### action\n *\n * - `type` ('action') - The item type.\n * - `index` (number) - The item's position relative to its parent.\n * - `option` (Item) - The original item configuration.\n * - `highlighted` (boolean) - Whether the item is currently highlighted.\n * - `disabled` (boolean) - Whether the item is disabled.\n * - `parent` (GroupRenderItem | null) - The parent group item, if any.\n *\n * ### checkbox\n *\n * - `type` ('checkbox') - The item type.\n * - `index` (number) - The item's position relative to its parent.\n * - `option` (CheckboxItem) - The original item configuration.\n * - `disabled` (boolean) - Whether the item is disabled.\n * - `highlighted` (boolean) - Whether the item is currently highlighted.\n * - `checked` (boolean) - Controls the state of the checkbox item.\n * - `parent` (GroupRenderItem | null) - The parent group item, if any.\n *\n * ### group\n *\n * - `type` ('group') - The item type.\n * - `index` (number) - The item's position in the list.\n * - `option` (ItemGroup) - The original item configuration.\n * - `disabled` (boolean) - Whether the item is disabled.\n * - `highlighted` (boolean) - Whether the item is currently highlighted.\n * - `expanded` (boolean) - Whether the group is expanded.\n * - `expandDirection` ('vertical' | 'horizontal') - The direction in which the group expands.\n *\n * When providing a custom `renderItem` implementation, it fully replaces the default visual rendering and content for that item.\n * The component still manages focus, keyboard interactions, and selection state, but it no longer applies its default item layout or typography.\n *\n * When returning `null`, the default styling will be applied.\n *\n * @awsuiSystem core\n */\n renderItem?: ButtonDropdownProps.ItemRenderer;\n\n /**\n * Determines whether the button dropdown is disabled. Users cannot interact with the control if it's disabled.\n */\n disabled?: boolean;\n /**\n * Provides a reason why the button dropdown is disabled (only when `disabled` is `true`).\n * If provided, the disabled button becomes focusable.\n */\n disabledReason?: string;\n /**\n * Renders the button as being in a loading state. It takes precedence over the `disabled` if both are set to `true`.\n * It prevents clicks.\n */\n loading?: boolean;\n /**\n * Specifies the text that screen reader announces when the button dropdown is in a loading state.\n */\n loadingText?: string;\n /** Determines the general styling of the button dropdown.\n * * `primary` for primary buttons\n * * `normal` for secondary buttons\n * * `icon` for icon buttons\n * * `inline-icon` for icon buttons with no outer padding\n */\n variant?: ButtonDropdownProps.Variant;\n /**\n * Controls expandability of the item groups.\n */\n expandableGroups?: boolean;\n /**\n * Adds `aria-label` to the button dropdown trigger.\n * Use this to provide an accessible name for buttons that don't have visible text.\n */\n ariaLabel?: string;\n /**\n * Text displayed in the button dropdown trigger.\n * @displayname text\n */\n children?: React.ReactNode;\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?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n /**\n * Called when the user clicks on an item with the left mouse button without pressing\n * modifier keys (that is, CTRL, ALT, SHIFT, META), and the item has an `href` set.\n */\n onItemFollow?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n /**\n * A standalone action that is shown prior to the dropdown trigger.\n * Use it with \"primary\" and \"normal\" variant only.\n *\n * Main action properties:\n * * `text` (string) - Specifies the text shown in the main action.\n * * `external` (boolean) - Marks the main action as external by adding an icon after the text. The link will open in a new tab when clicked. Note that this only works when `href` is also provided.\n * * `externalIconAriaLabel` (string) - Adds an ARIA label to the external icon.\n *\n * The main action also supports the following properties of the [button](/components/button/?tabId=api) component:\n * `ariaLabel`, `disabled`, `loading`, `loadingText`, `href`, `target`, `rel`, `download`, `iconAlt`, `iconName`, `iconUrl`, `iconSvg`, `onClick`, `onFollow`.\n */\n mainAction?: ButtonDropdownProps.MainAction;\n\n /**\n * Sets the button width to be 100% of the parent container width. Button content is centered.\n */\n fullWidth?: boolean;\n\n /**\n * Attributes to add to the native `button` element.\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeTriggerAttributes?: NativeAttributes<React.ButtonHTMLAttributes<HTMLButtonElement>>;\n\n /**\n * Attributes to add to the native element of the `mainAction`.\n *\n * Specify either `button` for a standard main action, or `anchor` if `html` is set.\n *\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeMainActionAttributes?: {\n button?: NativeAttributes<React.ButtonHTMLAttributes<HTMLButtonElement>>;\n anchor?: NativeAttributes<React.AnchorHTMLAttributes<HTMLAnchorElement>>;\n };\n}\n\nexport namespace ButtonDropdownProps {\n export type Variant = 'normal' | 'primary' | 'icon' | 'inline-icon';\n export type ItemType = 'action' | 'group';\n\n export interface ActionRenderItem {\n type: 'action';\n index: number;\n option: Item;\n highlighted: boolean;\n disabled: boolean;\n parent: GroupRenderItem | null;\n }\n export interface CheckboxRenderItem {\n type: 'checkbox';\n index: number;\n option: CheckboxItem;\n disabled: boolean;\n highlighted: boolean;\n checked: boolean;\n parent: GroupRenderItem | null;\n }\n export interface GroupRenderItem {\n type: 'group';\n index: number;\n option: ItemGroup;\n disabled: boolean;\n highlighted: boolean;\n expanded: boolean;\n expandDirection: 'vertical' | 'horizontal';\n }\n\n export type RenderItem = ActionRenderItem | CheckboxRenderItem | GroupRenderItem;\n export type ItemRenderer = (props: { item: ButtonDropdownProps.RenderItem }) => ReactNode | null;\n\n export interface MainAction {\n text?: string;\n ariaLabel?: string;\n onClick?: CancelableEventHandler<ButtonProps.ClickDetail>;\n onFollow?: CancelableEventHandler<ButtonProps.FollowDetail>;\n disabled?: boolean;\n disabledReason?: string;\n loading?: boolean;\n loadingText?: string;\n href?: string;\n target?: string;\n rel?: string;\n download?: boolean | string;\n external?: boolean;\n externalIconAriaLabel?: string;\n iconAlt?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n }\n\n export interface Item {\n itemType?: ItemType;\n id: string;\n text: string;\n secondaryText?: string;\n ariaLabel?: string;\n lang?: string;\n disabled?: boolean;\n disabledReason?: string;\n /**\n * @deprecated Has no effect.\n */\n description?: string;\n href?: string;\n download?: boolean | string;\n external?: boolean;\n externalIconAriaLabel?: string;\n iconAlt?: string;\n iconName?: IconProps.Name;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n labelTag?: string;\n dataAttributes?: Record<string, string>;\n }\n\n export interface CheckboxItem\n extends Omit<ButtonDropdownProps.Item, 'href' | 'download' | 'external' | 'externalIconAriaLabel' | 'itemType'> {\n itemType: 'checkbox';\n checked: boolean;\n }\n\n export interface ItemGroup extends Omit<Item, 'id' | 'text' | 'itemType' | 'secondaryText' | 'labelTag'> {\n itemType?: 'group';\n id?: string;\n text?: string;\n items: Items;\n }\n\n export type ItemOrGroup = Item | CheckboxItem | ItemGroup;\n\n export type Items = ReadonlyArray<ItemOrGroup>;\n\n export interface ItemClickDetails extends BaseNavigationDetail {\n id: string;\n checked?: boolean;\n }\n\n export interface Ref {\n /**\n * Focuses the underlying native button. If a main action is defined this will focus that button.\n */\n focus(options?: FocusOptions): void;\n /**\n * Focuses the underlying native button for the dropdown.\n */\n focusDropdownTrigger(options?: FocusOptions): void;\n }\n}\n\nexport interface ButtonDropdownSettings {\n // this means whether action is required to make group expand\n hasExpandableGroups: boolean;\n // on smaller screens expandable groups are integrated into parent dropdown\n // this changes keyboard navigation, highlight and activation behavior for parent dropdown\n isInRestrictedView?: boolean;\n}\n\nexport interface HighlightProps {\n targetItem: ButtonDropdownProps.ItemOrGroup | null;\n isHighlighted: (item: ButtonDropdownProps.ItemOrGroup) => boolean;\n isKeyboardHighlight: (item: ButtonDropdownProps.ItemOrGroup) => boolean;\n isExpanded: (group: ButtonDropdownProps.ItemGroup) => boolean;\n highlightItem: (item: ButtonDropdownProps.ItemOrGroup) => void;\n}\n\nexport type GroupToggle = (item: ButtonDropdownProps.ItemGroup, event: React.SyntheticEvent) => void;\nexport type ItemActivate = (\n item: ButtonDropdownProps.Item | ButtonDropdownProps.CheckboxItem,\n event: React.MouseEvent | React.KeyboardEvent\n) => void;\n\nexport interface CategoryProps extends HighlightProps {\n index?: number;\n item: ButtonDropdownProps.ItemGroup;\n onGroupToggle: GroupToggle;\n onItemActivate: ItemActivate;\n disabled: boolean;\n lastInDropdown: boolean;\n expandToViewport?: boolean;\n variant?: ItemListProps['variant'];\n position?: string;\n renderItem?: ButtonDropdownProps.ItemRenderer;\n}\n\nexport interface ItemListProps extends HighlightProps {\n items: ButtonDropdownProps.Items;\n onGroupToggle: GroupToggle;\n onItemActivate: ItemActivate;\n categoryDisabled?: boolean;\n hasExpandableGroups?: boolean;\n hasCategoryHeader?: boolean;\n lastInDropdown: boolean;\n expandToViewport?: boolean;\n variant?: InternalButtonDropdownProps['variant'];\n position?: string;\n analyticsMetadataTransformer?: InternalButtonDropdownProps['analyticsMetadataTransformer'];\n linkStyle?: boolean;\n renderItem?: ButtonDropdownProps.ItemRenderer;\n parentProps?: ButtonDropdownProps.GroupRenderItem;\n}\n\nexport interface LinkItem extends ButtonDropdownProps.Item {\n href: string;\n}\n\nexport interface ItemProps {\n index?: number;\n item: ButtonDropdownProps.Item | ButtonDropdownProps.CheckboxItem | LinkItem;\n disabled: boolean;\n highlighted: boolean;\n onItemActivate: ItemActivate;\n highlightItem: (item: ButtonDropdownProps.ItemOrGroup) => void;\n showDivider: boolean;\n hasCategoryHeader: boolean;\n isKeyboardHighlighted?: boolean;\n variant?: ItemListProps['variant'];\n position?: string;\n analyticsMetadataTransformer?: InternalButtonDropdownProps['analyticsMetadataTransformer'];\n linkStyle?: boolean;\n renderItem?: ButtonDropdownProps.ItemRenderer;\n parentProps?: ButtonDropdownProps.GroupRenderItem;\n}\n\nexport interface InternalItem extends ButtonDropdownProps.Item {\n badge?: boolean;\n /**\n * Used in breadcrumb-group: indicates that this breadcrumb item is the current page\n */\n isCurrentBreadcrumb?: boolean;\n}\n\nexport interface InternalCheckboxItem extends ButtonDropdownProps.CheckboxItem {\n badge?: boolean;\n}\n\ninterface InternalItemGroup extends Omit<ButtonDropdownProps.ItemGroup, 'items'> {\n items: InternalItems;\n}\n\ntype InternalItems = ReadonlyArray<InternalItemOrGroup>;\n\nexport type InternalItemOrGroup = InternalItem | InternalCheckboxItem | InternalItemGroup;\n\nexport interface InternalButtonDropdownProps\n extends Omit<ButtonDropdownProps, 'variant' | 'items'>,\n InternalBaseComponentProps {\n customTriggerBuilder?: (props: CustomTriggerProps) => React.ReactNode;\n variant?: ButtonDropdownProps['variant'] | 'navigation';\n items: ReadonlyArray<InternalItemOrGroup>;\n\n /**\n * Optional text that is displayed as the title at the top of the dropdown.\n */\n title?: string;\n\n /**\n * Optional text that is displayed underneath the title at the top of the dropdown.\n */\n description?: string;\n\n /**\n * Only show main action button as a regular, non-split button.\n * That is needed so that button dropdown test utils wrapper can still be used.\n */\n showMainActionOnly?: boolean;\n\n /**\n * Determines that the dropdown should preferably be aligned to the center of the trigger\n * instead of dropping left or right.\n */\n preferCenter?: boolean;\n\n /**\n * Determines whether simple items should be displayed with the link styles.\n * Used in Breadcrumb group component for collapsed breadcrumbs\n */\n linkStyle?: boolean;\n\n /**\n * Determines whether the dropdown should take up the full available width.\n * Used in Breadcrumb group component for collapsed breadcrumbs\n */\n fullWidth?: boolean;\n\n analyticsMetadataTransformer?: (input: GeneratedAnalyticsMetadataFragment) => GeneratedAnalyticsMetadataFragment;\n\n /**\n * Position of the button dropdown inside a list of elements, for example a button group\n */\n position?: string;\n}\n\nexport interface CustomTriggerProps {\n triggerRef: React.Ref<HTMLElement>;\n testUtilsClass: string;\n ariaLabel: string | undefined;\n disabled: boolean;\n disabledReason?: string;\n isOpen: boolean;\n onClick: () => void;\n ariaExpanded: boolean;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/button-dropdown/item-element/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/button-dropdown/item-element/index.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAA2D,SAAS,EAAY,MAAM,eAAe,CAAC;AAS7G,QAAA,MAAM,WAAW,GAAI,oNAgBlB,SAAS,gBAgEX,CAAC;AAoLF,eAAe,WAAW,CAAC"}
|
|
@@ -7,6 +7,7 @@ import InternalIcon from '../../icon/internal';
|
|
|
7
7
|
import { useDropdownContext } from '../../internal/components/dropdown/context';
|
|
8
8
|
import useHiddenDescription from '../../internal/hooks/use-hidden-description';
|
|
9
9
|
import { useVisualRefresh } from '../../internal/hooks/use-visual-mode';
|
|
10
|
+
import { getDataAttributes } from '../../internal/utils/data-attributes';
|
|
10
11
|
import Tooltip from '../tooltip';
|
|
11
12
|
import { getMenuItemCheckboxProps, getMenuItemProps } from '../utils/menu-item';
|
|
12
13
|
import { isCheckboxItem, isLinkItem } from '../utils/utils';
|
|
@@ -39,7 +40,7 @@ const ItemElement = ({ position = '1', index, item, disabled, onItemActivate, hi
|
|
|
39
40
|
[styles['show-divider']]: showDivider,
|
|
40
41
|
[styles['is-focused']]: isKeyboardHighlighted,
|
|
41
42
|
[styles['visual-refresh']]: isVisualRefresh,
|
|
42
|
-
}), role: "presentation", "data-testid": item.id, "data-description": item.description, onClick: onClick, onMouseEnter: onHover, onTouchStart: onHover, ...getAnalyticsMetadataAttribute(disabled
|
|
43
|
+
}), role: "presentation", "data-testid": item.id, "data-description": item.description, ...getDataAttributes(item.dataAttributes, ['testid']), onClick: onClick, onMouseEnter: onHover, onTouchStart: onHover, ...getAnalyticsMetadataAttribute(disabled
|
|
43
44
|
? {}
|
|
44
45
|
: analyticsMetadataTransformer({
|
|
45
46
|
action: 'click',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/button-dropdown/item-element/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAEL,6BAA6B,GAC9B,MAAM,kEAAkE,CAAC;AAE1E,OAAO,YAAmC,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,oBAAoB,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAGxE,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,eAAe,MAAM,qCAAqC,CAAC;AAClE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,WAAW,GAAG,CAAC,EACnB,QAAQ,GAAG,GAAG,EACd,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,WAAW,EACX,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,qBAAqB,GAAG,KAAK,EAC7B,4BAA4B,GAAG,CAAC,QAA4C,EAAE,EAAE,CAAC,QAAQ,EACzF,OAAO,GAAG,QAAQ,EAClB,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MAAM,YAAY,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAA6C,EAAE,EAAE;IAC1F,MAAM,IAAI,GAAG,oBAAC,YAAY,IAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAC,UAAU,GAAG,CAAC;IACzF,OAAO,CACL,8BAAM,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,gBAAc,SAAS,IACjG,IAAI,CACA,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport {\n GeneratedAnalyticsMetadataFragment,\n getAnalyticsMetadataAttribute,\n} from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalIcon, { InternalIconProps } from '../../icon/internal';\nimport { useDropdownContext } from '../../internal/components/dropdown/context';\nimport useHiddenDescription from '../../internal/hooks/use-hidden-description';\nimport { useVisualRefresh } from '../../internal/hooks/use-visual-mode';\nimport { GeneratedAnalyticsMetadataButtonDropdownClick } from '../analytics-metadata/interfaces';\nimport { ButtonDropdownProps, InternalCheckboxItem, InternalItem, ItemProps, LinkItem } from '../interfaces';\nimport Tooltip from '../tooltip';\nimport { getMenuItemCheckboxProps, getMenuItemProps } from '../utils/menu-item';\nimport { isCheckboxItem, isLinkItem } from '../utils/utils';\nimport { getItemTarget } from '../utils/utils';\n\nimport analyticsLabels from '../analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nconst ItemElement = ({\n position = '1',\n index,\n item,\n disabled,\n onItemActivate,\n highlighted,\n highlightItem,\n showDivider,\n hasCategoryHeader,\n isKeyboardHighlighted = false,\n analyticsMetadataTransformer = (metadata: GeneratedAnalyticsMetadataFragment) => metadata,\n variant = 'normal',\n linkStyle,\n renderItem,\n parentProps,\n}: ItemProps) => {\n const isLink = isLinkItem(item);\n const isCheckbox = isCheckboxItem(item);\n const onClick = (event: React.MouseEvent) => {\n // Stop propagation to parent node and handle event exclusively in here. This ensures\n // that no group will interfere with the default behavior of links\n event.stopPropagation();\n if (!isLink) {\n event.preventDefault();\n }\n if (!disabled) {\n onItemActivate(item, event);\n }\n };\n\n const onHover = () => {\n highlightItem(item);\n };\n\n const isVisualRefresh = useVisualRefresh();\n\n return (\n <li\n className={clsx(styles['item-element'], styles[`variant-${variant}`], {\n [styles.highlighted]: highlighted,\n [styles.disabled]: disabled,\n [styles['has-category-header']]: hasCategoryHeader,\n [styles['has-checkmark']]: isCheckbox,\n [styles['show-divider']]: showDivider,\n [styles['is-focused']]: isKeyboardHighlighted,\n [styles['visual-refresh']]: isVisualRefresh,\n })}\n role=\"presentation\"\n data-testid={item.id}\n data-description={item.description}\n onClick={onClick}\n onMouseEnter={onHover}\n onTouchStart={onHover}\n {...getAnalyticsMetadataAttribute(\n disabled\n ? {}\n : (analyticsMetadataTransformer!({\n action: 'click',\n detail: {\n position,\n id: item.id,\n label: `.${analyticsLabels['menu-item']}`,\n href: (item as LinkItem).href || '',\n },\n }) as GeneratedAnalyticsMetadataButtonDropdownClick)\n )}\n >\n <MenuItem\n index={index}\n item={item}\n disabled={disabled}\n highlighted={highlighted}\n linkStyle={linkStyle}\n renderItem={renderItem}\n parentProps={parentProps}\n />\n </li>\n );\n};\n\ninterface MenuItemProps {\n index?: number;\n item: InternalItem | InternalCheckboxItem;\n disabled: boolean;\n highlighted: boolean;\n linkStyle?: boolean;\n renderItem?: ButtonDropdownProps.ItemRenderer;\n parentProps?: ButtonDropdownProps.GroupRenderItem;\n}\n\nfunction MenuItem({ index, item, disabled, highlighted, linkStyle, renderItem, parentProps }: MenuItemProps) {\n const menuItemRef = useRef<(HTMLSpanElement & HTMLAnchorElement) | null>(null);\n const isCheckbox = isCheckboxItem(item);\n const isCurrentBreadcrumb = !isCheckbox && item.isCurrentBreadcrumb;\n\n useEffect(() => {\n if (highlighted && menuItemRef.current) {\n menuItemRef.current.focus();\n }\n }, [highlighted]);\n\n let itemProps: { item: ButtonDropdownProps.RenderItem };\n\n if (isCheckbox) {\n itemProps = {\n item: {\n index: index ?? 0,\n type: 'checkbox',\n option: item as ButtonDropdownProps.CheckboxItem,\n disabled: disabled,\n highlighted: highlighted,\n checked: item.checked,\n parent: parentProps ?? null,\n },\n };\n } else {\n itemProps = {\n item: {\n index: index ?? 0,\n type: 'action',\n option: item as ButtonDropdownProps.Item,\n disabled: disabled,\n highlighted: highlighted,\n parent: parentProps ?? null,\n },\n };\n }\n\n const renderResult = renderItem?.(itemProps) ?? null;\n\n const isDisabledWithReason = disabled && item.disabledReason;\n const { targetProps, descriptionEl } = useHiddenDescription(item.disabledReason);\n const menuItemProps: React.HTMLAttributes<HTMLSpanElement & HTMLAnchorElement> = {\n 'aria-label': item.ariaLabel,\n className: clsx(\n styles['menu-item'],\n !!renderResult && styles['no-content-styling'],\n analyticsLabels['menu-item'],\n linkStyle && styles['link-style'],\n linkStyle && highlighted && styles['link-style-highlighted'],\n isCurrentBreadcrumb && styles['current-breadcrumb']\n ),\n 'aria-current': isCurrentBreadcrumb,\n lang: item.lang,\n ref: menuItemRef,\n // We are using the roving tabindex technique to manage the focus state of the dropdown.\n // The current element will always have tabindex=0 which means that it can be tabbed to,\n // while all other items have tabindex=-1 so we can focus them when necessary.\n tabIndex: highlighted ? 0 : -1,\n ...(isCheckbox ? getMenuItemCheckboxProps({ disabled, checked: item.checked }) : getMenuItemProps({ disabled })),\n ...(isDisabledWithReason ? targetProps : {}),\n };\n\n const menuItem = isLinkItem(item) ? (\n <a\n {...menuItemProps}\n href={!disabled ? item.href : undefined}\n download={!disabled && item.download ? item.download : undefined}\n target={getItemTarget(item)}\n rel={item.external ? 'noopener noreferrer' : undefined}\n >\n {renderResult ? renderResult : <MenuItemContent item={item} disabled={disabled} highlighted={highlighted} />}\n </a>\n ) : (\n <span {...menuItemProps}>\n {renderResult ? renderResult : <MenuItemContent item={item} disabled={disabled} highlighted={highlighted} />}\n </span>\n );\n\n const { position } = useDropdownContext();\n const tooltipPosition = position === 'bottom-left' || position === 'top-left' ? 'left' : 'right';\n return isDisabledWithReason ? (\n <Tooltip content={item.disabledReason} position={tooltipPosition} className={styles['item-tooltip-wrapper']}>\n {menuItem}\n {descriptionEl}\n </Tooltip>\n ) : (\n menuItem\n );\n}\n\nconst MenuItemContent = ({\n item,\n disabled,\n highlighted,\n}: {\n item: InternalItem | InternalCheckboxItem;\n disabled: boolean;\n highlighted: boolean;\n}) => {\n const hasIcon = !!(item.iconName || item.iconUrl || item.iconSvg);\n const hasExternal = isLinkItem(item) && item.external;\n const isCheckbox = isCheckboxItem(item);\n return (\n <>\n {isCheckbox && <MenuItemCheckmark checked={item.checked} disabled={disabled} />}\n {hasIcon && (\n <MenuItemIcon\n name={item.iconName}\n url={item.iconUrl}\n svg={item.iconSvg}\n alt={item.iconAlt}\n badge={item.badge}\n />\n )}\n <div className={styles['content-wrapper']}>\n <div className={styles['main-row']}>\n <div>\n {item.text}\n {hasExternal && <ExternalIcon disabled={disabled} ariaLabel={item.externalIconAriaLabel} />}\n </div>\n {item.labelTag && (\n <div className={clsx(styles['label-tag'], disabled && styles.disabled)}>{item.labelTag}</div>\n )}\n </div>\n {item.secondaryText && (\n <div\n className={clsx(styles['secondary-text'], highlighted && styles.highlighted, disabled && styles.disabled)}\n >\n {item.secondaryText}\n </div>\n )}\n </div>\n </>\n );\n};\n\nconst MenuItemIcon = (props: InternalIconProps) => (\n <span className={styles.icon}>\n <InternalIcon {...props} />\n </span>\n);\n\n// Toggle has aria-hidden set because it's just used as a graphical element,\n// a11y attributes for the checkmark are communicated through the role and aria-checked state\n// of the menu element item.\nconst MenuItemCheckmark = ({ disabled, checked }: { disabled: boolean; checked: boolean }) => {\n const checkmark = <InternalIcon variant={disabled ? 'disabled' : 'normal'} name=\"check\" />;\n return (\n <span\n className={clsx(styles.icon, styles.checkmark, { [styles.disabled]: disabled })}\n aria-hidden=\"true\"\n style={{ visibility: checked ? 'visible' : 'hidden' }}\n >\n {checkmark}\n </span>\n );\n};\n\nconst ExternalIcon = ({ disabled, ariaLabel }: { disabled: boolean; ariaLabel?: string }) => {\n const icon = <InternalIcon variant={disabled ? 'disabled' : 'normal'} name=\"external\" />;\n return (\n <span className={styles['external-icon']} role={ariaLabel ? 'img' : undefined} aria-label={ariaLabel}>\n {icon}\n </span>\n );\n};\n\nexport default ItemElement;\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/button-dropdown/item-element/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAEL,6BAA6B,GAC9B,MAAM,kEAAkE,CAAC;AAE1E,OAAO,YAAmC,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,oBAAoB,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAGzE,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,eAAe,MAAM,qCAAqC,CAAC;AAClE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,WAAW,GAAG,CAAC,EACnB,QA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AAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC,iBACnE,MAAM,EAClB,KAAK,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE,IAEpD,SAAS,CACL,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAA6C,EAAE,EAAE;IAC1F,MAAM,IAAI,GAAG,oBAAC,YAAY,IAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAC,UAAU,GAAG,CAAC;IACzF,OAAO,CACL,8BAAM,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,gBAAc,SAAS,IACjG,IAAI,CACA,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport {\n GeneratedAnalyticsMetadataFragment,\n getAnalyticsMetadataAttribute,\n} from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalIcon, { InternalIconProps } from '../../icon/internal';\nimport { useDropdownContext } from '../../internal/components/dropdown/context';\nimport useHiddenDescription from '../../internal/hooks/use-hidden-description';\nimport { useVisualRefresh } from '../../internal/hooks/use-visual-mode';\nimport { getDataAttributes } from '../../internal/utils/data-attributes';\nimport { GeneratedAnalyticsMetadataButtonDropdownClick } from '../analytics-metadata/interfaces';\nimport { ButtonDropdownProps, InternalCheckboxItem, InternalItem, ItemProps, LinkItem } from '../interfaces';\nimport Tooltip from '../tooltip';\nimport { getMenuItemCheckboxProps, getMenuItemProps } from '../utils/menu-item';\nimport { isCheckboxItem, isLinkItem } from '../utils/utils';\nimport { getItemTarget } from '../utils/utils';\n\nimport analyticsLabels from '../analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nconst ItemElement = ({\n position = '1',\n index,\n item,\n disabled,\n onItemActivate,\n highlighted,\n highlightItem,\n showDivider,\n hasCategoryHeader,\n isKeyboardHighlighted = false,\n analyticsMetadataTransformer = (metadata: GeneratedAnalyticsMetadataFragment) => metadata,\n variant = 'normal',\n linkStyle,\n renderItem,\n parentProps,\n}: ItemProps) => {\n const isLink = isLinkItem(item);\n const isCheckbox = isCheckboxItem(item);\n const onClick = (event: React.MouseEvent) => {\n // Stop propagation to parent node and handle event exclusively in here. This ensures\n // that no group will interfere with the default behavior of links\n event.stopPropagation();\n if (!isLink) {\n event.preventDefault();\n }\n if (!disabled) {\n onItemActivate(item, event);\n }\n };\n\n const onHover = () => {\n highlightItem(item);\n };\n\n const isVisualRefresh = useVisualRefresh();\n\n return (\n <li\n className={clsx(styles['item-element'], styles[`variant-${variant}`], {\n [styles.highlighted]: highlighted,\n [styles.disabled]: disabled,\n [styles['has-category-header']]: hasCategoryHeader,\n [styles['has-checkmark']]: isCheckbox,\n [styles['show-divider']]: showDivider,\n [styles['is-focused']]: isKeyboardHighlighted,\n [styles['visual-refresh']]: isVisualRefresh,\n })}\n role=\"presentation\"\n data-testid={item.id}\n data-description={item.description}\n {...getDataAttributes(item.dataAttributes, ['testid'])}\n onClick={onClick}\n onMouseEnter={onHover}\n onTouchStart={onHover}\n {...getAnalyticsMetadataAttribute(\n disabled\n ? {}\n : (analyticsMetadataTransformer!({\n action: 'click',\n detail: {\n position,\n id: item.id,\n label: `.${analyticsLabels['menu-item']}`,\n href: (item as LinkItem).href || '',\n },\n }) as GeneratedAnalyticsMetadataButtonDropdownClick)\n )}\n >\n <MenuItem\n index={index}\n item={item}\n disabled={disabled}\n highlighted={highlighted}\n linkStyle={linkStyle}\n renderItem={renderItem}\n parentProps={parentProps}\n />\n </li>\n );\n};\n\ninterface MenuItemProps {\n index?: number;\n item: InternalItem | InternalCheckboxItem;\n disabled: boolean;\n highlighted: boolean;\n linkStyle?: boolean;\n renderItem?: ButtonDropdownProps.ItemRenderer;\n parentProps?: ButtonDropdownProps.GroupRenderItem;\n}\n\nfunction MenuItem({ index, item, disabled, highlighted, linkStyle, renderItem, parentProps }: MenuItemProps) {\n const menuItemRef = useRef<(HTMLSpanElement & HTMLAnchorElement) | null>(null);\n const isCheckbox = isCheckboxItem(item);\n const isCurrentBreadcrumb = !isCheckbox && item.isCurrentBreadcrumb;\n\n useEffect(() => {\n if (highlighted && menuItemRef.current) {\n menuItemRef.current.focus();\n }\n }, [highlighted]);\n\n let itemProps: { item: ButtonDropdownProps.RenderItem };\n\n if (isCheckbox) {\n itemProps = {\n item: {\n index: index ?? 0,\n type: 'checkbox',\n option: item as ButtonDropdownProps.CheckboxItem,\n disabled: disabled,\n highlighted: highlighted,\n checked: item.checked,\n parent: parentProps ?? null,\n },\n };\n } else {\n itemProps = {\n item: {\n index: index ?? 0,\n type: 'action',\n option: item as ButtonDropdownProps.Item,\n disabled: disabled,\n highlighted: highlighted,\n parent: parentProps ?? null,\n },\n };\n }\n\n const renderResult = renderItem?.(itemProps) ?? null;\n\n const isDisabledWithReason = disabled && item.disabledReason;\n const { targetProps, descriptionEl } = useHiddenDescription(item.disabledReason);\n const menuItemProps: React.HTMLAttributes<HTMLSpanElement & HTMLAnchorElement> = {\n 'aria-label': item.ariaLabel,\n className: clsx(\n styles['menu-item'],\n !!renderResult && styles['no-content-styling'],\n analyticsLabels['menu-item'],\n linkStyle && styles['link-style'],\n linkStyle && highlighted && styles['link-style-highlighted'],\n isCurrentBreadcrumb && styles['current-breadcrumb']\n ),\n 'aria-current': isCurrentBreadcrumb,\n lang: item.lang,\n ref: menuItemRef,\n // We are using the roving tabindex technique to manage the focus state of the dropdown.\n // The current element will always have tabindex=0 which means that it can be tabbed to,\n // while all other items have tabindex=-1 so we can focus them when necessary.\n tabIndex: highlighted ? 0 : -1,\n ...(isCheckbox ? getMenuItemCheckboxProps({ disabled, checked: item.checked }) : getMenuItemProps({ disabled })),\n ...(isDisabledWithReason ? targetProps : {}),\n };\n\n const menuItem = isLinkItem(item) ? (\n <a\n {...menuItemProps}\n href={!disabled ? item.href : undefined}\n download={!disabled && item.download ? item.download : undefined}\n target={getItemTarget(item)}\n rel={item.external ? 'noopener noreferrer' : undefined}\n >\n {renderResult ? renderResult : <MenuItemContent item={item} disabled={disabled} highlighted={highlighted} />}\n </a>\n ) : (\n <span {...menuItemProps}>\n {renderResult ? renderResult : <MenuItemContent item={item} disabled={disabled} highlighted={highlighted} />}\n </span>\n );\n\n const { position } = useDropdownContext();\n const tooltipPosition = position === 'bottom-left' || position === 'top-left' ? 'left' : 'right';\n return isDisabledWithReason ? (\n <Tooltip content={item.disabledReason} position={tooltipPosition} className={styles['item-tooltip-wrapper']}>\n {menuItem}\n {descriptionEl}\n </Tooltip>\n ) : (\n menuItem\n );\n}\n\nconst MenuItemContent = ({\n item,\n disabled,\n highlighted,\n}: {\n item: InternalItem | InternalCheckboxItem;\n disabled: boolean;\n highlighted: boolean;\n}) => {\n const hasIcon = !!(item.iconName || item.iconUrl || item.iconSvg);\n const hasExternal = isLinkItem(item) && item.external;\n const isCheckbox = isCheckboxItem(item);\n return (\n <>\n {isCheckbox && <MenuItemCheckmark checked={item.checked} disabled={disabled} />}\n {hasIcon && (\n <MenuItemIcon\n name={item.iconName}\n url={item.iconUrl}\n svg={item.iconSvg}\n alt={item.iconAlt}\n badge={item.badge}\n />\n )}\n <div className={styles['content-wrapper']}>\n <div className={styles['main-row']}>\n <div>\n {item.text}\n {hasExternal && <ExternalIcon disabled={disabled} ariaLabel={item.externalIconAriaLabel} />}\n </div>\n {item.labelTag && (\n <div className={clsx(styles['label-tag'], disabled && styles.disabled)}>{item.labelTag}</div>\n )}\n </div>\n {item.secondaryText && (\n <div\n className={clsx(styles['secondary-text'], highlighted && styles.highlighted, disabled && styles.disabled)}\n >\n {item.secondaryText}\n </div>\n )}\n </div>\n </>\n );\n};\n\nconst MenuItemIcon = (props: InternalIconProps) => (\n <span className={styles.icon}>\n <InternalIcon {...props} />\n </span>\n);\n\n// Toggle has aria-hidden set because it's just used as a graphical element,\n// a11y attributes for the checkmark are communicated through the role and aria-checked state\n// of the menu element item.\nconst MenuItemCheckmark = ({ disabled, checked }: { disabled: boolean; checked: boolean }) => {\n const checkmark = <InternalIcon variant={disabled ? 'disabled' : 'normal'} name=\"check\" />;\n return (\n <span\n className={clsx(styles.icon, styles.checkmark, { [styles.disabled]: disabled })}\n aria-hidden=\"true\"\n style={{ visibility: checked ? 'visible' : 'hidden' }}\n >\n {checkmark}\n </span>\n );\n};\n\nconst ExternalIcon = ({ disabled, ariaLabel }: { disabled: boolean; ariaLabel?: string }) => {\n const icon = <InternalIcon variant={disabled ? 'disabled' : 'normal'} name=\"external\" />;\n return (\n <span className={styles['external-icon']} role={ariaLabel ? 'img' : undefined} aria-label={ariaLabel}>\n {icon}\n </span>\n );\n};\n\nexport default ItemElement;\n"]}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { InputProps } from './interfaces';
|
|
2
|
-
export declare function getInputStyles(style: InputProps['style']): {
|
|
2
|
+
export declare function getInputStyles(style: InputProps['style']): {
|
|
3
|
+
[x: string]: string | undefined;
|
|
4
|
+
borderRadius: string | undefined;
|
|
5
|
+
borderWidth: string | undefined;
|
|
6
|
+
fontSize: string | undefined;
|
|
7
|
+
fontWeight: string | undefined;
|
|
8
|
+
paddingBlock: string | undefined;
|
|
9
|
+
paddingInline: string | undefined;
|
|
10
|
+
} | undefined;
|
|
3
11
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/input/styles.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/input/styles.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;;;;;;;;cAExD"}
|
|
@@ -1,44 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import {
|
|
4
|
-
import customCssProps from '../internal/generated/custom-css-properties';
|
|
3
|
+
import { getInputStylesCss } from '../internal/utils/input-styles';
|
|
5
4
|
export function getInputStyles(style) {
|
|
6
|
-
|
|
7
|
-
let properties = {};
|
|
8
|
-
if (SYSTEM === 'core') {
|
|
9
|
-
properties = {
|
|
10
|
-
borderRadius: (_a = style === null || style === void 0 ? void 0 : style.root) === null || _a === void 0 ? void 0 : _a.borderRadius,
|
|
11
|
-
borderWidth: (_b = style === null || style === void 0 ? void 0 : style.root) === null || _b === void 0 ? void 0 : _b.borderWidth,
|
|
12
|
-
fontSize: (_c = style === null || style === void 0 ? void 0 : style.root) === null || _c === void 0 ? void 0 : _c.fontSize,
|
|
13
|
-
fontWeight: (_d = style === null || style === void 0 ? void 0 : style.root) === null || _d === void 0 ? void 0 : _d.fontWeight,
|
|
14
|
-
paddingBlock: (_e = style === null || style === void 0 ? void 0 : style.root) === null || _e === void 0 ? void 0 : _e.paddingBlock,
|
|
15
|
-
paddingInline: (_f = style === null || style === void 0 ? void 0 : style.root) === null || _f === void 0 ? void 0 : _f.paddingInline,
|
|
16
|
-
[customCssProps.styleBackgroundDefault]: (_h = (_g = style === null || style === void 0 ? void 0 : style.root) === null || _g === void 0 ? void 0 : _g.backgroundColor) === null || _h === void 0 ? void 0 : _h.default,
|
|
17
|
-
[customCssProps.styleBackgroundDisabled]: (_k = (_j = style === null || style === void 0 ? void 0 : style.root) === null || _j === void 0 ? void 0 : _j.backgroundColor) === null || _k === void 0 ? void 0 : _k.disabled,
|
|
18
|
-
[customCssProps.styleBackgroundHover]: (_m = (_l = style === null || style === void 0 ? void 0 : style.root) === null || _l === void 0 ? void 0 : _l.backgroundColor) === null || _m === void 0 ? void 0 : _m.hover,
|
|
19
|
-
[customCssProps.styleBackgroundFocus]: (_p = (_o = style === null || style === void 0 ? void 0 : style.root) === null || _o === void 0 ? void 0 : _o.backgroundColor) === null || _p === void 0 ? void 0 : _p.focus,
|
|
20
|
-
[customCssProps.styleBackgroundReadonly]: (_r = (_q = style === null || style === void 0 ? void 0 : style.root) === null || _q === void 0 ? void 0 : _q.backgroundColor) === null || _r === void 0 ? void 0 : _r.readonly,
|
|
21
|
-
[customCssProps.styleBorderColorDefault]: (_t = (_s = style === null || style === void 0 ? void 0 : style.root) === null || _s === void 0 ? void 0 : _s.borderColor) === null || _t === void 0 ? void 0 : _t.default,
|
|
22
|
-
[customCssProps.styleBorderColorDisabled]: (_v = (_u = style === null || style === void 0 ? void 0 : style.root) === null || _u === void 0 ? void 0 : _u.borderColor) === null || _v === void 0 ? void 0 : _v.disabled,
|
|
23
|
-
[customCssProps.styleBorderColorHover]: (_x = (_w = style === null || style === void 0 ? void 0 : style.root) === null || _w === void 0 ? void 0 : _w.borderColor) === null || _x === void 0 ? void 0 : _x.hover,
|
|
24
|
-
[customCssProps.styleBorderColorFocus]: (_z = (_y = style === null || style === void 0 ? void 0 : style.root) === null || _y === void 0 ? void 0 : _y.borderColor) === null || _z === void 0 ? void 0 : _z.focus,
|
|
25
|
-
[customCssProps.styleBorderColorReadonly]: (_1 = (_0 = style === null || style === void 0 ? void 0 : style.root) === null || _0 === void 0 ? void 0 : _0.borderColor) === null || _1 === void 0 ? void 0 : _1.readonly,
|
|
26
|
-
[customCssProps.styleBoxShadowDefault]: (_3 = (_2 = style === null || style === void 0 ? void 0 : style.root) === null || _2 === void 0 ? void 0 : _2.boxShadow) === null || _3 === void 0 ? void 0 : _3.default,
|
|
27
|
-
[customCssProps.styleBoxShadowDisabled]: (_5 = (_4 = style === null || style === void 0 ? void 0 : style.root) === null || _4 === void 0 ? void 0 : _4.boxShadow) === null || _5 === void 0 ? void 0 : _5.disabled,
|
|
28
|
-
[customCssProps.styleBoxShadowHover]: (_7 = (_6 = style === null || style === void 0 ? void 0 : style.root) === null || _6 === void 0 ? void 0 : _6.boxShadow) === null || _7 === void 0 ? void 0 : _7.hover,
|
|
29
|
-
[customCssProps.styleBoxShadowFocus]: (_9 = (_8 = style === null || style === void 0 ? void 0 : style.root) === null || _8 === void 0 ? void 0 : _8.boxShadow) === null || _9 === void 0 ? void 0 : _9.focus,
|
|
30
|
-
[customCssProps.styleBoxShadowReadonly]: (_11 = (_10 = style === null || style === void 0 ? void 0 : style.root) === null || _10 === void 0 ? void 0 : _10.boxShadow) === null || _11 === void 0 ? void 0 : _11.readonly,
|
|
31
|
-
[customCssProps.styleColorDefault]: (_13 = (_12 = style === null || style === void 0 ? void 0 : style.root) === null || _12 === void 0 ? void 0 : _12.color) === null || _13 === void 0 ? void 0 : _13.default,
|
|
32
|
-
[customCssProps.styleColorDisabled]: (_15 = (_14 = style === null || style === void 0 ? void 0 : style.root) === null || _14 === void 0 ? void 0 : _14.color) === null || _15 === void 0 ? void 0 : _15.disabled,
|
|
33
|
-
[customCssProps.styleColorHover]: (_17 = (_16 = style === null || style === void 0 ? void 0 : style.root) === null || _16 === void 0 ? void 0 : _16.color) === null || _17 === void 0 ? void 0 : _17.hover,
|
|
34
|
-
[customCssProps.styleColorFocus]: (_19 = (_18 = style === null || style === void 0 ? void 0 : style.root) === null || _18 === void 0 ? void 0 : _18.color) === null || _19 === void 0 ? void 0 : _19.focus,
|
|
35
|
-
[customCssProps.styleColorReadonly]: (_21 = (_20 = style === null || style === void 0 ? void 0 : style.root) === null || _20 === void 0 ? void 0 : _20.color) === null || _21 === void 0 ? void 0 : _21.readonly,
|
|
36
|
-
[customCssProps.stylePlaceholderColor]: (_22 = style === null || style === void 0 ? void 0 : style.placeholder) === null || _22 === void 0 ? void 0 : _22.color,
|
|
37
|
-
[customCssProps.stylePlaceholderFontSize]: (_23 = style === null || style === void 0 ? void 0 : style.placeholder) === null || _23 === void 0 ? void 0 : _23.fontSize,
|
|
38
|
-
[customCssProps.stylePlaceholderFontWeight]: (_24 = style === null || style === void 0 ? void 0 : style.placeholder) === null || _24 === void 0 ? void 0 : _24.fontWeight,
|
|
39
|
-
[customCssProps.stylePlaceholderFontStyle]: (_25 = style === null || style === void 0 ? void 0 : style.placeholder) === null || _25 === void 0 ? void 0 : _25.fontStyle,
|
|
40
|
-
};
|
|
41
|
-
return properties;
|
|
42
|
-
}
|
|
5
|
+
return getInputStylesCss(style);
|
|
43
6
|
}
|
|
44
7
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/input/styles.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/input/styles.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnE,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getInputStylesCss } from '../internal/utils/input-styles';\nimport { InputProps } from './interfaces';\n\nexport function getInputStyles(style: InputProps['style']) {\n return getInputStylesCss(style);\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 (62db9d6a)";
|
|
3
|
+
export var GIT_SHA = "62db9d6a";
|
|
4
4
|
export var THEME = "open-source-visual-refresh";
|
|
5
5
|
export var SYSTEM = "core";
|
|
6
6
|
export var ALWAYS_VISUAL_REFRESH = true;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-attributes.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/data-attributes.ts"],"names":[],"mappings":"AAIA,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAClD,WAAW,GAAE,MAAM,EAAO,GACzB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAsBxB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { warnOnce } from '@cloudscape-design/component-toolkit/internal';
|
|
4
|
+
export function getDataAttributes(dataAttributes, excludeKeys = []) {
|
|
5
|
+
if (!dataAttributes) {
|
|
6
|
+
return {};
|
|
7
|
+
}
|
|
8
|
+
return Object.entries(dataAttributes).reduce((acc, [key, value]) => {
|
|
9
|
+
if (excludeKeys.includes(key) || excludeKeys.includes(`data-${key}`)) {
|
|
10
|
+
warnOnce('getDataAttributes', `"${key}" key is reserved and cannot be overridden via dataAttributes`);
|
|
11
|
+
return acc;
|
|
12
|
+
}
|
|
13
|
+
if (value === undefined) {
|
|
14
|
+
return acc;
|
|
15
|
+
}
|
|
16
|
+
const attrKey = key.startsWith('data-') ? key : `data-${key}`;
|
|
17
|
+
acc[attrKey] = value;
|
|
18
|
+
return acc;
|
|
19
|
+
}, {});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=data-attributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-attributes.js","sourceRoot":"","sources":["../../../../src/internal/utils/data-attributes.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,MAAM,UAAU,iBAAiB,CAC/B,cAAkD,EAClD,cAAwB,EAAE;IAE1B,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,MAAM,CAC1C,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACpB,IAAI,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,QAAQ,GAAG,EAAE,CAAC,EAAE,CAAC;YACrE,QAAQ,CAAC,mBAAmB,EAAE,IAAI,GAAG,+DAA+D,CAAC,CAAC;YACtG,OAAO,GAAG,CAAC;QACb,CAAC;QAED,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,GAAG,CAAC;QACb,CAAC;QAED,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,GAAG,EAAE,CAAC;QAC9D,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;QACrB,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAA4B,CAC7B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nexport function getDataAttributes(\n dataAttributes: Record<string, string> | undefined,\n excludeKeys: string[] = []\n): Record<string, string> {\n if (!dataAttributes) {\n return {};\n }\n\n return Object.entries(dataAttributes).reduce(\n (acc, [key, value]) => {\n if (excludeKeys.includes(key) || excludeKeys.includes(`data-${key}`)) {\n warnOnce('getDataAttributes', `\"${key}\" key is reserved and cannot be overridden via dataAttributes`);\n return acc;\n }\n\n if (value === undefined) {\n return acc;\n }\n\n const attrKey = key.startsWith('data-') ? key : `data-${key}`;\n acc[attrKey] = value;\n return acc;\n },\n {} as Record<string, string>\n );\n}\n"]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import customCssProps from '../generated/custom-css-properties';
|
|
2
|
+
/**
|
|
3
|
+
* Shared style interface for input-like components (input, textarea, text-filter).
|
|
4
|
+
* Components can extend or alias this interface in their own interfaces.ts files.
|
|
5
|
+
*/
|
|
6
|
+
export interface InputStyleProps {
|
|
7
|
+
root?: {
|
|
8
|
+
backgroundColor?: {
|
|
9
|
+
default?: string;
|
|
10
|
+
disabled?: string;
|
|
11
|
+
focus?: string;
|
|
12
|
+
hover?: string;
|
|
13
|
+
readonly?: string;
|
|
14
|
+
};
|
|
15
|
+
borderColor?: {
|
|
16
|
+
default?: string;
|
|
17
|
+
disabled?: string;
|
|
18
|
+
focus?: string;
|
|
19
|
+
hover?: string;
|
|
20
|
+
readonly?: string;
|
|
21
|
+
};
|
|
22
|
+
borderRadius?: string;
|
|
23
|
+
borderWidth?: string;
|
|
24
|
+
boxShadow?: {
|
|
25
|
+
default?: string;
|
|
26
|
+
disabled?: string;
|
|
27
|
+
focus?: string;
|
|
28
|
+
hover?: string;
|
|
29
|
+
readonly?: string;
|
|
30
|
+
};
|
|
31
|
+
color?: {
|
|
32
|
+
default?: string;
|
|
33
|
+
disabled?: string;
|
|
34
|
+
focus?: string;
|
|
35
|
+
hover?: string;
|
|
36
|
+
readonly?: string;
|
|
37
|
+
};
|
|
38
|
+
fontSize?: string;
|
|
39
|
+
fontWeight?: string;
|
|
40
|
+
paddingBlock?: string;
|
|
41
|
+
paddingInline?: string;
|
|
42
|
+
};
|
|
43
|
+
placeholder?: {
|
|
44
|
+
color?: string;
|
|
45
|
+
fontSize?: string;
|
|
46
|
+
fontStyle?: string;
|
|
47
|
+
fontWeight?: string;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Maps input-like component style props to CSS custom properties.
|
|
52
|
+
* Used by input, textarea, and text-filter components.
|
|
53
|
+
*
|
|
54
|
+
* @param style - The style props to map
|
|
55
|
+
* @param requireRoot - If true, returns undefined when style.root is not provided (textarea behavior).
|
|
56
|
+
* If false, returns object with undefined values (input/text-filter behavior).
|
|
57
|
+
*/
|
|
58
|
+
export declare function getInputStylesCss(style: InputStyleProps | undefined, requireRoot?: boolean): {
|
|
59
|
+
[customCssProps.styleBackgroundDefault]: string | undefined;
|
|
60
|
+
[customCssProps.styleBackgroundDisabled]: string | undefined;
|
|
61
|
+
[customCssProps.styleBackgroundHover]: string | undefined;
|
|
62
|
+
[customCssProps.styleBackgroundFocus]: string | undefined;
|
|
63
|
+
[customCssProps.styleBackgroundReadonly]: string | undefined;
|
|
64
|
+
[customCssProps.styleBorderColorDefault]: string | undefined;
|
|
65
|
+
[customCssProps.styleBorderColorDisabled]: string | undefined;
|
|
66
|
+
[customCssProps.styleBorderColorHover]: string | undefined;
|
|
67
|
+
[customCssProps.styleBorderColorFocus]: string | undefined;
|
|
68
|
+
[customCssProps.styleBorderColorReadonly]: string | undefined;
|
|
69
|
+
[customCssProps.styleBoxShadowDefault]: string | undefined;
|
|
70
|
+
[customCssProps.styleBoxShadowDisabled]: string | undefined;
|
|
71
|
+
[customCssProps.styleBoxShadowHover]: string | undefined;
|
|
72
|
+
[customCssProps.styleBoxShadowFocus]: string | undefined;
|
|
73
|
+
[customCssProps.styleBoxShadowReadonly]: string | undefined;
|
|
74
|
+
[customCssProps.styleColorDefault]: string | undefined;
|
|
75
|
+
[customCssProps.styleColorDisabled]: string | undefined;
|
|
76
|
+
[customCssProps.styleColorHover]: string | undefined;
|
|
77
|
+
[customCssProps.styleColorFocus]: string | undefined;
|
|
78
|
+
[customCssProps.styleColorReadonly]: string | undefined;
|
|
79
|
+
[customCssProps.stylePlaceholderColor]: string | undefined;
|
|
80
|
+
[customCssProps.stylePlaceholderFontSize]: string | undefined;
|
|
81
|
+
[customCssProps.stylePlaceholderFontWeight]: string | undefined;
|
|
82
|
+
[customCssProps.stylePlaceholderFontStyle]: string | undefined;
|
|
83
|
+
borderRadius: string | undefined;
|
|
84
|
+
borderWidth: string | undefined;
|
|
85
|
+
fontSize: string | undefined;
|
|
86
|
+
fontWeight: string | undefined;
|
|
87
|
+
paddingBlock: string | undefined;
|
|
88
|
+
paddingInline: string | undefined;
|
|
89
|
+
} | undefined;
|
|
90
|
+
//# sourceMappingURL=input-styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-styles.d.ts","sourceRoot":"","sources":["../../../../src/internal/utils/input-styles.ts"],"names":[],"mappings":"AAGA,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAEhE;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE;QACL,eAAe,CAAC,EAAE;YAChB,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,QAAQ,CAAC,EAAE,MAAM,CAAC;SACnB,CAAC;QACF,WAAW,CAAC,EAAE;YACZ,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,QAAQ,CAAC,EAAE,MAAM,CAAC;SACnB,CAAC;QACF,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE;YACV,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,QA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c,CAAC,sBAAsB,CAAC,qBAAkC;IACzE,CAAC,cAAc,CAAC,mBAAmB,CAAC,qBAA+B;IACnE,CAAC,cAAc,CAAC,mBAAmB,CAAC,qBAA+B;IACnE,CAAC,cAAc,CAAC,sBAAsB,CAAC,qBAAkC;IACzE,CAAC,cAAc,CAAC,iBAAiB,CAAC,qBAA6B;IAC/D,CAAC,cAAc,CAAC,kBAAkB,CAAC,qBAA8B;IACjE,CAAC,cAAc,CAAC,eAAe,CAAC,qBAA2B;IAC3D,CAAC,cAAc,CAAC,eAAe,CAAC,qBAA2B;IAC3D,CAAC,cAAc,CAAC,kBAAkB,CAAC,qBAA8B;IACjE,CAAC,cAAc,CAAC,qBAAqB,CAAC,qBAA2B;IACjE,CAAC,cAAc,CAAC,wBAAwB,CAAC,qBAA8B;IACvE,CAAC,cAAc,CAAC,0BAA0B,CAAC,qBAAgC;IAC3E,CAAC,cAAc,CAAC,yBAAyB,CAAC,qBAA+B;;;;;;;cAE5E"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { SYSTEM } from '../environment';
|
|
4
|
+
import customCssProps from '../generated/custom-css-properties';
|
|
5
|
+
/**
|
|
6
|
+
* Maps input-like component style props to CSS custom properties.
|
|
7
|
+
* Used by input, textarea, and text-filter components.
|
|
8
|
+
*
|
|
9
|
+
* @param style - The style props to map
|
|
10
|
+
* @param requireRoot - If true, returns undefined when style.root is not provided (textarea behavior).
|
|
11
|
+
* If false, returns object with undefined values (input/text-filter behavior).
|
|
12
|
+
*/
|
|
13
|
+
export function getInputStylesCss(style, requireRoot = false) {
|
|
14
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25;
|
|
15
|
+
if (SYSTEM !== 'core') {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
if (requireRoot && !(style === null || style === void 0 ? void 0 : style.root)) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
borderRadius: (_a = style === null || style === void 0 ? void 0 : style.root) === null || _a === void 0 ? void 0 : _a.borderRadius,
|
|
23
|
+
borderWidth: (_b = style === null || style === void 0 ? void 0 : style.root) === null || _b === void 0 ? void 0 : _b.borderWidth,
|
|
24
|
+
fontSize: (_c = style === null || style === void 0 ? void 0 : style.root) === null || _c === void 0 ? void 0 : _c.fontSize,
|
|
25
|
+
fontWeight: (_d = style === null || style === void 0 ? void 0 : style.root) === null || _d === void 0 ? void 0 : _d.fontWeight,
|
|
26
|
+
paddingBlock: (_e = style === null || style === void 0 ? void 0 : style.root) === null || _e === void 0 ? void 0 : _e.paddingBlock,
|
|
27
|
+
paddingInline: (_f = style === null || style === void 0 ? void 0 : style.root) === null || _f === void 0 ? void 0 : _f.paddingInline,
|
|
28
|
+
[customCssProps.styleBackgroundDefault]: (_h = (_g = style === null || style === void 0 ? void 0 : style.root) === null || _g === void 0 ? void 0 : _g.backgroundColor) === null || _h === void 0 ? void 0 : _h.default,
|
|
29
|
+
[customCssProps.styleBackgroundDisabled]: (_k = (_j = style === null || style === void 0 ? void 0 : style.root) === null || _j === void 0 ? void 0 : _j.backgroundColor) === null || _k === void 0 ? void 0 : _k.disabled,
|
|
30
|
+
[customCssProps.styleBackgroundHover]: (_m = (_l = style === null || style === void 0 ? void 0 : style.root) === null || _l === void 0 ? void 0 : _l.backgroundColor) === null || _m === void 0 ? void 0 : _m.hover,
|
|
31
|
+
[customCssProps.styleBackgroundFocus]: (_p = (_o = style === null || style === void 0 ? void 0 : style.root) === null || _o === void 0 ? void 0 : _o.backgroundColor) === null || _p === void 0 ? void 0 : _p.focus,
|
|
32
|
+
[customCssProps.styleBackgroundReadonly]: (_r = (_q = style === null || style === void 0 ? void 0 : style.root) === null || _q === void 0 ? void 0 : _q.backgroundColor) === null || _r === void 0 ? void 0 : _r.readonly,
|
|
33
|
+
[customCssProps.styleBorderColorDefault]: (_t = (_s = style === null || style === void 0 ? void 0 : style.root) === null || _s === void 0 ? void 0 : _s.borderColor) === null || _t === void 0 ? void 0 : _t.default,
|
|
34
|
+
[customCssProps.styleBorderColorDisabled]: (_v = (_u = style === null || style === void 0 ? void 0 : style.root) === null || _u === void 0 ? void 0 : _u.borderColor) === null || _v === void 0 ? void 0 : _v.disabled,
|
|
35
|
+
[customCssProps.styleBorderColorHover]: (_x = (_w = style === null || style === void 0 ? void 0 : style.root) === null || _w === void 0 ? void 0 : _w.borderColor) === null || _x === void 0 ? void 0 : _x.hover,
|
|
36
|
+
[customCssProps.styleBorderColorFocus]: (_z = (_y = style === null || style === void 0 ? void 0 : style.root) === null || _y === void 0 ? void 0 : _y.borderColor) === null || _z === void 0 ? void 0 : _z.focus,
|
|
37
|
+
[customCssProps.styleBorderColorReadonly]: (_1 = (_0 = style === null || style === void 0 ? void 0 : style.root) === null || _0 === void 0 ? void 0 : _0.borderColor) === null || _1 === void 0 ? void 0 : _1.readonly,
|
|
38
|
+
[customCssProps.styleBoxShadowDefault]: (_3 = (_2 = style === null || style === void 0 ? void 0 : style.root) === null || _2 === void 0 ? void 0 : _2.boxShadow) === null || _3 === void 0 ? void 0 : _3.default,
|
|
39
|
+
[customCssProps.styleBoxShadowDisabled]: (_5 = (_4 = style === null || style === void 0 ? void 0 : style.root) === null || _4 === void 0 ? void 0 : _4.boxShadow) === null || _5 === void 0 ? void 0 : _5.disabled,
|
|
40
|
+
[customCssProps.styleBoxShadowHover]: (_7 = (_6 = style === null || style === void 0 ? void 0 : style.root) === null || _6 === void 0 ? void 0 : _6.boxShadow) === null || _7 === void 0 ? void 0 : _7.hover,
|
|
41
|
+
[customCssProps.styleBoxShadowFocus]: (_9 = (_8 = style === null || style === void 0 ? void 0 : style.root) === null || _8 === void 0 ? void 0 : _8.boxShadow) === null || _9 === void 0 ? void 0 : _9.focus,
|
|
42
|
+
[customCssProps.styleBoxShadowReadonly]: (_11 = (_10 = style === null || style === void 0 ? void 0 : style.root) === null || _10 === void 0 ? void 0 : _10.boxShadow) === null || _11 === void 0 ? void 0 : _11.readonly,
|
|
43
|
+
[customCssProps.styleColorDefault]: (_13 = (_12 = style === null || style === void 0 ? void 0 : style.root) === null || _12 === void 0 ? void 0 : _12.color) === null || _13 === void 0 ? void 0 : _13.default,
|
|
44
|
+
[customCssProps.styleColorDisabled]: (_15 = (_14 = style === null || style === void 0 ? void 0 : style.root) === null || _14 === void 0 ? void 0 : _14.color) === null || _15 === void 0 ? void 0 : _15.disabled,
|
|
45
|
+
[customCssProps.styleColorHover]: (_17 = (_16 = style === null || style === void 0 ? void 0 : style.root) === null || _16 === void 0 ? void 0 : _16.color) === null || _17 === void 0 ? void 0 : _17.hover,
|
|
46
|
+
[customCssProps.styleColorFocus]: (_19 = (_18 = style === null || style === void 0 ? void 0 : style.root) === null || _18 === void 0 ? void 0 : _18.color) === null || _19 === void 0 ? void 0 : _19.focus,
|
|
47
|
+
[customCssProps.styleColorReadonly]: (_21 = (_20 = style === null || style === void 0 ? void 0 : style.root) === null || _20 === void 0 ? void 0 : _20.color) === null || _21 === void 0 ? void 0 : _21.readonly,
|
|
48
|
+
[customCssProps.stylePlaceholderColor]: (_22 = style === null || style === void 0 ? void 0 : style.placeholder) === null || _22 === void 0 ? void 0 : _22.color,
|
|
49
|
+
[customCssProps.stylePlaceholderFontSize]: (_23 = style === null || style === void 0 ? void 0 : style.placeholder) === null || _23 === void 0 ? void 0 : _23.fontSize,
|
|
50
|
+
[customCssProps.stylePlaceholderFontWeight]: (_24 = style === null || style === void 0 ? void 0 : style.placeholder) === null || _24 === void 0 ? void 0 : _24.fontWeight,
|
|
51
|
+
[customCssProps.stylePlaceholderFontStyle]: (_25 = style === null || style === void 0 ? void 0 : style.placeholder) === null || _25 === void 0 ? void 0 : _25.fontStyle,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=input-styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-styles.js","sourceRoot":"","sources":["../../../../src/internal/utils/input-styles.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAmDhE;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAkC,EAAE,WAAW,GAAG,KAAK;;IACvF,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,WAAW,IAAI,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAA,EAAE,CAAC;QAChC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,YAAY,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,YAAY;QACvC,WAAW,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,WAAW;QACrC,QAAQ,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,QAAQ;QAC/B,UAAU,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,UAAU;QACnC,YAAY,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,YAAY;QACvC,aAAa,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,aAAa;QACzC,CAAC,cAAc,CAAC,sBAAsB,CAAC,EAAE,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,e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B,CAAC,EAAE,OAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,4CAAE,KAAK;QACjE,CAAC,cAAc,CAAC,wBAAwB,CAAC,EAAE,OAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,4CAAE,QAAQ;QACvE,CAAC,cAAc,CAAC,0BAA0B,CAAC,EAAE,OAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,4CAAE,UAAU;QAC3E,CAAC,cAAc,CAAC,yBAAyB,CAAC,EAAE,OAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,4CAAE,SAAS;KAC1E,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { SYSTEM } from '../environment';\nimport customCssProps from '../generated/custom-css-properties';\n\n/**\n * Shared style interface for input-like components (input, textarea, text-filter).\n * Components can extend or alias this interface in their own interfaces.ts files.\n */\nexport interface InputStyleProps {\n root?: {\n backgroundColor?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n borderColor?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n borderRadius?: string;\n borderWidth?: string;\n boxShadow?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n color?: {\n default?: string;\n disabled?: string;\n focus?: string;\n hover?: string;\n readonly?: string;\n };\n fontSize?: string;\n fontWeight?: string;\n paddingBlock?: string;\n paddingInline?: string;\n };\n placeholder?: {\n color?: string;\n fontSize?: string;\n fontStyle?: string;\n fontWeight?: string;\n };\n}\n\n/**\n * Maps input-like component style props to CSS custom properties.\n * Used by input, textarea, and text-filter components.\n *\n * @param style - The style props to map\n * @param requireRoot - If true, returns undefined when style.root is not provided (textarea behavior).\n * If false, returns object with undefined values (input/text-filter behavior).\n */\nexport function getInputStylesCss(style: InputStyleProps | undefined, requireRoot = false) {\n if (SYSTEM !== 'core') {\n return undefined;\n }\n\n if (requireRoot && !style?.root) {\n return undefined;\n }\n\n return {\n borderRadius: style?.root?.borderRadius,\n borderWidth: style?.root?.borderWidth,\n fontSize: style?.root?.fontSize,\n fontWeight: style?.root?.fontWeight,\n paddingBlock: style?.root?.paddingBlock,\n paddingInline: style?.root?.paddingInline,\n [customCssProps.styleBackgroundDefault]: style?.root?.backgroundColor?.default,\n [customCssProps.styleBackgroundDisabled]: style?.root?.backgroundColor?.disabled,\n [customCssProps.styleBackgroundHover]: style?.root?.backgroundColor?.hover,\n [customCssProps.styleBackgroundFocus]: style?.root?.backgroundColor?.focus,\n [customCssProps.styleBackgroundReadonly]: style?.root?.backgroundColor?.readonly,\n [customCssProps.styleBorderColorDefault]: style?.root?.borderColor?.default,\n [customCssProps.styleBorderColorDisabled]: style?.root?.borderColor?.disabled,\n [customCssProps.styleBorderColorHover]: style?.root?.borderColor?.hover,\n [customCssProps.styleBorderColorFocus]: style?.root?.borderColor?.focus,\n [customCssProps.styleBorderColorReadonly]: style?.root?.borderColor?.readonly,\n [customCssProps.styleBoxShadowDefault]: style?.root?.boxShadow?.default,\n [customCssProps.styleBoxShadowDisabled]: style?.root?.boxShadow?.disabled,\n [customCssProps.styleBoxShadowHover]: style?.root?.boxShadow?.hover,\n [customCssProps.styleBoxShadowFocus]: style?.root?.boxShadow?.focus,\n [customCssProps.styleBoxShadowReadonly]: style?.root?.boxShadow?.readonly,\n [customCssProps.styleColorDefault]: style?.root?.color?.default,\n [customCssProps.styleColorDisabled]: style?.root?.color?.disabled,\n [customCssProps.styleColorHover]: style?.root?.color?.hover,\n [customCssProps.styleColorFocus]: style?.root?.color?.focus,\n [customCssProps.styleColorReadonly]: style?.root?.color?.readonly,\n [customCssProps.stylePlaceholderColor]: style?.placeholder?.color,\n [customCssProps.stylePlaceholderFontSize]: style?.placeholder?.fontSize,\n [customCssProps.stylePlaceholderFontWeight]: style?.placeholder?.fontWeight,\n [customCssProps.stylePlaceholderFontStyle]: style?.placeholder?.fontStyle,\n };\n}\n"]}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { TextFilterProps } from './interfaces';
|
|
2
|
-
export declare function getTextFilterStyles(style: TextFilterProps['style']): {
|
|
2
|
+
export declare function getTextFilterStyles(style: TextFilterProps['style']): {
|
|
3
|
+
[x: string]: string | undefined;
|
|
4
|
+
borderRadius: string | undefined;
|
|
5
|
+
borderWidth: string | undefined;
|
|
6
|
+
fontSize: string | undefined;
|
|
7
|
+
fontWeight: string | undefined;
|
|
8
|
+
paddingBlock: string | undefined;
|
|
9
|
+
paddingInline: string | undefined;
|
|
10
|
+
} | undefined;
|
|
3
11
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/text-filter/styles.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/text-filter/styles.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC;;;;;;;;cAElE"}
|
|
@@ -1,44 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import {
|
|
4
|
-
import customCssProps from '../internal/generated/custom-css-properties';
|
|
3
|
+
import { getInputStylesCss } from '../internal/utils/input-styles';
|
|
5
4
|
export function getTextFilterStyles(style) {
|
|
6
|
-
|
|
7
|
-
let properties = {};
|
|
8
|
-
if (SYSTEM === 'core') {
|
|
9
|
-
properties = {
|
|
10
|
-
borderRadius: (_a = style === null || style === void 0 ? void 0 : style.root) === null || _a === void 0 ? void 0 : _a.borderRadius,
|
|
11
|
-
borderWidth: (_b = style === null || style === void 0 ? void 0 : style.root) === null || _b === void 0 ? void 0 : _b.borderWidth,
|
|
12
|
-
fontSize: (_c = style === null || style === void 0 ? void 0 : style.root) === null || _c === void 0 ? void 0 : _c.fontSize,
|
|
13
|
-
fontWeight: (_d = style === null || style === void 0 ? void 0 : style.root) === null || _d === void 0 ? void 0 : _d.fontWeight,
|
|
14
|
-
paddingBlock: (_e = style === null || style === void 0 ? void 0 : style.root) === null || _e === void 0 ? void 0 : _e.paddingBlock,
|
|
15
|
-
paddingInline: (_f = style === null || style === void 0 ? void 0 : style.root) === null || _f === void 0 ? void 0 : _f.paddingInline,
|
|
16
|
-
[customCssProps.styleBackgroundDefault]: (_h = (_g = style === null || style === void 0 ? void 0 : style.root) === null || _g === void 0 ? void 0 : _g.backgroundColor) === null || _h === void 0 ? void 0 : _h.default,
|
|
17
|
-
[customCssProps.styleBackgroundDisabled]: (_k = (_j = style === null || style === void 0 ? void 0 : style.root) === null || _j === void 0 ? void 0 : _j.backgroundColor) === null || _k === void 0 ? void 0 : _k.disabled,
|
|
18
|
-
[customCssProps.styleBackgroundHover]: (_m = (_l = style === null || style === void 0 ? void 0 : style.root) === null || _l === void 0 ? void 0 : _l.backgroundColor) === null || _m === void 0 ? void 0 : _m.hover,
|
|
19
|
-
[customCssProps.styleBackgroundFocus]: (_p = (_o = style === null || style === void 0 ? void 0 : style.root) === null || _o === void 0 ? void 0 : _o.backgroundColor) === null || _p === void 0 ? void 0 : _p.focus,
|
|
20
|
-
[customCssProps.styleBackgroundReadonly]: (_r = (_q = style === null || style === void 0 ? void 0 : style.root) === null || _q === void 0 ? void 0 : _q.backgroundColor) === null || _r === void 0 ? void 0 : _r.readonly,
|
|
21
|
-
[customCssProps.styleBorderColorDefault]: (_t = (_s = style === null || style === void 0 ? void 0 : style.root) === null || _s === void 0 ? void 0 : _s.borderColor) === null || _t === void 0 ? void 0 : _t.default,
|
|
22
|
-
[customCssProps.styleBorderColorDisabled]: (_v = (_u = style === null || style === void 0 ? void 0 : style.root) === null || _u === void 0 ? void 0 : _u.borderColor) === null || _v === void 0 ? void 0 : _v.disabled,
|
|
23
|
-
[customCssProps.styleBorderColorHover]: (_x = (_w = style === null || style === void 0 ? void 0 : style.root) === null || _w === void 0 ? void 0 : _w.borderColor) === null || _x === void 0 ? void 0 : _x.hover,
|
|
24
|
-
[customCssProps.styleBorderColorFocus]: (_z = (_y = style === null || style === void 0 ? void 0 : style.root) === null || _y === void 0 ? void 0 : _y.borderColor) === null || _z === void 0 ? void 0 : _z.focus,
|
|
25
|
-
[customCssProps.styleBorderColorReadonly]: (_1 = (_0 = style === null || style === void 0 ? void 0 : style.root) === null || _0 === void 0 ? void 0 : _0.borderColor) === null || _1 === void 0 ? void 0 : _1.readonly,
|
|
26
|
-
[customCssProps.styleBoxShadowDefault]: (_3 = (_2 = style === null || style === void 0 ? void 0 : style.root) === null || _2 === void 0 ? void 0 : _2.boxShadow) === null || _3 === void 0 ? void 0 : _3.default,
|
|
27
|
-
[customCssProps.styleBoxShadowDisabled]: (_5 = (_4 = style === null || style === void 0 ? void 0 : style.root) === null || _4 === void 0 ? void 0 : _4.boxShadow) === null || _5 === void 0 ? void 0 : _5.disabled,
|
|
28
|
-
[customCssProps.styleBoxShadowHover]: (_7 = (_6 = style === null || style === void 0 ? void 0 : style.root) === null || _6 === void 0 ? void 0 : _6.boxShadow) === null || _7 === void 0 ? void 0 : _7.hover,
|
|
29
|
-
[customCssProps.styleBoxShadowFocus]: (_9 = (_8 = style === null || style === void 0 ? void 0 : style.root) === null || _8 === void 0 ? void 0 : _8.boxShadow) === null || _9 === void 0 ? void 0 : _9.focus,
|
|
30
|
-
[customCssProps.styleBoxShadowReadonly]: (_11 = (_10 = style === null || style === void 0 ? void 0 : style.root) === null || _10 === void 0 ? void 0 : _10.boxShadow) === null || _11 === void 0 ? void 0 : _11.readonly,
|
|
31
|
-
[customCssProps.styleColorDefault]: (_13 = (_12 = style === null || style === void 0 ? void 0 : style.root) === null || _12 === void 0 ? void 0 : _12.color) === null || _13 === void 0 ? void 0 : _13.default,
|
|
32
|
-
[customCssProps.styleColorDisabled]: (_15 = (_14 = style === null || style === void 0 ? void 0 : style.root) === null || _14 === void 0 ? void 0 : _14.color) === null || _15 === void 0 ? void 0 : _15.disabled,
|
|
33
|
-
[customCssProps.styleColorHover]: (_17 = (_16 = style === null || style === void 0 ? void 0 : style.root) === null || _16 === void 0 ? void 0 : _16.color) === null || _17 === void 0 ? void 0 : _17.hover,
|
|
34
|
-
[customCssProps.styleColorFocus]: (_19 = (_18 = style === null || style === void 0 ? void 0 : style.root) === null || _18 === void 0 ? void 0 : _18.color) === null || _19 === void 0 ? void 0 : _19.focus,
|
|
35
|
-
[customCssProps.styleColorReadonly]: (_21 = (_20 = style === null || style === void 0 ? void 0 : style.root) === null || _20 === void 0 ? void 0 : _20.color) === null || _21 === void 0 ? void 0 : _21.readonly,
|
|
36
|
-
[customCssProps.stylePlaceholderColor]: (_22 = style === null || style === void 0 ? void 0 : style.placeholder) === null || _22 === void 0 ? void 0 : _22.color,
|
|
37
|
-
[customCssProps.stylePlaceholderFontSize]: (_23 = style === null || style === void 0 ? void 0 : style.placeholder) === null || _23 === void 0 ? void 0 : _23.fontSize,
|
|
38
|
-
[customCssProps.stylePlaceholderFontWeight]: (_24 = style === null || style === void 0 ? void 0 : style.placeholder) === null || _24 === void 0 ? void 0 : _24.fontWeight,
|
|
39
|
-
[customCssProps.stylePlaceholderFontStyle]: (_25 = style === null || style === void 0 ? void 0 : style.placeholder) === null || _25 === void 0 ? void 0 : _25.fontStyle,
|
|
40
|
-
};
|
|
41
|
-
return properties;
|
|
42
|
-
}
|
|
5
|
+
return getInputStylesCss(style);
|
|
43
6
|
}
|
|
44
7
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/text-filter/styles.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/text-filter/styles.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnE,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IACjE,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getInputStylesCss } from '../internal/utils/input-styles';\nimport { TextFilterProps } from './interfaces';\n\nexport function getTextFilterStyles(style: TextFilterProps['style']) {\n return getInputStylesCss(style);\n}\n"]}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { TextareaProps } from './interfaces';
|
|
2
|
-
export declare function getTextareaStyles(style: TextareaProps['style']): {
|
|
2
|
+
export declare function getTextareaStyles(style: TextareaProps['style']): {
|
|
3
|
+
[x: string]: string | undefined;
|
|
4
|
+
borderRadius: string | undefined;
|
|
5
|
+
borderWidth: string | undefined;
|
|
6
|
+
fontSize: string | undefined;
|
|
7
|
+
fontWeight: string | undefined;
|
|
8
|
+
paddingBlock: string | undefined;
|
|
9
|
+
paddingInline: string | undefined;
|
|
10
|
+
} | undefined;
|
|
3
11
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/textarea/styles.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/textarea/styles.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC;;;;;;;;cAE9D"}
|
|
@@ -1,54 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import {
|
|
4
|
-
import customCssProps from '../internal/generated/custom-css-properties';
|
|
3
|
+
import { getInputStylesCss } from '../internal/utils/input-styles';
|
|
5
4
|
export function getTextareaStyles(style) {
|
|
6
|
-
|
|
7
|
-
let properties = {};
|
|
8
|
-
if ((style === null || style === void 0 ? void 0 : style.root) && SYSTEM === 'core') {
|
|
9
|
-
properties = {
|
|
10
|
-
borderRadius: (_a = style === null || style === void 0 ? void 0 : style.root) === null || _a === void 0 ? void 0 : _a.borderRadius,
|
|
11
|
-
borderWidth: (_b = style === null || style === void 0 ? void 0 : style.root) === null || _b === void 0 ? void 0 : _b.borderWidth,
|
|
12
|
-
fontSize: (_c = style === null || style === void 0 ? void 0 : style.root) === null || _c === void 0 ? void 0 : _c.fontSize,
|
|
13
|
-
fontWeight: (_d = style === null || style === void 0 ? void 0 : style.root) === null || _d === void 0 ? void 0 : _d.fontWeight,
|
|
14
|
-
paddingBlock: (_e = style === null || style === void 0 ? void 0 : style.root) === null || _e === void 0 ? void 0 : _e.paddingBlock,
|
|
15
|
-
paddingInline: (_f = style === null || style === void 0 ? void 0 : style.root) === null || _f === void 0 ? void 0 : _f.paddingInline,
|
|
16
|
-
...(((_g = style === null || style === void 0 ? void 0 : style.root) === null || _g === void 0 ? void 0 : _g.backgroundColor) && {
|
|
17
|
-
[customCssProps.styleBackgroundDefault]: (_h = style.root.backgroundColor) === null || _h === void 0 ? void 0 : _h.default,
|
|
18
|
-
[customCssProps.styleBackgroundDisabled]: (_j = style.root.backgroundColor) === null || _j === void 0 ? void 0 : _j.disabled,
|
|
19
|
-
[customCssProps.styleBackgroundHover]: (_k = style.root.backgroundColor) === null || _k === void 0 ? void 0 : _k.hover,
|
|
20
|
-
[customCssProps.styleBackgroundFocus]: (_l = style.root.backgroundColor) === null || _l === void 0 ? void 0 : _l.focus,
|
|
21
|
-
[customCssProps.styleBackgroundReadonly]: (_m = style.root.backgroundColor) === null || _m === void 0 ? void 0 : _m.readonly,
|
|
22
|
-
}),
|
|
23
|
-
...(((_o = style === null || style === void 0 ? void 0 : style.root) === null || _o === void 0 ? void 0 : _o.borderColor) && {
|
|
24
|
-
[customCssProps.styleBorderColorDefault]: (_p = style.root.borderColor) === null || _p === void 0 ? void 0 : _p.default,
|
|
25
|
-
[customCssProps.styleBorderColorDisabled]: (_q = style.root.borderColor) === null || _q === void 0 ? void 0 : _q.disabled,
|
|
26
|
-
[customCssProps.styleBorderColorHover]: (_r = style.root.borderColor) === null || _r === void 0 ? void 0 : _r.hover,
|
|
27
|
-
[customCssProps.styleBorderColorFocus]: (_s = style.root.borderColor) === null || _s === void 0 ? void 0 : _s.focus,
|
|
28
|
-
[customCssProps.styleBorderColorReadonly]: (_t = style.root.borderColor) === null || _t === void 0 ? void 0 : _t.readonly,
|
|
29
|
-
}),
|
|
30
|
-
...(((_u = style === null || style === void 0 ? void 0 : style.root) === null || _u === void 0 ? void 0 : _u.boxShadow) && {
|
|
31
|
-
[customCssProps.styleBoxShadowDefault]: (_v = style.root.boxShadow) === null || _v === void 0 ? void 0 : _v.default,
|
|
32
|
-
[customCssProps.styleBoxShadowDisabled]: (_w = style.root.boxShadow) === null || _w === void 0 ? void 0 : _w.disabled,
|
|
33
|
-
[customCssProps.styleBoxShadowHover]: (_x = style.root.boxShadow) === null || _x === void 0 ? void 0 : _x.hover,
|
|
34
|
-
[customCssProps.styleBoxShadowFocus]: (_y = style.root.boxShadow) === null || _y === void 0 ? void 0 : _y.focus,
|
|
35
|
-
[customCssProps.styleBoxShadowReadonly]: (_z = style.root.boxShadow) === null || _z === void 0 ? void 0 : _z.readonly,
|
|
36
|
-
}),
|
|
37
|
-
...(((_0 = style === null || style === void 0 ? void 0 : style.root) === null || _0 === void 0 ? void 0 : _0.color) && {
|
|
38
|
-
[customCssProps.styleColorDefault]: (_1 = style.root.color) === null || _1 === void 0 ? void 0 : _1.default,
|
|
39
|
-
[customCssProps.styleColorDisabled]: (_2 = style.root.color) === null || _2 === void 0 ? void 0 : _2.disabled,
|
|
40
|
-
[customCssProps.styleColorHover]: (_3 = style.root.color) === null || _3 === void 0 ? void 0 : _3.hover,
|
|
41
|
-
[customCssProps.styleColorFocus]: (_4 = style.root.color) === null || _4 === void 0 ? void 0 : _4.focus,
|
|
42
|
-
[customCssProps.styleColorReadonly]: (_5 = style.root.color) === null || _5 === void 0 ? void 0 : _5.readonly,
|
|
43
|
-
}),
|
|
44
|
-
...((style === null || style === void 0 ? void 0 : style.placeholder) && {
|
|
45
|
-
[customCssProps.stylePlaceholderColor]: (_6 = style.placeholder) === null || _6 === void 0 ? void 0 : _6.color,
|
|
46
|
-
[customCssProps.stylePlaceholderFontSize]: (_7 = style.placeholder) === null || _7 === void 0 ? void 0 : _7.fontSize,
|
|
47
|
-
[customCssProps.stylePlaceholderFontWeight]: (_8 = style.placeholder) === null || _8 === void 0 ? void 0 : _8.fontWeight,
|
|
48
|
-
[customCssProps.stylePlaceholderFontStyle]: (_9 = style.placeholder) === null || _9 === void 0 ? void 0 : _9.fontStyle,
|
|
49
|
-
}),
|
|
50
|
-
};
|
|
51
|
-
return properties;
|
|
52
|
-
}
|
|
5
|
+
return getInputStylesCss(style, true);
|
|
53
6
|
}
|
|
54
7
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/textarea/styles.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/textarea/styles.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnE,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,OAAO,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACxC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getInputStylesCss } from '../internal/utils/input-styles';\nimport { TextareaProps } from './interfaces';\n\nexport function getTextareaStyles(style: TextareaProps['style']) {\n return getInputStylesCss(style, true);\n}\n"]}
|