@govtechsg/sgds-web-component 3.3.0 → 3.3.1
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/base/card-element.d.ts +19 -0
- package/base/card-element.js +43 -2
- package/base/card-element.js.map +1 -1
- package/base/card.js +1 -1
- package/{src/base → base}/dropdown-element.d.ts +3 -1
- package/base/dropdown-element.js +2 -1
- package/base/dropdown-element.js.map +1 -1
- package/base/select-element.js +3 -1
- package/base/select-element.js.map +1 -1
- package/components/Breadcrumb/index.umd.js +3 -2
- package/components/Breadcrumb/index.umd.js.map +1 -1
- package/{src/components → components}/Breadcrumb/sgds-breadcrumb.d.ts +1 -1
- package/components/Breadcrumb/sgds-breadcrumb.js +1 -1
- package/components/Breadcrumb/sgds-breadcrumb.js.map +1 -1
- package/components/Card/card.js +1 -1
- package/components/Card/index.umd.js +83 -82
- package/components/Card/index.umd.js.map +1 -1
- package/{src/components → components}/Card/sgds-card.d.ts +4 -15
- package/components/Card/sgds-card.js +16 -56
- package/components/Card/sgds-card.js.map +1 -1
- package/components/Card/types.d.ts +3 -0
- package/components/ComboBox/combo-box.js +1 -1
- package/components/ComboBox/index.umd.js +18 -3
- package/components/ComboBox/index.umd.js.map +1 -1
- package/components/Datepicker/index.umd.js +17 -12
- package/components/Datepicker/index.umd.js.map +1 -1
- package/{src/components → components}/Datepicker/sgds-datepicker.d.ts +3 -2
- package/components/Datepicker/sgds-datepicker.js +15 -11
- package/components/Datepicker/sgds-datepicker.js.map +1 -1
- package/components/Dropdown/dropdown.js +1 -1
- package/components/Dropdown/index.umd.js +3 -2
- package/components/Dropdown/index.umd.js.map +1 -1
- package/components/IconCard/icon-card.js +6 -0
- package/components/IconCard/icon-card.js.map +1 -0
- package/components/IconCard/index.d.ts +6 -0
- package/components/IconCard/index.js +4 -0
- package/components/IconCard/index.js.map +1 -0
- package/components/IconCard/index.umd.js +4750 -0
- package/components/IconCard/index.umd.js.map +1 -0
- package/components/IconCard/sgds-icon-card.d.ts +24 -0
- package/components/IconCard/sgds-icon-card.js +83 -0
- package/components/IconCard/sgds-icon-card.js.map +1 -0
- package/components/ImageCard/image-card.js +6 -0
- package/components/ImageCard/image-card.js.map +1 -0
- package/components/ImageCard/index.d.ts +6 -0
- package/components/ImageCard/index.js +4 -0
- package/components/ImageCard/index.js.map +1 -0
- package/components/ImageCard/index.umd.js +4764 -0
- package/components/ImageCard/index.umd.js.map +1 -0
- package/components/ImageCard/sgds-image-card.d.ts +30 -0
- package/components/ImageCard/sgds-image-card.js +97 -0
- package/components/ImageCard/sgds-image-card.js.map +1 -0
- package/components/Mainnav/index.umd.js +5 -4
- package/components/Mainnav/index.umd.js.map +1 -1
- package/components/Mainnav/mainnav.js +1 -1
- package/components/Mainnav/sgds-mainnav-dropdown.js +1 -1
- package/components/Mainnav/sgds-mainnav-dropdown.js.map +1 -1
- package/components/Modal/index.umd.js +1 -1
- package/components/Modal/modal.js +1 -1
- package/components/OverflowMenu/index.js +5 -0
- package/components/OverflowMenu/index.js.map +1 -0
- package/components/OverflowMenu/index.umd.js +11130 -0
- package/components/OverflowMenu/index.umd.js.map +1 -0
- package/{src/internals → components}/OverflowMenu/sgds-overflow-menu.d.ts +3 -3
- package/{internals → components}/OverflowMenu/sgds-overflow-menu.js +3 -3
- package/components/OverflowMenu/sgds-overflow-menu.js.map +1 -0
- package/components/Select/index.umd.js +18 -3
- package/components/Select/index.umd.js.map +1 -1
- package/components/Select/select.js +1 -1
- package/components/ThumbnailCard/index.d.ts +6 -0
- package/components/ThumbnailCard/index.js +4 -0
- package/components/ThumbnailCard/index.js.map +1 -0
- package/components/ThumbnailCard/index.umd.js +4754 -0
- package/components/ThumbnailCard/index.umd.js.map +1 -0
- package/components/ThumbnailCard/sgds-thumbnail-card.d.ts +24 -0
- package/components/ThumbnailCard/sgds-thumbnail-card.js +87 -0
- package/components/ThumbnailCard/sgds-thumbnail-card.js.map +1 -0
- package/components/ThumbnailCard/thumbnail-card.js +6 -0
- package/components/ThumbnailCard/thumbnail-card.js.map +1 -0
- package/{src/components → components}/index.d.ts +4 -0
- package/components/index.js +4 -0
- package/components/index.js.map +1 -1
- package/components/index.umd.js +475 -208
- package/components/index.umd.js.map +1 -1
- package/{src/index.d.ts → index.d.ts} +4 -0
- package/index.js +4 -0
- package/index.js.map +1 -1
- package/index.umd.js +493 -222
- package/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/react/base/card-element.cjs.js +42 -1
- package/react/base/card-element.cjs.js.map +1 -1
- package/react/base/card-element.js +43 -2
- package/react/base/card-element.js.map +1 -1
- package/react/base/card.cjs.js +1 -1
- package/react/base/card.js +1 -1
- package/react/base/dropdown-element.cjs.js +2 -1
- package/react/base/dropdown-element.cjs.js.map +1 -1
- package/react/base/dropdown-element.js +2 -1
- package/react/base/dropdown-element.js.map +1 -1
- package/react/base/select-element.cjs.js +3 -1
- package/react/base/select-element.cjs.js.map +1 -1
- package/react/base/select-element.js +3 -1
- package/react/base/select-element.js.map +1 -1
- package/react/components/Breadcrumb/sgds-breadcrumb.cjs.js +1 -1
- package/react/components/Breadcrumb/sgds-breadcrumb.cjs.js.map +1 -1
- package/react/components/Breadcrumb/sgds-breadcrumb.js +1 -1
- package/react/components/Breadcrumb/sgds-breadcrumb.js.map +1 -1
- package/react/components/Card/card.cjs.js +1 -1
- package/react/components/Card/card.js +1 -1
- package/react/components/Card/sgds-card.cjs.js +15 -55
- package/react/components/Card/sgds-card.cjs.js.map +1 -1
- package/react/components/Card/sgds-card.js +16 -56
- package/react/components/Card/sgds-card.js.map +1 -1
- package/react/components/ComboBox/combo-box.cjs.js +1 -1
- package/react/components/ComboBox/combo-box.js +1 -1
- package/react/components/Datepicker/sgds-datepicker.cjs.js +15 -11
- package/react/components/Datepicker/sgds-datepicker.cjs.js.map +1 -1
- package/react/components/Datepicker/sgds-datepicker.js +15 -11
- package/react/components/Datepicker/sgds-datepicker.js.map +1 -1
- package/react/components/Dropdown/dropdown.cjs.js +1 -1
- package/react/components/Dropdown/dropdown.js +1 -1
- package/react/components/IconCard/icon-card.cjs.js +11 -0
- package/react/components/IconCard/icon-card.cjs.js.map +1 -0
- package/react/components/IconCard/icon-card.js +7 -0
- package/react/components/IconCard/icon-card.js.map +1 -0
- package/react/components/IconCard/sgds-icon-card.cjs.js +89 -0
- package/react/components/IconCard/sgds-icon-card.cjs.js.map +1 -0
- package/react/components/IconCard/sgds-icon-card.js +84 -0
- package/react/components/IconCard/sgds-icon-card.js.map +1 -0
- package/react/components/ImageCard/image-card.cjs.js +11 -0
- package/react/components/ImageCard/image-card.cjs.js.map +1 -0
- package/react/components/ImageCard/image-card.js +7 -0
- package/react/components/ImageCard/image-card.js.map +1 -0
- package/react/components/ImageCard/sgds-image-card.cjs.js +103 -0
- package/react/components/ImageCard/sgds-image-card.cjs.js.map +1 -0
- package/react/components/ImageCard/sgds-image-card.js +98 -0
- package/react/components/ImageCard/sgds-image-card.js.map +1 -0
- package/react/components/Mainnav/mainnav.cjs.js +1 -1
- package/react/components/Mainnav/mainnav.js +1 -1
- package/react/components/Mainnav/sgds-mainnav-dropdown.cjs.js +1 -1
- package/react/components/Mainnav/sgds-mainnav-dropdown.cjs.js.map +1 -1
- package/react/components/Mainnav/sgds-mainnav-dropdown.js +1 -1
- package/react/components/Mainnav/sgds-mainnav-dropdown.js.map +1 -1
- package/react/components/Modal/modal.cjs.js +1 -1
- package/react/components/Modal/modal.js +1 -1
- package/react/{internals → components}/OverflowMenu/sgds-overflow-menu.cjs.js +3 -3
- package/react/components/OverflowMenu/sgds-overflow-menu.cjs.js.map +1 -0
- package/react/{internals → components}/OverflowMenu/sgds-overflow-menu.js +3 -3
- package/react/components/OverflowMenu/sgds-overflow-menu.js.map +1 -0
- package/react/components/Select/select.cjs.js +1 -1
- package/react/components/Select/select.js +1 -1
- package/react/components/ThumbnailCard/sgds-thumbnail-card.cjs.js +93 -0
- package/react/components/ThumbnailCard/sgds-thumbnail-card.cjs.js.map +1 -0
- package/react/components/ThumbnailCard/sgds-thumbnail-card.js +88 -0
- package/react/components/ThumbnailCard/sgds-thumbnail-card.js.map +1 -0
- package/react/components/ThumbnailCard/thumbnail-card.cjs.js +11 -0
- package/react/components/ThumbnailCard/thumbnail-card.cjs.js.map +1 -0
- package/react/components/ThumbnailCard/thumbnail-card.js +7 -0
- package/react/components/ThumbnailCard/thumbnail-card.js.map +1 -0
- package/react/icon-card/index.cjs.js +40 -0
- package/react/icon-card/index.cjs.js.map +1 -0
- package/react/icon-card/index.js +16 -0
- package/react/icon-card/index.js.map +1 -0
- package/react/image-card/index.cjs.js +40 -0
- package/react/image-card/index.cjs.js.map +1 -0
- package/react/image-card/index.js +16 -0
- package/react/image-card/index.js.map +1 -0
- package/react/index.cjs.js +78 -70
- package/react/index.cjs.js.map +1 -1
- package/{src/react → react}/index.d.ts +4 -0
- package/react/index.js +4 -0
- package/react/index.js.map +1 -1
- package/react/overflow-menu/index.cjs.js +40 -0
- package/react/overflow-menu/index.cjs.js.map +1 -0
- package/react/overflow-menu/index.js +16 -0
- package/react/overflow-menu/index.js.map +1 -0
- package/react/thumbnail-card/index.cjs.js +40 -0
- package/react/thumbnail-card/index.cjs.js.map +1 -0
- package/react/thumbnail-card/index.d.ts +2 -0
- package/react/thumbnail-card/index.js +16 -0
- package/react/thumbnail-card/index.js.map +1 -0
- package/react/toast/index.d.ts +2 -0
- package/react/toast-container/index.d.ts +2 -0
- package/react/tooltip/index.d.ts +2 -0
- package/react/utils/popper.cjs.js +20 -0
- package/react/utils/popper.cjs.js.map +1 -0
- package/react/utils/popper.js +16 -0
- package/react/utils/popper.js.map +1 -0
- package/utils/popper.d.ts +5 -0
- package/utils/popper.js +15 -0
- package/utils/popper.js.map +1 -0
- package/internals/OverflowMenu/sgds-overflow-menu.js.map +0 -1
- package/react/internals/OverflowMenu/sgds-overflow-menu.cjs.js.map +0 -1
- package/react/internals/OverflowMenu/sgds-overflow-menu.js.map +0 -1
- package/scripts/figma/sync-figma-to-tokens/__tests__/write-tokens-to-css-var.test.d.ts +0 -0
- package/scripts/figma/sync-figma-to-tokens/color.d.ts +0 -8
- package/scripts/figma/sync-figma-to-tokens/figma_api.d.ts +0 -8
- package/scripts/figma/sync-figma-to-tokens/sync-figma-to-tokens.d.ts +0 -1
- package/scripts/figma/sync-figma-to-tokens/token_export.d.ts +0 -5
- package/scripts/figma/sync-figma-to-tokens/token_types.d.ts +0 -52
- package/scripts/figma/sync-figma-to-tokens/utils.d.ts +0 -3
- package/scripts/figma/sync-figma-to-tokens/write-tokens-to-css-var.d.ts +0 -8
- package/src/base/card-element.d.ts +0 -8
- /package/{src/base → base}/button-element.d.ts +0 -0
- /package/{src/base → base}/dropdown-list-element.d.ts +0 -0
- /package/{src/base → base}/form-control-element.d.ts +0 -0
- /package/{src/base → base}/link-element.d.ts +0 -0
- /package/{src/base → base}/select-element.d.ts +0 -0
- /package/{src/base → base}/sgds-element.d.ts +0 -0
- /package/{src/components → components}/Accordion/index.d.ts +0 -0
- /package/{src/components → components}/Accordion/sgds-accordion-item.d.ts +0 -0
- /package/{src/components → components}/Accordion/sgds-accordion.d.ts +0 -0
- /package/{src/components → components}/Alert/index.d.ts +0 -0
- /package/{src/components → components}/Alert/sgds-alert-link.d.ts +0 -0
- /package/{src/components → components}/Alert/sgds-alert.d.ts +0 -0
- /package/{src/components → components}/Badge/index.d.ts +0 -0
- /package/{src/components → components}/Badge/sgds-badge.d.ts +0 -0
- /package/{src/components → components}/Breadcrumb/index.d.ts +0 -0
- /package/{src/components → components}/Breadcrumb/sgds-breadcrumb-item.d.ts +0 -0
- /package/{src/components → components}/Button/index.d.ts +0 -0
- /package/{src/components → components}/Button/sgds-button.d.ts +0 -0
- /package/{src/components → components}/Card/index.d.ts +0 -0
- /package/{src/components → components}/Checkbox/index.d.ts +0 -0
- /package/{src/components → components}/Checkbox/sgds-checkbox-group.d.ts +0 -0
- /package/{src/components → components}/Checkbox/sgds-checkbox.d.ts +0 -0
- /package/{src/components → components}/ComboBox/combo-box-item.d.ts +0 -0
- /package/{src/components → components}/ComboBox/index.d.ts +0 -0
- /package/{src/components → components}/ComboBox/sgds-combo-box.d.ts +0 -0
- /package/{src/components → components}/Datepicker/datepicker-calendar.d.ts +0 -0
- /package/{src/components → components}/Datepicker/datepicker-header.d.ts +0 -0
- /package/{src/components → components}/Datepicker/datepicker-input.d.ts +0 -0
- /package/{src/components → components}/Datepicker/index.d.ts +0 -0
- /package/{src/components → components}/Datepicker/types.d.ts +0 -0
- /package/{src/components → components}/DescriptionList/index.d.ts +0 -0
- /package/{src/components → components}/DescriptionList/sgds-description-list-group.d.ts +0 -0
- /package/{src/components → components}/DescriptionList/sgds-description-list.d.ts +0 -0
- /package/{src/components → components}/Divider/index.d.ts +0 -0
- /package/{src/components → components}/Divider/sgds-divider.d.ts +0 -0
- /package/{src/components → components}/Drawer/index.d.ts +0 -0
- /package/{src/components → components}/Drawer/sgds-drawer.d.ts +0 -0
- /package/{src/components → components}/Dropdown/index.d.ts +0 -0
- /package/{src/components → components}/Dropdown/sgds-dropdown-item.d.ts +0 -0
- /package/{src/components → components}/Dropdown/sgds-dropdown.d.ts +0 -0
- /package/{src/components → components}/FileUpload/index.d.ts +0 -0
- /package/{src/components → components}/FileUpload/sgds-file-upload.d.ts +0 -0
- /package/{src/components → components}/Footer/index.d.ts +0 -0
- /package/{src/components → components}/Footer/sgds-footer-item.d.ts +0 -0
- /package/{src/components → components}/Footer/sgds-footer.d.ts +0 -0
- /package/{src/components → components}/Icon/icon-registry.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/archive.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/arrow-bar-down.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/arrow-bar-left.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/arrow-bar-right.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/arrow-bar-up.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/arrow-circle-down.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/arrow-circle-left.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/arrow-circle-right.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/arrow-circle-up.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/arrow-clockwise.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/arrow-down.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/arrow-left.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/arrow-repeat.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/arrow-right.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/arrow-square-down.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/arrow-square-left.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/arrow-square-right.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/arrow-square-up.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/arrow-up.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/bank-fill.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/bell-slash.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/bell.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/bi-funnel.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/bookmark-fill.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/bookmark.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/box-arrow-up-right.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/box-seam.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/building.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/bus.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/calculator.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/calendar-check.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/calendar-x.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/calendar.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/camera.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/car.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/chat-dots.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/chat-left-text.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/chat.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/check-circle-fill.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/check-circle.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/check.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/chevron-down.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/chevron-left.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/chevron-right.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/chevron-selector-vertical.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/chevron-up.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/clock.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/cloud-check.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/cloud-download.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/cloud-upload.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/cloud.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/compass.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/cross.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/cursor-fill.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/cursor.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/dash-circle.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/dash-square.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/dash.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/download.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/edit.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/exclamation-circle-fill.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/exclamation-circle.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/exclamation-triangle-fill.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/exclamation-triangle.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/exclamation.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/eye-fill.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/eye-slash-fill.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/eye-slash.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/eye.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/facebook.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/file-earmark-text.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/file-pdf.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/file-plus.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/file-text.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/file.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/files.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/folder-check.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/folder-minus.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/folder-plus.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/folder.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/gear.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/geo-alt.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/geo-fill.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/geo.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/globe-alt.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/globe.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/google.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/grid-fill.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/hand-thumbs-down.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/hand-thumbs-up.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/hard-drive.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/heart.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/house-door.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/house.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/image.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/in-box.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/info-circle-fill.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/info-circle.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/instagram.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/laptop.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/layers.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/layout-text-window-reverse.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/layout-text-window.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/layout.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/lightbulb.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/link.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/linkedin.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/list.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/lock-fill.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/lock.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/login.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/logout.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/luggage.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/mail.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/map.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/menu.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/microphone.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/monitor.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/paperclip.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/passport.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/pencil.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/pending-circle.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/person-dash.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/person-plus.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/person-x.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/person.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/phone.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/pin-map-fill.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/pin.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/placeholder.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/plane.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/plus-circle.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/plus-square.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/plus.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/printer.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/question-circle.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/rocket.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/save.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/search.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/send.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/sg-crest.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/share.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/slash-circle.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/sliders.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/speedometer.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/star-fill.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/star.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/stoplights.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/switch-horizontal.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/switch-vertical.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/tablet.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/telephone.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/three-dots-vertical.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/three-dots.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/ticket.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/toggle-off.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/toggle-on.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/train.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/translate.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/trash.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/truck.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/twitter-x.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/unlock.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/upload.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/user-circle.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/user-square.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/users.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/video-recorder.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/volume-max.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/volume-x.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/window-dash.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/window-desktop.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/window-dock.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/window-fullscreen.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/window-plus.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/window-sidebar.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/window-split.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/window-stack.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/window-x.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/window.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/xcircle-fill.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/xcircle.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/youtube.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/zoom-in.d.ts +0 -0
- /package/{src/components → components}/Icon/icons/zoom-out.d.ts +0 -0
- /package/{src/components → components}/Icon/index.d.ts +0 -0
- /package/{src/components → components}/Icon/sgds-icon.d.ts +0 -0
- /package/{src/components → components}/IconButton/index.d.ts +0 -0
- /package/{src/components → components}/IconButton/sgds-icon-button.d.ts +0 -0
- /package/{src/components → components}/IconList/index.d.ts +0 -0
- /package/{src/components → components}/IconList/sgds-icon-list.d.ts +0 -0
- /package/{src/components → components}/Input/index.d.ts +0 -0
- /package/{src/components → components}/Input/sgds-input.d.ts +0 -0
- /package/{src/components → components}/Link/index.d.ts +0 -0
- /package/{src/components → components}/Link/sgds-link.d.ts +0 -0
- /package/{src/components → components}/Mainnav/index.d.ts +0 -0
- /package/{src/components → components}/Mainnav/mainnav-context.d.ts +0 -0
- /package/{src/components → components}/Mainnav/sgds-mainnav-dropdown.d.ts +0 -0
- /package/{src/components → components}/Mainnav/sgds-mainnav-item.d.ts +0 -0
- /package/{src/components → components}/Mainnav/sgds-mainnav.d.ts +0 -0
- /package/{src/components → components}/Masthead/index.d.ts +0 -0
- /package/{src/components → components}/Masthead/sgds-masthead.d.ts +0 -0
- /package/{src/components → components}/Modal/index.d.ts +0 -0
- /package/{src/components → components}/Modal/sgds-modal.d.ts +0 -0
- /package/{src/internals → components}/OverflowMenu/index.d.ts +0 -0
- /package/{internals → components}/OverflowMenu/overflow-menu.js +0 -0
- /package/{internals → components}/OverflowMenu/overflow-menu.js.map +0 -0
- /package/{src/components → components}/Pagination/index.d.ts +0 -0
- /package/{src/components → components}/Pagination/sgds-pagination.d.ts +0 -0
- /package/{src/components → components}/ProgressBar/index.d.ts +0 -0
- /package/{src/components → components}/ProgressBar/sgds-progress-bar.d.ts +0 -0
- /package/{src/components → components}/QuantityToggle/index.d.ts +0 -0
- /package/{src/components → components}/QuantityToggle/sgds-quantity-toggle.d.ts +0 -0
- /package/{src/components → components}/Radio/index.d.ts +0 -0
- /package/{src/components → components}/Radio/sgds-radio-group.d.ts +0 -0
- /package/{src/components → components}/Radio/sgds-radio.d.ts +0 -0
- /package/{src/components → components}/Select/index.d.ts +0 -0
- /package/{src/components → components}/Select/select-item.d.ts +0 -0
- /package/{src/components → components}/Select/sgds-select.d.ts +0 -0
- /package/{src/components → components}/Sidenav/index.d.ts +0 -0
- /package/{src/components → components}/Sidenav/sgds-sidenav-item.d.ts +0 -0
- /package/{src/components → components}/Sidenav/sgds-sidenav-link.d.ts +0 -0
- /package/{src/components → components}/Sidenav/sgds-sidenav.d.ts +0 -0
- /package/{src/components → components}/Skeleton/index.d.ts +0 -0
- /package/{src/components → components}/Skeleton/sgds-skeleton.d.ts +0 -0
- /package/{src/components → components}/Spinner/index.d.ts +0 -0
- /package/{src/components → components}/Spinner/sgds-spinner.d.ts +0 -0
- /package/{src/components → components}/Stepper/index.d.ts +0 -0
- /package/{src/components → components}/Stepper/sgds-stepper.d.ts +0 -0
- /package/{src/components → components}/Subnav/index.d.ts +0 -0
- /package/{src/components → components}/Subnav/sgds-subnav-item.d.ts +0 -0
- /package/{src/components → components}/Subnav/sgds-subnav.d.ts +0 -0
- /package/{src/components → components}/Switch/index.d.ts +0 -0
- /package/{src/components → components}/Switch/sgds-switch.d.ts +0 -0
- /package/{src/components → components}/Tab/index.d.ts +0 -0
- /package/{src/components → components}/Tab/sgds-tab-group.d.ts +0 -0
- /package/{src/components → components}/Tab/sgds-tab-panel.d.ts +0 -0
- /package/{src/components → components}/Tab/sgds-tab.d.ts +0 -0
- /package/{src/components → components}/Table/index.d.ts +0 -0
- /package/{src/components → components}/Table/sgds-table-cell.d.ts +0 -0
- /package/{src/components → components}/Table/sgds-table-head.d.ts +0 -0
- /package/{src/components → components}/Table/sgds-table-row.d.ts +0 -0
- /package/{src/components → components}/Table/sgds-table.d.ts +0 -0
- /package/{src/components → components}/TableOfContents/index.d.ts +0 -0
- /package/{src/components → components}/TableOfContents/sgds-table-of-contents.d.ts +0 -0
- /package/{src/components → components}/Textarea/index.d.ts +0 -0
- /package/{src/components → components}/Textarea/sgds-textarea.d.ts +0 -0
- /package/{src/components → components}/Toast/index.d.ts +0 -0
- /package/{src/components → components}/Toast/sgds-toast-container.d.ts +0 -0
- /package/{src/components → components}/Toast/sgds-toast.d.ts +0 -0
- /package/{src/components → components}/Tooltip/index.d.ts +0 -0
- /package/{src/components → components}/Tooltip/sgds-tooltip.d.ts +0 -0
- /package/{src/internals → internals}/CloseButton/index.d.ts +0 -0
- /package/{src/internals → internals}/CloseButton/sgds-close-button.d.ts +0 -0
- /package/{src/react → react}/accordion/index.d.ts +0 -0
- /package/{src/react → react}/accordion-item/index.d.ts +0 -0
- /package/{src/react → react}/alert/index.d.ts +0 -0
- /package/{src/react → react}/alert-link/index.d.ts +0 -0
- /package/{src/react → react}/badge/index.d.ts +0 -0
- /package/{src/react → react}/breadcrumb/index.d.ts +0 -0
- /package/{src/react → react}/breadcrumb-item/index.d.ts +0 -0
- /package/{src/react → react}/button/index.d.ts +0 -0
- /package/{src/react → react}/card/index.d.ts +0 -0
- /package/{src/react → react}/checkbox/index.d.ts +0 -0
- /package/{src/react → react}/checkbox-group/index.d.ts +0 -0
- /package/{src/react → react}/combo-box/index.d.ts +0 -0
- /package/react/{internals → components}/OverflowMenu/overflow-menu.cjs.js +0 -0
- /package/react/{internals → components}/OverflowMenu/overflow-menu.cjs.js.map +0 -0
- /package/react/{internals → components}/OverflowMenu/overflow-menu.js +0 -0
- /package/react/{internals → components}/OverflowMenu/overflow-menu.js.map +0 -0
- /package/{src/react → react}/datepicker/index.d.ts +0 -0
- /package/{src/react → react}/description-list/index.d.ts +0 -0
- /package/{src/react → react}/description-list-group/index.d.ts +0 -0
- /package/{src/react → react}/divider/index.d.ts +0 -0
- /package/{src/react → react}/drawer/index.d.ts +0 -0
- /package/{src/react → react}/dropdown/index.d.ts +0 -0
- /package/{src/react → react}/dropdown-item/index.d.ts +0 -0
- /package/{src/react → react}/file-upload/index.d.ts +0 -0
- /package/{src/react → react}/footer/index.d.ts +0 -0
- /package/{src/react → react}/footer-item/index.d.ts +0 -0
- /package/{src/react/input → react/icon}/index.d.ts +0 -0
- /package/{src/react → react}/icon-button/index.d.ts +0 -0
- /package/{src/react/icon-list → react/icon-card}/index.d.ts +0 -0
- /package/{src/react/icon → react/icon-list}/index.d.ts +0 -0
- /package/{src/react/link → react/image-card}/index.d.ts +0 -0
- /package/{src/react/mainnav-dropdown → react/input}/index.d.ts +0 -0
- /package/{src/react/mainnav-item → react/link}/index.d.ts +0 -0
- /package/{src/react/modal → react/mainnav}/index.d.ts +0 -0
- /package/{src/react/mainnav → react/mainnav-dropdown}/index.d.ts +0 -0
- /package/{src/react/masthead → react/mainnav-item}/index.d.ts +0 -0
- /package/{src/react/pagination → react/masthead}/index.d.ts +0 -0
- /package/{src/react/progress-bar → react/modal}/index.d.ts +0 -0
- /package/{src/react/quantity-toggle → react/overflow-menu}/index.d.ts +0 -0
- /package/{src/react/radio-group → react/pagination}/index.d.ts +0 -0
- /package/{src/react/radio → react/progress-bar}/index.d.ts +0 -0
- /package/{src/react/select → react/quantity-toggle}/index.d.ts +0 -0
- /package/{src/react/sidenav-link → react/radio}/index.d.ts +0 -0
- /package/{src/react/sidenav-item → react/radio-group}/index.d.ts +0 -0
- /package/{src/react/sidenav → react/select}/index.d.ts +0 -0
- /package/{src/react/stepper → react/sidenav}/index.d.ts +0 -0
- /package/{src/react/skeleton → react/sidenav-item}/index.d.ts +0 -0
- /package/{src/react/spinner → react/sidenav-link}/index.d.ts +0 -0
- /package/{src/react/subnav-item → react/skeleton}/index.d.ts +0 -0
- /package/{src/react/subnav → react/spinner}/index.d.ts +0 -0
- /package/{src/react/switch → react/stepper}/index.d.ts +0 -0
- /package/{src/react/tab-panel → react/subnav}/index.d.ts +0 -0
- /package/{src/react/tab-group → react/subnav-item}/index.d.ts +0 -0
- /package/{src/react/tab → react/switch}/index.d.ts +0 -0
- /package/{src/react/table-of-contents → react/tab}/index.d.ts +0 -0
- /package/{src/react/table-cell → react/tab-group}/index.d.ts +0 -0
- /package/{src/react/table-head → react/tab-panel}/index.d.ts +0 -0
- /package/{src/react/toast → react/table}/index.d.ts +0 -0
- /package/{src/react/table-row → react/table-cell}/index.d.ts +0 -0
- /package/{src/react/table → react/table-head}/index.d.ts +0 -0
- /package/{src/react/textarea → react/table-of-contents}/index.d.ts +0 -0
- /package/{src/react/toast-container → react/table-row}/index.d.ts +0 -0
- /package/{src/react/tooltip → react/textarea}/index.d.ts +0 -0
- /package/{src/utils → utils}/animate.d.ts +0 -0
- /package/{src/utils → utils}/animation-registry.d.ts +0 -0
- /package/{src/utils → utils}/breakpoints.d.ts +0 -0
- /package/{src/utils → utils}/ce-registry.d.ts +0 -0
- /package/{src/utils → utils}/defaultvalue.d.ts +0 -0
- /package/{src/utils → utils}/event.d.ts +0 -0
- /package/{src/utils → utils}/formSubmitController.d.ts +0 -0
- /package/{src/utils → utils}/generateCustomElementName.d.ts +0 -0
- /package/{src/utils → utils}/generateId.d.ts +0 -0
- /package/{src/utils → utils}/inputValidationController.d.ts +0 -0
- /package/{src/utils → utils}/mergeDeep.d.ts +0 -0
- /package/{src/utils → utils}/modal.d.ts +0 -0
- /package/{src/utils → utils}/object.d.ts +0 -0
- /package/{src/utils → utils}/offset.d.ts +0 -0
- /package/{src/utils → utils}/scroll.d.ts +0 -0
- /package/{src/utils → utils}/slot.d.ts +0 -0
- /package/{src/utils → utils}/tabbable.d.ts +0 -0
- /package/{src/utils → utils}/test.d.ts +0 -0
- /package/{src/utils → utils}/time.d.ts +0 -0
- /package/{src/utils → utils}/validatorMixin.d.ts +0 -0
- /package/{src/utils → utils}/watch.d.ts +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CardOrientation } from "../components/Card/types";
|
|
2
|
+
import SgdsElement from "./sgds-element";
|
|
3
|
+
export declare class CardElement extends SgdsElement {
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
|
+
/** @internal */
|
|
6
|
+
card: HTMLAnchorElement;
|
|
7
|
+
/** Extends the link passed in slot[name="link"] to the entire card */
|
|
8
|
+
stretchedLink: boolean;
|
|
9
|
+
/** Disables the card */
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
/** When true, hides the default border of the card. */
|
|
12
|
+
hideBorder: boolean;
|
|
13
|
+
/** When true, applies a tinted background color to the card. */
|
|
14
|
+
tinted: boolean;
|
|
15
|
+
/** Sets the orientation of the card. Available options: `vertical`, `horizontal` */
|
|
16
|
+
orientation: CardOrientation;
|
|
17
|
+
handleTitleSlotChange(e: Event): void;
|
|
18
|
+
handleLinkSlotChange(e: Event): void;
|
|
19
|
+
}
|
package/base/card-element.js
CHANGED
|
@@ -1,29 +1,70 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
2
|
+
import { query, property } from 'lit/decorators.js';
|
|
3
|
+
import { SgdsLink } from '../components/Link/sgds-link.js';
|
|
4
|
+
import SgdsElement from './sgds-element.js';
|
|
3
5
|
import css_248z$5 from './card.js';
|
|
4
6
|
import css_248z from '../styles/text-variants.js';
|
|
5
7
|
import css_248z$1 from '../styles/bg-variants.js';
|
|
6
8
|
import css_248z$2 from '../styles/border-variants.js';
|
|
7
9
|
import css_248z$3 from '../styles/header-class.js';
|
|
8
10
|
import css_248z$4 from '../styles/paragraph.js';
|
|
9
|
-
import SgdsElement from './sgds-element.js';
|
|
10
11
|
|
|
11
12
|
class CardElement extends SgdsElement {
|
|
12
13
|
constructor() {
|
|
13
14
|
super(...arguments);
|
|
15
|
+
/** Extends the link passed in slot[name="link"] to the entire card */
|
|
16
|
+
this.stretchedLink = false;
|
|
17
|
+
/** Disables the card */
|
|
18
|
+
this.disabled = false;
|
|
14
19
|
/** When true, hides the default border of the card. */
|
|
15
20
|
this.hideBorder = false;
|
|
16
21
|
/** When true, applies a tinted background color to the card. */
|
|
17
22
|
this.tinted = false;
|
|
23
|
+
/** Sets the orientation of the card. Available options: `vertical`, `horizontal` */
|
|
24
|
+
this.orientation = "vertical";
|
|
25
|
+
}
|
|
26
|
+
handleTitleSlotChange(e) {
|
|
27
|
+
const childNodes = e.target.assignedNodes({ flatten: true });
|
|
28
|
+
if (this.stretchedLink && childNodes[0] instanceof HTMLAnchorElement) {
|
|
29
|
+
const hyperlink = childNodes[0].querySelector("a") || childNodes[0];
|
|
30
|
+
hyperlink.removeAttribute("href");
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
handleLinkSlotChange(e) {
|
|
35
|
+
const childNodes = e.target.assignedNodes({ flatten: true });
|
|
36
|
+
if (childNodes.length > 1) {
|
|
37
|
+
return console.error("Multiple elements passed into SgdsCard's link slot");
|
|
38
|
+
}
|
|
39
|
+
if (!this.stretchedLink)
|
|
40
|
+
return;
|
|
41
|
+
if (childNodes[0] instanceof HTMLAnchorElement || childNodes[0] instanceof SgdsLink) {
|
|
42
|
+
const hyperlink = (childNodes[0].querySelector("a") || childNodes[0]);
|
|
43
|
+
this.card.setAttribute("href", hyperlink.href);
|
|
44
|
+
const linkSlot = this.shadowRoot.querySelector("slot[name='link']");
|
|
45
|
+
linkSlot.style.display = "none";
|
|
46
|
+
}
|
|
18
47
|
}
|
|
19
48
|
}
|
|
20
49
|
CardElement.styles = [...SgdsElement.styles, css_248z, css_248z$1, css_248z$2, css_248z$3, css_248z$4, css_248z$5];
|
|
50
|
+
__decorate([
|
|
51
|
+
query("a.card")
|
|
52
|
+
], CardElement.prototype, "card", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
property({ type: Boolean, reflect: true })
|
|
55
|
+
], CardElement.prototype, "stretchedLink", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
property({ type: Boolean, reflect: true })
|
|
58
|
+
], CardElement.prototype, "disabled", void 0);
|
|
21
59
|
__decorate([
|
|
22
60
|
property({ type: Boolean, reflect: true })
|
|
23
61
|
], CardElement.prototype, "hideBorder", void 0);
|
|
24
62
|
__decorate([
|
|
25
63
|
property({ type: Boolean, reflect: true })
|
|
26
64
|
], CardElement.prototype, "tinted", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
property({ type: String, reflect: true })
|
|
67
|
+
], CardElement.prototype, "orientation", void 0);
|
|
27
68
|
|
|
28
69
|
export { CardElement };
|
|
29
70
|
//# sourceMappingURL=card-element.js.map
|
package/base/card-element.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card-element.js","sources":["../../src/base/card-element.ts"],"sourcesContent":["import { property } from \"lit/decorators.js\";\nimport cardStyle from \"./card.css\";\nimport textStyles from \"../styles/text-variants.css\";\nimport bgStyles from \"../styles/bg-variants.css\";\nimport borderStyles from \"../styles/border-variants.css\";\nimport headerStyles from \"../styles/header-class.css\";\nimport paragraphStyles from \"../styles/paragraph.css\";\n\
|
|
1
|
+
{"version":3,"file":"card-element.js","sources":["../../src/base/card-element.ts"],"sourcesContent":["import { property, query } from \"lit/decorators.js\";\nimport { SgdsLink } from \"../components/Link/sgds-link\";\nimport { CardOrientation } from \"../components/Card/types\";\nimport SgdsElement from \"./sgds-element\";\nimport cardStyle from \"./card.css\";\nimport textStyles from \"../styles/text-variants.css\";\nimport bgStyles from \"../styles/bg-variants.css\";\nimport borderStyles from \"../styles/border-variants.css\";\nimport headerStyles from \"../styles/header-class.css\";\nimport paragraphStyles from \"../styles/paragraph.css\";\n\nexport class CardElement extends SgdsElement {\n static styles = [...SgdsElement.styles, textStyles, bgStyles, borderStyles, headerStyles, paragraphStyles, cardStyle];\n\n /** @internal */\n @query(\"a.card\") card: HTMLAnchorElement;\n\n /** Extends the link passed in slot[name=\"link\"] to the entire card */\n @property({ type: Boolean, reflect: true }) stretchedLink = false;\n\n /** Disables the card */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** When true, hides the default border of the card. */\n @property({ type: Boolean, reflect: true }) hideBorder = false;\n\n /** When true, applies a tinted background color to the card. */\n @property({ type: Boolean, reflect: true }) tinted = false;\n\n /** Sets the orientation of the card. Available options: `vertical`, `horizontal` */\n @property({ type: String, reflect: true }) orientation: CardOrientation = \"vertical\";\n\n handleTitleSlotChange(e: Event) {\n const childNodes = (e.target as HTMLSlotElement).assignedNodes({ flatten: true }) as Array<HTMLElement>;\n\n if (this.stretchedLink && childNodes[0] instanceof HTMLAnchorElement) {\n const hyperlink = childNodes[0].querySelector(\"a\") || childNodes[0];\n hyperlink.removeAttribute(\"href\");\n }\n return;\n }\n\n handleLinkSlotChange(e: Event) {\n const childNodes = (e.target as HTMLSlotElement).assignedNodes({ flatten: true }) as\n | Array<HTMLLinkElement>\n | Array<HTMLAnchorElement>\n | Array<SgdsLink>;\n\n if (childNodes.length > 1) {\n return console.error(\"Multiple elements passed into SgdsCard's link slot\");\n }\n\n if (!this.stretchedLink) return;\n\n if (childNodes[0] instanceof HTMLAnchorElement || childNodes[0] instanceof SgdsLink) {\n const hyperlink = (childNodes[0].querySelector(\"a\") || childNodes[0]) as HTMLAnchorElement;\n this.card.setAttribute(\"href\", hyperlink.href);\n const linkSlot = this.shadowRoot.querySelector(\"slot[name='link']\") as HTMLSlotElement;\n linkSlot.style.display = \"none\";\n }\n }\n}\n"],"names":["textStyles","bgStyles","borderStyles","headerStyles","paragraphStyles","cardStyle"],"mappings":";;;;;;;;;;;AAWM,MAAO,WAAY,SAAQ,WAAW,CAAA;AAA5C,IAAA,WAAA,GAAA;;;QAO8C,IAAa,CAAA,aAAA,GAAG,KAAK,CAAC;;QAGtB,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;;QAGjB,IAAU,CAAA,UAAA,GAAG,KAAK,CAAC;;QAGnB,IAAM,CAAA,MAAA,GAAG,KAAK,CAAC;;QAGhB,IAAW,CAAA,WAAA,GAAoB,UAAU,CAAC;KA+BtF;AA7BC,IAAA,qBAAqB,CAAC,CAAQ,EAAA;AAC5B,QAAA,MAAM,UAAU,GAAI,CAAC,CAAC,MAA0B,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAuB,CAAC;QAExG,IAAI,IAAI,CAAC,aAAa,IAAI,UAAU,CAAC,CAAC,CAAC,YAAY,iBAAiB,EAAE;AACpE,YAAA,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,CAAC,C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O,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAuB,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,eAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGtB,UAAA,CAAA;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAkB,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,UAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGjB,UAAA,CAAA;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAoB,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,YAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGnB,UAAA,CAAA;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAgB,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,QAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGhB,UAAA,CAAA;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAA2C,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,aAAA,EAAA,KAAA,CAAA,CAAA;;;;"}
|
package/base/card.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
|
|
3
|
-
var css_248z = css`:host([
|
|
3
|
+
var css_248z = css`:host([disabled]){cursor:not-allowed}:host([orientation=horizontal]) .card{flex-direction:row}:host(:not([hideBorder])) .card{border:var(--sgds-border-width-1) solid var(--sgds-border-color-muted)}:host([orientation=horizontal]) .card-body{flex:1}:host([orientation=horizontal]) .card-media{padding:var(--sgds-padding-xl) var(--sgds-padding-none) var(--sgds-padding-xl) var(--sgds-padding-xl)}:host([orientation=horizontal]) .card-image{width:40%}:host([imagePosition=after]) .card-image{order:1}:host([orientation=vertical][imagePosition=after]) slot[name=image]::slotted(img){border-radius:calc(var(--sgds-border-radius-md) - var(--sgds-border-width-1));border-top-left-radius:var(--sgds-border-radius-none);border-top-right-radius:var(--sgds-border-radius-none)}:host([orientation=horizontal][imagePosition=after]) slot[name=image]::slotted(img){border-radius:calc(var(--sgds-border-radius-md) - var(--sgds-border-width-1));border-bottom-left-radius:var(--sgds-border-radius-none);border-top-left-radius:var(--sgds-border-radius-none)}:host([orientation=horizontal]) slot[name=image]::slotted(img){border-bottom-left-radius:calc(var(--sgds-border-radius-md) - var(--sgds-border-width-1));border-top-right-radius:var(--sgds-border-radius-none);height:100%;object-fit:cover}:host([orientation=vertical][imageAdjustment="padding around"]) .card-image{margin:var(--sgds-margin-sm) var(--sgds-margin-sm) var(--sgds-padding-none)}:host([orientation=vertical][imageAdjustment="padding around"][imagePosition=after]) .card-image{margin:var(--sgds-margin-none) var(--sgds-margin-sm) var(--sgds-margin-sm)}:host([orientation=horizontal][imageAdjustment="padding around"]) .card-image{margin:var(--sgds-margin-sm) var(--sgds-margin-none) var(--sgds-margin-sm) var(--sgds-margin-sm)}:host([orientation=horizontal][imageAdjustment="padding around"][imagePosition=after]) .card-image{margin:var(--sgds-margin-sm) var(--sgds-margin-sm) var(--sgds-margin-sm) var(--sgds-margin-none)}:host([orientation][imageAdjustment="padding around"]) slot[name=image]::slotted(img){border-radius:calc(var(--sgds-border-radius-md) - var(--sgds-border-width-1))}:host([orientation=vertical]:not([imageAdjustment="aspect ratio"])) slot[name=image]::slotted(img){height:auto}:host([orientation=vertical][imageAdjustment="aspect ratio"]) slot[name=image]::slotted(img){object-fit:cover}.card{word-wrap:break-word;background-clip:border-box;background-color:var(--sgds-surface-default);border:var(--sgds-border-width-1) solid var(--sgds-border-color-transparent);border-radius:var(--sgds-border-radius-md);box-shadow:none;display:flex;flex-direction:column;height:100%;min-width:0;position:relative;transition:box-shadow .3s ease}a.card{color:initial;text-decoration:none}@media (prefers-reduced-motion:reduce){.card{transition:none}}.card.disabled{opacity:var(--sgds-opacity-50);pointer-events:none}a.card:focus{outline:0}a.card:not(.disabled):focus-visible{box-shadow:var(--sgds-box-shadow-focus)}.card-tinted-bg{border-radius:var(--sgds-border-radius-md);bottom:0;left:0;opacity:var(--sgds-opacity-0);position:absolute;right:0;top:0}.card-image{flex:1;position:relative}.card-media{align-items:flex-start;display:flex;justify-content:space-between;line-height:0;padding:var(--sgds-padding-xl) var(--sgds-padding-xl) var(--sgds-padding-none)}.card-thumbnail{align-items:center;border:var(--sgds-border-width-1) solid var(--sgds-border-color-muted);border-radius:var(--sgds-border-radius-full);display:flex;height:var(--sgds-dimension-80);justify-content:center;width:var(--sgds-dimension-80)}.card-body{color:var(--sgds-body-color-default);display:flex;flex:1 1 auto;flex-direction:column;gap:var(--sgds-gap-xl);padding:var(--sgds-padding-xl);z-index:1}.card-header-container{display:flex;flex-direction:column;gap:var(--sgds-gap-sm)}.card-header{display:flex;flex-direction:column;gap:var(--sgds-gap-xs)}.card-title{--sgds-font-size-5:var(--sgds-font-size-4);--sgds-font-size-6:var(--sgds-font-size-4);--sgds-margin-2-xs:var(--sgds-margin-none);--sgds-font-weight-bold:var(--sgds-font-weight-semibold);color:var(--sgds-body-color-default);font-size:var(--sgds-font-size-4);font-weight:var(--sgds-font-weight-semibold)}.card-subtitle,.card-text,.card-title{margin-bottom:var(--sgds-margin-none)}slot[name=subtitle]::slotted(*){--sgds-margin-2-xs:var(--sgds-margin-none);--sgds-margin-xs:var(--sgds-margin-none);--sgds-font-size-4:var(--sgds-font-size-1);--sgds-font-size-5:var(--sgds-font-size-1);--sgds-font-size-6:var(--sgds-font-size-1);--sgds-font-weight-bold:var(--sgds-font-weight-semibold);--sgds-line-height-heading:var(--sgds-line-height-min);--sgds-letter-spacing-tight:var(--sgds-letter-spacing-wide);color:var(--sgds-color-default);font-size:var(--sgds-font-size-1);font-weight:var(--sgds-font-weight-semibold);letter-spacing:var(--sgds-letter-spacing-wide);line-height:var(--sgds-line-height-min);margin:var(--sgds-margin-none);text-transform:uppercase}slot[name=title]::slotted(a){--sgds-font-size-2:var(--sgds-font-size-4);--sgds-font-weight-regular:var(--sgds-font-weight-semibold);color:var(--sgds-link-color-default);font-size:var(--sgds-font-size-4);font-weight:var(--sgds-font-weight-semibold);text-decoration:none!important}slot[name=description]::slotted(*){color:var(--sgds-color-subtle)}slot[name=image]::slotted(img){border-top-left-radius:calc(var(--sgds-border-radius-md) - var(--sgds-border-width-1));border-top-right-radius:calc(var(--sgds-border-radius-md) - var(--sgds-border-width-1));display:block;width:100%}slot[name=link]::slotted(*){font-weight:700;margin-top:auto;padding-top:var(--sgds-padding-sm)}slot[name=link]::slotted(a){color:var(--sgds-link-color-default);display:inline-flex;gap:var(--sgds-gap-2-xs);height:auto!important;text-decoration:none!important}slot[name=link]::slotted(a:focus),slot[name=link]::slotted(a:hover),slot[name=title]::slotted(a:focus),slot[name=title]::slotted(a:hover){color:var(--sgds-link-color-emphasis)}slot[name=link]::slotted(a:focus),slot[name=title]::slotted(a:focus){outline:0}slot[name=link]::slotted(a:focus-visible),slot[name=title]::slotted(a:focus-visible){box-shadow:var(--sgds-box-shadow-focus)}`;
|
|
4
4
|
|
|
5
5
|
export { css_248z as default };
|
|
6
6
|
//# sourceMappingURL=card.js.map
|
|
@@ -4,6 +4,7 @@ import type { Dropdown as BsDropdown } from "bootstrap";
|
|
|
4
4
|
import { Ref } from "lit/directives/ref.js";
|
|
5
5
|
import SgdsElement from "./sgds-element";
|
|
6
6
|
export type DropDirection = "left" | "right" | "up" | "down";
|
|
7
|
+
type DropdownModifier = StrictModifiers | Popper.Modifier<string, object>;
|
|
7
8
|
/**
|
|
8
9
|
* @event sgds-show - Emitted event when show instance is called
|
|
9
10
|
* @event sgds-after-show - Emitted event when dropdown has been made visible to the user and CSS transitions have completed
|
|
@@ -28,7 +29,7 @@ export declare class DropdownElement extends SgdsElement {
|
|
|
28
29
|
/** @internal */
|
|
29
30
|
dropdownConfig: Partial<Popper.Options>;
|
|
30
31
|
/** @internal */
|
|
31
|
-
protected modifierOpt:
|
|
32
|
+
protected modifierOpt: DropdownModifier[];
|
|
32
33
|
/** When true, dropdown menu shows on first load */
|
|
33
34
|
menuIsOpen: boolean;
|
|
34
35
|
/** Controls the close behaviour of dropdown menu. By default menu auto-closes when SgdsDropdownItem or area outside dropdown is clicked */
|
|
@@ -46,3 +47,4 @@ export declare class DropdownElement extends SgdsElement {
|
|
|
46
47
|
protected _handleKeyboardMenuEvent(e: KeyboardEvent): void;
|
|
47
48
|
private _handleClickOutOfElement;
|
|
48
49
|
}
|
|
50
|
+
export {};
|
package/base/dropdown-element.js
CHANGED
|
@@ -60,6 +60,7 @@ class DropdownElement extends SgdsElement {
|
|
|
60
60
|
//working
|
|
61
61
|
this.dropdownConfig = {
|
|
62
62
|
placement: "bottom-start",
|
|
63
|
+
strategy: "fixed",
|
|
63
64
|
modifiers: !this.noFlip
|
|
64
65
|
? this.modifierOpt
|
|
65
66
|
: [
|
|
@@ -157,7 +158,7 @@ __decorate([
|
|
|
157
158
|
state()
|
|
158
159
|
], DropdownElement.prototype, "dropdownConfig", void 0);
|
|
159
160
|
__decorate([
|
|
160
|
-
property()
|
|
161
|
+
property({ type: Array })
|
|
161
162
|
], DropdownElement.prototype, "modifierOpt", void 0);
|
|
162
163
|
__decorate([
|
|
163
164
|
property({ type: Boolean, reflect: true })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-element.js","sources":["../../src/base/dropdown-element.ts"],"sourcesContent":["import type { StrictModifiers } from \"@popperjs/core\";\nimport * as Popper from \"@popperjs/core\";\nimport Dropdown from \"bootstrap/js/src/dropdown\";\nimport type { Dropdown as BsDropdown } from \"bootstrap\";\nimport { property, state } from \"lit/decorators.js\";\nimport { Ref, createRef } from \"lit/directives/ref.js\";\nimport mergeDeep from \"../utils/mergeDeep\";\nimport SgdsElement from \"./sgds-element\";\nimport generateId from \"../utils/generateId\";\n\nconst ARROW_DOWN = \"ArrowDown\";\nconst ARROW_UP = \"ArrowUp\";\nconst ESC = \"Escape\";\n\nexport type DropDirection = \"left\" | \"right\" | \"up\" | \"down\";\n\n/**\n * @event sgds-show - Emitted event when show instance is called\n * @event sgds-after-show - Emitted event when dropdown has been made visible to the user and CSS transitions have completed\n * @event sgds-hide - Emitted event when hide instance is called\n * @event sgds-after-hide - Emitted event when dropdown has hidden to the user and CSS transitions have completed\n */\n\nexport class DropdownElement extends SgdsElement {\n // static styles = SgdsElement.styles;\n\n /** @internal */\n protected myDropdown: Ref<HTMLElement> = createRef();\n /** @internal */\n protected bsDropdown: BsDropdown = null;\n\n /** @internal Unique id generated for the dropdown menu */\n protected dropdownMenuId: string = generateId(\"dropdown-menu\", \"div\");\n\n /** @internal Controls auto-flipping of menu */\n @property({ type: Boolean, state: true })\n protected noFlip = false;\n\n /** @internal When true, aligns right edge of menu with right edge of button */\n @property({ type: Boolean, reflect: true, state: true })\n protected menuAlignRight = false;\n\n /** @internal The drop position of menu relative to the toggle button */\n @property({ type: String, reflect: true, state: true })\n protected drop: DropDirection = \"down\";\n\n /** Additional configuration to pass to Popper.js. See https://popper.js.org/ for config opts */\n @property({ type: Object })\n popperOpts = {};\n\n /** @internal */\n @state()\n dropdownConfig: Partial<Popper.Options>;\n /** @internal */\n @property()\n protected modifierOpt: StrictModifiers[] = [];\n\n /** When true, dropdown menu shows on first load */\n @property({ type: Boolean, reflect: true })\n menuIsOpen = false;\n\n /** Controls the close behaviour of dropdown menu. By default menu auto-closes when SgdsDropdownItem or area outside dropdown is clicked */\n protected close: \"outside\" | \"default\" | \"inside\" = \"default\";\n\n /** Disables the dropdown toggle */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n connectedCallback() {\n super.connectedCallback();\n\n if (this.close !== \"inside\") {\n document.addEventListener(\"click\", (event: MouseEvent) => this._handleClickOutOfElement(event, this));\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n document.removeEventListener(\"click\", (event: MouseEvent) => this._handleClickOutOfElement(event, this));\n }\n\n firstUpdated() {\n this.bsDropdown = new Dropdown(this.myDropdown.value, {\n // autoClose not working as bootstrap is using attribute data-bs-toggle=\"dropdown\" to configure autoclose. But it doesnt look into this attribute in the shadow dom\n reference: \"toggle\", // working\n popperConfig: (defaultConfig?: Partial<Popper.Options>) => {\n //working\n this.dropdownConfig = {\n placement: \"bottom-start\",\n modifiers: !this.noFlip\n ? this.modifierOpt\n : [\n ...this.modifierOpt,\n {\n name: \"flip\",\n options: { fallbackPlacements: [] }\n }\n ]\n };\n\n switch (this.drop) {\n case \"up\":\n this.dropdownConfig.placement = this.menuAlignRight ? \"top-end\" : \"top-start\";\n break;\n case \"right\":\n this.dropdownConfig.placement = \"right-start\";\n break;\n case \"left\":\n this.dropdownConfig.placement = \"left-start\";\n break;\n case \"down\":\n this.dropdownConfig.placement = this.menuAlignRight ? \"bottom-end\" : \"bottom-start\";\n break;\n default:\n this.dropdownConfig.placement = undefined;\n break;\n }\n return mergeDeep(defaultConfig, mergeDeep(this.dropdownConfig, this.popperOpts));\n }\n });\n\n this.myDropdown.value.addEventListener(\"show.bs.dropdown\", () => {\n this.menuIsOpen = true;\n this.emit(\"sgds-show\");\n });\n\n this.myDropdown.value.addEventListener(\"shown.bs.dropdown\", () => {\n this.menuIsOpen = true;\n this.emit(\"sgds-after-show\");\n });\n\n this.myDropdown.value.addEventListener(\"hide.bs.dropdown\", () => {\n this.menuIsOpen = false;\n this.emit(\"sgds-hide\");\n });\n\n this.myDropdown.value.addEventListener(\"hidden.bs.dropdown\", () => {\n this.menuIsOpen = false;\n this.emit(\"sgds-after-hide\");\n });\n\n this.addEventListener(\"keydown\", this._handleKeyboardMenuEvent);\n }\n\n /** When invoked, opens the dropdown menu */\n public showMenu() {\n this.bsDropdown.show();\n }\n\n /** When invoked, hides the dropdown menu */\n public hideMenu() {\n this.bsDropdown.hide();\n }\n\n toggleMenu() {\n this.bsDropdown.toggle();\n }\n\n protected _handleKeyboardMenuEvent(e: KeyboardEvent) {\n switch (e.key) {\n case ARROW_DOWN:\n e.preventDefault();\n if (!this.menuIsOpen) return this.showMenu();\n break;\n case ARROW_UP:\n e.preventDefault();\n if (!this.menuIsOpen) return this.showMenu();\n break;\n case ESC:\n return this.hideMenu();\n default:\n break;\n }\n }\n\n private _handleClickOutOfElement(e: MouseEvent, self: DropdownElement) {\n if (!e.composedPath().includes(self)) {\n this.hideMenu();\n }\n }\n}\n"],"names":["generateId"],"mappings":";;;;;;;;AAUA,MAAM,UAAU,GAAG,WAAW,CAAC;AAC/B,MAAM,QAAQ,GAAG,SAAS,CAAC;AAC3B,MAAM,GAAG,GAAG,QAAQ,CAAC;AAIrB;;;;;AAKG;AAEG,MAAO,eAAgB,SAAQ,WAAW,CAAA;AAAhD,IAAA,WAAA,GAAA;;;;QAIY,IAAU,CAAA,UAAA,GAAqB,SAAS,EAAE,CAAC;;QAE3C,IAAU,CAAA,UAAA,GAAe,IAAI,CAAC;;AAG9B,QAAA,IAAA,CAAA,cAAc,GAAWA,KAAU,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;;QAI5D,IAAM,CAAA,MAAA,GAAG,KAAK,CAAC;;QAIf,IAAc,CAAA,cAAA,GAAG,KAAK,CAAC;;QAIvB,IAAI,CAAA,IAAA,GAAkB,MAAM,CAAC;;QAIvC,IAAU,CAAA,UAAA,GAAG,EAAE,CAAC;;QAON,IAAW,CAAA,WAAA,GAAsB,EAAE,CAAC;;QAI9C,IAAU,CAAA,UAAA,GAAG,KAAK,CAAC;;QAGT,IAAK,CAAA,KAAA,GAAqC,SAAS,CAAC;;QAI9D,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;KAkHlB;IAhHC,iBAAiB,GAAA;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAC;AAE1B,QAAA,IAAI,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE;AAC3B,YAAA,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,KAAiB,KAAK,IAAI,CAAC,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A,CAAA;AADT,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAChB,CAAA,EAAA,eAAA,CAAA,SAAA,EAAA,MAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAIvC,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACX,CAAA,EAAA,eAAA,CAAA,SAAA,EAAA,YAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAIhB,UAAA,CAAA;AADC,IAAA,KAAK,EAAE;AACgC,CAAA,EAAA,eAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAG9B,UAAA,CAAA;AADT,IAAA,QAAQ,EAAE;AACmC,CAAA,EAAA,eAAA,CAAA,SAAA,EAAA,aAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAI9C,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACxB,CAAA,EAAA,eAAA,CAAA,SAAA,EAAA,YAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAOnB,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC1B,CAAA,EAAA,eAAA,CAAA,SAAA,EAAA,UAAA,EAAA,KAAA,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"dropdown-element.js","sources":["../../src/base/dropdown-element.ts"],"sourcesContent":["import type { StrictModifiers } from \"@popperjs/core\";\nimport * as Popper from \"@popperjs/core\";\nimport Dropdown from \"bootstrap/js/src/dropdown\";\nimport type { Dropdown as BsDropdown } from \"bootstrap\";\nimport { property, state } from \"lit/decorators.js\";\nimport { Ref, createRef } from \"lit/directives/ref.js\";\nimport mergeDeep from \"../utils/mergeDeep\";\nimport SgdsElement from \"./sgds-element\";\nimport generateId from \"../utils/generateId\";\n\nconst ARROW_DOWN = \"ArrowDown\";\nconst ARROW_UP = \"ArrowUp\";\nconst ESC = \"Escape\";\n\nexport type DropDirection = \"left\" | \"right\" | \"up\" | \"down\";\ntype DropdownModifier = StrictModifiers | Popper.Modifier<string, object>;\n\n/**\n * @event sgds-show - Emitted event when show instance is called\n * @event sgds-after-show - Emitted event when dropdown has been made visible to the user and CSS transitions have completed\n * @event sgds-hide - Emitted event when hide instance is called\n * @event sgds-after-hide - Emitted event when dropdown has hidden to the user and CSS transitions have completed\n */\n\nexport class DropdownElement extends SgdsElement {\n // static styles = SgdsElement.styles;\n\n /** @internal */\n protected myDropdown: Ref<HTMLElement> = createRef();\n /** @internal */\n protected bsDropdown: BsDropdown = null;\n\n /** @internal Unique id generated for the dropdown menu */\n protected dropdownMenuId: string = generateId(\"dropdown-menu\", \"div\");\n\n /** @internal Controls auto-flipping of menu */\n @property({ type: Boolean, state: true })\n protected noFlip = false;\n\n /** @internal When true, aligns right edge of menu with right edge of button */\n @property({ type: Boolean, reflect: true, state: true })\n protected menuAlignRight = false;\n\n /** @internal The drop position of menu relative to the toggle button */\n @property({ type: String, reflect: true, state: true })\n protected drop: DropDirection = \"down\";\n\n /** Additional configuration to pass to Popper.js. See https://popper.js.org/ for config opts */\n @property({ type: Object })\n popperOpts = {};\n\n /** @internal */\n @state()\n dropdownConfig: Partial<Popper.Options>;\n /** @internal */\n @property({ type: Array })\n protected modifierOpt: DropdownModifier[] = [];\n\n /** When true, dropdown menu shows on first load */\n @property({ type: Boolean, reflect: true })\n menuIsOpen = false;\n\n /** Controls the close behaviour of dropdown menu. By default menu auto-closes when SgdsDropdownItem or area outside dropdown is clicked */\n protected close: \"outside\" | \"default\" | \"inside\" = \"default\";\n\n /** Disables the dropdown toggle */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n connectedCallback() {\n super.connectedCallback();\n\n if (this.close !== \"inside\") {\n document.addEventListener(\"click\", (event: MouseEvent) => this._handleClickOutOfElement(event, this));\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n document.removeEventListener(\"click\", (event: MouseEvent) => this._handleClickOutOfElement(event, this));\n }\n\n firstUpdated() {\n this.bsDropdown = new Dropdown(this.myDropdown.value, {\n // autoClose not working as bootstrap is using attribute data-bs-toggle=\"dropdown\" to configure autoclose. But it doesnt look into this attribute in the shadow dom\n reference: \"toggle\", // working\n popperConfig: (defaultConfig?: Partial<Popper.Options>) => {\n //working\n this.dropdownConfig = {\n placement: \"bottom-start\",\n strategy: \"fixed\",\n modifiers: !this.noFlip\n ? this.modifierOpt\n : [\n ...this.modifierOpt,\n {\n name: \"flip\",\n options: { fallbackPlacements: [] }\n }\n ]\n };\n\n switch (this.drop) {\n case \"up\":\n this.dropdownConfig.placement = this.menuAlignRight ? \"top-end\" : \"top-start\";\n break;\n case \"right\":\n this.dropdownConfig.placement = \"right-start\";\n break;\n case \"left\":\n this.dropdownConfig.placement = \"left-start\";\n break;\n case \"down\":\n this.dropdownConfig.placement = this.menuAlignRight ? \"bottom-end\" : \"bottom-start\";\n break;\n default:\n this.dropdownConfig.placement = undefined;\n break;\n }\n return mergeDeep(defaultConfig, mergeDeep(this.dropdownConfig, this.popperOpts));\n }\n });\n\n this.myDropdown.value.addEventListener(\"show.bs.dropdown\", () => {\n this.menuIsOpen = true;\n this.emit(\"sgds-show\");\n });\n\n this.myDropdown.value.addEventListener(\"shown.bs.dropdown\", () => {\n this.menuIsOpen = true;\n this.emit(\"sgds-after-show\");\n });\n\n this.myDropdown.value.addEventListener(\"hide.bs.dropdown\", () => {\n this.menuIsOpen = false;\n this.emit(\"sgds-hide\");\n });\n\n this.myDropdown.value.addEventListener(\"hidden.bs.dropdown\", () => {\n this.menuIsOpen = false;\n this.emit(\"sgds-after-hide\");\n });\n\n this.addEventListener(\"keydown\", this._handleKeyboardMenuEvent);\n }\n\n /** When invoked, opens the dropdown menu */\n public showMenu() {\n this.bsDropdown.show();\n }\n\n /** When invoked, hides the dropdown menu */\n public hideMenu() {\n this.bsDropdown.hide();\n }\n\n toggleMenu() {\n this.bsDropdown.toggle();\n }\n\n protected _handleKeyboardMenuEvent(e: KeyboardEvent) {\n switch (e.key) {\n case ARROW_DOWN:\n e.preventDefault();\n if (!this.menuIsOpen) return this.showMenu();\n break;\n case ARROW_UP:\n e.preventDefault();\n if (!this.menuIsOpen) return this.showMenu();\n break;\n case ESC:\n return this.hideMenu();\n default:\n break;\n }\n }\n\n private _handleClickOutOfElement(e: MouseEvent, self: DropdownElement) {\n if (!e.composedPath().includes(self)) {\n this.hideMenu();\n }\n }\n}\n"],"names":["generateId"],"mappings":";;;;;;;;AAUA,MAAM,UAAU,GAAG,WAAW,CAAC;AAC/B,MAAM,QAAQ,GAAG,SAAS,CAAC;AAC3B,MAAM,GAAG,GAAG,QAAQ,CAAC;AAKrB;;;;;AAKG;AAEG,MAAO,eAAgB,SAAQ,WAAW,CAAA;AAAhD,IAAA,WAAA,GAAA;;;;QAIY,IAAU,CAAA,UAAA,GAAqB,SAAS,EAAE,CAAC;;QAE3C,IAAU,CAAA,UAAA,GAAe,IAAI,CAAC;;AAG9B,QAAA,IAAA,CAAA,cAAc,GAAWA,KAAU,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;;QAI5D,IAAM,CAAA,MAAA,GAAG,KAAK,CAAC;;QAIf,IAAc,CAAA,cAAA,GAAG,KAAK,CAAC;;QAIvB,IAAI,CAAA,IAAA,GAAkB,MAAM,CAAC;;QAIvC,IAAU,CAAA,UAAA,GAAG,EAAE,CAAC;;QAON,IAAW,CAAA,WAAA,GAAuB,EAAE,CAAC;;QAI/C,IAAU,CAAA,UAAA,GAAG,KAAK,CAAC;;QAGT,IAAK,CAAA,KAAA,GAAqC,SAAS,CAAC;;QAI9D,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;KAmHlB;IAjHC,iBAAiB,GAAA;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAC;AAE1B,Q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
|
import genId from '../utils/generateId.js';
|
|
10
10
|
import { SgdsFormValidatorMixin } from '../utils/validatorMixin.js';
|
|
11
11
|
import { DropdownListElement } from './dropdown-list-element.js';
|
|
12
|
+
import { referenceTargetWidth } from '../utils/popper.js';
|
|
12
13
|
|
|
13
14
|
class SelectElement extends SgdsFormValidatorMixin(DropdownListElement) {
|
|
14
15
|
constructor() {
|
|
@@ -61,7 +62,8 @@ class SelectElement extends SgdsFormValidatorMixin(DropdownListElement) {
|
|
|
61
62
|
options: {
|
|
62
63
|
offset: [0, 8]
|
|
63
64
|
}
|
|
64
|
-
}
|
|
65
|
+
},
|
|
66
|
+
referenceTargetWidth
|
|
65
67
|
];
|
|
66
68
|
}
|
|
67
69
|
connectedCallback() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-element.js","sources":["../../src/base/select-element.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { property, queryAsync, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport dropdownMenuStyle from \"../components/Dropdown/dropdown-menu.css\";\nimport feedbackStyles from \"../styles/feedback.css\";\nimport hintTextStyles from \"../styles/form-hint.css\";\nimport { defaultValue } from \"../utils/defaultvalue\";\nimport { SgdsFormControl } from \"../utils/formSubmitController\";\nimport generateId from \"../utils/generateId\";\nimport { SgdsFormValidatorMixin } from \"../utils/validatorMixin\";\nimport { DropdownListElement } from \"./dropdown-list-element\";\n\nexport class SelectElement extends SgdsFormValidatorMixin(DropdownListElement) implements SgdsFormControl {\n static styles = [...DropdownListElement.styles, dropdownMenuStyle, hintTextStyles, feedbackStyles];\n\n /** The input's label */\n @property({ reflect: true }) label = \"\";\n\n /** The input's hint text below the label */\n @property({ reflect: true }) hintText = \"\";\n\n /** The input's name attribute */\n @property({ reflect: true }) name: string;\n\n /** The input's placeholder text. */\n @property({ type: String, reflect: true }) placeholder: string;\n\n /** Autofocus the input */\n @property({ type: Boolean, reflect: true }) autofocus = false;\n\n /** Disables the input. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Makes the input a required field. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n /** Makes the input readonly. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n /**\n * IMPORTANT:\n * We still expose `.value` externally, but this is now the underlying ID or data\n * (e.g. 1, 2, 'abc', ...), not the label that appears in the input box.\n */\n @property({ type: String, reflect: true })\n value = \"\";\n\n @state()\n protected displayValue = \"\";\n\n /** @internal Gets or sets the default value used to reset this element. */\n @defaultValue()\n defaultValue = \"\";\n\n /** Allows invalidFeedback, invalid and valid styles to be visible with the input */\n @property({ type: Boolean, reflect: true }) hasFeedback = false;\n\n /** Feedback text for error state when validated */\n @property({ type: String, reflect: true }) invalidFeedback = \"\";\n\n /** Marks the component as invalid. Replace the pseudo :invalid selector. */\n @property({ type: Boolean, reflect: true }) invalid = false;\n\n /** The list of items to display in the dropdown.\n * `interface SgdsComboBoxItemData {\n * label: string;\n * value: string;\n * }`\n */\n @property({ type: Array }) menuList: SgdsSelectItemData[] = [];\n /** Track selected items (even for single-select, but it will have at most one). */\n @state()\n protected selectedItems: SgdsSelectItemData[] = [];\n /** @internal Managed filtered menu on the fly with input change*/\n @state()\n protected filteredMenuList: SgdsSelectItemData[] = [];\n\n protected _isTouched = false;\n\n constructor() {\n super();\n /** @internal */\n this.modifierOpt = [\n {\n name: \"offset\",\n options: {\n offset: [0, 8]\n }\n }\n ];\n }\n\n @queryAsync(\"input.form-control\") protected _input: Promise<HTMLInputElement>;\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener(\"blur\", async () => {\n this.invalid = !this._mixinReportValidity();\n });\n if (this.readonly) {\n this._handleKeyboardMenuEvent = null;\n this._handleKeyboardMenuItemsEvent = null;\n }\n }\n\n /**\n * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state\n * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput\n */\n public reportValidity(): boolean {\n return this._mixinReportValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public checkValidity(): boolean {\n return this._mixinCheckValidity();\n }\n /**\n * Returns the ValidityState object\n */\n public get validity(): ValidityState {\n return this._mixinGetValidity();\n }\n /**\n * Returns the validation message based on the ValidityState\n */\n public get validationMessage(): string {\n return this._mixinGetValidationMessage();\n }\n protected _controlId = generateId(\"input\");\n protected _renderFeedback() {\n return this.invalid && this.hasFeedback\n ? html` <div class=\"invalid-feedback-container\">\n <slot name=\"invalidIcon\">\n <sgds-icon name=\"exclamation-circle-fill\" size=\"md\"></sgds-icon>\n </slot>\n <div id=\"${this._controlId}-invalid\" class=\"invalid-feedback\">\n ${this.invalidFeedback ? this.invalidFeedback : this.validationMessage}\n </div>\n </div>`\n : html`${this._renderHintText()}`;\n }\n\n protected _renderHintText() {\n const hintTextTemplate = html` <div id=\"${this._controlId}Help\" class=\"form-text\">${this.hintText}</div> `;\n return this.hintText && hintTextTemplate;\n }\n protected _labelId = generateId(\"label\");\n protected _renderLabel() {\n const labelTemplate = html`\n <label\n for=${this._controlId}\n id=${this._labelId}\n class=${classMap({\n \"form-label\": true,\n required: this.required\n })}\n >${this.label}</label\n >\n `;\n return this.label && labelTemplate;\n }\n\n protected _handleClick() {\n if (this.readonly) {\n return null;\n }\n if (!this.menuIsOpen) {\n this.showMenu();\n } else {\n this.hideMenu();\n }\n }\n}\n\nexport interface SgdsSelectItemData {\n label: string;\n value: string;\n}\n"],"names":["generateId","dropdownMenuStyle","hintTextStyles","feedbackStyles"],"mappings":";;;;;;;;;;;;MAYa,aAAc,SAAQ,sBAAsB,CAAC,mBAAmB,CAAC,CAAA;AAkE5E,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE,CAAC;;QA/DmB,IAAK,CAAA,KAAA,GAAG,EAAE,CAAC;;QAGX,IAAQ,CAAA,QAAA,GAAG,EAAE,CAAC;;QASC,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;;QAGlB,IAAQ,CAAA,QAAA,G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A;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAsB,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,iBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGpB,UAAA,CAAA;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAiB,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,SAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAQjC,UAAA,CAAA;AAA1B,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAAqC,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,UAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGrD,UAAA,CAAA;AADT,IAAA,KAAK,EAAE;AAC2C,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,eAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGzC,UAAA,CAAA;AADT,IAAA,KAAK,EAAE;AAC8C,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,kBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAiBV,UAAA,CAAA;IAA3C,UAAU,CAAC,oBAAoB,CAAC;AAA6C,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,QAAA,EAAA,KAAA,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"select-element.js","sources":["../../src/base/select-element.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { property, queryAsync, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport dropdownMenuStyle from \"../components/Dropdown/dropdown-menu.css\";\nimport feedbackStyles from \"../styles/feedback.css\";\nimport hintTextStyles from \"../styles/form-hint.css\";\nimport { defaultValue } from \"../utils/defaultvalue\";\nimport { SgdsFormControl } from \"../utils/formSubmitController\";\nimport generateId from \"../utils/generateId\";\nimport { SgdsFormValidatorMixin } from \"../utils/validatorMixin\";\nimport { DropdownListElement } from \"./dropdown-list-element\";\nimport { referenceTargetWidth } from \"../utils/popper\";\n\nexport class SelectElement extends SgdsFormValidatorMixin(DropdownListElement) implements SgdsFormControl {\n static styles = [...DropdownListElement.styles, dropdownMenuStyle, hintTextStyles, feedbackStyles];\n\n /** The input's label */\n @property({ reflect: true }) label = \"\";\n\n /** The input's hint text below the label */\n @property({ reflect: true }) hintText = \"\";\n\n /** The input's name attribute */\n @property({ reflect: true }) name: string;\n\n /** The input's placeholder text. */\n @property({ type: String, reflect: true }) placeholder: string;\n\n /** Autofocus the input */\n @property({ type: Boolean, reflect: true }) autofocus = false;\n\n /** Disables the input. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Makes the input a required field. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n /** Makes the input readonly. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n /**\n * IMPORTANT:\n * We still expose `.value` externally, but this is now the underlying ID or data\n * (e.g. 1, 2, 'abc', ...), not the label that appears in the input box.\n */\n @property({ type: String, reflect: true })\n value = \"\";\n\n @state()\n protected displayValue = \"\";\n\n /** @internal Gets or sets the default value used to reset this element. */\n @defaultValue()\n defaultValue = \"\";\n\n /** Allows invalidFeedback, invalid and valid styles to be visible with the input */\n @property({ type: Boolean, reflect: true }) hasFeedback = false;\n\n /** Feedback text for error state when validated */\n @property({ type: String, reflect: true }) invalidFeedback = \"\";\n\n /** Marks the component as invalid. Replace the pseudo :invalid selector. */\n @property({ type: Boolean, reflect: true }) invalid = false;\n\n /** The list of items to display in the dropdown.\n * `interface SgdsComboBoxItemData {\n * label: string;\n * value: string;\n * }`\n */\n @property({ type: Array }) menuList: SgdsSelectItemData[] = [];\n /** Track selected items (even for single-select, but it will have at most one). */\n @state()\n protected selectedItems: SgdsSelectItemData[] = [];\n /** @internal Managed filtered menu on the fly with input change*/\n @state()\n protected filteredMenuList: SgdsSelectItemData[] = [];\n\n protected _isTouched = false;\n\n constructor() {\n super();\n /** @internal */\n this.modifierOpt = [\n {\n name: \"offset\",\n options: {\n offset: [0, 8]\n }\n },\n referenceTargetWidth\n ];\n }\n\n @queryAsync(\"input.form-control\") protected _input: Promise<HTMLInputElement>;\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener(\"blur\", async () => {\n this.invalid = !this._mixinReportValidity();\n });\n if (this.readonly) {\n this._handleKeyboardMenuEvent = null;\n this._handleKeyboardMenuItemsEvent = null;\n }\n }\n\n /**\n * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state\n * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput\n */\n public reportValidity(): boolean {\n return this._mixinReportValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public checkValidity(): boolean {\n return this._mixinCheckValidity();\n }\n /**\n * Returns the ValidityState object\n */\n public get validity(): ValidityState {\n return this._mixinGetValidity();\n }\n /**\n * Returns the validation message based on the ValidityState\n */\n public get validationMessage(): string {\n return this._mixinGetValidationMessage();\n }\n protected _controlId = generateId(\"input\");\n protected _renderFeedback() {\n return this.invalid && this.hasFeedback\n ? html` <div class=\"invalid-feedback-container\">\n <slot name=\"invalidIcon\">\n <sgds-icon name=\"exclamation-circle-fill\" size=\"md\"></sgds-icon>\n </slot>\n <div id=\"${this._controlId}-invalid\" class=\"invalid-feedback\">\n ${this.invalidFeedback ? this.invalidFeedback : this.validationMessage}\n </div>\n </div>`\n : html`${this._renderHintText()}`;\n }\n\n protected _renderHintText() {\n const hintTextTemplate = html` <div id=\"${this._controlId}Help\" class=\"form-text\">${this.hintText}</div> `;\n return this.hintText && hintTextTemplate;\n }\n protected _labelId = generateId(\"label\");\n protected _renderLabel() {\n const labelTemplate = html`\n <label\n for=${this._controlId}\n id=${this._labelId}\n class=${classMap({\n \"form-label\": true,\n required: this.required\n })}\n >${this.label}</label\n >\n `;\n return this.label && labelTemplate;\n }\n\n protected _handleClick() {\n if (this.readonly) {\n return null;\n }\n if (!this.menuIsOpen) {\n this.showMenu();\n } else {\n this.hideMenu();\n }\n }\n}\n\nexport interface SgdsSelectItemData {\n label: string;\n value: string;\n}\n"],"names":["generateId","dropdownMenuStyle","hintTextStyles","feedbackStyles"],"mappings":";;;;;;;;;;;;;MAaa,aAAc,SAAQ,sBAAsB,CAAC,mBAAmB,CAAC,CAAA;AAkE5E,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE,CAAC;;QA/DmB,IAAK,CAAA,KAAA,GAAG,EAAE,CAAC;;QAGX,IAAQ,CAAA,QAAA,GAAG,EAAE,CAAC;;QASC,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;;QAGlB,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;;QAGjB,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;;QAGjB,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;AAC7D;;;;AAIG;QAEH,IAAK,CAAA,KAAA,GAAG,EAAE,CAAC;QAGD,IAAY,CAAA,YAAA,GAAG,EAAE,CAAC;;QAI5B,IAAY,CAAA,YAAA,GAAG,EAAE,CAAC;;QAG0B,IAAW,CAAA,WAAA,GAAG,KAAK,CAAC;;QAGrB,IAAe,CAAA,eAAA,GAAG,EAAE,CAAC;;QAGpB,IAAO,CAAA,OAAA,GAAG,KAAK,CAAC;AAE5D;;;;;AAKG;QACwB,IAAQ,CAAA,QAAA,GAAyB,EAAE,CAAC;;QAGrD,IAAa,CAAA,aAAA,GAAyB,EAAE,CAAC;;QAGzC,IAAgB,CAAA,gBAAA,GAAyB,EAAE,CAAC;QAE5C,IAAU,CAAA,UAAA,GAAG,KAAK,CAAC;AAsDnB,QAAA,IAAA,CAAA,UAAU,GAAGA,KAAU,CAAC,OAAO,CAAC,CAAC;AAkBjC,QAAA,IAAA,CAAA,QAAQ,GAAGA,KAAU,CAAC,OAAO,CAAC,CAAC;;QAnEvC,IAAI,CAAC,WAAW,GAAG;AACjB,YAAA;AACE,gBAAA,IA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,UAAU,CAAC,oBAAoB,CAAC;AAA6C,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,QAAA,EAAA,KAAA,CAAA,CAAA;;;;"}
|
|
@@ -8173,6 +8173,7 @@
|
|
|
8173
8173
|
//working
|
|
8174
8174
|
this.dropdownConfig = {
|
|
8175
8175
|
placement: "bottom-start",
|
|
8176
|
+
strategy: "fixed",
|
|
8176
8177
|
modifiers: !this.noFlip
|
|
8177
8178
|
? this.modifierOpt
|
|
8178
8179
|
: [
|
|
@@ -8270,7 +8271,7 @@
|
|
|
8270
8271
|
state()
|
|
8271
8272
|
], DropdownElement.prototype, "dropdownConfig", void 0);
|
|
8272
8273
|
__decorate([
|
|
8273
|
-
property()
|
|
8274
|
+
property({ type: Array })
|
|
8274
8275
|
], DropdownElement.prototype, "modifierOpt", void 0);
|
|
8275
8276
|
__decorate([
|
|
8276
8277
|
property({ type: Boolean, reflect: true })
|
|
@@ -8463,7 +8464,7 @@
|
|
|
8463
8464
|
|
|
8464
8465
|
var css_248z$6 = css`.dropdown-menu{background-clip:padding-box;background-color:var(--sgds-surface-default);border-radius:var(--sgds-border-radius-md);box-shadow:0 0 1px 0 hsla(0,0%,5%,.12),0 4px 8px 0 hsla(0,0%,5%,.12);color:var(--sgds-color-default);display:none;list-style:none;margin:0;max-height:var(--sgds-dimension-480);min-width:var(--sgds-dimension-280);overflow-y:auto;padding:var(--sgds-padding-xs) 0;position:absolute;text-align:left;z-index:1000}.dropdown-menu.show{display:block}.nav-tabs .dropdown-menu{border-top-left-radius:0;border-top-right-radius:0;margin-top:calc(var(--sgds-nav-tabs-border-width)*-1)}@media (min-width:576px){.navbar-expand-sm .navbar-nav .dropdown-menu{position:absolute}}@media (min-width:768px){.navbar-expand-md .navbar-nav .dropdown-menu{position:absolute}}@media (min-width:992px){.navbar-expand-lg .navbar-nav .dropdown-menu{position:absolute}}@media (min-width:1200px){.navbar-expand-xl .navbar-nav .dropdown-menu{position:absolute}}@media (min-width:1400px){.navbar-expand-xxl .navbar-nav .dropdown-menu{position:absolute}}.navbar-expand .navbar-nav .dropdown-menu{position:absolute}.sgds.navbar .dropdown-menu.megamenu{left:0;right:0;width:100%}.sgds.combobox>.dropdown-menu{min-width:100%}`;
|
|
8465
8466
|
|
|
8466
|
-
var css_248z$5 = css
|
|
8467
|
+
var css_248z$5 = css`.dropdown{display:flex;height:inherit;position:relative}`;
|
|
8467
8468
|
|
|
8468
8469
|
/**
|
|
8469
8470
|
* @summary `SgdsDropdown` toggles contextual overlays for displaying lists of links.
|