@cloudscape-design/components-themeable 3.0.974 → 3.0.976

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 (131) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/drawer/styles.scss +14 -0
  3. package/lib/internal/scss/link/styles.scss +1 -1
  4. package/lib/internal/template/annotation-context/index.js +2 -2
  5. package/lib/internal/template/annotation-context/index.js.map +1 -1
  6. package/lib/internal/template/app-layout/runtime-drawer/index.js +1 -1
  7. package/lib/internal/template/app-layout/runtime-drawer/index.js.map +1 -1
  8. package/lib/internal/template/app-layout/runtime-drawer/use-runtime-drawer-context.d.ts +6 -0
  9. package/lib/internal/template/app-layout/runtime-drawer/use-runtime-drawer-context.d.ts.map +1 -0
  10. package/lib/internal/template/app-layout/runtime-drawer/use-runtime-drawer-context.js +29 -0
  11. package/lib/internal/template/app-layout/runtime-drawer/use-runtime-drawer-context.js.map +1 -0
  12. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.d.ts.map +1 -1
  13. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.js +1 -1
  14. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawer.js.map +1 -1
  15. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.d.ts.map +1 -1
  16. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.js +1 -1
  17. package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.js.map +1 -1
  18. package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/index.d.ts.map +1 -1
  19. package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/index.js +1 -1
  20. package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/index.js.map +1 -1
  21. package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.d.ts.map +1 -1
  22. package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.js +7 -2
  23. package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/trigger-button/index.js.map +1 -1
  24. package/lib/internal/template/app-layout-toolbar/analytics-metadata/interfaces.d.ts +18 -0
  25. package/lib/internal/template/app-layout-toolbar/analytics-metadata/interfaces.d.ts.map +1 -0
  26. package/lib/internal/template/app-layout-toolbar/analytics-metadata/interfaces.js +4 -0
  27. package/lib/internal/template/app-layout-toolbar/analytics-metadata/interfaces.js.map +1 -0
  28. package/lib/internal/template/app-layout-toolbar/index.d.ts.map +1 -1
  29. package/lib/internal/template/app-layout-toolbar/index.js +9 -1
  30. package/lib/internal/template/app-layout-toolbar/index.js.map +1 -1
  31. package/lib/internal/template/date-input/internal.d.ts.map +1 -1
  32. package/lib/internal/template/date-input/internal.js +3 -16
  33. package/lib/internal/template/date-input/internal.js.map +1 -1
  34. package/lib/internal/template/date-input/utils.d.ts +7 -0
  35. package/lib/internal/template/date-input/utils.d.ts.map +1 -0
  36. package/lib/internal/template/date-input/utils.js +25 -0
  37. package/lib/internal/template/date-input/utils.js.map +1 -0
  38. package/lib/internal/template/date-range-picker/calendar/grids/index.js.map +1 -1
  39. package/lib/internal/template/date-range-picker/calendar/grids/interfaces.d.ts +3 -4
  40. package/lib/internal/template/date-range-picker/calendar/grids/interfaces.d.ts.map +1 -1
  41. package/lib/internal/template/date-range-picker/calendar/grids/interfaces.js.map +1 -1
  42. package/lib/internal/template/date-range-picker/calendar/header/header-button.d.ts +0 -2
  43. package/lib/internal/template/date-range-picker/calendar/header/header-button.d.ts.map +1 -1
  44. package/lib/internal/template/date-range-picker/calendar/header/header-button.js.map +1 -1
  45. package/lib/internal/template/date-range-picker/calendar/header/index.d.ts +2 -3
  46. package/lib/internal/template/date-range-picker/calendar/header/index.d.ts.map +1 -1
  47. package/lib/internal/template/date-range-picker/calendar/header/index.js.map +1 -1
  48. package/lib/internal/template/date-range-picker/calendar/index.d.ts +2 -2
  49. package/lib/internal/template/date-range-picker/calendar/index.d.ts.map +1 -1
  50. package/lib/internal/template/date-range-picker/calendar/index.js.map +1 -1
  51. package/lib/internal/template/date-range-picker/calendar/range-inputs.d.ts +3 -3
  52. package/lib/internal/template/date-range-picker/calendar/range-inputs.d.ts.map +1 -1
  53. package/lib/internal/template/date-range-picker/calendar/range-inputs.js.map +1 -1
  54. package/lib/internal/template/date-range-picker/dropdown.d.ts +2 -2
  55. package/lib/internal/template/date-range-picker/dropdown.d.ts.map +1 -1
  56. package/lib/internal/template/date-range-picker/dropdown.js.map +1 -1
  57. package/lib/internal/template/date-range-picker/interfaces.d.ts +2 -7
  58. package/lib/internal/template/date-range-picker/interfaces.d.ts.map +1 -1
  59. package/lib/internal/template/date-range-picker/interfaces.js.map +1 -1
  60. package/lib/internal/template/date-range-picker/relative-range/index.d.ts +2 -2
  61. package/lib/internal/template/date-range-picker/relative-range/index.d.ts.map +1 -1
  62. package/lib/internal/template/date-range-picker/relative-range/index.js.map +1 -1
  63. package/lib/internal/template/drawer/implementation.d.ts +1 -1
  64. package/lib/internal/template/drawer/implementation.d.ts.map +1 -1
  65. package/lib/internal/template/drawer/implementation.js +4 -2
  66. package/lib/internal/template/drawer/implementation.js.map +1 -1
  67. package/lib/internal/template/drawer/interfaces.d.ts +4 -0
  68. package/lib/internal/template/drawer/interfaces.d.ts.map +1 -1
  69. package/lib/internal/template/drawer/interfaces.js.map +1 -1
  70. package/lib/internal/template/drawer/styles.css.js +6 -5
  71. package/lib/internal/template/drawer/styles.scoped.css +23 -10
  72. package/lib/internal/template/drawer/styles.selectors.js +6 -5
  73. package/lib/internal/template/i18n/provider.js +2 -2
  74. package/lib/internal/template/i18n/provider.js.map +1 -1
  75. package/lib/internal/template/internal/components/drag-handle/index.d.ts.map +1 -1
  76. package/lib/internal/template/internal/components/drag-handle/index.js +2 -2
  77. package/lib/internal/template/internal/components/drag-handle/index.js.map +1 -1
  78. package/lib/internal/template/internal/components/drag-handle/interfaces.d.ts +2 -1
  79. package/lib/internal/template/internal/components/drag-handle/interfaces.d.ts.map +1 -1
  80. package/lib/internal/template/internal/components/drag-handle/interfaces.js.map +1 -1
  81. package/lib/internal/template/internal/components/drag-handle-wrapper/index.d.ts +1 -1
  82. package/lib/internal/template/internal/components/drag-handle-wrapper/index.d.ts.map +1 -1
  83. package/lib/internal/template/internal/components/drag-handle-wrapper/index.js +8 -2
  84. package/lib/internal/template/internal/components/drag-handle-wrapper/index.js.map +1 -1
  85. package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.d.ts +2 -0
  86. package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.d.ts.map +1 -1
  87. package/lib/internal/template/internal/components/drag-handle-wrapper/interfaces.js.map +1 -1
  88. package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.d.ts.map +1 -1
  89. package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.js +2 -1
  90. package/lib/internal/template/internal/components/drag-handle-wrapper/portal-overlay.js.map +1 -1
  91. package/lib/internal/template/internal/environment.js +1 -1
  92. package/lib/internal/template/internal/environment.json +1 -1
  93. package/lib/internal/template/internal/generated/theming/index.cjs +4 -0
  94. package/lib/internal/template/internal/generated/theming/index.cjs.d.ts +18 -0
  95. package/lib/internal/template/internal/generated/theming/index.d.ts +18 -0
  96. package/lib/internal/template/internal/generated/theming/index.js +4 -0
  97. package/lib/internal/template/internal/hooks/use-base-component/index.d.ts.map +1 -1
  98. package/lib/internal/template/internal/hooks/use-base-component/index.js +8 -5
  99. package/lib/internal/template/internal/hooks/use-base-component/index.js.map +1 -1
  100. package/lib/internal/template/internal/plugins/controllers/alert-flash-content.d.ts +2 -0
  101. package/lib/internal/template/internal/plugins/controllers/alert-flash-content.d.ts.map +1 -1
  102. package/lib/internal/template/internal/plugins/controllers/alert-flash-content.js.map +1 -1
  103. package/lib/internal/template/internal/plugins/controllers/drawers.d.ts +6 -0
  104. package/lib/internal/template/internal/plugins/controllers/drawers.d.ts.map +1 -1
  105. package/lib/internal/template/internal/plugins/controllers/drawers.js +17 -1
  106. package/lib/internal/template/internal/plugins/controllers/drawers.js.map +1 -1
  107. package/lib/internal/template/internal/plugins/helpers/use-discovered-content.d.ts +7 -7
  108. package/lib/internal/template/internal/plugins/helpers/use-discovered-content.d.ts.map +1 -1
  109. package/lib/internal/template/internal/plugins/helpers/use-discovered-content.js +5 -2
  110. package/lib/internal/template/internal/plugins/helpers/use-discovered-content.js.map +1 -1
  111. package/lib/internal/template/link/styles.css.js +20 -20
  112. package/lib/internal/template/link/styles.scoped.css +73 -71
  113. package/lib/internal/template/link/styles.selectors.js +20 -20
  114. package/lib/internal/template/popover/container.d.ts.map +1 -1
  115. package/lib/internal/template/popover/container.js +20 -7
  116. package/lib/internal/template/popover/container.js.map +1 -1
  117. package/lib/internal/template/table/body-cell/inline-editor.d.ts.map +1 -1
  118. package/lib/internal/template/table/body-cell/inline-editor.js +2 -1
  119. package/lib/internal/template/table/body-cell/inline-editor.js.map +1 -1
  120. package/lib/internal/template/test-utils/dom/drawer/index.d.ts +1 -0
  121. package/lib/internal/template/test-utils/dom/drawer/index.js +3 -0
  122. package/lib/internal/template/test-utils/dom/drawer/index.js.map +1 -1
  123. package/lib/internal/template/test-utils/selectors/drawer/index.d.ts +1 -0
  124. package/lib/internal/template/test-utils/selectors/drawer/index.js +3 -0
  125. package/lib/internal/template/test-utils/selectors/drawer/index.js.map +1 -1
  126. package/lib/internal/template/test-utils/tsconfig.tsbuildinfo +1 -1
  127. package/package.json +1 -1
  128. package/lib/internal/template/internal/hooks/use-telemetry/index.d.ts +0 -3
  129. package/lib/internal/template/internal/hooks/use-telemetry/index.d.ts.map +0 -1
  130. package/lib/internal/template/internal/hooks/use-telemetry/index.js +0 -12
  131. package/lib/internal/template/internal/hooks/use-telemetry/index.js.map +0 -1
@@ -2,10 +2,11 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "drawer": "awsui_drawer_1sxt8_24o8z_181",
6
- "header": "awsui_header_1sxt8_24o8z_214",
7
- "with-toolbar": "awsui_with-toolbar_1sxt8_24o8z_227",
8
- "content-with-paddings": "awsui_content-with-paddings_1sxt8_24o8z_245",
9
- "test-utils-drawer-content": "awsui_test-utils-drawer-content_1sxt8_24o8z_252"
5
+ "drawer": "awsui_drawer_1sxt8_6ymvz_181",
6
+ "header": "awsui_header_1sxt8_6ymvz_214",
7
+ "with-toolbar": "awsui_with-toolbar_1sxt8_6ymvz_229",
8
+ "header-actions": "awsui_header-actions_1sxt8_6ymvz_247",
9
+ "content-with-paddings": "awsui_content-with-paddings_1sxt8_6ymvz_258",
10
+ "test-utils-drawer-content": "awsui_test-utils-drawer-content_1sxt8_6ymvz_265"
10
11
  };
11
12
 
@@ -3,7 +3,7 @@
3
3
  import React, { useContext } from 'react';
4
4
  import IntlMessageFormat from 'intl-messageformat';
5
5
  import { warnOnce } from '@cloudscape-design/component-toolkit/internal';
6
- import { useTelemetry } from '../internal/hooks/use-telemetry';
6
+ import useBaseComponent from '../internal/hooks/use-base-component';
7
7
  import { applyDisplayName } from '../internal/utils/apply-display-name';
8
8
  import { InternalI18nContext } from './context';
9
9
  import { getMatchableLocales } from './get-matchable-locales';
@@ -14,7 +14,7 @@ import { getMatchableLocales } from './get-matchable-locales';
14
14
  */
15
15
  const I18nMessagesContext = React.createContext({});
16
16
  export function I18nProvider({ messages: messagesArray, locale: providedLocale, children }) {
17
- useTelemetry('I18nProvider');
17
+ useBaseComponent('I18nProvider');
18
18
  if (typeof document === 'undefined' && !providedLocale) {
19
19
  warnOnce('I18nProvider', 'An explicit locale was not provided during server rendering. This can lead to a hydration mismatch on the client.');
20
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/i18n/provider.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,iBAAiB,MAAM,oBAA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AAC,SAAS,CAAC,EAAE;wBAC7D,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC;qBAC9F;iBACF;aACF;SACF;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useContext } from 'react';\nimport { MessageFormatElement } from '@formatjs/icu-messageformat-parser';\nimport IntlMessageFormat from 'intl-messageformat';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useTelemetry } from '../internal/hooks/use-telemetry';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { CustomHandler, FormatFunction, InternalI18nContext } from './context';\nimport { getMatchableLocales } from './get-matchable-locales';\n\nexport interface I18nProviderProps {\n messages: ReadonlyArray<I18nProviderProps.Messages>;\n locale?: string;\n children: React.ReactNode;\n}\n\nexport namespace I18nProviderProps {\n export interface Messages {\n [namespace: string]: {\n [locale: string]: {\n [component: string]: {\n [key: string]: string | MessageFormatElement[];\n };\n };\n };\n }\n}\n\n/**\n * Context to send parent messages down to child I18nProviders. This isn't\n * included in the InternalI18nContext to avoid components from depending on\n * MessageFormatElement types.\n */\nconst I18nMessagesContext = React.createContext<I18nProviderProps.Messages>({});\n\nexport function I18nProvider({ messages: messagesArray, locale: providedLocale, children }: I18nProviderProps) {\n useTelemetry('I18nProvider');\n\n if (typeof document === 'undefined' && !providedLocale) {\n warnOnce(\n 'I18nProvider',\n 'An explicit locale was not provided during server rendering. This can lead to a hydration mismatch on the client.'\n );\n }\n\n // The provider accepts an array of configs. We merge parent messages and\n // flatten the tree early on so that accesses by key are simpler and faster.\n const parentMessages = useContext(I18nMessagesContext);\n const messages = mergeMessages([parentMessages, ...messagesArray]);\n\n let locale: string;\n if (providedLocale) {\n // If a locale is explicitly provided, use the string directly.\n // Locales have a recommended case, but are matched case-insensitively,\n // so we lowercase it internally.\n locale = providedLocale.toLowerCase();\n } else if (typeof document !== 'undefined' && document.documentElement.lang) {\n // Otherwise, use the value provided in the HTML tag.\n locale = document.documentElement.lang.toLowerCase();\n } else {\n // Lastly, fall back to English.\n locale = 'en';\n }\n\n // Create a per-render cache of messages and IntlMessageFormat instances.\n // Not memoizing it allows us to reset the cache when the component rerenders\n // with potentially different locale or messages. We expect this component to\n // be placed above AppLayout and therefore rerender very infrequently.\n const localeFormatterCache = new Map<string, IntlMessageFormat>();\n\n const format: FormatFunction = <ReturnValue, FormatFnArgs extends Record<string, string | number>>(\n namespace: string,\n component: string,\n key: string,\n provided: ReturnValue,\n customHandler?: CustomHandler<ReturnValue, FormatFnArgs>\n ): ReturnValue => {\n // A general rule in this library is that undefined is basically\n // treated as \"not provided\". So even if a user explicitly provides an\n // undefined value, it will default to i18n provider values.\n if (provided !== undefined) {\n return provided;\n }\n\n const cacheKey = `${namespace}.${component}.${key}`;\n let intlMessageFormat: IntlMessageFormat;\n\n const cachedFormatter = localeFormatterCache.get(cacheKey);\n if (cachedFormatter) {\n // If an IntlMessageFormat instance was cached for this locale, just use that.\n intlMessageFormat = cachedFormatter;\n } else {\n // Widen the locale string (e.g. en-GB -> en) until we find a locale\n // that contains the message we need.\n let message: string | MessageFormatElement[] | undefined;\n const matchableLocales = getMatchableLocales(locale);\n for (const matchableLocale of matchableLocales) {\n message = messages?.[namespace]?.[matchableLocale]?.[component]?.[key];\n if (message !== undefined) {\n break;\n }\n }\n\n // If a message wasn't found, exit early.\n if (message === undefined) {\n return provided;\n }\n\n // Lazily create an IntlMessageFormat object for this key.\n intlMessageFormat = new IntlMessageFormat(message, locale);\n localeFormatterCache.set(cacheKey, intlMessageFormat);\n }\n\n if (customHandler) {\n return customHandler(args => intlMessageFormat.format(args) as string);\n }\n // Assuming `T extends string` since a customHandler wasn't provided.\n return intlMessageFormat.format() as ReturnValue;\n };\n\n return (\n <InternalI18nContext.Provider value={{ locale, format }}>\n <I18nMessagesContext.Provider value={messages}>{children}</I18nMessagesContext.Provider>\n </InternalI18nContext.Provider>\n );\n}\n\napplyDisplayName(I18nProvider, 'I18nProvider');\n\nfunction mergeMessages(sources: ReadonlyArray<I18nProviderProps.Messages>): I18nProviderProps.Messages {\n const result: I18nProviderProps.Messages = {};\n for (const messages of sources) {\n for (const namespace in messages) {\n if (!(namespace in result)) {\n result[namespace] = {};\n }\n for (const casedLocale in messages[namespace]) {\n const locale = casedLocale.toLowerCase();\n if (!(locale in result[namespace])) {\n result[namespace][locale] = {};\n }\n for (const component in messages[namespace][casedLocale]) {\n if (!(component in result[namespace][locale])) {\n result[namespace][locale][component] = {};\n }\n for (const key in messages[namespace][casedLocale][component]) {\n result[namespace][locale][component][key] = messages[namespace][casedLocale][component][key];\n }\n }\n }\n }\n }\n return result;\n}\n"]}
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/i18n/provider.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,iBAAiB,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAiC,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAoB9D;;;;GAIG;AACH,MAAM,mBAAmB,GAAG,KAAK,CAAC,aAAa,CAA6B,EAAE,CAAC,CAAC;AAEhF,MAAM,UAAU,YAAY,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ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,IAAI,OAAO,EAAE;QAC9B,KAAK,MAAM,SAAS,IAAI,QAAQ,EAAE;YAChC,IAAI,CAAC,CAAC,SAAS,IAAI,MAAM,CAAC,EAAE;gBAC1B,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;aACxB;YACD,KAAK,MAAM,WAAW,IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE;gBAC7C,MAAM,MAAM,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;gBACzC,IAAI,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE;oBAClC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;iBAChC;gBACD,KAAK,MAAM,SAAS,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,EAAE;oBACxD,IAAI,CAAC,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE;wBAC7C,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;qBAC3C;oBACD,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,EAAE;wBAC7D,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC;qBAC9F;iBACF;aACF;SACF;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useContext } from 'react';\nimport { MessageFormatElement } from '@formatjs/icu-messageformat-parser';\nimport IntlMessageFormat from 'intl-messageformat';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { CustomHandler, FormatFunction, InternalI18nContext } from './context';\nimport { getMatchableLocales } from './get-matchable-locales';\n\nexport interface I18nProviderProps {\n messages: ReadonlyArray<I18nProviderProps.Messages>;\n locale?: string;\n children: React.ReactNode;\n}\n\nexport namespace I18nProviderProps {\n export interface Messages {\n [namespace: string]: {\n [locale: string]: {\n [component: string]: {\n [key: string]: string | MessageFormatElement[];\n };\n };\n };\n }\n}\n\n/**\n * Context to send parent messages down to child I18nProviders. This isn't\n * included in the InternalI18nContext to avoid components from depending on\n * MessageFormatElement types.\n */\nconst I18nMessagesContext = React.createContext<I18nProviderProps.Messages>({});\n\nexport function I18nProvider({ messages: messagesArray, locale: providedLocale, children }: I18nProviderProps) {\n useBaseComponent('I18nProvider');\n\n if (typeof document === 'undefined' && !providedLocale) {\n warnOnce(\n 'I18nProvider',\n 'An explicit locale was not provided during server rendering. This can lead to a hydration mismatch on the client.'\n );\n }\n\n // The provider accepts an array of configs. We merge parent messages and\n // flatten the tree early on so that accesses by key are simpler and faster.\n const parentMessages = useContext(I18nMessagesContext);\n const messages = mergeMessages([parentMessages, ...messagesArray]);\n\n let locale: string;\n if (providedLocale) {\n // If a locale is explicitly provided, use the string directly.\n // Locales have a recommended case, but are matched case-insensitively,\n // so we lowercase it internally.\n locale = providedLocale.toLowerCase();\n } else if (typeof document !== 'undefined' && document.documentElement.lang) {\n // Otherwise, use the value provided in the HTML tag.\n locale = document.documentElement.lang.toLowerCase();\n } else {\n // Lastly, fall back to English.\n locale = 'en';\n }\n\n // Create a per-render cache of messages and IntlMessageFormat instances.\n // Not memoizing it allows us to reset the cache when the component rerenders\n // with potentially different locale or messages. We expect this component to\n // be placed above AppLayout and therefore rerender very infrequently.\n const localeFormatterCache = new Map<string, IntlMessageFormat>();\n\n const format: FormatFunction = <ReturnValue, FormatFnArgs extends Record<string, string | number>>(\n namespace: string,\n component: string,\n key: string,\n provided: ReturnValue,\n customHandler?: CustomHandler<ReturnValue, FormatFnArgs>\n ): ReturnValue => {\n // A general rule in this library is that undefined is basically\n // treated as \"not provided\". So even if a user explicitly provides an\n // undefined value, it will default to i18n provider values.\n if (provided !== undefined) {\n return provided;\n }\n\n const cacheKey = `${namespace}.${component}.${key}`;\n let intlMessageFormat: IntlMessageFormat;\n\n const cachedFormatter = localeFormatterCache.get(cacheKey);\n if (cachedFormatter) {\n // If an IntlMessageFormat instance was cached for this locale, just use that.\n intlMessageFormat = cachedFormatter;\n } else {\n // Widen the locale string (e.g. en-GB -> en) until we find a locale\n // that contains the message we need.\n let message: string | MessageFormatElement[] | undefined;\n const matchableLocales = getMatchableLocales(locale);\n for (const matchableLocale of matchableLocales) {\n message = messages?.[namespace]?.[matchableLocale]?.[component]?.[key];\n if (message !== undefined) {\n break;\n }\n }\n\n // If a message wasn't found, exit early.\n if (message === undefined) {\n return provided;\n }\n\n // Lazily create an IntlMessageFormat object for this key.\n intlMessageFormat = new IntlMessageFormat(message, locale);\n localeFormatterCache.set(cacheKey, intlMessageFormat);\n }\n\n if (customHandler) {\n return customHandler(args => intlMessageFormat.format(args) as string);\n }\n // Assuming `T extends string` since a customHandler wasn't provided.\n return intlMessageFormat.format() as ReturnValue;\n };\n\n return (\n <InternalI18nContext.Provider value={{ locale, format }}>\n <I18nMessagesContext.Provider value={messages}>{children}</I18nMessagesContext.Provider>\n </InternalI18nContext.Provider>\n );\n}\n\napplyDisplayName(I18nProvider, 'I18nProvider');\n\nfunction mergeMessages(sources: ReadonlyArray<I18nProviderProps.Messages>): I18nProviderProps.Messages {\n const result: I18nProviderProps.Messages = {};\n for (const messages of sources) {\n for (const namespace in messages) {\n if (!(namespace in result)) {\n result[namespace] = {};\n }\n for (const casedLocale in messages[namespace]) {\n const locale = casedLocale.toLowerCase();\n if (!(locale in result[namespace])) {\n result[namespace][locale] = {};\n }\n for (const component in messages[namespace][casedLocale]) {\n if (!(component in result[namespace][locale])) {\n result[namespace][locale][component] = {};\n }\n for (const key in messages[namespace][casedLocale][component]) {\n result[namespace][locale][component][key] = messages[namespace][casedLocale][component][key];\n }\n }\n }\n }\n }\n return result;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAK1C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,QAAA,MAAM,kBAAkB,iFA2CvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAK1C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,QAAA,MAAM,kBAAkB,iFA6CvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -6,9 +6,9 @@ import { getBaseProps } from '../../base-component';
6
6
  import DragHandleWrapper from '../drag-handle-wrapper';
7
7
  import DragHandleButton from './button';
8
8
  const InternalDragHandle = forwardRef((_a, ref) => {
9
- var { variant, size, ariaLabel, ariaLabelledBy, ariaDescribedby, tooltipText, ariaValue, disabled, directions = {}, onPointerDown, onKeyDown, onDirectionClick } = _a, rest = __rest(_a, ["variant", "size", "ariaLabel", "ariaLabelledBy", "ariaDescribedby", "tooltipText", "ariaValue", "disabled", "directions", "onPointerDown", "onKeyDown", "onDirectionClick"]);
9
+ var { variant, size, ariaLabel, ariaLabelledBy, ariaDescribedby, tooltipText, ariaValue, disabled, directions = {}, onPointerDown, onKeyDown, onDirectionClick, triggerMode } = _a, rest = __rest(_a, ["variant", "size", "ariaLabel", "ariaLabelledBy", "ariaDescribedby", "tooltipText", "ariaValue", "disabled", "directions", "onPointerDown", "onKeyDown", "onDirectionClick", "triggerMode"]);
10
10
  const baseProps = getBaseProps(rest);
11
- return (React.createElement(DragHandleWrapper, { directions: !disabled ? directions : {}, tooltipText: tooltipText, onDirectionClick: onDirectionClick },
11
+ return (React.createElement(DragHandleWrapper, { directions: !disabled ? directions : {}, tooltipText: tooltipText, onDirectionClick: onDirectionClick, triggerMode: triggerMode },
12
12
  React.createElement(DragHandleButton, { ref: ref, className: baseProps.className, variant: variant, size: size, ariaLabel: ariaLabel, ariaLabelledBy: ariaLabelledBy, ariaDescribedby: ariaDescribedby, ariaValue: ariaValue, disabled: disabled, onPointerDown: onPointerDown, onKeyDown: onKeyDown })));
13
13
  });
14
14
  export default InternalDragHandle;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,gBAAgB,MAAM,UAAU,CAAC;AAKxC,MAAM,kBAAkB,GAAG,UAAU,CACnC,CACE,EAckB,EAClB,GAAuB,EACvB,EAAE;QAhBF,EACE,OAAO,EACP,IAAI,EACJ,SAAS,EACT,cAAc,EACd,eAAe,EACf,WAAW,EACX,SAAS,EACT,QAAQ,EACR,UAAU,GAAG,EAAE,EACf,aAAa,EACb,SAAS,EACT,gBAAgB,OAEA,EADb,IAAI,cAbT,6KAcC,CADQ;IAIT,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAErC,OAAO,CACL,oBAAC,iBAAiB,IAChB,UAAU,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EACvC,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB;QAElC,oBAAC,gBAAgB,IACf,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,CAAC,SAAS,EAC9B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS,GACpB,CACgB,CACrB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef } from 'react';\n\nimport { getBaseProps } from '../../base-component';\nimport DragHandleWrapper from '../drag-handle-wrapper';\nimport DragHandleButton from './button';\nimport { DragHandleProps } from './interfaces';\n\nexport { DragHandleProps };\n\nconst InternalDragHandle = forwardRef(\n (\n {\n variant,\n size,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedby,\n tooltipText,\n ariaValue,\n disabled,\n directions = {},\n onPointerDown,\n onKeyDown,\n onDirectionClick,\n ...rest\n }: DragHandleProps,\n ref: React.Ref<Element>\n ) => {\n const baseProps = getBaseProps(rest);\n\n return (\n <DragHandleWrapper\n directions={!disabled ? directions : {}}\n tooltipText={tooltipText}\n onDirectionClick={onDirectionClick}\n >\n <DragHandleButton\n ref={ref}\n className={baseProps.className}\n variant={variant}\n size={size}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n ariaDescribedby={ariaDescribedby}\n ariaValue={ariaValue}\n disabled={disabled}\n onPointerDown={onPointerDown}\n onKeyDown={onKeyDown}\n />\n </DragHandleWrapper>\n );\n }\n);\n\nexport default InternalDragHandle;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,gBAAgB,MAAM,UAAU,CAAC;AAKxC,MAAM,kBAAkB,GAAG,UAAU,CACnC,CACE,EAekB,EAClB,GAAuB,EACvB,EAAE;QAjBF,EACE,OAAO,EACP,IAAI,EACJ,SAAS,EACT,cAAc,EACd,eAAe,EACf,WAAW,EACX,SAAS,EACT,QAAQ,EACR,UAAU,GAAG,EAAE,EACf,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,WAAW,OAEK,EADb,IAAI,cAdT,4LAeC,CADQ;IAIT,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAErC,OAAO,CACL,oBAAC,iBAAiB,IAChB,UAAU,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EACvC,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,EAAE,WAAW;QAExB,oBAAC,gBAAgB,IACf,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,CAAC,SAAS,EAC9B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS,GACpB,CACgB,CACrB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef } from 'react';\n\nimport { getBaseProps } from '../../base-component';\nimport DragHandleWrapper from '../drag-handle-wrapper';\nimport DragHandleButton from './button';\nimport { DragHandleProps } from './interfaces';\n\nexport { DragHandleProps };\n\nconst InternalDragHandle = forwardRef(\n (\n {\n variant,\n size,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedby,\n tooltipText,\n ariaValue,\n disabled,\n directions = {},\n onPointerDown,\n onKeyDown,\n onDirectionClick,\n triggerMode,\n ...rest\n }: DragHandleProps,\n ref: React.Ref<Element>\n ) => {\n const baseProps = getBaseProps(rest);\n\n return (\n <DragHandleWrapper\n directions={!disabled ? directions : {}}\n tooltipText={tooltipText}\n onDirectionClick={onDirectionClick}\n triggerMode={triggerMode}\n >\n <DragHandleButton\n ref={ref}\n className={baseProps.className}\n variant={variant}\n size={size}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n ariaDescribedby={ariaDescribedby}\n ariaValue={ariaValue}\n disabled={disabled}\n onPointerDown={onPointerDown}\n onKeyDown={onKeyDown}\n />\n </DragHandleWrapper>\n );\n }\n);\n\nexport default InternalDragHandle;\n"]}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { Direction as WrapperDirection, DirectionState as WrapperDirectionState } from '../drag-handle-wrapper/interfaces';
2
+ import { Direction as WrapperDirection, DirectionState as WrapperDirectionState, TriggerMode } from '../drag-handle-wrapper/interfaces';
3
3
  export interface DragHandleProps {
4
4
  variant?: DragHandleProps.Variant;
5
5
  size?: DragHandleProps.Size;
@@ -14,6 +14,7 @@ export interface DragHandleProps {
14
14
  tooltipText?: string;
15
15
  directions?: Partial<Record<DragHandleProps.Direction, DragHandleProps.DirectionState>>;
16
16
  onDirectionClick?: (direction: DragHandleProps.Direction) => void;
17
+ triggerMode?: TriggerMode;
17
18
  }
18
19
  export declare namespace DragHandleProps {
19
20
  type Variant = 'drag-indicator' | 'resize-area' | 'resize-horizontal' | 'resize-vertical';
@@ -1 +1 @@
1
- {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ACjB,QAAQ,EAAE,MAAM,CAAC;KAClB;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n Direction as WrapperDirection,\n DirectionState as WrapperDirectionState,\n} from '../drag-handle-wrapper/interfaces';\n\nexport interface DragHandleProps {\n variant?: DragHandleProps.Variant;\n size?: DragHandleProps.Size;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n ariaDescribedby?: string;\n ariaValue?: DragHandleProps.AriaValue;\n disabled?: boolean;\n className?: string;\n onPointerDown?: React.PointerEventHandler;\n onKeyDown?: React.KeyboardEventHandler;\n\n tooltipText?: string;\n directions?: Partial<Record<DragHandleProps.Direction, DragHandleProps.DirectionState>>;\n onDirectionClick?: (direction: DragHandleProps.Direction) => void;\n}\n\nexport namespace DragHandleProps {\n export type Variant = 'drag-indicator' | 'resize-area' | 'resize-horizontal' | 'resize-vertical';\n\n export type Direction = WrapperDirection;\n export type DirectionState = WrapperDirectionState;\n\n export type Size = 'small' | 'normal';\n\n export interface AriaValue {\n valueMin: number;\n valueMax: number;\n valueNow: number;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n Direction as WrapperDirection,\n DirectionState as WrapperDirectionState,\n TriggerMode,\n} from '../drag-handle-wrapper/interfaces';\n\nexport interface DragHandleProps {\n variant?: DragHandleProps.Variant;\n size?: DragHandleProps.Size;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n ariaDescribedby?: string;\n ariaValue?: DragHandleProps.AriaValue;\n disabled?: boolean;\n className?: string;\n onPointerDown?: React.PointerEventHandler;\n onKeyDown?: React.KeyboardEventHandler;\n\n tooltipText?: string;\n directions?: Partial<Record<DragHandleProps.Direction, DragHandleProps.DirectionState>>;\n onDirectionClick?: (direction: DragHandleProps.Direction) => void;\n triggerMode?: TriggerMode;\n}\n\nexport namespace DragHandleProps {\n export type Variant = 'drag-indicator' | 'resize-area' | 'resize-horizontal' | 'resize-vertical';\n\n export type Direction = WrapperDirection;\n export type DirectionState = WrapperDirectionState;\n\n export type Size = 'small' | 'normal';\n\n export interface AriaValue {\n valueMin: number;\n valueMax: number;\n valueNow: number;\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { DragHandleWrapperProps } from './interfaces';
3
- export default function DragHandleWrapper({ directions, tooltipText, children, onDirectionClick, }: DragHandleWrapperProps): JSX.Element;
3
+ export default function DragHandleWrapper({ directions, tooltipText, children, onDirectionClick, triggerMode, }: DragHandleWrapperProps): JSX.Element;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/index.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAa,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAWjE,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,UAAU,EACV,WAAW,EACX,QAAQ,EACR,gBAAgB,GACjB,EAAE,sBAAsB,eAyMxB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/index.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAa,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAWjE,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,UAAU,EACV,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,WAAqB,GACtB,EAAE,sBAAsB,eA8MxB"}
@@ -13,7 +13,7 @@ import styles from './styles.css.js';
13
13
  // a drag. A little allowance is needed for usability reasons, but this number
14
14
  // isn't set in stone.
15
15
  const PRESS_DELTA_MAX = 3;
16
- export default function DragHandleWrapper({ directions, tooltipText, children, onDirectionClick, }) {
16
+ export default function DragHandleWrapper({ directions, tooltipText, children, onDirectionClick, triggerMode = 'focus', }) {
17
17
  const wrapperRef = useRef(null);
18
18
  const dragHandleRef = useRef(null);
19
19
  const [showTooltip, setShowTooltip] = useState(false);
@@ -33,7 +33,9 @@ export default function DragHandleWrapper({ directions, tooltipText, children, o
33
33
  // if the action that triggered the focus move was the result of a keypress.
34
34
  if (document.body.dataset.awsuiFocusVisible && !nodeContains(wrapperRef.current, event.relatedTarget)) {
35
35
  setShowTooltip(false);
36
- setShowButtons(true);
36
+ if (triggerMode === 'focus') {
37
+ setShowButtons(true);
38
+ }
37
39
  }
38
40
  };
39
41
  const onWrapperFocusOut = event => {
@@ -111,6 +113,10 @@ export default function DragHandleWrapper({ directions, tooltipText, children, o
111
113
  if (event.key === 'Escape') {
112
114
  setShowButtons(false);
113
115
  }
116
+ else if (triggerMode === 'keyboard-activate' && (event.key === 'Enter' || event.key === ' ')) {
117
+ // toggle buttons when Enter or space is pressed in 'keyboard-activate' triggerMode
118
+ setShowButtons(prevShowButtons => !prevShowButtons);
119
+ }
114
120
  else if (event.key !== 'Alt' && event.key !== 'Control' && event.key !== 'Meta' && event.key !== 'Shift') {
115
121
  // Pressing any other key will display the focus-visible ring around the
116
122
  // drag handle if it's in focus, so we should also show the buttons now.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,E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AC,wBAAwB,CAAC,YAAY,CAAC,GACrD,CACH,CACa,CACZ,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { nodeContains } from '@cloudscape-design/component-toolkit/dom';\n\nimport { getFirstFocusable } from '../focus-lock/utils';\nimport Tooltip from '../tooltip';\nimport DirectionButton from './direction-button';\nimport { Direction, DragHandleWrapperProps } from './interfaces';\nimport PortalOverlay from './portal-overlay';\n\nimport styles from './styles.css.js';\n\n// The amount of distance after pointer down that the cursor is allowed to\n// jitter for a subsequent mouseup to still register as a \"press\" instead of\n// a drag. A little allowance is needed for usability reasons, but this number\n// isn't set in stone.\nconst PRESS_DELTA_MAX = 3;\n\nexport default function DragHandleWrapper({\n directions,\n tooltipText,\n children,\n onDirectionClick,\n}: DragHandleWrapperProps) {\n const wrapperRef = useRef<HTMLDivElement | null>(null);\n const dragHandleRef = useRef<HTMLDivElement | null>(null);\n const [showTooltip, setShowTooltip] = useState(false);\n const [showButtons, setShowButtons] = useState(false);\n\n const isPointerDown = useRef(false);\n const initialPointerPosition = useRef<{ x: number; y: number } | undefined>();\n const didPointerDrag = useRef(false);\n\n // The tooltip (\"Drag or select to move/resize\") shouldn't show if clicking\n // on the handle wouldn't do anything.\n const isDisabled =\n !directions['block-start'] && !directions['block-end'] && !directions['inline-start'] && !directions['inline-end'];\n\n const onWrapperFocusIn: React.FocusEventHandler = event => {\n // The drag handle is focused when it's either tabbed to, or the pointer\n // is pressed on it. We exclude handling the pointer press in this handler,\n // since it could be the start of a drag event - the pointer stuff is\n // handled in the \"pointerup\" listener instead. In cases where focus is moved\n // to the button (by manually calling `.focus()`, the buttons should only appear)\n // if the action that triggered the focus move was the result of a keypress.\n if (document.body.dataset.awsuiFocusVisible && !nodeContains(wrapperRef.current, event.relatedTarget)) {\n setShowTooltip(false);\n setShowButtons(true);\n }\n };\n\n const onWrapperFocusOut: React.FocusEventHandler = event => {\n // Close the directional buttons when the focus leaves the drag handle.\n // \"focusout\" is also triggered when the user leaves the current tab, but\n // since it'll be returned when they switch back anyway, we exclude that\n // case by checking for `document.hasFocus()`.\n if (document.hasFocus() && !nodeContains(wrapperRef.current, event.relatedTarget)) {\n setShowButtons(false);\n }\n };\n\n useEffect(() => {\n const controller = new AbortController();\n\n // See `PRESS_DELTA_MAX` above. We need to differentiate between a \"click\"\n // and a \"drag\" action. We can say a \"click\" happens when a \"pointerdown\"\n // is followed by a \"pointerup\" with no \"pointermove\" between the two.\n // However, it would be a poor usability experience if a \"click\" isn't\n // registered because, while pressing my mouse, I moved it by just one\n // pixel, making it a \"drag\" instead. So we allow the pointer to move by\n // `PRESS_DELTA_MAX` pixels before setting `didPointerDrag` to true.\n document.addEventListener(\n 'pointermove',\n event => {\n if (\n isPointerDown.current &&\n initialPointerPosition.current &&\n (event.clientX > initialPointerPosition.current.x + PRESS_DELTA_MAX ||\n event.clientX < initialPointerPosition.current.x - PRESS_DELTA_MAX ||\n event.clientY > initialPointerPosition.current.y + PRESS_DELTA_MAX ||\n event.clientY < initialPointerPosition.current.y - PRESS_DELTA_MAX)\n ) {\n didPointerDrag.current = true;\n }\n },\n { signal: controller.signal }\n );\n\n // Shared behavior when a \"pointerdown\" state ends. This is shared so it\n // can be called for both \"pointercancel\" and \"pointerup\" events.\n const resetPointerDownState = () => {\n isPointerDown.current = false;\n initialPointerPosition.current = undefined;\n };\n\n document.addEventListener(\n 'pointercancel',\n () => {\n resetPointerDownState();\n },\n { signal: controller.signal }\n );\n\n document.addEventListener(\n 'pointerup',\n () => {\n if (isPointerDown.current && !didPointerDrag.current) {\n // The cursor didn't move much between \"pointerdown\" and \"pointerup\".\n // Handle this as a \"click\" instead of a \"drag\".\n setShowButtons(true);\n }\n resetPointerDownState();\n },\n { signal: controller.signal }\n );\n\n return () => controller.abort();\n }, []);\n\n const onHandlePointerDown: React.PointerEventHandler = event => {\n // Tooltip behavior: the tooltip should appear on hover, but disappear when\n // the pointer starts dragging (having the tooltip get in the way while\n // you're trying to drag upwards is annoying). Additionally, the tooltip\n // shouldn't reappear when dragging ends, but only when the pointer leaves\n // the drag handle and comes back.\n\n isPointerDown.current = true;\n didPointerDrag.current = false;\n initialPointerPosition.current = { x: event.clientX, y: event.clientY };\n setShowTooltip(false);\n };\n\n // Tooltip behavior: the tooltip should stay open when the cursor moves\n // from the drag handle into the tooltip content itself. This is why the\n // handler is set on the wrapper for both the drag handle and the tooltip.\n const onTooltipGroupPointerEnter: React.PointerEventHandler = () => {\n if (!isPointerDown.current) {\n setShowTooltip(true);\n }\n };\n const onTooltipGroupPointerLeave: React.PointerEventHandler = () => {\n setShowTooltip(false);\n };\n\n const onDragHandleKeyDown: React.KeyboardEventHandler = event => {\n // For accessibility reasons, pressing escape should should always close\n // the floating controls.\n if (event.key === 'Escape') {\n setShowButtons(false);\n } else if (event.key !== 'Alt' && event.key !== 'Control' && event.key !== 'Meta' && event.key !== 'Shift') {\n // Pressing any other key will display the focus-visible ring around the\n // drag handle if it's in focus, so we should also show the buttons now.\n setShowButtons(true);\n }\n };\n\n const onInternalDirectionClick = (direction: Direction) => {\n // Move focus back to the wrapper on click. This prevents focus from staying\n // on an aria-hidden control, and allows future keyboard events to be handled\n // cleanly using the drag handle's own handlers.\n if (dragHandleRef.current) {\n getFirstFocusable(dragHandleRef.current)?.focus();\n }\n onDirectionClick?.(direction);\n };\n\n return (\n <div\n className={clsx(styles['drag-handle-wrapper'], showButtons && styles['drag-handle-wrapper-open'])}\n ref={wrapperRef}\n onFocus={onWrapperFocusIn}\n onBlur={onWrapperFocusOut}\n >\n <div onPointerEnter={onTooltipGroupPointerEnter} onPointerLeave={onTooltipGroupPointerLeave}>\n <div\n className={styles['drag-handle']}\n ref={dragHandleRef}\n onPointerDown={onHandlePointerDown}\n onKeyDown={onDragHandleKeyDown}\n >\n {children}\n </div>\n\n {!isDisabled && !showButtons && showTooltip && tooltipText && (\n <Tooltip trackRef={dragHandleRef} value={tooltipText} onDismiss={() => setShowTooltip(false)} />\n )}\n </div>\n\n <PortalOverlay track={dragHandleRef.current} isDisabled={!showButtons}>\n {directions['block-start'] && (\n <DirectionButton\n show={!isDisabled && showButtons}\n direction=\"block-start\"\n state={directions['block-start']}\n onClick={() => onInternalDirectionClick('block-start')}\n />\n )}\n {directions['block-end'] && (\n <DirectionButton\n show={!isDisabled && showButtons}\n direction=\"block-end\"\n state={directions['block-end']}\n onClick={() => onInternalDirectionClick('block-end')}\n />\n )}\n {directions['inline-start'] && (\n <DirectionButton\n show={!isDisabled && showButtons}\n direction=\"inline-start\"\n state={directions['inline-start']}\n onClick={() => onInternalDirectionClick('inline-start')}\n />\n )}\n {directions['inline-end'] && (\n <DirectionButton\n show={!isDisabled && showButtons}\n direction=\"inline-end\"\n state={directions['inline-end']}\n onClick={() => onInternalDirectionClick('inline-end')}\n />\n )}\n </PortalOverlay>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAExE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,eAAe,MAAM,oBAAoB,CAAC;AAEjD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,0EAA0E;AAC1E,4EAA4E;AAC5E,8EAA8E;AAC9E,sBAAsB;AACtB,MAAM,eAAe,GAAG,CAAC,CAAC;AAE1B,MAAM,CAAC,O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// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { nodeContains } from '@cloudscape-design/component-toolkit/dom';\n\nimport { getFirstFocusable } from '../focus-lock/utils';\nimport Tooltip from '../tooltip';\nimport DirectionButton from './direction-button';\nimport { Direction, DragHandleWrapperProps } from './interfaces';\nimport PortalOverlay from './portal-overlay';\n\nimport styles from './styles.css.js';\n\n// The amount of distance after pointer down that the cursor is allowed to\n// jitter for a subsequent mouseup to still register as a \"press\" instead of\n// a drag. A little allowance is needed for usability reasons, but this number\n// isn't set in stone.\nconst PRESS_DELTA_MAX = 3;\n\nexport default function DragHandleWrapper({\n directions,\n tooltipText,\n children,\n onDirectionClick,\n triggerMode = 'focus',\n}: DragHandleWrapperProps) {\n const wrapperRef = useRef<HTMLDivElement | null>(null);\n const dragHandleRef = useRef<HTMLDivElement | null>(null);\n const [showTooltip, setShowTooltip] = useState(false);\n const [showButtons, setShowButtons] = useState(false);\n\n const isPointerDown = useRef(false);\n const initialPointerPosition = useRef<{ x: number; y: number } | undefined>();\n const didPointerDrag = useRef(false);\n\n // The tooltip (\"Drag or select to move/resize\") shouldn't show if clicking\n // on the handle wouldn't do anything.\n const isDisabled =\n !directions['block-start'] && !directions['block-end'] && !directions['inline-start'] && !directions['inline-end'];\n\n const onWrapperFocusIn: React.FocusEventHandler = event => {\n // The drag handle is focused when it's either tabbed to, or the pointer\n // is pressed on it. We exclude handling the pointer press in this handler,\n // since it could be the start of a drag event - the pointer stuff is\n // handled in the \"pointerup\" listener instead. In cases where focus is moved\n // to the button (by manually calling `.focus()`, the buttons should only appear)\n // if the action that triggered the focus move was the result of a keypress.\n if (document.body.dataset.awsuiFocusVisible && !nodeContains(wrapperRef.current, event.relatedTarget)) {\n setShowTooltip(false);\n if (triggerMode === 'focus') {\n setShowButtons(true);\n }\n }\n };\n\n const onWrapperFocusOut: React.FocusEventHandler = event => {\n // Close the directional buttons when the focus leaves the drag handle.\n // \"focusout\" is also triggered when the user leaves the current tab, but\n // since it'll be returned when they switch back anyway, we exclude that\n // case by checking for `document.hasFocus()`.\n if (document.hasFocus() && !nodeContains(wrapperRef.current, event.relatedTarget)) {\n setShowButtons(false);\n }\n };\n\n useEffect(() => {\n const controller = new AbortController();\n\n // See `PRESS_DELTA_MAX` above. We need to differentiate between a \"click\"\n // and a \"drag\" action. We can say a \"click\" happens when a \"pointerdown\"\n // is followed by a \"pointerup\" with no \"pointermove\" between the two.\n // However, it would be a poor usability experience if a \"click\" isn't\n // registered because, while pressing my mouse, I moved it by just one\n // pixel, making it a \"drag\" instead. So we allow the pointer to move by\n // `PRESS_DELTA_MAX` pixels before setting `didPointerDrag` to true.\n document.addEventListener(\n 'pointermove',\n event => {\n if (\n isPointerDown.current &&\n initialPointerPosition.current &&\n (event.clientX > initialPointerPosition.current.x + PRESS_DELTA_MAX ||\n event.clientX < initialPointerPosition.current.x - PRESS_DELTA_MAX ||\n event.clientY > initialPointerPosition.current.y + PRESS_DELTA_MAX ||\n event.clientY < initialPointerPosition.current.y - PRESS_DELTA_MAX)\n ) {\n didPointerDrag.current = true;\n }\n },\n { signal: controller.signal }\n );\n\n // Shared behavior when a \"pointerdown\" state ends. This is shared so it\n // can be called for both \"pointercancel\" and \"pointerup\" events.\n const resetPointerDownState = () => {\n isPointerDown.current = false;\n initialPointerPosition.current = undefined;\n };\n\n document.addEventListener(\n 'pointercancel',\n () => {\n resetPointerDownState();\n },\n { signal: controller.signal }\n );\n\n document.addEventListener(\n 'pointerup',\n () => {\n if (isPointerDown.current && !didPointerDrag.current) {\n // The cursor didn't move much between \"pointerdown\" and \"pointerup\".\n // Handle this as a \"click\" instead of a \"drag\".\n setShowButtons(true);\n }\n resetPointerDownState();\n },\n { signal: controller.signal }\n );\n\n return () => controller.abort();\n }, []);\n\n const onHandlePointerDown: React.PointerEventHandler = event => {\n // Tooltip behavior: the tooltip should appear on hover, but disappear when\n // the pointer starts dragging (having the tooltip get in the way while\n // you're trying to drag upwards is annoying). Additionally, the tooltip\n // shouldn't reappear when dragging ends, but only when the pointer leaves\n // the drag handle and comes back.\n\n isPointerDown.current = true;\n didPointerDrag.current = false;\n initialPointerPosition.current = { x: event.clientX, y: event.clientY };\n setShowTooltip(false);\n };\n\n // Tooltip behavior: the tooltip should stay open when the cursor moves\n // from the drag handle into the tooltip content itself. This is why the\n // handler is set on the wrapper for both the drag handle and the tooltip.\n const onTooltipGroupPointerEnter: React.PointerEventHandler = () => {\n if (!isPointerDown.current) {\n setShowTooltip(true);\n }\n };\n const onTooltipGroupPointerLeave: React.PointerEventHandler = () => {\n setShowTooltip(false);\n };\n\n const onDragHandleKeyDown: React.KeyboardEventHandler = event => {\n // For accessibility reasons, pressing escape should should always close\n // the floating controls.\n if (event.key === 'Escape') {\n setShowButtons(false);\n } else if (triggerMode === 'keyboard-activate' && (event.key === 'Enter' || event.key === ' ')) {\n // toggle buttons when Enter or space is pressed in 'keyboard-activate' triggerMode\n setShowButtons(prevShowButtons => !prevShowButtons);\n } else if (event.key !== 'Alt' && event.key !== 'Control' && event.key !== 'Meta' && event.key !== 'Shift') {\n // Pressing any other key will display the focus-visible ring around the\n // drag handle if it's in focus, so we should also show the buttons now.\n setShowButtons(true);\n }\n };\n\n const onInternalDirectionClick = (direction: Direction) => {\n // Move focus back to the wrapper on click. This prevents focus from staying\n // on an aria-hidden control, and allows future keyboard events to be handled\n // cleanly using the drag handle's own handlers.\n if (dragHandleRef.current) {\n getFirstFocusable(dragHandleRef.current)?.focus();\n }\n onDirectionClick?.(direction);\n };\n\n return (\n <div\n className={clsx(styles['drag-handle-wrapper'], showButtons && styles['drag-handle-wrapper-open'])}\n ref={wrapperRef}\n onFocus={onWrapperFocusIn}\n onBlur={onWrapperFocusOut}\n >\n <div onPointerEnter={onTooltipGroupPointerEnter} onPointerLeave={onTooltipGroupPointerLeave}>\n <div\n className={styles['drag-handle']}\n ref={dragHandleRef}\n onPointerDown={onHandlePointerDown}\n onKeyDown={onDragHandleKeyDown}\n >\n {children}\n </div>\n\n {!isDisabled && !showButtons && showTooltip && tooltipText && (\n <Tooltip trackRef={dragHandleRef} value={tooltipText} onDismiss={() => setShowTooltip(false)} />\n )}\n </div>\n\n <PortalOverlay track={dragHandleRef.current} isDisabled={!showButtons}>\n {directions['block-start'] && (\n <DirectionButton\n show={!isDisabled && showButtons}\n direction=\"block-start\"\n state={directions['block-start']}\n onClick={() => onInternalDirectionClick('block-start')}\n />\n )}\n {directions['block-end'] && (\n <DirectionButton\n show={!isDisabled && showButtons}\n direction=\"block-end\"\n state={directions['block-end']}\n onClick={() => onInternalDirectionClick('block-end')}\n />\n )}\n {directions['inline-start'] && (\n <DirectionButton\n show={!isDisabled && showButtons}\n direction=\"inline-start\"\n state={directions['inline-start']}\n onClick={() => onInternalDirectionClick('inline-start')}\n />\n )}\n {directions['inline-end'] && (\n <DirectionButton\n show={!isDisabled && showButtons}\n direction=\"inline-end\"\n state={directions['inline-end']}\n onClick={() => onInternalDirectionClick('inline-end')}\n />\n )}\n </PortalOverlay>\n </div>\n );\n}\n"]}
@@ -1,10 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  export type Direction = 'block-start' | 'block-end' | 'inline-start' | 'inline-end';
3
3
  export type DirectionState = 'active' | 'disabled';
4
+ export type TriggerMode = 'focus' | 'keyboard-activate';
4
5
  export interface DragHandleWrapperProps {
5
6
  directions: Partial<Record<Direction, DirectionState>>;
6
7
  onDirectionClick?: (direction: Direction) => void;
7
8
  tooltipText?: string;
8
9
  children: React.ReactNode;
10
+ triggerMode?: TriggerMode;
9
11
  }
10
12
  //# sourceMappingURL=interfaces.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/interfaces.ts"],"names":[],"mappings":";AAGA,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,WAAW,GAAG,cAAc,GAAG,YAAY,CAAC;AACpF,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEnD,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC;IACvD,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B"}
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/interfaces.ts"],"names":[],"mappings":";AAGA,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,WAAW,GAAG,cAAc,GAAG,YAAY,CAAC;AACpF,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,UAAU,CAAC;AACnD,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,mBAAmB,CAAC;AAExD,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC;IACvD,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport type Direction = 'block-start' | 'block-end' | 'inline-start' | 'inline-end';\nexport type DirectionState = 'active' | 'disabled';\n\nexport interface DragHandleWrapperProps {\n directions: Partial<Record<Direction, DirectionState>>;\n onDirectionClick?: (direction: Direction) => void;\n tooltipText?: string;\n children: React.ReactNode;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport type Direction = 'block-start' | 'block-end' | 'inline-start' | 'inline-end';\nexport type DirectionState = 'active' | 'disabled';\nexport type TriggerMode = 'focus' | 'keyboard-activate';\n\nexport interface DragHandleWrapperProps {\n directions: Partial<Record<Direction, DirectionState>>;\n onDirectionClick?: (direction: Direction) => void;\n tooltipText?: string;\n children: React.ReactNode;\n triggerMode?: TriggerMode;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"portal-overlay.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/portal-overlay.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAWjD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,KAAK,EACL,UAAU,EACV,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,sBAyDA"}
1
+ {"version":3,"file":"portal-overlay.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/portal-overlay.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAWjD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,KAAK,EACL,UAAU,EACV,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,sBA0DA"}
@@ -15,7 +15,8 @@ export default function PortalOverlay({ track, isDisabled, children, }) {
15
15
  let lastInlineSize;
16
16
  let lastBlockSize;
17
17
  const updateElement = () => {
18
- if (ref.current) {
18
+ // It could be that the portal hasn't been attached to the DOM yet - ensure the ref exists and is attached DOM tree.
19
+ if (ref.current && document.body.contains(ref.current)) {
19
20
  const isRtl = getIsRtl(ref.current);
20
21
  const { insetInlineStart, insetBlockStart, inlineSize, blockSize } = getLogicalBoundingClientRect(track);
21
22
  // For simplicity, we just make all our calculations independent of
@@ -1 +1 @@
1
- {"version":3,"file":"portal-overlay.js","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/portal-overlay.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EACL,QAAQ,EACR,4BAA4B,EAC5B,oBAAoB,EACpB,MAAM,GACP,MAAM,+CAA+C,CAAC;AAEvD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,KAAK,EACL,UAAU,EACV,QAAQ,GAKT;IACC,MAAM,GAAG,GAAG,MAAM,CAAyB,IAAI,CAAC,CAAC;IAEjD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,KAAK,KAAK,IAAI,IAAI,UAAU,EAAE;YAChC,OAAO;SACR;QAED,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,IAAI,KAAyB,CAAC;QAC9B,IAAI,KAAyB,CAAC;QAC9B,IAAI,cAAkC,CAAC;QACvC,IAAI,aAAiC,CAAC;QACtC,MAAM,aAAa,GAAG,GAAG,EAAE;YACzB,IAAI,GAAG,CAAC,OAAO,EAAE;gBACf,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACpC,MAAM,EAAE,gBAAgB,E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,CACL,oBAAC,MAAM;QACL,8BAAM,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC;YACjD,8BAAM,SAAS,EAAE,MAAM,CAAC,yBAAyB,CAAC,IAAG,QAAQ,CAAQ,CAChE,CACA,CACV,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\n\nimport {\n getIsRtl,\n getLogicalBoundingClientRect,\n getScrollInlineStart,\n Portal,\n} from '@cloudscape-design/component-toolkit/internal';\n\nimport styles from './styles.css.js';\n\nexport default function PortalOverlay({\n track,\n isDisabled,\n children,\n}: {\n track: HTMLElement | null;\n isDisabled: boolean;\n children: React.ReactNode;\n}) {\n const ref = useRef<HTMLSpanElement | null>(null);\n\n useEffect(() => {\n if (track === null || isDisabled) {\n return;\n }\n\n let cleanedUp = false;\n let lastX: number | undefined;\n let lastY: number | undefined;\n let lastInlineSize: number | undefined;\n let lastBlockSize: number | undefined;\n const updateElement = () => {\n if (ref.current) {\n const isRtl = getIsRtl(ref.current);\n const { insetInlineStart, insetBlockStart, inlineSize, blockSize } = getLogicalBoundingClientRect(track);\n // For simplicity, we just make all our calculations independent of\n // the browser's scrolling edge. When it comes to applying the changes,\n // translate is independent of writing direction, so we need to invert\n // the X coordinate ourselves just before applying the values.\n const newX = (insetInlineStart + getScrollInlineStart(document.documentElement)) * (isRtl ? -1 : 1);\n const newY = insetBlockStart + document.documentElement.scrollTop;\n if (lastX !== newX || lastY !== newY) {\n ref.current.style.translate = `${newX}px ${newY}px`;\n lastX = newX;\n lastY = newY;\n }\n if (lastInlineSize !== inlineSize || lastBlockSize !== blockSize) {\n ref.current.style.width = `${inlineSize}px`;\n ref.current.style.height = `${blockSize}px`;\n lastInlineSize = inlineSize;\n lastBlockSize = blockSize;\n }\n }\n if (!cleanedUp) {\n requestAnimationFrame(updateElement);\n }\n };\n updateElement();\n\n return () => {\n cleanedUp = true;\n };\n }, [isDisabled, track]);\n\n if (track === null) {\n return null;\n }\n\n return (\n <Portal>\n <span ref={ref} className={styles['portal-overlay']}>\n <span className={styles['portal-overlay-contents']}>{children}</span>\n </span>\n </Portal>\n );\n}\n"]}
1
+ {"version":3,"file":"portal-overlay.js","sourceRoot":"","sources":["../../../../../src/internal/components/drag-handle-wrapper/portal-overlay.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EACL,QAAQ,EACR,4BAA4B,EAC5B,oBAAoB,EACpB,MAAM,GACP,MAAM,+CAA+C,CAAC;AAEvD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,KAAK,EACL,UAAU,EACV,QAAQ,GAKT;IACC,MAAM,GAAG,GAAG,MAAM,CAAyB,IAAI,CAAC,CAAC;IAEjD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,KAAK,KAAK,IAAI,IAAI,UAAU,EAAE;YAChC,OAAO;SACR;QAED,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,IAAI,KAAyB,CAAC;QAC9B,IAAI,KAAyB,CAAC;QAC9B,IAAI,cAAkC,CAAC;QACvC,IAAI,aAAiC,CAAC;QACtC,MAAM,aAAa,GAAG,GAAG,EAAE;YACzB,oHAAoH;YACpH,IAAI,GAAG,CAAC,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;gBACtD,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACpC,MAAM,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,4BAA4B,CAAC,KAAK,CAAC,CAAC;gBACzG,mEAAmE;gBACnE,u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AM,SAAS,EAAE,MAAM,CAAC,yBAAyB,CAAC,IAAG,QAAQ,CAAQ,CAChE,CACA,CACV,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\n\nimport {\n getIsRtl,\n getLogicalBoundingClientRect,\n getScrollInlineStart,\n Portal,\n} from '@cloudscape-design/component-toolkit/internal';\n\nimport styles from './styles.css.js';\n\nexport default function PortalOverlay({\n track,\n isDisabled,\n children,\n}: {\n track: HTMLElement | null;\n isDisabled: boolean;\n children: React.ReactNode;\n}) {\n const ref = useRef<HTMLSpanElement | null>(null);\n\n useEffect(() => {\n if (track === null || isDisabled) {\n return;\n }\n\n let cleanedUp = false;\n let lastX: number | undefined;\n let lastY: number | undefined;\n let lastInlineSize: number | undefined;\n let lastBlockSize: number | undefined;\n const updateElement = () => {\n // It could be that the portal hasn't been attached to the DOM yet - ensure the ref exists and is attached DOM tree.\n if (ref.current && document.body.contains(ref.current)) {\n const isRtl = getIsRtl(ref.current);\n const { insetInlineStart, insetBlockStart, inlineSize, blockSize } = getLogicalBoundingClientRect(track);\n // For simplicity, we just make all our calculations independent of\n // the browser's scrolling edge. When it comes to applying the changes,\n // translate is independent of writing direction, so we need to invert\n // the X coordinate ourselves just before applying the values.\n const newX = (insetInlineStart + getScrollInlineStart(document.documentElement)) * (isRtl ? -1 : 1);\n const newY = insetBlockStart + document.documentElement.scrollTop;\n if (lastX !== newX || lastY !== newY) {\n ref.current.style.translate = `${newX}px ${newY}px`;\n lastX = newX;\n lastY = newY;\n }\n if (lastInlineSize !== inlineSize || lastBlockSize !== blockSize) {\n ref.current.style.width = `${inlineSize}px`;\n ref.current.style.height = `${blockSize}px`;\n lastInlineSize = inlineSize;\n lastBlockSize = blockSize;\n }\n }\n if (!cleanedUp) {\n requestAnimationFrame(updateElement);\n }\n };\n updateElement();\n\n return () => {\n cleanedUp = true;\n };\n }, [isDisabled, track]);\n\n if (track === null) {\n return null;\n }\n\n return (\n <Portal>\n <span ref={ref} className={styles['portal-overlay']}>\n <span className={styles['portal-overlay-contents']}>{children}</span>\n </span>\n </Portal>\n );\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (edc39883)";
2
+ export var PACKAGE_VERSION = "3.0.0 (955ec7c6)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (edc39883)",
3
+ "PACKAGE_VERSION": "3.0.0 (955ec7c6)",
4
4
  "THEME": "default",
5
5
  "ALWAYS_VISUAL_REFRESH": false
6
6
  }
@@ -10388,6 +10388,8 @@ module.exports.preset = {
10388
10388
  "colorTextNotificationSeverityMedium",
10389
10389
  "colorTextNotificationSeverityLow",
10390
10390
  "colorTextNotificationSeverityNeutral",
10391
+ "colorBackgroundButtonLinkActive",
10392
+ "colorBackgroundButtonLinkHover",
10391
10393
  "colorBackgroundButtonNormalActive",
10392
10394
  "colorBackgroundButtonNormalDefault",
10393
10395
  "colorBackgroundButtonNormalDisabled",
@@ -10735,6 +10737,8 @@ module.exports.preset = {
10735
10737
  "colorTextNotificationSeverityMedium",
10736
10738
  "colorTextNotificationSeverityLow",
10737
10739
  "colorTextNotificationSeverityNeutral",
10740
+ "colorBackgroundButtonLinkActive",
10741
+ "colorBackgroundButtonLinkHover",
10738
10742
  "colorBackgroundButtonNormalActive",
10739
10743
  "colorBackgroundButtonNormalDefault",
10740
10744
  "colorBackgroundButtonNormalDisabled",
@@ -73,6 +73,8 @@ export declare interface TypedOverride {
73
73
  colorTextNotificationSeverityMedium?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
74
74
  colorTextNotificationSeverityLow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
75
75
  colorTextNotificationSeverityNeutral?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
76
+ colorBackgroundButtonLinkActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
77
+ colorBackgroundButtonLinkHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
76
78
  colorBackgroundButtonNormalActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
77
79
  colorBackgroundButtonNormalDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
78
80
  colorBackgroundButtonNormalDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -329,6 +331,8 @@ export declare interface TypedOverride {
329
331
  colorTextNotificationSeverityMedium?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
330
332
  colorTextNotificationSeverityLow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
331
333
  colorTextNotificationSeverityNeutral?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
334
+ colorBackgroundButtonLinkActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
335
+ colorBackgroundButtonLinkHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
332
336
  colorBackgroundButtonNormalActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
333
337
  colorBackgroundButtonNormalDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
334
338
  colorBackgroundButtonNormalDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -585,6 +589,8 @@ export declare interface TypedOverride {
585
589
  colorTextNotificationSeverityMedium?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
586
590
  colorTextNotificationSeverityLow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
587
591
  colorTextNotificationSeverityNeutral?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
592
+ colorBackgroundButtonLinkActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
593
+ colorBackgroundButtonLinkHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
588
594
  colorBackgroundButtonNormalActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
589
595
  colorBackgroundButtonNormalDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
590
596
  colorBackgroundButtonNormalDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -841,6 +847,8 @@ export declare interface TypedOverride {
841
847
  colorTextNotificationSeverityMedium?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
842
848
  colorTextNotificationSeverityLow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
843
849
  colorTextNotificationSeverityNeutral?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
850
+ colorBackgroundButtonLinkActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
851
+ colorBackgroundButtonLinkHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
844
852
  colorBackgroundButtonNormalActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
845
853
  colorBackgroundButtonNormalDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
846
854
  colorBackgroundButtonNormalDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -1097,6 +1105,8 @@ export declare interface TypedOverride {
1097
1105
  colorTextNotificationSeverityMedium?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1098
1106
  colorTextNotificationSeverityLow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1099
1107
  colorTextNotificationSeverityNeutral?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1108
+ colorBackgroundButtonLinkActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1109
+ colorBackgroundButtonLinkHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1100
1110
  colorBackgroundButtonNormalActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1101
1111
  colorBackgroundButtonNormalDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1102
1112
  colorBackgroundButtonNormalDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -1353,6 +1363,8 @@ export declare interface TypedOverride {
1353
1363
  colorTextNotificationSeverityMedium?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1354
1364
  colorTextNotificationSeverityLow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1355
1365
  colorTextNotificationSeverityNeutral?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1366
+ colorBackgroundButtonLinkActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1367
+ colorBackgroundButtonLinkHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1356
1368
  colorBackgroundButtonNormalActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1357
1369
  colorBackgroundButtonNormalDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1358
1370
  colorBackgroundButtonNormalDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -1609,6 +1621,8 @@ export declare interface TypedOverride {
1609
1621
  colorTextNotificationSeverityMedium?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1610
1622
  colorTextNotificationSeverityLow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1611
1623
  colorTextNotificationSeverityNeutral?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1624
+ colorBackgroundButtonLinkActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1625
+ colorBackgroundButtonLinkHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1612
1626
  colorBackgroundButtonNormalActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1613
1627
  colorBackgroundButtonNormalDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1614
1628
  colorBackgroundButtonNormalDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -1865,6 +1879,8 @@ export declare interface TypedOverride {
1865
1879
  colorTextNotificationSeverityMedium?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1866
1880
  colorTextNotificationSeverityLow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1867
1881
  colorTextNotificationSeverityNeutral?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1882
+ colorBackgroundButtonLinkActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1883
+ colorBackgroundButtonLinkHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1868
1884
  colorBackgroundButtonNormalActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1869
1885
  colorBackgroundButtonNormalDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1870
1886
  colorBackgroundButtonNormalDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -2121,6 +2137,8 @@ export declare interface TypedOverride {
2121
2137
  colorTextNotificationSeverityMedium?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2122
2138
  colorTextNotificationSeverityLow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2123
2139
  colorTextNotificationSeverityNeutral?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2140
+ colorBackgroundButtonLinkActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2141
+ colorBackgroundButtonLinkHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2124
2142
  colorBackgroundButtonNormalActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2125
2143
  colorBackgroundButtonNormalDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2126
2144
  colorBackgroundButtonNormalDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -73,6 +73,8 @@ export declare interface TypedOverride {
73
73
  colorTextNotificationSeverityMedium?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
74
74
  colorTextNotificationSeverityLow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
75
75
  colorTextNotificationSeverityNeutral?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
76
+ colorBackgroundButtonLinkActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
77
+ colorBackgroundButtonLinkHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
76
78
  colorBackgroundButtonNormalActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
77
79
  colorBackgroundButtonNormalDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
78
80
  colorBackgroundButtonNormalDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -329,6 +331,8 @@ export declare interface TypedOverride {
329
331
  colorTextNotificationSeverityMedium?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
330
332
  colorTextNotificationSeverityLow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
331
333
  colorTextNotificationSeverityNeutral?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
334
+ colorBackgroundButtonLinkActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
335
+ colorBackgroundButtonLinkHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
332
336
  colorBackgroundButtonNormalActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
333
337
  colorBackgroundButtonNormalDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
334
338
  colorBackgroundButtonNormalDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -585,6 +589,8 @@ export declare interface TypedOverride {
585
589
  colorTextNotificationSeverityMedium?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
586
590
  colorTextNotificationSeverityLow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
587
591
  colorTextNotificationSeverityNeutral?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
592
+ colorBackgroundButtonLinkActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
593
+ colorBackgroundButtonLinkHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
588
594
  colorBackgroundButtonNormalActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
589
595
  colorBackgroundButtonNormalDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
590
596
  colorBackgroundButtonNormalDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -841,6 +847,8 @@ export declare interface TypedOverride {
841
847
  colorTextNotificationSeverityMedium?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
842
848
  colorTextNotificationSeverityLow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
843
849
  colorTextNotificationSeverityNeutral?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
850
+ colorBackgroundButtonLinkActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
851
+ colorBackgroundButtonLinkHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
844
852
  colorBackgroundButtonNormalActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
845
853
  colorBackgroundButtonNormalDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
846
854
  colorBackgroundButtonNormalDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -1097,6 +1105,8 @@ export declare interface TypedOverride {
1097
1105
  colorTextNotificationSeverityMedium?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1098
1106
  colorTextNotificationSeverityLow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1099
1107
  colorTextNotificationSeverityNeutral?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1108
+ colorBackgroundButtonLinkActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1109
+ colorBackgroundButtonLinkHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1100
1110
  colorBackgroundButtonNormalActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1101
1111
  colorBackgroundButtonNormalDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1102
1112
  colorBackgroundButtonNormalDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -1353,6 +1363,8 @@ export declare interface TypedOverride {
1353
1363
  colorTextNotificationSeverityMedium?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1354
1364
  colorTextNotificationSeverityLow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1355
1365
  colorTextNotificationSeverityNeutral?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1366
+ colorBackgroundButtonLinkActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1367
+ colorBackgroundButtonLinkHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1356
1368
  colorBackgroundButtonNormalActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1357
1369
  colorBackgroundButtonNormalDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1358
1370
  colorBackgroundButtonNormalDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -1609,6 +1621,8 @@ export declare interface TypedOverride {
1609
1621
  colorTextNotificationSeverityMedium?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1610
1622
  colorTextNotificationSeverityLow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1611
1623
  colorTextNotificationSeverityNeutral?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1624
+ colorBackgroundButtonLinkActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1625
+ colorBackgroundButtonLinkHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1612
1626
  colorBackgroundButtonNormalActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1613
1627
  colorBackgroundButtonNormalDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1614
1628
  colorBackgroundButtonNormalDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -1865,6 +1879,8 @@ export declare interface TypedOverride {
1865
1879
  colorTextNotificationSeverityMedium?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1866
1880
  colorTextNotificationSeverityLow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1867
1881
  colorTextNotificationSeverityNeutral?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1882
+ colorBackgroundButtonLinkActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1883
+ colorBackgroundButtonLinkHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1868
1884
  colorBackgroundButtonNormalActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1869
1885
  colorBackgroundButtonNormalDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1870
1886
  colorBackgroundButtonNormalDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -2121,6 +2137,8 @@ export declare interface TypedOverride {
2121
2137
  colorTextNotificationSeverityMedium?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2122
2138
  colorTextNotificationSeverityLow?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2123
2139
  colorTextNotificationSeverityNeutral?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2140
+ colorBackgroundButtonLinkActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2141
+ colorBackgroundButtonLinkHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2124
2142
  colorBackgroundButtonNormalActive?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2125
2143
  colorBackgroundButtonNormalDefault?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2126
2144
  colorBackgroundButtonNormalDisabled?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
@@ -10388,6 +10388,8 @@ export var preset = {
10388
10388
  "colorTextNotificationSeverityMedium",
10389
10389
  "colorTextNotificationSeverityLow",
10390
10390
  "colorTextNotificationSeverityNeutral",
10391
+ "colorBackgroundButtonLinkActive",
10392
+ "colorBackgroundButtonLinkHover",
10391
10393
  "colorBackgroundButtonNormalActive",
10392
10394
  "colorBackgroundButtonNormalDefault",
10393
10395
  "colorBackgroundButtonNormalDisabled",
@@ -10735,6 +10737,8 @@ export var preset = {
10735
10737
  "colorTextNotificationSeverityMedium",
10736
10738
  "colorTextNotificationSeverityLow",
10737
10739
  "colorTextNotificationSeverityNeutral",
10740
+ "colorBackgroundButtonLinkActive",
10741
+ "colorBackgroundButtonLinkHover",
10738
10742
  "colorBackgroundButtonNormalActive",
10739
10743
  "colorBackgroundButtonNormalDefault",
10740
10744
  "colorBackgroundButtonNormalDisabled",
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EACL,sBAAsB,EAGvB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAI/D,MAAM,WAAW,0BAA0B,CAAC,CAAC,GAAG,GAAG;IACjD,iBAAiB,CAAC,EAAE,gBAAgB,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;CACvD;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,CAAC,GAAG,GAAG,EAC9C,aAAa,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,sBAAsB,EAC/B,iBAAiB,CAAC,EAAE,iBAAiB;;EAMtC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EACL,sBAAsB,EAIvB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAK/D,MAAM,WAAW,0BAA0B,CAAC,CAAC,GAAG,GAAG;IACjD,iBAAiB,CAAC,EAAE,gBAAgB,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;CACvD;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,CAAC,GAAG,GAAG,EAC9C,aAAa,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,sBAAsB,EAC/B,iBAAiB,CAAC,EAAE,iBAAiB;;EAYtC"}