@adobe/spectrum-wc-core 0.0.0-snapshot.20260922095923
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.
- package/README.md +39 -0
- package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/decorate.js +9 -0
- package/dist/components/accordion/Accordion.base.d.ts +59 -0
- package/dist/components/accordion/Accordion.base.js +69 -0
- package/dist/components/accordion/Accordion.base.js.map +1 -0
- package/dist/components/accordion/Accordion.types.d.ts +22 -0
- package/dist/components/accordion/Accordion.types.js +21 -0
- package/dist/components/accordion/Accordion.types.js.map +1 -0
- package/dist/components/accordion/AccordionItem.base.d.ts +96 -0
- package/dist/components/accordion/AccordionItem.base.js +93 -0
- package/dist/components/accordion/AccordionItem.base.js.map +1 -0
- package/dist/components/accordion/index.d.ts +14 -0
- package/dist/components/accordion/index.js +4 -0
- package/dist/components/action-button/ActionButton.types.d.ts +15 -0
- package/dist/components/action-button/ActionButton.types.js +12 -0
- package/dist/components/action-button/ActionButton.types.js.map +1 -0
- package/dist/components/action-button/index.d.ts +12 -0
- package/dist/components/action-button/index.js +2 -0
- package/dist/components/action-group/ActionGroup.base.d.ts +108 -0
- package/dist/components/action-group/ActionGroup.base.js +53 -0
- package/dist/components/action-group/ActionGroup.base.js.map +1 -0
- package/dist/components/action-group/ActionGroup.types.d.ts +17 -0
- package/dist/components/action-group/ActionGroup.types.js +12 -0
- package/dist/components/action-group/ActionGroup.types.js.map +1 -0
- package/dist/components/action-group/index.d.ts +13 -0
- package/dist/components/action-group/index.js +3 -0
- package/dist/components/alert-banner/AlertBanner.base.d.ts +36 -0
- package/dist/components/alert-banner/AlertBanner.base.js +57 -0
- package/dist/components/alert-banner/AlertBanner.base.js.map +1 -0
- package/dist/components/alert-banner/AlertBanner.types.d.ts +13 -0
- package/dist/components/alert-banner/AlertBanner.types.js +10 -0
- package/dist/components/alert-banner/AlertBanner.types.js.map +1 -0
- package/dist/components/alert-banner/index.d.ts +13 -0
- package/dist/components/alert-banner/index.js +3 -0
- package/dist/components/asset/Asset.base.d.ts +101 -0
- package/dist/components/asset/Asset.base.js +130 -0
- package/dist/components/asset/Asset.base.js.map +1 -0
- package/dist/components/asset/Asset.types.d.ts +31 -0
- package/dist/components/asset/Asset.types.js +14 -0
- package/dist/components/asset/Asset.types.js.map +1 -0
- package/dist/components/asset/index.d.ts +13 -0
- package/dist/components/asset/index.js +3 -0
- package/dist/components/avatar/Avatar.base.d.ts +53 -0
- package/dist/components/avatar/Avatar.base.js +52 -0
- package/dist/components/avatar/Avatar.base.js.map +1 -0
- package/dist/components/avatar/Avatar.types.d.ts +19 -0
- package/dist/components/avatar/Avatar.types.js +24 -0
- package/dist/components/avatar/Avatar.types.js.map +1 -0
- package/dist/components/avatar/index.d.ts +13 -0
- package/dist/components/avatar/index.js +3 -0
- package/dist/components/badge/Badge.base.d.ts +114 -0
- package/dist/components/badge/Badge.base.js +49 -0
- package/dist/components/badge/Badge.base.js.map +1 -0
- package/dist/components/badge/Badge.types.d.ts +21 -0
- package/dist/components/badge/Badge.types.js +43 -0
- package/dist/components/badge/Badge.types.js.map +1 -0
- package/dist/components/badge/index.d.ts +13 -0
- package/dist/components/badge/index.js +3 -0
- package/dist/components/button/Button.base.d.ts +78 -0
- package/dist/components/button/Button.base.js +51 -0
- package/dist/components/button/Button.base.js.map +1 -0
- package/dist/components/button/Button.types.d.ts +19 -0
- package/dist/components/button/Button.types.js +16 -0
- package/dist/components/button/Button.types.js.map +1 -0
- package/dist/components/button/index.d.ts +13 -0
- package/dist/components/button/index.js +3 -0
- package/dist/components/button-group/ButtonGroup.base.d.ts +89 -0
- package/dist/components/button-group/ButtonGroup.base.js +60 -0
- package/dist/components/button-group/ButtonGroup.base.js.map +1 -0
- package/dist/components/button-group/ButtonGroup.types.d.ts +17 -0
- package/dist/components/button-group/ButtonGroup.types.js +15 -0
- package/dist/components/button-group/ButtonGroup.types.js.map +1 -0
- package/dist/components/button-group/index.d.ts +13 -0
- package/dist/components/button-group/index.js +3 -0
- package/dist/components/card/Card.base.d.ts +172 -0
- package/dist/components/card/Card.base.js +123 -0
- package/dist/components/card/Card.base.js.map +1 -0
- package/dist/components/card/Card.types.d.ts +18 -0
- package/dist/components/card/Card.types.js +21 -0
- package/dist/components/card/Card.types.js.map +1 -0
- package/dist/components/card/index.d.ts +13 -0
- package/dist/components/card/index.js +3 -0
- package/dist/components/color-handle/ColorHandle.base.d.ts +51 -0
- package/dist/components/color-handle/ColorHandle.base.js +39 -0
- package/dist/components/color-handle/ColorHandle.base.js.map +1 -0
- package/dist/components/color-handle/ColorHandle.types.d.ts +30 -0
- package/dist/components/color-handle/color-contrast.d.ts +55 -0
- package/dist/components/color-handle/color-contrast.js +49 -0
- package/dist/components/color-handle/color-contrast.js.map +1 -0
- package/dist/components/color-handle/index.d.ts +14 -0
- package/dist/components/color-handle/index.js +3 -0
- package/dist/components/color-loupe/ColorLoupe.base.d.ts +41 -0
- package/dist/components/color-loupe/ColorLoupe.base.js +21 -0
- package/dist/components/color-loupe/ColorLoupe.base.js.map +1 -0
- package/dist/components/color-loupe/index.d.ts +12 -0
- package/dist/components/color-loupe/index.js +2 -0
- package/dist/components/divider/Divider.base.d.ts +43 -0
- package/dist/components/divider/Divider.base.js +42 -0
- package/dist/components/divider/Divider.base.js.map +1 -0
- package/dist/components/divider/Divider.types.d.ts +15 -0
- package/dist/components/divider/Divider.types.js +10 -0
- package/dist/components/divider/Divider.types.js.map +1 -0
- package/dist/components/divider/index.d.ts +13 -0
- package/dist/components/divider/index.js +3 -0
- package/dist/components/dropzone/Dropzone.base.d.ts +74 -0
- package/dist/components/dropzone/Dropzone.base.js +82 -0
- package/dist/components/dropzone/Dropzone.base.js.map +1 -0
- package/dist/components/dropzone/Dropzone.types.d.ts +43 -0
- package/dist/components/dropzone/Dropzone.types.js +15 -0
- package/dist/components/dropzone/Dropzone.types.js.map +1 -0
- package/dist/components/dropzone/index.d.ts +13 -0
- package/dist/components/dropzone/index.js +3 -0
- package/dist/components/icon/Icon.base.d.ts +36 -0
- package/dist/components/icon/Icon.base.js +28 -0
- package/dist/components/icon/Icon.base.js.map +1 -0
- package/dist/components/icon/Icon.types.d.ts +13 -0
- package/dist/components/icon/Icon.types.js +12 -0
- package/dist/components/icon/Icon.types.js.map +1 -0
- package/dist/components/icon/index.d.ts +13 -0
- package/dist/components/icon/index.js +3 -0
- package/dist/components/illustrated-message/IllustratedMessage.base.d.ts +60 -0
- package/dist/components/illustrated-message/IllustratedMessage.base.js +59 -0
- package/dist/components/illustrated-message/IllustratedMessage.base.js.map +1 -0
- package/dist/components/illustrated-message/IllustratedMessage.types.d.ts +15 -0
- package/dist/components/illustrated-message/IllustratedMessage.types.js +10 -0
- package/dist/components/illustrated-message/IllustratedMessage.types.js.map +1 -0
- package/dist/components/illustrated-message/index.d.ts +13 -0
- package/dist/components/illustrated-message/index.js +3 -0
- package/dist/components/infield-button/InfieldButton.base.d.ts +28 -0
- package/dist/components/infield-button/InfieldButton.base.js +22 -0
- package/dist/components/infield-button/InfieldButton.base.js.map +1 -0
- package/dist/components/infield-button/InfieldButton.types.d.ts +13 -0
- package/dist/components/infield-button/InfieldButton.types.js +11 -0
- package/dist/components/infield-button/InfieldButton.types.js.map +1 -0
- package/dist/components/infield-button/index.d.ts +13 -0
- package/dist/components/infield-button/index.js +3 -0
- package/dist/components/meter/Meter.base.d.ts +40 -0
- package/dist/components/meter/Meter.base.js +32 -0
- package/dist/components/meter/Meter.base.js.map +1 -0
- package/dist/components/meter/Meter.types.d.ts +13 -0
- package/dist/components/meter/Meter.types.js +11 -0
- package/dist/components/meter/Meter.types.js.map +1 -0
- package/dist/components/meter/index.d.ts +13 -0
- package/dist/components/meter/index.js +3 -0
- package/dist/components/popover/Popover.base.d.ts +226 -0
- package/dist/components/popover/Popover.base.js +287 -0
- package/dist/components/popover/Popover.base.js.map +1 -0
- package/dist/components/popover/Popover.types.d.ts +39 -0
- package/dist/components/popover/Popover.types.js +24 -0
- package/dist/components/popover/Popover.types.js.map +1 -0
- package/dist/components/popover/index.d.ts +13 -0
- package/dist/components/popover/index.js +3 -0
- package/dist/components/progress-bar/ProgressBar.base.d.ts +34 -0
- package/dist/components/progress-bar/ProgressBar.base.js +21 -0
- package/dist/components/progress-bar/ProgressBar.base.js.map +1 -0
- package/dist/components/progress-bar/ProgressBar.types.d.ts +12 -0
- package/dist/components/progress-bar/index.d.ts +13 -0
- package/dist/components/progress-bar/index.js +2 -0
- package/dist/components/progress-circle/ProgressCircle.base.d.ts +83 -0
- package/dist/components/progress-circle/ProgressCircle.base.js +77 -0
- package/dist/components/progress-circle/ProgressCircle.base.js.map +1 -0
- package/dist/components/progress-circle/ProgressCircle.types.d.ts +15 -0
- package/dist/components/progress-circle/ProgressCircle.types.js +10 -0
- package/dist/components/progress-circle/ProgressCircle.types.js.map +1 -0
- package/dist/components/progress-circle/index.d.ts +13 -0
- package/dist/components/progress-circle/index.js +3 -0
- package/dist/components/status-light/StatusLight.base.d.ts +69 -0
- package/dist/components/status-light/StatusLight.base.js +32 -0
- package/dist/components/status-light/StatusLight.base.js.map +1 -0
- package/dist/components/status-light/StatusLight.types.d.ts +19 -0
- package/dist/components/status-light/StatusLight.types.js +32 -0
- package/dist/components/status-light/StatusLight.types.js.map +1 -0
- package/dist/components/status-light/index.d.ts +13 -0
- package/dist/components/status-light/index.js +3 -0
- package/dist/components/tabs/Tab.base.d.ts +49 -0
- package/dist/components/tabs/Tab.base.js +39 -0
- package/dist/components/tabs/Tab.base.js.map +1 -0
- package/dist/components/tabs/Tab.types.d.ts +17 -0
- package/dist/components/tabs/TabPanel.base.d.ts +49 -0
- package/dist/components/tabs/TabPanel.base.js +36 -0
- package/dist/components/tabs/TabPanel.base.js.map +1 -0
- package/dist/components/tabs/TabPanel.types.d.ts +17 -0
- package/dist/components/tabs/Tabs.base.d.ts +221 -0
- package/dist/components/tabs/Tabs.base.js +213 -0
- package/dist/components/tabs/Tabs.base.js.map +1 -0
- package/dist/components/tabs/Tabs.types.d.ts +55 -0
- package/dist/components/tabs/Tabs.types.js +6 -0
- package/dist/components/tabs/Tabs.types.js.map +1 -0
- package/dist/components/tabs/index.d.ts +17 -0
- package/dist/components/tabs/index.js +5 -0
- package/dist/components/tooltip/Tooltip.base.d.ts +159 -0
- package/dist/components/tooltip/Tooltip.base.js +198 -0
- package/dist/components/tooltip/Tooltip.base.js.map +1 -0
- package/dist/components/tooltip/Tooltip.types.d.ts +18 -0
- package/dist/components/tooltip/Tooltip.types.js +15 -0
- package/dist/components/tooltip/Tooltip.types.js.map +1 -0
- package/dist/components/tooltip/index.d.ts +13 -0
- package/dist/components/tooltip/index.js +3 -0
- package/dist/controllers/color-controller/index.d.ts +12 -0
- package/dist/controllers/color-controller/index.js +2 -0
- package/dist/controllers/color-controller/src/color-controller.d.ts +226 -0
- package/dist/controllers/color-controller/src/color-controller.js +253 -0
- package/dist/controllers/color-controller/src/color-controller.js.map +1 -0
- package/dist/controllers/drag-and-drop-controller/index.d.ts +12 -0
- package/dist/controllers/drag-and-drop-controller/index.js +2 -0
- package/dist/controllers/drag-and-drop-controller/src/drag-and-drop-controller.d.ts +68 -0
- package/dist/controllers/drag-and-drop-controller/src/drag-and-drop-controller.js +56 -0
- package/dist/controllers/drag-and-drop-controller/src/drag-and-drop-controller.js.map +1 -0
- package/dist/controllers/focusgroup-navigation-controller/index.d.ts +12 -0
- package/dist/controllers/focusgroup-navigation-controller/index.js +2 -0
- package/dist/controllers/focusgroup-navigation-controller/src/focusgroup-navigation-controller.d.ts +496 -0
- package/dist/controllers/focusgroup-navigation-controller/src/focusgroup-navigation-controller.js +345 -0
- package/dist/controllers/focusgroup-navigation-controller/src/focusgroup-navigation-controller.js.map +1 -0
- package/dist/controllers/hover-controller/index.d.ts +12 -0
- package/dist/controllers/hover-controller/index.js +2 -0
- package/dist/controllers/hover-controller/src/hover-controller.d.ts +118 -0
- package/dist/controllers/hover-controller/src/hover-controller.js +90 -0
- package/dist/controllers/hover-controller/src/hover-controller.js.map +1 -0
- package/dist/controllers/index.d.ts +26 -0
- package/dist/controllers/index.js +18 -0
- package/dist/controllers/language-resolution.d.ts +87 -0
- package/dist/controllers/language-resolution.js +56 -0
- package/dist/controllers/language-resolution.js.map +1 -0
- package/dist/controllers/live-selection-controller/index.d.ts +12 -0
- package/dist/controllers/live-selection-controller/index.js +2 -0
- package/dist/controllers/live-selection-controller/src/live-selection-controller.d.ts +144 -0
- package/dist/controllers/live-selection-controller/src/live-selection-controller.js +36 -0
- package/dist/controllers/live-selection-controller/src/live-selection-controller.js.map +1 -0
- package/dist/controllers/page-scroll-lock-controller/index.d.ts +12 -0
- package/dist/controllers/page-scroll-lock-controller/index.js +2 -0
- package/dist/controllers/page-scroll-lock-controller/src/page-scroll-lock.d.ts +20 -0
- package/dist/controllers/page-scroll-lock-controller/src/page-scroll-lock.js +30 -0
- package/dist/controllers/page-scroll-lock-controller/src/page-scroll-lock.js.map +1 -0
- package/dist/controllers/pending-controller/index.d.ts +12 -0
- package/dist/controllers/pending-controller/index.js +2 -0
- package/dist/controllers/pending-controller/src/pending-controller.d.ts +95 -0
- package/dist/controllers/pending-controller/src/pending-controller.js +55 -0
- package/dist/controllers/pending-controller/src/pending-controller.js.map +1 -0
- package/dist/controllers/placement-controller/index.d.ts +12 -0
- package/dist/controllers/placement-controller/index.js +4 -0
- package/dist/controllers/placement-controller/src/fallback-placements.d.ts +9 -0
- package/dist/controllers/placement-controller/src/fallback-placements.js +71 -0
- package/dist/controllers/placement-controller/src/fallback-placements.js.map +1 -0
- package/dist/controllers/placement-controller/src/placement-controller.d.ts +152 -0
- package/dist/controllers/placement-controller/src/placement-controller.js +129 -0
- package/dist/controllers/placement-controller/src/placement-controller.js.map +1 -0
- package/dist/controllers/placement-controller/src/placement-conversion.d.ts +35 -0
- package/dist/controllers/placement-controller/src/placement-conversion.js +54 -0
- package/dist/controllers/placement-controller/src/placement-conversion.js.map +1 -0
- package/dist/controllers/placement-controller/src/types.d.ts +128 -0
- package/dist/controllers/placement-controller/src/types.js +29 -0
- package/dist/controllers/placement-controller/src/types.js.map +1 -0
- package/dist/controllers/slot-attribute-propagation-controller/index.d.ts +12 -0
- package/dist/controllers/slot-attribute-propagation-controller/index.js +2 -0
- package/dist/controllers/slot-attribute-propagation-controller/src/slot-attribute-propagation-controller.d.ts +65 -0
- package/dist/controllers/slot-attribute-propagation-controller/src/slot-attribute-propagation-controller.js +33 -0
- package/dist/controllers/slot-attribute-propagation-controller/src/slot-attribute-propagation-controller.js.map +1 -0
- package/dist/controllers/slot-presence-controller/index.d.ts +12 -0
- package/dist/controllers/slot-presence-controller/index.js +2 -0
- package/dist/controllers/slot-presence-controller/src/slot-presence-controller.d.ts +57 -0
- package/dist/controllers/slot-presence-controller/src/slot-presence-controller.js +44 -0
- package/dist/controllers/slot-presence-controller/src/slot-presence-controller.js.map +1 -0
- package/dist/controllers/slot-text-controller/index.d.ts +12 -0
- package/dist/controllers/slot-text-controller/index.js +2 -0
- package/dist/controllers/slot-text-controller/src/slot-text-controller.d.ts +92 -0
- package/dist/controllers/slot-text-controller/src/slot-text-controller.js +53 -0
- package/dist/controllers/slot-text-controller/src/slot-text-controller.js.map +1 -0
- package/dist/directives/index.d.ts +15 -0
- package/dist/directives/index.js +3 -0
- package/dist/directives/pending-spinner/index.d.ts +12 -0
- package/dist/directives/pending-spinner/index.js +1 -0
- package/dist/directives/pending-spinner/src/pending-spinner.d.ts +22 -0
- package/dist/directives/pending-spinner/src/pending-spinner.js +39 -0
- package/dist/directives/pending-spinner/src/pending-spinner.js.map +1 -0
- package/dist/element/define-element.d.ts +16 -0
- package/dist/element/define-element.js +8 -0
- package/dist/element/define-element.js.map +1 -0
- package/dist/element/index.d.ts +14 -0
- package/dist/element/index.js +4 -0
- package/dist/element/spectrum-element.d.ts +69 -0
- package/dist/element/spectrum-element.js +85 -0
- package/dist/element/spectrum-element.js.map +1 -0
- package/dist/element/version.d.ts +19 -0
- package/dist/element/version.js +6 -0
- package/dist/element/version.js.map +1 -0
- package/dist/mixins/disabled-mixin.d.ts +30 -0
- package/dist/mixins/disabled-mixin.js +27 -0
- package/dist/mixins/disabled-mixin.js.map +1 -0
- package/dist/mixins/index.d.ts +16 -0
- package/dist/mixins/index.js +5 -0
- package/dist/mixins/linear-progress-mixin.d.ts +41 -0
- package/dist/mixins/linear-progress-mixin.js +115 -0
- package/dist/mixins/linear-progress-mixin.js.map +1 -0
- package/dist/mixins/pending-mixin.d.ts +45 -0
- package/dist/mixins/pending-mixin.js +50 -0
- package/dist/mixins/pending-mixin.js.map +1 -0
- package/dist/mixins/sized-mixin.d.ts +49 -0
- package/dist/mixins/sized-mixin.js +42 -0
- package/dist/mixins/sized-mixin.js.map +1 -0
- package/dist/utils/actual-placement.d.ts +10 -0
- package/dist/utils/actual-placement.js +8 -0
- package/dist/utils/actual-placement.js.map +1 -0
- package/dist/utils/capitalize.d.ts +26 -0
- package/dist/utils/capitalize.js +8 -0
- package/dist/utils/capitalize.js.map +1 -0
- package/dist/utils/deep-contains.d.ts +26 -0
- package/dist/utils/deep-contains.js +14 -0
- package/dist/utils/deep-contains.js.map +1 -0
- package/dist/utils/dev-validation.d.ts +88 -0
- package/dist/utils/dev-validation.js +33 -0
- package/dist/utils/dev-validation.js.map +1 -0
- package/dist/utils/dismissible-stack.d.ts +26 -0
- package/dist/utils/dismissible-stack.js +16 -0
- package/dist/utils/dismissible-stack.js.map +1 -0
- package/dist/utils/focusable-selectors.d.ts +43 -0
- package/dist/utils/focusable-selectors.js +18 -0
- package/dist/utils/focusable-selectors.js.map +1 -0
- package/dist/utils/get-active-element.d.ts +31 -0
- package/dist/utils/get-active-element.js +11 -0
- package/dist/utils/get-active-element.js.map +1 -0
- package/dist/utils/get-label-from-slot.d.ts +12 -0
- package/dist/utils/get-label-from-slot.js +10 -0
- package/dist/utils/get-label-from-slot.js.map +1 -0
- package/dist/utils/index.d.ts +22 -0
- package/dist/utils/index.js +12 -0
- package/dist/utils/is-focus-visible-in-tree.d.ts +33 -0
- package/dist/utils/is-focus-visible-in-tree.js +11 -0
- package/dist/utils/is-focus-visible-in-tree.js.map +1 -0
- package/dist/utils/resolve-trigger.d.ts +42 -0
- package/dist/utils/resolve-trigger.js +23 -0
- package/dist/utils/resolve-trigger.js.map +1 -0
- package/dist/utils/transition.d.ts +53 -0
- package/dist/utils/transition.js +26 -0
- package/dist/utils/transition.js.map +1 -0
- package/package.json +644 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Asset.base.js","names":[],"sources":["../../../components/asset/Asset.base.ts"],"sourcesContent":["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';\nimport {\n isDebug,\n validateEnum,\n warnIf,\n} from '@adobe/spectrum-wc-core/utils/index.js';\n\nimport {\n ASSET_BACKGROUND_VALUES,\n ASSET_FIT_VALUES,\n ASSET_LOAD_STATE_VALUES,\n type AssetBackground,\n type AssetErrorEventDetail,\n type AssetFit,\n type AssetLoadState,\n SWC_ASSET_ERROR_EVENT,\n SWC_ASSET_LOAD_EVENT,\n} from './Asset.types.js';\n\nconst DOCS_URL =\n 'https://spectrum-web-components.adobe.com/?path=/docs/components-asset--docs';\n\n// A plain CSS <number>: \"16\", \"1.5\", or \".5\".\nconst NUMBER = String.raw`(?:\\d+\\.?\\d*|\\.\\d+)`;\n// A CSS <ratio>, optionally paired with `auto` on either side (both orders\n// are valid, e.g. \"auto 16/9\" or \"16/9 auto\").\nconst RATIO = String.raw`${NUMBER}(?:\\s*\\/\\s*${NUMBER})?`;\nconst ASPECT_RATIO_PATTERN = new RegExp(\n `^(?:auto|${RATIO}|auto\\\\s+${RATIO}|${RATIO}\\\\s+auto)$`\n);\n\n// object-fit doesn't apply to inline <svg>, so `fit` drives\n// `preserveAspectRatio` instead.\nconst SVG_PRESERVE_ASPECT_RATIO: Record<AssetFit, string> = {\n cover: 'xMidYMid slice',\n contain: 'xMidYMid meet',\n};\n\n/**\n * Normalizes an `aspectRatio` value: maps the `square` keyword to `1/1`, and\n * `:`-separated ratios (e.g. `16:9`) to the CSS `<ratio>` separator (`16/9`).\n */\nfunction normalizeAspectRatio(value: string | undefined): string | undefined {\n if (!value) {\n return value;\n }\n if (value === 'square') {\n return '1/1';\n }\n return value.replace(':', '/');\n}\n\n/**\n * Base class for the `<swc-asset>` general image/media primitive.\n *\n * @slot - a single `<img>` or `<svg>` element to display\n */\nexport abstract class AssetBase extends SpectrumElement {\n // ──────────────────\n // SHARED API\n // ──────────────────\n\n private _aspectRatio: string | undefined;\n\n // The pre-normalization value, kept for the malformed-ratio warning\n private _rawAspectRatio: string | undefined;\n\n /**\n * The aspect ratio to apply to the asset, in CSS `<ratio>` syntax (e.g.\n * `\"16/9\"`), plus the `square` keyword. `:`-separated ratios (e.g.\n * `\"16:9\"`) are normalized to `/`. Falls through to an ancestor-supplied\n * default, else `auto`, when unset. Has no effect when both `width` and\n * `height` are also set.\n */\n @property({ attribute: 'aspect-ratio' })\n public get aspectRatio(): string | undefined {\n return this._aspectRatio;\n }\n\n public set aspectRatio(value: string | undefined) {\n const oldValue = this._aspectRatio;\n this._rawAspectRatio = value;\n this._aspectRatio = normalizeAspectRatio(value);\n this.requestUpdate('aspectRatio', oldValue);\n }\n\n /**\n * An explicit width, as a CSS `<length-percentage>` (e.g. `\"100px\"`,\n * `\"90%\"`). An alternative to `aspectRatio` for sizing the asset.\n */\n @property({ type: String })\n public width: string | undefined;\n\n /**\n * An explicit height, as a CSS `<length-percentage>` (e.g. `\"100px\"`,\n * `\"90%\"`). An alternative to `aspectRatio` for sizing the asset.\n */\n @property({ type: String })\n public height: string | undefined;\n\n /**\n * How slotted image/SVG content fits within the asset's box.\n *\n * @default cover\n */\n @property({ type: String, reflect: true })\n public fit: AssetFit = 'cover';\n\n /**\n * Marks the asset as decorative, removing it from the accessibility tree\n * (`aria-hidden=\"true\"` on the host) regardless of slotted content or\n * `accessibleLabel`.\n */\n @property({ type: Boolean, reflect: true })\n public decorative = false;\n\n /**\n * A fallback accessible name, applied to the slotted `<img>` or `<svg>`\n * only when it doesn't already carry its own accessible name.\n */\n @property({ type: String, attribute: 'accessible-label' })\n public accessibleLabel: string | undefined;\n\n /**\n * The background shown behind slotted content: `transparent` (no\n * background), a `solid` color, or an opacity `checkerboard`.\n *\n * @default transparent\n */\n @property({ type: String, reflect: true })\n public background: AssetBackground = 'transparent';\n\n /**\n * The load status of the slotted `<img>`: `'loading'` while its request is\n * in flight, `'loaded'` on success, `'error'` on failure. Immediately\n * `'loaded'` for a slotted `<svg>` or no slotted content, since there's\n * nothing asynchronous to wait for. Set internally by Asset; a consumer\n * influences it only by changing what's slotted, not by setting it\n * directly.\n */\n @property({ type: String, reflect: true, attribute: 'load-state' })\n public loadState: AssetLoadState = 'loading';\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n // Only clear `aria-hidden` if this instance set it, so a consumer's own\n // attribute survives.\n private _appliedAriaHidden = false;\n\n // `undefined` means \"not yet determined\" (distinct from `null`, \"confirmed\n // no `<img>` child\"), so the first resolution to \"no `<img>`\" isn't\n // mistaken for an already-processed steady state. See `updateLoadState`.\n private _trackedImg: HTMLImageElement | null | undefined = undefined;\n\n // The <svg> this instance owns `preserveAspectRatio` on, so a\n // consumer-set value is left alone until this instance takes over.\n private _preserveAspectRatioAppliedTo: Element | null = null;\n\n // The child this instance applied `accessibleLabel` to, so a later\n // change or clearing it updates/removes our own value instead of being\n // mistaken for the child's own name.\n private _appliedAccessibleLabelTo: Element | null = null;\n\n protected override update(changes: PropertyValues): void {\n if (changes.has('fit')) {\n validateEnum(this, {\n prop: 'fit',\n value: this.fit,\n valid: ASSET_FIT_VALUES,\n url: DOCS_URL,\n });\n }\n if (changes.has('background')) {\n validateEnum(this, {\n prop: 'background',\n value: this.background,\n valid: ASSET_BACKGROUND_VALUES,\n url: DOCS_URL,\n });\n }\n if (changes.has('loadState')) {\n validateEnum(this, {\n prop: 'load-state',\n value: this.loadState,\n valid: ASSET_LOAD_STATE_VALUES,\n url: DOCS_URL,\n });\n }\n if (\n changes.has('aspectRatio') ||\n changes.has('width') ||\n changes.has('height')\n ) {\n warnIf(\n this,\n typeof this.aspectRatio !== 'undefined' &&\n !ASPECT_RATIO_PATTERN.test(this.aspectRatio),\n `<${this.localName}> expects \"aspect-ratio\" to be a CSS <ratio> (e.g. \"16/9\"), the \"square\" keyword, or a \":\"-separated ratio (e.g. \"16:9\"). Received \"${this._rawAspectRatio}\".`,\n DOCS_URL\n );\n warnIf(\n this,\n typeof this.aspectRatio !== 'undefined' &&\n typeof this.width !== 'undefined' &&\n typeof this.height !== 'undefined',\n `<${this.localName}> \"aspect-ratio\" has no effect when both \"width\" and \"height\" are set.`,\n DOCS_URL\n );\n }\n\n const children = Array.from(this.children);\n if (isDebug()) {\n this.validateSlottedContent(children);\n }\n this.resolveAccessibleName(children);\n this.applyFitToSvg(children);\n this.updateLoadState(children);\n super.update(changes);\n }\n\n /**\n * Warns when the default slot receives more than one child, or a child\n * that isn't an `<img>` or `<svg>`. There is exactly one (default) slot,\n * so its assigned elements are the host's own light DOM children.\n */\n private validateSlottedContent(children: Element[]): void {\n warnIf(\n this,\n children.length > 1,\n `<${this.localName}> only supports a single slotted <img> or <svg> element. Received ${children.length} children.`,\n DOCS_URL\n );\n const [child] = children;\n if (child) {\n const tagName = child.tagName.toLowerCase();\n warnIf(\n this,\n tagName !== 'img' && tagName !== 'svg',\n `<${this.localName}> expects its slotted content to be an <img> or <svg> element. Received <${tagName}>.`,\n DOCS_URL\n );\n }\n }\n\n /**\n * Implements `decorative` and the `accessibleLabel` fallback, in priority\n * order: `decorative` > the child's own name (self-healing a missing\n * `role=\"img\"` on a named `<svg>`) > `accessibleLabel` > warn.\n */\n private resolveAccessibleName(children: Element[]): void {\n if (this.decorative) {\n // Only claim ownership (and write the attribute) when it isn't\n // already present, to avoid redundant attribute writes.\n if (!this.hasAttribute('aria-hidden')) {\n this._appliedAriaHidden = true;\n this.setAttribute('aria-hidden', 'true');\n }\n return;\n }\n if (this._appliedAriaHidden) {\n this.removeAttribute('aria-hidden');\n this._appliedAriaHidden = false;\n }\n\n const [child] = children;\n const tagName = child?.tagName.toLowerCase();\n if (child && tagName !== 'img' && tagName !== 'svg') {\n // Already warned about by validateSlottedContent.\n return;\n }\n\n // Excludes a name this instance applied itself from counting as the\n // child's own.\n const ownsAppliedName = !!child && this._appliedAccessibleLabelTo === child;\n const hasOwnName =\n !!child &&\n !ownsAppliedName &&\n this.hasOwnAccessibleName(child, tagName as 'img' | 'svg');\n\n if (child) {\n if (hasOwnName) {\n if (tagName === 'svg' && !child.hasAttribute('role')) {\n child.setAttribute('role', 'img');\n }\n } else if (this.accessibleLabel) {\n if (tagName === 'img') {\n (child as HTMLImageElement).alt = this.accessibleLabel;\n } else {\n child.setAttribute('role', 'img');\n child.setAttribute('aria-label', this.accessibleLabel);\n }\n this._appliedAccessibleLabelTo = child;\n } else if (ownsAppliedName) {\n // accessibleLabel cleared; remove the name we applied instead of\n // leaving it stale.\n if (tagName === 'img') {\n (child as HTMLImageElement).removeAttribute('alt');\n } else {\n child.removeAttribute('role');\n child.removeAttribute('aria-label');\n }\n this._appliedAccessibleLabelTo = null;\n }\n }\n\n warnIf(\n this,\n !hasOwnName && !this.accessibleLabel,\n `<${this.localName}> requires an accessible name: set \"alt\" on the slotted <img> (or \"aria-label\"/\"aria-labelledby\"/a child <title> on the slotted <svg>), set \"accessible-label\" on <${this.localName}>, or set \"decorative\".`,\n DOCS_URL\n );\n }\n\n /**\n * Whether `child` already has its own accessible name. The `<svg>` branch\n * doesn't require `role=\"img\"` — `resolveAccessibleName` self-heals a\n * missing role separately.\n */\n private hasOwnAccessibleName(\n child: Element,\n tagName: 'img' | 'svg'\n ): boolean {\n const hasAriaName =\n child.hasAttribute('aria-label') || child.hasAttribute('aria-labelledby');\n if (tagName === 'img') {\n return hasAriaName || child.hasAttribute('alt');\n }\n const hasTitleChild = !!child.querySelector(':scope > title');\n return hasAriaName || hasTitleChild;\n }\n\n /**\n * Applies `fit` to a slotted `<svg>` via `preserveAspectRatio`, without\n * overwriting a consumer-set value or writing on every update.\n */\n private applyFitToSvg(children: Element[]): void {\n const [child] = children;\n if (child?.tagName.toLowerCase() !== 'svg') {\n this._preserveAspectRatioAppliedTo = null;\n return;\n }\n const alreadyOwned = this._preserveAspectRatioAppliedTo === child;\n if (child.hasAttribute('preserveAspectRatio') && !alreadyOwned) {\n return;\n }\n const value =\n SVG_PRESERVE_ASPECT_RATIO[this.fit] ?? SVG_PRESERVE_ASPECT_RATIO.cover;\n if (child.getAttribute('preserveAspectRatio') !== value) {\n child.setAttribute('preserveAspectRatio', value);\n }\n this._preserveAspectRatioAppliedTo = child;\n }\n\n /**\n * Tracks `loadState` against the slotted `<img>`, re-wiring listeners only\n * when the tracked element actually changes (a no-op on every other\n * property update, since re-running this for the same `<img>` would\n * incorrectly reset an already-resolved `loadState` back to `'loading'`).\n */\n private updateLoadState(children: Element[]): void {\n const [child] = children;\n const img =\n child?.tagName.toLowerCase() === 'img'\n ? (child as HTMLImageElement)\n : null;\n\n if (img === this._trackedImg) {\n return;\n }\n\n if (this._trackedImg) {\n this._trackedImg.removeEventListener('load', this.handleImgLoad);\n this._trackedImg.removeEventListener('error', this.handleImgError);\n }\n this._trackedImg = img;\n\n if (!img) {\n // No <img> to wait for: a slotted <svg>, an unsupported child, or\n // nothing slotted at all.\n this.loadState = 'loaded';\n return;\n }\n\n this.loadState = 'loading';\n img.addEventListener('load', this.handleImgLoad);\n img.addEventListener('error', this.handleImgError);\n\n // An already-complete `<img>` (e.g. cached) already fired its native\n // `load`/`error` before these listeners attached, so schedule the\n // equivalent transition instead of skipping it - a consumer can always\n // just listen for the events without special-casing the cache case.\n // An `<img>` with no `src` yet is also `complete` but has nothing to\n // report, hence the `currentSrc` check.\n if (img.complete && img.currentSrc) {\n const succeeded = img.naturalWidth > 0;\n queueMicrotask(() => {\n if (this._trackedImg !== img) {\n return;\n }\n if (succeeded) {\n this.handleImgLoad();\n } else {\n this.handleImgError();\n }\n });\n }\n }\n\n private readonly handleImgLoad = (): void => {\n this.loadState = 'loaded';\n this.dispatchEvent(\n new CustomEvent(SWC_ASSET_LOAD_EVENT, {\n bubbles: true,\n composed: true,\n })\n );\n };\n\n private readonly handleImgError = (): void => {\n this.loadState = 'error';\n this.dispatchEvent(\n new CustomEvent<AssetErrorEventDetail>(SWC_ASSET_ERROR_EVENT, {\n bubbles: true,\n composed: true,\n detail: { src: this._trackedImg?.currentSrc ?? '' },\n })\n );\n };\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ASSET_FIT_VALUES: readonly ["cover", "contain"];
|
|
13
|
+
export type AssetFit = (typeof ASSET_FIT_VALUES)[number];
|
|
14
|
+
export declare const ASSET_BACKGROUND_VALUES: readonly ["transparent", "solid", "checkerboard"];
|
|
15
|
+
export type AssetBackground = (typeof ASSET_BACKGROUND_VALUES)[number];
|
|
16
|
+
export declare const ASSET_LOAD_STATE_VALUES: readonly ["loading", "loaded", "error"];
|
|
17
|
+
export type AssetLoadState = (typeof ASSET_LOAD_STATE_VALUES)[number];
|
|
18
|
+
/** Fired when the slotted `<img>` finishes loading successfully. */
|
|
19
|
+
export declare const SWC_ASSET_LOAD_EVENT = "swc-asset-load";
|
|
20
|
+
/** Fired when the slotted `<img>` fails to load. */
|
|
21
|
+
export declare const SWC_ASSET_ERROR_EVENT = "swc-asset-error";
|
|
22
|
+
/** Detail emitted with `swc-asset-error`. */
|
|
23
|
+
export interface AssetErrorEventDetail {
|
|
24
|
+
src: string;
|
|
25
|
+
}
|
|
26
|
+
declare global {
|
|
27
|
+
interface GlobalEventHandlersEventMap {
|
|
28
|
+
[SWC_ASSET_LOAD_EVENT]: CustomEvent<undefined>;
|
|
29
|
+
[SWC_ASSET_ERROR_EVENT]: CustomEvent<AssetErrorEventDetail>;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region components/asset/Asset.types.ts
|
|
2
|
+
var e = ["cover", "contain"], t = [
|
|
3
|
+
"transparent",
|
|
4
|
+
"solid",
|
|
5
|
+
"checkerboard"
|
|
6
|
+
], n = [
|
|
7
|
+
"loading",
|
|
8
|
+
"loaded",
|
|
9
|
+
"error"
|
|
10
|
+
], r = "swc-asset-load", i = "swc-asset-error";
|
|
11
|
+
//#endregion
|
|
12
|
+
export { t as ASSET_BACKGROUND_VALUES, e as ASSET_FIT_VALUES, n as ASSET_LOAD_STATE_VALUES, i as SWC_ASSET_ERROR_EVENT, r as SWC_ASSET_LOAD_EVENT };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=Asset.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Asset.types.js","names":[],"sources":["../../../components/asset/Asset.types.ts"],"sourcesContent":["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport const ASSET_FIT_VALUES = [\n 'cover',\n 'contain',\n] as const satisfies readonly string[];\n\nexport type AssetFit = (typeof ASSET_FIT_VALUES)[number];\n\nexport const ASSET_BACKGROUND_VALUES = [\n 'transparent',\n 'solid',\n 'checkerboard',\n] as const satisfies readonly string[];\n\nexport type AssetBackground = (typeof ASSET_BACKGROUND_VALUES)[number];\n\nexport const ASSET_LOAD_STATE_VALUES = [\n 'loading',\n 'loaded',\n 'error',\n] as const satisfies readonly string[];\n\nexport type AssetLoadState = (typeof ASSET_LOAD_STATE_VALUES)[number];\n\n// ──────────────────\n// EVENTS\n// ──────────────────\n\n/** Fired when the slotted `<img>` finishes loading successfully. */\nexport const SWC_ASSET_LOAD_EVENT = 'swc-asset-load';\n\n/** Fired when the slotted `<img>` fails to load. */\nexport const SWC_ASSET_ERROR_EVENT = 'swc-asset-error';\n\n/** Detail emitted with `swc-asset-error`. */\nexport interface AssetErrorEventDetail {\n src: string;\n}\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n [SWC_ASSET_LOAD_EVENT]: CustomEvent<undefined>;\n [SWC_ASSET_ERROR_EVENT]: CustomEvent<AssetErrorEventDetail>;\n }\n}\n"],"mappings":";AAYA,IAAa,IAAmB,CAC9B,SACA,UACD,EAIY,IAA0B;CACrC;CACA;CACA;CACD,EAIY,IAA0B;CACrC;CACA;CACA;CACD,EASY,IAAuB,kBAGvB,IAAwB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
export * from './Asset.base.js';
|
|
13
|
+
export * from './Asset.types.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ASSET_BACKGROUND_VALUES as e, ASSET_FIT_VALUES as t, ASSET_LOAD_STATE_VALUES as n, SWC_ASSET_ERROR_EVENT as r, SWC_ASSET_LOAD_EVENT as i } from "./Asset.types.js";
|
|
2
|
+
import { AssetBase as a } from "./Asset.base.js";
|
|
3
|
+
export { e as ASSET_BACKGROUND_VALUES, t as ASSET_FIT_VALUES, n as ASSET_LOAD_STATE_VALUES, a as AssetBase, r as SWC_ASSET_ERROR_EVENT, i as SWC_ASSET_LOAD_EVENT };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
2
|
+
import { SpectrumElement } from '../../element/index.js';
|
|
3
|
+
import { AvatarSize } from './Avatar.types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Base class for the avatar component.
|
|
6
|
+
*
|
|
7
|
+
* Provides the core API for displaying a circular profile image. Concrete
|
|
8
|
+
* classes supply the stylesheet and render template.
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class AvatarBase extends SpectrumElement {
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*
|
|
14
|
+
* The set of valid numeric size values for the avatar.
|
|
15
|
+
*
|
|
16
|
+
* This is an internal property not intended for consumer use, but used in
|
|
17
|
+
* internal validation logic, stories, and tests to keep them in sync with
|
|
18
|
+
* the canonical type definition in `Avatar.types.ts`.
|
|
19
|
+
*/
|
|
20
|
+
static readonly VALID_SIZES: readonly AvatarSize[];
|
|
21
|
+
/**
|
|
22
|
+
* URL of the profile image to display.
|
|
23
|
+
*/
|
|
24
|
+
src: string;
|
|
25
|
+
/**
|
|
26
|
+
* Text description of the avatar image.
|
|
27
|
+
*/
|
|
28
|
+
alt: string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* The size of the avatar. Invalid values fall back to the default (500).
|
|
31
|
+
*
|
|
32
|
+
* @default 500
|
|
33
|
+
*/
|
|
34
|
+
get size(): AvatarSize;
|
|
35
|
+
set size(value: AvatarSize);
|
|
36
|
+
private _size;
|
|
37
|
+
/**
|
|
38
|
+
* Renders a visual outline around the avatar image.
|
|
39
|
+
*/
|
|
40
|
+
outline: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Renders the avatar at reduced opacity, indicating the entity is inactive or unavailable.
|
|
43
|
+
*/
|
|
44
|
+
disabled: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Marks the avatar as decorative, hiding it from assistive technology.
|
|
47
|
+
*/
|
|
48
|
+
decorative: boolean;
|
|
49
|
+
protected firstUpdated(changes: PropertyValues): void;
|
|
50
|
+
protected updated(changes: PropertyValues): void;
|
|
51
|
+
private _syncAriaHidden;
|
|
52
|
+
private _warnMissingAlt;
|
|
53
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { __decorate as e } from "../../_virtual/_@oxc-project_runtime@0.124.0/helpers/decorate.js";
|
|
2
|
+
import { AVATAR_VALID_SIZES as t } from "./Avatar.types.js";
|
|
3
|
+
import { property as n } from "lit/decorators.js";
|
|
4
|
+
import { SpectrumElement as r } from "@adobe/spectrum-wc-core/element/index.js";
|
|
5
|
+
import { warnIf as i } from "@adobe/spectrum-wc-core/utils/index.js";
|
|
6
|
+
//#region components/avatar/Avatar.base.ts
|
|
7
|
+
var a, o = class extends r {
|
|
8
|
+
constructor(...e) {
|
|
9
|
+
super(...e), this.src = "", this._size = 500, this.outline = !1, this.disabled = !1, this.decorative = !1;
|
|
10
|
+
}
|
|
11
|
+
get size() {
|
|
12
|
+
return this._size;
|
|
13
|
+
}
|
|
14
|
+
set size(e) {
|
|
15
|
+
let n = t.includes(Number(e)), r = n ? Number(e) : 500;
|
|
16
|
+
if (i(this, !n, `<${this.localName}> expects "size" to be one of: ${t.join(", ")}. Received "${e}".`, "https://spectrum-web-components.adobe.com/?path=/docs/components-avatar--docs", { issues: [`size="${e}"`] }), this._size === r) return;
|
|
17
|
+
let a = this._size;
|
|
18
|
+
this._size = r, this.requestUpdate("size", a);
|
|
19
|
+
}
|
|
20
|
+
firstUpdated(e) {
|
|
21
|
+
super.firstUpdated(e), this.hasAttribute("size") || this.setAttribute("size", String(this.size)), this._syncAriaHidden(), this._warnMissingAlt();
|
|
22
|
+
}
|
|
23
|
+
updated(e) {
|
|
24
|
+
super.updated(e), e.has("decorative") && this._syncAriaHidden(), e.has("alt") && this._warnMissingAlt();
|
|
25
|
+
}
|
|
26
|
+
_syncAriaHidden() {
|
|
27
|
+
this.decorative ? this.setAttribute("aria-hidden", "true") : this.removeAttribute("aria-hidden");
|
|
28
|
+
}
|
|
29
|
+
_warnMissingAlt() {
|
|
30
|
+
i(this, this.alt === void 0 && !this.decorative, `<${this.localName}> is missing an \`alt\` attribute. Provide a text description or pass \`alt=""\` and mark it as \`decorative\`.`, "https://spectrum-web-components.adobe.com/?path=/docs/components-avatar--docs", {
|
|
31
|
+
type: "accessibility",
|
|
32
|
+
issues: ["Provide an `alt` attribute with meaningful alternative text, or", "Set `alt=\"\"` and mark the image as `decorative` (hidden from screen readers)."]
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
a = o, a.VALID_SIZES = t, e([n({ type: String })], o.prototype, "src", void 0), e([n({ type: String })], o.prototype, "alt", void 0), e([n({
|
|
37
|
+
type: Number,
|
|
38
|
+
reflect: !0
|
|
39
|
+
})], o.prototype, "size", null), e([n({
|
|
40
|
+
type: Boolean,
|
|
41
|
+
reflect: !0
|
|
42
|
+
})], o.prototype, "outline", void 0), e([n({
|
|
43
|
+
type: Boolean,
|
|
44
|
+
reflect: !0
|
|
45
|
+
})], o.prototype, "disabled", void 0), e([n({
|
|
46
|
+
type: Boolean,
|
|
47
|
+
reflect: !0
|
|
48
|
+
})], o.prototype, "decorative", void 0);
|
|
49
|
+
//#endregion
|
|
50
|
+
export { o as AvatarBase };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=Avatar.base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Avatar.base.js","names":[],"sources":["../../../components/avatar/Avatar.base.ts"],"sourcesContent":["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';\nimport { warnIf } from '@adobe/spectrum-wc-core/utils/index.js';\n\nimport {\n AVATAR_DEFAULT_SIZE,\n AVATAR_VALID_SIZES,\n type AvatarSize,\n} from './Avatar.types.js';\n\n/**\n * Base class for the avatar component.\n *\n * Provides the core API for displaying a circular profile image. Concrete\n * classes supply the stylesheet and render template.\n */\nexport abstract class AvatarBase extends SpectrumElement {\n // ─────────────────────────\n // STATIC\n // ─────────────────────────\n\n /**\n * @internal\n *\n * The set of valid numeric size values for the avatar.\n *\n * This is an internal property not intended for consumer use, but used in\n * internal validation logic, stories, and tests to keep them in sync with\n * the canonical type definition in `Avatar.types.ts`.\n */\n static readonly VALID_SIZES: readonly AvatarSize[] = AVATAR_VALID_SIZES;\n\n // ──────────────────\n // CORE API\n // ──────────────────\n\n /**\n * URL of the profile image to display.\n */\n @property({ type: String })\n public src = '';\n\n /**\n * Text description of the avatar image.\n */\n @property({ type: String })\n public alt: string | undefined;\n\n // ───────────────────\n // SIZE API\n // ───────────────────\n\n /**\n * The size of the avatar. Invalid values fall back to the default (500).\n *\n * @default 500\n */\n @property({ type: Number, reflect: true })\n public get size(): AvatarSize {\n return this._size;\n }\n\n public set size(value: AvatarSize) {\n const isValid = (AVATAR_VALID_SIZES as readonly number[]).includes(\n Number(value)\n );\n const validSize = isValid\n ? (Number(value) as AvatarSize)\n : AVATAR_DEFAULT_SIZE;\n\n warnIf(\n this,\n !isValid,\n `<${this.localName}> expects \"size\" to be one of: ${AVATAR_VALID_SIZES.join(', ')}. Received \"${value}\".`,\n 'https://spectrum-web-components.adobe.com/?path=/docs/components-avatar--docs',\n { issues: [`size=\"${value}\"`] }\n );\n\n if (this._size === validSize) {\n return;\n }\n\n const oldSize = this._size;\n this._size = validSize;\n this.requestUpdate('size', oldSize);\n }\n\n private _size: AvatarSize = AVATAR_DEFAULT_SIZE;\n\n // ───────────────────────\n // VISUAL API\n // ───────────────────────\n\n /**\n * Renders a visual outline around the avatar image.\n */\n @property({ type: Boolean, reflect: true })\n public outline = false;\n\n /**\n * Renders the avatar at reduced opacity, indicating the entity is inactive or unavailable.\n */\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n // ───────────────────────────\n // ACCESSIBILITY API\n // ───────────────────────────\n\n /**\n * Marks the avatar as decorative, hiding it from assistive technology.\n */\n @property({ type: Boolean, reflect: true })\n public decorative = false;\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n if (!this.hasAttribute('size')) {\n this.setAttribute('size', String(this.size));\n }\n this._syncAriaHidden();\n this._warnMissingAlt();\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('decorative')) {\n this._syncAriaHidden();\n }\n if (changes.has('alt')) {\n this._warnMissingAlt();\n }\n }\n\n private _syncAriaHidden(): void {\n if (this.decorative) {\n this.setAttribute('aria-hidden', 'true');\n } else {\n this.removeAttribute('aria-hidden');\n }\n }\n\n private _warnMissingAlt(): void {\n warnIf(\n this,\n this.alt === undefined && !this.decorative,\n `<${this.localName}> is missing an \\`alt\\` attribute. Provide a text description or pass \\`alt=\"\"\\` and mark it as \\`decorative\\`.`,\n 'https://spectrum-web-components.adobe.com/?path=/docs/components-avatar--docs',\n {\n type: 'accessibility',\n issues: [\n 'Provide an `alt` attribute with meaningful alternative text, or',\n 'Set `alt=\"\"` and mark the image as `decorative` (hidden from screen readers).',\n ],\n }\n );\n }\n}\n"],"mappings":";;;;;;OA6BsB,IAAtB,cAAyC,EAAgB;;0BAwB1C,qCAyDI,oBAMC,sBAUE;;CAxDpB,IACW,OAAmB;AAC5B,SAAO,KAAK;;CAGd,IAAW,KAAK,GAAmB;EACjC,IAAM,IAAW,EAAyC,SACxD,OAAO,EAAM,CACd,EACK,IAAY,IACb,OAAO,EAAM,GAAA;AAWlB,MARA,EACE,MACA,CAAC,GACD,IAAI,KAAK,UAAU,iCAAiC,EAAmB,KAAK,KAAK,CAAC,cAAc,EAAM,KACtG,iFACA,EAAE,QAAQ,CAAC,SAAS,EAAM,GAAG,EAAE,CAChC,EAEG,KAAK,UAAU,EACjB;EAGF,IAAM,IAAU,KAAK;AAErB,EADA,KAAK,QAAQ,GACb,KAAK,cAAc,QAAQ,EAAQ;;CAmCrC,aAAgC,GAA+B;AAM7D,EALA,MAAM,aAAa,EAAQ,EACtB,KAAK,aAAa,OAAO,IAC5B,KAAK,aAAa,QAAQ,OAAO,KAAK,KAAK,CAAC,EAE9C,KAAK,iBAAiB,EACtB,KAAK,iBAAiB;;CAGxB,QAA2B,GAA+B;AAKxD,EAJA,MAAM,QAAQ,EAAQ,EAClB,EAAQ,IAAI,aAAa,IAC3B,KAAK,iBAAiB,EAEpB,EAAQ,IAAI,MAAM,IACpB,KAAK,iBAAiB;;CAI1B,kBAAgC;AAC9B,EAAI,KAAK,aACP,KAAK,aAAa,eAAe,OAAO,GAExC,KAAK,gBAAgB,cAAc;;CAIvC,kBAAgC;AAC9B,IACE,MACA,KAAK,QAAQ,KAAA,KAAa,CAAC,KAAK,YAChC,IAAI,KAAK,UAAU,kHACnB,iFACA;GACE,MAAM;GACN,QAAQ,CACN,mEACA,kFACD;GACF,CACF;;;uBAjIkD,MASpD,EAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,EAAA,EAAA,WAAA,OAAA,KAAA,EAAA,KAM1B,EAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,EAAA,EAAA,WAAA,OAAA,KAAA,EAAA,KAY1B,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,QAAA,KAAA,KAuCzC,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA,EAAA,KAM1C,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,YAAA,KAAA,EAAA,KAU1C,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,cAAA,KAAA,EAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Valid numeric size values for the Avatar component.
|
|
14
|
+
*
|
|
15
|
+
* Sizes 50–700 match 1st-gen. Sizes 800–1500 are new in Spectrum 2.
|
|
16
|
+
*/
|
|
17
|
+
export declare const AVATAR_VALID_SIZES: readonly [50, 75, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500];
|
|
18
|
+
export type AvatarSize = (typeof AVATAR_VALID_SIZES)[number];
|
|
19
|
+
export declare const AVATAR_DEFAULT_SIZE: 500;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region components/avatar/Avatar.types.ts
|
|
2
|
+
var e = [
|
|
3
|
+
50,
|
|
4
|
+
75,
|
|
5
|
+
100,
|
|
6
|
+
200,
|
|
7
|
+
300,
|
|
8
|
+
400,
|
|
9
|
+
500,
|
|
10
|
+
600,
|
|
11
|
+
700,
|
|
12
|
+
800,
|
|
13
|
+
900,
|
|
14
|
+
1e3,
|
|
15
|
+
1100,
|
|
16
|
+
1200,
|
|
17
|
+
1300,
|
|
18
|
+
1400,
|
|
19
|
+
1500
|
|
20
|
+
], t = 500;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { t as AVATAR_DEFAULT_SIZE, e as AVATAR_VALID_SIZES };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=Avatar.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Avatar.types.js","names":[],"sources":["../../../components/avatar/Avatar.types.ts"],"sourcesContent":["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/**\n * Valid numeric size values for the Avatar component.\n *\n * Sizes 50–700 match 1st-gen. Sizes 800–1500 are new in Spectrum 2.\n */\nexport const AVATAR_VALID_SIZES = [\n 50, 75, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300,\n 1400, 1500,\n] as const;\n\nexport type AvatarSize = (typeof AVATAR_VALID_SIZES)[number];\n\nexport const AVATAR_DEFAULT_SIZE = 500 as const satisfies AvatarSize;\n"],"mappings":";AAiBA,IAAa,IAAqB;CAChC;CAAI;CAAI;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAM;CAAM;CAAM;CACvE;CAAM;CACP,EAIY,IAAsB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
export * from './Avatar.base.js';
|
|
13
|
+
export * from './Avatar.types.js';
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
2
|
+
import { SlotPresenceController } from '../../controllers/slot-presence-controller/index.js';
|
|
3
|
+
import { SlotTextController } from '../../controllers/slot-text-controller/index.js';
|
|
4
|
+
import { SpectrumElement } from '../../element/index.js';
|
|
5
|
+
import { BadgeSize, BadgeVariant, FixedValues } from './Badge.types.js';
|
|
6
|
+
declare const BadgeBase_base: typeof SpectrumElement & {
|
|
7
|
+
new (...args: any[]): import('../../mixins/index.js').SizedElementInterface;
|
|
8
|
+
prototype: import('../../mixins/index.js').SizedElementInterface;
|
|
9
|
+
} & import('../../mixins/index.js').SizedElementConstructor;
|
|
10
|
+
/**
|
|
11
|
+
* A badge component that displays short, descriptive information about an element.
|
|
12
|
+
* Badges are typically used to indicate status, categories, or provide supplementary information.
|
|
13
|
+
*
|
|
14
|
+
* @attribute {ElementSize} size - The size of the badge.
|
|
15
|
+
*
|
|
16
|
+
* @slot - Text label of the badge.
|
|
17
|
+
* @slot icon - Optional icon that appears to the left of the label
|
|
18
|
+
*/
|
|
19
|
+
export declare abstract class BadgeBase extends BadgeBase_base {
|
|
20
|
+
/**
|
|
21
|
+
* The size of the badge.
|
|
22
|
+
*
|
|
23
|
+
* @default s
|
|
24
|
+
*/
|
|
25
|
+
size: BadgeSize;
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*
|
|
29
|
+
* A readonly array of the valid color variants for the badge.
|
|
30
|
+
*
|
|
31
|
+
* This is an actual internal property, intended not for customer use
|
|
32
|
+
* but for use in internal validation logic, stories, tests, etc.
|
|
33
|
+
*
|
|
34
|
+
* Because S1 and S2 support different color variants, the value of this
|
|
35
|
+
* property must be set in each subclass.
|
|
36
|
+
*/
|
|
37
|
+
static readonly VARIANTS_COLOR: readonly string[];
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
*
|
|
41
|
+
* A readonly array of all valid variants for the badge.
|
|
42
|
+
*
|
|
43
|
+
* This is an actual internal property, intended not for customer use
|
|
44
|
+
* but for use in internal validation logic, stories, tests, etc.
|
|
45
|
+
*
|
|
46
|
+
* Because S1 and S2 support different variants, the value of this
|
|
47
|
+
* property must be set in each subclass.
|
|
48
|
+
*/
|
|
49
|
+
static readonly VARIANTS: readonly string[];
|
|
50
|
+
/**
|
|
51
|
+
* @internal
|
|
52
|
+
*
|
|
53
|
+
* The variant of the badge.
|
|
54
|
+
*
|
|
55
|
+
* This is a public property, but its valid values vary between S1 and S2,
|
|
56
|
+
* so the property (and its docs) need to be redefined in each subclass.
|
|
57
|
+
*
|
|
58
|
+
* The type declared here is a union of the valid values for S1 and S2,
|
|
59
|
+
* and should be narrowed in each subclass.
|
|
60
|
+
*/
|
|
61
|
+
variant: BadgeVariant;
|
|
62
|
+
/**
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
static readonly FIXED_VALUES: readonly string[];
|
|
66
|
+
/**
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
static readonly VARIANTS_SEMANTIC: readonly string[];
|
|
70
|
+
/**
|
|
71
|
+
* The fixed position of the badge.
|
|
72
|
+
*/
|
|
73
|
+
fixed?: FixedValues;
|
|
74
|
+
/**
|
|
75
|
+
* Whether the badge is subtle.
|
|
76
|
+
*/
|
|
77
|
+
subtle: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Whether the badge is outlined.
|
|
80
|
+
*
|
|
81
|
+
* Can only be used with semantic variants.
|
|
82
|
+
*/
|
|
83
|
+
outline: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Observes whether an icon is slotted into `[slot="icon"]`.
|
|
86
|
+
*
|
|
87
|
+
* @internal
|
|
88
|
+
*/
|
|
89
|
+
protected slotPresence: SlotPresenceController;
|
|
90
|
+
/**
|
|
91
|
+
* Observes whether the default slot has meaningful text content. The default
|
|
92
|
+
* slot must bind `@slotchange=${this.slotText.handleSlotChange}` for changes
|
|
93
|
+
* after the first render to be tracked.
|
|
94
|
+
*
|
|
95
|
+
* @internal
|
|
96
|
+
*/
|
|
97
|
+
protected slotText: SlotTextController;
|
|
98
|
+
/**
|
|
99
|
+
* @internal
|
|
100
|
+
*
|
|
101
|
+
* Used for rendering gap when the badge has an icon.
|
|
102
|
+
*/
|
|
103
|
+
protected get hasIcon(): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Whether the default slot has meaningful text content. Consumed by the
|
|
106
|
+
* concrete element's `render()` to toggle icon-only presentation (the
|
|
107
|
+
* `swc-Badge--no-label` class and its icon-only padding tokens).
|
|
108
|
+
*
|
|
109
|
+
* @internal
|
|
110
|
+
*/
|
|
111
|
+
protected get slotHasContent(): boolean;
|
|
112
|
+
protected update(changedProperties: PropertyValues): void;
|
|
113
|
+
}
|
|
114
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { __decorate as e } from "../../_virtual/_@oxc-project_runtime@0.124.0/helpers/decorate.js";
|
|
2
|
+
import { BADGE_VALID_SIZES as t, BADGE_VARIANTS_SEMANTIC as n, FIXED_VALUES as r } from "./Badge.types.js";
|
|
3
|
+
import { property as i } from "lit/decorators.js";
|
|
4
|
+
import { SpectrumElement as a } from "@adobe/spectrum-wc-core/element/index.js";
|
|
5
|
+
import { SizedMixin as o } from "@adobe/spectrum-wc-core/mixins/index.js";
|
|
6
|
+
import { validateEnum as s, warnIf as c } from "@adobe/spectrum-wc-core/utils/index.js";
|
|
7
|
+
import { SlotPresenceController as l } from "@adobe/spectrum-wc-core/controllers/slot-presence-controller/index.js";
|
|
8
|
+
import { SlotTextController as u } from "@adobe/spectrum-wc-core/controllers/slot-text-controller/index.js";
|
|
9
|
+
//#region components/badge/Badge.base.ts
|
|
10
|
+
var d, f = class extends o(a, {
|
|
11
|
+
validSizes: t,
|
|
12
|
+
defaultSize: "s"
|
|
13
|
+
}) {
|
|
14
|
+
constructor(...e) {
|
|
15
|
+
super(...e), this.variant = "neutral", this.subtle = !1, this.outline = !1, this.slotPresence = new l(this, "[slot=\"icon\"]"), this.slotText = new u(this);
|
|
16
|
+
}
|
|
17
|
+
get hasIcon() {
|
|
18
|
+
return this.slotPresence.isPresent;
|
|
19
|
+
}
|
|
20
|
+
get slotHasContent() {
|
|
21
|
+
return this.slotText.hasContent;
|
|
22
|
+
}
|
|
23
|
+
update(e) {
|
|
24
|
+
let t = this.constructor;
|
|
25
|
+
s(this, {
|
|
26
|
+
prop: "variant",
|
|
27
|
+
value: this.variant,
|
|
28
|
+
valid: t.VARIANTS,
|
|
29
|
+
url: "https://spectrum-web-components.adobe.com/?path=/docs/components-badge--docs"
|
|
30
|
+
}), c(this, "outline" in this && this.outline === !0 && !t.VARIANTS_SEMANTIC.includes(this.variant), `<${this.localName}> element only supports the outline styling if the variant is a semantic color variant.`, "https://spectrum-web-components.adobe.com/?path=/docs/components-badge--docs", { issues: [...t.VARIANTS_SEMANTIC] }), super.update(e);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
d = f, d.FIXED_VALUES = r, d.VARIANTS_SEMANTIC = n, e([i({
|
|
34
|
+
type: String,
|
|
35
|
+
reflect: !0
|
|
36
|
+
})], f.prototype, "variant", void 0), e([i({
|
|
37
|
+
type: String,
|
|
38
|
+
reflect: !0
|
|
39
|
+
})], f.prototype, "fixed", void 0), e([i({
|
|
40
|
+
type: Boolean,
|
|
41
|
+
reflect: !0
|
|
42
|
+
})], f.prototype, "subtle", void 0), e([i({
|
|
43
|
+
type: Boolean,
|
|
44
|
+
reflect: !0
|
|
45
|
+
})], f.prototype, "outline", void 0);
|
|
46
|
+
//#endregion
|
|
47
|
+
export { f as BadgeBase };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=Badge.base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.base.js","names":[],"sources":["../../../components/badge/Badge.base.ts"],"sourcesContent":["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { SlotPresenceController } from '@adobe/spectrum-wc-core/controllers/slot-presence-controller/index.js';\nimport { SlotTextController } from '@adobe/spectrum-wc-core/controllers/slot-text-controller/index.js';\nimport { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';\nimport { SizedMixin } from '@adobe/spectrum-wc-core/mixins/index.js';\nimport { validateEnum, warnIf } from '@adobe/spectrum-wc-core/utils/index.js';\n\nimport {\n BADGE_VALID_SIZES,\n BADGE_VARIANTS_SEMANTIC,\n type BadgeSize,\n type BadgeVariant,\n FIXED_VALUES,\n type FixedValues,\n} from './Badge.types.js';\n\n/**\n * A badge component that displays short, descriptive information about an element.\n * Badges are typically used to indicate status, categories, or provide supplementary information.\n *\n * @attribute {ElementSize} size - The size of the badge.\n *\n * @slot - Text label of the badge.\n * @slot icon - Optional icon that appears to the left of the label\n */\nexport abstract class BadgeBase extends SizedMixin(SpectrumElement, {\n validSizes: BADGE_VALID_SIZES,\n defaultSize: 's',\n}) {\n /**\n * The size of the badge.\n *\n * @default s\n */\n declare public size: BadgeSize;\n\n // ─────────────────────────\n // API TO OVERRIDE\n // ─────────────────────────\n\n /**\n * @internal\n *\n * A readonly array of the valid color variants for the badge.\n *\n * This is an actual internal property, intended not for customer use\n * but for use in internal validation logic, stories, tests, etc.\n *\n * Because S1 and S2 support different color variants, the value of this\n * property must be set in each subclass.\n */\n static readonly VARIANTS_COLOR: readonly string[];\n\n /**\n * @internal\n *\n * A readonly array of all valid variants for the badge.\n *\n * This is an actual internal property, intended not for customer use\n * but for use in internal validation logic, stories, tests, etc.\n *\n * Because S1 and S2 support different variants, the value of this\n * property must be set in each subclass.\n */\n static readonly VARIANTS: readonly string[];\n\n /**\n * @internal\n *\n * The variant of the badge.\n *\n * This is a public property, but its valid values vary between S1 and S2,\n * so the property (and its docs) need to be redefined in each subclass.\n *\n * The type declared here is a union of the valid values for S1 and S2,\n * and should be narrowed in each subclass.\n */\n @property({ type: String, reflect: true })\n public variant: BadgeVariant = 'neutral';\n\n // ──────────────────\n // SHARED API\n // ──────────────────\n\n /**\n * @internal\n */\n static readonly FIXED_VALUES: readonly string[] = FIXED_VALUES;\n\n /**\n * @internal\n */\n static readonly VARIANTS_SEMANTIC: readonly string[] =\n BADGE_VARIANTS_SEMANTIC;\n\n /**\n * The fixed position of the badge.\n */\n @property({ type: String, reflect: true })\n public fixed?: FixedValues;\n\n /**\n * Whether the badge is subtle.\n */\n @property({ type: Boolean, reflect: true })\n public subtle: boolean = false;\n\n /**\n * Whether the badge is outlined.\n *\n * Can only be used with semantic variants.\n */\n @property({ type: Boolean, reflect: true })\n public outline: boolean = false;\n\n // ──────────────────────\n // CONTROLLERS\n // ──────────────────────\n\n /**\n * Observes whether an icon is slotted into `[slot=\"icon\"]`.\n *\n * @internal\n */\n protected slotPresence = new SlotPresenceController(this, '[slot=\"icon\"]');\n\n /**\n * Observes whether the default slot has meaningful text content. The default\n * slot must bind `@slotchange=${this.slotText.handleSlotChange}` for changes\n * after the first render to be tracked.\n *\n * @internal\n */\n protected slotText = new SlotTextController(this);\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n /**\n * @internal\n *\n * Used for rendering gap when the badge has an icon.\n */\n protected get hasIcon(): boolean {\n return this.slotPresence.isPresent;\n }\n\n /**\n * Whether the default slot has meaningful text content. Consumed by the\n * concrete element's `render()` to toggle icon-only presentation (the\n * `swc-Badge--no-label` class and its icon-only padding tokens).\n *\n * @internal\n */\n protected get slotHasContent(): boolean {\n return this.slotText.hasContent;\n }\n\n protected override update(changedProperties: PropertyValues): void {\n const constructor = this.constructor as typeof BadgeBase;\n validateEnum(this, {\n prop: 'variant',\n value: this.variant,\n valid: constructor.VARIANTS,\n url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-badge--docs',\n });\n // Check outline property if it exists (S2 only)\n warnIf(\n this,\n 'outline' in this &&\n (this as { outline: boolean }).outline === true &&\n !constructor.VARIANTS_SEMANTIC.includes(this.variant),\n `<${this.localName}> element only supports the outline styling if the variant is a semantic color variant.`,\n 'https://spectrum-web-components.adobe.com/?path=/docs/components-badge--docs',\n { issues: [...constructor.VARIANTS_SEMANTIC] }\n );\n super.update(changedProperties);\n }\n}\n"],"mappings":";;;;;;;;;OAsCsB,IAAtB,cAAwC,EAAW,GAAiB;CAClE,YAAY;CACZ,aAAa;CACd,CAAC,CAAC;;8BAkD8B,yBA2BN,mBAQC,wBAWD,IAAI,EAAuB,MAAM,kBAAgB,kBASrD,IAAI,EAAmB,KAAK;;CAWjD,IAAc,UAAmB;AAC/B,SAAO,KAAK,aAAa;;CAU3B,IAAc,iBAA0B;AACtC,SAAO,KAAK,SAAS;;CAGvB,OAA0B,GAAyC;EACjE,IAAM,IAAc,KAAK;AAiBzB,EAhBA,EAAa,MAAM;GACjB,MAAM;GACN,OAAO,KAAK;GACZ,OAAO,EAAY;GACnB,KAAK;GACN,CAAC,EAEF,EACE,MACA,aAAa,QACV,KAA8B,YAAY,MAC3C,CAAC,EAAY,kBAAkB,SAAS,KAAK,QAAQ,EACvD,IAAI,KAAK,UAAU,0FACnB,gFACA,EAAE,QAAQ,CAAC,GAAG,EAAY,kBAAkB,EAAE,CAC/C,EACD,MAAM,OAAO,EAAkB;;;wBA1FiB,yBAMhD,MAhBD,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA,EAAA,KAqBzC,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,SAAA,KAAA,EAAA,KAMzC,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,UAAA,KAAA,EAAA,KAQ1C,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA,EAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
export declare const BADGE_VALID_SIZES: readonly ["s", "m", "l", "xl"];
|
|
13
|
+
export declare const BADGE_VARIANTS_SEMANTIC: readonly ["accent", "informative", "neutral", "positive", "notice", "negative"];
|
|
14
|
+
export declare const BADGE_VARIANTS_COLOR: readonly ["fuchsia", "indigo", "magenta", "purple", "seafoam", "yellow", "gray", "red", "orange", "chartreuse", "celery", "green", "cyan", "blue", "pink", "turquoise", "brown", "cinnamon", "silver"];
|
|
15
|
+
export declare const FIXED_VALUES: readonly ["block-start", "block-end", "inline-start", "inline-end"];
|
|
16
|
+
export declare const BADGE_VARIANTS: readonly ["accent", "informative", "neutral", "positive", "notice", "negative", "fuchsia", "indigo", "magenta", "purple", "seafoam", "yellow", "gray", "red", "orange", "chartreuse", "celery", "green", "cyan", "blue", "pink", "turquoise", "brown", "cinnamon", "silver"];
|
|
17
|
+
export type FixedValues = (typeof FIXED_VALUES)[number];
|
|
18
|
+
export type BadgeSize = (typeof BADGE_VALID_SIZES)[number];
|
|
19
|
+
export type BadgeSemanticVariant = (typeof BADGE_VARIANTS_SEMANTIC)[number];
|
|
20
|
+
export type BadgeColorVariant = (typeof BADGE_VARIANTS_COLOR)[number];
|
|
21
|
+
export type BadgeVariant = (typeof BADGE_VARIANTS)[number];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//#region components/badge/Badge.types.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"s",
|
|
4
|
+
"m",
|
|
5
|
+
"l",
|
|
6
|
+
"xl"
|
|
7
|
+
], t = [
|
|
8
|
+
"accent",
|
|
9
|
+
"informative",
|
|
10
|
+
"neutral",
|
|
11
|
+
"positive",
|
|
12
|
+
"notice",
|
|
13
|
+
"negative"
|
|
14
|
+
], n = [
|
|
15
|
+
"fuchsia",
|
|
16
|
+
"indigo",
|
|
17
|
+
"magenta",
|
|
18
|
+
"purple",
|
|
19
|
+
"seafoam",
|
|
20
|
+
"yellow",
|
|
21
|
+
"gray",
|
|
22
|
+
"red",
|
|
23
|
+
"orange",
|
|
24
|
+
"chartreuse",
|
|
25
|
+
"celery",
|
|
26
|
+
"green",
|
|
27
|
+
"cyan",
|
|
28
|
+
"blue",
|
|
29
|
+
"pink",
|
|
30
|
+
"turquoise",
|
|
31
|
+
"brown",
|
|
32
|
+
"cinnamon",
|
|
33
|
+
"silver"
|
|
34
|
+
], r = [
|
|
35
|
+
"block-start",
|
|
36
|
+
"block-end",
|
|
37
|
+
"inline-start",
|
|
38
|
+
"inline-end"
|
|
39
|
+
], i = [...t, ...n];
|
|
40
|
+
//#endregion
|
|
41
|
+
export { e as BADGE_VALID_SIZES, i as BADGE_VARIANTS, n as BADGE_VARIANTS_COLOR, t as BADGE_VARIANTS_SEMANTIC, r as FIXED_VALUES };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=Badge.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.types.js","names":[],"sources":["../../../components/badge/Badge.types.ts"],"sourcesContent":["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport type { ElementSize } from '@adobe/spectrum-wc-core/mixins/index.js';\n\n// ──────────────────\n// SHARED\n// ──────────────────\n\nexport const BADGE_VALID_SIZES = [\n 's',\n 'm',\n 'l',\n 'xl',\n] as const satisfies readonly ElementSize[];\n\nexport const BADGE_VARIANTS_SEMANTIC = [\n 'accent',\n 'informative',\n 'neutral',\n 'positive',\n 'notice',\n 'negative',\n] as const;\n\nexport const BADGE_VARIANTS_COLOR = [\n 'fuchsia',\n 'indigo',\n 'magenta',\n 'purple',\n 'seafoam',\n 'yellow',\n 'gray',\n 'red',\n 'orange',\n 'chartreuse',\n 'celery',\n 'green',\n 'cyan',\n 'blue',\n 'pink',\n 'turquoise',\n 'brown',\n 'cinnamon',\n 'silver',\n] as const;\n\nexport const FIXED_VALUES = [\n 'block-start',\n 'block-end',\n 'inline-start',\n 'inline-end',\n] as const;\n\n// ──────────────────\n// CANONICAL\n// ──────────────────\n\nexport const BADGE_VARIANTS = [\n ...BADGE_VARIANTS_SEMANTIC,\n ...BADGE_VARIANTS_COLOR,\n] as const;\n\n// ──────────────────\n// TYPES\n// ──────────────────\n\n// Shared\nexport type FixedValues = (typeof FIXED_VALUES)[number];\nexport type BadgeSize = (typeof BADGE_VALID_SIZES)[number];\nexport type BadgeSemanticVariant = (typeof BADGE_VARIANTS_SEMANTIC)[number];\n\n// Canonical\nexport type BadgeColorVariant = (typeof BADGE_VARIANTS_COLOR)[number];\nexport type BadgeVariant = (typeof BADGE_VARIANTS)[number];\n"],"mappings":";AAkBA,IAAa,IAAoB;CAC/B;CACA;CACA;CACA;CACD,EAEY,IAA0B;CACrC;CACA;CACA;CACA;CACA;CACA;CACD,EAEY,IAAuB;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,EAEY,IAAe;CAC1B;CACA;CACA;CACA;CACD,EAMY,IAAiB,CAC5B,GAAG,GACH,GAAG,EACJ"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
export * from './Badge.base.js';
|
|
13
|
+
export * from './Badge.types.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { BADGE_VALID_SIZES as e, BADGE_VARIANTS as t, BADGE_VARIANTS_COLOR as n, BADGE_VARIANTS_SEMANTIC as r, FIXED_VALUES as i } from "./Badge.types.js";
|
|
2
|
+
import { BadgeBase as a } from "./Badge.base.js";
|
|
3
|
+
export { e as BADGE_VALID_SIZES, t as BADGE_VARIANTS, n as BADGE_VARIANTS_COLOR, r as BADGE_VARIANTS_SEMANTIC, a as BadgeBase, i as FIXED_VALUES };
|