diff --git a/pages/radio-group/style-api-v2.page.tsx b/pages/radio-group/style-api-v2.page.tsx index 200e142ed4a..1b2ed8fe0db 100644 --- a/pages/radio-group/style-api-v2.page.tsx +++ b/pages/radio-group/style-api-v2.page.tsx @@ -40,7 +40,14 @@ function StyledRadioGroup({ ariaLabel, items, readOnly, direction }: StyledRadio onChange={({ detail }) => setValue(detail.value)} {...{ styleClassNames: { - item: { control: clsx(styles['radio-control'], readOnly && styles['radio-control-readonly']) }, + item: ({ item, checked }: { item: RadioGroupProps.RadioButtonDefinition; checked: boolean }) => ({ + control: clsx( + styles['radio-control'], + checked && styles['radio-control-checked'], + item.disabled && styles['radio-control-disabled'], + readOnly && styles['radio-control-readonly'] + ), + }), }, }} /> diff --git a/pages/radio-group/style-api-v2.scss b/pages/radio-group/style-api-v2.scss index 8c63da1508d..52f61b068d6 100644 --- a/pages/radio-group/style-api-v2.scss +++ b/pages/radio-group/style-api-v2.scss @@ -15,14 +15,14 @@ $awsui-focus-ring-radius: 50% ); - &:has(:checked) { + &.radio-control-checked { @include radio-button.control( $awsui-fill-color: palette.$control-bg-checked, $awsui-indicator-color: palette.$control-fg ); } - &:has(:disabled) { + &.radio-control-disabled { @include radio-button.control( $awsui-fill-color: palette.$control-bg-disabled, $awsui-border-color: palette.$border-disabled, diff --git a/pages/segmented-control/style-api-v2.page.tsx b/pages/segmented-control/style-api-v2.page.tsx index e6f4a3430d9..96d7cfab205 100644 --- a/pages/segmented-control/style-api-v2.page.tsx +++ b/pages/segmented-control/style-api-v2.page.tsx @@ -38,7 +38,13 @@ function StyledSegmentedControl({ options, label, square }: StyledSegmentedContr {...{ styleClassNames: { root: styles.root, - segment: clsx(styles.segment, square && styles['segment-square']), + segment: ({ option, selected }: { option: SegmentedControlProps.Option; selected: boolean }) => + clsx( + styles.segment, + selected && styles['segment-selected'], + option.disabled && styles['segment-disabled'], + square && styles['segment-square'] + ), divider: styles.divider, select: { trigger: styles['select-trigger'], dropdown: styles['select-dropdown'] }, }, diff --git a/pages/segmented-control/style-api-v2.scss b/pages/segmented-control/style-api-v2.scss index 9232b18bcf5..797eb8f12f5 100644 --- a/pages/segmented-control/style-api-v2.scss +++ b/pages/segmented-control/style-api-v2.scss @@ -35,7 +35,7 @@ @include segmented-control.segment($background: palette.$subtle-hover, $color: palette.$text); } - &[aria-pressed='true'] { + &.segment-selected { @include segmented-control.segment( $background: palette.$accent, $color: palette.$text-on-accent, @@ -43,8 +43,7 @@ ); } - &:disabled, - &[aria-disabled='true'] { + &.segment-disabled { @include segmented-control.segment($background: palette.$control-bg-disabled, $color: palette.$text-disabled); } } diff --git a/pages/table/style-api-v2.page.tsx b/pages/table/style-api-v2.page.tsx index 999feb6f861..29192c98825 100644 --- a/pages/table/style-api-v2.page.tsx +++ b/pages/table/style-api-v2.page.tsx @@ -4,7 +4,6 @@ import React, { useContext, useState } from 'react'; import clsx from 'clsx'; import { Checkbox, FormField, Header, Select, SpaceBetween, Table, TableProps } from '~components'; -import { StyleClassNames } from '~components/table/style-api'; import AppContext, { AppContextType } from '../app/app-context'; import { SimplePage } from '../app/templates'; @@ -135,7 +134,7 @@ export default function () { selectionType !== 'none' && (selectionType === 'single' ? selectedItems[0] === item : selectedItems.includes(item)); // Selected rows keep the selection color: status and nested highlights skip them. - const styleClassNames: StyleClassNames = { + const styleClassNames: TableProps.StyleClassNames = { root: styles.table, headerCell: args => { if (args.type === 'selection') { diff --git a/src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap b/src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap index b369da37cbd..413648ded77 100644 --- a/src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap +++ b/src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap @@ -209,6 +209,33 @@ This property only applies when an \`href\` is provided.", "optional": true, "type": "string", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: root, header. +Refer to the [style docs](/components/action-card/?tabId=style) for more details.", + "inlineType": { + "name": "ActionCardProps.StyleClassNames", + "properties": [ + { + "name": "header", + "optional": true, + "type": "string", + }, + { + "name": "root", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "ActionCardProps.StyleClassNames", + }, { "description": "Specifies where to open the linked URL (for example, to open in a new browser window or tab use \`_blank\`). This property only applies when an \`href\` is provided.", @@ -470,8 +497,9 @@ If the label is assigned via the \`i18nStrings\` property, this label will be ig "type": "string", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the alert's visual appearance. -Refer to the [style](/components/alert/?tabId=style) tab for more details.", +Refer to the [style docs](/components/alert/?tabId=style) for more details.", "inlineType": { "name": "AlertProps.Style", "properties": [ @@ -626,6 +654,38 @@ Refer to the [style](/components/alert/?tabId=style) tab for more details.", ], "type": "AlertProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: root, icon, dismissButton. +Refer to the [style docs](/components/alert/?tabId=style) for more details.", + "inlineType": { + "name": "AlertProps.StyleClassNames", + "properties": [ + { + "name": "dismissButton", + "optional": true, + "type": "string", + }, + { + "name": "icon", + "optional": true, + "type": "string", + }, + { + "name": "root", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "AlertProps.StyleClassNames", + }, { "defaultValue": "'info'", "description": "Specifies the type of message you want to display.", @@ -4068,8 +4128,9 @@ This is required to provide a good screen reader experience. For more informatio "type": "string", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the autosuggest's visual appearance. -Refer to the [style](/components/autosuggest/?tabId=style) tab for more details.", +Refer to the [style docs](/components/autosuggest/?tabId=style) for more details.", "inlineType": { "name": "AutosuggestProps.Style", "properties": [ @@ -4299,6 +4360,64 @@ Refer to the [style](/components/autosuggest/?tabId=style) tab for more details. ], "type": "AutosuggestProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: input, dropdown. +Refer to the [style docs](/components/autosuggest/?tabId=style) for more details.", + "inlineType": { + "name": "AutosuggestProps.StyleClassNames", + "properties": [ + { + "name": "dropdown", + "optional": true, + "type": "string", + }, + { + "inlineType": { + "name": "InputProps.StyleClassNames", + "properties": [ + { + "name": "clearButton", + "optional": true, + "type": "string", + }, + { + "name": "inlineLabel", + "optional": true, + "type": "string", + }, + { + "name": "input", + "optional": true, + "type": "string", + }, + { + "name": "root", + "optional": true, + "type": "string", + }, + { + "name": "searchIcon", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "input", + "optional": true, + "type": "InputProps.StyleClassNames", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "AutosuggestProps.StyleClassNames", + }, { "description": "Specifies the list of tokens to display inline before the text input. When this prop is provided (including an empty array), the component enters token mode: @@ -4426,8 +4545,9 @@ Pass a \`ref\` to access the native element for measurement, observation, or thi "type": "NativeAttributes>", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the badge's visual appearance. -Refer to the [style](/components/badge/?tabId=style) tab for more details.", +Refer to the [style docs](/components/badge/?tabId=style) for more details.", "inlineType": { "name": "BadgeProps.Style", "properties": [ @@ -4487,6 +4607,28 @@ Refer to the [style](/components/badge/?tabId=style) tab for more details.", ], "type": "BadgeProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: root. +Refer to the [style docs](/components/badge/?tabId=style) for more details.", + "inlineType": { + "name": "BadgeProps.StyleClassNames", + "properties": [ + { + "name": "root", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "BadgeProps.StyleClassNames", + }, ], "regions": [ { @@ -6070,8 +6212,9 @@ If the \`rel\` property is provided, it overrides the default behavior.", "type": "string", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the button's visual appearance. -Refer to the [style](/components/button/?tabId=style) tab for more details.", +Refer to the [style docs](/components/button/?tabId=style) for more details.", "inlineType": { "name": "ButtonProps.Style", "properties": [ @@ -6266,6 +6409,28 @@ Refer to the [style](/components/button/?tabId=style) tab for more details.", ], "type": "ButtonProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: root. +Refer to the [style docs](/components/button/?tabId=style) for more details.", + "inlineType": { + "name": "ButtonProps.StyleClassNames", + "properties": [ + { + "name": "root", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "ButtonProps.StyleClassNames", + }, { "description": "Specifies where to open the linked URL (for example, to open in a new browser window or tab use \`_blank\`). This property only applies when an \`href\` is provided.", @@ -7459,6 +7624,38 @@ When returning \`null\`, the default styling will be applied.", "optional": true, "type": "ButtonDropdownProps.ItemRenderer", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: trigger, mainAction, dropdown. +Refer to the [style docs](/components/button-dropdown/?tabId=style) for more details.", + "inlineType": { + "name": "ButtonDropdownProps.StyleClassNames", + "properties": [ + { + "name": "dropdown", + "optional": true, + "type": "string", + }, + { + "name": "mainAction", + "optional": true, + "type": "string", + }, + { + "name": "trigger", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "ButtonDropdownProps.StyleClassNames", + }, { "defaultValue": "'normal'", "description": "Determines the general styling of the button dropdown. @@ -7747,8 +7944,9 @@ use the \`id\` attribute, consider setting it on a parent element instead.", "type": "ReadonlyArray", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the button group's visual appearance. -Refer to the [style](/components/button-group/?tabId=style) tab for more details.", +Refer to the [style docs](/components/button-group/?tabId=style) for more details.", "inlineType": { "name": "ButtonGroupProps.Style", "properties": [ @@ -7933,6 +8131,46 @@ Refer to the [style](/components/button-group/?tabId=style) tab for more details ], "type": "ButtonGroupProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: divider, item, dropdown. +Refer to the [style docs](/components/button-group/?tabId=style) for more details.", + "inlineType": { + "name": "ButtonGroupProps.StyleClassNames", + "properties": [ + { + "name": "divider", + "optional": true, + "type": "string", + }, + { + "name": "dropdown", + "optional": true, + "type": "string", + }, + { + "inlineType": { + "name": "StyleSlot<{ item: ButtonGroupProps.Item; }>", + "type": "union", + "values": [ + "string", + "(args: { item: ButtonGroupProps.Item; }) => string", + ], + }, + "name": "item", + "optional": true, + "type": "StyleSlot<{ item: ButtonGroupProps.Item; }>", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "ButtonGroupProps.StyleClassNames", + }, { "description": "Determines the general styling of the button dropdown. * \`icon\` for icon buttons.", @@ -8738,8 +8976,9 @@ If both \`readOnly\` and \`disabled\` are set, \`disabled\` takes precedence.", "type": "boolean", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the checkbox's visual appearance. -Refer to the [style](/components/checkbox/?tabId=style) tab for more details.", +Refer to the [style docs](/components/checkbox/?tabId=style) for more details.", "inlineType": { "name": "CheckboxProps.Style", "properties": [ @@ -8951,6 +9190,28 @@ Refer to the [style](/components/checkbox/?tabId=style) tab for more details.", ], "type": "CheckboxProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: control. +Refer to the [style docs](/components/checkbox/?tabId=style) for more details.", + "inlineType": { + "name": "CheckboxProps.StyleClassNames", + "properties": [ + { + "name": "control", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "CheckboxProps.StyleClassNames", + }, ], "regions": [ { @@ -10756,8 +11017,9 @@ If no height is provided, the media slot will be displayed at its full height.", "type": "ContainerProps.Media", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the container's visual appearance. -Refer to the [style](/components/container/?tabId=style) tab for more details.", +Refer to the [style docs](/components/container/?tabId=style) for more details.", "inlineType": { "name": "ContainerProps.Style", "properties": [ @@ -10907,6 +11169,38 @@ Refer to the [style](/components/container/?tabId=style) tab for more details.", ], "type": "ContainerProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: root, header, footer. +Refer to the [style docs](/components/container/?tabId=style) for more details.", + "inlineType": { + "name": "ContainerProps.StyleClassNames", + "properties": [ + { + "name": "footer", + "optional": true, + "type": "string", + }, + { + "name": "header", + "optional": true, + "type": "string", + }, + { + "name": "root", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "ContainerProps.StyleClassNames", + }, { "defaultValue": "'default'", "description": "Specify a container variant with one of the following: @@ -11471,6 +11765,54 @@ Enable this setting if you need the popover to ignore its parent stacking contex "optional": true, "type": "boolean", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: copyButton, statusPopover. +Refer to the [style docs](/components/copy-to-clipboard/?tabId=style) for more details.", + "inlineType": { + "name": "CopyToClipboardProps.StyleClassNames", + "properties": [ + { + "name": "copyButton", + "optional": true, + "type": "string", + }, + { + "inlineType": { + "name": "PopoverProps.StyleClassNames", + "properties": [ + { + "name": "arrow", + "optional": true, + "type": "string", + }, + { + "name": "container", + "optional": true, + "type": "string", + }, + { + "name": "dismissButton", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "statusPopover", + "optional": true, + "type": "PopoverProps.StyleClassNames", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "CopyToClipboardProps.StyleClassNames", + }, { "description": "The text content to be copied. It is displayed next to the copy button when \`variant="inline"\` unless when \`content\` is specified, and is not shown otherwise.", "name": "textToCopy", @@ -11777,6 +12119,59 @@ Don't use read-only inputs outside a form.", "optional": true, "type": "boolean", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: input. +Refer to the [style docs](/components/date-input/?tabId=style) for more details.", + "inlineType": { + "name": "DateInputProps.StyleClassNames", + "properties": [ + { + "inlineType": { + "name": "InputProps.StyleClassNames", + "properties": [ + { + "name": "clearButton", + "optional": true, + "type": "string", + }, + { + "name": "inlineLabel", + "optional": true, + "type": "string", + }, + { + "name": "input", + "optional": true, + "type": "string", + }, + { + "name": "root", + "optional": true, + "type": "string", + }, + { + "name": "searchIcon", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "input", + "optional": true, + "type": "InputProps.StyleClassNames", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "DateInputProps.StyleClassNames", + }, { "description": "The current input value, in YYYY-MM-DD format.", "name": "value", @@ -13166,6 +13561,28 @@ Pass a \`ref\` to access the native element for measurement, observation, or thi "optional": true, "type": "string", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: root. +Refer to the [style docs](/components/divider/?tabId=style) for more details.", + "inlineType": { + "name": "DividerProps.StyleClassNames", + "properties": [ + { + "name": "root", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "DividerProps.StyleClassNames", + }, ], "regions": [ { @@ -13924,6 +14341,7 @@ dropdown will shrink to fit its content.", "type": "boolean", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the dropdown's visual appearance.", "inlineType": { "name": "DropdownProps.Style", @@ -13969,6 +14387,28 @@ dropdown will shrink to fit its content.", ], "type": "DropdownProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: root. +Refer to the [style docs](/components/dropdown/?tabId=style) for more details.", + "inlineType": { + "name": "DropdownProps.StyleClassNames", + "properties": [ + { + "name": "root", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "DropdownProps.StyleClassNames", + }, ], "regions": [ { @@ -15230,8 +15670,9 @@ If the \`action\` property is set, this property is ignored. **Deprecated**, rep "type": "boolean", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the flashbar's visual appearance. -Refer to the [style](/components/flashbar/?tabId=style) tab for more details.", +Refer to the [style docs](/components/flashbar/?tabId=style) for more details.", "inlineType": { "name": "FlashbarProps.Style", "properties": [ @@ -15776,6 +16217,51 @@ Refer to the [style](/components/flashbar/?tabId=style) tab for more details.", ], "type": "FlashbarProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: item, icon, dismissButton, notificationBar. +Refer to the [style docs](/components/flashbar/?tabId=style) for more details.", + "inlineType": { + "name": "FlashbarProps.StyleClassNames", + "properties": [ + { + "name": "dismissButton", + "optional": true, + "type": "string", + }, + { + "name": "icon", + "optional": true, + "type": "string", + }, + { + "inlineType": { + "name": "StyleSlot<{ item: FlashbarProps.MessageDefinition; }>", + "type": "union", + "values": [ + "string", + "(args: { item: FlashbarProps.MessageDefinition; }) => string", + ], + }, + "name": "item", + "optional": true, + "type": "StyleSlot<{ item: FlashbarProps.MessageDefinition; }>", + }, + { + "name": "notificationBar", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "FlashbarProps.StyleClassNames", + }, ], "regions": [], "releaseStatus": "stable", @@ -18114,8 +18600,9 @@ including the date, month, week, time, datetime-local, number and range types.", "type": "InputProps.Step", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the input's visual appearance. -Refer to the [style](/components/input/?tabId=style) tab for more details.", +Refer to the [style docs](/components/input/?tabId=style) for more details.", "inlineType": { "name": "InputProps.Style", "properties": [ @@ -18345,6 +18832,48 @@ Refer to the [style](/components/input/?tabId=style) tab for more details.", ], "type": "InputProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: root, input, inlineLabel, searchIcon, clearButton. +Refer to the [style docs](/components/input/?tabId=style) for more details.", + "inlineType": { + "name": "InputProps.StyleClassNames", + "properties": [ + { + "name": "clearButton", + "optional": true, + "type": "string", + }, + { + "name": "inlineLabel", + "optional": true, + "type": "string", + }, + { + "name": "input", + "optional": true, + "type": "string", + }, + { + "name": "root", + "optional": true, + "type": "string", + }, + { + "name": "searchIcon", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "InputProps.StyleClassNames", + }, { "defaultValue": "'text'", "description": "Specifies the type of control to render. @@ -18483,8 +19012,9 @@ Pass a \`ref\` to access the native element for measurement, observation, or thi "type": "NativeAttributes>", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the item card's visual appearance. -Refer to the [style](/components/item-card/?tabId=style) tab for more details.", +Refer to the [style docs](/components/item-card/?tabId=style) for more details.", "inlineType": { "name": "ItemCardProps.Style", "properties": [ @@ -18629,6 +19159,38 @@ Refer to the [style](/components/item-card/?tabId=style) tab for more details.", ], "type": "ItemCardProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: root, header, footer. +Refer to the [style docs](/components/item-card/?tabId=style) for more details.", + "inlineType": { + "name": "ItemCardProps.StyleClassNames", + "properties": [ + { + "name": "footer", + "optional": true, + "type": "string", + }, + { + "name": "header", + "optional": true, + "type": "string", + }, + { + "name": "root", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "ItemCardProps.StyleClassNames", + }, { "defaultValue": "'default'", "description": "Specifies the visual variant of the item card, which controls the border radius and padding. @@ -19461,8 +20023,9 @@ By default, the component sets the \`rel\` attribute to "noopener noreferrer" wh "type": "string", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the link's visual appearance. -Refer to the [style](/components/link/?tabId=style) tab for more details.", +Refer to the [style docs](/components/link/?tabId=style) for more details.", "inlineType": { "name": "LinkProps.Style", "properties": [ @@ -19539,6 +20102,28 @@ Refer to the [style](/components/link/?tabId=style) tab for more details.", ], "type": "LinkProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: root. +Refer to the [style docs](/components/link/?tabId=style) for more details.", + "inlineType": { + "name": "LinkProps.StyleClassNames", + "properties": [ + { + "name": "root", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "LinkProps.StyleClassNames", + }, { "description": "Specifies where to open the linked URL. Set this to \`_blank\` to open the URL in a new tab. If you set this property to \`_blank\`, the component @@ -21198,6 +21783,95 @@ Provide an empty array to clear the selection.", "optional": true, "type": "string", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: trigger, inlineLabel, filter, dropdown, token. +Refer to the [style docs](/components/multiselect/?tabId=style) for more details.", + "inlineType": { + "name": "MultiselectProps.StyleClassNames", + "properties": [ + { + "name": "dropdown", + "optional": true, + "type": "string", + }, + { + "inlineType": { + "name": "InputProps.StyleClassNames", + "properties": [ + { + "name": "clearButton", + "optional": true, + "type": "string", + }, + { + "name": "inlineLabel", + "optional": true, + "type": "string", + }, + { + "name": "input", + "optional": true, + "type": "string", + }, + { + "name": "root", + "optional": true, + "type": "string", + }, + { + "name": "searchIcon", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "filter", + "optional": true, + "type": "InputProps.StyleClassNames", + }, + { + "name": "inlineLabel", + "optional": true, + "type": "string", + }, + { + "inlineType": { + "name": "TokenProps.StyleClassNames", + "properties": [ + { + "name": "dismissButton", + "optional": true, + "type": "string", + }, + { + "name": "root", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "token", + "optional": true, + "type": "TokenProps.StyleClassNames", + }, + { + "name": "trigger", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "MultiselectProps.StyleClassNames", + }, { "description": "Specifies the maximum number of displayed tokens. If the property isn't set, all of the tokens are displayed.", "name": "tokenLimit", @@ -22610,6 +23284,38 @@ Note: Using popover rendered with portal within a Modal is not supported.", "optional": true, "type": "string", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: container, arrow, dismissButton. +Refer to the [style docs](/components/popover/?tabId=style) for more details.", + "inlineType": { + "name": "PopoverProps.StyleClassNames", + "properties": [ + { + "name": "arrow", + "optional": true, + "type": "string", + }, + { + "name": "container", + "optional": true, + "type": "string", + }, + { + "name": "dismissButton", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "PopoverProps.StyleClassNames", + }, { "description": "Adds \`aria-label\` to the text trigger button. Use this to provide an accessible name for triggers that don't have visible text, and to distinguish between multiple triggers with identical visible text.", @@ -22743,8 +23449,9 @@ Add a button using the \`action\` property of the flashbar item instead.", "type": "string", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the progress bar's visual appearance. -Refer to the [style](/components/progress-bar/?tabId=style) tab for more details.", +Refer to the [style docs](/components/progress-bar/?tabId=style) for more details.", "inlineType": { "name": "ProgressBarProps.Style", "properties": [ @@ -22826,6 +23533,33 @@ Refer to the [style](/components/progress-bar/?tabId=style) tab for more details ], "type": "ProgressBarProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: root, valueLabel. +Refer to the [style docs](/components/progress-bar/?tabId=style) for more details.", + "inlineType": { + "name": "ProgressBarProps.StyleClassNames", + "properties": [ + { + "name": "root", + "optional": true, + "type": "string", + }, + { + "name": "valueLabel", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "ProgressBarProps.StyleClassNames", + }, { "defaultValue": "0", "description": "Indicates the current progress as a percentage. The value must be between 0 and 100. Decimals are rounded.", @@ -24023,6 +24757,7 @@ inadvertently sending data (such as user passwords) to third parties.", "type": "boolean", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "inlineType": { "name": "PromptInputProps.Style", "properties": [ @@ -24252,6 +24987,48 @@ inadvertently sending data (such as user passwords) to third parties.", ], "type": "PromptInputProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: root, textarea, actionButton, token, menu. +Refer to the [style docs](/components/prompt-input/?tabId=style) for more details.", + "inlineType": { + "name": "PromptInputProps.StyleClassNames", + "properties": [ + { + "name": "actionButton", + "optional": true, + "type": "string", + }, + { + "name": "menu", + "optional": true, + "type": "string", + }, + { + "name": "root", + "optional": true, + "type": "string", + }, + { + "name": "textarea", + "optional": true, + "type": "string", + }, + { + "name": "token", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "PromptInputProps.StyleClassNames", + }, { "description": "Specifies the content of the prompt input when using token mode. @@ -25325,8 +26102,9 @@ This property should be set for either all or none of the radio buttons in a gro "type": "boolean", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the radio button's visual appearance. -Refer to the [style](/components/radio-button/?tabId=style) tab for more details.", +Refer to the [style docs](/components/radio-button/?tabId=style) for more details.", "inlineType": { "name": "RadioButtonProps.Style", "properties": [ @@ -25555,6 +26333,28 @@ Refer to the [style](/components/radio-button/?tabId=style) tab for more details ], "type": "RadioButtonProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: control. +Refer to the [style docs](/components/radio-button/?tabId=style) for more details.", + "inlineType": { + "name": "RadioButtonProps.StyleClassNames", + "properties": [ + { + "name": "control", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "RadioButtonProps.StyleClassNames", + }, { "description": "Sets the value attribute to the native control. If using native form submission, this value is sent to the server if the radio button is checked. @@ -25729,8 +26529,9 @@ being included in a form submission. A read-only control is still focusable.", "type": "boolean", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the radio group's visual appearance. -Refer to the [style](/components/radio-group/?tabId=style) tab for more details.", +Refer to the [style docs](/components/radio-group/?tabId=style) for more details.", "inlineType": { "name": "RadioButtonProps.Style", "properties": [ @@ -25959,6 +26760,36 @@ Refer to the [style](/components/radio-group/?tabId=style) tab for more details. ], "type": "RadioButtonProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: item. +Refer to the [style docs](/components/radio-group/?tabId=style) for more details.", + "inlineType": { + "name": "RadioGroupProps.StyleClassNames", + "properties": [ + { + "inlineType": { + "name": "StyleSlot<{ item: RadioGroupProps.RadioButtonDefinition; checked: boolean; }, RadioButtonProps.StyleClassNames>", + "type": "union", + "values": [ + "RadioButtonProps.StyleClassNames", + "(args: { item: RadioGroupProps.RadioButtonDefinition; checked: boolean; }) => RadioButtonProps.StyleClassNames", + ], + }, + "name": "item", + "optional": true, + "type": "StyleSlot<{ item: RadioGroupProps.RadioButtonDefinition; checked: boolean; }, RadioButtonProps.StyleClassNames>", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "RadioGroupProps.StyleClassNames", + }, { "description": "Sets the value of the selected radio button. If you want to clear the selection, use \`null\`.", @@ -26922,8 +27753,9 @@ Each segment has the following properties: "type": "string | null", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the segmented control's visual appearance. -Refer to the [style](/components/segmented-control/?tabId=style) tab for more details.", +Refer to the [style docs](/components/segmented-control/?tabId=style) for more details.", "inlineType": { "name": "SegmentedControlProps.Style", "properties": [ @@ -27072,6 +27904,108 @@ Refer to the [style](/components/segmented-control/?tabId=style) tab for more de ], "type": "SegmentedControlProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: root, segment, divider, select. +Refer to the [style docs](/components/segmented-control/?tabId=style) for more details.", + "inlineType": { + "name": "SegmentedControlProps.StyleClassNames", + "properties": [ + { + "name": "divider", + "optional": true, + "type": "string", + }, + { + "name": "root", + "optional": true, + "type": "string", + }, + { + "inlineType": { + "name": "StyleSlot<{ option: SegmentedControlProps.Option; selected: boolean; }>", + "type": "union", + "values": [ + "string", + "(args: { option: SegmentedControlProps.Option; selected: boolean; }) => string", + ], + }, + "name": "segment", + "optional": true, + "type": "StyleSlot<{ option: SegmentedControlProps.Option; selected: boolean; }>", + }, + { + "inlineType": { + "name": "SelectProps.StyleClassNames", + "properties": [ + { + "name": "dropdown", + "optional": true, + "type": "string", + }, + { + "inlineType": { + "name": "InputProps.StyleClassNames", + "properties": [ + { + "name": "clearButton", + "optional": true, + "type": "string", + }, + { + "name": "inlineLabel", + "optional": true, + "type": "string", + }, + { + "name": "input", + "optional": true, + "type": "string", + }, + { + "name": "root", + "optional": true, + "type": "string", + }, + { + "name": "searchIcon", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "filter", + "optional": true, + "type": "InputProps.StyleClassNames", + }, + { + "name": "inlineLabel", + "optional": true, + "type": "string", + }, + { + "name": "trigger", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "select", + "optional": true, + "type": "SelectProps.StyleClassNames", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "SegmentedControlProps.StyleClassNames", + }, ], "regions": [], "releaseStatus": "stable", @@ -28050,6 +28984,74 @@ If you want to clear the selection, use \`null\`.", "optional": true, "type": "string", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: trigger, inlineLabel, filter, dropdown. +Refer to the [style docs](/components/select/?tabId=style) for more details.", + "inlineType": { + "name": "SelectProps.StyleClassNames", + "properties": [ + { + "name": "dropdown", + "optional": true, + "type": "string", + }, + { + "inlineType": { + "name": "InputProps.StyleClassNames", + "properties": [ + { + "name": "clearButton", + "optional": true, + "type": "string", + }, + { + "name": "inlineLabel", + "optional": true, + "type": "string", + }, + { + "name": "input", + "optional": true, + "type": "string", + }, + { + "name": "root", + "optional": true, + "type": "string", + }, + { + "name": "searchIcon", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "filter", + "optional": true, + "type": "InputProps.StyleClassNames", + }, + { + "name": "inlineLabel", + "optional": true, + "type": "string", + }, + { + "name": "trigger", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "SelectProps.StyleClassNames", + }, { "defaultValue": "'label'", "description": "Defines the variant of the trigger. You can use a simple label or the entire option (\`label | option\`)", @@ -28683,8 +29685,9 @@ being included in a form submission. A read-only control is still focusable.", "type": "number", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the slider's visual appearance. -Refer to the [style](/components/slider/?tabId=style) tab for more details.", +Refer to the [style docs](/components/slider/?tabId=style) for more details.", "inlineType": { "name": "SliderProps.Style", "properties": [ @@ -28788,6 +29791,33 @@ Refer to the [style](/components/slider/?tabId=style) tab for more details.", ], "type": "SliderProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: root, handle. +Refer to the [style docs](/components/slider/?tabId=style) for more details.", + "inlineType": { + "name": "SliderProps.StyleClassNames", + "properties": [ + { + "name": "handle", + "optional": true, + "type": "string", + }, + { + "name": "root", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "SliderProps.StyleClassNames", + }, { "description": "Show the tick marks along the slider line. Use with stepped sliders, except in extreme cases.", "name": "tickMarks", @@ -30717,6 +31747,140 @@ need to position the sticky header below other fixed position elements on the pa "optional": true, "type": "boolean", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: root, headerCell, sortingButton, sortingIndicator, sortingMenu, clearSortButton, row, cell, selectionCheckbox, selectionRadio. +Refer to the [style docs](/components/table/?tabId=style) for more details.", + "inlineType": { + "name": "TableProps.StyleClassNames", + "properties": [ + { + "inlineType": { + "name": "StyleSlot<{ type: "data"; item: T; column: TableProps.ColumnDefinition; } | { type: "selection"; item: T; }>", + "type": "union", + "values": [ + "string", + "(args: { type: "data"; item: T; column: TableProps.ColumnDefinition; } | { type: "selection"; item: T; }) => string", + ], + }, + "name": "cell", + "optional": true, + "type": "StyleSlot<{ type: "data"; item: T; column: TableProps.ColumnDefinition; } | { type: "selection"; item: T; }>", + }, + { + "name": "clearSortButton", + "optional": true, + "type": "string", + }, + { + "inlineType": { + "name": "StyleSlot<{ type: "column"; column: TableProps.ColumnDefinition; sortable: boolean; sorted: boolean; sortingDescending: boolean; } | { type: "group"; group: TableProps.GroupDefinition; } | { ...; }>", + "type": "union", + "values": [ + "string", + "(args: { type: "column"; column: TableProps.ColumnDefinition; sortable: boolean; sorted: boolean; sortingDescending: boolean; } | { type: "group"; group: TableProps.GroupDefinition; } | { ...; }) => string", + ], + }, + "name": "headerCell", + "optional": true, + "type": "StyleSlot<{ type: "column"; column: TableProps.ColumnDefinition; sortable: boolean; sorted: boolean; sortingDescending: boolean; } | { type: "group"; group: TableProps.GroupDefinition; } | { ...; }>", + }, + { + "name": "root", + "optional": true, + "type": "string", + }, + { + "inlineType": { + "name": "StyleSlot<{ item: T; index: number; selected: boolean; }>", + "type": "union", + "values": [ + "string", + "(args: { item: T; index: number; selected: boolean; }) => string", + ], + }, + "name": "row", + "optional": true, + "type": "StyleSlot<{ item: T; index: number; selected: boolean; }>", + }, + { + "inlineType": { + "name": "CheckboxProps.StyleClassNames", + "properties": [ + { + "name": "control", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "selectionCheckbox", + "optional": true, + "type": "CheckboxProps.StyleClassNames", + }, + { + "inlineType": { + "name": "RadioButtonProps.StyleClassNames", + "properties": [ + { + "name": "control", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "selectionRadio", + "optional": true, + "type": "RadioButtonProps.StyleClassNames", + }, + { + "name": "sortingButton", + "optional": true, + "type": "string", + }, + { + "name": "sortingIndicator", + "optional": true, + "type": "string", + }, + { + "inlineType": { + "name": "ButtonDropdownProps.StyleClassNames", + "properties": [ + { + "name": "dropdown", + "optional": true, + "type": "string", + }, + { + "name": "mainAction", + "optional": true, + "type": "string", + }, + { + "name": "trigger", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "sortingMenu", + "optional": true, + "type": "ButtonDropdownProps.StyleClassNames", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "TableProps.StyleClassNames", + }, { "description": "Specifies a function that will be called after user submits an inline edit. Return a promise to keep loading state while the submit request is in progress.", @@ -31485,8 +32649,9 @@ need to introduce friction to the switching of tabs.", "type": "string", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the tabs' visual appearance. -Refer to the [style](/components/tabs/?tabId=style) tab for more details.", +Refer to the [style docs](/components/tabs/?tabId=style) for more details.", "inlineType": { "name": "TabsProps.Style", "properties": [ @@ -31854,6 +33019,56 @@ Refer to the [style](/components/tabs/?tabId=style) tab for more details.", ], "type": "TabsProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: tabsHeader, tab, tabLink, content, dismissButton. +Refer to the [style docs](/components/tabs/?tabId=style) for more details.", + "inlineType": { + "name": "TabsProps.StyleClassNames", + "properties": [ + { + "name": "content", + "optional": true, + "type": "string", + }, + { + "name": "dismissButton", + "optional": true, + "type": "string", + }, + { + "inlineType": { + "name": "StyleSlot<{ tab: TabsProps.Tab; }>", + "type": "union", + "values": [ + "string", + "(args: { tab: TabsProps.Tab; }) => string", + ], + }, + "name": "tab", + "optional": true, + "type": "StyleSlot<{ tab: TabsProps.Tab; }>", + }, + { + "name": "tabLink", + "optional": true, + "type": "string", + }, + { + "name": "tabsHeader", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "TabsProps.StyleClassNames", + }, { "description": "Specifies the tabs to display. Each tab object has the following properties: @@ -32516,8 +33731,9 @@ If set to \`true\`, the live announcement of countText by assistive technologies "type": "boolean", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the text filter's visual appearance. -Refer to the [style](/components/text-filter/?tabId=style) tab for more details.", +Refer to the [style docs](/components/text-filter/?tabId=style) for more details.", "inlineType": { "name": "TextFilterProps.Style", "properties": [ @@ -32747,6 +33963,64 @@ Refer to the [style](/components/text-filter/?tabId=style) tab for more details. ], "type": "TextFilterProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: input, countText. +Refer to the [style docs](/components/text-filter/?tabId=style) for more details.", + "inlineType": { + "name": "TextFilterProps.StyleClassNames", + "properties": [ + { + "name": "countText", + "optional": true, + "type": "string", + }, + { + "inlineType": { + "name": "InputProps.StyleClassNames", + "properties": [ + { + "name": "clearButton", + "optional": true, + "type": "string", + }, + { + "name": "inlineLabel", + "optional": true, + "type": "string", + }, + { + "name": "input", + "optional": true, + "type": "string", + }, + { + "name": "root", + "optional": true, + "type": "string", + }, + { + "name": "searchIcon", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "input", + "optional": true, + "type": "InputProps.StyleClassNames", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "TextFilterProps.StyleClassNames", + }, ], "regions": [], "releaseStatus": "stable", @@ -33123,8 +34397,9 @@ inadvertently sending data (such as user passwords) to third parties.", "type": "boolean", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the textarea's visual appearance. -Refer to the [style](/components/textarea/?tabId=style) tab for more details.", +Refer to the [style docs](/components/textarea/?tabId=style) for more details.", "inlineType": { "name": "TextareaProps.Style", "properties": [ @@ -33354,6 +34629,28 @@ Refer to the [style](/components/textarea/?tabId=style) tab for more details.", ], "type": "TextareaProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: textarea. +Refer to the [style docs](/components/textarea/?tabId=style) for more details.", + "inlineType": { + "name": "TextareaProps.StyleClassNames", + "properties": [ + { + "name": "textarea", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "TextareaProps.StyleClassNames", + }, { "description": "Specifies the text entered into the form element.", "name": "value", @@ -33754,6 +35051,59 @@ Don't use read-only inputs outside a form.", "optional": true, "type": "boolean", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: input. +Refer to the [style docs](/components/time-input/?tabId=style) for more details.", + "inlineType": { + "name": "TimeInputProps.StyleClassNames", + "properties": [ + { + "inlineType": { + "name": "InputProps.StyleClassNames", + "properties": [ + { + "name": "clearButton", + "optional": true, + "type": "string", + }, + { + "name": "inlineLabel", + "optional": true, + "type": "string", + }, + { + "name": "input", + "optional": true, + "type": "string", + }, + { + "name": "root", + "optional": true, + "type": "string", + }, + { + "name": "searchIcon", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "input", + "optional": true, + "type": "InputProps.StyleClassNames", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "TimeInputProps.StyleClassNames", + }, { "defaultValue": "true", "description": "Specifies whether the component should use 12-hour or 24-hour format. @@ -33948,8 +35298,9 @@ If both \`readOnly\` and \`disabled\` are set, \`disabled\` takes precedence.", "type": "boolean", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the toggle's visual appearance. -Refer to the [style](/components/toggle/?tabId=style) tab for more details.", +Refer to the [style docs](/components/toggle/?tabId=style) for more details.", "inlineType": { "name": "ToggleProps.Style", "properties": [ @@ -34115,6 +35466,28 @@ Refer to the [style](/components/toggle/?tabId=style) tab for more details.", ], "type": "ToggleProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: control. +Refer to the [style docs](/components/toggle/?tabId=style) for more details.", + "inlineType": { + "name": "ToggleProps.StyleClassNames", + "properties": [ + { + "name": "control", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "ToggleProps.StyleClassNames", + }, ], "regions": [ { @@ -34388,242 +35761,264 @@ If an href is provided, it opens the link in a new tab.", "zoom-to-fit", ], }, - "name": "iconName", + "name": "iconName", + "optional": true, + "type": "string", + }, + { + "description": "Specifies the URL of a custom icon. Use this property if the icon you want isn't available. + +If you set both \`iconUrl\` and \`iconSvg\`, \`iconSvg\` will take precedence.", + "name": "iconUrl", + "optional": true, + "type": "string", + }, + { + "deprecatedTag": "The usage of the \`id\` attribute is reserved for internal use cases. For testing and other use cases, +use [data attributes](https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes). If you must +use the \`id\` attribute, consider setting it on a parent element instead.", + "description": "Adds the specified ID to the root element of the component.", + "name": "id", + "optional": true, + "type": "string", + }, + { + "defaultValue": "false", + "description": "Renders the button as being in a loading state. It takes precedence over the \`disabled\` if both are set to \`true\`. +It prevents users from clicking the button, but it can still be focused.", + "name": "loading", + "optional": true, + "type": "boolean", + }, + { + "description": "Specifies the text that screen reader announces when the button is in a loading state.", + "name": "loadingText", + "optional": true, + "type": "string", + }, + { + "description": "Attributes to add to the native \`button\` element. +Some attributes will be automatically combined with internal attribute values: +- \`className\` will be appended. +- Event handlers will be chained, unless the default is prevented. + +We do not support using this attribute to apply custom styling. + +Pass a \`ref\` to access the native element for measurement, observation, or third-party integration. +For actions such as focus or selection, use the component's explicit ref methods; +operations performed directly on the native element may bypass the built-in component's behaviors.", + "inlineType": { + "name": "NativeAttributes>", + "type": "union", + "values": [ + "Omit, "children">", + "Record<\`data-\${string}\`, string>", + "{ readonly ref?: React.Ref | undefined; }", + ], + }, + "name": "nativeButtonAttributes", + "optional": true, + "systemTags": [ + "core", + ], + "type": "NativeAttributes>", + }, + { + "defaultValue": "false", + "description": "Sets the toggle button to pressed state.", + "name": "pressed", + "optional": false, + "type": "boolean", + }, + { + "description": "Displays an icon next to the text in pressed state.", + "inlineType": { + "name": "IconProps.Name", + "type": "union", + "values": [ + "search", + "map", + "filter", + "key", + "file", + "pause", + "play", + "microphone", + "remove", + "copy", + "menu", + "script", + "close", + "status-pending", + "refresh", + "external", + "history", + "group", + "calendar", + "ellipsis", + "zoom-in", + "zoom-out", + "dot", + "security", + "download", + "edit", + "add-plus", + "anchor-link", + "angle-left-double", + "angle-left", + "angle-right-double", + "angle-right", + "angle-up", + "angle-down", + "announcement", + "arrow-left", + "arrow-right", + "arrow-up", + "arrow-down", + "at-symbol", + "audio-full", + "audio-half", + "audio-off", + "backward-10-seconds", + "bar-chart", + "bug", + "call", + "caret-down-filled", + "caret-down", + "caret-left-filled", + "caret-right-filled", + "caret-up-filled", + "caret-up", + "check", + "contact", + "closed-caption", + "closed-caption-unavailable", + "command-prompt", + "convert-code", + "delete-marker", + "drag-indicator", + "edit-gen-ai", + "envelope", + "exit-full-screen", + "expand", + "eye", + "face-happy", + "face-happy-filled", + "face-neutral", + "face-neutral-filled", + "face-sad", + "face-sad-filled", + "file-open", + "flag", + "folder-open", + "folder", + "forward-10-seconds", + "full-screen", + "gen-ai", + "gen-ai-token", + "globe", + "grid-view", + "group-active", + "heart", + "heart-filled", + "insert-row", + "internal-link", + "keyboard", + "light-dark", + "list-view", + "location-pin", + "lock-private", + "microphone-off", + "mini-player", + "multiscreen", + "notification", + "redo", + "resize-area", + "search-gen-ai", + "settings", + "send", + "share", + "shrink", + "sign-out", + "side-bar", + "slash", + "slash-divider", + "sliders", + "star-filled", + "star-half", + "star", + "status-in-progress", + "status-info", + "status-negative", + "status-not-started", + "status-positive", + "status-stopped", + "status-warning", + "stop-circle", + "subtract-minus", + "suggestions", + "suggestions-gen-ai", + "support", + "thumbs-down-filled", + "thumbs-down", + "thumbs-up-filled", + "thumbs-up", + "ticket", + "transcript", + "treeview-collapse", + "treeview-expand", + "undo", + "unlocked", + "upload-download", + "upload", + "user-profile-active", + "user-profile", + "video-off", + "video-on", + "video-unavailable", + "video-camera-off", + "video-camera-on", + "video-camera-unavailable", + "view-full", + "view-horizontal", + "view-vertical", + "view-vertical-start", + "zoom-to-fit", + ], + }, + "name": "pressedIconName", "optional": true, "type": "string", }, { - "description": "Specifies the URL of a custom icon. Use this property if the icon you want isn't available. + "description": "Specifies the URL of a custom icon in pressed state. Use this property if the icon needed for your use case isn't available. -If you set both \`iconUrl\` and \`iconSvg\`, \`iconSvg\` will take precedence.", - "name": "iconUrl", - "optional": true, - "type": "string", - }, - { - "deprecatedTag": "The usage of the \`id\` attribute is reserved for internal use cases. For testing and other use cases, -use [data attributes](https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes). If you must -use the \`id\` attribute, consider setting it on a parent element instead.", - "description": "Adds the specified ID to the root element of the component.", - "name": "id", - "optional": true, - "type": "string", - }, - { - "defaultValue": "false", - "description": "Renders the button as being in a loading state. It takes precedence over the \`disabled\` if both are set to \`true\`. -It prevents users from clicking the button, but it can still be focused.", - "name": "loading", - "optional": true, - "type": "boolean", - }, - { - "description": "Specifies the text that screen reader announces when the button is in a loading state.", - "name": "loadingText", +\`pressedIconSvg\` will take precedence if you set both \`pressedIconUrl\` and \`pressedIconSvg\`.", + "name": "pressedIconUrl", "optional": true, "type": "string", }, { - "description": "Attributes to add to the native \`button\` element. -Some attributes will be automatically combined with internal attribute values: -- \`className\` will be appended. -- Event handlers will be chained, unless the default is prevented. - -We do not support using this attribute to apply custom styling. - -Pass a \`ref\` to access the native element for measurement, observation, or third-party integration. -For actions such as focus or selection, use the component's explicit ref methods; -operations performed directly on the native element may bypass the built-in component's behaviors.", + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: root. +Refer to the [style docs](/components/toggle-button/?tabId=style) for more details.", "inlineType": { - "name": "NativeAttributes>", - "type": "union", - "values": [ - "Omit, "children">", - "Record<\`data-\${string}\`, string>", - "{ readonly ref?: React.Ref | undefined; }", + "name": "ToggleButtonProps.StyleClassNames", + "properties": [ + { + "name": "root", + "optional": true, + "type": "string", + }, ], + "type": "object", }, - "name": "nativeButtonAttributes", + "name": "styleClassNames", "optional": true, "systemTags": [ "core", ], - "type": "NativeAttributes>", - }, - { - "defaultValue": "false", - "description": "Sets the toggle button to pressed state.", - "name": "pressed", - "optional": false, - "type": "boolean", - }, - { - "description": "Displays an icon next to the text in pressed state.", - "inlineType": { - "name": "IconProps.Name", - "type": "union", - "values": [ - "search", - "map", - "filter", - "key", - "file", - "pause", - "play", - "microphone", - "remove", - "copy", - "menu", - "script", - "close", - "status-pending", - "refresh", - "external", - "history", - "group", - "calendar", - "ellipsis", - "zoom-in", - "zoom-out", - "dot", - "security", - "download", - "edit", - "add-plus", - "anchor-link", - "angle-left-double", - "angle-left", - "angle-right-double", - "angle-right", - "angle-up", - "angle-down", - "announcement", - "arrow-left", - "arrow-right", - "arrow-up", - "arrow-down", - "at-symbol", - "audio-full", - "audio-half", - "audio-off", - "backward-10-seconds", - "bar-chart", - "bug", - "call", - "caret-down-filled", - "caret-down", - "caret-left-filled", - "caret-right-filled", - "caret-up-filled", - "caret-up", - "check", - "contact", - "closed-caption", - "closed-caption-unavailable", - "command-prompt", - "convert-code", - "delete-marker", - "drag-indicator", - "edit-gen-ai", - "envelope", - "exit-full-screen", - "expand", - "eye", - "face-happy", - "face-happy-filled", - "face-neutral", - "face-neutral-filled", - "face-sad", - "face-sad-filled", - "file-open", - "flag", - "folder-open", - "folder", - "forward-10-seconds", - "full-screen", - "gen-ai", - "gen-ai-token", - "globe", - "grid-view", - "group-active", - "heart", - "heart-filled", - "insert-row", - "internal-link", - "keyboard", - "light-dark", - "list-view", - "location-pin", - "lock-private", - "microphone-off", - "mini-player", - "multiscreen", - "notification", - "redo", - "resize-area", - "search-gen-ai", - "settings", - "send", - "share", - "shrink", - "sign-out", - "side-bar", - "slash", - "slash-divider", - "sliders", - "star-filled", - "star-half", - "star", - "status-in-progress", - "status-info", - "status-negative", - "status-not-started", - "status-positive", - "status-stopped", - "status-warning", - "stop-circle", - "subtract-minus", - "suggestions", - "suggestions-gen-ai", - "support", - "thumbs-down-filled", - "thumbs-down", - "thumbs-up-filled", - "thumbs-up", - "ticket", - "transcript", - "treeview-collapse", - "treeview-expand", - "undo", - "unlocked", - "upload-download", - "upload", - "user-profile-active", - "user-profile", - "video-off", - "video-on", - "video-unavailable", - "video-camera-off", - "video-camera-on", - "video-camera-unavailable", - "view-full", - "view-horizontal", - "view-vertical", - "view-vertical-start", - "zoom-to-fit", - ], - }, - "name": "pressedIconName", - "optional": true, - "type": "string", - }, - { - "description": "Specifies the URL of a custom icon in pressed state. Use this property if the icon needed for your use case isn't available. - -\`pressedIconSvg\` will take precedence if you set both \`pressedIconUrl\` and \`pressedIconSvg\`.", - "name": "pressedIconUrl", - "optional": true, - "type": "string", + "type": "ToggleButtonProps.StyleClassNames", }, { "defaultValue": "'normal'", @@ -34792,8 +36187,9 @@ token is truncated, so include the label tag text in it.", "type": "boolean", }, { + "deprecatedTag": "Replaced by \`styleClassNames\`.", "description": "An object containing CSS properties to customize the token's visual appearance. -Refer to the [style](/components/token/?tabId=style) tab for more details.", +Refer to the [style docs](/components/token/?tabId=style) for more details.", "inlineType": { "name": "TokenProps.Style", "properties": [ @@ -34958,6 +36354,33 @@ Refer to the [style](/components/token/?tabId=style) tab for more details.", ], "type": "TokenProps.Style", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: root, dismissButton. +Refer to the [style docs](/components/token/?tabId=style) for more details.", + "inlineType": { + "name": "TokenProps.StyleClassNames", + "properties": [ + { + "name": "dismissButton", + "optional": true, + "type": "string", + }, + { + "name": "root", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "TokenProps.StyleClassNames", + }, { "description": "A list of tags giving further guidance about the token.", "name": "tags", @@ -35195,6 +36618,33 @@ Can return null if the element is not yet mounted or available.", "optional": true, "type": "string", }, + { + "description": "CSS class names for the slots of the component that can be styled with the Style API. +Available slots: container, arrow. +Refer to the [style docs](/components/tooltip/?tabId=style) for more details.", + "inlineType": { + "name": "TooltipProps.StyleClassNames", + "properties": [ + { + "name": "arrow", + "optional": true, + "type": "string", + }, + { + "name": "container", + "optional": true, + "type": "string", + }, + ], + "type": "object", + }, + "name": "styleClassNames", + "optional": true, + "systemTags": [ + "core", + ], + "type": "TooltipProps.StyleClassNames", + }, ], "regions": [ { diff --git a/src/__tests__/snapshot-tests/__snapshots__/style-docs.test.ts.snap b/src/__tests__/snapshot-tests/__snapshots__/style-docs.test.ts.snap index 8bad971a036..7bc263cc8cf 100644 --- a/src/__tests__/snapshot-tests/__snapshots__/style-docs.test.ts.snap +++ b/src/__tests__/snapshot-tests/__snapshots__/style-docs.test.ts.snap @@ -4,7 +4,7 @@ exports[`Style API docs definition for action-card matches the snapshot: action- { "slots": [ { - "description": "Not a button element: use \`:has(:hover)\` and \`:has(:active)\` for interaction states.", + "description": "Not a semantic button element: use \`:has(:hover)\` and \`:has(:active)\` for interaction states.", "name": "root", "properties": [ "background", diff --git a/src/action-card/interfaces.ts b/src/action-card/interfaces.ts index f68dd7d7155..b91ded67c2e 100644 --- a/src/action-card/interfaces.ts +++ b/src/action-card/interfaces.ts @@ -142,9 +142,22 @@ export interface ActionCardProps extends BaseComponentProps { * @awsuiSystem core */ nativeAnchorAttributes?: NativeAttributes>; + + /** + * CSS class names for the slots of the component that can be styled with the Style API. + * Available slots: root, header. + * Refer to the [style docs](/components/action-card/?tabId=style) for more details. + * @awsuiSystem core + */ + styleClassNames?: ActionCardProps.StyleClassNames; } export namespace ActionCardProps { + export interface StyleClassNames { + root?: string; + header?: string; + } + // eslint-disable-next-line @typescript-eslint/no-empty-object-type export interface ClickDetail {} diff --git a/src/action-card/internal.tsx b/src/action-card/internal.tsx index 5fd5b72c355..a3d811e8eb4 100644 --- a/src/action-card/internal.tsx +++ b/src/action-card/internal.tsx @@ -17,16 +17,7 @@ import { ActionCardProps } from './interfaces'; import styles from './styles.css.js'; import testStyles from './test-classes/styles.css.js'; -export type InternalActionCardProps = ActionCardProps & - InternalBaseComponentProps & { - styleClassNames?: StyleClassNames; - }; - -// Style API v2 -export interface StyleClassNames { - root?: string; - header?: string; -} +export type InternalActionCardProps = ActionCardProps & InternalBaseComponentProps; const InternalActionCard = React.forwardRef( ( diff --git a/src/action-card/styles.scss b/src/action-card/styles.scss index a96a294d9e3..be1ac0a6e52 100644 --- a/src/action-card/styles.scss +++ b/src/action-card/styles.scss @@ -21,7 +21,7 @@ $tokens: mixins.$tokens; $tokens, $properties: (background), $descriptions: ( - slot: 'Not a button element: use `:has(:hover)` and `:has(:active)` for interaction states.', + slot: 'Not a semantic button element: use `:has(:hover)` and `:has(:active)` for interaction states.', tokens: ( border-width: 'Drawn over the card edges; takes no space.', ) diff --git a/src/alert/interfaces.ts b/src/alert/interfaces.ts index 9a7074d09da..e7150622e36 100644 --- a/src/alert/interfaces.ts +++ b/src/alert/interfaces.ts @@ -7,6 +7,12 @@ import { BaseComponentProps } from '../types/base-component'; import { NonCancelableEventHandler } from '../types/events'; export namespace AlertProps { + export interface StyleClassNames { + root?: string; + icon?: string; + dismissButton?: string; + } + export type Type = 'success' | 'error' | 'warning' | 'info'; export interface Ref { @@ -158,7 +164,8 @@ export interface AlertProps extends BaseComponentProps { analyticsMetadata?: AlertProps.AnalyticsMetadata; /** * An object containing CSS properties to customize the alert's visual appearance. - * Refer to the [style](/components/alert/?tabId=style) tab for more details. + * Refer to the [style docs](/components/alert/?tabId=style) for more details. + * @deprecated Replaced by `styleClassNames`. * @awsuiSystem core */ style?: AlertProps.Style; @@ -170,4 +177,12 @@ export interface AlertProps extends BaseComponentProps { * @awsuiSystem console */ persistenceConfig?: AlertProps.PersistenceConfig; + + /** + * CSS class names for the slots of the component that can be styled with the Style API. + * Available slots: root, icon, dismissButton. + * Refer to the [style docs](/components/alert/?tabId=style) for more details. + * @awsuiSystem core + */ + styleClassNames?: AlertProps.StyleClassNames; } diff --git a/src/alert/internal.tsx b/src/alert/internal.tsx index 33ad3250569..c987552f3be 100644 --- a/src/alert/internal.tsx +++ b/src/alert/internal.tsx @@ -41,16 +41,8 @@ type InternalAlertProps = SomeRequired & InternalBaseComponentProps & { messageSlotId?: string; style?: AlertProps['style']; - styleClassNames?: StyleClassNames; }; -// Style API v2 -interface StyleClassNames { - root?: string; - icon?: string; - dismissButton?: string; -} - const useDiscoveredAction = createUseDiscoveredAction(awsuiPluginsInternal.alert.onActionRegistered); const useDiscoveredContent = createUseDiscoveredContent('alert', awsuiPluginsInternal.alertContent); diff --git a/src/autosuggest/__tests__/style-api.test.tsx b/src/autosuggest/__tests__/style-api.test.tsx index 7ada59c3267..bf4fc282220 100644 --- a/src/autosuggest/__tests__/style-api.test.tsx +++ b/src/autosuggest/__tests__/style-api.test.tsx @@ -28,16 +28,14 @@ function renderAutosuggest(props: Partial & { styleClassNames? } describe('Autosuggest Style API v2', () => { - test('forwards the input classes to the Input slots and ignores unknown keys', () => { + test('forwards the input classes to the Input slots', () => { const { container, wrapper } = renderAutosuggest({ - styleClassNames: { input: { root: 'a', input: 'b', searchIcon: 'c', unknown: 'd' }, unknown: 'e' }, + styleClassNames: { input: { root: 'a', input: 'b', searchIcon: 'c' } }, }); const nativeInput = wrapper.findNativeInput().getElement(); expect(nativeInput.parentElement).toHaveClass('a'); expect(nativeInput).toHaveClass('b'); expect(container.querySelector('.c')).toBe(nativeInput.parentElement!.previousElementSibling); - expect(container.querySelector('.d')).toBeNull(); - expect(container.querySelector('.e')).toBeNull(); }); test('forwards the clear button class to the clear button', () => { diff --git a/src/autosuggest/index.tsx b/src/autosuggest/index.tsx index 160561c5b2d..7dbd3fb9be3 100644 --- a/src/autosuggest/index.tsx +++ b/src/autosuggest/index.tsx @@ -10,7 +10,7 @@ import { applyDisplayName } from '../internal/utils/apply-display-name'; import { getExternalProps } from '../internal/utils/external-props'; import { GeneratedAnalyticsMetadataAutosuggestComponent } from './analytics-metadata/interfaces'; import { AutosuggestProps } from './interfaces'; -import InternalAutosuggest, { StyleClassNames } from './internal'; +import InternalAutosuggest from './internal'; export { AutosuggestProps }; @@ -60,7 +60,7 @@ const Autosuggest = React.forwardRef( hideEnteredTextOption={hideEnteredTextOption} {...externalProps} {...baseComponentProps} - styleClassNames={(props as { styleClassNames?: StyleClassNames }).styleClassNames} + styleClassNames={props.styleClassNames} ref={ref} {...getAnalyticsMetadataAttribute({ component: componentAnalyticsMetadata })} /> diff --git a/src/autosuggest/interfaces.ts b/src/autosuggest/interfaces.ts index 5b9d9206cb8..91d65c28da6 100644 --- a/src/autosuggest/interfaces.ts +++ b/src/autosuggest/interfaces.ts @@ -162,7 +162,8 @@ export interface AutosuggestProps /** * An object containing CSS properties to customize the autosuggest's visual appearance. - * Refer to the [style](/components/autosuggest/?tabId=style) tab for more details. + * Refer to the [style docs](/components/autosuggest/?tabId=style) for more details. + * @deprecated Replaced by `styleClassNames`. * @awsuiSystem core */ style?: AutosuggestProps.Style; @@ -197,9 +198,22 @@ export interface AutosuggestProps * @i18n */ i18nStrings?: AutosuggestProps.I18nStrings; + + /** + * CSS class names for the slots of the component that can be styled with the Style API. + * Available slots: input, dropdown. + * Refer to the [style docs](/components/autosuggest/?tabId=style) for more details. + * @awsuiSystem core + */ + styleClassNames?: AutosuggestProps.StyleClassNames; } export namespace AutosuggestProps { + export interface StyleClassNames { + input?: InputProps.StyleClassNames; + dropdown?: string; + } + export interface ChangeDetail { value: string; /** diff --git a/src/autosuggest/internal.tsx b/src/autosuggest/internal.tsx index b36933a7a58..64f78fc29e8 100644 --- a/src/autosuggest/internal.tsx +++ b/src/autosuggest/internal.tsx @@ -10,7 +10,6 @@ import { useFormFieldContext } from '../contexts/form-field'; import { OptionsLoadItemsDetail } from '../dropdown/interfaces'; import { useInternalI18n } from '../i18n/context'; import { BaseChangeDetail } from '../input/interfaces'; -import { StyleClassNames as InputStyleClassNames } from '../input/internal'; import AutosuggestInput, { AutosuggestInputRef } from '../internal/components/autosuggest-input'; import DropdownFooter from '../internal/components/dropdown-footer'; import { useDropdownStatus } from '../internal/components/dropdown-status'; @@ -29,15 +28,7 @@ import AutosuggestOptionsList from './options-list'; import styles from './styles.css.js'; -interface InternalAutosuggestProps extends AutosuggestProps, InternalBaseComponentProps { - styleClassNames?: StyleClassNames; -} - -// Style API v2 -export interface StyleClassNames { - input?: InputStyleClassNames; - dropdown?: string; -} +interface InternalAutosuggestProps extends AutosuggestProps, InternalBaseComponentProps {} const InternalAutosuggest = React.forwardRef((props: InternalAutosuggestProps, ref: Ref) => { const { diff --git a/src/badge/index.tsx b/src/badge/index.tsx index ca0dcf8584c..7ba58c41d4b 100644 --- a/src/badge/index.tsx +++ b/src/badge/index.tsx @@ -15,15 +15,10 @@ import styles from './styles.css.js'; export { BadgeProps }; -// Style API v2 -interface StyleClassNames { - root?: string; -} - export default function Badge({ color = 'grey', children, style, nativeAttributes, ...rest }: BadgeProps) { const { __internalRootRef } = useBaseComponent('Badge', { props: { color } }); const baseProps = getBaseProps(rest); - const { styleClassNames } = rest as { styleClassNames?: StyleClassNames }; + const { styleClassNames } = rest; const className = clsx(baseProps.className, styleClassNames?.root, styles.badge, styles[`badge-color-${color}`]); diff --git a/src/badge/interfaces.ts b/src/badge/interfaces.ts index 2374d364b49..a0678755719 100644 --- a/src/badge/interfaces.ts +++ b/src/badge/interfaces.ts @@ -30,7 +30,8 @@ export interface BadgeProps extends BaseComponentProps { /** * An object containing CSS properties to customize the badge's visual appearance. - * Refer to the [style](/components/badge/?tabId=style) tab for more details. + * Refer to the [style docs](/components/badge/?tabId=style) for more details. + * @deprecated Replaced by `styleClassNames`. * @awsuiSystem core */ style?: BadgeProps.Style; @@ -48,9 +49,21 @@ export interface BadgeProps extends BaseComponentProps { * @awsuiSystem core */ nativeAttributes?: NativeAttributes>; + + /** + * CSS class names for the slots of the component that can be styled with the Style API. + * Available slots: root. + * Refer to the [style docs](/components/badge/?tabId=style) for more details. + * @awsuiSystem core + */ + styleClassNames?: BadgeProps.StyleClassNames; } export namespace BadgeProps { + export interface StyleClassNames { + root?: string; + } + export interface Style { root?: { background?: string; diff --git a/src/button-dropdown/index.tsx b/src/button-dropdown/index.tsx index 5ea4c90b5d4..8702052c136 100644 --- a/src/button-dropdown/index.tsx +++ b/src/button-dropdown/index.tsx @@ -12,7 +12,6 @@ import { applyDisplayName } from '../internal/utils/apply-display-name'; import { GeneratedAnalyticsMetadataButtonDropdownComponent } from './analytics-metadata/interfaces'; import { ButtonDropdownProps } from './interfaces'; import InternalButtonDropdown from './internal'; -import { StyleClassNames } from './internal-interfaces'; import { hasCheckboxItems, hasDisabledReasonItems } from './utils/utils'; import analyticsSelectors from './analytics-metadata/styles.css.js'; @@ -81,7 +80,7 @@ const ButtonDropdown = React.forwardRef( >; anchor?: NativeAttributes>; }; + + /** + * CSS class names for the slots of the component that can be styled with the Style API. + * Available slots: trigger, mainAction, dropdown. + * Refer to the [style docs](/components/button-dropdown/?tabId=style) for more details. + * @awsuiSystem core + */ + styleClassNames?: ButtonDropdownProps.StyleClassNames; } export namespace ButtonDropdownProps { + export interface StyleClassNames { + trigger?: string; + mainAction?: string; + dropdown?: string; + } + export type Variant = 'normal' | 'primary' | 'icon' | 'inline-icon'; export type ItemType = 'action' | 'group'; export type FilteringType = 'none' | 'auto' | 'manual'; diff --git a/src/button-dropdown/internal-interfaces.ts b/src/button-dropdown/internal-interfaces.ts index f48fae06037..b1a7b13b287 100644 --- a/src/button-dropdown/internal-interfaces.ts +++ b/src/button-dropdown/internal-interfaces.ts @@ -108,17 +108,10 @@ type InternalItems = ReadonlyArray; export type InternalItemOrGroup = InternalItem | InternalCheckboxItem | InternalItemGroup; -// Style API v2 -export interface StyleClassNames { - trigger?: string; - mainAction?: string; - dropdown?: string; -} - export interface InternalButtonDropdownProps extends Omit, InternalBaseComponentProps { - styleClassNames?: StyleClassNames; + styleClassNames?: ButtonDropdownProps.StyleClassNames; customTriggerBuilder?: (props: CustomTriggerProps) => React.ReactNode; variant?: ButtonDropdownProps['variant'] | 'navigation'; items: ReadonlyArray; diff --git a/src/button-group/index.tsx b/src/button-group/index.tsx index ac9c0b408ec..98d25dd9ea2 100644 --- a/src/button-group/index.tsx +++ b/src/button-group/index.tsx @@ -12,7 +12,6 @@ import { getExternalProps } from '../internal/utils/external-props'; import { GeneratedAnalyticsMetadataButtonGroupComponent } from './analytics-metadata/interfaces'; import { ButtonGroupProps } from './interfaces'; import InternalButtonGroup from './internal'; -import { StyleClassNames } from './internal-interfaces'; export { ButtonGroupProps }; @@ -48,7 +47,7 @@ const ButtonGroup = React.forwardRef( return ( ; /** * An object containing CSS properties to customize the button group's visual appearance. - * Refer to the [style](/components/button-group/?tabId=style) tab for more details. + * Refer to the [style docs](/components/button-group/?tabId=style) for more details. + * @deprecated Replaced by `styleClassNames`. * @awsuiSystem core */ style?: ButtonGroupProps.Style; + + /** + * CSS class names for the slots of the component that can be styled with the Style API. + * Available slots: divider, item, dropdown. + * Refer to the [style docs](/components/button-group/?tabId=style) for more details. + * @awsuiSystem core + */ + styleClassNames?: ButtonGroupProps.StyleClassNames; } // The runtime plugin API cannot carry React nodes, so node-typed properties are omitted or narrowed @@ -166,6 +176,12 @@ export type ItemRuntime = | IconCopyToClipboardRuntime; export namespace ButtonGroupProps { + export interface StyleClassNames { + divider?: string; + item?: StyleSlot<{ item: ButtonGroupProps.Item }>; + dropdown?: string; + } + export type Variant = 'icon'; export type ItemOrGroup = Item | Group; diff --git a/src/button-group/internal-interfaces.ts b/src/button-group/internal-interfaces.ts index afa6f8dfe22..26de26589e0 100644 --- a/src/button-group/internal-interfaces.ts +++ b/src/button-group/internal-interfaces.ts @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import { InternalBaseComponentProps } from '../internal/hooks/use-base-component'; import { SomeRequired } from '../internal/types'; -import { Slot } from '../internal/utils/style-slot'; import { ButtonGroupProps } from './interfaces'; export interface InternalIconButton extends ButtonGroupProps.IconButton { @@ -20,17 +19,10 @@ export type InternalItem = | ButtonGroupProps.MenuDropdown | ButtonGroupProps.IconCopyToClipboard; -// Style API v2 -export interface StyleClassNames { - divider?: string; - item?: Slot<{ item: ButtonGroupProps.Item }>; - dropdown?: string; -} - export interface InternalButtonGroupProps extends SomeRequired, InternalBaseComponentProps { - styleClassNames?: StyleClassNames; + styleClassNames?: ButtonGroupProps.StyleClassNames; style?: ButtonGroupProps.Style; items: ReadonlyArray; } diff --git a/src/button-group/item-element.tsx b/src/button-group/item-element.tsx index 207585a8acc..00865dc7c5e 100644 --- a/src/button-group/item-element.tsx +++ b/src/button-group/item-element.tsx @@ -16,7 +16,6 @@ import FileInputItem from './file-input-item'; import IconButtonItem from './icon-button-item'; import IconToggleButtonItem from './icon-toggle-button-item.js'; import { ButtonGroupProps } from './interfaces'; -import { StyleClassNames } from './internal-interfaces'; import MenuDropdownItem from './menu-dropdown-item'; import { getButtonGroupItemStyles } from './style'; @@ -33,7 +32,7 @@ interface ItemElementProps { onCopyFailure?: NonCancelableEventHandler | undefined; position: string; style?: ButtonGroupProps.Style; - styleClassNames?: StyleClassNames; + styleClassNames?: ButtonGroupProps.StyleClassNames; } const ItemElement = forwardRef( diff --git a/src/button/index.tsx b/src/button/index.tsx index e0ae555256c..04088e6eedb 100644 --- a/src/button/index.tsx +++ b/src/button/index.tsx @@ -7,7 +7,7 @@ import { getBaseProps } from '../internal/base-component'; import useBaseComponent from '../internal/hooks/use-base-component'; import { applyDisplayName } from '../internal/utils/apply-display-name'; import { ButtonProps } from './interfaces'; -import { InternalButton, StyleClassNames } from './internal'; +import { InternalButton } from './internal'; export { ButtonProps }; @@ -87,7 +87,7 @@ const Button = React.forwardRef( form={form} i18nStrings={i18nStrings} style={style} - styleClassNames={(props as { styleClassNames?: StyleClassNames }).styleClassNames} + styleClassNames={props.styleClassNames} nativeButtonAttributes={nativeButtonAttributes} nativeAnchorAttributes={nativeAnchorAttributes} __injectAnalyticsComponentMetadata={true} diff --git a/src/button/interfaces.ts b/src/button/interfaces.ts index ced1c609a36..e8936bda90b 100644 --- a/src/button/interfaces.ts +++ b/src/button/interfaces.ts @@ -224,13 +224,26 @@ export interface ButtonProps extends BaseComponentProps, BaseButtonProps { /** * An object containing CSS properties to customize the button's visual appearance. - * Refer to the [style](/components/button/?tabId=style) tab for more details. + * Refer to the [style docs](/components/button/?tabId=style) for more details. + * @deprecated Replaced by `styleClassNames`. * @awsuiSystem core */ style?: ButtonProps.Style; + + /** + * CSS class names for the slots of the component that can be styled with the Style API. + * Available slots: root. + * Refer to the [style docs](/components/button/?tabId=style) for more details. + * @awsuiSystem core + */ + styleClassNames?: ButtonProps.StyleClassNames; } export namespace ButtonProps { + export interface StyleClassNames { + root?: string; + } + export type Variant = 'normal' | 'primary' | 'link' | 'icon' | 'inline-icon' | 'inline-link'; export type ClickDetail = _ClickDetail; export type FollowDetail = BaseNavigationDetail; diff --git a/src/button/internal.tsx b/src/button/internal.tsx index 9fd71577a90..12f4a3ce9b8 100644 --- a/src/button/internal.tsx +++ b/src/button/internal.tsx @@ -60,14 +60,8 @@ export type InternalButtonProps = Omit & { __emitPerformanceMarks?: boolean; __skipNativeAttributesWarnings?: boolean; __compact?: boolean; - styleClassNames?: StyleClassNames; } & InternalBaseComponentProps; -// Style API v2 -export interface StyleClassNames { - root?: string; -} - export const InternalButton = React.forwardRef( ( { diff --git a/src/checkbox/interfaces.ts b/src/checkbox/interfaces.ts index d7da5270516..39b34464b0f 100644 --- a/src/checkbox/interfaces.ts +++ b/src/checkbox/interfaces.ts @@ -35,7 +35,8 @@ export interface CheckboxProps extends BaseCheckboxProps { /** * An object containing CSS properties to customize the checkbox's visual appearance. - * Refer to the [style](/components/checkbox/?tabId=style) tab for more details. + * Refer to the [style docs](/components/checkbox/?tabId=style) for more details. + * @deprecated Replaced by `styleClassNames`. * @awsuiSystem core */ style?: CheckboxProps.Style; @@ -55,9 +56,21 @@ export interface CheckboxProps extends BaseCheckboxProps { * @awsuiSystem core */ nativeInputAttributes?: NativeAttributes>; + + /** + * CSS class names for the slots of the component that can be styled with the Style API. + * Available slots: control. + * Refer to the [style docs](/components/checkbox/?tabId=style) for more details. + * @awsuiSystem core + */ + styleClassNames?: CheckboxProps.StyleClassNames; } export namespace CheckboxProps { + export interface StyleClassNames { + control?: string; + } + export interface Ref { /** * Sets input focus onto the UI control. diff --git a/src/checkbox/internal.tsx b/src/checkbox/internal.tsx index d6b99114258..dc9faa8c32c 100644 --- a/src/checkbox/internal.tsx +++ b/src/checkbox/internal.tsx @@ -26,15 +26,9 @@ import styles from './styles.css.js'; interface InternalProps extends CheckboxProps, InternalBaseComponentProps { tabIndex?: -1; showOutline?: boolean; - styleClassNames?: StyleClassNames; __injectAnalyticsComponentMetadata?: boolean; } -// Style API v2 -export interface StyleClassNames { - control?: string; -} - const InternalCheckbox = React.forwardRef( ( { diff --git a/src/container/interfaces.ts b/src/container/interfaces.ts index 887f289f1d3..fedfdeb87d3 100644 --- a/src/container/interfaces.ts +++ b/src/container/interfaces.ts @@ -83,13 +83,28 @@ export interface ContainerProps extends BaseComponentProps { /** * An object containing CSS properties to customize the container's visual appearance. - * Refer to the [style](/components/container/?tabId=style) tab for more details. + * Refer to the [style docs](/components/container/?tabId=style) for more details. + * @deprecated Replaced by `styleClassNames`. * @awsuiSystem core */ style?: ContainerProps.Style; + + /** + * CSS class names for the slots of the component that can be styled with the Style API. + * Available slots: root, header, footer. + * Refer to the [style docs](/components/container/?tabId=style) for more details. + * @awsuiSystem core + */ + styleClassNames?: ContainerProps.StyleClassNames; } export namespace ContainerProps { + export interface StyleClassNames { + root?: string; + header?: string; + footer?: string; + } + export interface Ref { /** * Sets focus on the container and scrolls it into view. Use this to move the user's focus to a diff --git a/src/container/internal.tsx b/src/container/internal.tsx index 2a3e7c769b0..1bf3e9fbad9 100644 --- a/src/container/internal.tsx +++ b/src/container/internal.tsx @@ -54,8 +54,6 @@ export interface InternalContainerProps extends Omit, */ __contentKey?: string; - styleClassNames?: StyleClassNames; - /** * Native attributes spread onto the container root, for ARIA that `getBaseProps` does not forward * (it forwards only id/className/data-*). @@ -63,13 +61,6 @@ export interface InternalContainerProps extends Omit, __nativeAttributes?: React.HTMLAttributes; } -// Style API v2 -export interface StyleClassNames { - root?: string; - header?: string; - footer?: string; -} - export const InternalContainerAsSubstep = React.forwardRef( (props: InternalContainerProps, ref: React.Ref) => { const { subStepRef, funnelSubStepProps } = useFunnelSubStep(); diff --git a/src/copy-to-clipboard/__tests__/style-api.test.tsx b/src/copy-to-clipboard/__tests__/style-api.test.tsx index 9255f83b492..dced4abb973 100644 --- a/src/copy-to-clipboard/__tests__/style-api.test.tsx +++ b/src/copy-to-clipboard/__tests__/style-api.test.tsx @@ -26,12 +26,11 @@ describe('CopyToClipboard Style API v2', () => { test.each(['button', 'icon', 'inline'])( 'applies the copyButton slot (variant=%s)', variant => { - const { container, wrapper } = renderCopyToClipboard({ + const { wrapper } = renderCopyToClipboard({ variant, - styleClassNames: { copyButton: 'a', unknown: 'b' }, + styleClassNames: { copyButton: 'a' }, }); expect(wrapper.findCopyButton().getElement()).toHaveClass('a'); - expect(container.querySelector('.b')).toBeNull(); } ); diff --git a/src/copy-to-clipboard/index.tsx b/src/copy-to-clipboard/index.tsx index 2d13fb4fde7..dd0af724434 100644 --- a/src/copy-to-clipboard/index.tsx +++ b/src/copy-to-clipboard/index.tsx @@ -7,7 +7,7 @@ import useBaseComponent from '../internal/hooks/use-base-component'; import { applyDisplayName } from '../internal/utils/apply-display-name'; import { getExternalProps } from '../internal/utils/external-props'; import { CopyToClipboardProps } from './interfaces'; -import InternalCopyToClipboard, { StyleClassNames } from './internal'; +import InternalCopyToClipboard from './internal'; export { CopyToClipboardProps }; @@ -29,7 +29,7 @@ export default function CopyToClipboard({ wrapText={wrapText} {...baseProps} {...filteredProps} - styleClassNames={(filteredProps as { styleClassNames?: StyleClassNames }).styleClassNames} + styleClassNames={filteredProps.styleClassNames} /> ); } diff --git a/src/copy-to-clipboard/interfaces.ts b/src/copy-to-clipboard/interfaces.ts index 810943cad9a..382574d7c96 100644 --- a/src/copy-to-clipboard/interfaces.ts +++ b/src/copy-to-clipboard/interfaces.ts @@ -1,6 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +import { PopoverProps } from '../popover/interfaces'; import { BaseComponentProps } from '../types/base-component'; import { NonCancelableEventHandler } from '../types/events'; @@ -85,9 +86,22 @@ export interface CopyToClipboardProps extends BaseComponentProps { * The event `detail` contains the text that failed to copy. */ onCopyFailure?: NonCancelableEventHandler; + + /** + * CSS class names for the slots of the component that can be styled with the Style API. + * Available slots: copyButton, statusPopover. + * Refer to the [style docs](/components/copy-to-clipboard/?tabId=style) for more details. + * @awsuiSystem core + */ + styleClassNames?: CopyToClipboardProps.StyleClassNames; } export namespace CopyToClipboardProps { + export interface StyleClassNames { + copyButton?: string; + statusPopover?: PopoverProps.StyleClassNames; + } + export type Variant = 'button' | 'icon' | 'inline'; export interface CopySuccessDetail { diff --git a/src/copy-to-clipboard/internal.tsx b/src/copy-to-clipboard/internal.tsx index 9f327486006..ec685727191 100644 --- a/src/copy-to-clipboard/internal.tsx +++ b/src/copy-to-clipboard/internal.tsx @@ -8,22 +8,14 @@ import { getBaseProps } from '../internal/base-component'; import { fireNonCancelableEvent } from '../internal/events'; import { InternalBaseComponentProps } from '../internal/hooks/use-base-component'; import { useOneTheme } from '../internal/hooks/use-visual-mode'; -import InternalPopover, { StyleClassNames as PopoverStyleClassNames } from '../popover/internal'; +import InternalPopover from '../popover/internal'; import InternalStatusIndicator from '../status-indicator/internal'; import { CopyToClipboardProps } from './interfaces'; import styles from './styles.css.js'; import testStyles from './test-classes/styles.css.js'; -interface InternalCopyToClipboardProps extends CopyToClipboardProps, InternalBaseComponentProps { - styleClassNames?: StyleClassNames; -} - -// Style API v2 -export interface StyleClassNames { - copyButton?: string; - statusPopover?: PopoverStyleClassNames; -} +interface InternalCopyToClipboardProps extends CopyToClipboardProps, InternalBaseComponentProps {} export default function InternalCopyToClipboard({ variant = 'button', diff --git a/src/date-input/__tests__/style-api.test.tsx b/src/date-input/__tests__/style-api.test.tsx index 3923afe9335..57ab60171e7 100644 --- a/src/date-input/__tests__/style-api.test.tsx +++ b/src/date-input/__tests__/style-api.test.tsx @@ -17,16 +17,14 @@ function renderDateInput( } describe('Date input Style API v2', () => { - test('forwards the input classes to the Input slots and ignores unknown keys', () => { - const { container, wrapper } = renderDateInput({ + test('forwards the input classes to the Input slots', () => { + const { wrapper } = renderDateInput({ value: '2024-03-15', - styleClassNames: { input: { root: 'a', input: 'b', unknown: 'c' }, unknown: 'd' }, + styleClassNames: { input: { root: 'a', input: 'b' } }, }); const nativeInput = wrapper.findNativeInput().getElement(); expect(nativeInput.parentElement).toHaveClass('a'); expect(nativeInput).toHaveClass('b'); - expect(container.querySelector('.c')).toBeNull(); - expect(container.querySelector('.d')).toBeNull(); }); test('forwards the input classes in every state', () => { diff --git a/src/date-input/interfaces.ts b/src/date-input/interfaces.ts index 6929ae090bb..55e31dde29a 100644 --- a/src/date-input/interfaces.ts +++ b/src/date-input/interfaces.ts @@ -40,9 +40,21 @@ export interface DateInputProps extends BaseInputProps, FormFieldValidationContr * * `slashed`: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01). */ inputFormat?: DateInputProps.InputFormat; + + /** + * CSS class names for the slots of the component that can be styled with the Style API. + * Available slots: input. + * Refer to the [style docs](/components/date-input/?tabId=style) for more details. + * @awsuiSystem core + */ + styleClassNames?: DateInputProps.StyleClassNames; } export namespace DateInputProps { + export interface StyleClassNames { + input?: InputProps.StyleClassNames; + } + export type Ref = InputProps.Ref; export type Format = DateFormat; diff --git a/src/date-input/internal.tsx b/src/date-input/internal.tsx index 81eac88c9d1..ea95ae3a404 100644 --- a/src/date-input/internal.tsx +++ b/src/date-input/internal.tsx @@ -6,7 +6,6 @@ import clsx from 'clsx'; import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata'; -import { StyleClassNames as InputStyleClassNames } from '../input/internal'; import MaskedInput from '../internal/components/masked-input'; import { fireNonCancelableEvent } from '../internal/events'; import useForwardFocus from '../internal/hooks/forward-focus'; @@ -24,14 +23,8 @@ import styles from './styles.css.js'; type InternalDateInputProps = DateInputProps & InternalBaseComponentProps & { __injectAnalyticsComponentMetadata?: boolean; - styleClassNames?: StyleClassNames; }; -// Style API v2 -interface StyleClassNames { - input?: InputStyleClassNames; -} - const InternalDateInput = React.forwardRef( ( { diff --git a/src/divider/index.tsx b/src/divider/index.tsx index 74010eb3944..623f45065af 100644 --- a/src/divider/index.tsx +++ b/src/divider/index.tsx @@ -7,7 +7,7 @@ import { getBaseProps } from '../internal/base-component'; import useBaseComponent from '../internal/hooks/use-base-component'; import { applyDisplayName } from '../internal/utils/apply-display-name'; import { DividerProps } from './interfaces'; -import InternalDivider, { StyleClassNames } from './internal'; +import InternalDivider from './internal'; export { DividerProps }; @@ -21,7 +21,7 @@ export default function Divider({ orientation = 'horizontal', children, nativeAt {...baseComponentProps} orientation={orientation} nativeAttributes={nativeAttributes} - styleClassNames={(rest as { styleClassNames?: StyleClassNames }).styleClassNames} + styleClassNames={rest.styleClassNames} > {children} diff --git a/src/divider/interfaces.ts b/src/divider/interfaces.ts index 3f767b0f7dd..e1d96689872 100644 --- a/src/divider/interfaces.ts +++ b/src/divider/interfaces.ts @@ -42,8 +42,20 @@ export interface DividerProps extends BaseComponentProps { * @awsuiSystem core */ nativeAttributes?: NativeAttributes>; + + /** + * CSS class names for the slots of the component that can be styled with the Style API. + * Available slots: root. + * Refer to the [style docs](/components/divider/?tabId=style) for more details. + * @awsuiSystem core + */ + styleClassNames?: DividerProps.StyleClassNames; } export namespace DividerProps { + export interface StyleClassNames { + root?: string; + } + export type Orientation = 'horizontal' | 'vertical'; } diff --git a/src/divider/internal.tsx b/src/divider/internal.tsx index bbb81df46b5..b47e1c70ce9 100644 --- a/src/divider/internal.tsx +++ b/src/divider/internal.tsx @@ -10,12 +10,7 @@ import { DividerProps } from './interfaces'; import styles from './styles.css.js'; -// Style API v2 -export interface StyleClassNames { - root?: string; -} - -type InternalDividerProps = DividerProps & InternalBaseComponentProps & { styleClassNames?: StyleClassNames }; +type InternalDividerProps = DividerProps & InternalBaseComponentProps; export default function InternalDivider({ orientation, diff --git a/src/dropdown/index.tsx b/src/dropdown/index.tsx index 7618bc5f977..2d81142b483 100644 --- a/src/dropdown/index.tsx +++ b/src/dropdown/index.tsx @@ -6,19 +6,12 @@ import React from 'react'; import useBaseComponent from '../internal/hooks/use-base-component'; import { applyDisplayName } from '../internal/utils/apply-display-name'; import { DropdownProps } from './interfaces'; -import InternalDropdown, { StyleClassNames } from './internal'; +import InternalDropdown from './internal'; export { DropdownProps }; export default function Dropdown({ style, ...props }: DropdownProps) { const baseComponentProps = useBaseComponent('Dropdown'); - return ( - - ); + return ; } applyDisplayName(Dropdown, 'Dropdown'); diff --git a/src/dropdown/interfaces.ts b/src/dropdown/interfaces.ts index 78d31d59cd3..67c5a930788 100644 --- a/src/dropdown/interfaces.ts +++ b/src/dropdown/interfaces.ts @@ -7,6 +7,10 @@ import { NonCancelableEventHandler } from '../types/events'; export type OptionsFilteringType = 'none' | 'auto' | 'manual'; export namespace DropdownProps { + export interface StyleClassNames { + root?: string; + } + export interface Style { dropdown?: { /** @@ -168,9 +172,18 @@ export interface DropdownProps extends ExpandToViewport { /** * An object containing CSS properties to customize the dropdown's visual appearance. + * @deprecated Replaced by `styleClassNames`. * @awsuiSystem core */ style?: DropdownProps.Style; + + /** + * CSS class names for the slots of the component that can be styled with the Style API. + * Available slots: root. + * Refer to the [style docs](/components/dropdown/?tabId=style) for more details. + * @awsuiSystem core + */ + styleClassNames?: DropdownProps.StyleClassNames; } export interface ExpandToViewport { diff --git a/src/dropdown/internal.tsx b/src/dropdown/internal.tsx index 3f2f75fc7d0..28b38b7e660 100644 --- a/src/dropdown/internal.tsx +++ b/src/dropdown/internal.tsx @@ -53,12 +53,7 @@ export interface InternalDropdownProps onBlur?: NonCancelableEventHandler>; triggerRef?: React.RefObject; triggerId?: string; - styleClassNames?: StyleClassNames; -} - -// Style API v2 -export interface StyleClassNames { - root?: string; + styleClassNames?: DropdownProps.StyleClassNames; } import styles from './styles.css.js'; @@ -123,7 +118,7 @@ interface TransitionContentProps { ariaLabelledby?: string; ariaDescribedby?: string; dropdownStyle?: React.CSSProperties; - styleClassNames?: StyleClassNames; + styleClassNames?: DropdownProps.StyleClassNames; } const TransitionContent = ({ diff --git a/src/file-input/internal.tsx b/src/file-input/internal.tsx index d159ab2370a..f15ecb0f33a 100644 --- a/src/file-input/internal.tsx +++ b/src/file-input/internal.tsx @@ -11,7 +11,8 @@ import { getAnalyticsMetadataAttribute, } from '@cloudscape-design/component-toolkit/internal/analytics-metadata'; -import InternalButton, { StyleClassNames as ButtonStyleClassNames } from '../button/internal'; +import { ButtonProps } from '../button/interfaces'; +import InternalButton from '../button/internal'; import { useFormFieldContext } from '../contexts/form-field'; import { getBaseProps } from '../internal/base-component/index.js'; import ScreenreaderOnly from '../internal/components/screenreader-only'; @@ -27,7 +28,7 @@ import styles from './styles.css.js'; interface InternalFileInputProps { __inputClassName?: string; - styleClassNames?: ButtonStyleClassNames; + styleClassNames?: ButtonProps.StyleClassNames; __inputNativeAttributes?: React.InputHTMLAttributes | Record<`data-${string}`, string>; __injectAnalyticsComponentMetadata?: boolean; } diff --git a/src/flashbar/interfaces.ts b/src/flashbar/interfaces.ts index 8d455fd800b..ce990588645 100644 --- a/src/flashbar/interfaces.ts +++ b/src/flashbar/interfaces.ts @@ -5,8 +5,16 @@ import React from 'react'; import { ButtonProps } from '../button/interfaces'; import { ErrorContext } from '../types/analytics'; import { BaseComponentProps } from '../types/base-component'; +import { StyleSlot } from '../types/utils'; export namespace FlashbarProps { + export interface StyleClassNames { + item?: StyleSlot<{ item: FlashbarProps.MessageDefinition }>; + icon?: string; + dismissButton?: string; + notificationBar?: string; + } + export interface MessageDefinition { header?: React.ReactNode; content?: React.ReactNode; @@ -217,8 +225,17 @@ export interface FlashbarProps extends BaseComponentProps { /** * An object containing CSS properties to customize the flashbar's visual appearance. - * Refer to the [style](/components/flashbar/?tabId=style) tab for more details. + * Refer to the [style docs](/components/flashbar/?tabId=style) for more details. + * @deprecated Replaced by `styleClassNames`. * @awsuiSystem core */ style?: FlashbarProps.Style; + + /** + * CSS class names for the slots of the component that can be styled with the Style API. + * Available slots: item, icon, dismissButton, notificationBar. + * Refer to the [style docs](/components/flashbar/?tabId=style) for more details. + * @awsuiSystem core + */ + styleClassNames?: FlashbarProps.StyleClassNames; } diff --git a/src/flashbar/internal-interfaces.ts b/src/flashbar/internal-interfaces.ts index 8c454a01d26..f96b80fe282 100644 --- a/src/flashbar/internal-interfaces.ts +++ b/src/flashbar/internal-interfaces.ts @@ -1,16 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { InternalBaseComponentProps } from '../internal/hooks/use-base-component'; -import { Slot } from '../internal/utils/style-slot'; import { FlashbarProps } from './interfaces'; -// Style API v2 -export interface FlashbarStyleClassNames { - item?: Slot<{ item: FlashbarProps.MessageDefinition }>; - icon?: string; - dismissButton?: string; - notificationBar?: string; -} - export type InternalFlashbarProps = FlashbarProps & - InternalBaseComponentProps & { styleClassNames?: FlashbarStyleClassNames }; + InternalBaseComponentProps & { styleClassNames?: FlashbarProps.StyleClassNames }; diff --git a/src/input/index.tsx b/src/input/index.tsx index 7063bcfacf7..b56d416a9c2 100644 --- a/src/input/index.tsx +++ b/src/input/index.tsx @@ -8,7 +8,7 @@ import { getBaseProps } from '../internal/base-component'; import useBaseComponent from '../internal/hooks/use-base-component'; import { applyDisplayName } from '../internal/utils/apply-display-name'; import { InputProps } from './interfaces'; -import InternalInput, { StyleClassNames } from './internal'; +import InternalInput from './internal'; import styles from './styles.css.js'; @@ -107,7 +107,7 @@ const Input = React.forwardRef( prefix, suffix, inlineLabelText, - styleClassNames: (rest as { styleClassNames?: StyleClassNames }).styleClassNames, + styleClassNames: rest.styleClassNames, }} className={clsx(styles.root, baseProps.className)} __inheritFormFieldProps={true} diff --git a/src/input/interfaces.ts b/src/input/interfaces.ts index 19a9c91919b..3a2c0729adc 100644 --- a/src/input/interfaces.ts +++ b/src/input/interfaces.ts @@ -190,7 +190,8 @@ export interface InputProps /** * An object containing CSS properties to customize the input's visual appearance. - * Refer to the [style](/components/input/?tabId=style) tab for more details. + * Refer to the [style docs](/components/input/?tabId=style) for more details. + * @deprecated Replaced by `styleClassNames`. * @awsuiSystem core */ style?: InputProps.Style; @@ -211,9 +212,25 @@ export interface InputProps * Use for content rendered after the editable value. */ suffix?: ReactNode; + + /** + * CSS class names for the slots of the component that can be styled with the Style API. + * Available slots: root, input, inlineLabel, searchIcon, clearButton. + * Refer to the [style docs](/components/input/?tabId=style) for more details. + * @awsuiSystem core + */ + styleClassNames?: InputProps.StyleClassNames; } export namespace InputProps { + export interface StyleClassNames { + root?: string; + input?: string; + inlineLabel?: string; + searchIcon?: string; + clearButton?: string; + } + export type Type = 'text' | 'password' | 'search' | 'number' | 'email' | 'url'; export type InputMode = 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'; export type Step = number | 'any'; diff --git a/src/input/internal.tsx b/src/input/internal.tsx index fae57a37e24..e9c1ca9f6a2 100644 --- a/src/input/internal.tsx +++ b/src/input/internal.tsx @@ -62,16 +62,6 @@ export interface InternalInputProps __injectAnalyticsComponentMetadata?: boolean; __skipNativeAttributesWarnings?: SkipWarnings; __fullWidth?: boolean; - styleClassNames?: StyleClassNames; -} - -// Style API v2 -export interface StyleClassNames { - root?: string; - input?: string; - inlineLabel?: string; - searchIcon?: string; - clearButton?: string; } function InternalInput( diff --git a/src/internal/components/autosuggest-input/index.tsx b/src/internal/components/autosuggest-input/index.tsx index 2a105646cf2..e4b7f4e2d65 100644 --- a/src/internal/components/autosuggest-input/index.tsx +++ b/src/internal/components/autosuggest-input/index.tsx @@ -17,7 +17,7 @@ import { InputKeyEvents, InputProps, } from '../../../input/interfaces'; -import InternalInput, { StyleClassNames as InputStyleClassNames } from '../../../input/internal'; +import InternalInput from '../../../input/internal'; import InternalLiveRegion from '../../../live-region/internal'; import InternalToken from '../../../token/internal'; import { BaseComponentProps } from '../../../types/base-component'; @@ -69,7 +69,7 @@ interface AutosuggestInputProps tokenOverflowAriaLabel?: (hiddenCount: number) => string; tokenInsertedAnnouncement?: (value: string) => string; tokenDismissLabel?: (value: string) => string; - styleClassNames?: { input?: InputStyleClassNames; dropdown?: string }; + styleClassNames?: { input?: InputProps.StyleClassNames; dropdown?: string }; } interface AutosuggestInputFocusOptions { diff --git a/src/internal/components/radio-button/index.tsx b/src/internal/components/radio-button/index.tsx index 72b02e836bb..c4774711ac0 100644 --- a/src/internal/components/radio-button/index.tsx +++ b/src/internal/components/radio-button/index.tsx @@ -19,15 +19,10 @@ import styles from './styles.css.js'; import testUtilStyles from './test-classes/styles.css.js'; export interface InternalRadioButtonProps extends RadioButtonProps, InternalBaseComponentProps { - styleClassNames?: StyleClassNames; + styleClassNames?: RadioButtonProps.StyleClassNames; __skipNativeAttributesWarnings?: SkipWarnings; } -// Style API v2 -export interface StyleClassNames { - control?: string; -} - export default React.forwardRef(function RadioButton( { name, diff --git a/src/internal/utils/style-slot.ts b/src/internal/utils/style-slot.ts index 5838a559eec..3aedbae7cdc 100644 --- a/src/internal/utils/style-slot.ts +++ b/src/internal/utils/style-slot.ts @@ -1,9 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 +import { StyleSlot } from '../../types/utils'; -// A Style API v2 slot that takes a class name, or a function of the slot arguments that returns one. -export type Slot = string | ((args: Args) => string | undefined); - -export function getStyleClassName(slot: Slot | undefined, args: Args) { - return typeof slot === 'function' ? slot(args) : slot; +export function getStyleClassName(slot: StyleSlot | undefined, args: Args) { + return typeof slot === 'function' ? (slot as (args: Args) => Value | undefined)(args) : slot; } diff --git a/src/item-card/interfaces.ts b/src/item-card/interfaces.ts index fe83e5c9132..0a7230a1891 100644 --- a/src/item-card/interfaces.ts +++ b/src/item-card/interfaces.ts @@ -78,7 +78,8 @@ export interface ItemCardProps extends BaseComponentProps { /** * An object containing CSS properties to customize the item card's visual appearance. - * Refer to the [style](/components/item-card/?tabId=style) tab for more details. + * Refer to the [style docs](/components/item-card/?tabId=style) for more details. + * @deprecated Replaced by `styleClassNames`. * @awsuiSystem core */ style?: ItemCardProps.Style; @@ -96,9 +97,23 @@ export interface ItemCardProps extends BaseComponentProps { * @awsuiSystem core */ nativeAttributes?: NativeAttributes>; + + /** + * CSS class names for the slots of the component that can be styled with the Style API. + * Available slots: root, header, footer. + * Refer to the [style docs](/components/item-card/?tabId=style) for more details. + * @awsuiSystem core + */ + styleClassNames?: ItemCardProps.StyleClassNames; } export namespace ItemCardProps { + export interface StyleClassNames { + root?: string; + header?: string; + footer?: string; + } + export type Variant = 'embedded' | 'default'; export interface Style { diff --git a/src/item-card/internal.tsx b/src/item-card/internal.tsx index 2c5dc4546a3..2ba6002a3f6 100644 --- a/src/item-card/internal.tsx +++ b/src/item-card/internal.tsx @@ -15,17 +15,6 @@ import { getContentStyles, getFooterStyles, getHeaderStyles, getRootStyles } fro import styles from './styles.css.js'; import testStyles from './test-classes/styles.css.js'; -// Style API v2 -export interface StyleClassNames { - root?: string; - header?: string; - footer?: string; -} - -interface InternalItemCardWithStyleProps extends InternalItemCardProps { - styleClassNames?: StyleClassNames; -} - export default function InternalItemCard({ actions, highlighted, @@ -47,7 +36,7 @@ export default function InternalItemCard({ __internalRootRef, styleClassNames, ...restProps -}: InternalItemCardWithStyleProps) { +}: InternalItemCardProps) { const baseProps = getBaseProps(restProps); const isRefresh = useVisualRefresh(); const rootRef = useMergeRefs(__internalRootRef, nativeAttributes?.ref); diff --git a/src/link/index.tsx b/src/link/index.tsx index c9a8b9152d2..edbc97a688a 100644 --- a/src/link/index.tsx +++ b/src/link/index.tsx @@ -9,7 +9,7 @@ import useBaseComponent from '../internal/hooks/use-base-component'; import { applyDisplayName } from '../internal/utils/apply-display-name'; import { GeneratedAnalyticsMetadataLinkFragment } from './analytics-metadata/interfaces'; import { LinkProps } from './interfaces'; -import InternalLink, { StyleClassNames } from './internal'; +import InternalLink from './internal'; export { LinkProps }; @@ -49,7 +49,7 @@ const Link = React.forwardRef( ref={ref} {...getAnalyticsMetadataAttribute(analyticsMetadata)} style={style} - styleClassNames={(props as { styleClassNames?: StyleClassNames }).styleClassNames} + styleClassNames={props.styleClassNames} /> ); } diff --git a/src/link/interfaces.ts b/src/link/interfaces.ts index b2d425bdc96..bab94643973 100644 --- a/src/link/interfaces.ts +++ b/src/link/interfaces.ts @@ -113,7 +113,8 @@ export interface LinkProps extends BaseComponentProps { /** * An object containing CSS properties to customize the link's visual appearance. - * Refer to the [style](/components/link/?tabId=style) tab for more details. + * Refer to the [style docs](/components/link/?tabId=style) for more details. + * @deprecated Replaced by `styleClassNames`. * @awsuiSystem core */ style?: LinkProps.Style; @@ -133,9 +134,21 @@ export interface LinkProps extends BaseComponentProps { * @awsuiSystem core */ nativeAttributes?: NativeAttributes>; + + /** + * CSS class names for the slots of the component that can be styled with the Style API. + * Available slots: root. + * Refer to the [style docs](/components/link/?tabId=style) for more details. + * @awsuiSystem core + */ + styleClassNames?: LinkProps.StyleClassNames; } export namespace LinkProps { + export interface StyleClassNames { + root?: string; + } + export type Variant = 'primary' | 'secondary' | 'info' | 'awsui-value-large'; export type FontSize = | 'body-s' diff --git a/src/link/internal.tsx b/src/link/internal.tsx index 22d0d28dd79..2cb0ad72ef2 100644 --- a/src/link/internal.tsx +++ b/src/link/internal.tsx @@ -35,14 +35,8 @@ import styles from './styles.css.js'; type InternalLinkProps = InternalBaseComponentProps & Omit & { variant?: LinkProps['variant'] | 'top-navigation' | 'link' | 'recovery'; - styleClassNames?: StyleClassNames; }; -// Style API v2 -export interface StyleClassNames { - root?: string; -} - const InternalLink = React.forwardRef( ( { diff --git a/src/multiselect/index.tsx b/src/multiselect/index.tsx index 6a1f0542127..81781869b43 100644 --- a/src/multiselect/index.tsx +++ b/src/multiselect/index.tsx @@ -9,7 +9,7 @@ import useBaseComponent from '../internal/hooks/use-base-component'; import { applyDisplayName } from '../internal/utils/apply-display-name'; import { GeneratedAnalyticsMetadataMultiselectComponent } from './analytics-metadata/interfaces'; import { MultiselectProps } from './interfaces'; -import InternalMultiselect, { StyleClassNames } from './internal'; +import InternalMultiselect from './internal'; import buttonTriggerAnalyticsSelectors from '../internal/components/button-trigger/analytics-metadata/styles.css.js'; @@ -80,7 +80,7 @@ const Multiselect = React.forwardRef( hideTokens={hideTokens} {...restProps} {...baseComponentProps} - styleClassNames={(restProps as { styleClassNames?: StyleClassNames }).styleClassNames} + styleClassNames={restProps.styleClassNames} ref={ref} {...getAnalyticsMetadataAttribute({ component: componentAnalyticsMetadata })} /> diff --git a/src/multiselect/interfaces.ts b/src/multiselect/interfaces.ts index 7cd9dbecbb7..e10702c5c05 100644 --- a/src/multiselect/interfaces.ts +++ b/src/multiselect/interfaces.ts @@ -3,7 +3,9 @@ import { ReactNode } from 'react'; import { OptionsLoadItemsDetail } from '../dropdown/interfaces'; +import { InputProps } from '../input/interfaces'; import { BaseSelectProps, SelectProps } from '../select/interfaces'; +import { TokenProps } from '../token/interfaces'; import { NonCancelableEventHandler } from '../types/events'; import { OptionDefinition, OptionGroup as OptionGroupDefinition } from '../types/option'; @@ -81,9 +83,25 @@ export interface MultiselectProps extends BaseSelectProps { * Specifies a render function to render custom options in the dropdown menu. */ renderOption?: MultiselectProps.MultiselectOptionItemRenderer; + + /** + * CSS class names for the slots of the component that can be styled with the Style API. + * Available slots: trigger, inlineLabel, filter, dropdown, token. + * Refer to the [style docs](/components/multiselect/?tabId=style) for more details. + * @awsuiSystem core + */ + styleClassNames?: MultiselectProps.StyleClassNames; } export namespace MultiselectProps { + export interface StyleClassNames { + trigger?: string; + inlineLabel?: string; + filter?: InputProps.StyleClassNames; + dropdown?: string; + token?: TokenProps.StyleClassNames; + } + export type Option = OptionDefinition; export type OptionGroup = OptionGroupDefinition; export type Options = ReadonlyArray