@cloudscape-design/components 3.0.473 → 3.0.475

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/i18n/dynamic.js +2 -0
  2. package/i18n/messages/all.all.js +5225 -442
  3. package/i18n/messages/all.all.json +5230 -470
  4. package/i18n/messages/all.de.js +334 -23
  5. package/i18n/messages/all.de.json +338 -27
  6. package/i18n/messages/all.en-GB.js +334 -23
  7. package/i18n/messages/all.en-GB.json +338 -27
  8. package/i18n/messages/all.en.js +334 -23
  9. package/i18n/messages/all.en.json +338 -27
  10. package/i18n/messages/all.es.js +339 -19
  11. package/i18n/messages/all.es.json +340 -23
  12. package/i18n/messages/all.fr.js +334 -23
  13. package/i18n/messages/all.fr.json +338 -27
  14. package/i18n/messages/all.id.js +318 -19
  15. package/i18n/messages/all.id.json +319 -23
  16. package/i18n/messages/all.it.js +297 -19
  17. package/i18n/messages/all.it.json +298 -23
  18. package/i18n/messages/all.ja.js +339 -19
  19. package/i18n/messages/all.ja.json +340 -23
  20. package/i18n/messages/all.ko.js +339 -17
  21. package/i18n/messages/all.ko.json +340 -21
  22. package/i18n/messages/all.pt-BR.js +334 -23
  23. package/i18n/messages/all.pt-BR.json +338 -27
  24. package/i18n/messages/all.th.d.ts +3 -0
  25. package/i18n/messages/all.th.js +733 -0
  26. package/i18n/messages/all.th.json +734 -0
  27. package/i18n/messages/all.tr.js +339 -19
  28. package/i18n/messages/all.tr.json +340 -23
  29. package/i18n/messages/all.zh-CN.js +339 -19
  30. package/i18n/messages/all.zh-CN.json +340 -23
  31. package/i18n/messages/all.zh-TW.js +339 -19
  32. package/i18n/messages/all.zh-TW.json +340 -23
  33. package/i18n/messages-types.d.ts +5 -2
  34. package/i18n/messages-types.d.ts.map +1 -1
  35. package/i18n/messages-types.js.map +1 -1
  36. package/internal/analytics/components/analytics-funnel.js +3 -3
  37. package/internal/analytics/components/analytics-funnel.js.map +1 -1
  38. package/internal/analytics/context/analytics-context.d.ts +1 -1
  39. package/internal/analytics/context/analytics-context.d.ts.map +1 -1
  40. package/internal/analytics/context/analytics-context.js +1 -1
  41. package/internal/analytics/context/analytics-context.js.map +1 -1
  42. package/internal/analytics/hooks/use-funnel.d.ts.map +1 -1
  43. package/internal/analytics/hooks/use-funnel.js +2 -2
  44. package/internal/analytics/hooks/use-funnel.js.map +1 -1
  45. package/internal/environment.js +1 -1
  46. package/internal/environment.json +1 -1
  47. package/internal/manifest.json +1 -1
  48. package/package.json +1 -1
  49. package/table/table-role/grid-navigation.d.ts +1 -4
  50. package/table/table-role/grid-navigation.d.ts.map +1 -1
  51. package/table/table-role/grid-navigation.js +122 -66
  52. package/table/table-role/grid-navigation.js.map +1 -1
  53. package/table/table-role/table-role-helper.d.ts.map +1 -1
  54. package/table/table-role/table-role-helper.js +2 -0
  55. package/table/table-role/table-role-helper.js.map +1 -1
  56. package/table/table-role/utils.d.ts +9 -17
  57. package/table/table-role/utils.d.ts.map +1 -1
  58. package/table/table-role/utils.js +3 -83
  59. package/table/table-role/utils.js.map +1 -1
  60. package/toggle/styles.css.js +8 -8
  61. package/toggle/styles.scoped.css +14 -13
  62. package/toggle/styles.selectors.js +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"lib/default/","sources":["table/table-role/utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,aAAa,IAAI,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AAGlG,iGAAiG;AACjG,sGAAsG;AACtG,MAAM,0BAA0B,GAAG,CAAC,GAAG,CAAC;AACxC,MAAM,mBAAmB,GAAG,6BAA6B,0BAA0B,IAAI,CAAC;AAExF;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAAiB;;IAC/C,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,YAAY,WAAW,CAAC,EAAE;QAC1C,OAAO,IAAI,CAAC;KACb;IACD,MAAM,OAAO,GA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.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getFocusables as getActualFocusables } from '../../internal/components/focus-lock/utils';\nimport { FocusedCell } from './interfaces';\n\n// For the grid to have a single Tab stop all interactive element indices are updated to be -999.\n// The elements having tab index -999 are eligible for keyboard navigation but not for Tab navigation.\nconst PSEUDO_FOCUSABLE_TAB_INDEX = -999;\nconst FOCUSABLES_SELECTOR = `[tabIndex=\"0\"],[tabIndex=\"${PSEUDO_FOCUSABLE_TAB_INDEX}\"]`;\n\n/**\n * Finds focused cell props corresponding the focused element inside the table.\n * The function relies on ARIA colindex/rowindex attributes being correctly applied.\n */\nexport function findFocusinCell(event: FocusEvent): null | FocusedCell {\n if (!(event.target instanceof HTMLElement)) {\n return null;\n }\n const element = event.target;\n\n const cellElement = element.closest('td,th') as null | HTMLTableCellElement;\n const rowElement = cellElement?.closest('tr');\n\n if (!cellElement || !rowElement) {\n return null;\n }\n\n const colIndex = parseInt(cellElement.getAttribute('aria-colindex') ?? '');\n const rowIndex = parseInt(rowElement.getAttribute('aria-rowindex') ?? '');\n if (isNaN(colIndex) || isNaN(rowIndex)) {\n return null;\n }\n\n const cellFocusables = getFocusables(cellElement);\n const elementIndex = cellFocusables.indexOf(element);\n\n return { rowIndex, colIndex, rowElement, cellElement, element, elementIndex };\n}\n\n/**\n * Moves table focus in the provided direction. The focus can transition between cells or interactive elements inside cells.\n */\nexport function moveFocusBy(table: HTMLTableElement, from: FocusedCell, delta: { y: number; x: number }) {\n // Find next row to move focus into (can be null if the top/bottom is reached).\n const targetAriaRowIndex = from.rowIndex + delta.y;\n const targetRow = findTableRowByAriaRowIndex(table, targetAriaRowIndex, delta.y);\n if (!targetRow) {\n return;\n }\n\n // Move focus to the next interactive cell content element if available.\n const cellFocusables = getFocusables(from.cellElement);\n const nextElementIndex = from.elementIndex + delta.x;\n if (delta.x && from.elementIndex !== -1 && 0 <= nextElementIndex && nextElementIndex < cellFocusables.length) {\n focus(cellFocusables[nextElementIndex]);\n return;\n }\n\n // Find next cell to focus or move focus into (can be null if the left/right edge is reached).\n const targetAriaColIndex = from.colIndex + delta.x;\n const targetCell = findTableRowCellByAriaColIndex(targetRow, targetAriaColIndex, delta.x);\n if (!targetCell) {\n return;\n }\n\n // When target cell matches the current cell it means we reached the left or right boundary.\n if (targetCell === from.cellElement) {\n return;\n }\n\n // Move focus on the cell interactive content or the cell itself.\n const targetCellFocusables = getFocusables(targetCell);\n const focusIndex = delta.x < 0 ? targetCellFocusables.length - 1 : delta.x > 0 ? 0 : from.elementIndex;\n const focusTarget = targetCellFocusables[focusIndex] ?? targetCell;\n focus(focusTarget);\n}\n\n/**\n * Makes the cell element, the first interactive element or the first cell of the table user-focusable.\n */\nexport function ensureSingleFocusable(table: HTMLElement, cell: null | FocusedCell) {\n const firstTableCell = table.querySelector('td,th') as null | HTMLTableCellElement;\n\n // A single element of the table is made user-focusable.\n // It defaults to the first interactive element of the first cell or the first cell itself otherwise.\n let focusTarget: null | HTMLElement = (firstTableCell && getFocusables(firstTableCell)[0]) ?? firstTableCell;\n\n // When a navigation-focused element is present in the table it is used for user-navigation instead.\n if (cell && table.contains(cell.element) && isUserFocusable(cell.element)) {\n focusTarget = cell.element;\n }\n\n setTabIndex(focusTarget, 0);\n}\n\n/**\n * Makes all element focusable children pseudo-focusable unless the grid navigation is suppressed.\n */\nexport function muteElementFocusables(element: HTMLElement, suppressed: boolean) {\n // When grid navigation is suppressed all interactive elements and all cells focus is unmuted to unblock Tab navigation.\n // Leaving the interactive widget using Tab navigation moves the focus to the current or adjacent cell and un-suppresses\n // the navigation when implemented correctly.\n if (suppressed) {\n for (const focusable of getFocusables(element)) {\n setTabIndex(focusable, 0);\n }\n return;\n }\n\n // Assigning pseudo-focusable tab index to all cells and all interactive elements makes them focusable with grid navigation.\n for (const focusable of getActualFocusables(element)) {\n if (focusable !== document.activeElement) {\n setTabIndex(focusable, PSEUDO_FOCUSABLE_TAB_INDEX);\n }\n }\n}\n\n/**\n * This cleanup code ensures all cells are no longer focusable but the interactive elements are.\n * Currently there are no use cases for it as we don't expect the navigation to be used conditionally.\n */\nexport function restoreElementFocusables(element: HTMLTableElement) {\n for (const focusable of getFocusables(element)) {\n if (focusable instanceof HTMLTableCellElement) {\n setTabIndex(focusable, -1);\n } else {\n setTabIndex(focusable, 0);\n }\n }\n}\n\n/**\n * Returns true if the target element or one of its parents is a dialog or is marked with data-awsui-table-suppress-navigation attribute.\n * This is used to suppress navigation for interactive content without a need to use a custom suppression check.\n */\nexport function defaultIsSuppressed(target: HTMLElement) {\n let current: null | HTMLElement = target;\n while (current) {\n // Stop checking for parents upon reaching the cell element as the function only aims at the cell content.\n const tagName = current.tagName.toLowerCase();\n if (tagName === 'td' || tagName === 'th') {\n return false;\n }\n if (\n current.getAttribute('role') === 'dialog' ||\n current.getAttribute('data-awsui-table-suppress-navigation') === 'true'\n ) {\n return true;\n }\n current = current.parentElement;\n }\n return false;\n}\n\n/**\n * Returns actually focusable or pseudo-focusable elements to find navigation targets.\n */\nexport function getFocusables(element: HTMLElement) {\n return Array.from(element.querySelectorAll(FOCUSABLES_SELECTOR)) as HTMLElement[];\n}\n\nexport function getFirstFocusable(element: HTMLElement) {\n return element.querySelector(FOCUSABLES_SELECTOR) as null | HTMLElement;\n}\n\n/**\n * Finds the closest row to the targetAriaRowIndex+delta in the direction of delta.\n */\nfunction findTableRowByAriaRowIndex(table: HTMLTableElement, targetAriaRowIndex: number, delta: number) {\n let targetRow: null | HTMLTableRowElement = null;\n const rowElements = Array.from(table.querySelectorAll('tr[aria-rowindex]'));\n if (delta < 0) {\n rowElements.reverse();\n }\n for (const element of rowElements) {\n const rowIndex = parseInt(element.getAttribute('aria-rowindex') ?? '');\n targetRow = element as HTMLTableRowElement;\n\n if (rowIndex === targetAriaRowIndex) {\n break;\n }\n if (delta >= 0 && rowIndex > targetAriaRowIndex) {\n break;\n }\n if (delta < 0 && rowIndex < targetAriaRowIndex) {\n break;\n }\n }\n return targetRow;\n}\n\n/**\n * Finds the closest column to the targetAriaColIndex+delta in the direction of delta.\n */\nfunction findTableRowCellByAriaColIndex(tableRow: HTMLTableRowElement, targetAriaColIndex: number, delta: number) {\n let targetCell: null | HTMLTableCellElement = null;\n const cellElements = Array.from(tableRow.querySelectorAll('td[aria-colindex],th[aria-colindex]'));\n if (delta < 0) {\n cellElements.reverse();\n }\n for (const element of cellElements) {\n const columnIndex = parseInt(element.getAttribute('aria-colindex') ?? '');\n targetCell = element as HTMLTableCellElement;\n\n if (columnIndex === targetAriaColIndex) {\n break;\n }\n if (delta >= 0 && columnIndex > targetAriaColIndex) {\n break;\n }\n if (delta < 0 && columnIndex < targetAriaColIndex) {\n break;\n }\n }\n return targetCell;\n}\n\nfunction focus(element: null | HTMLElement) {\n setTabIndex(element, 0);\n element?.focus();\n}\n\nfunction setTabIndex(element: null | HTMLElement, tabIndex: number) {\n if (element && element.tabIndex !== tabIndex) {\n element.tabIndex = tabIndex;\n }\n}\n\nfunction isUserFocusable(element: HTMLElement) {\n return element.matches(FOCUSABLES_SELECTOR);\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"lib/default/","sources":["table/table-role/utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,aAAa,IAAI,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AAElG,iGAAiG;AACjG,sGAAsG;AACtG,MAAM,0BAA0B,GAAG,CAAC,GAAG,CAAC;AACxC,MAAM,mBAAmB,GAAG,6BAA6B,0BAA0B,IAAI,CAAC;AAExF;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAoB,EAAE,UAAmB;IAC7E,wHAAwH;IACxH,wHAAwH;IACxH,6CAA6C;IAC7C,IAAI,UAAU,EAAE;QACd,KAAK,MAAM,SAAS,IAAI,aAAa,CAAC,OAAO,CAAC,EAAE;YAC9C,WAAW,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;SAC3B;QACD,OAAO;KACR;IAED,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C;QAE7C,IAAI,WAAW,KAAK,kBAAkB,EAAE;YACtC,MAAM;SACP;QACD,IAAI,KAAK,IAAI,CAAC,IAAI,WAAW,GAAG,kBAAkB,EAAE;YAClD,MAAM;SACP;QACD,IAAI,KAAK,GAAG,CAAC,IAAI,WAAW,GAAG,kBAAkB,EAAE;YACjD,MAAM;SACP;KACF;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAA2B,EAAE,QAAgB;IACvE,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE;QAC5C,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;KAC7B;AACH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getFocusables as getActualFocusables } from '../../internal/components/focus-lock/utils';\n\n// For the grid to have a single Tab stop all interactive element indices are updated to be -999.\n// The elements having tab index -999 are eligible for keyboard navigation but not for Tab navigation.\nconst PSEUDO_FOCUSABLE_TAB_INDEX = -999;\nconst FOCUSABLES_SELECTOR = `[tabIndex=\"0\"],[tabIndex=\"${PSEUDO_FOCUSABLE_TAB_INDEX}\"]`;\n\n/**\n * Makes all element focusable children pseudo-focusable unless the grid navigation is suppressed.\n */\nexport function muteElementFocusables(element: HTMLElement, suppressed: boolean) {\n // When grid navigation is suppressed all interactive elements and all cells focus is unmuted to unblock Tab navigation.\n // Leaving the interactive widget using Tab navigation moves the focus to the current or adjacent cell and un-suppresses\n // the navigation when implemented correctly.\n if (suppressed) {\n for (const focusable of getFocusables(element)) {\n setTabIndex(focusable, 0);\n }\n return;\n }\n\n // Assigning pseudo-focusable tab index to all cells and all interactive elements makes them focusable with grid navigation.\n for (const focusable of getActualFocusables(element)) {\n if (focusable !== document.activeElement) {\n setTabIndex(focusable, PSEUDO_FOCUSABLE_TAB_INDEX);\n }\n }\n}\n\n/**\n * This cleanup code ensures all cells are no longer focusable but the interactive elements are.\n * Currently there are no use cases for it as we don't expect the navigation to be used conditionally.\n */\nexport function restoreElementFocusables(element: HTMLTableElement) {\n for (const focusable of getFocusables(element)) {\n if (focusable instanceof HTMLTableCellElement) {\n setTabIndex(focusable, -1);\n } else {\n setTabIndex(focusable, 0);\n }\n }\n}\n\n/**\n * Returns true if the target element or one of its parents is a dialog or is marked with data-awsui-table-suppress-navigation attribute.\n * This is used to suppress navigation for interactive content without a need to use a custom suppression check.\n */\nexport function defaultIsSuppressed(target: HTMLElement) {\n let current: null | HTMLElement = target;\n while (current) {\n // Stop checking for parents upon reaching the cell element as the function only aims at the cell content.\n const tagName = current.tagName.toLowerCase();\n if (tagName === 'td' || tagName === 'th') {\n return false;\n }\n if (\n current.getAttribute('role') === 'dialog' ||\n current.getAttribute('data-awsui-table-suppress-navigation') === 'true'\n ) {\n return true;\n }\n current = current.parentElement;\n }\n return false;\n}\n\n/**\n * Returns actually focusable or pseudo-focusable elements to find navigation targets.\n */\nexport function getFocusables(element: HTMLElement) {\n return Array.from(element.querySelectorAll(FOCUSABLES_SELECTOR)) as HTMLElement[];\n}\n\nexport function getFirstFocusable(element: HTMLElement) {\n return element.querySelector(FOCUSABLES_SELECTOR) as null | HTMLElement;\n}\n\n/**\n * Finds the closest row to the targetAriaRowIndex+delta in the direction of delta.\n */\nexport function findTableRowByAriaRowIndex(table: HTMLTableElement, targetAriaRowIndex: number, delta: number) {\n let targetRow: null | HTMLTableRowElement = null;\n const rowElements = Array.from(table.querySelectorAll('tr[aria-rowindex]'));\n if (delta < 0) {\n rowElements.reverse();\n }\n for (const element of rowElements) {\n const rowIndex = parseInt(element.getAttribute('aria-rowindex') ?? '');\n targetRow = element as HTMLTableRowElement;\n\n if (rowIndex === targetAriaRowIndex) {\n break;\n }\n if (delta >= 0 && rowIndex > targetAriaRowIndex) {\n break;\n }\n if (delta < 0 && rowIndex < targetAriaRowIndex) {\n break;\n }\n }\n return targetRow;\n}\n\n/**\n * Finds the closest column to the targetAriaColIndex+delta in the direction of delta.\n */\nexport function findTableRowCellByAriaColIndex(\n tableRow: HTMLTableRowElement,\n targetAriaColIndex: number,\n delta: number\n) {\n let targetCell: null | HTMLTableCellElement = null;\n const cellElements = Array.from(tableRow.querySelectorAll('td[aria-colindex],th[aria-colindex]'));\n if (delta < 0) {\n cellElements.reverse();\n }\n for (const element of cellElements) {\n const columnIndex = parseInt(element.getAttribute('aria-colindex') ?? '');\n targetCell = element as HTMLTableCellElement;\n\n if (columnIndex === targetAriaColIndex) {\n break;\n }\n if (delta >= 0 && columnIndex > targetAriaColIndex) {\n break;\n }\n if (delta < 0 && columnIndex < targetAriaColIndex) {\n break;\n }\n }\n return targetCell;\n}\n\nexport function setTabIndex(element: null | HTMLElement, tabIndex: number) {\n if (element && element.tabIndex !== tabIndex) {\n element.tabIndex = tabIndex;\n }\n}\n"]}
@@ -1,13 +1,13 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "root": "awsui_root_4yi2u_w83tx_93",
5
- "outline": "awsui_outline_4yi2u_w83tx_107",
6
- "toggle-control": "awsui_toggle-control_4yi2u_w83tx_126",
7
- "toggle-control-checked": "awsui_toggle-control-checked_4yi2u_w83tx_135",
8
- "toggle-control-disabled": "awsui_toggle-control-disabled_4yi2u_w83tx_138",
9
- "toggle-handle": "awsui_toggle-handle_4yi2u_w83tx_145",
10
- "toggle-handle-checked": "awsui_toggle-handle-checked_4yi2u_w83tx_157",
11
- "toggle-handle-disabled": "awsui_toggle-handle-disabled_4yi2u_w83tx_160"
4
+ "root": "awsui_root_4yi2u_7wj4c_93",
5
+ "outline": "awsui_outline_4yi2u_7wj4c_107",
6
+ "toggle-control": "awsui_toggle-control_4yi2u_7wj4c_126",
7
+ "toggle-control-checked": "awsui_toggle-control-checked_4yi2u_7wj4c_136",
8
+ "toggle-control-disabled": "awsui_toggle-control-disabled_4yi2u_7wj4c_139",
9
+ "toggle-handle": "awsui_toggle-handle_4yi2u_7wj4c_146",
10
+ "toggle-handle-checked": "awsui_toggle-handle-checked_4yi2u_7wj4c_158",
11
+ "toggle-handle-disabled": "awsui_toggle-handle-disabled_4yi2u_7wj4c_161"
12
12
  };
13
13
 
@@ -90,7 +90,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
90
90
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
91
91
  SPDX-License-Identifier: Apache-2.0
92
92
  */
93
- .awsui_root_4yi2u_w83tx_93:not(#\9) {
93
+ .awsui_root_4yi2u_7wj4c_93:not(#\9) {
94
94
  /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
95
95
  border-collapse: separate;
96
96
  border-spacing: 0;
@@ -130,14 +130,14 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
130
130
  display: flex;
131
131
  }
132
132
 
133
- .awsui_outline_4yi2u_w83tx_107:not(#\9) {
133
+ .awsui_outline_4yi2u_7wj4c_107:not(#\9) {
134
134
  position: relative;
135
135
  }
136
- .awsui_outline_4yi2u_w83tx_107:not(#\9) {
136
+ .awsui_outline_4yi2u_7wj4c_107:not(#\9) {
137
137
  outline: 2px dotted transparent;
138
138
  outline-offset: calc(2px - 1px);
139
139
  }
140
- .awsui_outline_4yi2u_w83tx_107:not(#\9)::before {
140
+ .awsui_outline_4yi2u_7wj4c_107:not(#\9)::before {
141
141
  content: " ";
142
142
  display: block;
143
143
  position: absolute;
@@ -149,7 +149,8 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
149
149
  box-shadow: 0 0 0 2px var(--color-border-item-focused-b2ntyl, #0972d3);
150
150
  }
151
151
 
152
- .awsui_toggle-control_4yi2u_w83tx_126:not(#\9) {
152
+ .awsui_toggle-control_4yi2u_7wj4c_126:not(#\9) {
153
+ forced-color-adjust: none;
153
154
  margin-top: calc((var(--line-height-body-m-30ar75, 20px) - 16px) / 2);
154
155
  min-height: 16px;
155
156
  min-width: 24px;
@@ -158,17 +159,17 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
158
159
  background: var(--color-background-toggle-default-6qtbef, #414d5c);
159
160
  border-radius: 8px;
160
161
  }
161
- .awsui_toggle-control-checked_4yi2u_w83tx_135:not(#\9) {
162
+ .awsui_toggle-control-checked_4yi2u_7wj4c_136:not(#\9) {
162
163
  background: var(--color-background-control-checked-w517i0, #0972d3);
163
164
  }
164
- .awsui_toggle-control-disabled_4yi2u_w83tx_138:not(#\9) {
165
+ .awsui_toggle-control-disabled_4yi2u_7wj4c_139:not(#\9) {
165
166
  background: var(--color-background-control-disabled-pwkvgd, #d1d5db);
166
167
  }
167
- .awsui_toggle-control-disabled_4yi2u_w83tx_138.awsui_toggle-control-checked_4yi2u_w83tx_135:not(#\9) {
168
+ .awsui_toggle-control-disabled_4yi2u_7wj4c_139.awsui_toggle-control-checked_4yi2u_7wj4c_136:not(#\9) {
168
169
  background: var(--color-background-toggle-checked-disabled-uqvx2z, #b5d6f4);
169
170
  }
170
171
 
171
- .awsui_toggle-handle_4yi2u_w83tx_145:not(#\9) {
172
+ .awsui_toggle-handle_4yi2u_7wj4c_146:not(#\9) {
172
173
  display: block;
173
174
  position: absolute;
174
175
  border-radius: 6px;
@@ -180,20 +181,20 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
180
181
  left: 2px;
181
182
  transition: transform var(--motion-duration-fast-sbm3r7, 90ms) var(--motion-easing-ease-out-quart-rrej5m, cubic-bezier(0.165, 0.84, 0.44, 1)), background-color var(--motion-duration-fast-sbm3r7, 90ms) var(--motion-easing-ease-out-quart-rrej5m, cubic-bezier(0.165, 0.84, 0.44, 1));
182
183
  }
183
- .awsui_toggle-handle-checked_4yi2u_w83tx_157:not(#\9) {
184
+ .awsui_toggle-handle-checked_4yi2u_7wj4c_158:not(#\9) {
184
185
  transform: translateX(8px);
185
186
  }
186
- .awsui_toggle-handle-disabled_4yi2u_w83tx_160:not(#\9) {
187
+ .awsui_toggle-handle-disabled_4yi2u_7wj4c_161:not(#\9) {
187
188
  background: var(--color-foreground-control-disabled-zmz2k2, #ffffff);
188
189
  box-shadow: none;
189
190
  }
190
191
  @media (prefers-reduced-motion: reduce) {
191
- .awsui_toggle-handle_4yi2u_w83tx_145:not(#\9) {
192
+ .awsui_toggle-handle_4yi2u_7wj4c_146:not(#\9) {
192
193
  animation: none;
193
194
  transition: none;
194
195
  }
195
196
  }
196
- .awsui-motion-disabled .awsui_toggle-handle_4yi2u_w83tx_145:not(#\9), .awsui-mode-entering .awsui_toggle-handle_4yi2u_w83tx_145:not(#\9) {
197
+ .awsui-motion-disabled .awsui_toggle-handle_4yi2u_7wj4c_146:not(#\9), .awsui-mode-entering .awsui_toggle-handle_4yi2u_7wj4c_146:not(#\9) {
197
198
  animation: none;
198
199
  transition: none;
199
200
  }
@@ -2,13 +2,13 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "root": "awsui_root_4yi2u_w83tx_93",
6
- "outline": "awsui_outline_4yi2u_w83tx_107",
7
- "toggle-control": "awsui_toggle-control_4yi2u_w83tx_126",
8
- "toggle-control-checked": "awsui_toggle-control-checked_4yi2u_w83tx_135",
9
- "toggle-control-disabled": "awsui_toggle-control-disabled_4yi2u_w83tx_138",
10
- "toggle-handle": "awsui_toggle-handle_4yi2u_w83tx_145",
11
- "toggle-handle-checked": "awsui_toggle-handle-checked_4yi2u_w83tx_157",
12
- "toggle-handle-disabled": "awsui_toggle-handle-disabled_4yi2u_w83tx_160"
5
+ "root": "awsui_root_4yi2u_7wj4c_93",
6
+ "outline": "awsui_outline_4yi2u_7wj4c_107",
7
+ "toggle-control": "awsui_toggle-control_4yi2u_7wj4c_126",
8
+ "toggle-control-checked": "awsui_toggle-control-checked_4yi2u_7wj4c_136",
9
+ "toggle-control-disabled": "awsui_toggle-control-disabled_4yi2u_7wj4c_139",
10
+ "toggle-handle": "awsui_toggle-handle_4yi2u_7wj4c_146",
11
+ "toggle-handle-checked": "awsui_toggle-handle-checked_4yi2u_7wj4c_158",
12
+ "toggle-handle-disabled": "awsui_toggle-handle-disabled_4yi2u_7wj4c_161"
13
13
  };
14
14