@cloudscape-design/components-themeable 3.0.1244 → 3.0.1246

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 (28) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
  3. package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-feature-notifications.d.ts.map +1 -1
  4. package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-feature-notifications.js +17 -1
  5. package/lib/internal/template/app-layout/visual-refresh-toolbar/state/use-feature-notifications.js.map +1 -1
  6. package/lib/internal/template/icon/interfaces.d.ts +2 -1
  7. package/lib/internal/template/icon/interfaces.d.ts.map +1 -1
  8. package/lib/internal/template/icon/interfaces.js.map +1 -1
  9. package/lib/internal/template/icon/internal.d.ts.map +1 -1
  10. package/lib/internal/template/icon/internal.js +5 -1
  11. package/lib/internal/template/icon/internal.js.map +1 -1
  12. package/lib/internal/template/icon-provider/define-icons.d.ts +14 -0
  13. package/lib/internal/template/icon-provider/define-icons.d.ts.map +1 -0
  14. package/lib/internal/template/icon-provider/define-icons.js +17 -0
  15. package/lib/internal/template/icon-provider/define-icons.js.map +1 -0
  16. package/lib/internal/template/icon-provider/index.d.ts +2 -0
  17. package/lib/internal/template/icon-provider/index.d.ts.map +1 -1
  18. package/lib/internal/template/icon-provider/index.js +1 -0
  19. package/lib/internal/template/icon-provider/index.js.map +1 -1
  20. package/lib/internal/template/icon-provider/interfaces.d.ts +23 -137
  21. package/lib/internal/template/icon-provider/interfaces.d.ts.map +1 -1
  22. package/lib/internal/template/icon-provider/interfaces.js.map +1 -1
  23. package/lib/internal/template/icon-provider/internal.js +4 -3
  24. package/lib/internal/template/icon-provider/internal.js.map +1 -1
  25. package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
  26. package/lib/internal/template/internal/environment.js +2 -2
  27. package/lib/internal/template/internal/environment.json +2 -2
  28. package/package.json +1 -1
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "3189432f9e56eccebe419a7b0ae0f837d1c68fd0"
2
+ "commit": "3dcd7e02ba9e57848247754993085c1b46f1e5ee"
3
3
  }
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Build environment
3
- $awsui-commit-hash: "3189432f";
3
+ $awsui-commit-hash: "3dcd7e02";
4
4
  // Manually managed CSS-variables
5
5
  $maxContentWidth: --awsui-max-content-width-n6lfw8;
6
6
  $minContentWidth: --awsui-min-content-width-n6lfw8;
@@ -1 +1 @@
1
- {"version":3,"file":"use-feature-notifications.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/use-feature-notifications.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,SAAS,EAA6B,MAAM,OAAO,CAAC;AAOpE,OAAO,EAIL,aAAa,EACd,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOlD,UAAU,8BAA8B;IACtC,UAAU,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;CACpC;AACD,MAAM,WAAW,yBAAyB;IACxC,yBAAyB,EAAE,yBAAyB,CAAC;IACrD,MAAM,CAAC,EAAE,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC;CACvC;AACD,MAAM,MAAM,yBAAyB,GAAG,CAAC,KAAK,EAAE,8BAA8B,KAAK,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;AA+BtG,wBAAgB,uBAAuB;;;gDAgDc,aAAa;EAqHjE"}
1
+ {"version":3,"file":"use-feature-notifications.d.ts","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/use-feature-notifications.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,SAAS,EAA6B,MAAM,OAAO,CAAC;AAOpE,OAAO,EAIL,aAAa,EACd,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOlD,UAAU,8BAA8B;IACtC,UAAU,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;CACpC;AACD,MAAM,WAAW,yBAAyB;IACxC,yBAAyB,EAAE,yBAAyB,CAAC;IACrD,MAAM,CAAC,EAAE,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC;CACvC;AACD,MAAM,MAAM,yBAAyB,GAAG,CAAC,KAAK,EAAE,8BAA8B,KAAK,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;AA+BtG,wBAAgB,uBAAuB;;;gDAgDc,aAAa;EA0IjE"}
@@ -82,10 +82,14 @@ export function useFeatureNotifications() {
82
82
  // Retrieve previously seen feature notifications from persistence to determine
83
83
  // which features the user has already viewed
84
84
  ((payload === null || payload === void 0 ? void 0 : payload.__retrieveFeatureNotifications) || retrieveFeatureNotifications)(persistenceConfig).then(seenFeatureNotifications => {
85
+ var _a;
85
86
  setSeenFeatures(seenFeatureNotifications);
86
87
  const hasUnseenFeatures = features.some(feature => !seenFeatureNotifications[feature.id]);
87
88
  if (hasUnseenFeatures) {
88
- if (!payload.suppressFeaturePrompt && !featurePromptDismissed) {
89
+ const latestFeature = (_a = features.find(feature => !seenFeatureNotifications[feature.id])) !== null && _a !== void 0 ? _a : null;
90
+ if (!payload.suppressFeaturePrompt &&
91
+ !featurePromptDismissed &&
92
+ !seenFeatureNotifications[getFeaturePromptPersistenceId(latestFeature)]) {
89
93
  featurePromptMountPromise.then(() => {
90
94
  var _a;
91
95
  (_a = featurePromptRef.current) === null || _a === void 0 ? void 0 : _a.show();
@@ -128,6 +132,7 @@ export function useFeatureNotifications() {
128
132
  triggerRef.current.dataset.awsuiSuppressTooltip = 'false';
129
133
  }
130
134
  });
135
+ persistFeaturePromptDismiss(latestFeature);
131
136
  }, header: React.createElement(RuntimeContentPart, { mountContent: featureNotificationsData === null || featureNotificationsData === void 0 ? void 0 : featureNotificationsData.mountItem, content: latestFeature.header }), content: React.createElement(RuntimeContentPart, { mountContent: featureNotificationsData === null || featureNotificationsData === void 0 ? void 0 : featureNotificationsData.mountItem, content: latestFeature.content }), trackKey: latestFeature.id, position: "left", getTrack: () => triggerRef.current }));
132
137
  }
133
138
  const setFeaturesToSeenAndPersist = () => {
@@ -146,6 +151,17 @@ export function useFeatureNotifications() {
146
151
  setFeatureNotificationsData(data => (data ? { ...data, badge: false } : data));
147
152
  });
148
153
  };
154
+ const getFeaturePromptPersistenceId = (feature) => `${feature === null || feature === void 0 ? void 0 : feature.id}_feature-prompt`;
155
+ const persistFeaturePromptDismiss = (feature) => {
156
+ var _a, _b, _c;
157
+ const persistenceConfig = (_a = featureNotificationsData === null || featureNotificationsData === void 0 ? void 0 : featureNotificationsData.persistenceConfig) !== null && _a !== void 0 ? _a : DEFAULT_PERSISTENCE_CONFIG;
158
+ const featuresMap = { [getFeaturePromptPersistenceId(feature)]: (_b = feature.releaseDate) === null || _b === void 0 ? void 0 : _b.toString() };
159
+ const filteredSeenFeaturesMap = filterOutdatedFeatures(seenFeatures);
160
+ const allFeaturesMap = { ...featuresMap, ...filteredSeenFeaturesMap };
161
+ ((_c = featureNotificationsData === null || featureNotificationsData === void 0 ? void 0 : featureNotificationsData.__persistFeatureNotifications) !== null && _c !== void 0 ? _c : persistFeatureNotifications)(persistenceConfig, allFeaturesMap).then(() => {
162
+ setSeenFeatures(allFeaturesMap);
163
+ });
164
+ };
149
165
  const onOpenFeatureNotificationsDrawer = () => {
150
166
  if (!featureNotificationsData || allNotificationsSeen) {
151
167
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"use-feature-notifications.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/use-feature-notifications.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAa,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpE,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAE7E,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC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AC;IAEF,MAAM,yBAAyB,GAA8B;QAC3D,yBAAyB;QACzB,MAAM,EAAE,wBAAwB,IAAI,kBAAkB,CAAC,wBAAwB,CAAC;KACjF,CAAC;IAEF,OAAO;QACL,yBAAyB;QACzB,gCAAgC;QAChC,kCAAkC;KACnC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { RefObject, useMemo, useRef, useState } from 'react';\n\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../../../i18n/context';\nimport FeaturePrompt, { FeaturePromptProps } from '../../../internal/do-not-use/feature-prompt';\nimport { persistFeatureNotifications, retrieveFeatureNotifications } from '../../../internal/persistence';\nimport {\n Feature,\n FeatureNotificationsPayload,\n PersistedFeaturesDict,\n WidgetMessage,\n} from '../../../internal/plugins/widget/interfaces';\nimport { useMountRefPromise } from '../../../internal/utils/promises';\nimport { AppLayoutProps } from '../../interfaces';\nimport RuntimeFeaturesNotificationDrawer, { RuntimeContentPart } from '../drawer/feature-notifications-drawer-content';\n\nconst DEFAULT_PERSISTENCE_CONFIG = {\n uniqueKey: 'awsui-feature-notifications',\n};\n\ninterface RenderLatestFeaturePromptProps {\n triggerRef: RefObject<HTMLElement>;\n}\nexport interface FeatureNotificationsProps {\n renderLatestFeaturePrompt: RenderLatestFeaturePrompt;\n drawer?: AppLayoutProps.Drawer | null;\n}\nexport type RenderLatestFeaturePrompt = (props: RenderLatestFeaturePromptProps) => JSX.Element | null;\ninterface FeatureNotifications extends FeatureNotificationsPayload<unknown> {\n badge?: boolean;\n}\n\nconst FEATURE_NOTIFICATIONS_RETENTION_DAYS = 180;\nconst DEFAULT_FEATURE_FILTER_DAYS = 90;\n\nfunction subtractDaysFromDate(currentDate: Date, daysToSubtract: number = 0): Date {\n const pastDate = new Date(currentDate);\n pastDate.setDate(pastDate.getDate() - daysToSubtract);\n return pastDate;\n}\n\nfunction filterOutdatedFeatures(features: PersistedFeaturesDict): PersistedFeaturesDict {\n const cutoffDate = subtractDaysFromDate(new Date(), FEATURE_NOTIFICATIONS_RETENTION_DAYS);\n\n return Object.keys(features).reduce((acc, key) => {\n const featureDate = new Date(features[key]);\n\n if (featureDate && featureDate >= cutoffDate) {\n return {\n ...acc,\n [key]: features[key],\n };\n }\n\n return acc;\n }, {});\n}\n\nexport function useFeatureNotifications() {\n const i18n = useInternalI18n('features-notification-drawer');\n const [featurePromptDismissed, setFeaturePromptDismissed] = useState(false);\n const [featureNotificationsData, setFeatureNotificationsData] = useState<FeatureNotifications | null>(null);\n const [seenFeatures, setSeenFeatures] = useState<PersistedFeaturesDict>({});\n const featurePromptRef = useRef<FeaturePromptProps.Ref>(null);\n const { ref: featurePromptMountRef, promise: featurePromptMountPromise } = useMountRefPromise();\n const featurePromptMergedRef = useMergeRefs(featurePromptRef, featurePromptMountRef);\n const allNotificationsSeen = useMemo(() => {\n return featureNotificationsData?.features.every(feature => !!seenFeatures[feature.id]);\n }, [featureNotificationsData, seenFeatures]);\n\n const defaultFeaturesFilter = (feature: Feature<unknown>) => {\n return feature.releaseDate >= subtractDaysFromDate(new Date(), DEFAULT_FEATURE_FILTER_DAYS);\n };\n\n const getFeaturesToDisplay = (payload: FeatureNotificationsPayload<unknown>): Array<Feature<unknown>> => {\n return payload.features\n .slice()\n .filter(payload.filterFeatures ? payload.filterFeatures : defaultFeaturesFilter)\n .sort((a, b) => b.releaseDate.getTime() - a.releaseDate.getTime());\n };\n\n const mapPayloadToDrawer = (payload: FeatureNotifications): AppLayoutProps.Drawer => {\n return {\n id: payload.id,\n content: (\n <RuntimeFeaturesNotificationDrawer\n features={payload.features}\n featuresPageLink={payload.featuresPageLink}\n mountItem={payload.mountItem}\n />\n ),\n trigger: {\n iconName: 'suggestions',\n },\n ariaLabels: {\n closeButton: i18n('ariaLabels.closeButton', undefined),\n drawerName: i18n('ariaLabels.content', undefined) ?? '',\n triggerButton: i18n('ariaLabels.triggerButton', undefined),\n resizeHandle: i18n('ariaLabels.resizeHandle', undefined),\n },\n resizable: true,\n defaultSize: 320,\n badge: payload.badge,\n };\n };\n\n function featureNotificationsMessageHandler(event: WidgetMessage) {\n if (event.type === 'registerFeatureNotifications') {\n const { payload } = event;\n const features = getFeaturesToDisplay(payload);\n if (features.length === 0) {\n return;\n }\n\n setFeatureNotificationsData({ ...payload, features });\n\n const persistenceConfig = payload.persistenceConfig ?? DEFAULT_PERSISTENCE_CONFIG;\n // Retrieve previously seen feature notifications from persistence to determine\n // which features the user has already viewed\n (payload?.__retrieveFeatureNotifications || retrieveFeatureNotifications)(persistenceConfig).then(\n seenFeatureNotifications => {\n setSeenFeatures(seenFeatureNotifications);\n const hasUnseenFeatures = features.some(feature => !seenFeatureNotifications[feature.id]);\n if (hasUnseenFeatures) {\n if (!payload.suppressFeaturePrompt && !featurePromptDismissed) {\n featurePromptMountPromise.then(() => {\n featurePromptRef.current?.show();\n });\n }\n setFeatureNotificationsData(data => (data ? { ...data, badge: true } : data));\n }\n }\n );\n return;\n }\n\n if (event.type === 'showFeaturePromptIfPossible' && !allNotificationsSeen) {\n featurePromptRef.current?.show();\n return;\n }\n\n if (event.type === 'clearFeatureNotifications') {\n setFeatureNotificationsData(null);\n return;\n }\n }\n\n function getLatestUnseenFeature() {\n return featureNotificationsData?.features.find(feature => !seenFeatures[feature.id]) ?? null;\n }\n\n function renderLatestFeaturePrompt({ triggerRef }: RenderLatestFeaturePromptProps) {\n const latestFeature = getLatestUnseenFeature();\n if (!triggerRef.current || !latestFeature) {\n return null;\n }\n return (\n <FeaturePrompt\n ref={featurePromptMergedRef}\n onShow={() => {\n triggerRef.current!.dataset!.awsuiSuppressTooltip = 'true';\n }}\n onDismiss={event => {\n if (event.detail?.method !== 'blur') {\n triggerRef?.current!.focus();\n }\n setFeaturePromptDismissed(true);\n Promise.resolve().then(() => {\n if (triggerRef.current?.dataset) {\n triggerRef.current!.dataset!.awsuiSuppressTooltip = 'false';\n }\n });\n }}\n header={\n <RuntimeContentPart mountContent={featureNotificationsData?.mountItem} content={latestFeature.header} />\n }\n content={\n <RuntimeContentPart mountContent={featureNotificationsData?.mountItem} content={latestFeature.content} />\n }\n trackKey={latestFeature.id}\n position=\"left\"\n getTrack={() => triggerRef.current}\n />\n );\n }\n\n const setFeaturesToSeenAndPersist = () => {\n const persistenceConfig = featureNotificationsData?.persistenceConfig ?? DEFAULT_PERSISTENCE_CONFIG;\n const featuresMap = featureNotificationsData?.features.reduce((acc, feature) => {\n return {\n ...acc,\n [feature.id]: feature.releaseDate,\n };\n }, {});\n const filteredSeenFeaturesMap = filterOutdatedFeatures(seenFeatures);\n const allFeaturesMap = { ...featuresMap, ...filteredSeenFeaturesMap };\n (featureNotificationsData?.__persistFeatureNotifications ?? persistFeatureNotifications)(\n persistenceConfig,\n allFeaturesMap\n ).then(() => {\n setSeenFeatures(allFeaturesMap);\n setFeatureNotificationsData(data => (data ? { ...data, badge: false } : data));\n });\n };\n\n const onOpenFeatureNotificationsDrawer = () => {\n if (!featureNotificationsData || allNotificationsSeen) {\n return;\n }\n\n setFeaturesToSeenAndPersist();\n };\n\n const featureNotificationsProps: FeatureNotificationsProps = {\n renderLatestFeaturePrompt,\n drawer: featureNotificationsData && mapPayloadToDrawer(featureNotificationsData),\n };\n\n return {\n featureNotificationsProps,\n onOpenFeatureNotificationsDrawer,\n featureNotificationsMessageHandler,\n };\n}\n"]}
1
+ {"version":3,"file":"use-feature-notifications.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/state/use-feature-notifications.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAa,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpE,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAE7E,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,aAAqC,MAAM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Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { RefObject, useMemo, useRef, useState } from 'react';\n\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../../../i18n/context';\nimport FeaturePrompt, { FeaturePromptProps } from '../../../internal/do-not-use/feature-prompt';\nimport { persistFeatureNotifications, retrieveFeatureNotifications } from '../../../internal/persistence';\nimport {\n Feature,\n FeatureNotificationsPayload,\n PersistedFeaturesDict,\n WidgetMessage,\n} from '../../../internal/plugins/widget/interfaces';\nimport { useMountRefPromise } from '../../../internal/utils/promises';\nimport { AppLayoutProps } from '../../interfaces';\nimport RuntimeFeaturesNotificationDrawer, { RuntimeContentPart } from '../drawer/feature-notifications-drawer-content';\n\nconst DEFAULT_PERSISTENCE_CONFIG = {\n uniqueKey: 'awsui-feature-notifications',\n};\n\ninterface RenderLatestFeaturePromptProps {\n triggerRef: RefObject<HTMLElement>;\n}\nexport interface FeatureNotificationsProps {\n renderLatestFeaturePrompt: RenderLatestFeaturePrompt;\n drawer?: AppLayoutProps.Drawer | null;\n}\nexport type RenderLatestFeaturePrompt = (props: RenderLatestFeaturePromptProps) => JSX.Element | null;\ninterface FeatureNotifications extends FeatureNotificationsPayload<unknown> {\n badge?: boolean;\n}\n\nconst FEATURE_NOTIFICATIONS_RETENTION_DAYS = 180;\nconst DEFAULT_FEATURE_FILTER_DAYS = 90;\n\nfunction subtractDaysFromDate(currentDate: Date, daysToSubtract: number = 0): Date {\n const pastDate = new Date(currentDate);\n pastDate.setDate(pastDate.getDate() - daysToSubtract);\n return pastDate;\n}\n\nfunction filterOutdatedFeatures(features: PersistedFeaturesDict): PersistedFeaturesDict {\n const cutoffDate = subtractDaysFromDate(new Date(), FEATURE_NOTIFICATIONS_RETENTION_DAYS);\n\n return Object.keys(features).reduce((acc, key) => {\n const featureDate = new Date(features[key]);\n\n if (featureDate && featureDate >= cutoffDate) {\n return {\n ...acc,\n [key]: features[key],\n };\n }\n\n return acc;\n }, {});\n}\n\nexport function useFeatureNotifications() {\n const i18n = useInternalI18n('features-notification-drawer');\n const [featurePromptDismissed, setFeaturePromptDismissed] = useState(false);\n const [featureNotificationsData, setFeatureNotificationsData] = useState<FeatureNotifications | null>(null);\n const [seenFeatures, setSeenFeatures] = useState<PersistedFeaturesDict>({});\n const featurePromptRef = useRef<FeaturePromptProps.Ref>(null);\n const { ref: featurePromptMountRef, promise: featurePromptMountPromise } = useMountRefPromise();\n const featurePromptMergedRef = useMergeRefs(featurePromptRef, featurePromptMountRef);\n const allNotificationsSeen = useMemo(() => {\n return featureNotificationsData?.features.every(feature => !!seenFeatures[feature.id]);\n }, [featureNotificationsData, seenFeatures]);\n\n const defaultFeaturesFilter = (feature: Feature<unknown>) => {\n return feature.releaseDate >= subtractDaysFromDate(new Date(), DEFAULT_FEATURE_FILTER_DAYS);\n };\n\n const getFeaturesToDisplay = (payload: FeatureNotificationsPayload<unknown>): Array<Feature<unknown>> => {\n return payload.features\n .slice()\n .filter(payload.filterFeatures ? payload.filterFeatures : defaultFeaturesFilter)\n .sort((a, b) => b.releaseDate.getTime() - a.releaseDate.getTime());\n };\n\n const mapPayloadToDrawer = (payload: FeatureNotifications): AppLayoutProps.Drawer => {\n return {\n id: payload.id,\n content: (\n <RuntimeFeaturesNotificationDrawer\n features={payload.features}\n featuresPageLink={payload.featuresPageLink}\n mountItem={payload.mountItem}\n />\n ),\n trigger: {\n iconName: 'suggestions',\n },\n ariaLabels: {\n closeButton: i18n('ariaLabels.closeButton', undefined),\n drawerName: i18n('ariaLabels.content', undefined) ?? '',\n triggerButton: i18n('ariaLabels.triggerButton', undefined),\n resizeHandle: i18n('ariaLabels.resizeHandle', undefined),\n },\n resizable: true,\n defaultSize: 320,\n badge: payload.badge,\n };\n };\n\n function featureNotificationsMessageHandler(event: WidgetMessage) {\n if (event.type === 'registerFeatureNotifications') {\n const { payload } = event;\n const features = getFeaturesToDisplay(payload);\n if (features.length === 0) {\n return;\n }\n\n setFeatureNotificationsData({ ...payload, features });\n\n const persistenceConfig = payload.persistenceConfig ?? DEFAULT_PERSISTENCE_CONFIG;\n // Retrieve previously seen feature notifications from persistence to determine\n // which features the user has already viewed\n (payload?.__retrieveFeatureNotifications || retrieveFeatureNotifications)(persistenceConfig).then(\n seenFeatureNotifications => {\n setSeenFeatures(seenFeatureNotifications);\n const hasUnseenFeatures = features.some(feature => !seenFeatureNotifications[feature.id]);\n if (hasUnseenFeatures) {\n const latestFeature = features.find(feature => !seenFeatureNotifications[feature.id]) ?? null;\n if (\n !payload.suppressFeaturePrompt &&\n !featurePromptDismissed &&\n !seenFeatureNotifications[getFeaturePromptPersistenceId(latestFeature)]\n ) {\n featurePromptMountPromise.then(() => {\n featurePromptRef.current?.show();\n });\n }\n setFeatureNotificationsData(data => (data ? { ...data, badge: true } : data));\n }\n }\n );\n return;\n }\n\n if (event.type === 'showFeaturePromptIfPossible' && !allNotificationsSeen) {\n featurePromptRef.current?.show();\n return;\n }\n\n if (event.type === 'clearFeatureNotifications') {\n setFeatureNotificationsData(null);\n return;\n }\n }\n\n function getLatestUnseenFeature() {\n return featureNotificationsData?.features.find(feature => !seenFeatures[feature.id]) ?? null;\n }\n\n function renderLatestFeaturePrompt({ triggerRef }: RenderLatestFeaturePromptProps) {\n const latestFeature = getLatestUnseenFeature();\n if (!triggerRef.current || !latestFeature) {\n return null;\n }\n return (\n <FeaturePrompt\n ref={featurePromptMergedRef}\n onShow={() => {\n triggerRef.current!.dataset!.awsuiSuppressTooltip = 'true';\n }}\n onDismiss={event => {\n if (event.detail?.method !== 'blur') {\n triggerRef?.current!.focus();\n }\n setFeaturePromptDismissed(true);\n Promise.resolve().then(() => {\n if (triggerRef.current?.dataset) {\n triggerRef.current!.dataset!.awsuiSuppressTooltip = 'false';\n }\n });\n persistFeaturePromptDismiss(latestFeature);\n }}\n header={\n <RuntimeContentPart mountContent={featureNotificationsData?.mountItem} content={latestFeature.header} />\n }\n content={\n <RuntimeContentPart mountContent={featureNotificationsData?.mountItem} content={latestFeature.content} />\n }\n trackKey={latestFeature.id}\n position=\"left\"\n getTrack={() => triggerRef.current}\n />\n );\n }\n\n const setFeaturesToSeenAndPersist = () => {\n const persistenceConfig = featureNotificationsData?.persistenceConfig ?? DEFAULT_PERSISTENCE_CONFIG;\n const featuresMap = featureNotificationsData?.features.reduce((acc, feature) => {\n return {\n ...acc,\n [feature.id]: feature.releaseDate,\n };\n }, {});\n const filteredSeenFeaturesMap = filterOutdatedFeatures(seenFeatures);\n const allFeaturesMap = { ...featuresMap, ...filteredSeenFeaturesMap };\n (featureNotificationsData?.__persistFeatureNotifications ?? persistFeatureNotifications)(\n persistenceConfig,\n allFeaturesMap\n ).then(() => {\n setSeenFeatures(allFeaturesMap);\n setFeatureNotificationsData(data => (data ? { ...data, badge: false } : data));\n });\n };\n\n const getFeaturePromptPersistenceId = (feature?: Feature<unknown> | null) => `${feature?.id}_feature-prompt`;\n\n const persistFeaturePromptDismiss = (feature: Feature<unknown>) => {\n const persistenceConfig = featureNotificationsData?.persistenceConfig ?? DEFAULT_PERSISTENCE_CONFIG;\n const featuresMap = { [getFeaturePromptPersistenceId(feature)]: feature.releaseDate?.toString() };\n const filteredSeenFeaturesMap = filterOutdatedFeatures(seenFeatures);\n const allFeaturesMap = { ...featuresMap, ...filteredSeenFeaturesMap };\n (featureNotificationsData?.__persistFeatureNotifications ?? persistFeatureNotifications)(\n persistenceConfig,\n allFeaturesMap\n ).then(() => {\n setSeenFeatures(allFeaturesMap);\n });\n };\n\n const onOpenFeatureNotificationsDrawer = () => {\n if (!featureNotificationsData || allNotificationsSeen) {\n return;\n }\n\n setFeaturesToSeenAndPersist();\n };\n\n const featureNotificationsProps: FeatureNotificationsProps = {\n renderLatestFeaturePrompt,\n drawer: featureNotificationsData && mapPayloadToDrawer(featureNotificationsData),\n };\n\n return {\n featureNotificationsProps,\n onOpenFeatureNotificationsDrawer,\n featureNotificationsMessageHandler,\n };\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { BuiltInIconName, IconRegistryIconName } from '../icon-provider/interfaces';
2
3
  import { BaseComponentProps } from '../internal/base-component';
3
4
  /**
4
5
  * @awsuiSystem core
@@ -76,7 +77,7 @@ export interface IconProps extends BaseComponentProps {
76
77
  nativeAttributes?: NativeAttributes<React.HTMLAttributes<HTMLElement>>;
77
78
  }
78
79
  export declare namespace IconProps {
79
- type Name = 'add-plus' | 'anchor-link' | 'angle-left-double' | 'angle-left' | 'angle-right-double' | 'angle-right' | 'angle-up' | 'angle-down' | 'arrow-left' | 'arrow-right' | 'arrow-up' | 'arrow-down' | 'at-symbol' | 'audio-full' | 'audio-half' | 'audio-off' | 'backward-10-seconds' | 'bug' | 'call' | 'calendar' | 'caret-down-filled' | 'caret-down' | 'caret-left-filled' | 'caret-right-filled' | 'caret-up-filled' | 'caret-up' | 'check' | 'contact' | 'close' | 'closed-caption' | 'closed-caption-unavailable' | 'copy' | 'command-prompt' | 'delete-marker' | 'download' | 'drag-indicator' | 'edit' | 'edit-gen-ai' | 'ellipsis' | 'envelope' | 'exit-full-screen' | 'expand' | 'external' | 'face-happy' | 'face-happy-filled' | 'face-neutral' | 'face-neutral-filled' | 'face-sad' | 'face-sad-filled' | 'file-open' | 'file' | 'filter' | 'flag' | 'folder-open' | 'folder' | 'forward-10-seconds' | 'full-screen' | 'gen-ai' | 'globe' | 'grid-view' | 'group-active' | 'group' | 'heart' | 'heart-filled' | 'history' | 'insert-row' | 'key' | 'keyboard' | 'list-view' | 'location-pin' | 'lock-private' | 'map' | 'menu' | 'microphone' | 'microphone-off' | 'mini-player' | 'multiscreen' | 'notification' | 'pause' | 'play' | 'redo' | 'refresh' | 'remove' | 'resize-area' | 'script' | 'search' | 'search-gen-ai' | 'security' | 'settings' | 'send' | 'share' | 'shrink' | 'slash' | 'star-filled' | 'star-half' | 'star' | 'status-in-progress' | 'status-info' | 'status-negative' | 'status-not-started' | 'status-pending' | 'status-positive' | 'status-stopped' | 'status-warning' | 'stop-circle' | 'subtract-minus' | 'suggestions' | 'suggestions-gen-ai' | 'support' | 'thumbs-down-filled' | 'thumbs-down' | 'thumbs-up-filled' | 'thumbs-up' | 'ticket' | 'transcript' | 'treeview-collapse' | 'treeview-expand' | 'undo' | 'unlocked' | 'upload-download' | 'upload' | 'user-profile-active' | 'user-profile' | 'video-off' | 'video-on' | 'video-unavailable' | 'video-camera-off' | 'video-camera-on' | 'video-camera-unavailable' | 'view-full' | 'view-horizontal' | 'view-vertical' | 'zoom-in' | 'zoom-out' | 'zoom-to-fit';
80
+ type Name = BuiltInIconName | IconRegistryIconName;
80
81
  type Variant = 'normal' | 'disabled' | 'error' | 'inverted' | 'link' | 'subtle' | 'success' | 'warning';
81
82
  type Size = 'small' | 'normal' | 'medium' | 'big' | 'large' | 'inherit';
82
83
  }
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/icon/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAE5E,MAAM,WAAW,SAAU,SAAQ,kBAAkB;IACnD;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;IAEtB;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;IAEtB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC;IAE5B;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEtB;;;;;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R,OAAO,GACP,aAAa,GACb,WAAW,GACX,MAAM,GACN,oBAAoB,GACpB,aAAa,GACb,iBAAiB,GACjB,oBAAoB,GACpB,gBAAgB,GAChB,iBAAiB,GACjB,gBAAgB,GAChB,gBAAgB,GAChB,aAAa,GACb,gBAAgB,GAChB,aAAa,GACb,oBAAoB,GACpB,SAAS,GACT,oBAAoB,GACpB,aAAa,GACb,kBAAkB,GAClB,WAAW,GACX,QAAQ,GACR,YAAY,GACZ,mBAAmB,GACnB,iBAAiB,GACjB,MAAM,GACN,UAAU,GACV,iBAAiB,GACjB,QAAQ,GACR,qBAAqB,GACrB,cAAc,GACd,WAAW,GACX,UAAU,GACV,mBAAmB,GACnB,kBAAkB,GAClB,iBAAiB,GACjB,0BAA0B,GAC1B,WAAW,GACX,iBAAiB,GACjB,eAAe,GACf,SAAS,GACT,UAAU,GACV,aAAa,CAAC;IAElB,KAAY,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IAE/G,KAAY,IAAI,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;CAChF"}
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/icon/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAE5E,MAAM,WAAW,SAAU,SAAQ,kBAAkB;IACnD;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;IAEtB;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;IAEtB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC;IAE5B;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEtB;;;;;;;;;OASG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;CACxE;AAED,yBAAiB,SAAS,CAAC;IACzB,KAAY,IAAI,GAAG,eAAe,GAAG,oBAAoB,CAAC;IAE1D,KAAY,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IAE/G,KAAY,IAAI,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;CAChF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/icon/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseComponentProps } from '../internal/base-component';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../internal/utils/with-native-attributes';\n\nexport interface IconProps extends BaseComponentProps {\n /**\n * Specifies the icon to be displayed.\n */\n name?: IconProps.Name;\n\n /**\n * Specifies the size of the icon.\n *\n * If you set size to `inherit`, an icon size will be assigned based on the icon's inherited line height.\n * For icons used alongside text, ensure the icon is placed inside the acompanying text tag.\n * The icon will be vertically centered based on the height.\n *\n * @visualrefresh `medium` size\n */\n size?: IconProps.Size;\n\n /**\n * Specifies the color variant of the icon. The `normal` variant picks up the current color of its context.\n */\n variant?: IconProps.Variant;\n\n /**\n * Specifies the URL of a custom icon. Use this property if the icon you want isn't available, and your custom icon cannot be an SVG.\n * For SVG icons, use the `svg` slot instead.\n *\n * If you set both `url` and `svg`, `svg` will take precedence.\n */\n url?: string;\n\n /**\n * Specifies alternate text for a custom icon (using the `url` attribute).\n * This property is ignored if you use a predefined icon or if you set your custom icon using the `svg` slot.\n *\n * @deprecated Use `ariaLabel` instead.\n */\n alt?: string;\n\n /**\n * Specifies alternate text for the icon. We recommend that you provide this for accessibility.\n */\n ariaLabel?: string;\n\n /**\n * Specifies the SVG of a custom icon.\n *\n * Use this property if the icon you want isn't available, and you want your custom icon to inherit colors dictated by variant or hover states.\n * When this property is set, the component will be decorated with `aria-hidden=\"true\"`. Ensure that the `svg` element:\n * - has attribute `focusable=\"false\"`.\n * - has `viewBox=\"0 0 16 16\"`.\n *\n * If you set the `svg` element as the root node of the slot, the component will automatically\n * - set `stroke=\"currentColor\"`, `fill=\"none\"`, and `vertical-align=\"top\"`.\n * - set the stroke width based on the size of the icon.\n * - set the width and height of the SVG element based on the size of the icon.\n *\n * If you don't want these styles to be automatically set, wrap the `svg` element into a `span` and ensure icon `size` is not set to `inherit`.\n * You can still set the stroke to `currentColor` to inherit the color of the surrounding elements.\n *\n * If you set both `url` and `svg`, `svg` will take precedence.\n *\n * *Note:* Remember to remove any additional elements (for example: `defs`) and related CSS classes from SVG files exported from design software.\n * In most cases, they aren't needed, as the `svg` element inherits styles from the icon component.\n */\n svg?: React.ReactNode;\n\n /**\n * Attributes to add to the native element.\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeAttributes?: NativeAttributes<React.HTMLAttributes<HTMLElement>>;\n}\n\nexport namespace IconProps {\n // Why not enums? Explained there\n // https://stackoverflow.com/questions/52393730/typescript-string-literal-union-type-from-enum\n export type Name =\n | 'add-plus'\n | 'anchor-link'\n | 'angle-left-double'\n | 'angle-left'\n | 'angle-right-double'\n | 'angle-right'\n | 'angle-up'\n | 'angle-down'\n | 'arrow-left'\n | 'arrow-right'\n | 'arrow-up'\n | 'arrow-down'\n | 'at-symbol'\n | 'audio-full'\n | 'audio-half'\n | 'audio-off'\n | 'backward-10-seconds'\n | 'bug'\n | 'call'\n | 'calendar'\n | 'caret-down-filled'\n | 'caret-down'\n | 'caret-left-filled'\n | 'caret-right-filled'\n | 'caret-up-filled'\n | 'caret-up'\n | 'check'\n | 'contact'\n | 'close'\n | 'closed-caption'\n | 'closed-caption-unavailable'\n | 'copy'\n | 'command-prompt'\n | 'delete-marker'\n | 'download'\n | 'drag-indicator'\n | 'edit'\n | 'edit-gen-ai'\n | 'ellipsis'\n | 'envelope'\n | 'exit-full-screen'\n | 'expand'\n | 'external'\n | 'face-happy'\n | 'face-happy-filled'\n | 'face-neutral'\n | 'face-neutral-filled'\n | 'face-sad'\n | 'face-sad-filled'\n | 'file-open'\n | 'file'\n | 'filter'\n | 'flag'\n | 'folder-open'\n | 'folder'\n | 'forward-10-seconds'\n | 'full-screen'\n | 'gen-ai'\n | 'globe'\n | 'grid-view'\n | 'group-active'\n | 'group'\n | 'heart'\n | 'heart-filled'\n | 'history'\n | 'insert-row'\n | 'key'\n | 'keyboard'\n | 'list-view'\n | 'location-pin'\n | 'lock-private'\n | 'map'\n | 'menu'\n | 'microphone'\n | 'microphone-off'\n | 'mini-player'\n | 'multiscreen'\n | 'notification'\n | 'pause'\n | 'play'\n | 'redo'\n | 'refresh'\n | 'remove'\n | 'resize-area'\n | 'script'\n | 'search'\n | 'search-gen-ai'\n | 'security'\n | 'settings'\n | 'send'\n | 'share'\n | 'shrink'\n | 'slash'\n | 'star-filled'\n | 'star-half'\n | 'star'\n | 'status-in-progress'\n | 'status-info'\n | 'status-negative'\n | 'status-not-started'\n | 'status-pending'\n | 'status-positive'\n | 'status-stopped'\n | 'status-warning'\n | 'stop-circle'\n | 'subtract-minus'\n | 'suggestions'\n | 'suggestions-gen-ai'\n | 'support'\n | 'thumbs-down-filled'\n | 'thumbs-down'\n | 'thumbs-up-filled'\n | 'thumbs-up'\n | 'ticket'\n | 'transcript'\n | 'treeview-collapse'\n | 'treeview-expand'\n | 'undo'\n | 'unlocked'\n | 'upload-download'\n | 'upload'\n | 'user-profile-active'\n | 'user-profile'\n | 'video-off'\n | 'video-on'\n | 'video-unavailable'\n | 'video-camera-off'\n | 'video-camera-on'\n | 'video-camera-unavailable'\n | 'view-full'\n | 'view-horizontal'\n | 'view-vertical'\n | 'zoom-in'\n | 'zoom-out'\n | 'zoom-to-fit';\n\n export type Variant = 'normal' | 'disabled' | 'error' | 'inverted' | 'link' | 'subtle' | 'success' | 'warning';\n\n export type Size = 'small' | 'normal' | 'medium' | 'big' | 'large' | 'inherit';\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/icon/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BuiltInIconName, IconRegistryIconName } from '../icon-provider/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../internal/utils/with-native-attributes';\n\nexport interface IconProps extends BaseComponentProps {\n /**\n * Specifies the icon to be displayed.\n */\n name?: IconProps.Name;\n\n /**\n * Specifies the size of the icon.\n *\n * If you set size to `inherit`, an icon size will be assigned based on the icon's inherited line height.\n * For icons used alongside text, ensure the icon is placed inside the acompanying text tag.\n * The icon will be vertically centered based on the height.\n *\n * @visualrefresh `medium` size\n */\n size?: IconProps.Size;\n\n /**\n * Specifies the color variant of the icon. The `normal` variant picks up the current color of its context.\n */\n variant?: IconProps.Variant;\n\n /**\n * Specifies the URL of a custom icon. Use this property if the icon you want isn't available, and your custom icon cannot be an SVG.\n * For SVG icons, use the `svg` slot instead.\n *\n * If you set both `url` and `svg`, `svg` will take precedence.\n */\n url?: string;\n\n /**\n * Specifies alternate text for a custom icon (using the `url` attribute).\n * This property is ignored if you use a predefined icon or if you set your custom icon using the `svg` slot.\n *\n * @deprecated Use `ariaLabel` instead.\n */\n alt?: string;\n\n /**\n * Specifies alternate text for the icon. We recommend that you provide this for accessibility.\n */\n ariaLabel?: string;\n\n /**\n * Specifies the SVG of a custom icon.\n *\n * Use this property if the icon you want isn't available, and you want your custom icon to inherit colors dictated by variant or hover states.\n * When this property is set, the component will be decorated with `aria-hidden=\"true\"`. Ensure that the `svg` element:\n * - has attribute `focusable=\"false\"`.\n * - has `viewBox=\"0 0 16 16\"`.\n *\n * If you set the `svg` element as the root node of the slot, the component will automatically\n * - set `stroke=\"currentColor\"`, `fill=\"none\"`, and `vertical-align=\"top\"`.\n * - set the stroke width based on the size of the icon.\n * - set the width and height of the SVG element based on the size of the icon.\n *\n * If you don't want these styles to be automatically set, wrap the `svg` element into a `span` and ensure icon `size` is not set to `inherit`.\n * You can still set the stroke to `currentColor` to inherit the color of the surrounding elements.\n *\n * If you set both `url` and `svg`, `svg` will take precedence.\n *\n * *Note:* Remember to remove any additional elements (for example: `defs`) and related CSS classes from SVG files exported from design software.\n * In most cases, they aren't needed, as the `svg` element inherits styles from the icon component.\n */\n svg?: React.ReactNode;\n\n /**\n * Attributes to add to the native element.\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeAttributes?: NativeAttributes<React.HTMLAttributes<HTMLElement>>;\n}\n\nexport namespace IconProps {\n export type Name = BuiltInIconName | IconRegistryIconName;\n\n export type Variant = 'normal' | 'disabled' | 'error' | 'inverted' | 'link' | 'subtle' | 'success' | 'warning';\n\n export type Size = 'small' | 'normal' | 'medium' | 'big' | 'large' | 'inherit';\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/icon/internal.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,KAAK,iBAAiB,GAAG,SAAS,GAChC,0BAA0B,GAAG;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAuBJ,QAAA,MAAM,YAAY,GAAI,yGAYnB,iBAAiB,gBAsHnB,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/icon/internal.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,KAAK,iBAAiB,GAAG,SAAS,GAChC,0BAA0B,GAAG;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAuBJ,QAAA,MAAM,YAAY,GAAI,yGAYnB,iBAAiB,gBA6HnB,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,eAAe,YAAY,CAAC"}
@@ -77,7 +77,11 @@ const InternalIcon = ({ name, size = 'normal', variant = 'normal', url, alt, ari
77
77
  React.createElement("path", { d: "m8 4.4 1.018 2.582L11.6 8 9.018 9.018 8 11.6 6.982 9.018 4.4 8l2.582-1.018L8 4.4ZM2.405 2.41l.002-.003.003-.002-.003-.002-.002-.003-.002.003-.003.002.003.002.002.003Z", className: "filled" })));
78
78
  }
79
79
  else {
80
- return icons[name];
80
+ const icon = icons[name];
81
+ if (!icon) {
82
+ warnOnce('Icon', `You have specified \`name="${name}"\` but no icon with that name was found in the current IconProvider context. If this is a custom icon, ensure your app is wrapped in an \`IconProvider\` with the icon defined via \`defineIcons\`.`);
83
+ }
84
+ return icon;
81
85
  }
82
86
  }
83
87
  return (React.createElement(WithNativeAttributes, { ...baseProps, ...labelAttributes, tag: "span", componentName: "Icon", nativeAttributes: nativeAttributes, ref: mergedRef, style: inlineStyles }, validIcon ? iconMap(name) : undefined));
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/icon/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAG5E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAOrC,SAAS,WAAW,CAAC,MAAqB,EAAE,QAAwB;IAClE,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,2EAA2E;QAC3E,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,oFAAoF;IACpF,gEAAgE;IAChE,IAAI,MAAM,IAAI,EAAE,EAAE,CAAC;QACjB,OAAO,OAAO,CAAC;IACjB,CAAC;SAAM,IAAI,MAAM,IAAI,EAAE,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;SAAM,IAAI,MAAM,IAAI,EAAE,IAAI,CAAC,CAAC,QAAQ,IAAI,QAAQ,IAAI,EAAE,EAAE,CAAC;QACxD,OAAO,QAAQ,CAAC;IAClB,CAAC;SAAM,IAAI,MAAM,IAAI,EAAE,E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AY,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useLayoutEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { InternalIconContext } from '../icon-provider/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport WithNativeAttributes from '../internal/utils/with-native-attributes';\nimport { IconProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ntype InternalIconProps = IconProps &\n InternalBaseComponentProps & {\n badge?: boolean;\n };\n\nfunction iconSizeMap(height: number | null, fontSize?: number | null) {\n if (height === null) {\n // This is the best guess for the contextual height while server rendering.\n return 'normal';\n }\n\n // Only display medium size icon when both line-height >= 24px AND font-size >= 20px\n // This prevents icons from becoming medium size inappropriately\n if (height >= 50) {\n return 'large';\n } else if (height >= 36) {\n return 'big';\n } else if (height >= 24 && !!fontSize && fontSize >= 20) {\n return 'medium';\n } else if (height <= 16) {\n return 'small';\n } else {\n return 'normal';\n }\n}\n\nconst InternalIcon = ({\n name,\n size = 'normal',\n variant = 'normal',\n url,\n alt,\n ariaLabel,\n svg,\n badge,\n nativeAttributes,\n __internalRootRef,\n ...props\n}: InternalIconProps) => {\n const icons = useContext(InternalIconContext);\n const iconRef = useRef<HTMLElement>(null);\n // To ensure a re-render is triggered on visual mode changes\n useVisualRefresh();\n const [parentHeight, setParentHeight] = useState<number | null>(null);\n const [parentFontSize, setParentFontSize] = useState<number | null>(null);\n const contextualSize = size === 'inherit';\n const iconSize = contextualSize ? iconSizeMap(parentHeight, parentFontSize) : size;\n const inlineStyles = contextualSize && parentHeight !== null ? { height: `${parentHeight}px` } : {};\n const baseProps = getBaseProps(props);\n\n baseProps.className = clsx(\n baseProps.className,\n styles.icon,\n contextualSize && styles['icon-flex-height'],\n badge && styles.badge,\n !contextualSize && styles[`size-${iconSize}-mapped-height`],\n styles[`size-${iconSize}`],\n styles[`variant-${variant}`],\n styles[`name-${name}`]\n );\n\n // Possible infinite loop is not a concern here because line\n // height should not change without an external state update.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(() => {\n if (!contextualSize || !iconRef.current) {\n return;\n }\n const computedStyle = getComputedStyle(iconRef.current);\n const { lineHeight, fontSize } = computedStyle;\n const newParentHeight = parseInt(lineHeight, 10);\n const newParentFontSize = parseInt(fontSize, 10);\n setParentHeight(newParentHeight);\n setParentFontSize(newParentFontSize);\n });\n\n const mergedRef = useMergeRefs(iconRef, __internalRootRef);\n const hasAriaLabel = typeof ariaLabel === 'string';\n const labelAttributes = hasAriaLabel ? { role: 'img', 'aria-label': ariaLabel } : {};\n\n if (svg) {\n if (url) {\n warnOnce(\n 'Icon',\n 'You have specified both `url` and `svg`. `svg` will take precedence and `url` will be ignored.'\n );\n }\n return (\n <WithNativeAttributes\n {...baseProps}\n {...labelAttributes}\n tag=\"span\"\n componentName=\"Icon\"\n nativeAttributes={nativeAttributes}\n ref={mergedRef}\n aria-hidden={!hasAriaLabel}\n style={inlineStyles}\n >\n {svg}\n </WithNativeAttributes>\n );\n }\n\n if (url) {\n return (\n <WithNativeAttributes\n {...baseProps}\n tag=\"span\"\n componentName=\"Icon\"\n nativeAttributes={nativeAttributes}\n ref={mergedRef}\n style={inlineStyles}\n >\n <img src={url} alt={ariaLabel ?? alt} />\n </WithNativeAttributes>\n );\n }\n\n const validIcon = name && Object.prototype.hasOwnProperty.call(icons, name);\n\n function iconMap(name: IconProps.Name) {\n if (name === 'gen-ai' && iconSize === 'small') {\n return (\n <svg\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 16 16\"\n xmlns=\"http://www.w3.org/2000/svg\"\n focusable=\"false\"\n aria-hidden=\"true\"\n data-testid=\"gen-ai-filled\"\n >\n <path\n d=\"m8 4.4 1.018 2.582L11.6 8 9.018 9.018 8 11.6 6.982 9.018 4.4 8l2.582-1.018L8 4.4ZM2.405 2.41l.002-.003.003-.002-.003-.002-.002-.003-.002.003-.003.002.003.002.002.003Z\"\n className=\"filled\"\n />\n </svg>\n );\n } else {\n return icons[name];\n }\n }\n\n return (\n <WithNativeAttributes\n {...baseProps}\n {...labelAttributes}\n tag=\"span\"\n componentName=\"Icon\"\n nativeAttributes={nativeAttributes}\n ref={mergedRef}\n style={inlineStyles}\n >\n {validIcon ? iconMap(name) : undefined}\n </WithNativeAttributes>\n );\n};\n\nexport { InternalIconProps };\nexport default InternalIcon;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/icon/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAG5E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAOrC,SAAS,WAAW,CAAC,MAAqB,EAAE,QAAwB;IAClE,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,2EAA2E;QAC3E,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,oFAAoF;IACpF,gEAAgE;IAChE,IAAI,MAAM,IAAI,EAAE,EAAE,CAAC;QACjB,OAAO,OAAO,CAAC;IACjB,CAAC;SAAM,IAAI,MAAM,IAAI,EAAE,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,C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,CAAC;IAED,OAAO,CACL,oBAAC,oBAAoB,OACf,SAAS,KACT,eAAe,EACnB,GAAG,EAAC,MAAM,EACV,aAAa,EAAC,MAAM,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,YAAY,IAElB,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CACjB,CACxB,CAAC;AACJ,CAAC,CAAC;AAGF,eAAe,YAAY,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useLayoutEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { InternalIconContext } from '../icon-provider/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport WithNativeAttributes from '../internal/utils/with-native-attributes';\nimport { IconProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\ntype InternalIconProps = IconProps &\n InternalBaseComponentProps & {\n badge?: boolean;\n };\n\nfunction iconSizeMap(height: number | null, fontSize?: number | null) {\n if (height === null) {\n // This is the best guess for the contextual height while server rendering.\n return 'normal';\n }\n\n // Only display medium size icon when both line-height >= 24px AND font-size >= 20px\n // This prevents icons from becoming medium size inappropriately\n if (height >= 50) {\n return 'large';\n } else if (height >= 36) {\n return 'big';\n } else if (height >= 24 && !!fontSize && fontSize >= 20) {\n return 'medium';\n } else if (height <= 16) {\n return 'small';\n } else {\n return 'normal';\n }\n}\n\nconst InternalIcon = ({\n name,\n size = 'normal',\n variant = 'normal',\n url,\n alt,\n ariaLabel,\n svg,\n badge,\n nativeAttributes,\n __internalRootRef,\n ...props\n}: InternalIconProps) => {\n const icons = useContext(InternalIconContext);\n const iconRef = useRef<HTMLElement>(null);\n // To ensure a re-render is triggered on visual mode changes\n useVisualRefresh();\n const [parentHeight, setParentHeight] = useState<number | null>(null);\n const [parentFontSize, setParentFontSize] = useState<number | null>(null);\n const contextualSize = size === 'inherit';\n const iconSize = contextualSize ? iconSizeMap(parentHeight, parentFontSize) : size;\n const inlineStyles = contextualSize && parentHeight !== null ? { height: `${parentHeight}px` } : {};\n const baseProps = getBaseProps(props);\n\n baseProps.className = clsx(\n baseProps.className,\n styles.icon,\n contextualSize && styles['icon-flex-height'],\n badge && styles.badge,\n !contextualSize && styles[`size-${iconSize}-mapped-height`],\n styles[`size-${iconSize}`],\n styles[`variant-${variant}`],\n styles[`name-${name}`]\n );\n\n // Possible infinite loop is not a concern here because line\n // height should not change without an external state update.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(() => {\n if (!contextualSize || !iconRef.current) {\n return;\n }\n const computedStyle = getComputedStyle(iconRef.current);\n const { lineHeight, fontSize } = computedStyle;\n const newParentHeight = parseInt(lineHeight, 10);\n const newParentFontSize = parseInt(fontSize, 10);\n setParentHeight(newParentHeight);\n setParentFontSize(newParentFontSize);\n });\n\n const mergedRef = useMergeRefs(iconRef, __internalRootRef);\n const hasAriaLabel = typeof ariaLabel === 'string';\n const labelAttributes = hasAriaLabel ? { role: 'img', 'aria-label': ariaLabel } : {};\n\n if (svg) {\n if (url) {\n warnOnce(\n 'Icon',\n 'You have specified both `url` and `svg`. `svg` will take precedence and `url` will be ignored.'\n );\n }\n return (\n <WithNativeAttributes\n {...baseProps}\n {...labelAttributes}\n tag=\"span\"\n componentName=\"Icon\"\n nativeAttributes={nativeAttributes}\n ref={mergedRef}\n aria-hidden={!hasAriaLabel}\n style={inlineStyles}\n >\n {svg}\n </WithNativeAttributes>\n );\n }\n\n if (url) {\n return (\n <WithNativeAttributes\n {...baseProps}\n tag=\"span\"\n componentName=\"Icon\"\n nativeAttributes={nativeAttributes}\n ref={mergedRef}\n style={inlineStyles}\n >\n <img src={url} alt={ariaLabel ?? alt} />\n </WithNativeAttributes>\n );\n }\n\n const validIcon = name && Object.prototype.hasOwnProperty.call(icons, name);\n\n function iconMap(name: IconProps.Name) {\n if (name === 'gen-ai' && iconSize === 'small') {\n return (\n <svg\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 16 16\"\n xmlns=\"http://www.w3.org/2000/svg\"\n focusable=\"false\"\n aria-hidden=\"true\"\n data-testid=\"gen-ai-filled\"\n >\n <path\n d=\"m8 4.4 1.018 2.582L11.6 8 9.018 9.018 8 11.6 6.982 9.018 4.4 8l2.582-1.018L8 4.4ZM2.405 2.41l.002-.003.003-.002-.003-.002-.002-.003-.002.003-.003.002.003.002.002.003Z\"\n className=\"filled\"\n />\n </svg>\n );\n } else {\n const icon = icons[name];\n if (!icon) {\n warnOnce(\n 'Icon',\n `You have specified \\`name=\"${name}\"\\` but no icon with that name was found in the current IconProvider context. If this is a custom icon, ensure your app is wrapped in an \\`IconProvider\\` with the icon defined via \\`defineIcons\\`.`\n );\n }\n return icon;\n }\n }\n\n return (\n <WithNativeAttributes\n {...baseProps}\n {...labelAttributes}\n tag=\"span\"\n componentName=\"Icon\"\n nativeAttributes={nativeAttributes}\n ref={mergedRef}\n style={inlineStyles}\n >\n {validIcon ? iconMap(name) : undefined}\n </WithNativeAttributes>\n );\n};\n\nexport { InternalIconProps };\nexport default InternalIcon;\n"]}
@@ -0,0 +1,14 @@
1
+ import { DefineIconsInput } from './interfaces';
2
+ /**
3
+ * Defines a set of custom icons for use with {@link IconProvider}.
4
+ * Use with {@link IconMap} and `declare module` to register the icon names.
5
+ *
6
+ * @example
7
+ * const myIcons = defineIcons({ "my-icon": <MySvg /> });
8
+ *
9
+ * declare module "@cloudscape-design/components/icon-provider" {
10
+ * interface IconRegistry extends IconMap<typeof myIcons> {}
11
+ * }
12
+ */
13
+ export declare function defineIcons<T extends DefineIconsInput>(icons: T): T;
14
+ //# sourceMappingURL=define-icons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-icons.d.ts","sourceRoot":"","sources":["../../../src/icon-provider/define-icons.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,gBAAgB,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAEnE"}
@@ -0,0 +1,17 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ /**
4
+ * Defines a set of custom icons for use with {@link IconProvider}.
5
+ * Use with {@link IconMap} and `declare module` to register the icon names.
6
+ *
7
+ * @example
8
+ * const myIcons = defineIcons({ "my-icon": <MySvg /> });
9
+ *
10
+ * declare module "@cloudscape-design/components/icon-provider" {
11
+ * interface IconRegistry extends IconMap<typeof myIcons> {}
12
+ * }
13
+ */
14
+ export function defineIcons(icons) {
15
+ return icons;
16
+ }
17
+ //# sourceMappingURL=define-icons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-icons.js","sourceRoot":"","sources":["../../../src/icon-provider/define-icons.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CAA6B,KAAQ;IAC9D,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { DefineIconsInput } from './interfaces';\n\n/**\n * Defines a set of custom icons for use with {@link IconProvider}.\n * Use with {@link IconMap} and `declare module` to register the icon names.\n *\n * @example\n * const myIcons = defineIcons({ \"my-icon\": <MySvg /> });\n *\n * declare module \"@cloudscape-design/components/icon-provider\" {\n * interface IconRegistry extends IconMap<typeof myIcons> {}\n * }\n */\nexport function defineIcons<T extends DefineIconsInput>(icons: T): T {\n return icons;\n}\n"]}
@@ -1,5 +1,7 @@
1
1
  import { IconProviderProps } from './interfaces';
2
2
  export { IconProviderProps } from './interfaces';
3
+ export { defineIcons } from './define-icons';
4
+ export type { IconRegistry, IconMap } from './interfaces';
3
5
  /**
4
6
  * @awsuiSystem core
5
7
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icon-provider/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,iBAAiB,eAG5D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icon-provider/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,iBAAiB,eAG5D"}
@@ -5,6 +5,7 @@ import React from 'react';
5
5
  import useBaseComponent from '../internal/hooks/use-base-component';
6
6
  import { applyDisplayName } from '../internal/utils/apply-display-name';
7
7
  import InternalIconProvider from './internal';
8
+ export { defineIcons } from './define-icons';
8
9
  /**
9
10
  * @awsuiSystem core
10
11
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/icon-provider/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,oBAAoB,MAAM,YAAY,CAAC;AAI9C;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAwB;IAC3D,gBAAgB,CAAC,cAAc,CAAC,CAAC;IACjC,OAAO,oBAAC,oBAAoB,OAAK,KAAK,GAAI,CAAC;AAC7C,CAAC;AAED,gBAAgB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { IconProviderProps } from './interfaces';\nimport InternalIconProvider from './internal';\n\nexport { IconProviderProps } from './interfaces';\n\n/**\n * @awsuiSystem core\n */\nexport default function IconProvider(props: IconProviderProps) {\n useBaseComponent('IconProvider');\n return <InternalIconProvider {...props} />;\n}\n\napplyDisplayName(IconProvider, 'IconProvider');\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/icon-provider/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,oBAAoB,MAAM,YAAY,CAAC;AAG9C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAwB;IAC3D,gBAAgB,CAAC,cAAc,CAAC,CAAC;IACjC,OAAO,oBAAC,oBAAoB,OAAK,KAAK,GAAI,CAAC;AAC7C,CAAC;AAED,gBAAgB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { IconProviderProps } from './interfaces';\nimport InternalIconProvider from './internal';\n\nexport { IconProviderProps } from './interfaces';\nexport { defineIcons } from './define-icons';\nexport type { IconRegistry, IconMap } from './interfaces';\n\n/**\n * @awsuiSystem core\n */\nexport default function IconProvider(props: IconProviderProps) {\n useBaseComponent('IconProvider');\n return <InternalIconProvider {...props} />;\n}\n\napplyDisplayName(IconProvider, 'IconProvider');\n"]}
@@ -1,5 +1,25 @@
1
1
  import { ReactNode } from 'react';
2
+ import { IconProps } from '../icon/interfaces';
2
3
  import { BaseComponentProps } from '../internal/base-component';
4
+ export type BuiltInIconName = 'add-plus' | 'anchor-link' | 'angle-left-double' | 'angle-left' | 'angle-right-double' | 'angle-right' | 'angle-up' | 'angle-down' | 'arrow-left' | 'arrow-right' | 'arrow-up' | 'arrow-down' | 'at-symbol' | 'audio-full' | 'audio-half' | 'audio-off' | 'backward-10-seconds' | 'bug' | 'call' | 'calendar' | 'caret-down-filled' | 'caret-down' | 'caret-left-filled' | 'caret-right-filled' | 'caret-up-filled' | 'caret-up' | 'check' | 'contact' | 'close' | 'closed-caption' | 'closed-caption-unavailable' | 'copy' | 'command-prompt' | 'delete-marker' | 'download' | 'drag-indicator' | 'edit' | 'edit-gen-ai' | 'ellipsis' | 'envelope' | 'exit-full-screen' | 'expand' | 'external' | 'face-happy' | 'face-happy-filled' | 'face-neutral' | 'face-neutral-filled' | 'face-sad' | 'face-sad-filled' | 'file-open' | 'file' | 'filter' | 'flag' | 'folder-open' | 'folder' | 'forward-10-seconds' | 'full-screen' | 'gen-ai' | 'globe' | 'grid-view' | 'group-active' | 'group' | 'heart' | 'heart-filled' | 'history' | 'insert-row' | 'key' | 'keyboard' | 'list-view' | 'location-pin' | 'lock-private' | 'map' | 'menu' | 'microphone' | 'microphone-off' | 'mini-player' | 'multiscreen' | 'notification' | 'pause' | 'play' | 'redo' | 'refresh' | 'remove' | 'resize-area' | 'script' | 'search' | 'search-gen-ai' | 'security' | 'settings' | 'send' | 'share' | 'shrink' | 'slash' | 'star-filled' | 'star-half' | 'star' | 'status-in-progress' | 'status-info' | 'status-negative' | 'status-not-started' | 'status-pending' | 'status-positive' | 'status-stopped' | 'status-warning' | 'stop-circle' | 'subtract-minus' | 'suggestions' | 'suggestions-gen-ai' | 'support' | 'thumbs-down-filled' | 'thumbs-down' | 'thumbs-up-filled' | 'thumbs-up' | 'ticket' | 'transcript' | 'treeview-collapse' | 'treeview-expand' | 'undo' | 'unlocked' | 'upload-download' | 'upload' | 'user-profile-active' | 'user-profile' | 'video-off' | 'video-on' | 'video-unavailable' | 'video-camera-off' | 'video-camera-on' | 'video-camera-unavailable' | 'view-full' | 'view-horizontal' | 'view-vertical' | 'zoom-in' | 'zoom-out' | 'zoom-to-fit';
5
+ /**
6
+ * Augment this interface using `declare module` to register custom icon names.
7
+ * Registered names become valid across all icon-accepting components.
8
+ *
9
+ * @example
10
+ * declare module "@cloudscape-design/components/icon-provider" {
11
+ * interface IconRegistry extends IconMap<typeof myIcons> {}
12
+ * }
13
+ */
14
+ export interface IconRegistry {
15
+ }
16
+ /** Union of all icon names in the {@link IconRegistry}. */
17
+ export type IconRegistryIconName = keyof IconRegistry & string;
18
+ export type DefineIconsInput = Partial<Record<BuiltInIconName | (string & {}), ReactNode>>;
19
+ /** Extracts the keys of a `defineIcons` result into the shape that {@link IconRegistry} expects. */
20
+ export type IconMap<T> = {
21
+ [K in keyof T & string]: T[K];
22
+ };
3
23
  export interface IconProviderProps extends BaseComponentProps {
4
24
  children: ReactNode;
5
25
  /**
@@ -18,142 +38,8 @@ export interface IconProviderProps extends BaseComponentProps {
18
38
  icons: IconProviderProps.Icons | null;
19
39
  }
20
40
  export declare namespace IconProviderProps {
21
- interface Icons {
22
- 'add-plus'?: ReactNode | null;
23
- 'anchor-link'?: ReactNode | null;
24
- 'angle-left-double'?: ReactNode | null;
25
- 'angle-left'?: ReactNode | null;
26
- 'angle-right-double'?: ReactNode | null;
27
- 'angle-right'?: ReactNode | null;
28
- 'angle-up'?: ReactNode | null;
29
- 'angle-down'?: ReactNode | null;
30
- 'arrow-left'?: ReactNode | null;
31
- 'arrow-right'?: ReactNode | null;
32
- 'arrow-up'?: ReactNode | null;
33
- 'arrow-down'?: ReactNode | null;
34
- 'at-symbol'?: ReactNode | null;
35
- 'audio-full'?: ReactNode | null;
36
- 'audio-half'?: ReactNode | null;
37
- 'audio-off'?: ReactNode | null;
38
- 'backward-10-seconds'?: ReactNode | null;
39
- bug?: ReactNode | null;
40
- call?: ReactNode | null;
41
- calendar?: ReactNode | null;
42
- 'caret-down-filled'?: ReactNode | null;
43
- 'caret-down'?: ReactNode | null;
44
- 'caret-left-filled'?: ReactNode | null;
45
- 'caret-right-filled'?: ReactNode | null;
46
- 'caret-up-filled'?: ReactNode | null;
47
- 'caret-up'?: ReactNode | null;
48
- check?: ReactNode | null;
49
- contact?: ReactNode | null;
50
- close?: ReactNode | null;
51
- 'closed-caption'?: ReactNode | null;
52
- 'closed-caption-unavailable'?: ReactNode | null;
53
- copy?: ReactNode | null;
54
- 'command-prompt'?: ReactNode | null;
55
- 'delete-marker'?: ReactNode | null;
56
- download?: ReactNode | null;
57
- 'drag-indicator'?: ReactNode | null;
58
- edit?: ReactNode | null;
59
- 'edit-gen-ai'?: ReactNode | null;
60
- ellipsis?: ReactNode | null;
61
- envelope?: ReactNode | null;
62
- 'exit-full-screen'?: ReactNode | null;
63
- expand?: ReactNode | null;
64
- external?: ReactNode | null;
65
- 'face-happy'?: ReactNode | null;
66
- 'face-happy-filled'?: ReactNode | null;
67
- 'face-neutral'?: ReactNode | null;
68
- 'face-neutral-filled'?: ReactNode | null;
69
- 'face-sad'?: ReactNode | null;
70
- 'face-sad-filled'?: ReactNode | null;
71
- 'file-open'?: ReactNode | null;
72
- file?: ReactNode | null;
73
- filter?: ReactNode | null;
74
- flag?: ReactNode | null;
75
- 'folder-open'?: ReactNode | null;
76
- folder?: ReactNode | null;
77
- 'forward-10-seconds'?: ReactNode | null;
78
- 'full-screen'?: ReactNode | null;
79
- 'gen-ai'?: ReactNode | null;
80
- globe?: ReactNode | null;
81
- 'grid-view'?: ReactNode | null;
82
- 'group-active'?: ReactNode | null;
83
- group?: ReactNode | null;
84
- heart?: ReactNode | null;
85
- 'heart-filled'?: ReactNode | null;
86
- history?: ReactNode | null;
87
- 'insert-row'?: ReactNode | null;
88
- key?: ReactNode | null;
89
- keyboard?: ReactNode | null;
90
- 'list-view'?: ReactNode | null;
91
- 'location-pin'?: ReactNode | null;
92
- 'lock-private'?: ReactNode | null;
93
- map?: ReactNode | null;
94
- menu?: ReactNode | null;
95
- microphone?: ReactNode | null;
96
- 'microphone-off'?: ReactNode | null;
97
- 'mini-player'?: ReactNode | null;
98
- multiscreen?: ReactNode | null;
99
- notification?: ReactNode | null;
100
- pause?: ReactNode | null;
101
- play?: ReactNode | null;
102
- redo?: ReactNode | null;
103
- refresh?: ReactNode | null;
104
- remove?: ReactNode | null;
105
- 'resize-area'?: ReactNode | null;
106
- script?: ReactNode | null;
107
- search?: ReactNode | null;
108
- 'search-gen-ai'?: ReactNode | null;
109
- security?: ReactNode | null;
110
- settings?: ReactNode | null;
111
- send?: ReactNode | null;
112
- share?: ReactNode | null;
113
- shrink?: ReactNode | null;
114
- slash?: ReactNode | null;
115
- 'star-filled'?: ReactNode | null;
116
- 'star-half'?: ReactNode | null;
117
- star?: ReactNode | null;
118
- 'status-in-progress'?: ReactNode | null;
119
- 'status-info'?: ReactNode | null;
120
- 'status-negative'?: ReactNode | null;
121
- 'status-not-started'?: ReactNode | null;
122
- 'status-pending'?: ReactNode | null;
123
- 'status-positive'?: ReactNode | null;
124
- 'status-stopped'?: ReactNode | null;
125
- 'status-warning'?: ReactNode | null;
126
- 'stop-circle'?: ReactNode | null;
127
- 'subtract-minus'?: ReactNode | null;
128
- suggestions?: ReactNode | null;
129
- 'suggestions-gen-ai'?: ReactNode | null;
130
- support?: ReactNode | null;
131
- 'thumbs-down-filled'?: ReactNode | null;
132
- 'thumbs-down'?: ReactNode | null;
133
- 'thumbs-up-filled'?: ReactNode | null;
134
- 'thumbs-up'?: ReactNode | null;
135
- ticket?: ReactNode | null;
136
- transcript?: ReactNode | null;
137
- 'treeview-collapse'?: ReactNode | null;
138
- 'treeview-expand'?: ReactNode | null;
139
- undo?: ReactNode | null;
140
- unlocked?: ReactNode | null;
141
- 'upload-download'?: ReactNode | null;
142
- upload?: ReactNode | null;
143
- 'user-profile-active'?: ReactNode | null;
144
- 'user-profile'?: ReactNode | null;
145
- 'video-off'?: ReactNode | null;
146
- 'video-on'?: ReactNode | null;
147
- 'video-unavailable'?: ReactNode | null;
148
- 'video-camera-off'?: ReactNode | null;
149
- 'video-camera-on'?: ReactNode | null;
150
- 'video-camera-unavailable'?: ReactNode | null;
151
- 'view-full'?: ReactNode | null;
152
- 'view-horizontal'?: ReactNode | null;
153
- 'view-vertical'?: ReactNode | null;
154
- 'zoom-in'?: ReactNode | null;
155
- 'zoom-out'?: ReactNode | null;
156
- 'zoom-to-fit'?: ReactNode | null;
157
- }
41
+ type Icons = {
42
+ [name in IconProps.Name]?: ReactNode | null;
43
+ };
158
44
  }
159
45
  //# sourceMappingURL=interfaces.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/icon-provider/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;;;;;;;;;;OAYG;IACH,KAAK,EAAE,iBAAiB,CAAC,KAAK,GAAG,IAAI,CAAC;CACvC;AAED,yBAAiB,iBAAiB,CAAC;IACjC,UAAi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C;QAC9B,mBAAmB,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;QACvC,kBAAkB,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;QACtC,iBAAiB,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;QACrC,0BAA0B,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;QAC9C,WAAW,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;QAC/B,iBAAiB,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;QACrC,eAAe,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;QACnC,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;QAC7B,UAAU,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;QAC9B,aAAa,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;KAClC;CACF"}
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/icon-provider/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIhE,MAAM,MAAM,eAAe,GACvB,UAAU,GACV,aAAa,GACb,mBAAmB,GACnB,YAAY,GACZ,oBAAoB,GACpB,aAAa,GACb,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,UAAU,GACV,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,qBAAqB,GACrB,KAAK,GACL,MAAM,GACN,UAAU,GACV,mBAAmB,GACnB,YAAY,GACZ,mBAAmB,GACnB,oBAAoB,GACpB,iBAAiB,GACjB,UAAU,GACV,OAAO,GACP,SAAS,GACT,OAAO,GACP,gBAAgB,GAChB,4BAA4B,GAC5B,MAAM,GACN,gBAAgB,GAChB,eAAe,GACf,UAAU,GACV,gBAAgB,GAChB,MAAM,GACN,a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DAA2D;AAC3D,MAAM,MAAM,oBAAoB,GAAG,MAAM,YAAY,GAAG,MAAM,CAAC;AAE/D,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,eAAe,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;AAE3F,oGAAoG;AACpG,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAE3D,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;;;;;;;;;;OAYG;IACH,KAAK,EAAE,iBAAiB,CAAC,KAAK,GAAG,IAAI,CAAC;CACvC;AAED,yBAAiB,iBAAiB,CAAC;IACjC,KAAY,KAAK,GAAG;SACjB,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI;KAC5C,CAAC;CACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/icon-provider/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 { ReactNode } from 'react';\n\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface IconProviderProps extends BaseComponentProps {\n children: ReactNode;\n\n /**\n * Specifies icon overrides using existing icon names, for example, `{'add-plus': <svg>...</svg>}`.\n *\n * These icon overrides will automatically be applied to any component that is a descendant of this provider, including nested providers.\n *\n * Set to `null` to reset the icons to the default set or set specific icon names to `null` to change them back to the default set.\n *\n * For example, override `AppLayout` icons but not icons in the content slot by wrapping content with an `IconProvider` with this property set to `null`.\n *\n * `<Icon ... />` component can be used as an override (for example, `{'close': <Icon name='arrow-left' />}`).\n * However, if the icon name is the same as the key, for example, `{'close': <Icon name='close' />}` an infinite loop will be created.\n * The same applies to switching icons in the same configuration (for example, `{'close': <Icon name='arrow-left' />, 'arrow-left': <Icon name='close' />}`).\n */\n icons: IconProviderProps.Icons | null;\n}\n\nexport namespace IconProviderProps {\n export interface Icons {\n // TODO: Update documenter to support mapped types to replace pedantic key declaration with [name in keyof typeof generatedIcons]: AWSUI-61054\n // Option 1: [name in keyof typeof generatedIcons]?: ReactNode | null;\n // Option 2: [name in IconProps.Name]?: ReactNode | null;\n 'add-plus'?: ReactNode | null;\n 'anchor-link'?: ReactNode | null;\n 'angle-left-double'?: ReactNode | null;\n 'angle-left'?: ReactNode | null;\n 'angle-right-double'?: ReactNode | null;\n 'angle-right'?: ReactNode | null;\n 'angle-up'?: ReactNode | null;\n 'angle-down'?: ReactNode | null;\n 'arrow-left'?: ReactNode | null;\n 'arrow-right'?: ReactNode | null;\n 'arrow-up'?: ReactNode | null;\n 'arrow-down'?: ReactNode | null;\n 'at-symbol'?: ReactNode | null;\n 'audio-full'?: ReactNode | null;\n 'audio-half'?: ReactNode | null;\n 'audio-off'?: ReactNode | null;\n 'backward-10-seconds'?: ReactNode | null;\n bug?: ReactNode | null;\n call?: ReactNode | null;\n calendar?: ReactNode | null;\n 'caret-down-filled'?: ReactNode | null;\n 'caret-down'?: ReactNode | null;\n 'caret-left-filled'?: ReactNode | null;\n 'caret-right-filled'?: ReactNode | null;\n 'caret-up-filled'?: ReactNode | null;\n 'caret-up'?: ReactNode | null;\n check?: ReactNode | null;\n contact?: ReactNode | null;\n close?: ReactNode | null;\n 'closed-caption'?: ReactNode | null;\n 'closed-caption-unavailable'?: ReactNode | null;\n copy?: ReactNode | null;\n 'command-prompt'?: ReactNode | null;\n 'delete-marker'?: ReactNode | null;\n download?: ReactNode | null;\n 'drag-indicator'?: ReactNode | null;\n edit?: ReactNode | null;\n 'edit-gen-ai'?: ReactNode | null;\n ellipsis?: ReactNode | null;\n envelope?: ReactNode | null;\n 'exit-full-screen'?: ReactNode | null;\n expand?: ReactNode | null;\n external?: ReactNode | null;\n 'face-happy'?: ReactNode | null;\n 'face-happy-filled'?: ReactNode | null;\n 'face-neutral'?: ReactNode | null;\n 'face-neutral-filled'?: ReactNode | null;\n 'face-sad'?: ReactNode | null;\n 'face-sad-filled'?: ReactNode | null;\n 'file-open'?: ReactNode | null;\n file?: ReactNode | null;\n filter?: ReactNode | null;\n flag?: ReactNode | null;\n 'folder-open'?: ReactNode | null;\n folder?: ReactNode | null;\n 'forward-10-seconds'?: ReactNode | null;\n 'full-screen'?: ReactNode | null;\n 'gen-ai'?: ReactNode | null;\n globe?: ReactNode | null;\n 'grid-view'?: ReactNode | null;\n 'group-active'?: ReactNode | null;\n group?: ReactNode | null;\n heart?: ReactNode | null;\n 'heart-filled'?: ReactNode | null;\n history?: ReactNode | null;\n 'insert-row'?: ReactNode | null;\n key?: ReactNode | null;\n keyboard?: ReactNode | null;\n 'list-view'?: ReactNode | null;\n 'location-pin'?: ReactNode | null;\n 'lock-private'?: ReactNode | null;\n map?: ReactNode | null;\n menu?: ReactNode | null;\n microphone?: ReactNode | null;\n 'microphone-off'?: ReactNode | null;\n 'mini-player'?: ReactNode | null;\n multiscreen?: ReactNode | null;\n notification?: ReactNode | null;\n pause?: ReactNode | null;\n play?: ReactNode | null;\n redo?: ReactNode | null;\n refresh?: ReactNode | null;\n remove?: ReactNode | null;\n 'resize-area'?: ReactNode | null;\n script?: ReactNode | null;\n search?: ReactNode | null;\n 'search-gen-ai'?: ReactNode | null;\n security?: ReactNode | null;\n settings?: ReactNode | null;\n send?: ReactNode | null;\n share?: ReactNode | null;\n shrink?: ReactNode | null;\n slash?: ReactNode | null;\n 'star-filled'?: ReactNode | null;\n 'star-half'?: ReactNode | null;\n star?: ReactNode | null;\n 'status-in-progress'?: ReactNode | null;\n 'status-info'?: ReactNode | null;\n 'status-negative'?: ReactNode | null;\n 'status-not-started'?: ReactNode | null;\n 'status-pending'?: ReactNode | null;\n 'status-positive'?: ReactNode | null;\n 'status-stopped'?: ReactNode | null;\n 'status-warning'?: ReactNode | null;\n 'stop-circle'?: ReactNode | null;\n 'subtract-minus'?: ReactNode | null;\n suggestions?: ReactNode | null;\n 'suggestions-gen-ai'?: ReactNode | null;\n support?: ReactNode | null;\n 'thumbs-down-filled'?: ReactNode | null;\n 'thumbs-down'?: ReactNode | null;\n 'thumbs-up-filled'?: ReactNode | null;\n 'thumbs-up'?: ReactNode | null;\n ticket?: ReactNode | null;\n transcript?: ReactNode | null;\n 'treeview-collapse'?: ReactNode | null;\n 'treeview-expand'?: ReactNode | null;\n undo?: ReactNode | null;\n unlocked?: ReactNode | null;\n 'upload-download'?: ReactNode | null;\n upload?: ReactNode | null;\n 'user-profile-active'?: ReactNode | null;\n 'user-profile'?: ReactNode | null;\n 'video-off'?: ReactNode | null;\n 'video-on'?: ReactNode | null;\n 'video-unavailable'?: ReactNode | null;\n 'video-camera-off'?: ReactNode | null;\n 'video-camera-on'?: ReactNode | null;\n 'video-camera-unavailable'?: ReactNode | null;\n 'view-full'?: ReactNode | null;\n 'view-horizontal'?: ReactNode | null;\n 'view-vertical'?: ReactNode | null;\n 'zoom-in'?: ReactNode | null;\n 'zoom-out'?: ReactNode | null;\n 'zoom-to-fit'?: ReactNode | null;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/icon-provider/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 { ReactNode } from 'react';\n\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\n\n// Why not enums? Explained there\n// https://stackoverflow.com/questions/52393730/typescript-string-literal-union-type-from-enum\nexport type BuiltInIconName =\n | 'add-plus'\n | 'anchor-link'\n | 'angle-left-double'\n | 'angle-left'\n | 'angle-right-double'\n | 'angle-right'\n | 'angle-up'\n | 'angle-down'\n | 'arrow-left'\n | 'arrow-right'\n | 'arrow-up'\n | 'arrow-down'\n | 'at-symbol'\n | 'audio-full'\n | 'audio-half'\n | 'audio-off'\n | 'backward-10-seconds'\n | 'bug'\n | 'call'\n | 'calendar'\n | 'caret-down-filled'\n | 'caret-down'\n | 'caret-left-filled'\n | 'caret-right-filled'\n | 'caret-up-filled'\n | 'caret-up'\n | 'check'\n | 'contact'\n | 'close'\n | 'closed-caption'\n | 'closed-caption-unavailable'\n | 'copy'\n | 'command-prompt'\n | 'delete-marker'\n | 'download'\n | 'drag-indicator'\n | 'edit'\n | 'edit-gen-ai'\n | 'ellipsis'\n | 'envelope'\n | 'exit-full-screen'\n | 'expand'\n | 'external'\n | 'face-happy'\n | 'face-happy-filled'\n | 'face-neutral'\n | 'face-neutral-filled'\n | 'face-sad'\n | 'face-sad-filled'\n | 'file-open'\n | 'file'\n | 'filter'\n | 'flag'\n | 'folder-open'\n | 'folder'\n | 'forward-10-seconds'\n | 'full-screen'\n | 'gen-ai'\n | 'globe'\n | 'grid-view'\n | 'group-active'\n | 'group'\n | 'heart'\n | 'heart-filled'\n | 'history'\n | 'insert-row'\n | 'key'\n | 'keyboard'\n | 'list-view'\n | 'location-pin'\n | 'lock-private'\n | 'map'\n | 'menu'\n | 'microphone'\n | 'microphone-off'\n | 'mini-player'\n | 'multiscreen'\n | 'notification'\n | 'pause'\n | 'play'\n | 'redo'\n | 'refresh'\n | 'remove'\n | 'resize-area'\n | 'script'\n | 'search'\n | 'search-gen-ai'\n | 'security'\n | 'settings'\n | 'send'\n | 'share'\n | 'shrink'\n | 'slash'\n | 'star-filled'\n | 'star-half'\n | 'star'\n | 'status-in-progress'\n | 'status-info'\n | 'status-negative'\n | 'status-not-started'\n | 'status-pending'\n | 'status-positive'\n | 'status-stopped'\n | 'status-warning'\n | 'stop-circle'\n | 'subtract-minus'\n | 'suggestions'\n | 'suggestions-gen-ai'\n | 'support'\n | 'thumbs-down-filled'\n | 'thumbs-down'\n | 'thumbs-up-filled'\n | 'thumbs-up'\n | 'ticket'\n | 'transcript'\n | 'treeview-collapse'\n | 'treeview-expand'\n | 'undo'\n | 'unlocked'\n | 'upload-download'\n | 'upload'\n | 'user-profile-active'\n | 'user-profile'\n | 'video-off'\n | 'video-on'\n | 'video-unavailable'\n | 'video-camera-off'\n | 'video-camera-on'\n | 'video-camera-unavailable'\n | 'view-full'\n | 'view-horizontal'\n | 'view-vertical'\n | 'zoom-in'\n | 'zoom-out'\n | 'zoom-to-fit';\n\n/**\n * Augment this interface using `declare module` to register custom icon names.\n * Registered names become valid across all icon-accepting components.\n *\n * @example\n * declare module \"@cloudscape-design/components/icon-provider\" {\n * interface IconRegistry extends IconMap<typeof myIcons> {}\n * }\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface IconRegistry {}\n\n/** Union of all icon names in the {@link IconRegistry}. */\nexport type IconRegistryIconName = keyof IconRegistry & string;\n\nexport type DefineIconsInput = Partial<Record<BuiltInIconName | (string & {}), ReactNode>>;\n\n/** Extracts the keys of a `defineIcons` result into the shape that {@link IconRegistry} expects. */\nexport type IconMap<T> = { [K in keyof T & string]: T[K] };\n\nexport interface IconProviderProps extends BaseComponentProps {\n children: ReactNode;\n\n /**\n * Specifies icon overrides using existing icon names, for example, `{'add-plus': <svg>...</svg>}`.\n *\n * These icon overrides will automatically be applied to any component that is a descendant of this provider, including nested providers.\n *\n * Set to `null` to reset the icons to the default set or set specific icon names to `null` to change them back to the default set.\n *\n * For example, override `AppLayout` icons but not icons in the content slot by wrapping content with an `IconProvider` with this property set to `null`.\n *\n * `<Icon ... />` component can be used as an override (for example, `{'close': <Icon name='arrow-left' />}`).\n * However, if the icon name is the same as the key, for example, `{'close': <Icon name='close' />}` an infinite loop will be created.\n * The same applies to switching icons in the same configuration (for example, `{'close': <Icon name='arrow-left' />, 'arrow-left': <Icon name='close' />}`).\n */\n icons: IconProviderProps.Icons | null;\n}\n\nexport namespace IconProviderProps {\n export type Icons = {\n [name in IconProps.Name]?: ReactNode | null;\n };\n}\n"]}
@@ -9,11 +9,12 @@ function InternalIconProvider({ children, icons }) {
9
9
  // Merge the context icons with the custom icons, this allows child instances of IconProvider to persist parent configurations
10
10
  if (icons !== null) {
11
11
  const clonedIcons = { ...icons };
12
- // Reset null icon values to their original definitions
12
+ // Reset null icon values to their generated default, or the inherited context value for custom icons
13
13
  Object.keys(clonedIcons).forEach(name => {
14
+ var _a;
14
15
  const iconName = name;
15
- if (iconName in generatedIcons && clonedIcons[iconName] === null) {
16
- clonedIcons[iconName] = generatedIcons[iconName];
16
+ if (clonedIcons[iconName] === null) {
17
+ clonedIcons[iconName] = (_a = generatedIcons[iconName]) !== null && _a !== void 0 ? _a : contextIcons[iconName];
17
18
  }
18
19
  });
19
20
  iconsToProvide = { ...contextIcons, ...clonedIcons };
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/icon-provider/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,cAAc,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGhD,SAAS,oBAAoB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAqB;IAClE,MAAM,YAAY,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAErD,IAAI,cAAc,GAA4B,cAAc,CAAC;IAE7D,8HAA8H;IAC9H,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,MAAM,WAAW,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;QAEjC,uDAAuD;QACvD,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACtC,MAAM,QAAQ,GAAG,IAAmC,CAAC;YACrD,IAAI,QAAQ,IAAI,cAAc,IAAI,WAAW,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC;gBACjE,WAAW,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;YACnD,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,cAAc,GAAG,EAAE,GAAG,YAAY,EAAE,GAAG,WAAW,EAAE,CAAC;IACvD,CAAC;IAED,OAAO,oBAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,cAAc,IAAG,QAAQ,CAAgC,CAAC;AACxG,CAAC;AAED,eAAe,oBAAoB,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';\n\nimport generatedIcons from '../icon/generated/icons';\nimport { InternalIconContext } from './context';\nimport { IconProviderProps } from './interfaces';\n\nfunction InternalIconProvider({ children, icons }: IconProviderProps) {\n const contextIcons = useContext(InternalIconContext);\n\n let iconsToProvide: IconProviderProps.Icons = generatedIcons;\n\n // Merge the context icons with the custom icons, this allows child instances of IconProvider to persist parent configurations\n if (icons !== null) {\n const clonedIcons = { ...icons };\n\n // Reset null icon values to their original definitions\n Object.keys(clonedIcons).forEach(name => {\n const iconName = name as keyof typeof generatedIcons;\n if (iconName in generatedIcons && clonedIcons[iconName] === null) {\n clonedIcons[iconName] = generatedIcons[iconName];\n }\n });\n\n iconsToProvide = { ...contextIcons, ...clonedIcons };\n }\n\n return <InternalIconContext.Provider value={iconsToProvide}>{children}</InternalIconContext.Provider>;\n}\n\nexport default InternalIconProvider;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/icon-provider/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,cAAc,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGhD,SAAS,oBAAoB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAqB;IAClE,MAAM,YAAY,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAErD,IAAI,cAAc,GAA4B,cAAc,CAAC;IAE7D,8HAA8H;IAC9H,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,MAAM,WAAW,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;QAEjC,qGAAqG;QACrG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;;YACtC,MAAM,QAAQ,GAAG,IAAmC,CAAC;YACrD,IAAI,WAAW,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC;gBACnC,WAAW,CAAC,QAAQ,CAAC,GAAG,MAAA,cAAc,CAAC,QAAQ,CAAC,mCAAI,YAAY,CAAC,QAAQ,CAAC,CAAC;YAC7E,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,cAAc,GAAG,EAAE,GAAG,YAAY,EAAE,GAAG,WAAW,EAAE,CAAC;IACvD,CAAC;IAED,OAAO,oBAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,cAAc,IAAG,QAAQ,CAAgC,CAAC;AACxG,CAAC;AAED,eAAe,oBAAoB,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';\n\nimport generatedIcons from '../icon/generated/icons';\nimport { InternalIconContext } from './context';\nimport { IconProviderProps } from './interfaces';\n\nfunction InternalIconProvider({ children, icons }: IconProviderProps) {\n const contextIcons = useContext(InternalIconContext);\n\n let iconsToProvide: IconProviderProps.Icons = generatedIcons;\n\n // Merge the context icons with the custom icons, this allows child instances of IconProvider to persist parent configurations\n if (icons !== null) {\n const clonedIcons = { ...icons };\n\n // Reset null icon values to their generated default, or the inherited context value for custom icons\n Object.keys(clonedIcons).forEach(name => {\n const iconName = name as keyof typeof generatedIcons;\n if (clonedIcons[iconName] === null) {\n clonedIcons[iconName] = generatedIcons[iconName] ?? contextIcons[iconName];\n }\n });\n\n iconsToProvide = { ...contextIcons, ...clonedIcons };\n }\n\n return <InternalIconContext.Provider value={iconsToProvide}>{children}</InternalIconContext.Provider>;\n}\n\nexport default InternalIconProvider;\n"]}
@@ -3816,5 +3816,5 @@ body {
3816
3816
  }
3817
3817
  }
3818
3818
  :root {
3819
- --awsui-version-info-3189432f: true;
3819
+ --awsui-version-info-3dcd7e02: true;
3820
3820
  }
@@ -1,6 +1,6 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (3189432f)";
3
- export var GIT_SHA = "3189432f";
2
+ export var PACKAGE_VERSION = "3.0.0 (3dcd7e02)";
3
+ export var GIT_SHA = "3dcd7e02";
4
4
  export var THEME = "open-source-visual-refresh";
5
5
  export var SYSTEM = "core";
6
6
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (3189432f)",
4
- "GIT_SHA": "3189432f",
3
+ "PACKAGE_VERSION": "3.0.0 (3dcd7e02)",
4
+ "GIT_SHA": "3dcd7e02",
5
5
  "THEME": "default",
6
6
  "SYSTEM": "core",
7
7
  "ALWAYS_VISUAL_REFRESH": false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudscape-design/components-themeable",
3
- "version": "3.0.1244",
3
+ "version": "3.0.1246",
4
4
  "files": [
5
5
  "lib"
6
6
  ],