@cloudscape-design/components-themeable 3.0.133 → 3.0.135

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.
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "59a17971fb3a9644335f446c5fadf5d97f62e95e"
2
+ "commit": "a514891f0234ecd060b8f4fb11d7b94639dc9564"
3
3
  }
@@ -1,5 +1,5 @@
1
1
 
2
- export var PACKAGE_VERSION = '3.0.0 (59a1797)';
2
+ export var PACKAGE_VERSION = '3.0.0 (a514891)';
3
3
  export var THEME = 'open-source-visual-refresh';
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
5
5
 
@@ -3217,20 +3217,6 @@
3217
3217
  "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
3218
3218
  "dev": true
3219
3219
  },
3220
- "autoprefixer": {
3221
- "version": "10.4.4",
3222
- "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.4.tgz",
3223
- "integrity": "sha512-Tm8JxsB286VweiZ5F0anmbyGiNI3v3wGv3mz9W+cxEDYB/6jbnj6GM9H9mK3wIL8ftgl+C07Lcwb8PG5PCCPzA==",
3224
- "dev": true,
3225
- "requires": {
3226
- "browserslist": "^4.20.2",
3227
- "caniuse-lite": "^1.0.30001317",
3228
- "fraction.js": "^4.2.0",
3229
- "normalize-range": "^0.1.2",
3230
- "picocolors": "^1.0.0",
3231
- "postcss-value-parser": "^4.2.0"
3232
- }
3233
- },
3234
3220
  "available-typed-arrays": {
3235
3221
  "version": "1.0.5",
3236
3222
  "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz",
@@ -11894,15 +11880,6 @@
11894
11880
  "postcss-value-parser": "^4.2.0"
11895
11881
  }
11896
11882
  },
11897
- "postcss-custom-properties": {
11898
- "version": "12.1.7",
11899
- "resolved": "https://registry.npmjs.org/postcss-custom-properties/-/postcss-custom-properties-12.1.7.tgz",
11900
- "integrity": "sha512-N/hYP5gSoFhaqxi2DPCmvto/ZcRDVjE3T1LiAMzc/bg53hvhcHOLpXOHb526LzBBp5ZlAUhkuot/bfpmpgStJg==",
11901
- "dev": true,
11902
- "requires": {
11903
- "postcss-value-parser": "^4.2.0"
11904
- }
11905
- },
11906
11883
  "postcss-discard-comments": {
11907
11884
  "version": "5.1.1",
11908
11885
  "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-5.1.1.tgz",
@@ -11966,34 +11943,6 @@
11966
11943
  "postcss-value-parser": "^4.0.0"
11967
11944
  }
11968
11945
  },
11969
- "postcss-loader": {
11970
- "version": "6.2.1",
11971
- "resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-6.2.1.tgz",
11972
- "integrity": "sha512-WbbYpmAaKcux/P66bZ40bpWsBucjx/TTgVVzRZ9yUO8yQfVBlameJ0ZGVaPfH64hNSBh63a+ICP5nqOpBA0w+Q==",
11973
- "dev": true,
11974
- "requires": {
11975
- "cosmiconfig": "^7.0.0",
11976
- "klona": "^2.0.5",
11977
- "semver": "^7.3.5"
11978
- },
11979
- "dependencies": {
11980
- "lru-cache": {
11981
- "version": "7.8.0",
11982
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.8.0.tgz",
11983
- "integrity": "sha512-AmXqneQZL3KZMIgBpaPTeI6pfwh+xQ2vutMsyqOu1TBdEXFZgpG/80wuJ531w2ZN7TI0/oc8CPxzh/DKQudZqg==",
11984
- "dev": true
11985
- },
11986
- "semver": {
11987
- "version": "7.3.6",
11988
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.6.tgz",
11989
- "integrity": "sha512-HZWqcgwLsjaX1HBD31msI/rXktuIhS+lWvdE4kN9z+8IVT4Itc7vqU2WvYsyD6/sjYCt4dEKH/m1M3dwI9CC5w==",
11990
- "dev": true,
11991
- "requires": {
11992
- "lru-cache": "^7.4.0"
11993
- }
11994
- }
11995
- }
11996
- },
11997
11946
  "postcss-media-query-parser": {
11998
11947
  "version": "0.2.3",
11999
11948
  "resolved": "https://registry.npmjs.org/postcss-media-query-parser/-/postcss-media-query-parser-0.2.3.tgz",
@@ -1 +1 @@
1
- {"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../../../src/top-navigation/parts/utility.tsx"],"names":[],"mappings":"AAQA,OAAqB,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAKnD,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,kBAAkB,CAAC,OAAO,CAAC;IACvC,WAAW,CAAC,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC;CAChD;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE,YAAY,sBAmGlF"}
1
+ {"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../../../src/top-navigation/parts/utility.tsx"],"names":[],"mappings":"AAQA,OAAqB,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAMnD,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,kBAAkB,CAAC,OAAO,CAAC;IACvC,WAAW,CAAC,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC;CAChD;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE,YAAY,sBA0FlF"}
@@ -9,6 +9,7 @@ import InternalIcon from '../../icon/internal';
9
9
  import MenuDropdown from '../../internal/components/menu-dropdown';
10
10
  import styles from '../styles.css.js';
11
11
  import { checkSafeUrl } from '../../internal/utils/check-safe-url';
12
+ import { joinStrings } from '../../internal/utils/strings';
12
13
  export default function Utility(_a) {
13
14
  var _b;
14
15
  var hideText = _a.hideText, definition = _a.definition, offsetRight = _a.offsetRight;
@@ -16,6 +17,9 @@ export default function Utility(_a) {
16
17
  var shouldHideText = hideText && !definition.disableTextCollapse && hasIcon;
17
18
  var ariaLabel = (_b = definition.ariaLabel) !== null && _b !== void 0 ? _b : definition.text;
18
19
  if (definition.type === 'button') {
20
+ ariaLabel = definition.ariaLabel
21
+ ? definition.ariaLabel
22
+ : joinStrings(definition.text, definition.externalIconAriaLabel);
19
23
  checkSafeUrl('TopNavigation', definition.href);
20
24
  if (definition.variant === 'primary-button') {
21
25
  return (React.createElement("span", { className: styles["offset-right-".concat(offsetRight)] },
@@ -29,13 +33,9 @@ export default function Utility(_a) {
29
33
  else {
30
34
  // Link
31
35
  return (React.createElement("span", { className: styles["offset-right-".concat(offsetRight)] },
32
- React.createElement(InternalLink, { variant: "top-navigation", href: definition.href, target: definition.external ? '_blank' : undefined, onFollow: definition.onClick, ariaLabel: ariaLabel },
36
+ React.createElement(InternalLink, { variant: "top-navigation", href: definition.href, external: definition.external, onFollow: definition.onClick, ariaLabel: ariaLabel },
33
37
  hasIcon && (React.createElement(InternalIcon, { name: definition.iconName, url: definition.iconUrl, alt: definition.iconAlt, svg: definition.iconSvg, badge: definition.badge })),
34
- !shouldHideText && definition.text && (React.createElement("span", { className: hasIcon ? styles['utility-link-icon'] : undefined }, definition.text)),
35
- definition.external && (React.createElement(React.Fragment, null,
36
- ' ',
37
- React.createElement("span", { role: definition.externalIconAriaLabel ? 'img' : undefined, "aria-label": definition.externalIconAriaLabel },
38
- React.createElement(InternalIcon, { name: "external", size: "normal" })))))));
38
+ !shouldHideText && definition.text && (React.createElement("span", { className: hasIcon ? styles['utility-link-icon'] : undefined }, definition.text)))));
39
39
  }
40
40
  }
41
41
  else if (definition.type === 'menu-dropdown') {
@@ -1 +1 @@
1
- {"version":3,"file":"utility.js","sourceRoot":"","sources":["../../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AuB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACrC;KACF;AACH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { InternalButton } from '../../button/internal';\nimport InternalLink from '../../link/internal';\nimport InternalIcon from '../../icon/internal';\nimport MenuDropdown, { MenuDropdownProps } from '../../internal/components/menu-dropdown';\n\nimport { TopNavigationProps } from '../interfaces';\n\nimport styles from '../styles.css.js';\nimport { checkSafeUrl } from '../../internal/utils/check-safe-url';\n\nexport interface UtilityProps {\n hideText: boolean;\n definition: TopNavigationProps.Utility;\n offsetRight?: MenuDropdownProps['offsetRight'];\n}\n\nexport default function Utility({ hideText, definition, offsetRight }: UtilityProps) {\n const hasIcon = !!definition.iconName || !!definition.iconUrl || !!definition.iconAlt || !!definition.iconSvg;\n const shouldHideText = hideText && !definition.disableTextCollapse && hasIcon;\n const ariaLabel = definition.ariaLabel ?? definition.text;\n\n if (definition.type === 'button') {\n checkSafeUrl('TopNavigation', definition.href);\n if (definition.variant === 'primary-button') {\n return (\n <span className={styles[`offset-right-${offsetRight}`]}>\n <InternalButton\n variant=\"primary\"\n href={definition.href}\n target={definition.external ? '_blank' : undefined}\n onClick={definition.onClick}\n ariaLabel={ariaLabel}\n iconName={definition.iconName}\n iconUrl={definition.iconUrl}\n iconAlt={definition.iconAlt}\n iconSvg={definition.iconSvg}\n >\n {shouldHideText ? null : (\n <>\n {definition.text}\n {definition.external && (\n <>\n {' '}\n <span\n className={clsx(styles['utility-button-external-icon'], styles[`offset-right-${offsetRight}`])}\n aria-label={definition.externalIconAriaLabel}\n role={definition.externalIconAriaLabel ? 'img' : undefined}\n >\n <InternalIcon name=\"external\" />\n </span>\n </>\n )}\n </>\n )}\n </InternalButton>\n </span>\n );\n } else {\n // Link\n return (\n <span className={styles[`offset-right-${offsetRight}`]}>\n <InternalLink\n variant=\"top-navigation\"\n href={definition.href}\n target={definition.external ? '_blank' : undefined}\n onFollow={definition.onClick}\n ariaLabel={ariaLabel}\n >\n {hasIcon && (\n <InternalIcon\n name={definition.iconName}\n url={definition.iconUrl}\n alt={definition.iconAlt}\n svg={definition.iconSvg}\n badge={definition.badge}\n />\n )}\n {!shouldHideText && definition.text && (\n <span className={hasIcon ? styles['utility-link-icon'] : undefined}>{definition.text}</span>\n )}\n {/* HACK: The link component uses size=\"inherit\", and Firefox scales up SVGs massively on the first render */}\n {definition.external && (\n <>\n {' '}\n <span\n role={definition.externalIconAriaLabel ? 'img' : undefined}\n aria-label={definition.externalIconAriaLabel}\n >\n <InternalIcon name=\"external\" size=\"normal\" />\n </span>\n </>\n )}\n </InternalLink>\n </span>\n );\n }\n } else if (definition.type === 'menu-dropdown') {\n const title = definition.title || definition.text;\n const shouldShowTitle = shouldHideText || !definition.text;\n\n checkSafeUrlRecursively(definition.items);\n\n return (\n <MenuDropdown\n {...definition}\n title={shouldShowTitle ? title : ''}\n ariaLabel={ariaLabel}\n offsetRight={offsetRight}\n >\n {!shouldHideText && definition.text}\n </MenuDropdown>\n );\n }\n\n return null;\n}\n\nfunction checkSafeUrlRecursively(itemOrGroup: MenuDropdownProps['items']) {\n for (const item of itemOrGroup) {\n checkSafeUrl('TopNavigation', item.href);\n\n if ('items' in item) {\n checkSafeUrlRecursively(item.items);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"utility.js","sourceRoot":"","sources":["../../../../src/top-navigation/parts/utility.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,YAAmC,MAAM,yCAAyC,CAAC;AAI1F,OAAO,MAAM,MAAM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G,UAAU,CAAC,IAAI,CAAQ,CAC7F,CACY,CACV,CACR,CAAC;SACH;KACF;SAAM,IAAI,UAAU,CAAC,IAAI,KAAK,eAAe,EAAE;QAC9C,IAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,UAAU,CAAC,IAAI,CAAC;QAClD,IAAM,eAAe,GAAG,cAAc,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAE3D,uBAAuB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAE1C,OAAO,CACL,oBAAC,YAAY,eACP,UAAU,IACd,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EACnC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,KAEvB,CAAC,cAAc,IAAI,UAAU,CAAC,IAAI,CACtB,CAChB,CAAC;KACH;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,uBAAuB,CAAC,WAAuC;IACtE,KAAmB,UAAW,EAAX,2BAAW,EAAX,yBAAW,EAAX,IAAW,EAAE;QAA3B,IAAM,IAAI,oBAAA;QACb,YAAY,CAAC,eAAe,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAEzC,IAAI,OAAO,IAAI,IAAI,EAAE;YACnB,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACrC;KACF;AACH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { InternalButton } from '../../button/internal';\nimport InternalLink from '../../link/internal';\nimport InternalIcon from '../../icon/internal';\nimport MenuDropdown, { MenuDropdownProps } from '../../internal/components/menu-dropdown';\n\nimport { TopNavigationProps } from '../interfaces';\n\nimport styles from '../styles.css.js';\nimport { checkSafeUrl } from '../../internal/utils/check-safe-url';\nimport { joinStrings } from '../../internal/utils/strings';\n\nexport interface UtilityProps {\n hideText: boolean;\n definition: TopNavigationProps.Utility;\n offsetRight?: MenuDropdownProps['offsetRight'];\n}\n\nexport default function Utility({ hideText, definition, offsetRight }: UtilityProps) {\n const hasIcon = !!definition.iconName || !!definition.iconUrl || !!definition.iconAlt || !!definition.iconSvg;\n const shouldHideText = hideText && !definition.disableTextCollapse && hasIcon;\n let ariaLabel = definition.ariaLabel ?? definition.text;\n\n if (definition.type === 'button') {\n ariaLabel = definition.ariaLabel\n ? definition.ariaLabel\n : joinStrings(definition.text, definition.externalIconAriaLabel);\n checkSafeUrl('TopNavigation', definition.href);\n if (definition.variant === 'primary-button') {\n return (\n <span className={styles[`offset-right-${offsetRight}`]}>\n <InternalButton\n variant=\"primary\"\n href={definition.href}\n target={definition.external ? '_blank' : undefined}\n onClick={definition.onClick}\n ariaLabel={ariaLabel}\n iconName={definition.iconName}\n iconUrl={definition.iconUrl}\n iconAlt={definition.iconAlt}\n iconSvg={definition.iconSvg}\n >\n {shouldHideText ? null : (\n <>\n {definition.text}\n {definition.external && (\n <>\n {' '}\n <span\n className={clsx(styles['utility-button-external-icon'], styles[`offset-right-${offsetRight}`])}\n aria-label={definition.externalIconAriaLabel}\n role={definition.externalIconAriaLabel ? 'img' : undefined}\n >\n <InternalIcon name=\"external\" />\n </span>\n </>\n )}\n </>\n )}\n </InternalButton>\n </span>\n );\n } else {\n // Link\n return (\n <span className={styles[`offset-right-${offsetRight}`]}>\n <InternalLink\n variant=\"top-navigation\"\n href={definition.href}\n external={definition.external}\n onFollow={definition.onClick}\n ariaLabel={ariaLabel}\n >\n {hasIcon && (\n <InternalIcon\n name={definition.iconName}\n url={definition.iconUrl}\n alt={definition.iconAlt}\n svg={definition.iconSvg}\n badge={definition.badge}\n />\n )}\n {!shouldHideText && definition.text && (\n <span className={hasIcon ? styles['utility-link-icon'] : undefined}>{definition.text}</span>\n )}\n </InternalLink>\n </span>\n );\n }\n } else if (definition.type === 'menu-dropdown') {\n const title = definition.title || definition.text;\n const shouldShowTitle = shouldHideText || !definition.text;\n\n checkSafeUrlRecursively(definition.items);\n\n return (\n <MenuDropdown\n {...definition}\n title={shouldShowTitle ? title : ''}\n ariaLabel={ariaLabel}\n offsetRight={offsetRight}\n >\n {!shouldHideText && definition.text}\n </MenuDropdown>\n );\n }\n\n return null;\n}\n\nfunction checkSafeUrlRecursively(itemOrGroup: MenuDropdownProps['items']) {\n for (const item of itemOrGroup) {\n checkSafeUrl('TopNavigation', item.href);\n\n if ('items' in item) {\n checkSafeUrlRecursively(item.items);\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudscape-design/components-themeable",
3
- "version": "3.0.133",
3
+ "version": "3.0.135",
4
4
  "files": [
5
5
  "lib",
6
6
  "package.json",