@govtechsg/sgds-web-component 3.0.0-rc.1 → 3.0.0-rc.2
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 +5 -5
- package/base/button.js +1 -1
- package/base/form-control-element.d.ts +4 -11
- package/base/form-control-element.js +13 -23
- package/base/form-control-element.js.map +1 -1
- package/components/Accordion/accordion-item.js +1 -1
- package/components/Accordion/index.umd.js +7 -19
- package/components/Accordion/index.umd.js.map +1 -1
- package/components/Accordion/sgds-accordion-item.d.ts +3 -7
- package/components/Accordion/sgds-accordion-item.js +6 -18
- package/components/Accordion/sgds-accordion-item.js.map +1 -1
- package/components/ActionCard/index.umd.js +407 -329
- package/components/ActionCard/index.umd.js.map +1 -1
- package/components/Alert/alert.js +1 -1
- package/components/Alert/index.umd.js +553 -485
- package/components/Alert/index.umd.js.map +1 -1
- package/components/Alert/sgds-alert.d.ts +2 -2
- package/components/Alert/sgds-alert.js +6 -13
- package/components/Alert/sgds-alert.js.map +1 -1
- package/components/Badge/badge.js +1 -1
- package/components/Badge/index.umd.js +8 -9
- package/components/Badge/index.umd.js.map +1 -1
- package/components/Badge/sgds-badge.d.ts +4 -5
- package/components/Badge/sgds-badge.js +5 -6
- package/components/Badge/sgds-badge.js.map +1 -1
- package/components/Button/index.umd.js +8 -81
- package/components/Button/index.umd.js.map +1 -1
- package/components/Button/sgds-button.js +1 -1
- package/components/Button/sgds-button.js.map +1 -1
- package/components/Checkbox/checkbox.js +1 -1
- package/components/Checkbox/index.umd.js +541 -475
- package/components/Checkbox/index.umd.js.map +1 -1
- package/components/Checkbox/sgds-checkbox-group.d.ts +7 -1
- package/components/Checkbox/sgds-checkbox-group.js +15 -4
- package/components/Checkbox/sgds-checkbox-group.js.map +1 -1
- package/components/Checkbox/sgds-checkbox.d.ts +30 -21
- package/components/Checkbox/sgds-checkbox.js +77 -60
- package/components/Checkbox/sgds-checkbox.js.map +1 -1
- package/components/ComboBox/index.umd.js +385 -216
- package/components/ComboBox/index.umd.js.map +1 -1
- package/components/Datepicker/datepicker-input.d.ts +4 -2
- package/components/Datepicker/datepicker-input.js +24 -7
- package/components/Datepicker/datepicker-input.js.map +1 -1
- package/components/Datepicker/index.umd.js +433 -244
- package/components/Datepicker/index.umd.js.map +1 -1
- package/components/Datepicker/sgds-datepicker.d.ts +1 -1
- package/components/Datepicker/sgds-datepicker.js.map +1 -1
- package/components/Drawer/index.umd.js +2 -2
- package/components/Drawer/index.umd.js.map +1 -1
- package/components/Dropdown/index.umd.js +8 -81
- package/components/Dropdown/index.umd.js.map +1 -1
- package/components/FileUpload/file-upload.js +1 -1
- package/components/FileUpload/index.umd.js +579 -272
- package/components/FileUpload/index.umd.js.map +1 -1
- package/components/FileUpload/sgds-file-upload.d.ts +42 -30
- package/components/FileUpload/sgds-file-upload.js +147 -103
- package/components/FileUpload/sgds-file-upload.js.map +1 -1
- package/components/Footer/footer-item.js +6 -0
- package/components/Footer/footer-item.js.map +1 -0
- package/components/Footer/footer.js +1 -1
- package/components/Footer/index.d.ts +2 -0
- package/components/Footer/index.js +2 -0
- package/components/Footer/index.js.map +1 -1
- package/components/Footer/index.umd.js +93 -94
- package/components/Footer/index.umd.js.map +1 -1
- package/components/Footer/sgds-footer-item.d.ts +13 -0
- package/components/Footer/sgds-footer-item.js +27 -0
- package/components/Footer/sgds-footer-item.js.map +1 -0
- package/components/Footer/sgds-footer.d.ts +9 -30
- package/components/Footer/sgds-footer.js +65 -90
- package/components/Footer/sgds-footer.js.map +1 -1
- package/components/Icon/icon.js +6 -0
- package/components/Icon/icon.js.map +1 -0
- package/components/Icon/index.d.ts +6 -0
- package/components/Icon/index.js +4 -0
- package/components/Icon/index.js.map +1 -0
- package/components/Icon/index.umd.js +4389 -0
- package/components/Icon/index.umd.js.map +1 -0
- package/components/Icon/sgds-icon.d.ts +21 -0
- package/components/Icon/sgds-icon.js +64 -0
- package/components/Icon/sgds-icon.js.map +1 -0
- package/components/IconButton/icon-button.js +1 -1
- package/components/IconButton/index.umd.js +6 -9
- package/components/IconButton/index.umd.js.map +1 -1
- package/components/IconButton/sgds-icon-button.d.ts +2 -2
- package/components/IconButton/sgds-icon-button.js +4 -9
- package/components/IconButton/sgds-icon-button.js.map +1 -1
- package/components/Input/index.umd.js +1734 -1376
- package/components/Input/index.umd.js.map +1 -1
- package/components/Input/sgds-input.d.ts +41 -21
- package/components/Input/sgds-input.js +103 -66
- package/components/Input/sgds-input.js.map +1 -1
- package/components/Modal/index.umd.js +2 -2
- package/components/Modal/index.umd.js.map +1 -1
- package/components/QuantityToggle/index.umd.js +894 -316
- package/components/QuantityToggle/index.umd.js.map +1 -1
- package/components/QuantityToggle/sgds-quantity-toggle.d.ts +42 -15
- package/components/QuantityToggle/sgds-quantity-toggle.js +129 -62
- package/components/QuantityToggle/sgds-quantity-toggle.js.map +1 -1
- package/components/Radio/index.umd.js +516 -203
- package/components/Radio/index.umd.js.map +1 -1
- package/components/Radio/sgds-radio-group.d.ts +38 -27
- package/components/Radio/sgds-radio-group.js +100 -84
- package/components/Radio/sgds-radio-group.js.map +1 -1
- package/components/Radio/sgds-radio.js +1 -1
- package/components/Radio/sgds-radio.js.map +1 -1
- package/components/Stepper/index.umd.js +1 -0
- package/components/Stepper/index.umd.js.map +1 -1
- package/components/Stepper/sgds-stepper.d.ts +1 -0
- package/components/Stepper/sgds-stepper.js +1 -0
- package/components/Stepper/sgds-stepper.js.map +1 -1
- package/components/Switch/index.umd.js +21 -321
- package/components/Switch/index.umd.js.map +1 -1
- package/components/Switch/sgds-switch.js +1 -2
- package/components/Switch/sgds-switch.js.map +1 -1
- package/components/Textarea/index.umd.js +1554 -1336
- package/components/Textarea/index.umd.js.map +1 -1
- package/components/Textarea/sgds-textarea.d.ts +33 -22
- package/components/Textarea/sgds-textarea.js +78 -75
- package/components/Textarea/sgds-textarea.js.map +1 -1
- package/components/Textarea/textarea.js +1 -1
- package/components/Toast/index.umd.js +9 -21
- package/components/Toast/index.umd.js.map +1 -1
- package/components/Toast/sgds-toast.d.ts +2 -1
- package/components/Toast/sgds-toast.js +6 -18
- package/components/Toast/sgds-toast.js.map +1 -1
- package/components/Toast/toast.js +1 -1
- package/components/Tooltip/index.umd.js +14 -14
- package/components/Tooltip/index.umd.js.map +1 -1
- package/components/Tooltip/sgds-tooltip.d.ts +4 -7
- package/components/Tooltip/sgds-tooltip.js +14 -14
- package/components/Tooltip/sgds-tooltip.js.map +1 -1
- package/components/index.d.ts +1 -0
- package/components/index.js +1 -0
- package/components/index.js.map +1 -1
- package/components/index.umd.js +1318 -1124
- package/components/index.umd.js.map +1 -1
- package/icons/arrow-bar-down.svg +3 -0
- package/icons/arrow-bar-left.svg +3 -0
- package/icons/arrow-bar-right.svg +3 -0
- package/icons/arrow-bar-up.svg +3 -0
- package/icons/arrow-clockwise.svg +3 -0
- package/icons/arrow-down.svg +3 -0
- package/icons/arrow-left.svg +3 -0
- package/icons/arrow-repeat.svg +3 -0
- package/icons/arrow-right.svg +3 -0
- package/icons/arrow-up.svg +3 -0
- package/icons/bank-fill.svg +3 -0
- package/icons/bell-slash.svg +3 -0
- package/icons/bell.svg +3 -0
- package/icons/bi-funnel.svg +3 -0
- package/icons/bookmark-fill.svg +3 -0
- package/icons/bookmark.svg +3 -0
- package/icons/box-arrow-up-right.svg +3 -0
- package/icons/box-seam.svg +3 -0
- package/icons/building.svg +3 -0
- package/icons/calculator.svg +3 -0
- package/icons/calendar-check.svg +4 -0
- package/icons/calendar-x.svg +4 -0
- package/icons/calendar.svg +3 -0
- package/icons/camera.svg +3 -0
- package/icons/chat-left-text.svg +3 -0
- package/icons/check-circle-fill.svg +3 -0
- package/icons/check-circle.svg +3 -0
- package/icons/check.svg +3 -0
- package/icons/chevron-down.svg +3 -0
- package/icons/chevron-left.svg +3 -0
- package/icons/chevron-right.svg +3 -0
- package/icons/chevron-up .svg +3 -0
- package/icons/clock.svg +4 -0
- package/icons/cloud-check.svg +4 -0
- package/icons/cloud-download.svg +3 -0
- package/icons/cloud-upload.svg +3 -0
- package/icons/cloud.svg +3 -0
- package/icons/compass.svg +4 -0
- package/icons/cross.svg +3 -0
- package/icons/cursor-fill.svg +3 -0
- package/icons/cursor.svg +3 -0
- package/icons/dash-circle.svg +3 -0
- package/icons/dash-square.svg +3 -0
- package/icons/dash.svg +3 -0
- package/icons/download.svg +3 -0
- package/icons/exclamation-circle-fill.svg +3 -0
- package/icons/exclamation-circle.svg +4 -0
- package/icons/exclamation-triangle-fill.svg +3 -0
- package/icons/exclamation-triangle.svg +4 -0
- package/icons/exclamation.svg +4 -0
- package/icons/eye-fill.svg +3 -0
- package/icons/eye-slash-fill.svg +4 -0
- package/icons/eye-slash.svg +3 -0
- package/icons/eye.svg +3 -0
- package/icons/facebook.svg +3 -0
- package/icons/file-earmark-text.svg +3 -0
- package/icons/file-pdf.svg +4 -0
- package/icons/file-plus.svg +4 -0
- package/icons/file-text.svg +3 -0
- package/icons/file.svg +3 -0
- package/icons/files.svg +4 -0
- package/icons/folder-check.svg +4 -0
- package/icons/folder-minus.svg +4 -0
- package/icons/folder-plus.svg +4 -0
- package/icons/folder.svg +3 -0
- package/icons/gear.svg +3 -0
- package/icons/geo-alt.svg +4 -0
- package/icons/geo-fill.svg +4 -0
- package/icons/geo.svg +4 -0
- package/icons/google.svg +3 -0
- package/icons/grid-fill.svg +3 -0
- package/icons/hand-thumbs-down.svg +3 -0
- package/icons/hand-thumbs-up.svg +3 -0
- package/icons/hdd.svg +3 -0
- package/icons/house-door.svg +3 -0
- package/icons/house.svg +3 -0
- package/icons/image.svg +3 -0
- package/icons/inbox.svg +3 -0
- package/icons/info-circle-fill.svg +3 -0
- package/icons/info-circle.svg +4 -0
- package/icons/instagram.svg +3 -0
- package/icons/layers.svg +3 -0
- package/icons/layout-text-window-reverse.svg +3 -0
- package/icons/layout-text-window.svg +3 -0
- package/icons/layout.svg +3 -0
- package/icons/link.svg +3 -0
- package/icons/linkedin.svg +3 -0
- package/icons/list.svg +3 -0
- package/icons/lock-fill.svg +3 -0
- package/icons/lock.svg +3 -0
- package/icons/mail.svg +3 -0
- package/icons/map.svg +3 -0
- package/icons/paperclip.svg +3 -0
- package/icons/pencil.svg +3 -0
- package/icons/pending-circle.svg +3 -0
- package/icons/person-dash.svg +3 -0
- package/icons/person-plus.svg +3 -0
- package/icons/person-x.svg +3 -0
- package/icons/person.svg +3 -0
- package/icons/pin-map-fill.svg +3 -0
- package/icons/pin.svg +3 -0
- package/icons/placeholder.svg +3 -0
- package/icons/plus-circle.svg +3 -0
- package/icons/plus-square.svg +3 -0
- package/icons/plus.svg +3 -0
- package/icons/printer.svg +3 -0
- package/icons/question-circle.svg +4 -0
- package/icons/save.svg +3 -0
- package/icons/search.svg +3 -0
- package/icons/share.svg +3 -0
- package/icons/slash-circle.svg +3 -0
- package/icons/sliders.svg +3 -0
- package/icons/speedometer.svg +3 -0
- package/icons/star-fill.svg +3 -0
- package/icons/star.svg +3 -0
- package/icons/stoplights.svg +4 -0
- package/icons/telephone.svg +3 -0
- package/icons/three-dots-vertical.svg +3 -0
- package/icons/three-dots.svg +3 -0
- package/icons/toggle-off.svg +3 -0
- package/icons/toggle-on.svg +3 -0
- package/icons/trash.svg +3 -0
- package/icons/twitter-x.svg +3 -0
- package/icons/unlock.svg +3 -0
- package/icons/upload.svg +3 -0
- package/icons/window-dash.svg +4 -0
- package/icons/window-desktop.svg +4 -0
- package/icons/window-dock.svg +4 -0
- package/icons/window-fullscreen.svg +3 -0
- package/icons/window-plus.svg +4 -0
- package/icons/window-sidebar.svg +3 -0
- package/icons/window-split.svg +3 -0
- package/icons/window-stack.svg +3 -0
- package/icons/window-x.svg +4 -0
- package/icons/window.svg +3 -0
- package/icons/x-circle-fill.svg +3 -0
- package/icons/x-circle.svg +3 -0
- package/icons/youtube.svg +3 -0
- package/icons/zoom-in.svg +3 -0
- package/icons/zoom-out.svg +3 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/index.umd.js +1338 -1119
- package/index.umd.js.map +1 -1
- package/internals/CloseButton/close-button.js +1 -1
- package/internals/CloseButton/sgds-close-button.js +1 -1
- package/internals/CloseButton/sgds-close-button.js.map +1 -1
- package/package.json +1 -1
- package/react/base/button.cjs.js +1 -1
- package/react/base/button.js +1 -1
- package/react/base/form-control-element.cjs.js +13 -23
- package/react/base/form-control-element.cjs.js.map +1 -1
- package/react/base/form-control-element.js +13 -23
- package/react/base/form-control-element.js.map +1 -1
- package/react/checkbox/index.cjs.js +2 -0
- package/react/checkbox/index.cjs.js.map +1 -1
- package/react/checkbox/index.d.ts +2 -0
- package/react/checkbox/index.js +2 -0
- package/react/checkbox/index.js.map +1 -1
- package/react/components/Accordion/accordion-item.cjs.js +1 -1
- package/react/components/Accordion/accordion-item.js +1 -1
- package/react/components/Accordion/sgds-accordion-item.cjs.js +6 -18
- package/react/components/Accordion/sgds-accordion-item.cjs.js.map +1 -1
- package/react/components/Accordion/sgds-accordion-item.js +6 -18
- package/react/components/Accordion/sgds-accordion-item.js.map +1 -1
- package/react/components/Alert/alert.cjs.js +1 -1
- package/react/components/Alert/alert.js +1 -1
- package/react/components/Alert/sgds-alert.cjs.js +5 -12
- package/react/components/Alert/sgds-alert.cjs.js.map +1 -1
- package/react/components/Alert/sgds-alert.js +6 -13
- package/react/components/Alert/sgds-alert.js.map +1 -1
- package/react/components/Badge/badge.cjs.js +1 -1
- package/react/components/Badge/badge.js +1 -1
- package/react/components/Badge/sgds-badge.cjs.js +5 -6
- package/react/components/Badge/sgds-badge.cjs.js.map +1 -1
- package/react/components/Badge/sgds-badge.js +5 -6
- package/react/components/Badge/sgds-badge.js.map +1 -1
- package/react/components/Button/sgds-button.cjs.js +2 -2
- package/react/components/Button/sgds-button.cjs.js.map +1 -1
- package/react/components/Button/sgds-button.js +1 -1
- package/react/components/Button/sgds-button.js.map +1 -1
- package/react/components/Checkbox/checkbox.cjs.js +1 -1
- package/react/components/Checkbox/checkbox.js +1 -1
- package/react/components/Checkbox/sgds-checkbox-group.cjs.js +15 -4
- package/react/components/Checkbox/sgds-checkbox-group.cjs.js.map +1 -1
- package/react/components/Checkbox/sgds-checkbox-group.js +15 -4
- package/react/components/Checkbox/sgds-checkbox-group.js.map +1 -1
- package/react/components/Checkbox/sgds-checkbox.cjs.js +77 -60
- package/react/components/Checkbox/sgds-checkbox.cjs.js.map +1 -1
- package/react/components/Checkbox/sgds-checkbox.js +77 -60
- package/react/components/Checkbox/sgds-checkbox.js.map +1 -1
- package/react/components/Datepicker/datepicker-input.cjs.js +24 -7
- package/react/components/Datepicker/datepicker-input.cjs.js.map +1 -1
- package/react/components/Datepicker/datepicker-input.js +24 -7
- package/react/components/Datepicker/datepicker-input.js.map +1 -1
- package/react/components/Datepicker/sgds-datepicker.cjs.js.map +1 -1
- package/react/components/Datepicker/sgds-datepicker.js.map +1 -1
- package/react/components/FileUpload/file-upload.cjs.js +1 -1
- package/react/components/FileUpload/file-upload.js +1 -1
- package/react/components/FileUpload/sgds-file-upload.cjs.js +145 -101
- package/react/components/FileUpload/sgds-file-upload.cjs.js.map +1 -1
- package/react/components/FileUpload/sgds-file-upload.js +147 -103
- package/react/components/FileUpload/sgds-file-upload.js.map +1 -1
- package/react/components/Footer/footer-item.cjs.js +11 -0
- package/react/components/Footer/footer-item.cjs.js.map +1 -0
- package/react/components/Footer/footer-item.js +7 -0
- package/react/components/Footer/footer-item.js.map +1 -0
- package/react/components/Footer/footer.cjs.js +1 -1
- package/react/components/Footer/footer.js +1 -1
- package/react/components/Footer/sgds-footer-item.cjs.js +33 -0
- package/react/components/Footer/sgds-footer-item.cjs.js.map +1 -0
- package/react/components/Footer/sgds-footer-item.js +28 -0
- package/react/components/Footer/sgds-footer-item.js.map +1 -0
- package/react/components/Footer/sgds-footer.cjs.js +65 -90
- package/react/components/Footer/sgds-footer.cjs.js.map +1 -1
- package/react/components/Footer/sgds-footer.js +65 -90
- package/react/components/Footer/sgds-footer.js.map +1 -1
- package/react/components/Icon/icon.cjs.js +11 -0
- package/react/components/Icon/icon.cjs.js.map +1 -0
- package/react/components/Icon/icon.js +7 -0
- package/react/components/Icon/icon.js.map +1 -0
- package/react/components/Icon/sgds-icon.cjs.js +70 -0
- package/react/components/Icon/sgds-icon.cjs.js.map +1 -0
- package/react/components/Icon/sgds-icon.js +65 -0
- package/react/components/Icon/sgds-icon.js.map +1 -0
- package/react/components/IconButton/icon-button.cjs.js +1 -1
- package/react/components/IconButton/icon-button.js +1 -1
- package/react/components/IconButton/sgds-icon-button.cjs.js +4 -9
- package/react/components/IconButton/sgds-icon-button.cjs.js.map +1 -1
- package/react/components/IconButton/sgds-icon-button.js +4 -9
- package/react/components/IconButton/sgds-icon-button.js.map +1 -1
- package/react/components/Input/sgds-input.cjs.js +101 -64
- package/react/components/Input/sgds-input.cjs.js.map +1 -1
- package/react/components/Input/sgds-input.js +103 -66
- package/react/components/Input/sgds-input.js.map +1 -1
- package/react/components/QuantityToggle/sgds-quantity-toggle.cjs.js +128 -61
- package/react/components/QuantityToggle/sgds-quantity-toggle.cjs.js.map +1 -1
- package/react/components/QuantityToggle/sgds-quantity-toggle.js +129 -62
- package/react/components/QuantityToggle/sgds-quantity-toggle.js.map +1 -1
- package/react/components/Radio/sgds-radio-group.cjs.js +99 -83
- package/react/components/Radio/sgds-radio-group.cjs.js.map +1 -1
- package/react/components/Radio/sgds-radio-group.js +100 -84
- package/react/components/Radio/sgds-radio-group.js.map +1 -1
- package/react/components/Radio/sgds-radio.cjs.js +1 -1
- package/react/components/Radio/sgds-radio.cjs.js.map +1 -1
- package/react/components/Radio/sgds-radio.js +1 -1
- package/react/components/Radio/sgds-radio.js.map +1 -1
- package/react/components/Stepper/sgds-stepper.cjs.js +1 -0
- package/react/components/Stepper/sgds-stepper.cjs.js.map +1 -1
- package/react/components/Stepper/sgds-stepper.js +1 -0
- package/react/components/Stepper/sgds-stepper.js.map +1 -1
- package/react/components/Switch/sgds-switch.cjs.js +1 -2
- package/react/components/Switch/sgds-switch.cjs.js.map +1 -1
- package/react/components/Switch/sgds-switch.js +1 -2
- package/react/components/Switch/sgds-switch.js.map +1 -1
- package/react/components/Textarea/sgds-textarea.cjs.js +76 -73
- package/react/components/Textarea/sgds-textarea.cjs.js.map +1 -1
- package/react/components/Textarea/sgds-textarea.js +78 -75
- package/react/components/Textarea/sgds-textarea.js.map +1 -1
- package/react/components/Textarea/textarea.cjs.js +1 -1
- package/react/components/Textarea/textarea.js +1 -1
- package/react/components/Toast/sgds-toast.cjs.js +6 -18
- package/react/components/Toast/sgds-toast.cjs.js.map +1 -1
- package/react/components/Toast/sgds-toast.js +6 -18
- package/react/components/Toast/sgds-toast.js.map +1 -1
- package/react/components/Toast/toast.cjs.js +1 -1
- package/react/components/Toast/toast.js +1 -1
- package/react/components/Tooltip/sgds-tooltip.cjs.js +14 -14
- package/react/components/Tooltip/sgds-tooltip.cjs.js.map +1 -1
- package/react/components/Tooltip/sgds-tooltip.js +14 -14
- package/react/components/Tooltip/sgds-tooltip.js.map +1 -1
- package/react/footer-item/index.cjs.js +39 -0
- package/react/footer-item/index.cjs.js.map +1 -0
- package/react/footer-item/index.d.ts +3 -0
- package/react/footer-item/index.js +15 -0
- package/react/footer-item/index.js.map +1 -0
- package/react/icon/index.cjs.js +42 -0
- package/react/icon/index.cjs.js.map +1 -0
- package/react/icon/index.d.ts +6 -0
- package/react/icon/index.js +18 -0
- package/react/icon/index.js.map +1 -0
- package/react/index.cjs.js +64 -60
- package/react/index.cjs.js.map +1 -1
- package/react/index.d.ts +2 -0
- package/react/index.js +2 -0
- package/react/index.js.map +1 -1
- package/react/input/index.cjs.js +3 -1
- package/react/input/index.cjs.js.map +1 -1
- package/react/input/index.d.ts +2 -0
- package/react/input/index.js +3 -1
- package/react/input/index.js.map +1 -1
- package/react/internals/CloseButton/close-button.cjs.js +1 -1
- package/react/internals/CloseButton/close-button.js +1 -1
- package/react/internals/CloseButton/sgds-close-button.cjs.js +1 -1
- package/react/internals/CloseButton/sgds-close-button.cjs.js.map +1 -1
- package/react/internals/CloseButton/sgds-close-button.js +1 -1
- package/react/internals/CloseButton/sgds-close-button.js.map +1 -1
- package/react/styles/form-hint.cjs.js +1 -1
- package/react/styles/form-hint.js +1 -1
- package/react/styles/form-label.cjs.js +1 -1
- package/react/styles/form-label.js +1 -1
- package/react/utils/formSubmitController.cjs.js +64 -0
- package/react/utils/formSubmitController.cjs.js.map +1 -0
- package/react/utils/formSubmitController.js +60 -0
- package/react/utils/formSubmitController.js.map +1 -0
- package/react/utils/inputValidationController.cjs.js +130 -0
- package/react/utils/inputValidationController.cjs.js.map +1 -0
- package/react/utils/inputValidationController.js +126 -0
- package/react/utils/inputValidationController.js.map +1 -0
- package/react/utils/validatorMixin.cjs.js +108 -0
- package/react/utils/validatorMixin.cjs.js.map +1 -0
- package/react/utils/validatorMixin.js +104 -0
- package/react/utils/validatorMixin.js.map +1 -0
- package/styles/form-hint.js +1 -1
- package/styles/form-label.js +1 -1
- package/themes/day.css +1 -1
- package/themes/night.css +3 -2
- package/themes/root.css +1 -0
- package/utils/{form.d.ts → formSubmitController.d.ts} +10 -20
- package/utils/formSubmitController.js +59 -0
- package/utils/formSubmitController.js.map +1 -0
- package/utils/inputValidationController.d.ts +70 -0
- package/utils/inputValidationController.js +125 -0
- package/utils/inputValidationController.js.map +1 -0
- package/utils/validatorMixin.d.ts +24 -0
- package/utils/validatorMixin.js +103 -0
- package/utils/validatorMixin.js.map +1 -0
- package/base/form-check-element.d.ts +0 -50
- package/base/form-check-element.js +0 -169
- package/base/form-check-element.js.map +0 -1
- package/react/base/form-check-element.cjs.js +0 -175
- package/react/base/form-check-element.cjs.js.map +0 -1
- package/react/base/form-check-element.js +0 -170
- package/react/base/form-check-element.js.map +0 -1
- package/react/utils/form.cjs.js +0 -137
- package/react/utils/form.cjs.js.map +0 -1
- package/react/utils/form.js +0 -133
- package/react/utils/form.js.map +0 -1
- package/utils/form.js +0 -132
- package/utils/form.js.map +0 -1
package/index.umd.js
CHANGED
|
@@ -4514,7 +4514,7 @@
|
|
|
4514
4514
|
*/
|
|
4515
4515
|
const classMap = directive(ClassMapDirective);
|
|
4516
4516
|
|
|
4517
|
-
var css_248z$
|
|
4517
|
+
var css_248z$14 = css`:host{-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0,0,0,0);color:var(--sgds-body-color);font-family:var(--sgds-font-family-brand);font-size:var(--sgds-font-size-2);font-weight:var(--sgds-font-weight-regular);line-height:var(--sgds-line-height-heading);margin:0;*,:after,:before{box-sizing:border-box}:disabled{cursor:not-allowed}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}::slotted(a[target=_blank]):after{background-color:currentColor;content:"/";display:inline-block;margin:0 .125rem;-webkit-mask-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-up-right"><path fill-rule="evenodd" d="M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z"/><path fill-rule="evenodd" d="M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z"/></svg>');mask-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-up-right"><path fill-rule="evenodd" d="M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z"/><path fill-rule="evenodd" d="M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z"/></svg>');-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;mask-size:73%;-webkit-mask-size:73%;padding:0 .45em}::slotted(a){color:var(--sgds-link);text-decoration:var(--sgds-link-decoration)}::slotted(a:hover){color:var(--sgds-link-hover-color)}::slotted(svg){vertical-align:middle}}`;
|
|
4518
4518
|
|
|
4519
4519
|
/**
|
|
4520
4520
|
* @cssprop --sgds-{stateColor} - State colors in hexadecimal value
|
|
@@ -4532,9 +4532,9 @@
|
|
|
4532
4532
|
return event;
|
|
4533
4533
|
}
|
|
4534
4534
|
}
|
|
4535
|
-
SgdsElement.styles = [css_248z$
|
|
4535
|
+
SgdsElement.styles = [css_248z$14];
|
|
4536
4536
|
|
|
4537
|
-
var css_248z$
|
|
4537
|
+
var css_248z$13 = css`:host([variant=border]) .accordion{border:var(--sgds-border-width-1) solid var(--sgds-default-border-color-muted);border-radius:var(--sgds-border-radius-md)}`;
|
|
4538
4538
|
|
|
4539
4539
|
const VALID_KEYS = ["Enter", "ArrowUp", "ArrowLeft", "ArrowDown", "ArrowRight"];
|
|
4540
4540
|
/**
|
|
@@ -4610,7 +4610,7 @@
|
|
|
4610
4610
|
`;
|
|
4611
4611
|
}
|
|
4612
4612
|
}
|
|
4613
|
-
SgdsAccordion.styles = [...SgdsElement.styles, css_248z$
|
|
4613
|
+
SgdsAccordion.styles = [...SgdsElement.styles, css_248z$13];
|
|
4614
4614
|
__decorate([
|
|
4615
4615
|
property({ type: Boolean, reflect: true })
|
|
4616
4616
|
], SgdsAccordion.prototype, "allowMultiple", void 0);
|
|
@@ -4753,7 +4753,7 @@
|
|
|
4753
4753
|
};
|
|
4754
4754
|
}
|
|
4755
4755
|
|
|
4756
|
-
var css_248z$
|
|
4756
|
+
var css_248z$12 = css`:host([variant=border][last-of-type]) .accordion-item{border-bottom:none}:host([density=compact]) .accordion-btn{font-size:var(--sgds-font-size-2);line-height:var(--sgds-line-height-heading);padding:var(--sgds-padding-sm) var(--sgds-padding-sm)}:host([density=compact]) .content{padding:var(--sgds-padding-xs) var(--sgds-padding-sm) var(--sgds-padding-sm)}:host([density=compact]) slot[name=caret] svg,:host([density=compact]) slot[name=caret]::slotted(*){height:var(--sgds-icon-size-md);width:var(--sgds-icon-size-md)}.accordion-item{border-bottom:var(--sgds-border-width-1) solid var(--sgds-default-border-color-muted)}.accordion-btn{align-items:center;background-color:var(--sgds-default-bg-transparent);border:0;color:var(--sgds-default-color);display:flex;font-size:var(--sgds-font-size-3);gap:var(--sgds-gap-sm);line-height:var(--sgds-line-height-body);overflow-anchor:none;padding:var(--sgds-padding-lg) var(--sgds-padding-lg);text-align:left;width:100%}@media (prefers-reduced-motion:reduce){.accordion-btn,.accordion-btn:after{transition:none}}.accordion-btn:not(.collapsed){font-weight:var(--sgds-font-weight-semibold)}.accordion-btn:hover{background-color:var(--sgds-default-bg-translucent);z-index:2}.accordion-btn:focus,.accordion-btn:focus-visible{background-color:var(--sgds-default-bg-translucent);box-shadow:var(--sgds-box-shadow-focus);outline:0;z-index:3}.accordion-btn.disabled,.accordion-btn:disabled{cursor:not-allowed;opacity:var(--sgds-opacity-50)}slot[name=caret] svg,slot[name=caret]::slotted(*){color:var(--sgds-default-color-subtle);height:var(--sgds-icon-size-lg);margin-left:auto;transition:transform .2s ease-in-out;width:var(--sgds-icon-size-lg)}.accordion-btn:not(.collapsed) slot[name=caret] svg,.accordion-btn:not(.collapsed) slot[name=caret]::slotted(*){transform:rotate(-180deg)}.accordion-body{overflow:hidden;padding:0}.content{display:block;padding:var(--sgds-padding-xs) var(--sgds-padding-lg) var(--sgds-padding-lg)}.hidden{display:none}`;
|
|
4757
4757
|
|
|
4758
4758
|
/**
|
|
4759
4759
|
*
|
|
@@ -4762,13 +4762,9 @@
|
|
|
4762
4762
|
* @event sgds-hide - Emitted on hide.
|
|
4763
4763
|
* @event sgds-after-hide - Emitted on hide after animation has completed.
|
|
4764
4764
|
*
|
|
4765
|
-
* @
|
|
4766
|
-
* @
|
|
4767
|
-
* @
|
|
4768
|
-
*
|
|
4769
|
-
* @slot accordion-header - The accordion-item button header slot.
|
|
4770
|
-
* @slot accordion-content - The accordion-item content slot.
|
|
4771
|
-
* @slot accordion-caret - The caret icon of accordion-item.
|
|
4765
|
+
* @slot header - The accordion-item button header slot.
|
|
4766
|
+
* @slot content - The accordion-item content slot.
|
|
4767
|
+
* @slot caret - The caret icon of accordion-item.
|
|
4772
4768
|
*
|
|
4773
4769
|
*/
|
|
4774
4770
|
class SgdsAccordionItem extends SgdsElement {
|
|
@@ -4863,7 +4859,6 @@
|
|
|
4863
4859
|
render() {
|
|
4864
4860
|
return html$1 `
|
|
4865
4861
|
<div
|
|
4866
|
-
part="base"
|
|
4867
4862
|
class=${classMap({
|
|
4868
4863
|
"accordion-item": true
|
|
4869
4864
|
})}
|
|
@@ -4875,7 +4870,6 @@
|
|
|
4875
4870
|
collapsed: !this.open
|
|
4876
4871
|
})}
|
|
4877
4872
|
?disabled=${this.disabled}
|
|
4878
|
-
part="header"
|
|
4879
4873
|
role="button"
|
|
4880
4874
|
aria-expanded=${this.open ? "true" : "false"}
|
|
4881
4875
|
aria-disabled=${this.disabled ? "true" : "false"}
|
|
@@ -4884,8 +4878,8 @@
|
|
|
4884
4878
|
@click=${this.handleSummaryClick}
|
|
4885
4879
|
@keydown=${this.handleSummaryKeyDown}
|
|
4886
4880
|
>
|
|
4887
|
-
<slot name="
|
|
4888
|
-
<slot name="
|
|
4881
|
+
<slot name="header"></slot>
|
|
4882
|
+
<slot name="caret">
|
|
4889
4883
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
4890
4884
|
<path
|
|
4891
4885
|
fill-rule="evenodd"
|
|
@@ -4897,19 +4891,13 @@
|
|
|
4897
4891
|
</slot>
|
|
4898
4892
|
</button>
|
|
4899
4893
|
<div class="accordion-body">
|
|
4900
|
-
<slot
|
|
4901
|
-
id="content"
|
|
4902
|
-
name="accordion-content"
|
|
4903
|
-
class="accordion-content"
|
|
4904
|
-
role="region"
|
|
4905
|
-
aria-labelledby="header"
|
|
4906
|
-
></slot>
|
|
4894
|
+
<slot id="content" name="content" class="content" role="region" aria-labelledby="header"></slot>
|
|
4907
4895
|
</div>
|
|
4908
4896
|
</div>
|
|
4909
4897
|
`;
|
|
4910
4898
|
}
|
|
4911
4899
|
}
|
|
4912
|
-
SgdsAccordionItem.styles = [...SgdsElement.styles, css_248z$
|
|
4900
|
+
SgdsAccordionItem.styles = [...SgdsElement.styles, css_248z$12];
|
|
4913
4901
|
__decorate([
|
|
4914
4902
|
query(".accordion-item")
|
|
4915
4903
|
], SgdsAccordionItem.prototype, "accordion", void 0);
|
|
@@ -5793,21 +5781,21 @@
|
|
|
5793
5781
|
*/
|
|
5794
5782
|
const html = withStatic(html$1);
|
|
5795
5783
|
|
|
5796
|
-
var css_248z
|
|
5784
|
+
var css_248z$11 = css`.card{word-wrap:break-word;background-clip:border-box;background-color:var(--sgds-body-bg);border:var(--sgds-border-width) solid var(--sgds-border-color-translucent);border-radius:var(--sgds-border-radius);box-shadow:none;display:flex;flex-direction:column;height:auto;min-width:0;position:relative}.card,.card-body{color:var(--sgds-body-color)}.card-body{flex:1 1 auto;padding:var(--sgds-spacer-4)}.card-title{color:var(--sgds-body-color);margin-bottom:var(--sgds-spacer-2)}.card-subtitle,.card-text:last-child{margin-bottom:0}slot[name=card-image]::slotted(img){border-top-left-radius:calc(var(--sgds-border-radius) - var(--sgds-border-width));border-top-right-radius:calc(var(--sgds-border-radius) - var(--sgds-border-width))}slot[name=card-link]::slotted(*){font-weight:700}`;
|
|
5797
5785
|
|
|
5798
|
-
var css_248z$
|
|
5786
|
+
var css_248z$10 = css`.text-primary{color:var(--sgds-primary-rgb)!important}.text-secondary{color:var(--sgds-secondary-rgb)!important}.text-success{color:var(--sgds-success-rgb)!important}.text-info{color:var(--sgds-info-rgb)!important}.text-warning{color:var(--sgds-warning-rgb)!important}.text-danger{color:var(--sgds-danger-rgb)!important}.text-light{color:var(--sgds-light-rgb)!important}.text-dark{color:var(--sgds-dark-rgb)!important}.text-muted{color:var(--sgds-secondary-color)!important}`;
|
|
5799
5787
|
|
|
5800
|
-
var css_248z
|
|
5788
|
+
var css_248z$$ = css`.bg-primary{background-color:var(--sgds-primary)!important}.bg-secondary{background-color:var(--sgds-secondary)!important}.bg-success{background-color:var(--sgds-success)!important}.bg-info{background-color:var(--sgds-info)!important}.bg-warning{background-color:var(--sgds-warning)!important}.bg-danger{background-color:var(--sgds-danger)!important}.bg-light{background-color:var(--sgds-light)!important}.bg-dark{background-color:var(--sgds-dark)!important}`;
|
|
5801
5789
|
|
|
5802
|
-
var css_248z$
|
|
5790
|
+
var css_248z$_ = css`.border-primary{border-color:var(--sgds-primary)!important}.border-secondary{border-color:var(--sgds-secondary)!important}.border-success{border-color:var(--sgds-success)!important}.border-info{border-color:var(--sgds-info)!important}.border-warning{border-color:var(--sgds-warning)!important}.border-danger{border-color:var(--sgds-danger)!important}.border-light{border-color:var(--sgds-light)!important}.border-dark{border-color:var(--sgds-dark)!important}`;
|
|
5803
5791
|
|
|
5804
|
-
var css_248z$
|
|
5792
|
+
var css_248z$Z = css`.h1,.h2,.h3,.h4,.h5,.h6 ::slotted(h6),::slotted(h1),::slotted(h2),::slotted(h3),::slotted(h4),::slotted(h5),h1,h2,h3,h4,h5,h6{color:var(--sgds-heading-color);font-weight:700;line-height:1.2;margin-bottom:.5rem;margin-top:0}.h1,::slotted(h1),h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){.h1,::slotted(h1),h1{font-size:2.5rem}}.h2,::slotted(h2),h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){.h2,::slotted(h2),h2{font-size:2rem}}.h3,::slotted(h3),h3{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){.h3,::slotted(h3),h3{font-size:1.5rem}}.h4,::slotted(h4),h4{font-size:1.125rem}.h5,.h6 ::slotted(h6),::slotted(h5),h5,h6{font-size:1rem}.h1,::slotted(h1),h1{line-height:1.2}.h2,::slotted(h2),h2{line-height:1.25}.h3,::slotted(h3),h3{line-height:1.33}.h4,::slotted(h4),h4{line-height:1.78}.h5,.h6 ::slotted(h6),::slotted(h5),h5,h6{line-height:1.2}`;
|
|
5805
5793
|
|
|
5806
|
-
var css_248z$
|
|
5794
|
+
var css_248z$Y = css`p{margin-bottom:1.5rem;margin-top:0}`;
|
|
5807
5795
|
|
|
5808
5796
|
class CardElement extends SgdsElement {
|
|
5809
5797
|
}
|
|
5810
|
-
CardElement.styles = [...SgdsElement.styles, css_248z$
|
|
5798
|
+
CardElement.styles = [...SgdsElement.styles, css_248z$10, css_248z$$, css_248z$_, css_248z$Z, css_248z$Y, css_248z$11];
|
|
5811
5799
|
__decorate([
|
|
5812
5800
|
property()
|
|
5813
5801
|
], CardElement.prototype, "borderColor", void 0);
|
|
@@ -5835,6 +5823,56 @@
|
|
|
5835
5823
|
*/
|
|
5836
5824
|
const ifDefined = (value) => value ?? nothing;
|
|
5837
5825
|
|
|
5826
|
+
var css_248z$X = css`.invalid-feedback-container{display:flex;gap:var(--sgds-form-gap-sm)}.invalid-feedback{color:var(--sgds-form-danger-color);font-size:var(--sgds-font-size-1);font-weight:var(--sgds-font-weight-regular)}`;
|
|
5827
|
+
|
|
5828
|
+
var css_248z$W = css`.form-text{color:var(--sgds-form-color-subtle);font-size:var(--sgds-font-size-1)}.form-text.disabled{opacity:var(--sgds-opacity-50)}`;
|
|
5829
|
+
|
|
5830
|
+
var css_248z$V = css`.form-label{color:var(--sgds-form-color);margin-bottom:0}.form-label.disabled{opacity:var(--sgds-opacity-50)}.form-check-label{color:var(--sgds-form-color)}.form-check-input:disabled~.form-check-label,.form-check-input[disabled]~.form-check-label{cursor:not-allowed}`;
|
|
5831
|
+
|
|
5832
|
+
var css_248z$U = css`.form-control::placeholder{color:var(--sgds-form-color-subtle);font-family:var(--sgds-font-family-brand);font-weight:var(--sgds-font-weight-light);line-height:var(--sgds-line-height-heading)}`;
|
|
5833
|
+
|
|
5834
|
+
class FormControlElement extends SgdsElement {
|
|
5835
|
+
constructor() {
|
|
5836
|
+
super(...arguments);
|
|
5837
|
+
/** The input's label */
|
|
5838
|
+
this.label = "";
|
|
5839
|
+
/** The input's hint text */
|
|
5840
|
+
this.hintText = "";
|
|
5841
|
+
/** Disables the input. */
|
|
5842
|
+
this.disabled = false;
|
|
5843
|
+
/** Marks the component as invalid. Replace the pseudo :invalid selector for absent in custom elements */
|
|
5844
|
+
this.invalid = false;
|
|
5845
|
+
this._controlId = genId("input");
|
|
5846
|
+
this._labelId = genId("label");
|
|
5847
|
+
}
|
|
5848
|
+
/** Programatically sets the invalid state of the input. Pass in boolean value in the argument */
|
|
5849
|
+
setInvalid(bool) {
|
|
5850
|
+
this.invalid = bool;
|
|
5851
|
+
if (bool) {
|
|
5852
|
+
this.emit("sgds-invalid");
|
|
5853
|
+
}
|
|
5854
|
+
else {
|
|
5855
|
+
this.emit("sgds-valid");
|
|
5856
|
+
}
|
|
5857
|
+
}
|
|
5858
|
+
}
|
|
5859
|
+
FormControlElement.styles = [...SgdsElement.styles, css_248z$X, css_248z$W, css_248z$V, css_248z$U];
|
|
5860
|
+
__decorate([
|
|
5861
|
+
property({ reflect: true })
|
|
5862
|
+
], FormControlElement.prototype, "label", void 0);
|
|
5863
|
+
__decorate([
|
|
5864
|
+
property({ reflect: true })
|
|
5865
|
+
], FormControlElement.prototype, "hintText", void 0);
|
|
5866
|
+
__decorate([
|
|
5867
|
+
property({ reflect: true })
|
|
5868
|
+
], FormControlElement.prototype, "name", void 0);
|
|
5869
|
+
__decorate([
|
|
5870
|
+
property({ type: Boolean, reflect: true })
|
|
5871
|
+
], FormControlElement.prototype, "disabled", void 0);
|
|
5872
|
+
__decorate([
|
|
5873
|
+
property({ type: Boolean, reflect: true })
|
|
5874
|
+
], FormControlElement.prototype, "invalid", void 0);
|
|
5875
|
+
|
|
5838
5876
|
// @defaultValue decorator
|
|
5839
5877
|
const defaultValue = (propertyName = "value") => (proto, key) => {
|
|
5840
5878
|
const ctor = proto.constructor;
|
|
@@ -5855,294 +5893,227 @@
|
|
|
5855
5893
|
};
|
|
5856
5894
|
};
|
|
5857
5895
|
|
|
5858
|
-
|
|
5859
|
-
|
|
5896
|
+
/**
|
|
5897
|
+
* SGDS custom form validation methods and behaviours
|
|
5898
|
+
*/
|
|
5899
|
+
class InputValidationController {
|
|
5860
5900
|
constructor(host, options) {
|
|
5861
5901
|
(this.host = host).addController(this);
|
|
5862
|
-
this.
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
} }, options);
|
|
5869
|
-
this.handleFormData = this.handleFormData.bind(this);
|
|
5870
|
-
this.handleFormSubmit = this.handleFormSubmit.bind(this);
|
|
5871
|
-
this.handleFormReset = this.handleFormReset.bind(this);
|
|
5872
|
-
this.reportFormValidity = this.reportFormValidity.bind(this);
|
|
5902
|
+
this._internals = this.host.attachInternals();
|
|
5903
|
+
this.options = Object.assign({ setInvalid: (host, value) => {
|
|
5904
|
+
host.invalid = value;
|
|
5905
|
+
}, value: (host) => {
|
|
5906
|
+
return host.value;
|
|
5907
|
+
}, input: (host) => host.input }, options);
|
|
5873
5908
|
}
|
|
5874
5909
|
hostConnected() {
|
|
5875
|
-
this.
|
|
5876
|
-
if (this.form) {
|
|
5877
|
-
this.form.addEventListener("formdata", this.handleFormData);
|
|
5878
|
-
this.form.addEventListener("submit", this.handleFormSubmit);
|
|
5879
|
-
this.form.addEventListener("reset", this.handleFormReset);
|
|
5880
|
-
// Overload the form's reportValidity() method so it looks at Shoelace form controls
|
|
5881
|
-
if (!reportValidityOverloads.has(this.form)) {
|
|
5882
|
-
reportValidityOverloads.set(this.form, this.form.reportValidity);
|
|
5883
|
-
this.form.reportValidity = () => this.reportFormValidity();
|
|
5884
|
-
}
|
|
5885
|
-
}
|
|
5910
|
+
this.host.addEventListener("invalid", e => this.handleInvalid(e));
|
|
5886
5911
|
}
|
|
5887
5912
|
hostDisconnected() {
|
|
5888
|
-
|
|
5889
|
-
this.form.removeEventListener("formdata", this.handleFormData);
|
|
5890
|
-
this.form.removeEventListener("submit", this.handleFormSubmit);
|
|
5891
|
-
this.form.removeEventListener("reset", this.handleFormReset);
|
|
5892
|
-
// Remove the overload and restore the original method
|
|
5893
|
-
if (reportValidityOverloads.has(this.form)) {
|
|
5894
|
-
this.form.reportValidity = reportValidityOverloads.get(this.form);
|
|
5895
|
-
reportValidityOverloads.delete(this.form);
|
|
5896
|
-
}
|
|
5897
|
-
this.form = undefined;
|
|
5898
|
-
}
|
|
5913
|
+
this.host.removeEventListener("invalid", e => this.handleInvalid(e));
|
|
5899
5914
|
}
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
});
|
|
5909
|
-
}
|
|
5910
|
-
else {
|
|
5911
|
-
event.formData.append(name, value.toString());
|
|
5912
|
-
}
|
|
5913
|
-
}
|
|
5915
|
+
/**
|
|
5916
|
+
* Prevents the native browser error message pop up when reportValidity() called by
|
|
5917
|
+
* associated form or the component's reportValidity during constraint validation
|
|
5918
|
+
* Sets invalid reactive prop to true
|
|
5919
|
+
*/
|
|
5920
|
+
handleInvalid(e) {
|
|
5921
|
+
e.preventDefault();
|
|
5922
|
+
this.options.setInvalid(this.host, true);
|
|
5914
5923
|
}
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
this.
|
|
5925
|
-
}
|
|
5926
|
-
reportFormValidity() {
|
|
5927
|
-
//
|
|
5928
|
-
// Shoelace form controls work hard to act like regular form controls. They support the Constraint Validation API
|
|
5929
|
-
// and its associated methods such as setCustomValidity() and reportValidity(). However, the HTMLFormElement also
|
|
5930
|
-
// has a reportValidity() method that will trigger validation on all child controls. Since we're not yet using
|
|
5931
|
-
// ElementInternals, we need to overload this method so it looks for any element with the reportValidity() method.
|
|
5932
|
-
//
|
|
5933
|
-
// We preserve the original method in a WeakMap, but we don't call it from the overload because that would trigger
|
|
5934
|
-
// validations in an unexpected order. When the element disconnects, we revert to the original behavior. This won't
|
|
5935
|
-
// be necessary once we can use ElementInternals.
|
|
5936
|
-
//
|
|
5937
|
-
// Note that we're also honoring the form's novalidate attribute.
|
|
5938
|
-
//
|
|
5939
|
-
if (this.form && !this.form.noValidate) {
|
|
5940
|
-
// This seems sloppy, but checking all elements will cover native inputs, Shoelace inputs, and other custom
|
|
5941
|
-
// elements that support the constraint validation API.
|
|
5942
|
-
const elements = this.form.querySelectorAll("*");
|
|
5943
|
-
for (const element of elements) {
|
|
5944
|
-
if (typeof element.reportValidity === "function") {
|
|
5945
|
-
if (!element.reportValidity()) {
|
|
5946
|
-
return false;
|
|
5947
|
-
}
|
|
5948
|
-
}
|
|
5949
|
-
}
|
|
5950
|
-
}
|
|
5951
|
-
return true;
|
|
5924
|
+
/**
|
|
5925
|
+
* Sets invalid to false when invoked and
|
|
5926
|
+
* Updates the ValidityState based on new value, but
|
|
5927
|
+
* does not update invalid reactive prop
|
|
5928
|
+
* @param e
|
|
5929
|
+
*/
|
|
5930
|
+
handleInput(e) {
|
|
5931
|
+
const input = e.target;
|
|
5932
|
+
this.options.setInvalid(this.host, false);
|
|
5933
|
+
this.validateInput(input);
|
|
5952
5934
|
}
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
button.style.whiteSpace = "nowrap";
|
|
5963
|
-
// Pass form attributes through to the temporary button
|
|
5964
|
-
if (invoker) {
|
|
5965
|
-
["formaction", "formmethod", "formnovalidate", "formtarget"].forEach(attr => {
|
|
5966
|
-
if (invoker.hasAttribute(attr)) {
|
|
5967
|
-
button.setAttribute(attr, invoker.getAttribute(attr));
|
|
5968
|
-
}
|
|
5969
|
-
});
|
|
5970
|
-
}
|
|
5971
|
-
this.form.append(button);
|
|
5972
|
-
button.click();
|
|
5973
|
-
button.remove();
|
|
5974
|
-
}
|
|
5935
|
+
/**
|
|
5936
|
+
* Validate the input's new value after onChange and
|
|
5937
|
+
* update invalid reactive prop
|
|
5938
|
+
* @param e
|
|
5939
|
+
*/
|
|
5940
|
+
handleChange(e) {
|
|
5941
|
+
const input = e.target;
|
|
5942
|
+
this.validateInput(input);
|
|
5943
|
+
this.options.setInvalid(this.host, !this.checkValidity());
|
|
5975
5944
|
}
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
this.doAction("reset", invoker);
|
|
5945
|
+
get form() {
|
|
5946
|
+
return this._internals.form;
|
|
5979
5947
|
}
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
// Calling form.submit() bypasses the submit event and constraint validation. To prevent this, we can inject a
|
|
5983
|
-
// native submit button into the form, "click" it, then remove it to simulate a standard form submission.
|
|
5984
|
-
this.doAction("submit", invoker);
|
|
5948
|
+
get validity() {
|
|
5949
|
+
return this._internals.validity;
|
|
5985
5950
|
}
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
class FormCheckElement extends SgdsElement {
|
|
5989
|
-
constructor() {
|
|
5990
|
-
super(...arguments);
|
|
5991
|
-
/**@internal */
|
|
5992
|
-
this.formSubmitController = new FormSubmitController(this, {
|
|
5993
|
-
value: (control) => (control.checked ? control.value : undefined),
|
|
5994
|
-
defaultValue: (control) => control.defaultChecked,
|
|
5995
|
-
setValue: (control, checked) => (control.checked = checked)
|
|
5996
|
-
});
|
|
5997
|
-
/** For aria-label when there is no appropriate text label visible */
|
|
5998
|
-
this.ariaLabel = "checkbox";
|
|
5999
|
-
/** Makes the checkbox a required field. */
|
|
6000
|
-
this.required = false;
|
|
6001
|
-
/** Draws the checkbox in a checked state. */
|
|
6002
|
-
this.checked = false;
|
|
6003
|
-
/** Disables the checkbox (so the user can't check / uncheck it). */
|
|
6004
|
-
this.disabled = false;
|
|
6005
|
-
/** Allows invalidFeedback, invalid and valid styles to be visible with the input */
|
|
6006
|
-
this.hasFeedback = false;
|
|
6007
|
-
/** Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */
|
|
6008
|
-
this.defaultChecked = false;
|
|
6009
|
-
/** Marks the checkbox input as invalid. Replace the pseudo :invalid selector for absent in custom elements */
|
|
6010
|
-
this.invalid = false;
|
|
6011
|
-
/** Marks the checkbox input as indeterminate , with indeterminate logo */
|
|
6012
|
-
this.indeterminate = false;
|
|
5951
|
+
get validationMessage() {
|
|
5952
|
+
return this._internals.validationMessage;
|
|
6013
5953
|
}
|
|
6014
|
-
|
|
6015
|
-
|
|
5954
|
+
get willValidate() {
|
|
5955
|
+
return this._internals.willValidate;
|
|
6016
5956
|
}
|
|
6017
|
-
/**
|
|
6018
|
-
|
|
6019
|
-
|
|
5957
|
+
/**
|
|
5958
|
+
* Checks the validity and updates the invalid reactive prop of form components
|
|
5959
|
+
*/
|
|
5960
|
+
updateInvalidState() {
|
|
5961
|
+
this.options.setInvalid(this.host, !this.checkValidity());
|
|
6020
5962
|
}
|
|
6021
|
-
/**
|
|
6022
|
-
|
|
6023
|
-
|
|
5963
|
+
/**
|
|
5964
|
+
* Resets the ValidityState of the control
|
|
5965
|
+
*/
|
|
5966
|
+
resetValidity() {
|
|
5967
|
+
return this._internals.setValidity({});
|
|
6024
5968
|
}
|
|
6025
|
-
/**
|
|
6026
|
-
|
|
6027
|
-
|
|
5969
|
+
/**
|
|
5970
|
+
* Reports the validity
|
|
5971
|
+
*/
|
|
5972
|
+
checkValidity() {
|
|
5973
|
+
return this._internals.checkValidity();
|
|
6028
5974
|
}
|
|
6029
|
-
/**
|
|
5975
|
+
/**
|
|
5976
|
+
* Reports the validity with a error popup message
|
|
5977
|
+
*/
|
|
6030
5978
|
reportValidity() {
|
|
6031
|
-
|
|
6032
|
-
this.invalid = !this.input.checkValidity();
|
|
6033
|
-
}
|
|
6034
|
-
return this.input.reportValidity();
|
|
5979
|
+
return this._internals.reportValidity();
|
|
6035
5980
|
}
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
this.
|
|
5981
|
+
/**
|
|
5982
|
+
* Sets the form control value into FormData,
|
|
5983
|
+
* making the value of control accessible via FormData
|
|
5984
|
+
*/
|
|
5985
|
+
setFormValue() {
|
|
5986
|
+
const value = this.options.value(this.host);
|
|
5987
|
+
this._internals.setFormValue(value);
|
|
6043
5988
|
}
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
5989
|
+
/**
|
|
5990
|
+
* Updates the ValidityState of the input in form component at current state
|
|
5991
|
+
*/
|
|
5992
|
+
validateInput(input) {
|
|
5993
|
+
/** When the form control is disabled, its always valid */
|
|
5994
|
+
if (this.options.input(this.host).disabled) {
|
|
5995
|
+
return this._internals.setValidity({});
|
|
5996
|
+
}
|
|
5997
|
+
// get the validity of the internal <input>
|
|
5998
|
+
const validState = input.validity;
|
|
5999
|
+
// if the input is invalid, show the correct error
|
|
6000
|
+
if (!validState.valid) {
|
|
6001
|
+
// loop through the error reasons
|
|
6002
|
+
for (const state in validState) {
|
|
6003
|
+
// if there is an error and corresponding attribute holding
|
|
6004
|
+
// the message
|
|
6005
|
+
if (validState[state]) {
|
|
6006
|
+
this.validationError = state.toString();
|
|
6007
|
+
// set the validity error reason and the corresponding
|
|
6008
|
+
// message
|
|
6009
|
+
this._internals.setValidity({ [this.validationError]: true }, input.validationMessage, input);
|
|
6010
|
+
}
|
|
6011
|
+
}
|
|
6012
|
+
}
|
|
6013
|
+
else {
|
|
6014
|
+
this._internals.setValidity({});
|
|
6048
6015
|
}
|
|
6049
|
-
}
|
|
6050
|
-
_handleInvalid(e) {
|
|
6051
|
-
e.preventDefault();
|
|
6052
|
-
this.invalid = true;
|
|
6053
|
-
}
|
|
6054
|
-
/** @internal */
|
|
6055
|
-
handleDisabledChange() {
|
|
6056
|
-
// Disabled form controls are always valid, so we need to recheck validity when the state changes
|
|
6057
|
-
this.input.disabled = this.disabled;
|
|
6058
|
-
this.invalid = !this.input.checkValidity();
|
|
6059
|
-
}
|
|
6060
|
-
/** @internal */
|
|
6061
|
-
handleStateChange() {
|
|
6062
|
-
this.invalid = !this.input.checkValidity();
|
|
6063
|
-
}
|
|
6064
|
-
render() {
|
|
6065
|
-
return html$1 `
|
|
6066
|
-
<div
|
|
6067
|
-
class=${classMap({
|
|
6068
|
-
"form-check": true
|
|
6069
|
-
})}
|
|
6070
|
-
>
|
|
6071
|
-
<input
|
|
6072
|
-
class=${classMap({
|
|
6073
|
-
"form-check-input": true,
|
|
6074
|
-
"is-invalid": this.hasFeedback && this.invalid,
|
|
6075
|
-
md: this._size === "md"
|
|
6076
|
-
})}
|
|
6077
|
-
type="checkbox"
|
|
6078
|
-
id=${this._inputId}
|
|
6079
|
-
aria-invalid=${this.invalid ? "true" : "false"}
|
|
6080
|
-
name=${ifDefined(this.name)}
|
|
6081
|
-
value=${ifDefined(this.value)}
|
|
6082
|
-
?checked=${this.checked}
|
|
6083
|
-
?indeterminate=${this.indeterminate}
|
|
6084
|
-
?disabled=${this.disabled}
|
|
6085
|
-
?required=${this.required}
|
|
6086
|
-
aria-disabled=${this.disabled ? "true" : "false"}
|
|
6087
|
-
aria-checked=${this.checked ? "true" : "false"}
|
|
6088
|
-
@change=${this._handleChange}
|
|
6089
|
-
@keydown=${this._handleKeyDown}
|
|
6090
|
-
@invalid=${(e) => this._handleInvalid(e)}
|
|
6091
|
-
/>
|
|
6092
|
-
<label for="${this._inputId}" aria-label=${ifDefined(this.ariaLabel)} class="form-check-label"
|
|
6093
|
-
><slot></slot
|
|
6094
|
-
></label>
|
|
6095
|
-
</div>
|
|
6096
|
-
`;
|
|
6097
6016
|
}
|
|
6098
6017
|
}
|
|
6099
|
-
__decorate([
|
|
6100
|
-
query('input[type="checkbox"]')
|
|
6101
|
-
], FormCheckElement.prototype, "input", void 0);
|
|
6102
|
-
__decorate([
|
|
6103
|
-
property({ type: String, reflect: true })
|
|
6104
|
-
], FormCheckElement.prototype, "name", void 0);
|
|
6105
|
-
__decorate([
|
|
6106
|
-
property({ type: String, reflect: true })
|
|
6107
|
-
], FormCheckElement.prototype, "ariaLabel", void 0);
|
|
6108
|
-
__decorate([
|
|
6109
|
-
property({ type: String, reflect: true })
|
|
6110
|
-
], FormCheckElement.prototype, "value", void 0);
|
|
6111
|
-
__decorate([
|
|
6112
|
-
property({ type: Boolean, reflect: true })
|
|
6113
|
-
], FormCheckElement.prototype, "required", void 0);
|
|
6114
|
-
__decorate([
|
|
6115
|
-
property({ type: Boolean, reflect: true })
|
|
6116
|
-
], FormCheckElement.prototype, "checked", void 0);
|
|
6117
|
-
__decorate([
|
|
6118
|
-
property({ type: Boolean, reflect: true })
|
|
6119
|
-
], FormCheckElement.prototype, "disabled", void 0);
|
|
6120
|
-
__decorate([
|
|
6121
|
-
property({ type: Boolean, reflect: true })
|
|
6122
|
-
], FormCheckElement.prototype, "hasFeedback", void 0);
|
|
6123
|
-
__decorate([
|
|
6124
|
-
defaultValue("checked")
|
|
6125
|
-
], FormCheckElement.prototype, "defaultChecked", void 0);
|
|
6126
|
-
__decorate([
|
|
6127
|
-
property({ type: Boolean, reflect: true })
|
|
6128
|
-
], FormCheckElement.prototype, "invalid", void 0);
|
|
6129
|
-
__decorate([
|
|
6130
|
-
property({ type: Boolean, reflect: true })
|
|
6131
|
-
], FormCheckElement.prototype, "indeterminate", void 0);
|
|
6132
|
-
__decorate([
|
|
6133
|
-
watch("invalid", { waitUntilFirstUpdate: true })
|
|
6134
|
-
], FormCheckElement.prototype, "_handleInvalidChange", null);
|
|
6135
|
-
__decorate([
|
|
6136
|
-
property({ type: String })
|
|
6137
|
-
], FormCheckElement.prototype, "_size", void 0);
|
|
6138
|
-
__decorate([
|
|
6139
|
-
watch("disabled", { waitUntilFirstUpdate: true })
|
|
6140
|
-
], FormCheckElement.prototype, "handleDisabledChange", null);
|
|
6141
|
-
__decorate([
|
|
6142
|
-
watch("checked", { waitUntilFirstUpdate: true })
|
|
6143
|
-
], FormCheckElement.prototype, "handleStateChange", null);
|
|
6144
6018
|
|
|
6145
|
-
|
|
6019
|
+
/**
|
|
6020
|
+
* @summary The FormValidationMixin used by the form components
|
|
6021
|
+
* @param superClass
|
|
6022
|
+
* @returns
|
|
6023
|
+
*/
|
|
6024
|
+
const SgdsFormValidatorMixin = (superClass) => {
|
|
6025
|
+
class ToBeValidatedElement extends superClass {
|
|
6026
|
+
constructor() {
|
|
6027
|
+
super(...arguments);
|
|
6028
|
+
this._isTouched = false;
|
|
6029
|
+
}
|
|
6030
|
+
connectedCallback() {
|
|
6031
|
+
super.connectedCallback();
|
|
6032
|
+
this.inputValidationController = new InputValidationController(this);
|
|
6033
|
+
}
|
|
6034
|
+
async firstUpdated(changedProperties) {
|
|
6035
|
+
super.firstUpdated(changedProperties);
|
|
6036
|
+
/* Either input or sgds-input. For example, quantity-toggle uses sgds-input */
|
|
6037
|
+
this.input =
|
|
6038
|
+
this.shadowRoot.querySelector("input") || (await this.sgdsInput) || this.shadowRoot.querySelector("textarea");
|
|
6039
|
+
this._mixinValidate(this.input);
|
|
6040
|
+
}
|
|
6041
|
+
/**
|
|
6042
|
+
* Native lifecycle of Form-Associated Custom Element Callbacks
|
|
6043
|
+
*/
|
|
6044
|
+
formResetCallback() {
|
|
6045
|
+
if (this._mixinResetFormControl) {
|
|
6046
|
+
this._mixinResetFormControl();
|
|
6047
|
+
}
|
|
6048
|
+
else {
|
|
6049
|
+
this.value = this.defaultValue;
|
|
6050
|
+
this._mixinResetValidity(this.input);
|
|
6051
|
+
}
|
|
6052
|
+
this._mixinSetFormValue();
|
|
6053
|
+
}
|
|
6054
|
+
/**
|
|
6055
|
+
*
|
|
6056
|
+
* Methods use by classes using this mixin
|
|
6057
|
+
*/
|
|
6058
|
+
/**
|
|
6059
|
+
* OnChange of form component
|
|
6060
|
+
* 1. Make value of control accessible via FormData
|
|
6061
|
+
* 2. Run change handler
|
|
6062
|
+
*/
|
|
6063
|
+
_mixinHandleChange(e) {
|
|
6064
|
+
this._mixinSetFormValue();
|
|
6065
|
+
this.inputValidationController.handleChange(e);
|
|
6066
|
+
}
|
|
6067
|
+
/**
|
|
6068
|
+
* OnChange of form component
|
|
6069
|
+
* 1. Make value of control accessible via FormData
|
|
6070
|
+
* 2. Run input handler
|
|
6071
|
+
*/
|
|
6072
|
+
_mixinHandleInputChange(e) {
|
|
6073
|
+
this._mixinSetFormValue();
|
|
6074
|
+
this.inputValidationController.handleInput(e);
|
|
6075
|
+
}
|
|
6076
|
+
/**
|
|
6077
|
+
* During form resetting,
|
|
6078
|
+
* 1. ValidityState is reset
|
|
6079
|
+
* 2. invalid reactive prop is updated after the reset
|
|
6080
|
+
* 3. Revalidates the ValidityState (but do not update invalid prop)
|
|
6081
|
+
* to prepare for the next validity check
|
|
6082
|
+
* 4. Reset touched state to false for a pristine form
|
|
6083
|
+
*/
|
|
6084
|
+
_mixinResetValidity(input) {
|
|
6085
|
+
this.inputValidationController.resetValidity();
|
|
6086
|
+
this.inputValidationController.updateInvalidState();
|
|
6087
|
+
this.inputValidationController.validateInput(input);
|
|
6088
|
+
this._isTouched ? (this._isTouched = false) : null;
|
|
6089
|
+
}
|
|
6090
|
+
_mixinValidate(input) {
|
|
6091
|
+
this.inputValidationController.validateInput(input);
|
|
6092
|
+
}
|
|
6093
|
+
_mixinSetFormValue() {
|
|
6094
|
+
this.inputValidationController.setFormValue();
|
|
6095
|
+
}
|
|
6096
|
+
_mixinCheckValidity() {
|
|
6097
|
+
return this.inputValidationController.checkValidity();
|
|
6098
|
+
}
|
|
6099
|
+
_mixinReportValidity() {
|
|
6100
|
+
return this.inputValidationController.reportValidity();
|
|
6101
|
+
}
|
|
6102
|
+
_mixinGetValidity() {
|
|
6103
|
+
return this.inputValidationController.validity;
|
|
6104
|
+
}
|
|
6105
|
+
_mixinGetValidationMessage() {
|
|
6106
|
+
return this.inputValidationController.validationMessage;
|
|
6107
|
+
}
|
|
6108
|
+
}
|
|
6109
|
+
ToBeValidatedElement.formAssociated = true;
|
|
6110
|
+
__decorate([
|
|
6111
|
+
queryAsync("sgds-input")
|
|
6112
|
+
], ToBeValidatedElement.prototype, "sgdsInput", void 0);
|
|
6113
|
+
return ToBeValidatedElement;
|
|
6114
|
+
};
|
|
6115
|
+
|
|
6116
|
+
var css_248z$T = css`input{margin:0}.form-check{display:flex;gap:var(--sgds-form-gap-md);padding:var(--sgds-form-padding-inline-sm) 0}.form-check-input,.form-check-input-container{height:var(--sgds-form-height-sm);width:var(--sgds-form-width-xs)}.form-check-input{appearance:none;background-color:var(--sgds-form-bg);background-image:var(--sgds-radio-bg-image);background-position:50%;background-repeat:no-repeat;background-size:auto;border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color);border-radius:var(--sgds-form-border-radius-md)}.form-check-input:focus,.form-check-input:focus-visible{box-shadow:var(--sgds-form-box-shadow-focus);outline:0}.form-check-input:checked,.form-check-input[checked]{--sgds-radio-bg-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="17" height="16" fill="none"><path d="M14.347 3.979a.522.522 0 0 1 0 .739L7.043 12.02a.521.521 0 0 1-.738 0L2.653 8.369a.522.522 0 1 1 .739-.738l3.282 3.283 6.934-6.935a.52.52 0 0 1 .739 0Z" fill="%23fff"/></svg>');background-color:var(--sgds-form-primary-bg)}.form-check-input:indeterminate,.form-check-input[indeterminate]{--sgds-radio-bg-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="17" height="16" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.5 8a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5Z" fill="%23fff"/></svg>');background-color:var(--sgds-form-primary-bg)}:host([disabled]) .form-check{cursor:not-allowed;opacity:var(--sgds-opacity-50)}.form-check-input.is-invalid{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-danger-border-color)}.form-check-input:checked.is-invalid,.form-check-input[checked].is-invalid{background-color:var(--sgds-form-danger-bg)}.form-check-input:indeterminate.is-invalid,.form-check-input[indeterminate].is-invalid{background-color:var(--sgds-form-danger-bg)}`;
|
|
6146
6117
|
|
|
6147
6118
|
/**
|
|
6148
6119
|
* @summary Checkbox component is used when you require users to select multiple items from a list.
|
|
@@ -6150,36 +6121,29 @@
|
|
|
6150
6121
|
* @slot default - The label of checkbox.
|
|
6151
6122
|
*
|
|
6152
6123
|
* @event sgds-change - Emitted when the checked state changes.
|
|
6124
|
+
* @event sgds-blur - Emitted when input is not in focus.
|
|
6125
|
+
* @event sgds-focus - Emitted when input is in focus.
|
|
6153
6126
|
* @event sgds-validity-change - Emitted when the invalid state changes. This event is used by sgds-checkbox-group to check the invalid state change of its children
|
|
6154
6127
|
*/
|
|
6155
|
-
class SgdsCheckbox extends
|
|
6128
|
+
class SgdsCheckbox extends SgdsFormValidatorMixin(FormControlElement) {
|
|
6156
6129
|
constructor() {
|
|
6157
6130
|
super(...arguments);
|
|
6158
|
-
/**@internal */
|
|
6159
|
-
this.formSubmitController = new FormSubmitController(this, {
|
|
6160
|
-
value: (control) => (control.checked ? control.value : undefined),
|
|
6161
|
-
defaultValue: (control) => control.defaultChecked,
|
|
6162
|
-
setValue: (control, checked) => (control.checked = checked)
|
|
6163
|
-
});
|
|
6164
|
-
/** Makes the checkbox a required field. */
|
|
6165
|
-
this.required = false;
|
|
6166
6131
|
/** Draws the checkbox in a checked state. */
|
|
6167
6132
|
this.checked = false;
|
|
6168
|
-
/** Disables the checkbox (so the user can't check / uncheck it). */
|
|
6169
|
-
this.disabled = false;
|
|
6170
6133
|
/** Allows invalidFeedback, invalid and valid styles to be visible with the input */
|
|
6171
6134
|
this.hasFeedback = false;
|
|
6172
6135
|
/** Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */
|
|
6173
6136
|
this.defaultChecked = false;
|
|
6174
|
-
/** Marks the checkbox input as invalid. Replace the pseudo :invalid selector for absent in custom elements */
|
|
6175
|
-
this.invalid = false;
|
|
6176
6137
|
/** Marks the checkbox input as indeterminate , with indeterminate logo */
|
|
6177
6138
|
this.indeterminate = false;
|
|
6178
|
-
/**
|
|
6179
|
-
this.
|
|
6139
|
+
/** Makes the checkbox a required field. */
|
|
6140
|
+
this.required = false;
|
|
6141
|
+
this._isTouched = false;
|
|
6180
6142
|
}
|
|
6181
6143
|
_handleInvalidChange() {
|
|
6182
|
-
this.emit("sgds-validity-change", {
|
|
6144
|
+
this.emit("sgds-validity-change", {
|
|
6145
|
+
detail: { invalid: this.invalid, validationMessage: this.input.validationMessage }
|
|
6146
|
+
});
|
|
6183
6147
|
}
|
|
6184
6148
|
/** Simulates a click on the checkbox. */
|
|
6185
6149
|
click() {
|
|
@@ -6193,19 +6157,13 @@
|
|
|
6193
6157
|
blur() {
|
|
6194
6158
|
this.input.blur();
|
|
6195
6159
|
}
|
|
6196
|
-
|
|
6197
|
-
reportValidity() {
|
|
6198
|
-
if (!this.input.reportValidity()) {
|
|
6199
|
-
this.invalid = !this.input.checkValidity();
|
|
6200
|
-
}
|
|
6201
|
-
return this.input.reportValidity();
|
|
6202
|
-
}
|
|
6203
|
-
_handleChange() {
|
|
6160
|
+
_handleChange(e) {
|
|
6204
6161
|
if (this.indeterminate) {
|
|
6205
6162
|
this.indeterminate = !this.indeterminate;
|
|
6206
6163
|
}
|
|
6207
6164
|
this.checked = !this.checked;
|
|
6208
6165
|
this.value = this.input.value;
|
|
6166
|
+
super._mixinHandleChange(e);
|
|
6209
6167
|
this.emit("sgds-change", { detail: { checked: this.checked, value: this.value } });
|
|
6210
6168
|
}
|
|
6211
6169
|
_handleKeyDown(event) {
|
|
@@ -6214,6 +6172,13 @@
|
|
|
6214
6172
|
this.click();
|
|
6215
6173
|
}
|
|
6216
6174
|
}
|
|
6175
|
+
_handleBlur() {
|
|
6176
|
+
this._isTouched = true;
|
|
6177
|
+
this.emit("sgds-blur");
|
|
6178
|
+
}
|
|
6179
|
+
_handleFocus() {
|
|
6180
|
+
this.emit("sgds-focus");
|
|
6181
|
+
}
|
|
6217
6182
|
_handleInvalid(e) {
|
|
6218
6183
|
e.preventDefault();
|
|
6219
6184
|
this.invalid = true;
|
|
@@ -6221,12 +6186,43 @@
|
|
|
6221
6186
|
/** @internal */
|
|
6222
6187
|
_handleDisabledChange() {
|
|
6223
6188
|
// Disabled form controls are always valid, so we need to recheck validity when the state changes
|
|
6224
|
-
this.
|
|
6225
|
-
this.invalid = !this.input.checkValidity();
|
|
6189
|
+
this.setInvalid(false);
|
|
6226
6190
|
}
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6191
|
+
_handleIsTouched() {
|
|
6192
|
+
if (this._isTouched) {
|
|
6193
|
+
this.invalid = !this.input.checkValidity();
|
|
6194
|
+
}
|
|
6195
|
+
}
|
|
6196
|
+
_mixinResetFormControl() {
|
|
6197
|
+
this._isTouched = false;
|
|
6198
|
+
this.checked = this.input.checked = this.defaultChecked;
|
|
6199
|
+
this.input.dispatchEvent(new InputEvent("reset"));
|
|
6200
|
+
this._mixinResetValidity(this.input);
|
|
6201
|
+
}
|
|
6202
|
+
/**
|
|
6203
|
+
* Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
|
|
6204
|
+
* 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
|
|
6205
|
+
*/
|
|
6206
|
+
reportValidity() {
|
|
6207
|
+
return this._mixinReportValidity();
|
|
6208
|
+
}
|
|
6209
|
+
/**
|
|
6210
|
+
* Checks for validity without any native error popup message
|
|
6211
|
+
*/
|
|
6212
|
+
checkValidity() {
|
|
6213
|
+
return this._mixinCheckValidity();
|
|
6214
|
+
}
|
|
6215
|
+
/**
|
|
6216
|
+
* Returns the ValidityState object
|
|
6217
|
+
*/
|
|
6218
|
+
get validity() {
|
|
6219
|
+
return this._mixinGetValidity();
|
|
6220
|
+
}
|
|
6221
|
+
/**
|
|
6222
|
+
* Returns the validation message based on the ValidityState
|
|
6223
|
+
*/
|
|
6224
|
+
get validationMessage() {
|
|
6225
|
+
return this._mixinGetValidationMessage();
|
|
6230
6226
|
}
|
|
6231
6227
|
render() {
|
|
6232
6228
|
return html$1 `
|
|
@@ -6238,45 +6234,35 @@
|
|
|
6238
6234
|
"is-invalid": this.hasFeedback && this.invalid
|
|
6239
6235
|
})}
|
|
6240
6236
|
type="checkbox"
|
|
6241
|
-
id=${this.
|
|
6237
|
+
id=${this._controlId}
|
|
6242
6238
|
aria-invalid=${this.invalid ? "true" : "false"}
|
|
6243
6239
|
name=${ifDefined(this.name)}
|
|
6244
|
-
value=${ifDefined(this.value)}
|
|
6245
|
-
?checked=${this.checked}
|
|
6246
6240
|
?indeterminate=${this.indeterminate}
|
|
6247
|
-
?disabled=${this.disabled}
|
|
6248
6241
|
?required=${this.required}
|
|
6249
6242
|
aria-disabled=${this.disabled ? "true" : "false"}
|
|
6250
6243
|
aria-checked=${this.checked ? "true" : "false"}
|
|
6251
|
-
@change=${this._handleChange}
|
|
6244
|
+
@change=${(e) => this._handleChange(e)}
|
|
6252
6245
|
@keydown=${this._handleKeyDown}
|
|
6253
6246
|
@invalid=${(e) => this._handleInvalid(e)}
|
|
6247
|
+
.checked=${live(this.checked)}
|
|
6248
|
+
.disabled=${this.disabled}
|
|
6249
|
+
.required=${this.required}
|
|
6250
|
+
@blur=${this._handleBlur}
|
|
6251
|
+
@focus=${this._handleFocus}
|
|
6254
6252
|
/>
|
|
6255
6253
|
</div>
|
|
6256
|
-
<label for="${this.
|
|
6254
|
+
<label for="${this._controlId}" class="form-check-label" id="${this._labelId}"><slot></slot></label>
|
|
6257
6255
|
</div>
|
|
6258
6256
|
`;
|
|
6259
6257
|
}
|
|
6260
6258
|
}
|
|
6261
|
-
SgdsCheckbox.styles = [...
|
|
6262
|
-
__decorate([
|
|
6263
|
-
query('input[type="checkbox"]')
|
|
6264
|
-
], SgdsCheckbox.prototype, "input", void 0);
|
|
6265
|
-
__decorate([
|
|
6266
|
-
property({ type: String, reflect: true })
|
|
6267
|
-
], SgdsCheckbox.prototype, "name", void 0);
|
|
6259
|
+
SgdsCheckbox.styles = [...FormControlElement.styles, css_248z$T];
|
|
6268
6260
|
__decorate([
|
|
6269
6261
|
property({ type: String, reflect: true })
|
|
6270
6262
|
], SgdsCheckbox.prototype, "value", void 0);
|
|
6271
|
-
__decorate([
|
|
6272
|
-
property({ type: Boolean, reflect: true })
|
|
6273
|
-
], SgdsCheckbox.prototype, "required", void 0);
|
|
6274
6263
|
__decorate([
|
|
6275
6264
|
property({ type: Boolean, reflect: true })
|
|
6276
6265
|
], SgdsCheckbox.prototype, "checked", void 0);
|
|
6277
|
-
__decorate([
|
|
6278
|
-
property({ type: Boolean, reflect: true })
|
|
6279
|
-
], SgdsCheckbox.prototype, "disabled", void 0);
|
|
6280
6266
|
__decorate([
|
|
6281
6267
|
property({ type: Boolean, reflect: true })
|
|
6282
6268
|
], SgdsCheckbox.prototype, "hasFeedback", void 0);
|
|
@@ -6285,10 +6271,13 @@
|
|
|
6285
6271
|
], SgdsCheckbox.prototype, "defaultChecked", void 0);
|
|
6286
6272
|
__decorate([
|
|
6287
6273
|
property({ type: Boolean, reflect: true })
|
|
6288
|
-
], SgdsCheckbox.prototype, "
|
|
6274
|
+
], SgdsCheckbox.prototype, "indeterminate", void 0);
|
|
6289
6275
|
__decorate([
|
|
6290
6276
|
property({ type: Boolean, reflect: true })
|
|
6291
|
-
], SgdsCheckbox.prototype, "
|
|
6277
|
+
], SgdsCheckbox.prototype, "required", void 0);
|
|
6278
|
+
__decorate([
|
|
6279
|
+
state()
|
|
6280
|
+
], SgdsCheckbox.prototype, "_isTouched", void 0);
|
|
6292
6281
|
__decorate([
|
|
6293
6282
|
watch("invalid", { waitUntilFirstUpdate: true })
|
|
6294
6283
|
], SgdsCheckbox.prototype, "_handleInvalidChange", null);
|
|
@@ -6296,12 +6285,10 @@
|
|
|
6296
6285
|
watch("disabled", { waitUntilFirstUpdate: true })
|
|
6297
6286
|
], SgdsCheckbox.prototype, "_handleDisabledChange", null);
|
|
6298
6287
|
__decorate([
|
|
6299
|
-
watch("
|
|
6300
|
-
], SgdsCheckbox.prototype, "
|
|
6288
|
+
watch("_isTouched", { waitUntilFirstUpdate: true })
|
|
6289
|
+
], SgdsCheckbox.prototype, "_handleIsTouched", null);
|
|
6301
6290
|
|
|
6302
|
-
var css_248z$
|
|
6303
|
-
|
|
6304
|
-
var css_248z$T = css`.form-label{margin-bottom:0}.form-check-label,.form-label{color:var(--sgds-form-color)}.form-check-input:disabled~.form-check-label,.form-check-input[disabled]~.form-check-label{cursor:not-allowed}`;
|
|
6291
|
+
var css_248z$S = css`:host{outline:0}input{margin:0}.form-check{display:flex;gap:var(--sgds-form-gap-md);padding:var(--sgds-form-padding-inline-sm) 0}.form-check-input-container{height:var(--sgds-form-height-sm);width:var(--sgds-form-width-xs)}.form-check-input{appearance:none;background-color:var(--sgds-form-bg);background-image:var(--sgds-radio-bg-image);background-position:50%;background-repeat:no-repeat;background-size:auto;border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color);border-radius:50%;height:var(--sgds-form-height-sm);width:var(--sgds-form-height-sm)}.form-check-input:not([disabled]):not(.is-invalid):not([aria-checked=true]):hover{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis)}.form-check-input:focus,.form-check-input:focus-visible{border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color-emphasis);box-shadow:var(--sgds-form-box-shadow-focus);outline:0}.form-check-input:checked,.form-check-input[checked]{--sgds-radio-bg-image:url('data:image/svg+xml;charset=utf-8,<svg width="8" height="8" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 4a4 4 0 1 1 8 0 4 4 0 0 1-8 0Z" fill="%23fff"/></svg>');background-color:var(--sgds-form-primary-bg);border:var(--sgds-form-border-width-default) solid var(--sgds-default-border-color-transparent)}.form-check-input:not([disabled]):not(.is-invalid):checked:focus-visible,.form-check-input:not([disabled]):not(.is-invalid):checked:hover,.form-check-input:not([disabled]):not(.is-invalid)[checked]:focus-visible,.form-check-input:not([disabled]):not(.is-invalid)[checked]:hover{background-color:var(--sgds-form-primary-bg-emphasis)}:host([disabled]) .form-check{cursor:not-allowed;opacity:var(--sgds-opacity-50)}.form-check-input:not([disabled]).is-invalid{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-danger-border-color)}.form-check-input:checked.is-invalid,.form-check-input[checked].is-invalid{background-color:var(--sgds-form-danger-bg)}`;
|
|
6305
6292
|
|
|
6306
6293
|
/**
|
|
6307
6294
|
* @summary Radio allows the user to select one option from a set while seeing all available options.
|
|
@@ -6387,7 +6374,7 @@
|
|
|
6387
6374
|
`;
|
|
6388
6375
|
}
|
|
6389
6376
|
}
|
|
6390
|
-
SgdsRadio.styles = [...SgdsElement.styles, css_248z$
|
|
6377
|
+
SgdsRadio.styles = [...SgdsElement.styles, css_248z$V, css_248z$S];
|
|
6391
6378
|
__decorate([
|
|
6392
6379
|
property({ type: Boolean, reflect: true })
|
|
6393
6380
|
], SgdsRadio.prototype, "checked", void 0);
|
|
@@ -6410,7 +6397,7 @@
|
|
|
6410
6397
|
watch("disabled", { waitUntilFirstUpdate: true })
|
|
6411
6398
|
], SgdsRadio.prototype, "handleDisabledChange", null);
|
|
6412
6399
|
|
|
6413
|
-
var css_248z$
|
|
6400
|
+
var css_248z$R = css`.sgds.card[variant*=card-action]{transition-duration:.3s;transition-property:box-shadow,border-color;transition-timing-function:ease-in-out}.card-body{display:flex;flex-direction:column;gap:var(--sgds-spacer-3)}slot[name=icon]::slotted(*){margin-right:1rem}.sgds.card[variant*=card-action].is-active,.sgds.card[variant*=card-action]:hover{border-color:transparent;box-shadow:var(--sgds-box-shadow),inset 0 0 0 2.1px var(--sgds-link)}.sgds.card[variant*=card-action] .card-subtitle{align-items:center;display:flex;justify-content:space-between}.sgds.card[variant*=card-action] .card-title{color:var(--sgds-body-color);margin-bottom:0}`;
|
|
6414
6401
|
|
|
6415
6402
|
/**
|
|
6416
6403
|
* @summary Action Card are cards with built in checkbox or radio components. The ref of input is extended to the Card's body.
|
|
@@ -6524,7 +6511,7 @@
|
|
|
6524
6511
|
`;
|
|
6525
6512
|
}
|
|
6526
6513
|
}
|
|
6527
|
-
SgdsActionCard.styles = [...CardElement.styles, css_248z$
|
|
6514
|
+
SgdsActionCard.styles = [...CardElement.styles, css_248z$R];
|
|
6528
6515
|
__decorate([
|
|
6529
6516
|
property({ reflect: true })
|
|
6530
6517
|
], SgdsActionCard.prototype, "name", void 0);
|
|
@@ -6550,58 +6537,185 @@
|
|
|
6550
6537
|
watch("disabled")
|
|
6551
6538
|
], SgdsActionCard.prototype, "handleDisabledChange", null);
|
|
6552
6539
|
|
|
6553
|
-
customElements.define("sgds-action-card", SgdsActionCard);
|
|
6540
|
+
customElements.define("sgds-action-card", SgdsActionCard);
|
|
6541
|
+
|
|
6542
|
+
var css_248z$Q = css`:host{--sgds-close-btn-border-radius:var(--sgds-border-radius-sm);display:inline-flex}.btn-close{background-color:var(--sgds-default-bg-transparent);border:0;border:var(--sgds-border-width-1) solid var(--sgds-default-border-color-transparent);border-radius:var(--sgds-close-btn-border-radius);cursor:pointer;height:var(--sgds-dimension-32);padding:0;position:relative;width:var(--sgds-dimension-32)}.btn-close:before{background-color:currentColor;border-radius:var(--sgds-border-radius);box-sizing:content-box;color:var(--sgds-default-color);content:"";height:var(--sgds-icon-size-md);left:50%;mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M5.614 5.614a.75.75 0 0 1 1.06 0l5.304 5.303 5.303-5.303a.75.75 0 0 1 1.06 1.06l-5.302 5.304 5.303 5.303a.75.75 0 0 1-1.06 1.06l-5.304-5.302-5.303 5.303a.75.75 0 0 1-1.061-1.06l5.303-5.304-5.303-5.303a.75.75 0 0 1 0-1.061Z'/%3E%3C/svg%3E");-webkit-mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M5.614 5.614a.75.75 0 0 1 1.06 0l5.304 5.303 5.303-5.303a.75.75 0 0 1 1.06 1.06l-5.302 5.304 5.303 5.303a.75.75 0 0 1-1.06 1.06l-5.304-5.302-5.303 5.303a.75.75 0 0 1-1.061-1.06l5.303-5.304-5.303-5.303a.75.75 0 0 1 0-1.061Z'/%3E%3C/svg%3E");mask-position:center;-webkit-mask-position:center;mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;position:absolute;top:50%;transform:translate(-50%,-50%);width:var(--sgds-icon-size-md)}.btn-close-light:before{color:var(--sgds-default-color-on-dark)}.btn-close-dark:before{color:var(--sgds-default-color-on-light)}.btn-close:hover{background-color:var(--sgds-default-bg-translucent)}.btn-close:focus,.btn-close:focus-visible{background-color:var(--sgds-default-bg-translucent);box-shadow:var(--sgds-box-shadow-focus);outline:0}.btn-close-sm{height:var(--sgds-dimension-24);width:var(--sgds-dimension-24)}.btn-close.btn-close-sm:before{height:var(--sgds-icon-size-sm);width:var(--sgds-icon-size-sm)}`;
|
|
6543
|
+
|
|
6544
|
+
/**
|
|
6545
|
+
* @summary Close button for closing actions. Used in Modal, Drawer, Alert and Toast.
|
|
6546
|
+
*
|
|
6547
|
+
* @cssprop --sgds-close-btn-border-radius - The border radius of close button border
|
|
6548
|
+
*
|
|
6549
|
+
*/
|
|
6550
|
+
class SgdsCloseButton extends SgdsElement {
|
|
6551
|
+
constructor() {
|
|
6552
|
+
super(...arguments);
|
|
6553
|
+
this.ariaLabel = "Close button";
|
|
6554
|
+
/** Specifies a large or small button */
|
|
6555
|
+
this.size = "md";
|
|
6556
|
+
this.variant = "default";
|
|
6557
|
+
this._clickHandler = () => {
|
|
6558
|
+
return;
|
|
6559
|
+
};
|
|
6560
|
+
}
|
|
6561
|
+
_handleClick() {
|
|
6562
|
+
this.removeEventListener("click", this._clickHandler);
|
|
6563
|
+
this.addEventListener("click", this._clickHandler);
|
|
6564
|
+
}
|
|
6565
|
+
render() {
|
|
6566
|
+
return html$1 `
|
|
6567
|
+
<button
|
|
6568
|
+
class=${classMap({
|
|
6569
|
+
"btn-close": true,
|
|
6570
|
+
[`btn-close-${this.size}`]: this.size,
|
|
6571
|
+
"btn-close-light": this.variant === "light",
|
|
6572
|
+
"btn-close-dark": this.variant === "dark"
|
|
6573
|
+
})}
|
|
6574
|
+
aria-label=${ifDefined(this.ariaLabel)}
|
|
6575
|
+
@click=${this._handleClick}
|
|
6576
|
+
></button>
|
|
6577
|
+
`;
|
|
6578
|
+
}
|
|
6579
|
+
}
|
|
6580
|
+
SgdsCloseButton.styles = [...SgdsElement.styles, css_248z$Q];
|
|
6581
|
+
__decorate([
|
|
6582
|
+
property({ type: String })
|
|
6583
|
+
], SgdsCloseButton.prototype, "ariaLabel", void 0);
|
|
6584
|
+
__decorate([
|
|
6585
|
+
property({ type: String, reflect: true })
|
|
6586
|
+
], SgdsCloseButton.prototype, "size", void 0);
|
|
6587
|
+
__decorate([
|
|
6588
|
+
property({ type: String, reflect: true })
|
|
6589
|
+
], SgdsCloseButton.prototype, "variant", void 0);
|
|
6590
|
+
|
|
6591
|
+
/**
|
|
6592
|
+
* @license
|
|
6593
|
+
* Copyright 2017 Google LLC
|
|
6594
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
6595
|
+
*/
|
|
6596
|
+
const HTML_RESULT = 1;
|
|
6597
|
+
class UnsafeHTMLDirective extends Directive {
|
|
6598
|
+
constructor(partInfo) {
|
|
6599
|
+
super(partInfo);
|
|
6600
|
+
this._value = nothing;
|
|
6601
|
+
if (partInfo.type !== PartType.CHILD) {
|
|
6602
|
+
throw new Error(`${this.constructor.directiveName}() can only be used in child bindings`);
|
|
6603
|
+
}
|
|
6604
|
+
}
|
|
6605
|
+
render(value) {
|
|
6606
|
+
if (value === nothing || value == null) {
|
|
6607
|
+
this._templateResult = undefined;
|
|
6608
|
+
return (this._value = value);
|
|
6609
|
+
}
|
|
6610
|
+
if (value === noChange) {
|
|
6611
|
+
return value;
|
|
6612
|
+
}
|
|
6613
|
+
if (typeof value != 'string') {
|
|
6614
|
+
throw new Error(`${this.constructor.directiveName}() called with a non-string value`);
|
|
6615
|
+
}
|
|
6616
|
+
if (value === this._value) {
|
|
6617
|
+
return this._templateResult;
|
|
6618
|
+
}
|
|
6619
|
+
this._value = value;
|
|
6620
|
+
const strings = [value];
|
|
6621
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6622
|
+
strings.raw = strings;
|
|
6623
|
+
// WARNING: impersonating a TemplateResult like this is extremely
|
|
6624
|
+
// dangerous. Third-party directives should not do this.
|
|
6625
|
+
return (this._templateResult = {
|
|
6626
|
+
// Cast to a known set of integers that satisfy ResultType so that we
|
|
6627
|
+
// don't have to export ResultType and possibly encourage this pattern.
|
|
6628
|
+
// This property needs to remain unminified.
|
|
6629
|
+
['_$litType$']: this.constructor
|
|
6630
|
+
.resultType,
|
|
6631
|
+
strings,
|
|
6632
|
+
values: [],
|
|
6633
|
+
});
|
|
6634
|
+
}
|
|
6635
|
+
}
|
|
6636
|
+
UnsafeHTMLDirective.directiveName = 'unsafeHTML';
|
|
6637
|
+
UnsafeHTMLDirective.resultType = HTML_RESULT;
|
|
6638
|
+
|
|
6639
|
+
/**
|
|
6640
|
+
* @license
|
|
6641
|
+
* Copyright 2017 Google LLC
|
|
6642
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
6643
|
+
*/
|
|
6644
|
+
const SVG_RESULT = 2;
|
|
6645
|
+
class UnsafeSVGDirective extends UnsafeHTMLDirective {
|
|
6646
|
+
}
|
|
6647
|
+
UnsafeSVGDirective.directiveName = 'unsafeSVG';
|
|
6648
|
+
UnsafeSVGDirective.resultType = SVG_RESULT;
|
|
6649
|
+
/**
|
|
6650
|
+
* Renders the result as SVG, rather than text.
|
|
6651
|
+
*
|
|
6652
|
+
* The values `undefined`, `null`, and `nothing`, will all result in no content
|
|
6653
|
+
* (empty string) being rendered.
|
|
6654
|
+
*
|
|
6655
|
+
* Note, this is unsafe to use with any user-provided input that hasn't been
|
|
6656
|
+
* sanitized or escaped, as it may lead to cross-site-scripting
|
|
6657
|
+
* vulnerabilities.
|
|
6658
|
+
*/
|
|
6659
|
+
const unsafeSVG = directive(UnsafeSVGDirective);
|
|
6554
6660
|
|
|
6555
|
-
var css_248z$
|
|
6661
|
+
var css_248z$P = css`:host([size=sm]) svg{height:var(--sgds-icon-size-sm);width:var(--sgds-icon-size-sm)}:host([size=md]) svg{height:var(--sgds-icon-size-md);width:var(--sgds-icon-size-md)}:host([size=xl]) svg{height:var(--sgds-icon-size-xl);width:var(--sgds-icon-size-xl)}:host([size="2-xl"]) svg{height:var(--sgds-icon-size-2-xl);width:var(--sgds-icon-size-2-xl)}:host([size="3-xl"]) svg{height:var(--sgds-icon-size-3-xl);width:var(--sgds-icon-size-3-xl)}svg{display:block;height:var(--sgds-icon-size-lg);width:var(--sgds-icon-size-lg)}`;
|
|
6556
6662
|
|
|
6557
6663
|
/**
|
|
6558
|
-
* @summary
|
|
6559
|
-
*
|
|
6560
|
-
* @cssprop --sgds-close-btn-border-radius - The border radius of close button border
|
|
6664
|
+
* @summary Icons offer a form of visual shorthand that we are all familiar with. They can label, inform and aid navigation quickly and effectively in minimal space. Icons must first and foremost communicate meaning. By default, the icon component renders icons form SgdsIcon library set
|
|
6561
6665
|
*
|
|
6666
|
+
* @event sgds-blur - Emitted when the button is blurred.
|
|
6667
|
+
* @event sgds-focus - Emitted when the button is focused.
|
|
6562
6668
|
*/
|
|
6563
|
-
class
|
|
6669
|
+
class SgdsIcon extends SgdsElement {
|
|
6564
6670
|
constructor() {
|
|
6565
6671
|
super(...arguments);
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
this.
|
|
6570
|
-
this._clickHandler = () => {
|
|
6571
|
-
return;
|
|
6572
|
-
};
|
|
6672
|
+
/** Specifies a small, medium or large icon, the size is medium by default. */
|
|
6673
|
+
this.size = "lg";
|
|
6674
|
+
/** @internal */
|
|
6675
|
+
this._svgContent = null;
|
|
6573
6676
|
}
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6677
|
+
async firstUpdated() {
|
|
6678
|
+
if (this.name) {
|
|
6679
|
+
this.loadSvg(this.name);
|
|
6680
|
+
}
|
|
6681
|
+
}
|
|
6682
|
+
updated() {
|
|
6683
|
+
this.style.display = this._svgContent ? "flex" : "none";
|
|
6684
|
+
}
|
|
6685
|
+
async loadSvg(name) {
|
|
6686
|
+
if (name) {
|
|
6687
|
+
// Dynamically import the SVG if not cached
|
|
6688
|
+
try {
|
|
6689
|
+
//TODO: This path is too specific to our repo, it won't work for users
|
|
6690
|
+
const response = await fetch(`/src/icons/${name}.svg`);
|
|
6691
|
+
if (response.ok) {
|
|
6692
|
+
const svgContent = await response.text();
|
|
6693
|
+
// Render the SVG
|
|
6694
|
+
// this.renderSvg(svgContent);
|
|
6695
|
+
this._svgContent = svgContent;
|
|
6696
|
+
}
|
|
6697
|
+
}
|
|
6698
|
+
catch (error) {
|
|
6699
|
+
console.error(`Error loading SVG: ${name}`, error);
|
|
6700
|
+
}
|
|
6701
|
+
}
|
|
6577
6702
|
}
|
|
6578
6703
|
render() {
|
|
6579
|
-
return html
|
|
6580
|
-
<button
|
|
6581
|
-
class=${classMap({
|
|
6582
|
-
"btn-close": true,
|
|
6583
|
-
[`btn-close-${this.size}`]: this.size,
|
|
6584
|
-
"btn-close-light": this.variant === "light",
|
|
6585
|
-
"btn-close-dark": this.variant === "dark"
|
|
6586
|
-
})}
|
|
6587
|
-
aria-label=${ifDefined(this.ariaLabel)}
|
|
6588
|
-
@click=${this._handleClick}
|
|
6589
|
-
></button>
|
|
6590
|
-
`;
|
|
6704
|
+
return html `${unsafeSVG(this._svgContent)}`;
|
|
6591
6705
|
}
|
|
6592
6706
|
}
|
|
6593
|
-
|
|
6594
|
-
__decorate([
|
|
6595
|
-
property({ type: String })
|
|
6596
|
-
], SgdsCloseButton.prototype, "ariaLabel", void 0);
|
|
6707
|
+
SgdsIcon.styles = [...SgdsElement.styles, css_248z$P];
|
|
6597
6708
|
__decorate([
|
|
6598
6709
|
property({ type: String, reflect: true })
|
|
6599
|
-
],
|
|
6710
|
+
], SgdsIcon.prototype, "name", void 0);
|
|
6600
6711
|
__decorate([
|
|
6601
6712
|
property({ type: String, reflect: true })
|
|
6602
|
-
],
|
|
6713
|
+
], SgdsIcon.prototype, "size", void 0);
|
|
6714
|
+
__decorate([
|
|
6715
|
+
state()
|
|
6716
|
+
], SgdsIcon.prototype, "_svgContent", void 0);
|
|
6603
6717
|
|
|
6604
|
-
var css_248z$
|
|
6718
|
+
var css_248z$O = css`:host{--sgds-alert-bg:var(--sgds-primary-bg);--sgds-alert-color:var(--sgds-default-color-on-dark);--sgds-alert-border-radius:var(--sgds-border-radius-md)}:host([variant=success]){--sgds-alert-bg:var(--sgds-success-bg)}:host([variant=warning]){--sgds-alert-bg:var(--sgds-warning-bg)}:host([variant=danger]){--sgds-alert-bg:var(--sgds-danger-bg)}:host([variant=neutral]){--sgds-alert-bg:var(--sgds-neutral-bg)}:host([outlined]){--sgds-alert-color:var(--sgds-default-color-on-light)}:host([variant=info][outlined]){--sgds-alert-bg:var(--sgds-primary-bg-subtle);--sgds-alert-border-color:var(--sgds-primary-border-color-subtle)}:host([variant=success][outlined]){--sgds-alert-bg:var(--sgds-success-bg-subtle);--sgds-alert-border-color:var(--sgds-success-border-color-subtle)}:host([variant=warning][outlined]){--sgds-alert-bg:var(--sgds-warning-bg-subtle);--sgds-alert-border-color:var(--sgds-warning-border-color-subtle)}:host([variant=danger][outlined]){--sgds-alert-bg:var(--sgds-danger-bg-subtle);--sgds-alert-border-color:var(--sgds-danger-border-color-subtle)}:host([variant=neutral][outlined]){--sgds-alert-bg:var(--sgds-neutral-bg-subtle);--sgds-alert-border-color:var(--sgds-neutral-border-color-subtle)}slot[name=icon]::slotted(*){color:var(--sgds-alert-color)}.alert{background-color:var(--sgds-alert-bg);border:var(--sgds-border-width-1) solid var(--sgds-default-border-color-transparent);border-radius:var(--sgds-alert-border-radius);color:var(--sgds-alert-color);display:flex;flex-direction:row;gap:var(--sgds-gap-sm);padding:var(--sgds-padding-lg)}.alert.outlined{border:var(--sgds-border-width-1) solid var(--sgds-alert-border-color)}.alert-content{align-items:flex-start;display:flex;flex:1 0 0;flex-direction:column;gap:var(--sgds-gap-2-xs);justify-content:center;padding-right:var(--sgds-padding-2-xl)}.alert-title{font-weight:var(--sgds-font-weight-semibold)}`;
|
|
6605
6719
|
|
|
6606
6720
|
/**
|
|
6607
6721
|
* @summary Alerts provide short, timely, and relevant information for your users. It can be a simple text message or customised HTML content with paragraphs, headings and links.
|
|
@@ -6628,7 +6742,8 @@
|
|
|
6628
6742
|
/**@internal */
|
|
6629
6743
|
static get scopedElements() {
|
|
6630
6744
|
return {
|
|
6631
|
-
"sgds-close-button": SgdsCloseButton
|
|
6745
|
+
"sgds-close-button": SgdsCloseButton,
|
|
6746
|
+
"sgds-icon": SgdsIcon
|
|
6632
6747
|
};
|
|
6633
6748
|
}
|
|
6634
6749
|
/** Closes the alert */
|
|
@@ -6639,14 +6754,8 @@
|
|
|
6639
6754
|
_handleShowChange() {
|
|
6640
6755
|
this.show ? this.emit("sgds-show") : this.emit("sgds-hide");
|
|
6641
6756
|
}
|
|
6642
|
-
firstUpdated() {
|
|
6643
|
-
var _a;
|
|
6644
|
-
if (this._iconNodes.length === 0) {
|
|
6645
|
-
return (_a = this.shadowRoot.querySelector("slot[name='icon']")) === null || _a === void 0 ? void 0 : _a.classList.add("d-none");
|
|
6646
|
-
}
|
|
6647
|
-
}
|
|
6648
6757
|
render() {
|
|
6649
|
-
return this.show
|
|
6758
|
+
return (this.dismissible && this.show) || !this.dismissible
|
|
6650
6759
|
? html `
|
|
6651
6760
|
<div
|
|
6652
6761
|
class="${classMap({
|
|
@@ -6675,7 +6784,7 @@
|
|
|
6675
6784
|
: nothing;
|
|
6676
6785
|
}
|
|
6677
6786
|
}
|
|
6678
|
-
SgdsAlert.styles = [...SgdsElement.styles, css_248z$
|
|
6787
|
+
SgdsAlert.styles = [...SgdsElement.styles, css_248z$O];
|
|
6679
6788
|
__decorate([
|
|
6680
6789
|
property({ type: Boolean, reflect: true })
|
|
6681
6790
|
], SgdsAlert.prototype, "show", void 0);
|
|
@@ -6694,13 +6803,10 @@
|
|
|
6694
6803
|
__decorate([
|
|
6695
6804
|
watch("show")
|
|
6696
6805
|
], SgdsAlert.prototype, "_handleShowChange", null);
|
|
6697
|
-
__decorate([
|
|
6698
|
-
queryAssignedNodes({ slot: "icon", flatten: true })
|
|
6699
|
-
], SgdsAlert.prototype, "_iconNodes", void 0);
|
|
6700
6806
|
|
|
6701
|
-
var css_248z$
|
|
6807
|
+
var css_248z$N = css`:host{cursor:pointer;display:inline-block}.alert-link,.alert-link:hover{color:var(--sgds-alert-color);text-decoration-line:underline}.alert-link:focus,.alert-link:focus-visible{box-shadow:var(--sgds-box-shadow-focus);outline:0}`;
|
|
6702
6808
|
|
|
6703
|
-
var css_248z$
|
|
6809
|
+
var css_248z$M = css`a[target=_blank]:after{background-color:currentColor;content:"/";display:inline-block;margin:0 .125rem;-webkit-mask-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-up-right"><path fill-rule="evenodd" d="M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z"/><path fill-rule="evenodd" d="M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z"/></svg>');mask-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-up-right"><path fill-rule="evenodd" d="M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z"/><path fill-rule="evenodd" d="M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z"/></svg>');-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;mask-size:73%;-webkit-mask-size:73%;padding:0 .45em}`;
|
|
6704
6810
|
|
|
6705
6811
|
/**
|
|
6706
6812
|
* @summary Alert link are used within the alert's message that is passed into the default slot of `<sgds-alert>`
|
|
@@ -6714,7 +6820,7 @@
|
|
|
6714
6820
|
`;
|
|
6715
6821
|
}
|
|
6716
6822
|
}
|
|
6717
|
-
SgdsAlertLink.styles = [...SgdsElement.styles, css_248z$
|
|
6823
|
+
SgdsAlertLink.styles = [...SgdsElement.styles, css_248z$M, css_248z$N];
|
|
6718
6824
|
__decorate([
|
|
6719
6825
|
property({ type: String, reflect: true })
|
|
6720
6826
|
], SgdsAlertLink.prototype, "href", void 0);
|
|
@@ -6725,14 +6831,13 @@
|
|
|
6725
6831
|
customElements.define("sgds-alert", SgdsAlert);
|
|
6726
6832
|
customElements.define("sgds-alert-link", SgdsAlertLink);
|
|
6727
6833
|
|
|
6728
|
-
var css_248z$
|
|
6834
|
+
var css_248z$L = css`:host{--sgds-badge-bg:var(--sgds-primary-bg);--sgds-badge-color:var(--sgds-default-color-on-dark);--sgds-badge-border-radius:var(--sgds-border-radius-sm);display:inline-flex}:host([variant=success]){--sgds-badge-bg:var(--sgds-success-bg);--sgds-badge-color:var(--sgds-default-color-on-dark)}:host([variant=danger]){--sgds-badge-bg:var(--sgds-danger-bg);--sgds-badge-color:var(--sgds-default-color-on-dark)}:host([variant=warning]){--sgds-badge-bg:var(--sgds-warning-bg);--sgds-badge-color:var(--sgds-default-color-on-dark)}:host([variant=neutral]){--sgds-badge-bg:var(--sgds-neutral-bg);--sgds-badge-color:var(--sgds-default-color-on-dark)}:host([variant=info][outlined]){--sgds-badge-bg:var(--sgds-primary-bg-subtle);--sgds-badge-color:var(--sgds-default-color-on-light);--sgds-badge-border-color:var(--sgds-primary-border-color-subtle)}:host([variant=success][outlined]){--sgds-badge-bg:var(--sgds-success-bg-subtle);--sgds-badge-color:var(--sgds-default-color-on-light);--sgds-badge-border-color:var(--sgds-success-border-color-subtle)}:host([variant=danger][outlined]){--sgds-badge-bg:var(--sgds-danger-bg-subtle);--sgds-badge-color:var(--sgds-default-color-on-light);--sgds-badge-border-color:var(--sgds-danger-border-color-subtle)}:host([variant=warning][outlined]){--sgds-badge-bg:var(--sgds-danger-bg-subtle);--sgds-badge-color:var(--sgds-default-color-on-light);--sgds-badge-border-color:var(--sgds-warning-border-color-subtle)}:host([variant=neutral][outlined]){--sgds-badge-bg:var(--sgds-neutral-bg-subtle);--sgds-badge-color:var(--sgds-default-color-on-light);--sgds-badge-border-color:var(--sgds-neutral-border-color-subtle)}.badge{align-items:center;background-color:var(--sgds-badge-bg);border:var(--sgds-border-width-1) solid var(--sgds-default-border-color-transparent);border-radius:var(--sgds-badge-border-radius);color:var(--sgds-badge-color);display:inline-flex;font-size:var(--sgds-font-size-1);height:var(--sgds-dimension-24);justify-content:center;min-width:var(---sgds-dimension-24);padding:0 var(--sgds-padding-2-xs)}.badge.outlined{border:var(--sgds-border-width-1) solid var(--sgds-badge-border-color)}.badge-label{padding:0 var(--sgds-padding-2-xs)}.badge-dismissible{padding-right:0}.badge-dimissible sgds-close-button{--sgds-close-btn-border-radius:var(--sgds-badge-border-radius)}slot[name=icon]::slotted(*){color:var(--sgds-badge-color)}slot::slotted(*){font-size:14px;font-weight:400}`;
|
|
6729
6835
|
|
|
6730
6836
|
/**
|
|
6731
6837
|
* @summary Badges can be used to highlight important bits of information such as labels, notifications & status.
|
|
6732
6838
|
*
|
|
6733
6839
|
* @slot default - slot for badge
|
|
6734
|
-
* @slot
|
|
6735
|
-
* @slot rightIcon - The slot for icon to the right of the badge text
|
|
6840
|
+
* @slot icon - The slot for icon to the left of the badge text
|
|
6736
6841
|
*
|
|
6737
6842
|
* @event sgds-show - Emitted when the badge appears.
|
|
6738
6843
|
* @event sgds-hide - Emitted after the badge closes.
|
|
@@ -6740,13 +6845,13 @@
|
|
|
6740
6845
|
class SgdsBadge extends ScopedElementsMixin(SgdsElement) {
|
|
6741
6846
|
constructor() {
|
|
6742
6847
|
super(...arguments);
|
|
6743
|
-
/** Controls the appearance of the
|
|
6848
|
+
/** Controls the appearance of the dismissible badge. This prop only applies when dismissible is true */
|
|
6744
6849
|
this.show = false;
|
|
6745
|
-
/** One or more button variant combinations buttons may be one of a variety of visual variants such as: `
|
|
6850
|
+
/** One or more button variant combinations buttons may be one of a variety of visual variants such as: `info`, `success`, `danger`, `warning`, 'neutral' */
|
|
6746
6851
|
this.variant = "info";
|
|
6747
6852
|
/** Manually set the outlined state to false */
|
|
6748
6853
|
this.outlined = false;
|
|
6749
|
-
/** Manually set the
|
|
6854
|
+
/** Manually set the dismissible state of the button to `false` */
|
|
6750
6855
|
this.dismissible = false;
|
|
6751
6856
|
}
|
|
6752
6857
|
/**@internal */
|
|
@@ -6776,7 +6881,7 @@
|
|
|
6776
6881
|
"
|
|
6777
6882
|
aria-hidden=${this.show ? "false" : "true"}
|
|
6778
6883
|
>
|
|
6779
|
-
${!this.dismissible ? html$1 `<slot name="
|
|
6884
|
+
${!this.dismissible ? html$1 `<slot name="icon"></slot>` : nothing}
|
|
6780
6885
|
<span class="badge-label">
|
|
6781
6886
|
<slot></slot>
|
|
6782
6887
|
</span>
|
|
@@ -6794,7 +6899,7 @@
|
|
|
6794
6899
|
: nothing;
|
|
6795
6900
|
}
|
|
6796
6901
|
}
|
|
6797
|
-
SgdsBadge.styles = [...SgdsElement.styles, css_248z$
|
|
6902
|
+
SgdsBadge.styles = [...SgdsElement.styles, css_248z$L];
|
|
6798
6903
|
__decorate([
|
|
6799
6904
|
property({ type: Boolean, reflect: true })
|
|
6800
6905
|
], SgdsBadge.prototype, "show", void 0);
|
|
@@ -6813,7 +6918,7 @@
|
|
|
6813
6918
|
|
|
6814
6919
|
customElements.define("sgds-badge", SgdsBadge);
|
|
6815
6920
|
|
|
6816
|
-
var css_248z$
|
|
6921
|
+
var css_248z$K = css`.breadcrumb{display:flex;flex-wrap:wrap;list-style:none;margin:0;padding:var(--sgds-spacer-0) var(--sgds-spacer-0)}`;
|
|
6817
6922
|
|
|
6818
6923
|
/**
|
|
6819
6924
|
* @summary Breadcrumbs help users to navigate and understand where they are on the current website or service.
|
|
@@ -6876,7 +6981,7 @@
|
|
|
6876
6981
|
`;
|
|
6877
6982
|
}
|
|
6878
6983
|
}
|
|
6879
|
-
SgdsBreadcrumb.styles = [...SgdsElement.styles, css_248z$
|
|
6984
|
+
SgdsBreadcrumb.styles = [...SgdsElement.styles, css_248z$K];
|
|
6880
6985
|
__decorate([
|
|
6881
6986
|
property({ type: String })
|
|
6882
6987
|
], SgdsBreadcrumb.prototype, "ariaLabel", void 0);
|
|
@@ -6887,7 +6992,7 @@
|
|
|
6887
6992
|
query('slot[name="separator"]')
|
|
6888
6993
|
], SgdsBreadcrumb.prototype, "separatorSlot", void 0);
|
|
6889
6994
|
|
|
6890
|
-
var css_248z$
|
|
6995
|
+
var css_248z$J = css`:host{font-size:var(--sgds-body-font-size)}slot[name=separator]::slotted(*){color:var(--sgds-body-color);padding-left:var(--sgds-spacer-3);padding-right:var(--sgds-spacer-3)}:host(:last-of-type) .breadcrumb-item__separator{display:none}.breadcrumb-item.active{color:var(--sgds-body-color)}`;
|
|
6891
6996
|
|
|
6892
6997
|
/**
|
|
6893
6998
|
* @summary Breadcrumb Item are navigational links used in Breadcrumb component
|
|
@@ -6931,7 +7036,7 @@
|
|
|
6931
7036
|
`;
|
|
6932
7037
|
}
|
|
6933
7038
|
}
|
|
6934
|
-
SgdsBreadcrumbItem.styles = [...SgdsElement.styles, css_248z$
|
|
7039
|
+
SgdsBreadcrumbItem.styles = [...SgdsElement.styles, css_248z$M, css_248z$J];
|
|
6935
7040
|
__decorate([
|
|
6936
7041
|
property({ type: String, reflect: true })
|
|
6937
7042
|
], SgdsBreadcrumbItem.prototype, "href", void 0);
|
|
@@ -6945,7 +7050,7 @@
|
|
|
6945
7050
|
customElements.define("sgds-breadcrumb", SgdsBreadcrumb);
|
|
6946
7051
|
customElements.define("sgds-breadcrumb-item", SgdsBreadcrumbItem);
|
|
6947
7052
|
|
|
6948
|
-
var css_248z$
|
|
7053
|
+
var css_248z$I = css`:host{--sgds-btn-font-weight:var(--sgds-font-weight-regular);--sgds-btn-bg:var(--sgds-primary-bg);--sgds-btn-hover-bg:var(--sgds-primary-bg-emphasis);--sgds-btn-border-radius:var(--sgds-border-radius-md)}:host([variant=primary]){--sgds-btn-bg:var(--sgds-primary-bg);--sgds-btn-color:var(--sgds-default-color-on-dark)}:host([variant=outline]){--sgds-btn-bg:var(--sgds-default-bg-transparent);--sgds-btn-hover-bg:var(--sgds-primary-bg-translucent);--sgds-btn-color:var(--sgds-primary-color);--sgds-btn-border-width:var(--sgds-border-width-1);--sgds-btn-border-color:var(--sgds-primary-border-color)}:host([variant=ghost]){--sgds-btn-bg:var(--sgds-default-bg-transparent);--sgds-btn-hover-bg:var(--sgds-primary-bg-translucent);--sgds-btn-color:var(--sgds-primary-color)}:host([variant=danger]){--sgds-btn-bg:var(--sgds-danger-bg);--sgds-btn-hover-bg:var(--sgds-danger-bg-emphasis);--sgds-btn-color:var(--sgds-default-color-on-dark)}.btn{align-items:center;background-color:var(--sgds-btn-bg);border:1px solid var(--sgds-default-border-color-transparent);border-radius:var(--sgds-btn-border-radius);color:var(--sgds-default-color-on-dark);cursor:pointer;display:inline-flex;font-size:var(--sgds-font-size-2);font-weight:var(--sgds-btn-font-weight);gap:var(--sgds-gap-2-xs);height:var(--sgds-dimension-48);justify-content:center;line-height:var(--sgds-line-height-md);min-width:var(--sgds-dimension-96);padding:0 var(--sgds-padding-lg);text-align:center;text-decoration:none;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;user-select:none;vertical-align:middle}.btn-ghost,.btn-outline,.btn-primary{color:var(--sgds-btn-color)}.btn-outline{border:var(--sgds-btn-border-width) solid var(--sgds-btn-border-color)}@media (prefers-reduced-motion:reduce){.btn{transition:none}}.btn.active,.btn:hover{background-color:var(--sgds-btn-hover-bg)}.btn:focus,.btn:focus-visible{background-color:var(--sgds-btn-hover-bg);border-color:transparent;box-shadow:var(--sgds-box-shadow-focus);outline:0}.btn.disabled,.btn:disabled{color:var(--sgds-btn-color);opacity:var(--sgds-opacity-50);pointer-events:none}.btn-lg{font-size:var(--sgds-font-size-3);height:var(--sgds-dimension-56);min-width:var(--sgds-dimension-112);padding:0 var(--sgds-padding-xl)}.btn-sm{font-size:var(--sgds-font-size-1);height:var(--sgds-dimension-40);min-width:var(--sgds-dimension-80);padding:0 var(--sgds-padding-md)}.btn slot::slotted(*){color:var(--sgds-btn-color)}`;
|
|
6949
7054
|
|
|
6950
7055
|
class ButtonElement extends SgdsElement {
|
|
6951
7056
|
constructor() {
|
|
@@ -6987,7 +7092,7 @@
|
|
|
6987
7092
|
}
|
|
6988
7093
|
}
|
|
6989
7094
|
}
|
|
6990
|
-
ButtonElement.styles = [...SgdsElement.styles, css_248z$
|
|
7095
|
+
ButtonElement.styles = [...SgdsElement.styles, css_248z$I];
|
|
6991
7096
|
__decorate([
|
|
6992
7097
|
query(".btn")
|
|
6993
7098
|
], ButtonElement.prototype, "button", void 0);
|
|
@@ -7016,7 +7121,64 @@
|
|
|
7016
7121
|
property({ type: String })
|
|
7017
7122
|
], ButtonElement.prototype, "ariaLabel", void 0);
|
|
7018
7123
|
|
|
7019
|
-
|
|
7124
|
+
/**
|
|
7125
|
+
* A controller to help with form submission
|
|
7126
|
+
*/
|
|
7127
|
+
class FormSubmitController {
|
|
7128
|
+
constructor(host, options) {
|
|
7129
|
+
(this.host = host).addController(this);
|
|
7130
|
+
this.options = Object.assign({ form: (input) => {
|
|
7131
|
+
return input.closest("form");
|
|
7132
|
+
} }, options);
|
|
7133
|
+
}
|
|
7134
|
+
hostConnected() {
|
|
7135
|
+
this.form = this.options.form(this.host);
|
|
7136
|
+
}
|
|
7137
|
+
hostDisconnected() {
|
|
7138
|
+
if (this.form) {
|
|
7139
|
+
this.form = undefined;
|
|
7140
|
+
}
|
|
7141
|
+
}
|
|
7142
|
+
/**
|
|
7143
|
+
* Creates a temporary native HTML button that can participate in form and invoke form submits and reset
|
|
7144
|
+
* Button is removed once action is performed
|
|
7145
|
+
*/
|
|
7146
|
+
doAction(type, invoker) {
|
|
7147
|
+
if (this.form) {
|
|
7148
|
+
const button = document.createElement("button");
|
|
7149
|
+
button.type = type;
|
|
7150
|
+
button.style.position = "absolute";
|
|
7151
|
+
button.style.width = "0";
|
|
7152
|
+
button.style.height = "0";
|
|
7153
|
+
button.style.clipPath = "inset(50%)";
|
|
7154
|
+
button.style.overflow = "hidden";
|
|
7155
|
+
button.style.whiteSpace = "nowrap";
|
|
7156
|
+
// Pass form attributes through to the temporary button
|
|
7157
|
+
if (invoker) {
|
|
7158
|
+
["formaction", "formmethod", "formnovalidate", "formtarget"].forEach(attr => {
|
|
7159
|
+
if (invoker.hasAttribute(attr)) {
|
|
7160
|
+
button.setAttribute(attr, invoker.getAttribute(attr));
|
|
7161
|
+
}
|
|
7162
|
+
});
|
|
7163
|
+
}
|
|
7164
|
+
this.form.append(button);
|
|
7165
|
+
button.click();
|
|
7166
|
+
button.remove();
|
|
7167
|
+
}
|
|
7168
|
+
}
|
|
7169
|
+
/** Resets the form, restoring all the control to their default value */
|
|
7170
|
+
reset(invoker) {
|
|
7171
|
+
this.doAction("reset", invoker);
|
|
7172
|
+
}
|
|
7173
|
+
/** Submits the form, triggering validation and form data injection. */
|
|
7174
|
+
submit(invoker) {
|
|
7175
|
+
// Calling form.submit() bypasses the submit event and constraint validation. To prevent this, we can inject a
|
|
7176
|
+
// native submit button into the form, "click" it, then remove it to simulate a standard form submission.
|
|
7177
|
+
this.doAction("submit", invoker);
|
|
7178
|
+
}
|
|
7179
|
+
}
|
|
7180
|
+
|
|
7181
|
+
var css_248z$H = css`:host{display:inline-flex}.btn.full-width,:host([fullWidth]){max-width:var(--sgds-dimension-320);width:100%}.btn.full-width.has-left-icon{justify-content:flex-start}.btn.full-width.has-right-icon{justify-content:space-between}.btn.full-width.has-left-icon.has-right-icon{justify-content:center}.btn span{padding:0 var(--sgds-padding-2-xs)}`;
|
|
7020
7182
|
|
|
7021
7183
|
/**
|
|
7022
7184
|
* @summary Custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more.
|
|
@@ -7120,7 +7282,7 @@
|
|
|
7120
7282
|
`;
|
|
7121
7283
|
}
|
|
7122
7284
|
}
|
|
7123
|
-
SgdsButton.styles = [...ButtonElement.styles, css_248z$
|
|
7285
|
+
SgdsButton.styles = [...ButtonElement.styles, css_248z$M, css_248z$H];
|
|
7124
7286
|
__decorate([
|
|
7125
7287
|
state()
|
|
7126
7288
|
], SgdsButton.prototype, "_hasLeftIcon", void 0);
|
|
@@ -7151,7 +7313,7 @@
|
|
|
7151
7313
|
|
|
7152
7314
|
customElements.define("sgds-button", SgdsButton);
|
|
7153
7315
|
|
|
7154
|
-
var css_248z$
|
|
7316
|
+
var css_248z$G = css`::slotted(.stretched-link):before{bottom:0;content:"";left:0;position:absolute;right:0;top:0;z-index:1}`;
|
|
7155
7317
|
|
|
7156
7318
|
/**
|
|
7157
7319
|
* @summary Cards can be used for headers and footers, a wide variety of content, contain contextual background colors and images.
|
|
@@ -7214,7 +7376,7 @@
|
|
|
7214
7376
|
`;
|
|
7215
7377
|
}
|
|
7216
7378
|
}
|
|
7217
|
-
SgdsCard.styles = [...CardElement.styles, css_248z$
|
|
7379
|
+
SgdsCard.styles = [...CardElement.styles, css_248z$G];
|
|
7218
7380
|
__decorate([
|
|
7219
7381
|
property({ type: Boolean })
|
|
7220
7382
|
], SgdsCard.prototype, "stretchedLink", void 0);
|
|
@@ -10851,7 +11013,7 @@
|
|
|
10851
11013
|
property({ type: String, reflect: true })
|
|
10852
11014
|
], LinkElement.prototype, "target", void 0);
|
|
10853
11015
|
|
|
10854
|
-
var css_248z$
|
|
11016
|
+
var css_248z$F = css`.input-group.has-validation>.dropdown-toggle:nth-last-child(n+4),.input-group.has-validation>:nth-last-child(n+3):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating),.input-group:not(.has-validation)>.dropdown-toggle:nth-last-child(n+3),.input-group:not(.has-validation)>:not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating){border-bottom-right-radius:0;border-top-right-radius:0}.input-group>:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback){border-bottom-left-radius:0;border-top-left-radius:0;margin-left:-1px}.dropdown,.dropdown-center{position:relative}.dropdown-toggle{white-space:nowrap}.dropdown-toggle:after{border-bottom:0;border-left:.3em solid transparent;border-right:.3em solid transparent;border-top:.3em solid;content:"";display:inline-block;margin-left:.255em;vertical-align:.255em}.dropdown-toggle:empty:after{margin-left:0}.dropdown-divider{--sgds-dropdown-divider-bg:var(--sgds-border-color-translucent);--sgds-dropdown-divider-margin-y:0.5rem;border-top:1px solid var(--sgds-dropdown-divider-bg);height:0;margin:var(--sgds-dropdown-divider-margin-y) 0;opacity:1;overflow:hidden}.dropdown-item{--sgds-dropdown-item-active-color:#fff;--sgds-dropdown-item-active-bg:var(--sgds-info);--sgds-dropdown-item-disabled-color:var(--sgds-gray-500);background-color:var(--sgds-default-bg-transparent);clear:both;color:var(--sgds-default-color);display:block;padding:var(--sgds-padding-xs) var(--sgds-padding-lg);text-align:inherit;text-decoration:none;white-space:nowrap}.dropdown-item:hover{background-color:var(--sgds-default-bg-translucent-subtle)}.dropdown-item:focus,.dropdown-item:focus-visible{background-color:var(--sgds-default-bg-translucent-subtle);box-shadow:inset var(--sgds-form-box-shadow-focus);outline:0}.dropdown-item.active,.dropdown-item:active{background-color:var(--sgds-primary-bg-translucent);color:var(--sgds-primary-color);text-decoration:none}.dropdown-item.disabled,.dropdown-item:disabled{opacity:var(--sgds-opacity-50);pointer-events:none}.dropdown-item-label{align-items:center;display:flex;gap:var(--sgds-gap-sm);padding:var(--sgds-padding-2-xs) 0}.active-icon{margin-left:auto}.dropdown-header{--sgds-dropdown-header-color:#5d5d5d;--sgds-dropdown-header-padding-x:1rem;--sgds-dropdown-header-padding-y:0.5rem;color:var(--sgds-dropdown-header-color);display:block;font-size:.875rem;margin-bottom:0;padding:var(--sgds-dropdown-header-padding-y) var(--sgds-dropdown-header-padding-x);white-space:nowrap}.sgds.dropdown .dropdown-toggle{align-items:center;gap:.5rem;justify-content:space-between}.sgds.dropdown .dropdown-toggle:after{content:none}.sgds.dropdown-menu li a.dropdown-item{padding:1rem}.sgds.dropdown-menu li a.dropdown-item.active,.sgds.dropdown-menu li a.dropdown-item:hover{background-color:#0950df;color:#fff}.btn-group>.btn.dropdown-toggle-split:first-child,.btn-group>.btn:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-top-right-radius:0}.dropdown-toggle-split{padding-left:.75rem;padding-right:.75rem}.dropdown-toggle-split:after{margin-left:0}.btn-group-sm>.btn+.dropdown-toggle-split,.btn-sm+.dropdown-toggle-split{padding-left:.375rem;padding-right:.375rem}.btn-group-lg>.btn+.dropdown-toggle-split,.btn-lg+.dropdown-toggle-split{padding-left:.75rem;padding-right:.75rem}.btn-group-vertical>.btn:not(:last-child):not(.dropdown-toggle){border-bottom-left-radius:0;border-bottom-right-radius:0}.sgds.navbar .nav-item a.nav-link.dropdown-toggle{gap:.75rem}.sgds.navbar .nav-item a.nav-link.dropdown-toggle.show{border-bottom:.125rem solid #9182e8;color:#9182e8}`;
|
|
10855
11017
|
|
|
10856
11018
|
/**
|
|
10857
11019
|
* @summary `SgdsDropdownItem` are navigation links built with `HTMLAnchorElement`. It should be used in the default slot of `SgdsDropdown`
|
|
@@ -10873,165 +11035,37 @@
|
|
|
10873
11035
|
class="dropdown-item ${classMap({
|
|
10874
11036
|
disabled: this.disabled,
|
|
10875
11037
|
active: this.active
|
|
10876
|
-
})}"
|
|
10877
|
-
?disabled=${this.disabled}
|
|
10878
|
-
aria-disabled=${this.disabled ? "true" : "false"}
|
|
10879
|
-
role="menuitem"
|
|
10880
|
-
tabindex=${this.disabled ? "-1" : "0"}
|
|
10881
|
-
target=${this.target}
|
|
10882
|
-
>
|
|
10883
|
-
<div class="dropdown-item-label">
|
|
10884
|
-
<slot></slot>
|
|
10885
|
-
${this.active
|
|
10886
|
-
? html$1 `<div class="active-icon">
|
|
10887
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="14" viewBox="0 0 18 14" fill="none">
|
|
10888
|
-
<path
|
|
10889
|
-
d="M17.7701 0.968446C17.843 1.04113 17.9008 1.12748 17.9402 1.22255C17.9797 1.31762 18 1.41953 18 1.52246C18 1.62539 17.9797 1.7273 17.9402 1.82237C17.9008 1.91744 17.843 2.00379 17.7701 2.07647L6.81504 13.0315C6.74235 13.1044 6.656 13.1622 6.56094 13.2017C6.46587 13.2411 6.36395 13.2614 6.26103 13.2614C6.1581 13.2614 6.05619 13.2411 5.96112 13.2017C5.86605 13.1622 5.7797 13.1044 5.70701 13.0315L0.22948 7.55401C0.0825462 7.40707 0 7.20779 0 6.99999C0 6.7922 0.0825462 6.59291 0.22948 6.44598C0.376413 6.29905 0.575698 6.2165 0.783493 6.2165C0.991289 6.2165 1.19057 6.29905 1.33751 6.44598L6.26103 11.3711L16.6621 0.968446C16.7348 0.895574 16.8211 0.837758 16.9162 0.79831C17.0113 0.758862 17.1132 0.738556 17.2161 0.738556C17.319 0.738556 17.4209 0.758862 17.516 0.79831C17.6111 0.837758 17.6974 0.895574 17.7701 0.968446Z"
|
|
10890
|
-
fill="#5A42C0"
|
|
10891
|
-
/>
|
|
10892
|
-
</svg>
|
|
10893
|
-
</div>`
|
|
10894
|
-
: nothing}
|
|
10895
|
-
</div>
|
|
10896
|
-
</a>
|
|
10897
|
-
</div>
|
|
10898
|
-
`;
|
|
10899
|
-
}
|
|
10900
|
-
}
|
|
10901
|
-
SgdsDropdownItem.styles = [css_248z$H];
|
|
10902
|
-
__decorate([
|
|
10903
|
-
query("a")
|
|
10904
|
-
], SgdsDropdownItem.prototype, "anchor", void 0);
|
|
10905
|
-
|
|
10906
|
-
/**
|
|
10907
|
-
* @license
|
|
10908
|
-
* Copyright 2017 Google LLC
|
|
10909
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
10910
|
-
*/
|
|
10911
|
-
const HTML_RESULT = 1;
|
|
10912
|
-
class UnsafeHTMLDirective extends Directive {
|
|
10913
|
-
constructor(partInfo) {
|
|
10914
|
-
super(partInfo);
|
|
10915
|
-
this._value = nothing;
|
|
10916
|
-
if (partInfo.type !== PartType.CHILD) {
|
|
10917
|
-
throw new Error(`${this.constructor.directiveName}() can only be used in child bindings`);
|
|
10918
|
-
}
|
|
10919
|
-
}
|
|
10920
|
-
render(value) {
|
|
10921
|
-
if (value === nothing || value == null) {
|
|
10922
|
-
this._templateResult = undefined;
|
|
10923
|
-
return (this._value = value);
|
|
10924
|
-
}
|
|
10925
|
-
if (value === noChange) {
|
|
10926
|
-
return value;
|
|
10927
|
-
}
|
|
10928
|
-
if (typeof value != 'string') {
|
|
10929
|
-
throw new Error(`${this.constructor.directiveName}() called with a non-string value`);
|
|
10930
|
-
}
|
|
10931
|
-
if (value === this._value) {
|
|
10932
|
-
return this._templateResult;
|
|
10933
|
-
}
|
|
10934
|
-
this._value = value;
|
|
10935
|
-
const strings = [value];
|
|
10936
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10937
|
-
strings.raw = strings;
|
|
10938
|
-
// WARNING: impersonating a TemplateResult like this is extremely
|
|
10939
|
-
// dangerous. Third-party directives should not do this.
|
|
10940
|
-
return (this._templateResult = {
|
|
10941
|
-
// Cast to a known set of integers that satisfy ResultType so that we
|
|
10942
|
-
// don't have to export ResultType and possibly encourage this pattern.
|
|
10943
|
-
// This property needs to remain unminified.
|
|
10944
|
-
['_$litType$']: this.constructor
|
|
10945
|
-
.resultType,
|
|
10946
|
-
strings,
|
|
10947
|
-
values: [],
|
|
10948
|
-
});
|
|
10949
|
-
}
|
|
10950
|
-
}
|
|
10951
|
-
UnsafeHTMLDirective.directiveName = 'unsafeHTML';
|
|
10952
|
-
UnsafeHTMLDirective.resultType = HTML_RESULT;
|
|
10953
|
-
|
|
10954
|
-
/**
|
|
10955
|
-
* @license
|
|
10956
|
-
* Copyright 2017 Google LLC
|
|
10957
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
10958
|
-
*/
|
|
10959
|
-
const SVG_RESULT = 2;
|
|
10960
|
-
class UnsafeSVGDirective extends UnsafeHTMLDirective {
|
|
10961
|
-
}
|
|
10962
|
-
UnsafeSVGDirective.directiveName = 'unsafeSVG';
|
|
10963
|
-
UnsafeSVGDirective.resultType = SVG_RESULT;
|
|
10964
|
-
/**
|
|
10965
|
-
* Renders the result as SVG, rather than text.
|
|
10966
|
-
*
|
|
10967
|
-
* The values `undefined`, `null`, and `nothing`, will all result in no content
|
|
10968
|
-
* (empty string) being rendered.
|
|
10969
|
-
*
|
|
10970
|
-
* Note, this is unsafe to use with any user-provided input that hasn't been
|
|
10971
|
-
* sanitized or escaped, as it may lead to cross-site-scripting
|
|
10972
|
-
* vulnerabilities.
|
|
10973
|
-
*/
|
|
10974
|
-
const unsafeSVG = directive(UnsafeSVGDirective);
|
|
10975
|
-
|
|
10976
|
-
var css_248z$G = css`.invalid-feedback-container{display:flex;gap:var(--sgds-form-gap-sm)}.invalid-feedback{color:var(--sgds-form-danger-color);font-size:var(--sgds-font-size-1);font-weight:var(--sgds-font-weight-regular)}`;
|
|
10977
|
-
|
|
10978
|
-
var css_248z$F = css`.form-text{color:var(--sgds-form-color-subtle);font-size:var(--sgds-font-size-1)}`;
|
|
10979
|
-
|
|
10980
|
-
var css_248z$E = css`.form-control::placeholder{color:var(--sgds-form-color-subtle);font-family:var(--sgds-font-family-brand);font-weight:var(--sgds-font-weight-light);line-height:var(--sgds-line-height-heading)}`;
|
|
10981
|
-
|
|
10982
|
-
class FormControlElement extends SgdsElement {
|
|
10983
|
-
constructor() {
|
|
10984
|
-
super(...arguments);
|
|
10985
|
-
/** The input's label */
|
|
10986
|
-
this.label = "";
|
|
10987
|
-
/** The input's hint text */
|
|
10988
|
-
this.hintText = "";
|
|
10989
|
-
/** Disables the input. */
|
|
10990
|
-
this.disabled = false;
|
|
10991
|
-
/** Allows invalidFeedback, invalid and valid styles to be visible with the input */
|
|
10992
|
-
this.hasFeedback = false;
|
|
10993
|
-
/**Feedback text for error state when validated */
|
|
10994
|
-
this.invalidFeedback = "";
|
|
10995
|
-
/** Marks the component as invalid. Replace the pseudo :invalid selector for absent in custom elements */
|
|
10996
|
-
this.invalid = false;
|
|
10997
|
-
/** Makes the input a required field. */
|
|
10998
|
-
this.required = false;
|
|
10999
|
-
this.labelId = genId("label");
|
|
11038
|
+
})}"
|
|
11039
|
+
?disabled=${this.disabled}
|
|
11040
|
+
aria-disabled=${this.disabled ? "true" : "false"}
|
|
11041
|
+
role="menuitem"
|
|
11042
|
+
tabindex=${this.disabled ? "-1" : "0"}
|
|
11043
|
+
target=${this.target}
|
|
11044
|
+
>
|
|
11045
|
+
<div class="dropdown-item-label">
|
|
11046
|
+
<slot></slot>
|
|
11047
|
+
${this.active
|
|
11048
|
+
? html$1 `<div class="active-icon">
|
|
11049
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="14" viewBox="0 0 18 14" fill="none">
|
|
11050
|
+
<path
|
|
11051
|
+
d="M17.7701 0.968446C17.843 1.04113 17.9008 1.12748 17.9402 1.22255C17.9797 1.31762 18 1.41953 18 1.52246C18 1.62539 17.9797 1.7273 17.9402 1.82237C17.9008 1.91744 17.843 2.00379 17.7701 2.07647L6.81504 13.0315C6.74235 13.1044 6.656 13.1622 6.56094 13.2017C6.46587 13.2411 6.36395 13.2614 6.26103 13.2614C6.1581 13.2614 6.05619 13.2411 5.96112 13.2017C5.86605 13.1622 5.7797 13.1044 5.70701 13.0315L0.22948 7.55401C0.0825462 7.40707 0 7.20779 0 6.99999C0 6.7922 0.0825462 6.59291 0.22948 6.44598C0.376413 6.29905 0.575698 6.2165 0.783493 6.2165C0.991289 6.2165 1.19057 6.29905 1.33751 6.44598L6.26103 11.3711L16.6621 0.968446C16.7348 0.895574 16.8211 0.837758 16.9162 0.79831C17.0113 0.758862 17.1132 0.738556 17.2161 0.738556C17.319 0.738556 17.4209 0.758862 17.516 0.79831C17.6111 0.837758 17.6974 0.895574 17.7701 0.968446Z"
|
|
11052
|
+
fill="#5A42C0"
|
|
11053
|
+
/>
|
|
11054
|
+
</svg>
|
|
11055
|
+
</div>`
|
|
11056
|
+
: nothing}
|
|
11057
|
+
</div>
|
|
11058
|
+
</a>
|
|
11059
|
+
</div>
|
|
11060
|
+
`;
|
|
11000
11061
|
}
|
|
11001
11062
|
}
|
|
11002
|
-
|
|
11003
|
-
__decorate([
|
|
11004
|
-
property({ reflect: true })
|
|
11005
|
-
], FormControlElement.prototype, "label", void 0);
|
|
11006
|
-
__decorate([
|
|
11007
|
-
property({ reflect: true })
|
|
11008
|
-
], FormControlElement.prototype, "hintText", void 0);
|
|
11009
|
-
__decorate([
|
|
11010
|
-
property({ reflect: true })
|
|
11011
|
-
], FormControlElement.prototype, "name", void 0);
|
|
11063
|
+
SgdsDropdownItem.styles = [css_248z$F];
|
|
11012
11064
|
__decorate([
|
|
11013
|
-
|
|
11014
|
-
],
|
|
11015
|
-
__decorate([
|
|
11016
|
-
property()
|
|
11017
|
-
], FormControlElement.prototype, "min", void 0);
|
|
11018
|
-
__decorate([
|
|
11019
|
-
property()
|
|
11020
|
-
], FormControlElement.prototype, "max", void 0);
|
|
11021
|
-
__decorate([
|
|
11022
|
-
property({ type: Boolean, reflect: true })
|
|
11023
|
-
], FormControlElement.prototype, "hasFeedback", void 0);
|
|
11024
|
-
__decorate([
|
|
11025
|
-
property({ type: String, reflect: true })
|
|
11026
|
-
], FormControlElement.prototype, "invalidFeedback", void 0);
|
|
11027
|
-
__decorate([
|
|
11028
|
-
property({ type: Boolean, reflect: true })
|
|
11029
|
-
], FormControlElement.prototype, "invalid", void 0);
|
|
11030
|
-
__decorate([
|
|
11031
|
-
property({ type: Boolean, reflect: true })
|
|
11032
|
-
], FormControlElement.prototype, "required", void 0);
|
|
11065
|
+
query("a")
|
|
11066
|
+
], SgdsDropdownItem.prototype, "anchor", void 0);
|
|
11033
11067
|
|
|
11034
|
-
var css_248z$
|
|
11068
|
+
var css_248z$E = css`:host{--sgds-spinner-bg:var(--sgds-primary-bg);display:inline-flex}:host([variant=neutral]){--sgds-spinner-bg:var(--sgds-neutral-color-emphasis)}.spinner-wrapper{align-items:center;display:flex;flex-direction:column;gap:var(--sgds-gap-2-xs)}.spinner{animation:spinner .75s linear infinite;border-radius:50%;border-right:.25em solid var(--sgds-alternate-bg);border:.25em solid var(--sgds-alternate-bg);border-right-color:var(--sgds-spinner-bg);color:var(--sgds-spinner-color);display:inline-flex;height:var(--sgds-dimension-32);width:var(--sgds-dimension-32)}.spinner-sm{height:var(--sgds-dimension-24);width:var(--sgds-dimension-24)}.spinner-lg{height:var(--sgds-dimension-48);width:var(--sgds-dimension-48)}.spinner-label{font-size:var(--sgds-font-size-1)}@media (prefers-reduced-motion:reduce){.spinner{animation-duration:1.5s}}
|
|
11035
11069
|
|
|
11036
11070
|
/*! CSS Used keyframes */@keyframes spinner{to{transform:rotate(1turn)}}.sr-only{clip:rect(0,0,0,0);border:0;height:1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}`;
|
|
11037
11071
|
|
|
@@ -11063,7 +11097,7 @@
|
|
|
11063
11097
|
`;
|
|
11064
11098
|
}
|
|
11065
11099
|
}
|
|
11066
|
-
SgdsSpinner.styles = [...SgdsElement.styles, css_248z$
|
|
11100
|
+
SgdsSpinner.styles = [...SgdsElement.styles, css_248z$10, css_248z$E];
|
|
11067
11101
|
__decorate([
|
|
11068
11102
|
property({ type: String, reflect: true })
|
|
11069
11103
|
], SgdsSpinner.prototype, "variant", void 0);
|
|
@@ -11074,7 +11108,7 @@
|
|
|
11074
11108
|
property({ reflect: true, type: String })
|
|
11075
11109
|
], SgdsSpinner.prototype, "label", void 0);
|
|
11076
11110
|
|
|
11077
|
-
var css_248z$
|
|
11111
|
+
var css_248z$D = css`.form-control-container{display:flex;flex-direction:column;gap:var(--sgds-form-gap-md)}.form-control-container.disabled{opacity:var(--sgds-opacity-50)}.form-control-group{align-items:center;background-color:var(--sgds-form-bg);border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color);border-radius:var(--sgds-form-border-radius-md);display:flex;gap:var(--sgds-form-gap-md);height:var(--sgds-dimension-48);justify-content:center;min-width:var(--sgds-dimension-256);padding:0 var(--sgds-form-padding-x);transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out;width:-webkit-fill-available;width:-moz-available}.form-control{appearance:none;background-clip:padding-box;background:none;border:none;color:var(--sgds-form-color);display:block;flex-grow:1;font-size:var(--sgds-font-size-2);line-height:var(--sgds-line-height-heading);outline:none;padding:0}.form-control-group>.form-control:focus{z-index:3}@media (prefers-reduced-motion:reduce){.form-control-group{transition:none}}.form-control-group.readonly{border-color:var(--sgds-form-border-color-muted)}.form-control-group:not(.disabled):not(.is-invalid):hover{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis)}.form-control-group:not(.disabled):not(.is-invalid):focus,.form-control-group:not(.disabled):not(.is-invalid):focus-within{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis);box-shadow:var(--sgds-form-box-shadow-focus);outline:0}.form-control-group.is-invalid{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-danger-border-color)}.form-control-group.disabled{background-color:var(--sgds-form-bg-muted)}:host(.quantity-toggle) input::-webkit-inner-spin-button{appearance:none;margin:0}:host(.quantity-toggle) input{text-align:center}.form-control-icon{align-items:center;display:flex;height:var(--sgds-form-icon-size-lg);justify-content:center;width:var(--sgds-form-icon-size-lg)}.form-control-prefix,.form-control-suffix{color:var(--sgds-form-color-subtle)}.form-control-group.quantity-toggle{padding:0}`;
|
|
11078
11112
|
|
|
11079
11113
|
/**
|
|
11080
11114
|
* @summary Text inputs allow your users to enter letters, numbers and symbols on a single line.
|
|
@@ -11083,14 +11117,13 @@
|
|
|
11083
11117
|
* @event sgds-input - Emitted when the control receives input and its value changes.
|
|
11084
11118
|
* @event sgds-focus - Emitted when input is in focus.
|
|
11085
11119
|
* @event sgds-blur - Emitted when input is not in focus.
|
|
11120
|
+
* @event sgds-invalid - Emitted when input is invalid
|
|
11121
|
+
* @event sgds-valid - Emitted when input is valid
|
|
11086
11122
|
*
|
|
11087
11123
|
*/
|
|
11088
|
-
class SgdsInput extends FormControlElement {
|
|
11124
|
+
class SgdsInput extends SgdsFormValidatorMixin(ScopedElementsMixin(FormControlElement)) {
|
|
11089
11125
|
constructor() {
|
|
11090
11126
|
super(...arguments);
|
|
11091
|
-
/**@internal */
|
|
11092
|
-
this.formSubmitController = new FormSubmitController(this);
|
|
11093
|
-
/** The type of input which works the same as HTMLInputElement */
|
|
11094
11127
|
this.type = "text";
|
|
11095
11128
|
/** The input's placeholder text. */
|
|
11096
11129
|
this.placeholder = "placeholder";
|
|
@@ -11098,16 +11131,17 @@
|
|
|
11098
11131
|
this.autofocus = false;
|
|
11099
11132
|
/** Makes the input readonly. */
|
|
11100
11133
|
this.readonly = false;
|
|
11101
|
-
/**The input's value attribute. */
|
|
11102
|
-
this.value = "";
|
|
11103
11134
|
/**Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */
|
|
11104
11135
|
this.defaultValue = "";
|
|
11105
11136
|
/** Marks the component as valid. */
|
|
11106
11137
|
this.valid = false;
|
|
11107
11138
|
/** Marks the component as loading. */
|
|
11108
11139
|
this.loading = false;
|
|
11109
|
-
|
|
11110
|
-
this.
|
|
11140
|
+
/** Makes the input a required field. */
|
|
11141
|
+
this.required = false;
|
|
11142
|
+
/**The input's value attribute. */
|
|
11143
|
+
this.value = "";
|
|
11144
|
+
this._isTouched = false;
|
|
11111
11145
|
}
|
|
11112
11146
|
/**@internal */
|
|
11113
11147
|
static get scopedElements() {
|
|
@@ -11123,60 +11157,79 @@
|
|
|
11123
11157
|
blur() {
|
|
11124
11158
|
this.input.blur();
|
|
11125
11159
|
}
|
|
11126
|
-
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
11127
|
-
reportValidity() {
|
|
11128
|
-
return this.input.reportValidity();
|
|
11129
|
-
}
|
|
11130
|
-
/** Sets a custom validation message. Pass an empty string to restore validity */
|
|
11131
|
-
setCustomValidity(err) {
|
|
11132
|
-
return this.input.setCustomValidity(err);
|
|
11133
|
-
}
|
|
11134
11160
|
/** Programatically sets the invalid state of the input. Pass in boolean value in the argument */
|
|
11135
11161
|
setInvalid(bool) {
|
|
11136
11162
|
this.invalid = bool;
|
|
11163
|
+
if (bool) {
|
|
11164
|
+
this.emit("sgds-invalid");
|
|
11165
|
+
}
|
|
11166
|
+
else {
|
|
11167
|
+
this.emit("sgds-valid");
|
|
11168
|
+
}
|
|
11137
11169
|
}
|
|
11138
|
-
|
|
11139
|
-
|
|
11170
|
+
/**
|
|
11171
|
+
* Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
|
|
11172
|
+
* 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
|
|
11173
|
+
*/
|
|
11174
|
+
reportValidity() {
|
|
11175
|
+
return this._mixinReportValidity();
|
|
11140
11176
|
}
|
|
11141
|
-
|
|
11142
|
-
|
|
11143
|
-
|
|
11177
|
+
/**
|
|
11178
|
+
* Checks for validity without any native error popup message
|
|
11179
|
+
*/
|
|
11180
|
+
checkValidity() {
|
|
11181
|
+
return this._mixinCheckValidity();
|
|
11182
|
+
}
|
|
11183
|
+
/**
|
|
11184
|
+
* Returns the ValidityState object
|
|
11185
|
+
*/
|
|
11186
|
+
get validity() {
|
|
11187
|
+
return this._mixinGetValidity();
|
|
11188
|
+
}
|
|
11189
|
+
/**
|
|
11190
|
+
* Returns the validation message based on the ValidityState
|
|
11191
|
+
*/
|
|
11192
|
+
get validationMessage() {
|
|
11193
|
+
return this._mixinGetValidationMessage();
|
|
11144
11194
|
}
|
|
11145
11195
|
_handleFocus() {
|
|
11146
11196
|
this.emit("sgds-focus");
|
|
11147
11197
|
}
|
|
11148
11198
|
_handleBlur() {
|
|
11199
|
+
this._isTouched = true;
|
|
11149
11200
|
this.emit("sgds-blur");
|
|
11150
11201
|
}
|
|
11151
|
-
|
|
11152
|
-
|
|
11153
|
-
|
|
11154
|
-
|
|
11155
|
-
|
|
11156
|
-
|
|
11157
|
-
|
|
11158
|
-
|
|
11159
|
-
|
|
11160
|
-
|
|
11161
|
-
|
|
11202
|
+
_handleClick() {
|
|
11203
|
+
this.focus();
|
|
11204
|
+
}
|
|
11205
|
+
_handleChange(e) {
|
|
11206
|
+
this.value = this.input.value;
|
|
11207
|
+
this.emit("sgds-change");
|
|
11208
|
+
super._mixinHandleChange(e);
|
|
11209
|
+
}
|
|
11210
|
+
_handleInputChange(e) {
|
|
11211
|
+
this.value = this.input.value;
|
|
11212
|
+
this.emit("sgds-input");
|
|
11213
|
+
super._mixinHandleInputChange(e);
|
|
11214
|
+
}
|
|
11215
|
+
/** @internal */
|
|
11216
|
+
_handleIsTouched() {
|
|
11217
|
+
if (this._isTouched) {
|
|
11218
|
+
this.setInvalid(!this._mixinCheckValidity());
|
|
11162
11219
|
}
|
|
11163
11220
|
}
|
|
11164
11221
|
_handleDisabledChange() {
|
|
11165
11222
|
// Disabled form controls are always valid, so we need to recheck validity when the state changes
|
|
11166
|
-
this.
|
|
11167
|
-
this.invalid = !this.input.checkValidity();
|
|
11168
|
-
}
|
|
11169
|
-
_handleValueChange() {
|
|
11170
|
-
this.invalid = !this.input.checkValidity();
|
|
11223
|
+
this.setInvalid(false);
|
|
11171
11224
|
}
|
|
11172
11225
|
_renderInput() {
|
|
11226
|
+
const wantFeedbackStyle = this.hasFeedback === "both" || this.hasFeedback === "style";
|
|
11173
11227
|
return html `
|
|
11174
11228
|
<div
|
|
11175
11229
|
class="form-control-group ${classMap({
|
|
11176
11230
|
disabled: this.disabled,
|
|
11177
11231
|
readonly: this.readonly,
|
|
11178
|
-
"is-invalid": this.invalid &&
|
|
11179
|
-
"quantity-toggle": this.classList.contains("quantity-toggle")
|
|
11232
|
+
"is-invalid": this.invalid && wantFeedbackStyle
|
|
11180
11233
|
})}"
|
|
11181
11234
|
@click=${this._handleClick}
|
|
11182
11235
|
>
|
|
@@ -11185,7 +11238,7 @@
|
|
|
11185
11238
|
<input
|
|
11186
11239
|
class="form-control"
|
|
11187
11240
|
type=${this.type}
|
|
11188
|
-
id=${this.
|
|
11241
|
+
id=${this._controlId}
|
|
11189
11242
|
name=${ifDefined(this.name)}
|
|
11190
11243
|
placeholder=${ifDefined(this.placeholder)}
|
|
11191
11244
|
aria-invalid=${this.invalid ? "true" : "false"}
|
|
@@ -11200,15 +11253,14 @@
|
|
|
11200
11253
|
min=${ifDefined(this.min)}
|
|
11201
11254
|
max=${ifDefined(this.max)}
|
|
11202
11255
|
step=${ifDefined(this.step)}
|
|
11203
|
-
@input=${() => this.
|
|
11204
|
-
@change=${() => this._handleChange(
|
|
11205
|
-
@keydown=${this._handleKeyDown}
|
|
11256
|
+
@input=${(e) => this._handleInputChange(e)}
|
|
11257
|
+
@change=${(e) => this._handleChange(e)}
|
|
11206
11258
|
@invalid=${() => this.setInvalid(true)}
|
|
11207
11259
|
@focus=${this._handleFocus}
|
|
11208
11260
|
@blur=${this._handleBlur}
|
|
11209
|
-
aria-describedby=${ifDefined(this.invalid && this.hasFeedback ? `${this.
|
|
11210
|
-
aria-labelledby="${this.
|
|
11211
|
-
? `${this.
|
|
11261
|
+
aria-describedby=${ifDefined(this.invalid && this.hasFeedback ? `${this._controlId}-invalid` : undefined)}
|
|
11262
|
+
aria-labelledby="${this._labelId} ${this._controlId}Help ${this.invalid && this.hasFeedback
|
|
11263
|
+
? `${this._controlId}-invalid`
|
|
11212
11264
|
: ""}"
|
|
11213
11265
|
/>
|
|
11214
11266
|
${this.loading ? html `<sgds-spinner size="sm"></sgds-spinner>` : nothing}
|
|
@@ -11225,7 +11277,8 @@
|
|
|
11225
11277
|
`;
|
|
11226
11278
|
}
|
|
11227
11279
|
_renderFeedback() {
|
|
11228
|
-
|
|
11280
|
+
const wantFeedbackText = this.hasFeedback === "both" || this.hasFeedback === "text";
|
|
11281
|
+
return this.invalid && wantFeedbackText
|
|
11229
11282
|
? html ` <div class="invalid-feedback-container">
|
|
11230
11283
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
11231
11284
|
<path
|
|
@@ -11233,15 +11286,17 @@
|
|
|
11233
11286
|
fill="#B90000"
|
|
11234
11287
|
/>
|
|
11235
11288
|
</svg>
|
|
11236
|
-
<div id="${this.
|
|
11289
|
+
<div id="${this._controlId}-invalid" class="invalid-feedback">
|
|
11290
|
+
${this.invalidFeedback ? this.invalidFeedback : this.input.validationMessage}
|
|
11291
|
+
</div>
|
|
11237
11292
|
</div>`
|
|
11238
11293
|
: html `${this._renderHintText()}`;
|
|
11239
11294
|
}
|
|
11240
11295
|
_renderLabel() {
|
|
11241
11296
|
const labelTemplate = html `
|
|
11242
11297
|
<label
|
|
11243
|
-
for=${this.
|
|
11244
|
-
id=${this.
|
|
11298
|
+
for=${this._controlId}
|
|
11299
|
+
id=${this._labelId}
|
|
11245
11300
|
class=${classMap({
|
|
11246
11301
|
"form-label": true,
|
|
11247
11302
|
required: this.required
|
|
@@ -11252,7 +11307,7 @@
|
|
|
11252
11307
|
return this.label && labelTemplate;
|
|
11253
11308
|
}
|
|
11254
11309
|
_renderHintText() {
|
|
11255
|
-
const hintTextTemplate = html ` <div id="${this.
|
|
11310
|
+
const hintTextTemplate = html ` <div id="${this._controlId}Help" class="form-text">${this.hintText}</div> `;
|
|
11256
11311
|
return this.hintText && hintTextTemplate;
|
|
11257
11312
|
}
|
|
11258
11313
|
render() {
|
|
@@ -11267,10 +11322,7 @@
|
|
|
11267
11322
|
`;
|
|
11268
11323
|
}
|
|
11269
11324
|
}
|
|
11270
|
-
SgdsInput.styles = [...FormControlElement.styles, css_248z$
|
|
11271
|
-
__decorate([
|
|
11272
|
-
query("input.form-control")
|
|
11273
|
-
], SgdsInput.prototype, "input", void 0);
|
|
11325
|
+
SgdsInput.styles = [...FormControlElement.styles, css_248z$U, css_248z$D];
|
|
11274
11326
|
__decorate([
|
|
11275
11327
|
property({ reflect: true })
|
|
11276
11328
|
], SgdsInput.prototype, "type", void 0);
|
|
@@ -11289,6 +11341,12 @@
|
|
|
11289
11341
|
__decorate([
|
|
11290
11342
|
property({ type: Number, reflect: true })
|
|
11291
11343
|
], SgdsInput.prototype, "maxlength", void 0);
|
|
11344
|
+
__decorate([
|
|
11345
|
+
property()
|
|
11346
|
+
], SgdsInput.prototype, "min", void 0);
|
|
11347
|
+
__decorate([
|
|
11348
|
+
property()
|
|
11349
|
+
], SgdsInput.prototype, "max", void 0);
|
|
11292
11350
|
__decorate([
|
|
11293
11351
|
property({ type: String, reflect: true })
|
|
11294
11352
|
], SgdsInput.prototype, "placeholder", void 0);
|
|
@@ -11305,8 +11363,11 @@
|
|
|
11305
11363
|
property()
|
|
11306
11364
|
], SgdsInput.prototype, "step", void 0);
|
|
11307
11365
|
__decorate([
|
|
11308
|
-
property({ reflect: true })
|
|
11309
|
-
], SgdsInput.prototype, "
|
|
11366
|
+
property({ type: String, reflect: true })
|
|
11367
|
+
], SgdsInput.prototype, "hasFeedback", void 0);
|
|
11368
|
+
__decorate([
|
|
11369
|
+
property({ type: String, reflect: true })
|
|
11370
|
+
], SgdsInput.prototype, "invalidFeedback", void 0);
|
|
11310
11371
|
__decorate([
|
|
11311
11372
|
defaultValue()
|
|
11312
11373
|
], SgdsInput.prototype, "defaultValue", void 0);
|
|
@@ -11316,16 +11377,25 @@
|
|
|
11316
11377
|
__decorate([
|
|
11317
11378
|
property({ type: Boolean, reflect: true })
|
|
11318
11379
|
], SgdsInput.prototype, "loading", void 0);
|
|
11380
|
+
__decorate([
|
|
11381
|
+
property({ type: Boolean, reflect: true })
|
|
11382
|
+
], SgdsInput.prototype, "required", void 0);
|
|
11383
|
+
__decorate([
|
|
11384
|
+
property({ reflect: true })
|
|
11385
|
+
], SgdsInput.prototype, "value", void 0);
|
|
11386
|
+
__decorate([
|
|
11387
|
+
state()
|
|
11388
|
+
], SgdsInput.prototype, "_isTouched", void 0);
|
|
11389
|
+
__decorate([
|
|
11390
|
+
watch("_isTouched", { waitUntilFirstUpdate: true })
|
|
11391
|
+
], SgdsInput.prototype, "_handleIsTouched", null);
|
|
11319
11392
|
__decorate([
|
|
11320
11393
|
watch("disabled", { waitUntilFirstUpdate: true })
|
|
11321
11394
|
], SgdsInput.prototype, "_handleDisabledChange", null);
|
|
11322
|
-
__decorate([
|
|
11323
|
-
watch("value", { waitUntilFirstUpdate: true })
|
|
11324
|
-
], SgdsInput.prototype, "_handleValueChange", null);
|
|
11325
11395
|
|
|
11326
|
-
var css_248z$
|
|
11396
|
+
var css_248z$C = css`.sgds.combobox .form-control-icon{align-items:center;display:flex;font-size:1rem;height:3rem;justify-content:center;position:absolute;width:3rem;z-index:4}.sgds.combobox{align-items:stretch;display:flex;flex-wrap:wrap;justify-content:flex-end;position:relative;width:-webkit-fill-available;width:-moz-available}.sgds.combobox .dropdown-toggle{width:100%}.sgds.combobox>.dropdown-menu{min-width:100%}.form-control-icon{bottom:0}`;
|
|
11327
11397
|
|
|
11328
|
-
var css_248z$
|
|
11398
|
+
var css_248z$B = css`.dropdown-menu{background-clip:padding-box;background-color:var(--sgds-neutral-bg-inverse);border-radius:var(--sgds-border-radius-md);box-shadow:0 0 2px 0 rgba(0,0,0,.12),0 4px 8px 0 rgba(0,0,0,.14);color:var(--sgds-default-color);display:none;list-style:none;margin:0;min-width:var(--sgds-dimension-280);overflow-y:scroll;padding:var(--sgds-padding-xs) 0;position:absolute;text-align:left;z-index:1000}.dropdown .dropdown-menu{max-height:var(--sgds-dimension-192)}.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%}`;
|
|
11329
11399
|
|
|
11330
11400
|
/**
|
|
11331
11401
|
* @summary ComboBox component is used for users to make one or more selections from a list.
|
|
@@ -11449,7 +11519,7 @@
|
|
|
11449
11519
|
`;
|
|
11450
11520
|
}
|
|
11451
11521
|
}
|
|
11452
|
-
SgdsComboBox.styles = [...DropdownListElement.styles, css_248z$
|
|
11522
|
+
SgdsComboBox.styles = [...DropdownListElement.styles, css_248z$C, css_248z$F, css_248z$B];
|
|
11453
11523
|
__decorate([
|
|
11454
11524
|
property({ reflect: true })
|
|
11455
11525
|
], SgdsComboBox.prototype, "label", void 0);
|
|
@@ -11507,12 +11577,17 @@
|
|
|
11507
11577
|
|
|
11508
11578
|
customElements.define("sgds-combo-box", SgdsComboBox);
|
|
11509
11579
|
|
|
11510
|
-
var css_248z$
|
|
11580
|
+
var css_248z$A = css`:host{--sgds-checkbox-group-gap:var(--sgds-spacer-2)}fieldset{border:0;gap:var(--sgds-form-gap-md);margin:0;min-width:0;padding:0}.label-hint-container,fieldset{display:flex;flex-direction:column}.label-hint-container{gap:var(--sgds-form-gap-sm)}.label-hint-container .form-label{color:var(--sgds-form-color);font-size:var(--sgds-font-size-2);font-weight:var(--sgds-font-weight-regular)}.checkbox-container{display:flex;flex-direction:column;gap:var(--sgds-form-gap-md)}`;
|
|
11511
11581
|
|
|
11582
|
+
/**
|
|
11583
|
+
* @summary CheckboxGroup is the container that group multiple checkboxes under a single question field.
|
|
11584
|
+
* It handles the display of validation feedback of its checkboxes children.
|
|
11585
|
+
*
|
|
11586
|
+
* @slot default - Pass in `sgds-checkbox` into the default slot
|
|
11587
|
+
*/
|
|
11512
11588
|
class SgdsCheckboxGroup extends SgdsElement {
|
|
11513
11589
|
constructor() {
|
|
11514
11590
|
super();
|
|
11515
|
-
/**@internal */
|
|
11516
11591
|
this.hasInvalidCheckbox = false;
|
|
11517
11592
|
/** The checkbox group's label */
|
|
11518
11593
|
this.label = "";
|
|
@@ -11524,6 +11599,7 @@
|
|
|
11524
11599
|
this.hintText = "";
|
|
11525
11600
|
this.addEventListener("sgds-validity-change", (e) => {
|
|
11526
11601
|
this.hasInvalidCheckbox = e.detail.invalid;
|
|
11602
|
+
this.validationMessage = e.detail.validationMessage;
|
|
11527
11603
|
});
|
|
11528
11604
|
}
|
|
11529
11605
|
_checkInvalidState() {
|
|
@@ -11551,7 +11627,7 @@
|
|
|
11551
11627
|
${this._renderHintText()}
|
|
11552
11628
|
</div>
|
|
11553
11629
|
<div class="checkbox-container">
|
|
11554
|
-
<slot
|
|
11630
|
+
<slot></slot>
|
|
11555
11631
|
</div>
|
|
11556
11632
|
${this.hasInvalidCheckbox && this.hasFeedback
|
|
11557
11633
|
? html$1 `
|
|
@@ -11562,7 +11638,9 @@
|
|
|
11562
11638
|
fill="#B90000"
|
|
11563
11639
|
/>
|
|
11564
11640
|
</svg>
|
|
11565
|
-
<div id="checkbox-feedback" tabindex="0" class="invalid-feedback"
|
|
11641
|
+
<div id="checkbox-feedback" tabindex="0" class="invalid-feedback">
|
|
11642
|
+
${this.invalidFeedback ? this.invalidFeedback : this.validationMessage}
|
|
11643
|
+
</div>
|
|
11566
11644
|
</div>
|
|
11567
11645
|
`
|
|
11568
11646
|
: nothing}
|
|
@@ -11570,13 +11648,16 @@
|
|
|
11570
11648
|
`;
|
|
11571
11649
|
}
|
|
11572
11650
|
}
|
|
11573
|
-
SgdsCheckboxGroup.styles = [...SgdsElement.styles, css_248z$
|
|
11651
|
+
SgdsCheckboxGroup.styles = [...SgdsElement.styles, css_248z$X, css_248z$V, css_248z$A, css_248z$W];
|
|
11574
11652
|
__decorate([
|
|
11575
|
-
queryAssignedElements({
|
|
11653
|
+
queryAssignedElements({ flatten: true })
|
|
11576
11654
|
], SgdsCheckboxGroup.prototype, "checkboxes", void 0);
|
|
11577
11655
|
__decorate([
|
|
11578
11656
|
state()
|
|
11579
11657
|
], SgdsCheckboxGroup.prototype, "hasInvalidCheckbox", void 0);
|
|
11658
|
+
__decorate([
|
|
11659
|
+
state()
|
|
11660
|
+
], SgdsCheckboxGroup.prototype, "validationMessage", void 0);
|
|
11580
11661
|
__decorate([
|
|
11581
11662
|
property({ reflect: true })
|
|
11582
11663
|
], SgdsCheckboxGroup.prototype, "label", void 0);
|
|
@@ -17284,7 +17365,7 @@
|
|
|
17284
17365
|
return newDate;
|
|
17285
17366
|
};
|
|
17286
17367
|
|
|
17287
|
-
var css_248z$
|
|
17368
|
+
var css_248z$z = css`button{font-family:inherit;font-size:inherit;line-height:inherit;margin:0}.datepicker-body{padding:0 1.5rem 1.5rem}table{border-collapse:collapse;text-align:center}.sgds.monthpicker,.sgds.yearpicker{align-content:space-between;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(4,3rem);justify-content:space-between;padding:1rem 0 0}button.month,button.year{background-color:transparent;border:0;padding:0}button.month.active{background-color:var(--datepicker-hover-bg);cursor:pointer}button.month.active.selected-ends{background-color:var(--datepicker-selected-date-bg);color:var(--datepicker-selected-date-color)}button.month:hover:not(.active){background-color:var(--datepicker-hover-bg);cursor:pointer}button.month:focus{outline:var(--datepicker-theme-color) auto 2px;z-index:100}button.year.active{background-color:var(--datepicker-hover-bg);cursor:pointer}button.year.active.selected-ends{background-color:var(--datepicker-selected-date-bg);color:var(--datepicker-selected-date-color)}button.year:hover:not(.active){background-color:var(--datepicker-hover-bg);cursor:pointer}button.year:focus{outline:var(--datepicker-theme-color) auto 2px;z-index:100}td{height:3rem;padding:0;width:3rem}td[data-day]{cursor:pointer}td[data-day].active,td[data-day]:hover:not(.disabled):not(.selected-ends){background-color:var(--datepicker-hover-bg);cursor:pointer}td[data-day].active.selected-ends{background-color:var(--datepicker-selected-date-bg);color:var(--datepicker-selected-date-color)}td[data-day]:focus{outline:var(--datepicker-theme-color) auto 2px}td[data-day].disabled{color:var(--sgds-gray-400);cursor:not-allowed}.today{color:var(--datepicker-theme-color)}`;
|
|
17288
17369
|
|
|
17289
17370
|
const TODAY_DATE = new Date();
|
|
17290
17371
|
const keyPressAction = {
|
|
@@ -17682,7 +17763,7 @@
|
|
|
17682
17763
|
return html$1 ` <div class="datepicker-body">${viewContent}</div> `;
|
|
17683
17764
|
}
|
|
17684
17765
|
}
|
|
17685
|
-
DatepickerCalendar.styles = [css_248z$
|
|
17766
|
+
DatepickerCalendar.styles = [css_248z$z];
|
|
17686
17767
|
/** @internal */
|
|
17687
17768
|
DatepickerCalendar.DAY_LABELS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
|
17688
17769
|
/** @internal */
|
|
@@ -17730,7 +17811,7 @@
|
|
|
17730
17811
|
watch("displayDate")
|
|
17731
17812
|
], DatepickerCalendar.prototype, "_updateFocusedDate", null);
|
|
17732
17813
|
|
|
17733
|
-
var css_248z$
|
|
17814
|
+
var css_248z$y = css`.datepicker-header{align-items:center;display:flex;justify-content:space-between;line-height:28px;padding:1.5rem 1.5rem 0;text-align:center}.datepicker-header,.datepicker-header button{border:none;color:var(--datepicker-theme-color)}.datepicker-header button{background-color:transparent;cursor:pointer;font-size:14px;font-weight:700;line-height:var(--sgds-line-height-lg)}.datepicker-header button:focus{outline:var(--datepicker-theme-color) auto 2px}.datepicker-header button.disabled{cursor:not-allowed}.datepicker-header button:hover:not(.disabled){background-color:var(--datepicker-hover-bg)}.datepicker-header svg{font-size:10rem;vertical-align:middle}`;
|
|
17734
17815
|
|
|
17735
17816
|
class DatepickerHeader extends SgdsElement {
|
|
17736
17817
|
constructor() {
|
|
@@ -17912,7 +17993,7 @@
|
|
|
17912
17993
|
`;
|
|
17913
17994
|
}
|
|
17914
17995
|
}
|
|
17915
|
-
DatepickerHeader.styles = [css_248z$
|
|
17996
|
+
DatepickerHeader.styles = [css_248z$y];
|
|
17916
17997
|
__decorate([
|
|
17917
17998
|
property({ attribute: false })
|
|
17918
17999
|
], DatepickerHeader.prototype, "displayDate", void 0);
|
|
@@ -21547,7 +21628,7 @@
|
|
|
21547
21628
|
globalThis.IMask = IMask;
|
|
21548
21629
|
} catch {}
|
|
21549
21630
|
|
|
21550
|
-
var css_248z$
|
|
21631
|
+
var css_248z$x = css`.input-container{display:flex;flex-direction:row;width:-webkit-fill-available;width:-moz-available}.form-control-group{border-radius:var(--sgds-form-border-radius-md) 0 0 var(--sgds-form-border-radius-md)}.input-feedback{display:flex;flex-direction:column;width:-webkit-fill-available;width:-moz-available}`;
|
|
21551
21632
|
|
|
21552
21633
|
class DatepickerInput extends SgdsInput {
|
|
21553
21634
|
constructor() {
|
|
@@ -21582,15 +21663,28 @@
|
|
|
21582
21663
|
}
|
|
21583
21664
|
};
|
|
21584
21665
|
this.type = "text";
|
|
21585
|
-
this.hasFeedback =
|
|
21586
|
-
this.
|
|
21666
|
+
this.hasFeedback = "both";
|
|
21667
|
+
// this._handleChange = () => null;
|
|
21668
|
+
// this._handleInputChange = () => null
|
|
21669
|
+
}
|
|
21670
|
+
// connectedCallback(): void {
|
|
21671
|
+
// super.connectedCallback();
|
|
21672
|
+
// this.addEventListener("sgds-change", this._validateInput);
|
|
21673
|
+
// }
|
|
21674
|
+
async _handleChange(e) {
|
|
21675
|
+
this.value = this.input.value;
|
|
21676
|
+
this.emit("sgds-change");
|
|
21677
|
+
super._mixinHandleChange(e);
|
|
21678
|
+
await this._validateInput();
|
|
21587
21679
|
}
|
|
21588
|
-
|
|
21589
|
-
|
|
21590
|
-
this.
|
|
21680
|
+
/** @internal */
|
|
21681
|
+
_handleIsTouched() {
|
|
21682
|
+
if (this._isTouched && this.required) {
|
|
21683
|
+
this.invalid = true;
|
|
21684
|
+
}
|
|
21591
21685
|
}
|
|
21592
|
-
async firstUpdated(
|
|
21593
|
-
super.firstUpdated(
|
|
21686
|
+
async firstUpdated(changedProperties) {
|
|
21687
|
+
super.firstUpdated(changedProperties);
|
|
21594
21688
|
this._applyInputMask(this.dateFormat);
|
|
21595
21689
|
}
|
|
21596
21690
|
async _applyInputMask(dateFormat) {
|
|
@@ -21671,7 +21765,7 @@
|
|
|
21671
21765
|
`;
|
|
21672
21766
|
}
|
|
21673
21767
|
}
|
|
21674
|
-
DatepickerInput.styles = [...SgdsInput.styles, css_248z$
|
|
21768
|
+
DatepickerInput.styles = [...SgdsInput.styles, css_248z$x];
|
|
21675
21769
|
__decorate([
|
|
21676
21770
|
property({ type: String })
|
|
21677
21771
|
], DatepickerInput.prototype, "dateFormat", void 0);
|
|
@@ -21687,8 +21781,11 @@
|
|
|
21687
21781
|
__decorate([
|
|
21688
21782
|
queryAsync("input")
|
|
21689
21783
|
], DatepickerInput.prototype, "shadowInput", void 0);
|
|
21784
|
+
__decorate([
|
|
21785
|
+
watch("_isTouched", { waitUntilFirstUpdate: true })
|
|
21786
|
+
], DatepickerInput.prototype, "_handleIsTouched", null);
|
|
21690
21787
|
|
|
21691
|
-
var css_248z$
|
|
21788
|
+
var css_248z$w = css`:host{--datepicker-theme-color:var(--sgds-primary);--datepicker-hover-bg:var(--sgds-primary-100);--datepicker-bg:#fff;--datepicker-close-btn-bg:var(--datepicker-theme-color);--datepicker-close-btn-hover-bg:var(--sgds-primary-700);--datepicker-close-btn-color:#fff;--datepicker-selected-date-bg:var(--sgds-primary);--datepicker-selected-date-color:#fff}.datepicker{background-color:var(--datepicker-bg);border-color:var(--sgds-border-color);font-size:1rem;max-width:24rem;width:24rem}div{display:flex}button{align-self:self-start}sgds-datepicker-input{--input-border-radius:var(--sgds-border-radius,0.3125rem) 0 0 var(--sgds-border-radius,0.3125rem);flex:1;margin-right:0}sgds-button[variant=outlined]{--btn-color:var(--sgds-dark);--btn-bg:var(--sgds-white);--btn-border-color:var(--sgds-dark);--btn-hover-bg:var(--sgds-dark);--btn-hover-color:var(--sgds-white)}.calendar-btn{--btn-border-color:var(--sgds-border-color);--btn-border-radius:0}.reset-btn{--btn-bg:var(--datepicker-close-btn-bg);--btn-color:var(--datepicker-close-btn-color);--btn-border-radius:0}.reset-btn:hover{--btn-hover-bg:var(--datepicker-close-btn-hover-bg)}`;
|
|
21692
21789
|
|
|
21693
21790
|
/**
|
|
21694
21791
|
* @summary The `DatePicker` Component is built using `Dropdown`, `Input` and `Button` components. By default, the Calendar points to today's date and input has no value. Users can either pick dates from the calendar or type dates through the input
|
|
@@ -22078,7 +22175,7 @@
|
|
|
22078
22175
|
`;
|
|
22079
22176
|
}
|
|
22080
22177
|
}
|
|
22081
|
-
SgdsDatepicker.styles = [...DropdownElement.styles, css_248z$
|
|
22178
|
+
SgdsDatepicker.styles = [...DropdownElement.styles, css_248z$F, css_248z$B, css_248z$w];
|
|
22082
22179
|
/**@internal */
|
|
22083
22180
|
SgdsDatepicker.formAssociated = true;
|
|
22084
22181
|
__decorate([
|
|
@@ -22156,7 +22253,7 @@
|
|
|
22156
22253
|
|
|
22157
22254
|
customElements.define("sgds-datepicker", SgdsDatepicker);
|
|
22158
22255
|
|
|
22159
|
-
var css_248z$
|
|
22256
|
+
var css_248z$v = css`:host{--container-size:8px}:host([orientation=horizontal]){border-top:var(--border-width) solid var(--sgds-default-color-muted);display:block;margin:calc((var(--container-size) - var(--border-width))/2) 0;width:100%}:host([orientation=vertical]){border-left:var(--border-width) solid var(--sgds-default-color-muted);display:inline-block;height:100%;margin:0 calc((var(--container-size) - var(--border-width))/2)}:host([thickness=thin]){--border-width:var(--sgds-border-width-1)}:host([thickness=thick]){--border-width:var(--sgds-border-width-2)}:host([thickness=thicker]){--border-width:var(--sgds-border-width-4)}`;
|
|
22160
22257
|
|
|
22161
22258
|
/**
|
|
22162
22259
|
* @summary A divider is a thin line that groups content in lists and layouts. They bring clarity to a layout by grouping and dividing content in close proximity.
|
|
@@ -22175,7 +22272,7 @@
|
|
|
22175
22272
|
this.setAttribute("aria-orientation", this.orientation);
|
|
22176
22273
|
}
|
|
22177
22274
|
}
|
|
22178
|
-
SgdsDivider.styles = [css_248z$
|
|
22275
|
+
SgdsDivider.styles = [css_248z$v];
|
|
22179
22276
|
__decorate([
|
|
22180
22277
|
property({ type: String, reflect: true })
|
|
22181
22278
|
], SgdsDivider.prototype, "orientation", void 0);
|
|
@@ -22254,7 +22351,7 @@
|
|
|
22254
22351
|
}
|
|
22255
22352
|
}
|
|
22256
22353
|
|
|
22257
|
-
var css_248z$
|
|
22354
|
+
var css_248z$u = css`:host{--drawer-padding:var(--sgds-spacer-4);--drawer-size:35rem;--drawer-bg:var(--sgds-body-bg);--drawer-button-gap:var(--sgds-spacer-2);display:contents}.drawer{height:100%;inset-inline-start:0;overflow:hidden;pointer-events:none;top:0;width:100%}.drawer-fixed{position:fixed;z-index:1055}.drawer-panel{background-color:var(--drawer-bg);box-shadow:0 2px 8px hsla(240,4%,46%,.12);display:flex;flex-direction:column;max-height:100%;max-width:100%;overflow:auto;pointer-events:all;position:absolute;z-index:2}.drawer-panel:focus{outline:none}.drawer-top .drawer-panel{bottom:auto;height:var(--drawer-size);inset-inline-end:auto;inset-inline-start:0;top:0;width:100%}.drawer-end .drawer-panel{bottom:auto;height:100%;inset-inline-end:0;inset-inline-start:auto;top:0;width:var(--drawer-size)}.drawer-bottom .drawer-panel{bottom:0;height:var(--drawer-size);inset-inline-end:auto;inset-inline-start:0;top:auto;width:100%}.drawer-start .drawer-panel{bottom:auto;height:100%;inset-inline-end:auto;inset-inline-start:0;top:0;width:var(--drawer-size)}.drawer-header{display:flex;padding:var(--drawer-padding)}.drawer-title{flex:1 1 auto;font:inherit;font-size:calc(1.275rem + .3vw);line-height:1.33;margin:0}.drawer-header-actions{cursor:pointer;display:flex;flex-shrink:0;flex-wrap:wrap;gap:var(--drawer-button-gap);justify-content:end;padding:0 var(--drawer-padding)}.drawer-header-actions .drawer-close{align-self:center;display:flex;flex:0 0 auto}.drawer-body{-webkit-overflow-scrolling:touch;display:block;flex:1 1 auto;overflow:auto}.drawer-body,.drawer-footer{padding:var(--drawer-padding)}.drawer-footer{text-align:right}.drawer-footer ::slotted(sgds-button:not(:last-of-type)){margin-inline-end:var(--drawer-button-gap)}.drawer:not(.drawer-has-footer) .drawer-footer{display:none}.drawer-overlay{background-color:rgba(0,0,0,.5);bottom:0;display:block;left:0;pointer-events:all;position:fixed;right:0;top:0}.drawer-contained .drawer-overlay{display:none}`;
|
|
22258
22355
|
|
|
22259
22356
|
/**
|
|
22260
22357
|
* @summary Drawers slide in from a container to expose additional options and information.
|
|
@@ -22528,7 +22625,7 @@
|
|
|
22528
22625
|
`;
|
|
22529
22626
|
}
|
|
22530
22627
|
}
|
|
22531
|
-
SgdsDrawer.styles = [...SgdsElement.styles, css_248z$
|
|
22628
|
+
SgdsDrawer.styles = [...SgdsElement.styles, css_248z$u];
|
|
22532
22629
|
__decorate([
|
|
22533
22630
|
query(".drawer")
|
|
22534
22631
|
], SgdsDrawer.prototype, "drawer", void 0);
|
|
@@ -22744,7 +22841,7 @@
|
|
|
22744
22841
|
`;
|
|
22745
22842
|
}
|
|
22746
22843
|
}
|
|
22747
|
-
SgdsDropdown.styles = [...DropdownListElement.styles, css_248z$
|
|
22844
|
+
SgdsDropdown.styles = [...DropdownListElement.styles, css_248z$F, css_248z$B];
|
|
22748
22845
|
__decorate([
|
|
22749
22846
|
property({ type: String })
|
|
22750
22847
|
], SgdsDropdown.prototype, "togglerId", void 0);
|
|
@@ -22770,58 +22867,72 @@
|
|
|
22770
22867
|
customElements.define("sgds-dropdown", SgdsDropdown);
|
|
22771
22868
|
customElements.define("sgds-dropdown-item", SgdsDropdownItem);
|
|
22772
22869
|
|
|
22773
|
-
var css_248z$
|
|
22774
|
-
|
|
22775
|
-
var css_248z$r = css`svg{vertical-align:middle}`;
|
|
22870
|
+
var css_248z$t = css`:host{--file-upload-left-icon-color:var(--sgds-success);--file-upload-remove-icon-color:var(--sgds-body-color);--file-upload-remove-icon-hover-color: }.file-upload{display:flex;flex-direction:column;gap:var(--sgds-form-gap-2-xl)}.file-upload-container{display:flex;flex-direction:column;gap:var(--sgds-form-gap-md)}.file-upload-list{display:flex;flex-direction:column;gap:var(--sgds-form-gap-xl);list-style-type:none}.file-upload-list-item{align-items:center;background-color:var(--sgds-form-bg);border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color-muted);border-radius:var(--sgds-form-border-radius-md);display:flex;gap:var(--sgds-form-gap-lg);padding:var(--sgds-form-padding-y) var(--sgds-form-padding-x)}.file-upload-list-item span:not(:first-of-type){cursor:pointer}.file-upload-list-item span:first-of-type svg{color:var(--file-upload-left-icon-color)}.file-upload-list-item span:last-of-type svg{color:var(--file-upload-remove-icon-color)}.file-upload-list-item span:last-of-type svg:hover{color:var(--file-upload-remove-icon-hover-color)}ul{margin:0;padding:0}input{display:none}label,sgds-button{cursor:pointer}sgds-close-button{margin-left:auto}`;
|
|
22776
22871
|
|
|
22777
22872
|
/**
|
|
22778
22873
|
* @summary Allows users to upload files of various sizes and formats
|
|
22779
22874
|
* @slot default - Label for file upload button
|
|
22780
22875
|
*
|
|
22781
|
-
* @event sgds-files-selected - Emitted when files are selected for uploading
|
|
22782
|
-
*
|
|
22783
|
-
* @cssproperty --file-upload-file-icon-color - Left icon color
|
|
22784
|
-
* @cssproperty --file-upload-remove-icon-color - Remove icon color
|
|
22785
|
-
* @cssproperty --file-upload-remove-icon-hover-color - Remove icon hover color
|
|
22876
|
+
* @event sgds-files-selected - Emitted when files are selected for uploading. Access the selected files with event.target.detail
|
|
22786
22877
|
*/
|
|
22787
|
-
class SgdsFileUpload extends ScopedElementsMixin(
|
|
22878
|
+
class SgdsFileUpload extends SgdsFormValidatorMixin(ScopedElementsMixin(FormControlElement)) {
|
|
22788
22879
|
constructor() {
|
|
22789
22880
|
super(...arguments);
|
|
22790
|
-
/** The button's variant. */
|
|
22791
|
-
this.variant = "primary";
|
|
22792
|
-
//** Disable the fileuploader button */
|
|
22793
|
-
this.disabled = false;
|
|
22794
22881
|
/** Allows multiple files to be listed for uploading */
|
|
22795
22882
|
this.multiple = false;
|
|
22796
22883
|
/** Specify the acceptable file type */
|
|
22797
22884
|
this.accept = "";
|
|
22798
|
-
/** Customize the check icon with SVG */
|
|
22799
|
-
|
|
22800
|
-
/**
|
|
22801
|
-
this.
|
|
22802
|
-
/**
|
|
22803
|
-
this.
|
|
22804
|
-
/** @internal */
|
|
22885
|
+
// /** Customize the check icon with SVG */
|
|
22886
|
+
// @property({ type: String }) checkedIcon = "";
|
|
22887
|
+
/** Allows invalidFeedback, invalid and valid styles to be visible with the input */
|
|
22888
|
+
this.hasFeedback = false;
|
|
22889
|
+
/** Makes the input as a required field. */
|
|
22890
|
+
this.required = false;
|
|
22805
22891
|
this.selectedFiles = [];
|
|
22806
|
-
// Create a ref to the input element
|
|
22807
|
-
/** @internal */
|
|
22808
22892
|
this.inputRef = createRef();
|
|
22809
|
-
/**@internal */
|
|
22810
|
-
this.inputId = genId("input", "file");
|
|
22811
22893
|
}
|
|
22812
22894
|
/**@internal */
|
|
22813
22895
|
static get scopedElements() {
|
|
22814
22896
|
return {
|
|
22815
|
-
"sgds-button": SgdsButton
|
|
22897
|
+
"sgds-button": SgdsButton,
|
|
22898
|
+
"sgds-close-button": SgdsCloseButton
|
|
22816
22899
|
};
|
|
22817
22900
|
}
|
|
22901
|
+
/**
|
|
22902
|
+
* Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
|
|
22903
|
+
* 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
|
|
22904
|
+
*/
|
|
22905
|
+
reportValidity() {
|
|
22906
|
+
return this._mixinReportValidity();
|
|
22907
|
+
}
|
|
22908
|
+
/**
|
|
22909
|
+
* Checks for validity without any native error popup message
|
|
22910
|
+
*/
|
|
22911
|
+
checkValidity() {
|
|
22912
|
+
return this._mixinCheckValidity();
|
|
22913
|
+
}
|
|
22914
|
+
/**
|
|
22915
|
+
* Returns the ValidityState object
|
|
22916
|
+
*/
|
|
22917
|
+
get validity() {
|
|
22918
|
+
return this._mixinGetValidity();
|
|
22919
|
+
}
|
|
22920
|
+
/**
|
|
22921
|
+
* Returns the validation message based on the ValidityState
|
|
22922
|
+
*/
|
|
22923
|
+
get validationMessage() {
|
|
22924
|
+
return this._mixinGetValidationMessage();
|
|
22925
|
+
}
|
|
22926
|
+
/**
|
|
22927
|
+
* Returns files selected for upload
|
|
22928
|
+
*/
|
|
22929
|
+
get files() {
|
|
22930
|
+
return this.selectedFiles;
|
|
22931
|
+
}
|
|
22818
22932
|
_setFileList(files) {
|
|
22819
|
-
this.files
|
|
22820
|
-
this.emit("sgds-files-selected");
|
|
22821
|
-
//Possible to pass in the files
|
|
22933
|
+
this.emit("sgds-files-selected", { detail: files });
|
|
22822
22934
|
}
|
|
22823
|
-
|
|
22824
|
-
handleClick(event) {
|
|
22935
|
+
_handleClick(event) {
|
|
22825
22936
|
event.preventDefault();
|
|
22826
22937
|
if (!this.disabled) {
|
|
22827
22938
|
// Get a reference to the input element using the inputRef
|
|
@@ -22830,8 +22941,7 @@
|
|
|
22830
22941
|
inputElement.click();
|
|
22831
22942
|
}
|
|
22832
22943
|
}
|
|
22833
|
-
|
|
22834
|
-
handleInputChange(event) {
|
|
22944
|
+
_handleChange(event) {
|
|
22835
22945
|
const inputElement = event.target;
|
|
22836
22946
|
const files = inputElement.files;
|
|
22837
22947
|
if (files.length > 0) {
|
|
@@ -22840,6 +22950,7 @@
|
|
|
22840
22950
|
// Trigger a re-render of the component to update the list of selected files
|
|
22841
22951
|
this._setFileList(files);
|
|
22842
22952
|
this.requestUpdate();
|
|
22953
|
+
super._mixinHandleChange(event);
|
|
22843
22954
|
}
|
|
22844
22955
|
_removeFileHandler(index) {
|
|
22845
22956
|
const inputElement = this.inputRef.value;
|
|
@@ -22856,19 +22967,56 @@
|
|
|
22856
22967
|
this.selectedFiles = Array.from(fileBuffer.files);
|
|
22857
22968
|
// Trigger a re-render of the component to update the list of selected files
|
|
22858
22969
|
this.requestUpdate();
|
|
22970
|
+
this._mixinValidate(this.input);
|
|
22971
|
+
}
|
|
22972
|
+
_clearAllFiles() {
|
|
22973
|
+
const inputElement = this.inputRef.value;
|
|
22974
|
+
const fileBuffer = new DataTransfer();
|
|
22975
|
+
inputElement.files = fileBuffer.files;
|
|
22976
|
+
this._setFileList(fileBuffer.files);
|
|
22977
|
+
this.selectedFiles = Array.from(fileBuffer.files);
|
|
22978
|
+
}
|
|
22979
|
+
/**
|
|
22980
|
+
* fileupload requries a custom _mixinResetFormControl for clearing files
|
|
22981
|
+
*/
|
|
22982
|
+
_mixinResetFormControl() {
|
|
22983
|
+
this._clearAllFiles();
|
|
22984
|
+
this._mixinResetValidity(this.input);
|
|
22985
|
+
}
|
|
22986
|
+
_handleDisabledChange() {
|
|
22987
|
+
// Disabled form controls are always valid, so we need to recheck validity when the state changes
|
|
22988
|
+
this.setInvalid(false);
|
|
22989
|
+
}
|
|
22990
|
+
_renderLabel() {
|
|
22991
|
+
const labelTemplate = html$1 `
|
|
22992
|
+
<label for=${this._controlId} id=${this._labelId} class="form-label"> ${this.label} </label>
|
|
22993
|
+
`;
|
|
22994
|
+
return this.label && labelTemplate;
|
|
22859
22995
|
}
|
|
22860
22996
|
_renderHintText() {
|
|
22861
|
-
const hintTextTemplate = html$1 ` <
|
|
22997
|
+
const hintTextTemplate = html$1 ` <div id="${this._controlId}Help" class="form-text">${this.hintText}</div> `;
|
|
22862
22998
|
return this.hintText && hintTextTemplate;
|
|
22863
22999
|
}
|
|
22864
|
-
|
|
22865
|
-
return
|
|
23000
|
+
_renderFeedback() {
|
|
23001
|
+
return html$1 `
|
|
23002
|
+
<div class="invalid-feedback-container">
|
|
23003
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
23004
|
+
<path
|
|
23005
|
+
d="M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10ZM10 6.25C9.49805 6.25 9.10584 6.68339 9.15578 7.18285L9.48461 10.4711C9.51109 10.7359 9.7339 10.9375 10 10.9375C10.2661 10.9375 10.4889 10.7359 10.5154 10.4711L10.8442 7.18285C10.8942 6.68339 10.5019 6.25 10 6.25ZM10.0014 11.875C9.48368 11.875 9.06394 12.2947 9.06394 12.8125C9.06394 13.3303 9.48368 13.75 10.0014 13.75C10.5192 13.75 10.9389 13.3303 10.9389 12.8125C10.9389 12.2947 10.5192 11.875 10.0014 11.875Z"
|
|
23006
|
+
fill="#B90000"
|
|
23007
|
+
/>
|
|
23008
|
+
</svg>
|
|
23009
|
+
<div id="${this._controlId}-invalid" class="invalid-feedback">
|
|
23010
|
+
${this.invalidFeedback ? this.invalidFeedback : this.input.validationMessage}
|
|
23011
|
+
</div>
|
|
23012
|
+
</div>
|
|
23013
|
+
`;
|
|
22866
23014
|
}
|
|
22867
23015
|
render() {
|
|
22868
|
-
const getCheckedIcon = (
|
|
22869
|
-
if (checkedIcon) {
|
|
22870
|
-
|
|
22871
|
-
}
|
|
23016
|
+
const getCheckedIcon = () => {
|
|
23017
|
+
// if (checkedIcon) {
|
|
23018
|
+
// return html`${unsafeSVG(checkedIcon)}`;
|
|
23019
|
+
// }
|
|
22872
23020
|
return html$1 ` <svg
|
|
22873
23021
|
xmlns="http://www.w3.org/2000/svg"
|
|
22874
23022
|
width="16"
|
|
@@ -22880,67 +23028,62 @@
|
|
|
22880
23028
|
<path
|
|
22881
23029
|
d="M12.736 3.97a.733.733 0 0 1 1.047 0c.286.289.29.756.01 1.05L7.88 12.01a.733.733 0 0 1-1.065.02L3.217 8.384a.757.757 0 0 1 0-1.06.733.733 0 0 1 1.047 0l3.052 3.093 5.4-6.425a.247.247 0 0 1 .02-.022Z"
|
|
22882
23030
|
/>
|
|
22883
|
-
</svg>`;
|
|
22884
|
-
};
|
|
22885
|
-
const getCancelIcon = (cancelIcon) => {
|
|
22886
|
-
if (cancelIcon) {
|
|
22887
|
-
return html$1 `${unsafeSVG(cancelIcon)}`;
|
|
22888
|
-
}
|
|
22889
|
-
return html$1 `<svg
|
|
22890
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
22891
|
-
width="16"
|
|
22892
|
-
height="16"
|
|
22893
|
-
fill="currentColor"
|
|
22894
|
-
class="bi bi-x-circle"
|
|
22895
|
-
viewBox="0 0 16 16"
|
|
22896
|
-
>
|
|
22897
|
-
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
|
|
22898
|
-
<path
|
|
22899
|
-
d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"
|
|
22900
|
-
/>
|
|
22901
23031
|
</svg>`;
|
|
22902
23032
|
};
|
|
22903
23033
|
const listItems = this.selectedFiles.map((file, index) => html$1 `
|
|
22904
|
-
<li key=${index} class="
|
|
22905
|
-
<span>${getCheckedIcon(
|
|
23034
|
+
<li key=${index} class="file-upload-list-item">
|
|
23035
|
+
<span>${getCheckedIcon()}</span>
|
|
22906
23036
|
<span class="filename">${file.name}</span>
|
|
22907
|
-
<
|
|
23037
|
+
<sgds-close-button
|
|
23038
|
+
aria-label="remove the file"
|
|
23039
|
+
@click=${() => this._removeFileHandler(index)}
|
|
23040
|
+
></sgds-close-button>
|
|
22908
23041
|
</li>
|
|
22909
23042
|
`);
|
|
22910
23043
|
return html$1 `
|
|
22911
|
-
<
|
|
22912
|
-
|
|
22913
|
-
|
|
22914
|
-
|
|
22915
|
-
|
|
22916
|
-
|
|
22917
|
-
|
|
22918
|
-
|
|
22919
|
-
|
|
22920
|
-
<sgds-button
|
|
22921
|
-
size=${this.size}
|
|
22922
|
-
variant=${this._sanitizeVariant(this.variant)}
|
|
22923
|
-
?outlined=${this.variant.includes("outline")}
|
|
23044
|
+
<div class="file-upload">
|
|
23045
|
+
<input
|
|
23046
|
+
${ref(this.inputRef)}
|
|
23047
|
+
type="file"
|
|
23048
|
+
@change=${this._handleChange}
|
|
23049
|
+
?multiple=${this.multiple}
|
|
23050
|
+
accept=${this.accept}
|
|
23051
|
+
id=${this._controlId}
|
|
23052
|
+
?required=${this.required}
|
|
22924
23053
|
?disabled=${this.disabled}
|
|
22925
|
-
|
|
22926
|
-
>
|
|
22927
|
-
|
|
22928
|
-
|
|
22929
|
-
|
|
22930
|
-
|
|
23054
|
+
/>
|
|
23055
|
+
<div class="file-upload-container">
|
|
23056
|
+
${this._renderLabel()}
|
|
23057
|
+
<sgds-button variant="outline" ?disabled=${this.disabled} @click=${this._handleClick}>
|
|
23058
|
+
<label for=${this._controlId}><slot></slot></label>
|
|
23059
|
+
<svg
|
|
23060
|
+
slot="rightIcon"
|
|
23061
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
23062
|
+
width="24"
|
|
23063
|
+
height="24"
|
|
23064
|
+
viewBox="0 0 24 24"
|
|
23065
|
+
fill="none"
|
|
23066
|
+
>
|
|
23067
|
+
<path
|
|
23068
|
+
d="M3.5625 14.1943C3.71168 14.1943 3.85476 14.2535 3.96025 14.359C4.06574 14.4645 4.125 14.6076 4.125 14.7568V17.5693C4.125 17.8677 4.24353 18.1538 4.4545 18.3648C4.66548 18.5758 4.95163 18.6943 5.25 18.6943H18.75C19.0484 18.6943 19.3345 18.5758 19.5455 18.3648C19.7565 18.1538 19.875 17.8677 19.875 17.5693V14.7568C19.875 14.6076 19.9343 14.4645 20.0398 14.359C20.1452 14.2535 20.2883 14.1943 20.4375 14.1943C20.5867 14.1943 20.7298 14.2535 20.8352 14.359C20.9407 14.4645 21 14.6076 21 14.7568V17.5693C21 18.166 20.7629 18.7383 20.341 19.1603C19.919 19.5822 19.3467 19.8193 18.75 19.8193H5.25C4.65326 19.8193 4.08097 19.5822 3.65901 19.1603C3.23705 18.7383 3 18.166 3 17.5693V14.7568C3 14.6076 3.05926 14.4645 3.16475 14.359C3.27024 14.2535 3.41332 14.1943 3.5625 14.1943Z"
|
|
23069
|
+
fill="currentColor"
|
|
23070
|
+
/>
|
|
23071
|
+
<path
|
|
23072
|
+
d="M11.6018 4.34604C11.654 4.29366 11.7161 4.2521 11.7844 4.22374C11.8528 4.19538 11.926 4.18079 12 4.18079C12.074 4.18079 12.1473 4.19538 12.2156 4.22374C12.2839 4.2521 12.346 4.29366 12.3983 4.34604L15.7733 7.72104C15.8789 7.82666 15.9382 7.96992 15.9382 8.11929C15.9382 8.26866 15.8789 8.41192 15.7733 8.51754C15.6676 8.62316 15.5244 8.6825 15.375 8.6825C15.2256 8.6825 15.0824 8.62316 14.9768 8.51754L12.5625 6.10217V15.9943C12.5625 16.1435 12.5032 16.2866 12.3978 16.392C12.2923 16.4975 12.1492 16.5568 12 16.5568C11.8508 16.5568 11.7077 16.4975 11.6023 16.392C11.4968 16.2866 11.4375 16.1435 11.4375 15.9943V6.10217L9.02326 8.51754C8.97096 8.56984 8.90887 8.61133 8.84054 8.63963C8.77221 8.66793 8.69897 8.6825 8.62501 8.6825C8.55105 8.6825 8.47781 8.66793 8.40948 8.63963C8.34114 8.61133 8.27906 8.56984 8.22676 8.51754C8.17446 8.46524 8.13297 8.40316 8.10467 8.33482C8.07636 8.26649 8.0618 8.19325 8.0618 8.11929C8.0618 8.04533 8.07636 7.97209 8.10467 7.90376C8.13297 7.83543 8.17446 7.77334 8.22676 7.72104L11.6018 4.34604Z"
|
|
23073
|
+
fill="currentColor"
|
|
23074
|
+
/>
|
|
23075
|
+
</svg>
|
|
23076
|
+
</sgds-button>
|
|
23077
|
+
${this.hasFeedback && this.invalid ? this._renderFeedback() : this._renderHintText()}
|
|
23078
|
+
</div>
|
|
23079
|
+
<ul class="file-upload-list">
|
|
22931
23080
|
${listItems}
|
|
22932
23081
|
</ul>
|
|
22933
23082
|
</div>
|
|
22934
23083
|
`;
|
|
22935
23084
|
}
|
|
22936
23085
|
}
|
|
22937
|
-
SgdsFileUpload.styles = [...
|
|
22938
|
-
__decorate([
|
|
22939
|
-
property({ reflect: true })
|
|
22940
|
-
], SgdsFileUpload.prototype, "variant", void 0);
|
|
22941
|
-
__decorate([
|
|
22942
|
-
property({ type: Boolean, reflect: true })
|
|
22943
|
-
], SgdsFileUpload.prototype, "disabled", void 0);
|
|
23086
|
+
SgdsFileUpload.styles = [...FormControlElement.styles, css_248z$t];
|
|
22944
23087
|
__decorate([
|
|
22945
23088
|
property({ type: Boolean, reflect: true })
|
|
22946
23089
|
], SgdsFileUpload.prototype, "multiple", void 0);
|
|
@@ -22948,62 +23091,41 @@
|
|
|
22948
23091
|
property({ type: String, reflect: true })
|
|
22949
23092
|
], SgdsFileUpload.prototype, "accept", void 0);
|
|
22950
23093
|
__decorate([
|
|
22951
|
-
property({ reflect: true })
|
|
22952
|
-
], SgdsFileUpload.prototype, "
|
|
22953
|
-
__decorate([
|
|
22954
|
-
property({ type: String })
|
|
22955
|
-
], SgdsFileUpload.prototype, "checkedIcon", void 0);
|
|
22956
|
-
__decorate([
|
|
22957
|
-
property({ type: String })
|
|
22958
|
-
], SgdsFileUpload.prototype, "cancelIcon", void 0);
|
|
23094
|
+
property({ type: Boolean, reflect: true })
|
|
23095
|
+
], SgdsFileUpload.prototype, "hasFeedback", void 0);
|
|
22959
23096
|
__decorate([
|
|
22960
|
-
property({ reflect: true })
|
|
22961
|
-
], SgdsFileUpload.prototype, "
|
|
23097
|
+
property({ type: String, reflect: true })
|
|
23098
|
+
], SgdsFileUpload.prototype, "invalidFeedback", void 0);
|
|
22962
23099
|
__decorate([
|
|
22963
|
-
property({ type:
|
|
22964
|
-
], SgdsFileUpload.prototype, "
|
|
23100
|
+
property({ type: Boolean, reflect: true })
|
|
23101
|
+
], SgdsFileUpload.prototype, "required", void 0);
|
|
22965
23102
|
__decorate([
|
|
22966
|
-
|
|
23103
|
+
state()
|
|
22967
23104
|
], SgdsFileUpload.prototype, "selectedFiles", void 0);
|
|
23105
|
+
__decorate([
|
|
23106
|
+
watch("disabled", { waitUntilFirstUpdate: true })
|
|
23107
|
+
], SgdsFileUpload.prototype, "_handleDisabledChange", null);
|
|
22968
23108
|
|
|
22969
23109
|
customElements.define("sgds-file-upload", SgdsFileUpload);
|
|
22970
23110
|
|
|
22971
|
-
var css_248z$
|
|
23111
|
+
var css_248z$s = css`.footer{container:footer/inline-size;height:auto}.footer-top{background-color:var(--sgds-default-bg-emphasis);border-bottom:var(--sgds-border-width-1) solid var(--sgds-default-border-color);gap:var(--sgds-gap-md);padding:var(--sgds-padding-xl) var(--sgds-padding-2-xl)}.footer-header,.footer-top{display:flex;flex-direction:column}.footer-header{gap:var(--sgds-gap-xs);margin:var(--sgds-margin-3-xs) 0}slot[name=title]::slotted(*){--sgds-header-color:var(--sgds-default-color-inverse);--sgds-font-size-6:var(--sgds-font-size-5);--sgds-margin-2-xs:var(--sgds-margin-none);--sgds-line-height-heading:var(--sgds-line-height-body);color:var(--sgds-header-color,--sgds-default-color-inverse);font-size:var(--sgds-font-size-6,--sgds-font-size-5);font-weight:var(--sgds-font-weight-bold);letter-spacing:var(--sgds-letter-spacing-tight);line-height:var(--sgds-line-height-heading,--sgds-line-height-body);margin-bottom:var(--sgds-margin-2-xs,--sgds-margin-none);margin-top:var(--sgds-margin-none)}slot[name=description]::slotted(*){--sgds-font-size-2:var(--sgds-font-size-3);--sgds-paragraph-spacing-xl:var(--sgds-margin-none);color:var(--sgds-default-color-muted);font-size:var(--sgds-font-size-2,--sgds-font-size-3);margin-bottom:var(--sgds-paragraph-spacing-xl,--sgds-margin-none);margin-top:var(--sgds-margin-none)}.footer-items{display:grid;gap:var(--sgds-gap-md) var(--sgds-gap-lg);grid-template-columns:repeat(auto-fit,minmax(240px,1fr))}.footer ul{margin:0;padding:0}.footer ul li{list-style-type:none}.footer-mandatory-links ul li a{color:var(--sgds-default-color-muted);text-decoration:none}.footer-mandatory-links ul li a:focus,.footer-mandatory-links ul li a:hover{color:var(--sgds-default-color-inverse)}.footer-mandatory-links ul li a:focus,.footer-mandatory-links ul li a:focus-visible{box-shadow:var(--sgds-box-shadow-focus);outline:0}.footer-bottom{background-color:var(--sgds-default-bg-emphasis);display:flex;flex-direction:column;gap:var(--sgds-gap-md);padding:var(--sgds-padding-xl) var(--sgds-padding-2-xl)}.social-media{display:flex;gap:var(--sgds-gap-sm)}slot[name=social-media]::slotted(a){--sgds-link-color:light-dark(var(--sgds-gray-000),var(--sgds-gray-900));--sgds-body-color:light-dark(var(--sgds-gray-000),var(--sgds-gray-900));color:var(--sgds-body-color,--sgds-link-color);display:inline-flex}slot[name=social-media]::slotted(a:hover){--sgds-link-color-emphasis:light-dark(var(--sgds-gray-000),var(--sgds-gray-900));color:var(--sgds-link-color-emphasis)}slot[name=social-media]::slotted(a:focus),slot[name=social-media]::slotted(a:focus-visible){--sgds-link-color-emphasis:light-dark(var(--sgds-gray-000),var(--sgds-gray-900));box-shadow:var(--sgds-box-shadow-focus);color:var(--sgds-link-color-emphasis);outline:0}.footer-mandatory-links{display:flex;flex-wrap:wrap;gap:var(--sgds-gap-xl) var(--sgds-gap-lg);justify-content:space-between}.footer-mandatory-links ul{display:flex;flex-wrap:wrap;gap:var(--sgds-gap-xs) var(--sgds-gap-xl)}.footer-copyrights{color:var(--sgds-default-color-muted)}@container footer (max-width: 711px){.footer-bottom,.footer-top{padding:var(--sgds-padding-lg)}.footer-top{gap:var(--sgds-gap-lg)}.footer-mandatory-links,.footer-mandatory-links ul{flex-direction:column}}`;
|
|
22972
23112
|
|
|
22973
23113
|
/**
|
|
22974
23114
|
* @summary The footer contains supporting information for your service at the bottom of your website. All .gov.sg digital services shall contain a Global Footer Bar across all pages. The Global Footer Bar should include the name of the digital service, contact information, a privacy statement and the terms of use.
|
|
22975
23115
|
*
|
|
22976
|
-
* @
|
|
22977
|
-
* @
|
|
23116
|
+
* @slot title - The slot for title
|
|
23117
|
+
* @slot description - The slot for description
|
|
23118
|
+
* @slot items - The slot for the list of footer items
|
|
23119
|
+
* @slot social-media - The slot for the list of social media with icons
|
|
22978
23120
|
*
|
|
22979
|
-
* @cssproperty footer-top - The component's footer-top section container.
|
|
22980
|
-
* @cssproperty footer-bottom - The component's footer-bottom section container.
|
|
22981
23121
|
*/
|
|
22982
23122
|
class SgdsFooter extends SgdsElement {
|
|
22983
23123
|
constructor() {
|
|
22984
23124
|
super(...arguments);
|
|
22985
23125
|
/**
|
|
22986
|
-
* Sets
|
|
22987
|
-
*/
|
|
22988
|
-
this.title = "";
|
|
22989
|
-
/**
|
|
22990
|
-
* Sets description of SgdsFooter
|
|
22991
|
-
*/
|
|
22992
|
-
this.description = "";
|
|
22993
|
-
/**
|
|
22994
|
-
* Sets copyrightLiner of SgdsFooter
|
|
22995
|
-
*/
|
|
22996
|
-
this.copyrightLiner = "Government of Singapore";
|
|
22997
|
-
/**
|
|
22998
|
-
* Array of type
|
|
22999
|
-
*
|
|
23000
|
-
* `interface ColumnLinks { title: string; links : Links[] } interface Links { href: string; label: string; }`
|
|
23001
|
-
*/
|
|
23002
|
-
this.links = [];
|
|
23003
|
-
/**
|
|
23004
|
-
* String date for last updated date
|
|
23126
|
+
* Sets copyrightLiner of SgdsFooter
|
|
23005
23127
|
*/
|
|
23006
|
-
this.
|
|
23128
|
+
this.copyrightLiner = "Government of Singapore";
|
|
23007
23129
|
/**
|
|
23008
23130
|
* href link for contacts
|
|
23009
23131
|
*/
|
|
@@ -23012,6 +23134,10 @@
|
|
|
23012
23134
|
* href link for feedback
|
|
23013
23135
|
*/
|
|
23014
23136
|
this.feedbackHref = "#";
|
|
23137
|
+
/**
|
|
23138
|
+
* href link for faq
|
|
23139
|
+
*/
|
|
23140
|
+
this.faqHref = "#";
|
|
23015
23141
|
/**
|
|
23016
23142
|
* href link for privacy statement
|
|
23017
23143
|
*/
|
|
@@ -23021,94 +23147,83 @@
|
|
|
23021
23147
|
*/
|
|
23022
23148
|
this.termsOfUseHref = "#";
|
|
23023
23149
|
}
|
|
23150
|
+
firstUpdated() {
|
|
23151
|
+
const socialMediaSlot = this.shadowRoot.querySelector("slot[name='social-media']");
|
|
23152
|
+
const footerTitleSlot = this.shadowRoot.querySelector("slot[name='title']");
|
|
23153
|
+
const footerDescriptionSlot = this.shadowRoot.querySelector("slot[name='description']");
|
|
23154
|
+
const footerItemsSlot = this.shadowRoot.querySelector("slot[name='items']");
|
|
23155
|
+
const socialMediaChildNodes = socialMediaSlot.assignedNodes({ flatten: true });
|
|
23156
|
+
const footerTitleChildNodes = footerTitleSlot.assignedNodes({ flatten: true });
|
|
23157
|
+
const footerDescriptionChildNodes = footerDescriptionSlot.assignedNodes({ flatten: true });
|
|
23158
|
+
const footerItemsChildNodes = footerItemsSlot.assignedNodes({ flatten: true });
|
|
23159
|
+
if (socialMediaChildNodes.length === 0) {
|
|
23160
|
+
const socialMediaContainer = this.shadowRoot.querySelector(".social-media");
|
|
23161
|
+
socialMediaContainer.style.display = "none";
|
|
23162
|
+
}
|
|
23163
|
+
if (footerTitleChildNodes.length === 0 && footerDescriptionChildNodes.length === 0) {
|
|
23164
|
+
const footerHeaderContainer = this.shadowRoot.querySelector(".footer-header");
|
|
23165
|
+
footerHeaderContainer.style.display = "none";
|
|
23166
|
+
}
|
|
23167
|
+
if (footerItemsChildNodes.length === 0) {
|
|
23168
|
+
const footerItemsContainer = this.shadowRoot.querySelector(".footer-items");
|
|
23169
|
+
footerItemsContainer.style.display = "none";
|
|
23170
|
+
}
|
|
23171
|
+
if (footerTitleChildNodes.length === 0 &&
|
|
23172
|
+
footerDescriptionChildNodes.length === 0 &&
|
|
23173
|
+
footerItemsChildNodes.length === 0) {
|
|
23174
|
+
const footerTopContainer = this.shadowRoot.querySelector(".footer-top");
|
|
23175
|
+
footerTopContainer.style.display = "none";
|
|
23176
|
+
}
|
|
23177
|
+
}
|
|
23024
23178
|
render() {
|
|
23025
|
-
// if description is defined
|
|
23026
|
-
const hasDescription = html$1 ` <div class="description">${this.description}</div>`;
|
|
23027
23179
|
return html$1 `
|
|
23028
|
-
<footer class="
|
|
23029
|
-
<section class="footer-top"
|
|
23030
|
-
<div class="
|
|
23031
|
-
<
|
|
23032
|
-
|
|
23033
|
-
|
|
23034
|
-
|
|
23035
|
-
|
|
23036
|
-
</div>
|
|
23037
|
-
<div class="row footer-items">
|
|
23038
|
-
${this.links.map((item) => html$1 `
|
|
23039
|
-
<div class="col-xxl-2 col-md-4 mb-3">
|
|
23040
|
-
<div class="title">${item.title}</div>
|
|
23041
|
-
<ul class="links">
|
|
23042
|
-
${item.links.map((link) => html$1 ` <li><a href=${link.href}>${link.label}</a></li> `)}
|
|
23043
|
-
</ul>
|
|
23044
|
-
</div>
|
|
23045
|
-
`)}
|
|
23046
|
-
</div>
|
|
23047
|
-
<div class="row footer-contact-links">
|
|
23048
|
-
<div class="col">
|
|
23049
|
-
<div class="d-flex justify-content-lg-end">
|
|
23050
|
-
<ul>
|
|
23051
|
-
<li><a href=${this.contactHref}>Contact</a></li>
|
|
23052
|
-
<li><a href=${this.feedbackHref}>Feedback</a></li>
|
|
23053
|
-
</ul>
|
|
23054
|
-
</div>
|
|
23055
|
-
</div>
|
|
23056
|
-
</div>
|
|
23180
|
+
<footer class="footer">
|
|
23181
|
+
<section class="footer-top">
|
|
23182
|
+
<div class="footer-header">
|
|
23183
|
+
<slot name="title"></slot>
|
|
23184
|
+
<slot name="description"></slot>
|
|
23185
|
+
</div>
|
|
23186
|
+
<div class="footer-items">
|
|
23187
|
+
<slot name="items"></slot>
|
|
23057
23188
|
</div>
|
|
23058
23189
|
</section>
|
|
23059
|
-
<section class="footer-bottom"
|
|
23060
|
-
<div class="
|
|
23061
|
-
<
|
|
23062
|
-
|
|
23063
|
-
|
|
23064
|
-
|
|
23065
|
-
|
|
23066
|
-
|
|
23067
|
-
|
|
23068
|
-
|
|
23069
|
-
|
|
23070
|
-
|
|
23071
|
-
</
|
|
23072
|
-
</
|
|
23073
|
-
|
|
23074
|
-
|
|
23075
|
-
|
|
23076
|
-
|
|
23077
|
-
© ${new Date().getFullYear()} ${this.copyrightLiner}<br />
|
|
23078
|
-
Last Updated ${this.lastUpdatedDate}
|
|
23079
|
-
</div>
|
|
23080
|
-
</div>
|
|
23081
|
-
</div>
|
|
23190
|
+
<section class="footer-bottom">
|
|
23191
|
+
<div class="social-media">
|
|
23192
|
+
<slot name="social-media"></slot>
|
|
23193
|
+
</div>
|
|
23194
|
+
<div class="footer-mandatory-links">
|
|
23195
|
+
<ul>
|
|
23196
|
+
<li><a href=${this.contactHref}>Contact</a></li>
|
|
23197
|
+
<li><a href=${this.feedbackHref}>Feedback</a></li>
|
|
23198
|
+
<li><a href=${this.faqHref}>FAQ</a></li>
|
|
23199
|
+
<li>
|
|
23200
|
+
<a href="https://tech.gov.sg/report_vulnerability" target="_blank" rel="noopener noreferrer">
|
|
23201
|
+
Report Vulnerability
|
|
23202
|
+
</a>
|
|
23203
|
+
</li>
|
|
23204
|
+
<li><a href=${this.privacyHref}>Privacy Statement</a></li>
|
|
23205
|
+
<li><a href=${this.termsOfUseHref}>Terms of use</a></li>
|
|
23206
|
+
</ul>
|
|
23207
|
+
<div class="footer-copyrights">© ${new Date().getFullYear()}, ${this.copyrightLiner}</div>
|
|
23082
23208
|
</div>
|
|
23083
23209
|
</section>
|
|
23084
23210
|
</footer>
|
|
23085
23211
|
`;
|
|
23086
23212
|
}
|
|
23087
23213
|
}
|
|
23088
|
-
SgdsFooter.styles = [...SgdsElement.styles, css_248z$
|
|
23089
|
-
__decorate([
|
|
23090
|
-
property({ type: String })
|
|
23091
|
-
], SgdsFooter.prototype, "title", void 0);
|
|
23092
|
-
__decorate([
|
|
23093
|
-
property({ type: String })
|
|
23094
|
-
], SgdsFooter.prototype, "description", void 0);
|
|
23214
|
+
SgdsFooter.styles = [...SgdsElement.styles, css_248z$s];
|
|
23095
23215
|
__decorate([
|
|
23096
23216
|
property({ type: String })
|
|
23097
23217
|
], SgdsFooter.prototype, "copyrightLiner", void 0);
|
|
23098
|
-
__decorate([
|
|
23099
|
-
property({
|
|
23100
|
-
type: Array
|
|
23101
|
-
})
|
|
23102
|
-
], SgdsFooter.prototype, "links", void 0);
|
|
23103
|
-
__decorate([
|
|
23104
|
-
property({ type: String })
|
|
23105
|
-
], SgdsFooter.prototype, "lastUpdatedDate", void 0);
|
|
23106
23218
|
__decorate([
|
|
23107
23219
|
property({ type: String })
|
|
23108
23220
|
], SgdsFooter.prototype, "contactHref", void 0);
|
|
23109
23221
|
__decorate([
|
|
23110
23222
|
property({ type: String })
|
|
23111
23223
|
], SgdsFooter.prototype, "feedbackHref", void 0);
|
|
23224
|
+
__decorate([
|
|
23225
|
+
property({ type: String })
|
|
23226
|
+
], SgdsFooter.prototype, "faqHref", void 0);
|
|
23112
23227
|
__decorate([
|
|
23113
23228
|
property({ type: String })
|
|
23114
23229
|
], SgdsFooter.prototype, "privacyHref", void 0);
|
|
@@ -23116,13 +23231,41 @@
|
|
|
23116
23231
|
property({ type: String })
|
|
23117
23232
|
], SgdsFooter.prototype, "termsOfUseHref", void 0);
|
|
23118
23233
|
|
|
23234
|
+
var css_248z$r = css`.footer-item{margin-bottom:var(--sgds-margin-3-xs)}.footer-item,.links{display:flex;flex-direction:column;gap:var(--sgds-gap-xs)}slot[name=title]::slotted(*){--sgds-paragraph-spacing-xl:var(--sgds-margin-none);--sgds-font-weight-regular:var(--sgds-font-weight-semibold);color:var(--sgds-default-color-inverse);font-weight:var(--sgds-font-weight-regular,--sgds-font-weight-semibold);margin:var(--sgds-paragraph-spacing-xl,--sgds-margin-none)}.links{margin:0;padding:0}.links slot::slotted(a){--sgds-link-color:var(--sgds-default-color-muted);color:var(--sgds-link-color,--sgds-default-color-muted);text-decoration:none!important;width:fit-content}.links slot::slotted(a:focus),.links slot::slotted(a:focus-visible),slot::slotted(a:hover){--sgds-link-color-emphasis:var(--sgds-default-color-inverse);color:var(--sgds-link-color-emphasis,--sgds-default-color-inverse)}.links slot::slotted(a:focus),.links slot::slotted(a:focus-visible){box-shadow:var(--sgds-box-shadow-focus);outline:0}`;
|
|
23235
|
+
|
|
23236
|
+
/**
|
|
23237
|
+
* @summary The footer item component organizes links under a clear, descriptive title within the footer. It helps users easily navigate to related resources or information, ensuring clarity and accessibility.
|
|
23238
|
+
*
|
|
23239
|
+
* @slot default - The slot for the list of link items
|
|
23240
|
+
* @slot title - The slot for the title of the list of items
|
|
23241
|
+
*
|
|
23242
|
+
*/
|
|
23243
|
+
class SgdsFooterItem extends SgdsElement {
|
|
23244
|
+
render() {
|
|
23245
|
+
return html$1 `
|
|
23246
|
+
<div class="footer-item">
|
|
23247
|
+
<slot name="title"></slot>
|
|
23248
|
+
<div class="links">
|
|
23249
|
+
<slot></slot>
|
|
23250
|
+
</div>
|
|
23251
|
+
</div>
|
|
23252
|
+
`;
|
|
23253
|
+
}
|
|
23254
|
+
}
|
|
23255
|
+
SgdsFooterItem.styles = [...SgdsElement.styles, css_248z$r];
|
|
23256
|
+
|
|
23119
23257
|
customElements.define("sgds-footer", SgdsFooter);
|
|
23258
|
+
customElements.define("sgds-footer-item", SgdsFooterItem);
|
|
23120
23259
|
|
|
23121
|
-
|
|
23260
|
+
customElements.define("sgds-icon", SgdsIcon);
|
|
23261
|
+
|
|
23262
|
+
var css_248z$q = css`.btn.btn-icon{display:flex;height:var(--sgds-dimension-48,56px);min-width:unset;padding:0;width:var(--sgds-dimension-48,56px)}.btn.btn-icon.btn-lg{font-size:var(--sgds-font-size-3);height:var(--sgds-dimension-56);min-width:unset;padding:0;width:var(--sgds-dimension-56)}.btn.btn-icon.btn-sm{font-size:var(--sgds-font-size-1);height:var(--sgds-dimension-40);min-width:unset;padding:0;width:var(--sgds-dimension-40)}`;
|
|
23122
23263
|
|
|
23123
23264
|
/**
|
|
23124
23265
|
* @summary An icon button is a user interface element that combines an icon and a button, serving as a clickable or tabbable component.
|
|
23125
23266
|
*
|
|
23267
|
+
* @slot default - The slot for sgds-icon
|
|
23268
|
+
*
|
|
23126
23269
|
* @event sgds-blur - Emitted when the button is blurred.
|
|
23127
23270
|
* @event sgds-focus - Emitted when the button is focused.
|
|
23128
23271
|
*/
|
|
@@ -23139,7 +23282,7 @@
|
|
|
23139
23282
|
[`btn-${this.size}`]: this.size
|
|
23140
23283
|
})}"
|
|
23141
23284
|
?disabled=${ifDefined(isLink ? undefined : this.disabled)}
|
|
23142
|
-
type
|
|
23285
|
+
type=${ifDefined(isLink ? undefined : "button")}
|
|
23143
23286
|
href=${ifDefined(isLink ? this.href : undefined)}
|
|
23144
23287
|
target=${ifDefined(isLink ? this.target : undefined)}
|
|
23145
23288
|
download=${ifDefined(isLink ? this.download : undefined)}
|
|
@@ -23152,21 +23295,16 @@
|
|
|
23152
23295
|
@blur=${this._handleBlur}
|
|
23153
23296
|
aria-label=${ifDefined(this.ariaLabel)}
|
|
23154
23297
|
>
|
|
23155
|
-
|
|
23156
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M3 12C3 11.8295 3.06773 11.666 3.18828 11.5455C3.30883 11.4249 3.47233 11.3572 3.64282 11.3572H18.8043L14.7584 7.31258C14.6377 7.19187 14.5699 7.02817 14.5699 6.85746C14.5699 6.68676 14.6377 6.52305 14.7584 6.40235C14.8791 6.28165 15.0428 6.21384 15.2135 6.21384C15.3842 6.21384 15.5479 6.28165 15.6686 6.40235L20.8111 11.5449C20.871 11.6046 20.9185 11.6755 20.9509 11.7536C20.9833 11.8317 21 11.9154 21 12C21 12.0845 20.9833 12.1683 20.9509 12.2464C20.9185 12.3245 20.871 12.3954 20.8111 12.4551L15.6686 17.5976C15.5479 17.7183 15.3842 17.7861 15.2135 17.7861C15.0428 17.7861 14.8791 17.7183 14.7584 17.5976C14.6377 17.4769 14.5699 17.3132 14.5699 17.1425C14.5699 16.9718 14.6377 16.8081 14.7584 16.6874L18.8043 12.6428H3.64282C3.47233 12.6428 3.30883 12.5751 3.18828 12.4545C3.06773 12.334 3 12.1705 3 12Z" fill="currentColor"/>
|
|
23157
|
-
</svg>
|
|
23298
|
+
<slot></slot>
|
|
23158
23299
|
</${tag}>
|
|
23159
23300
|
`;
|
|
23160
23301
|
}
|
|
23161
23302
|
}
|
|
23162
|
-
SgdsIconButton.styles = [...ButtonElement.styles, css_248z$
|
|
23163
|
-
__decorate([
|
|
23164
|
-
property({ type: String, reflect: true })
|
|
23165
|
-
], SgdsIconButton.prototype, "name", void 0);
|
|
23303
|
+
SgdsIconButton.styles = [...ButtonElement.styles, css_248z$q];
|
|
23166
23304
|
|
|
23167
23305
|
customElements.define("sgds-icon-button", SgdsIconButton);
|
|
23168
23306
|
|
|
23169
|
-
var css_248z$
|
|
23307
|
+
var css_248z$p = css`slot{display:flex;flex-direction:column;gap:var(--sgds-gap-xs)}slot::slotted(*){align-items:center;display:flex;gap:var(--sgds-gap-xs)}.sm{font-size:var(--sgds-font-size-1)}.lg{font-size:var(--sgds-font-size-3)}`;
|
|
23170
23308
|
|
|
23171
23309
|
/**
|
|
23172
23310
|
* @summary A IconList can be used to display content related to the same topic. Each list item begins an icon.
|
|
@@ -23189,7 +23327,7 @@
|
|
|
23189
23327
|
`;
|
|
23190
23328
|
}
|
|
23191
23329
|
}
|
|
23192
|
-
SgdsIconList.styles = [...SgdsElement.styles, css_248z$
|
|
23330
|
+
SgdsIconList.styles = [...SgdsElement.styles, css_248z$p];
|
|
23193
23331
|
__decorate([
|
|
23194
23332
|
property({ type: String, reflect: true })
|
|
23195
23333
|
], SgdsIconList.prototype, "role", void 0);
|
|
@@ -23201,7 +23339,7 @@
|
|
|
23201
23339
|
|
|
23202
23340
|
customElements.define("sgds-input", SgdsInput);
|
|
23203
23341
|
|
|
23204
|
-
var css_248z$
|
|
23342
|
+
var css_248z$o = css`a.nav-link{align-items:center;color:var(--sgds-primary-color);cursor:pointer;display:inline-flex;flex-shrink:0;gap:var(--sgds-gap-xs);height:var(--sgds-dimension-24);justify-content:center;text-decoration:none}a.nav-link:hover{color:var(--sgds-primary-color-emphasis)}a.nav-link:focus,a.nav-link:focus-visible{box-shadow:var(--sgds-box-shadow-focus);color:var(--sgds-primary-color-emphasis);outline:0}a.nav-link.disabled,a.nav-link[disabled]{cursor:not-allowed;opacity:var(--sgds-opacity-50)}:host([variant=danger]) a.nav-link{color:var(--sgds-danger-color)}:host([variant=danger]) a.nav-link:focus,:host([variant=danger]) a.nav-link:focus-visible,:host([variant=danger]) a.nav-link:hover{color:var(--sgds-danger-color-emphasis)}:host([size=lg]) a.nav-link{font-size:var(--sgds-font-size-3);height:var(--sgds-dimension-32)}:host([size=sm]) a.nav-link{font-size:var(--sgds-font-size-1);height:var(--sgds-dimension-20)}`;
|
|
23205
23343
|
|
|
23206
23344
|
/**
|
|
23207
23345
|
* @summary Link allows users to click and navigate their way from page to page
|
|
@@ -23265,7 +23403,7 @@
|
|
|
23265
23403
|
`;
|
|
23266
23404
|
}
|
|
23267
23405
|
}
|
|
23268
|
-
SgdsLink.styles = [...LinkElement.styles, css_248z$
|
|
23406
|
+
SgdsLink.styles = [...LinkElement.styles, css_248z$o];
|
|
23269
23407
|
__decorate([
|
|
23270
23408
|
property({ type: String, reflect: true })
|
|
23271
23409
|
], SgdsLink.prototype, "size", void 0);
|
|
@@ -23281,7 +23419,7 @@
|
|
|
23281
23419
|
const XL_BREAKPOINT = 1200;
|
|
23282
23420
|
const XXL_BREAKPOINT = 1400;
|
|
23283
23421
|
|
|
23284
|
-
var css_248z$
|
|
23422
|
+
var css_248z$n = css`:host{--mainnav-bg:transparent;--mainnav-padding-x:var(--sgds-spacer-5);--mainnav-padding-y:var(--sgds-spacer-0);--mainnav-mobile-padding-x:var(--sgds-spacer-2);--mainnav-mobile-padding-y:var(--sgds-spacer-0);--mainnav-border-bottom-width:1px;--mainnav-border-bottom-color:var(--sgds-gray-400);--mainnav-theme-color:var(--sgds-primary)}.navbar{align-items:stretch;background-color:var(--mainnav-bg);border-bottom:var(--mainnav-border-bottom-width) solid var(--mainnav-border-bottom-color);display:flex;flex-wrap:wrap;justify-content:space-between;min-height:80px;padding:var(--mainnav-padding-y) var(--mainnav-padding-x);position:relative;@media (max-width:768px){padding:var(--mainnav-mobile-padding-y) var(--mainnav-mobile-padding-x)}}.navbar-brand{align-items:center;display:flex;font-size:1.25rem;margin-right:var(--sgds-spacer-4);padding-bottom:.125rem;padding-top:.125rem;text-decoration:none;white-space:nowrap}.navbar-brand,.navbar-brand:focus,.navbar-brand:hover{color:rgba(var(--sgds-emphasis-color-rgb),.9)}.navbar-nav{display:flex;flex-direction:column;gap:var(--sgds-spacer-4);height:100%;list-style:none;margin-bottom:0;margin-top:0;padding-left:0;padding-right:var(--sgds-spacer-4);width:100%}.navbar-collapse{align-items:center;flex-basis:100%;flex-grow:1}.navbar-toggler{background-color:transparent;border:none;cursor:pointer;font-size:1.25rem;line-height:1;padding:var(--sgds-spacer-1) .75rem}@media (prefers-reduced-motion:reduce){.navbar-toggler{transition:none}}.navbar-toggler:hover{text-decoration:none}.navbar-toggler:focus{box-shadow:none;outline:0;text-decoration:none}.navbar-toggler-icon{background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" fill="currentColor" class="bi bi-list" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5z"/></svg>');background-position:50%;background-repeat:no-repeat;background-size:100%;display:inline-block;height:1.5em;vertical-align:middle;width:1.5em}.navbar-nav-scroll{max-height:75vh;overflow-y:auto;padding-right:.5rem}@media (min-width:576px){.navbar-expand-sm{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-sm .navbar-nav{flex-direction:row}.navbar-expand-sm .navbar-nav-scroll{overflow:visible}.navbar-expand-sm .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-sm .navbar-toggler{display:none}}@media (min-width:768px){.navbar-expand-md{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-md .navbar-nav{flex-direction:row}.navbar-expand-md .navbar-nav-scroll{overflow:visible}.navbar-expand-md .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-md .navbar-toggler{display:none}}@media (min-width:992px){.navbar-expand-lg{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-lg .navbar-nav{flex-direction:row}.navbar-expand-lg .navbar-nav-scroll{overflow:visible}.navbar-expand-lg .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-lg .navbar-toggler{display:none}}@media (min-width:1200px){.navbar-expand-xl{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-xl .navbar-nav .nav-link{padding-left:var(--mainnav-nav-link-padding-x);padding-right:var(--mainnav-nav-link-padding-x)}.navbar-expand-xl .navbar-nav-scroll{overflow:visible}.navbar-expand-xl .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-xl .navbar-toggler{display:none}}@media (min-width:1400px){.navbar-expand-xxl{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-xxl .navbar-nav{flex-direction:row}.navbar-expand-xxl .navbar-nav-scroll{overflow:visible}.navbar-expand-xxl .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-xxl .navbar-toggler{display:none}}.navbar-expand{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand .navbar-nav{flex-direction:row}.navbar-expand .navbar-nav-scroll{overflow:visible}.navbar-expand .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand .navbar-toggler{display:none}.order-first{order:-1!important}.order-1{order:1!important}.order-2{order:2!important}.order-last{order:6!important}slot[name=non-collapsible]{align-items:center}.slot-end,slot[name=non-collapsible]{display:flex;gap:var(--sgds-spacer-4);margin-left:auto}.slot-end{align-items:stretch}.slot-end::slotted(:not([name$=-mainnav-item]):not([name$=-mainnav-dropdown])){align-self:center}`;
|
|
23285
23423
|
|
|
23286
23424
|
const SIZES = {
|
|
23287
23425
|
sm: SM_BREAKPOINT,
|
|
@@ -23457,7 +23595,7 @@
|
|
|
23457
23595
|
}
|
|
23458
23596
|
}
|
|
23459
23597
|
}
|
|
23460
|
-
SgdsMainnav.styles = [...SgdsElement.styles, css_248z$
|
|
23598
|
+
SgdsMainnav.styles = [...SgdsElement.styles, css_248z$n];
|
|
23461
23599
|
__decorate([
|
|
23462
23600
|
query(".navbar-toggler")
|
|
23463
23601
|
], SgdsMainnav.prototype, "header", void 0);
|
|
@@ -23494,7 +23632,7 @@
|
|
|
23494
23632
|
options: { duration: 200, easing: "ease-in-out" }
|
|
23495
23633
|
});
|
|
23496
23634
|
|
|
23497
|
-
var css_248z$
|
|
23635
|
+
var css_248z$m = css`.dropdown-menu{background-color:#fff;border:1px solid rgba(0,0,0,.1);border-radius:0 0 5px 5px;box-shadow:0 .5rem 1rem rgba(0,0,0,.15);margin-top:0}.nav-link.show{border-color:var(--mainnav-theme-color);color:var(--mainnav-theme-color)}.sgds.dropdown.nav-item{height:100%}a.nav-link{align-items:center;border-bottom:.125rem solid transparent;color:var(--sgds-body-color);cursor:pointer;display:flex;min-height:100%;padding:0;text-decoration:none;&.active,&:hover{border-color:var(--mainnav-theme-color);color:var(--mainnav-theme-color)}&:focus-visible{box-shadow:0 0 0 .25rem rgba(89,66,219,.25);outline:0}}.nav-link.disabled{cursor:default;opacity:var(--mainnav-disabled-opacity);pointer-events:none}`;
|
|
23498
23636
|
|
|
23499
23637
|
/**
|
|
23500
23638
|
* @slot default - The menu items. Pass in sgds-dropdown-item as the menu items
|
|
@@ -23557,7 +23695,7 @@
|
|
|
23557
23695
|
`;
|
|
23558
23696
|
}
|
|
23559
23697
|
}
|
|
23560
|
-
SgdsMainnavDropdown.styles = [...DropdownListElement.styles, css_248z$
|
|
23698
|
+
SgdsMainnavDropdown.styles = [...DropdownListElement.styles, css_248z$F, css_248z$B, css_248z$m];
|
|
23561
23699
|
__decorate([
|
|
23562
23700
|
queryAsync("a")
|
|
23563
23701
|
], SgdsMainnavDropdown.prototype, "dropdownRef", void 0);
|
|
@@ -23568,7 +23706,7 @@
|
|
|
23568
23706
|
property({ type: Boolean })
|
|
23569
23707
|
], SgdsMainnavDropdown.prototype, "active", void 0);
|
|
23570
23708
|
|
|
23571
|
-
var css_248z$
|
|
23709
|
+
var css_248z$l = css`:host{--mainnav-item-border-bottom-width:0.125rem}li{height:100%}a.nav-link{align-items:center;border-bottom:var(--mainnav-item-border-bottom-width) solid transparent;color:var(--sgds-body-color);cursor:pointer;display:flex;min-height:100%;padding:0;text-decoration:none;&.active,&:hover{border-color:var(--mainnav-theme-color);color:var(--mainnav-theme-color)}&:focus-visible{box-shadow:0 0 0 .25rem rgba(89,66,219,.25);outline:0}}.nav-link.disabled{cursor:default;opacity:var(--sgds-disabled-opacity);pointer-events:none}`;
|
|
23572
23710
|
|
|
23573
23711
|
/**
|
|
23574
23712
|
* @slot default - slot for SgdsMainnavItem element.
|
|
@@ -23576,13 +23714,15 @@
|
|
|
23576
23714
|
* */
|
|
23577
23715
|
class SgdsMainnavItem extends LinkElement {
|
|
23578
23716
|
}
|
|
23579
|
-
SgdsMainnavItem.styles = [...LinkElement.styles, css_248z$
|
|
23717
|
+
SgdsMainnavItem.styles = [...LinkElement.styles, css_248z$l];
|
|
23580
23718
|
|
|
23581
23719
|
customElements.define("sgds-mainnav", SgdsMainnav);
|
|
23582
23720
|
customElements.define("sgds-mainnav-dropdown", SgdsMainnavDropdown);
|
|
23583
23721
|
customElements.define("sgds-mainnav-item", SgdsMainnavItem);
|
|
23584
23722
|
|
|
23585
|
-
var css_248z$
|
|
23723
|
+
var css_248z$k = css`:host{--masthead-max-width:1440px;--masthead-padding-x:2rem}b{font-weight:bolder}[role=button]{cursor:pointer}a{color:#0049dc}a:hover{color:#0022b9}.sgds-masthead{color:light-dark(#252525,#eaeaea);font-family:Inter,system-ui,sans-serif;font-size:.875rem;line-height:1.25rem}.banner{background-color:light-dark(#eaeaea,#252525)}.container{margin-left:auto;margin-right:auto;max-width:var(--masthead-max-width);padding:.25rem var(--masthead-padding-x);width:100%}.sg-crest{flex-shrink:0;height:20px;width:20px}.sg-crest path{fill:#db0000}.masthead-layout{display:flex;gap:.25rem}.masthead-text-layout{align-items:center;display:flex;flex-wrap:wrap;gap:0 .75rem}.sgds-masthead-identify-icon{align-self:center;display:block;height:20px;transform:rotate(180deg);transition:transform .3s ease-in-out 0s;user-select:none;width:20px}.sgds-masthead-identify-icon.show{transform:rotate(0deg)}.sgds-masthead-button{align-items:center;color:light-dark(#0049dc,#7fb5ff);cursor:pointer;display:flex;gap:4px}.sgds-masthead-button:hover{color:light-dark(#0022b9,#5592ff)}.panel{background-color:light-dark(hsla(0,0%,5%,.05),hsla(0,0%,100%,.1))}.sgds-masthead .sgds-masthead-content{display:none;padding-bottom:1rem;padding-top:1rem}.sgds-masthead .sgds-masthead-content.show{display:block}.content-grid{display:grid;gap:1.5rem;grid-template-columns:repeat(auto-fit,minmax(300px,1fr))}.icon{margin-top:-.1em}.wrapper{display:flex;gap:.5rem}.content{display:flex;flex-direction:column;gap:.25rem}.content .title{font-weight:600}.content article{color:light-dark(#595959,#b2b2b2)}.banner-icon,.banner-icon-inline{height:20px;width:20px}.banner-icon path,.banner-icon-inline path{fill:light-dark(#0e0e0e,#fff)}a.trusted-websites-link{color:light-dark(#0049dc,#7fb5ff);text-decoration:underline;width:fit-content}a.trusted-websites-link:hover{color:light-dark(#0022b9,#5592ff)}@media screen and (max-width:768px){.container{--masthead-padding-x:1rem}.sgds-masthead-content .content-grid{gap:1rem;grid-template-columns:1fr}}`;
|
|
23724
|
+
|
|
23725
|
+
var css_248z$j = css`svg{vertical-align:middle}`;
|
|
23586
23726
|
|
|
23587
23727
|
/**
|
|
23588
23728
|
* @summary All .gov.sg digital services shall adopt The Official Government Banner for every page in the digital service and be placed at the top of the page.
|
|
@@ -23755,7 +23895,7 @@
|
|
|
23755
23895
|
`;
|
|
23756
23896
|
}
|
|
23757
23897
|
}
|
|
23758
|
-
SgdsMasthead.styles = [...SgdsElement.styles, css_248z$
|
|
23898
|
+
SgdsMasthead.styles = [...SgdsElement.styles, css_248z$j, css_248z$M, css_248z$k];
|
|
23759
23899
|
__decorate([
|
|
23760
23900
|
state()
|
|
23761
23901
|
], SgdsMasthead.prototype, "toggleVisibility", void 0);
|
|
@@ -24131,7 +24271,7 @@
|
|
|
24131
24271
|
`;
|
|
24132
24272
|
}
|
|
24133
24273
|
}
|
|
24134
|
-
SgdsModal.styles = [...SgdsElement.styles, css_248z$
|
|
24274
|
+
SgdsModal.styles = [...SgdsElement.styles, css_248z$Z, css_248z$j, css_248z$i];
|
|
24135
24275
|
__decorate([
|
|
24136
24276
|
query(".modal")
|
|
24137
24277
|
], SgdsModal.prototype, "dialog", void 0);
|
|
@@ -24723,45 +24863,82 @@
|
|
|
24723
24863
|
/**
|
|
24724
24864
|
* @summary The quantity toggle component is used to increase or decrease an incremental venue, best used when the user needs to enter or adjust the quantity of a selected item.
|
|
24725
24865
|
*
|
|
24726
|
-
* @csspart base - The base wrapper of the quantity toggle component.
|
|
24727
|
-
* @csspart button - The plus and minus button of quantity toggle
|
|
24728
|
-
*
|
|
24729
24866
|
* @event sgds-change - Emitted when an alteration to the control's value is committed by the user.
|
|
24730
24867
|
* @event sgds-input - Emitted when the control receives input and its value changes.
|
|
24731
24868
|
*
|
|
24732
24869
|
*/
|
|
24733
|
-
class SgdsQuantityToggle extends FormControlElement {
|
|
24870
|
+
class SgdsQuantityToggle extends SgdsFormValidatorMixin(ScopedElementsMixin(FormControlElement)) {
|
|
24734
24871
|
constructor() {
|
|
24735
24872
|
super(...arguments);
|
|
24736
|
-
/** @internal */
|
|
24737
|
-
this.formSubmitController = new FormSubmitController(this);
|
|
24738
24873
|
/** Controls the size of the quantity toggle */
|
|
24739
24874
|
this.size = "md";
|
|
24740
24875
|
/** The input's value. Set to 0 by default */
|
|
24741
24876
|
this.value = 0;
|
|
24742
|
-
/**
|
|
24743
|
-
|
|
24744
|
-
/** The quantity toggle's button variants */
|
|
24745
|
-
this.iconButtonVariant = "ghost";
|
|
24877
|
+
// /** The quantity toggle's button variants */
|
|
24878
|
+
// @property({ type: String }) iconButtonVariant = "ghost";
|
|
24746
24879
|
/** Controls the incremental / decremental value of the input */
|
|
24747
24880
|
this.step = 1;
|
|
24748
24881
|
/** Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */
|
|
24749
24882
|
this.defaultValue = 0;
|
|
24750
|
-
/** @internal The id forwarded to input element */
|
|
24751
|
-
this.inputId = genId("quantity-toggle", "input");
|
|
24752
24883
|
}
|
|
24753
24884
|
/** @internal */
|
|
24754
24885
|
static get scopedElements() {
|
|
24755
24886
|
return {
|
|
24756
24887
|
"sgds-input": SgdsInput,
|
|
24757
|
-
"sgds-icon-button": SgdsIconButton
|
|
24888
|
+
"sgds-icon-button": SgdsIconButton,
|
|
24889
|
+
"sgds-icon": SgdsIcon
|
|
24758
24890
|
};
|
|
24759
24891
|
}
|
|
24760
|
-
|
|
24761
|
-
|
|
24762
|
-
|
|
24892
|
+
/**
|
|
24893
|
+
* Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
|
|
24894
|
+
* 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
|
|
24895
|
+
*/
|
|
24896
|
+
reportValidity() {
|
|
24897
|
+
return this._mixinReportValidity();
|
|
24898
|
+
}
|
|
24899
|
+
/**
|
|
24900
|
+
* Checks for validity without any native error popup message
|
|
24901
|
+
*/
|
|
24902
|
+
checkValidity() {
|
|
24903
|
+
return this._mixinCheckValidity();
|
|
24904
|
+
}
|
|
24905
|
+
/**
|
|
24906
|
+
* Returns the ValidityState object
|
|
24907
|
+
*/
|
|
24908
|
+
get validity() {
|
|
24909
|
+
return this._mixinGetValidity();
|
|
24910
|
+
}
|
|
24911
|
+
/**
|
|
24912
|
+
* Returns the validation message based on the ValidityState
|
|
24913
|
+
*/
|
|
24914
|
+
get validationMessage() {
|
|
24915
|
+
return this._mixinGetValidationMessage();
|
|
24916
|
+
}
|
|
24917
|
+
async _handleChange() {
|
|
24918
|
+
const sgdsInput = await this._sgdsInput;
|
|
24919
|
+
if (parseInt(sgdsInput.value) < this.step || sgdsInput.value === "") {
|
|
24920
|
+
sgdsInput.value = "0";
|
|
24921
|
+
}
|
|
24922
|
+
this.value = parseInt(sgdsInput.value);
|
|
24923
|
+
this._mixinSetFormValue();
|
|
24924
|
+
this._mixinValidate(sgdsInput.input);
|
|
24925
|
+
this.invalid = !this._mixinReportValidity();
|
|
24926
|
+
}
|
|
24927
|
+
async _handleInputChange() {
|
|
24928
|
+
const sgdsInput = await this._sgdsInput;
|
|
24929
|
+
this.invalid = false;
|
|
24930
|
+
if (parseInt(sgdsInput.value) < this.step || sgdsInput.value === "") {
|
|
24931
|
+
sgdsInput.value = "0";
|
|
24763
24932
|
}
|
|
24764
|
-
this.value = parseInt(
|
|
24933
|
+
this.value = parseInt(sgdsInput.value);
|
|
24934
|
+
this._mixinSetFormValue();
|
|
24935
|
+
this._mixinValidate(sgdsInput.input);
|
|
24936
|
+
}
|
|
24937
|
+
async _mixinResetFormControl() {
|
|
24938
|
+
const sgdsInput = await this._sgdsInput;
|
|
24939
|
+
this.value = this.defaultValue;
|
|
24940
|
+
sgdsInput.input.value = this.value.toString();
|
|
24941
|
+
this._mixinResetValidity(sgdsInput.input);
|
|
24765
24942
|
}
|
|
24766
24943
|
_handleKeyDown(event) {
|
|
24767
24944
|
const allowedKeys = [
|
|
@@ -24778,6 +24955,12 @@
|
|
|
24778
24955
|
event.preventDefault();
|
|
24779
24956
|
}
|
|
24780
24957
|
}
|
|
24958
|
+
_handleInvalid() {
|
|
24959
|
+
this.invalid = true;
|
|
24960
|
+
}
|
|
24961
|
+
_handleValid() {
|
|
24962
|
+
this.invalid = false;
|
|
24963
|
+
}
|
|
24781
24964
|
/** Simulates a click on the plus button */
|
|
24782
24965
|
plus() {
|
|
24783
24966
|
this.plusBtn.click();
|
|
@@ -24786,23 +24969,41 @@
|
|
|
24786
24969
|
minus() {
|
|
24787
24970
|
this.minusBtn.click();
|
|
24788
24971
|
}
|
|
24789
|
-
_onPlus(event) {
|
|
24972
|
+
async _onPlus(event) {
|
|
24973
|
+
const sgdsInput = await this._sgdsInput;
|
|
24790
24974
|
event.preventDefault();
|
|
24791
24975
|
event.stopPropagation();
|
|
24792
|
-
this.value = parseInt(
|
|
24976
|
+
this.value = parseInt(sgdsInput.value) + parseInt(sgdsInput.step.toString());
|
|
24977
|
+
this._validateOnClick(sgdsInput.input);
|
|
24793
24978
|
}
|
|
24794
|
-
_onMinus(event) {
|
|
24979
|
+
async _onMinus(event) {
|
|
24980
|
+
const sgdsInput = await this._sgdsInput;
|
|
24795
24981
|
event.preventDefault();
|
|
24796
24982
|
event.stopPropagation();
|
|
24797
24983
|
if (this.value < this.step) {
|
|
24798
24984
|
this.value = 0;
|
|
24799
24985
|
}
|
|
24800
24986
|
else {
|
|
24801
|
-
this.value = parseInt(
|
|
24987
|
+
this.value = parseInt(sgdsInput.value) - parseInt(sgdsInput.step.toString());
|
|
24802
24988
|
}
|
|
24989
|
+
this._validateOnClick(sgdsInput.input);
|
|
24990
|
+
}
|
|
24991
|
+
/**
|
|
24992
|
+
* Validates the input on button clicks of the toggle.
|
|
24993
|
+
* Input is validated every time the button is click to update the invalid state
|
|
24994
|
+
* to indiciate the validity of quantity toggle
|
|
24995
|
+
* @param input native HTMLInputElement
|
|
24996
|
+
*/
|
|
24997
|
+
async _validateOnClick(input) {
|
|
24998
|
+
const sgdsInput = await this._sgdsInput;
|
|
24999
|
+
await sgdsInput.updateComplete;
|
|
25000
|
+
this._mixinSetFormValue();
|
|
25001
|
+
this._mixinValidate(input);
|
|
25002
|
+
this.invalid = !this._mixinReportValidity();
|
|
24803
25003
|
}
|
|
24804
25004
|
_renderFeedback() {
|
|
24805
|
-
|
|
25005
|
+
const wantFeedbackText = this.hasFeedback === "both" || this.hasFeedback === "text";
|
|
25006
|
+
return this.invalid && wantFeedbackText
|
|
24806
25007
|
? html ` <div class="invalid-feedback-container">
|
|
24807
25008
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
24808
25009
|
<path
|
|
@@ -24810,17 +25011,20 @@
|
|
|
24810
25011
|
fill="#B90000"
|
|
24811
25012
|
/>
|
|
24812
25013
|
</svg>
|
|
24813
|
-
<div id="${this.
|
|
25014
|
+
<div id="${this._controlId}-invalid" class="invalid-feedback">
|
|
25015
|
+
${this.invalidFeedback ? this.invalidFeedback : this.validationMessage}
|
|
25016
|
+
</div>
|
|
24814
25017
|
</div>`
|
|
24815
25018
|
: html `${this._renderHintText()}`;
|
|
24816
25019
|
}
|
|
24817
25020
|
_renderLabel() {
|
|
24818
25021
|
const labelTemplate = html `
|
|
24819
25022
|
<label
|
|
24820
|
-
for=${this.
|
|
24821
|
-
id=${this.
|
|
25023
|
+
for=${this._controlId}
|
|
25024
|
+
id=${this._labelId}
|
|
24822
25025
|
class=${classMap({
|
|
24823
|
-
"form-label": true
|
|
25026
|
+
"form-label": true,
|
|
25027
|
+
disabled: this.disabled
|
|
24824
25028
|
})}
|
|
24825
25029
|
>${this.label}</label
|
|
24826
25030
|
>
|
|
@@ -24828,30 +25032,22 @@
|
|
|
24828
25032
|
return this.label && labelTemplate;
|
|
24829
25033
|
}
|
|
24830
25034
|
_renderHintText() {
|
|
24831
|
-
const hintTextTemplate = html ` <div id="${this.
|
|
25035
|
+
const hintTextTemplate = html ` <div id="${this._controlId}Help" class="form-text">${this.hintText}</div> `;
|
|
24832
25036
|
return this.hintText && hintTextTemplate;
|
|
24833
25037
|
}
|
|
24834
25038
|
render() {
|
|
24835
25039
|
return html `
|
|
24836
25040
|
<div class="form-control-container">
|
|
24837
25041
|
${this._renderLabel()}
|
|
24838
|
-
<div
|
|
24839
|
-
part="base"
|
|
24840
|
-
class="${classMap({
|
|
24841
|
-
disabled: this.disabled,
|
|
24842
|
-
"input-group": true,
|
|
24843
|
-
[`input-group-${this.size}`]: this.size
|
|
24844
|
-
})}"
|
|
24845
|
-
variant="quantity-toggle"
|
|
24846
|
-
size=${this.size}
|
|
24847
|
-
>
|
|
25042
|
+
<div class="input-group">
|
|
24848
25043
|
<sgds-icon-button
|
|
24849
|
-
variant
|
|
25044
|
+
variant="ghost"
|
|
24850
25045
|
ariaLabel=${`decrease by ${this.step}`}
|
|
24851
|
-
part="button"
|
|
24852
25046
|
?disabled=${this.disabled || (this.min !== undefined ? this.value <= this.min : this.value < 1)}
|
|
24853
25047
|
@click=${this._onMinus}
|
|
24854
|
-
|
|
25048
|
+
>
|
|
25049
|
+
<sgds-icon name="dash"></sgds-icon>
|
|
25050
|
+
</sgds-icon-button>
|
|
24855
25051
|
<sgds-input
|
|
24856
25052
|
type="number"
|
|
24857
25053
|
class="quantity-toggle"
|
|
@@ -24859,21 +25055,24 @@
|
|
|
24859
25055
|
step=${ifDefined(this.step)}
|
|
24860
25056
|
min=${ifDefined(this.min)}
|
|
24861
25057
|
max=${ifDefined(this.max)}
|
|
24862
|
-
.value=${live(this.value
|
|
24863
|
-
@sgds-change=${
|
|
24864
|
-
@sgds-input=${
|
|
25058
|
+
.value=${live(this.value)}
|
|
25059
|
+
@sgds-change=${this._handleChange}
|
|
25060
|
+
@sgds-input=${this._handleInputChange}
|
|
25061
|
+
@sgds-invalid=${this._handleInvalid}
|
|
25062
|
+
@sgds-valid=${this._handleValid}
|
|
24865
25063
|
@keydown=${this._handleKeyDown}
|
|
24866
25064
|
?disabled=${this.disabled}
|
|
25065
|
+
id=${this._controlId}
|
|
24867
25066
|
?invalid=${this.invalid}
|
|
24868
|
-
|
|
25067
|
+
hasFeedback=${ifDefined(this.hasFeedback !== "text" ? "style" : undefined)}
|
|
24869
25068
|
></sgds-input>
|
|
24870
25069
|
<sgds-icon-button
|
|
24871
|
-
variant
|
|
25070
|
+
variant="ghost"
|
|
24872
25071
|
ariaLabel=${`increase by ${this.step}`}
|
|
24873
|
-
part="button"
|
|
24874
25072
|
@click=${this._onPlus}
|
|
24875
25073
|
?disabled=${this.disabled || (this.max !== undefined && this.max && this.value >= this.max)}
|
|
24876
|
-
|
|
25074
|
+
><sgds-icon name="plus"></sgds-icon>
|
|
25075
|
+
</sgds-icon-button>
|
|
24877
25076
|
</div>
|
|
24878
25077
|
<div id="announcer" role="region" aria-live="assertive" class="visually-hidden">${this.value}</div>
|
|
24879
25078
|
${this._renderFeedback()}
|
|
@@ -24881,10 +25080,7 @@
|
|
|
24881
25080
|
`;
|
|
24882
25081
|
}
|
|
24883
25082
|
}
|
|
24884
|
-
SgdsQuantityToggle.styles = [...FormControlElement.styles, css_248z$
|
|
24885
|
-
__decorate([
|
|
24886
|
-
query("sgds-input")
|
|
24887
|
-
], SgdsQuantityToggle.prototype, "input", void 0);
|
|
25083
|
+
SgdsQuantityToggle.styles = [...FormControlElement.styles, css_248z$U, css_248z$j, css_248z$f];
|
|
24888
25084
|
__decorate([
|
|
24889
25085
|
query("sgds-icon-button[ariaLabel^='increase by']")
|
|
24890
25086
|
], SgdsQuantityToggle.prototype, "plusBtn", void 0);
|
|
@@ -24897,18 +25093,27 @@
|
|
|
24897
25093
|
__decorate([
|
|
24898
25094
|
property({ type: Number, reflect: true })
|
|
24899
25095
|
], SgdsQuantityToggle.prototype, "value", void 0);
|
|
24900
|
-
__decorate([
|
|
24901
|
-
property({ type: Boolean, reflect: true })
|
|
24902
|
-
], SgdsQuantityToggle.prototype, "disabled", void 0);
|
|
24903
|
-
__decorate([
|
|
24904
|
-
property({ type: String })
|
|
24905
|
-
], SgdsQuantityToggle.prototype, "iconButtonVariant", void 0);
|
|
24906
25096
|
__decorate([
|
|
24907
25097
|
property({ type: Number })
|
|
24908
25098
|
], SgdsQuantityToggle.prototype, "step", void 0);
|
|
25099
|
+
__decorate([
|
|
25100
|
+
property()
|
|
25101
|
+
], SgdsQuantityToggle.prototype, "min", void 0);
|
|
25102
|
+
__decorate([
|
|
25103
|
+
property()
|
|
25104
|
+
], SgdsQuantityToggle.prototype, "max", void 0);
|
|
25105
|
+
__decorate([
|
|
25106
|
+
property({ type: String, reflect: true })
|
|
25107
|
+
], SgdsQuantityToggle.prototype, "hasFeedback", void 0);
|
|
25108
|
+
__decorate([
|
|
25109
|
+
property({ type: String, reflect: true })
|
|
25110
|
+
], SgdsQuantityToggle.prototype, "invalidFeedback", void 0);
|
|
24909
25111
|
__decorate([
|
|
24910
25112
|
defaultValue()
|
|
24911
25113
|
], SgdsQuantityToggle.prototype, "defaultValue", void 0);
|
|
25114
|
+
__decorate([
|
|
25115
|
+
queryAsync("sgds-input")
|
|
25116
|
+
], SgdsQuantityToggle.prototype, "_sgdsInput", void 0);
|
|
24912
25117
|
|
|
24913
25118
|
customElements.define("sgds-quantity-toggle", SgdsQuantityToggle);
|
|
24914
25119
|
|
|
@@ -24923,43 +25128,46 @@
|
|
|
24923
25128
|
*
|
|
24924
25129
|
*
|
|
24925
25130
|
*/
|
|
24926
|
-
class SgdsRadioGroup extends
|
|
25131
|
+
class SgdsRadioGroup extends SgdsFormValidatorMixin(FormControlElement) {
|
|
24927
25132
|
constructor() {
|
|
24928
25133
|
super(...arguments);
|
|
24929
25134
|
/**@internal */
|
|
24930
|
-
this.formSubmitController = new FormSubmitController(this, {
|
|
24931
|
-
defaultValue: (control) => control.defaultValue
|
|
24932
|
-
});
|
|
24933
|
-
/**@internal */
|
|
24934
25135
|
this.defaultValue = "";
|
|
24935
|
-
/**@internal */
|
|
24936
|
-
this.customErrorMessage = "";
|
|
24937
|
-
/** The radio group's label */
|
|
24938
|
-
this.label = "";
|
|
24939
|
-
/** This will be true when the control is in an invalid state. */
|
|
24940
|
-
this.invalid = false;
|
|
24941
25136
|
/** The selected value of the control. */
|
|
24942
25137
|
this.value = "";
|
|
24943
|
-
/** The name assigned to the radio controls. */
|
|
24944
|
-
this.name = "option";
|
|
24945
|
-
/** Ensures a child radio is checked before allowing the containing form to submit. */
|
|
24946
|
-
this.required = false;
|
|
24947
25138
|
/**Feedback text for error state when validated */
|
|
24948
25139
|
this.invalidFeedback = "";
|
|
24949
25140
|
/** Allows invalidFeedback, invalid and valid styles to be visible with the input */
|
|
24950
25141
|
this.hasFeedback = false;
|
|
24951
|
-
/**
|
|
24952
|
-
this.
|
|
25142
|
+
/** Makes the input as a required field. */
|
|
25143
|
+
this.required = false;
|
|
25144
|
+
this._isTouched = false;
|
|
24953
25145
|
}
|
|
24954
25146
|
_handleValueChange() {
|
|
24955
25147
|
this.emit("sgds-change", { detail: { value: this.value } });
|
|
24956
25148
|
this._updateCheckedRadio();
|
|
24957
25149
|
}
|
|
25150
|
+
_handleInvalidChange() {
|
|
25151
|
+
this._radios.forEach(r => (r.invalid = this.invalid));
|
|
25152
|
+
}
|
|
25153
|
+
/**
|
|
25154
|
+
* radio requries a custom _mixinResetFormControl as the update of input value
|
|
25155
|
+
* requires to fire a reset event manually
|
|
25156
|
+
* */
|
|
25157
|
+
_mixinResetFormControl() {
|
|
25158
|
+
this.value = this.input.value = this.defaultValue;
|
|
25159
|
+
this._updateInputValue("reset");
|
|
25160
|
+
this._mixinResetValidity(this.input);
|
|
25161
|
+
}
|
|
24958
25162
|
connectedCallback() {
|
|
24959
25163
|
super.connectedCallback();
|
|
24960
25164
|
this.defaultValue = this.value;
|
|
25165
|
+
this.addEventListener("sgds-blur", () => {
|
|
25166
|
+
this._isTouched = true;
|
|
25167
|
+
});
|
|
24961
25168
|
}
|
|
24962
|
-
firstUpdated() {
|
|
25169
|
+
firstUpdated(changedProperties) {
|
|
25170
|
+
super.firstUpdated(changedProperties);
|
|
24963
25171
|
const radios = this._radios;
|
|
24964
25172
|
radios.forEach((item, index) => {
|
|
24965
25173
|
if (radios.length > 1) {
|
|
@@ -24975,33 +25183,9 @@
|
|
|
24975
25183
|
}
|
|
24976
25184
|
}
|
|
24977
25185
|
});
|
|
24978
|
-
|
|
24979
|
-
|
|
24980
|
-
get validity() {
|
|
24981
|
-
const hasMissingData = !((this.value && this.required) || !this.required);
|
|
24982
|
-
const hasCustomError = this.customErrorMessage !== "";
|
|
24983
|
-
return {
|
|
24984
|
-
badInput: false,
|
|
24985
|
-
customError: hasCustomError,
|
|
24986
|
-
patternMismatch: false,
|
|
24987
|
-
rangeOverflow: false,
|
|
24988
|
-
rangeUnderflow: false,
|
|
24989
|
-
stepMismatch: false,
|
|
24990
|
-
tooLong: false,
|
|
24991
|
-
tooShort: false,
|
|
24992
|
-
typeMismatch: false,
|
|
24993
|
-
valid: hasMissingData ? false : true,
|
|
24994
|
-
valueMissing: !hasMissingData
|
|
24995
|
-
};
|
|
24996
|
-
}
|
|
24997
|
-
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
24998
|
-
reportValidity() {
|
|
24999
|
-
const validity = this.validity;
|
|
25000
|
-
this.invalid = !validity.valid;
|
|
25001
|
-
if (!validity.valid) {
|
|
25002
|
-
this._showNativeErrorMessage();
|
|
25186
|
+
if (this.value) {
|
|
25187
|
+
this._updateInputValue("change");
|
|
25003
25188
|
}
|
|
25004
|
-
return !this.invalid;
|
|
25005
25189
|
}
|
|
25006
25190
|
_handleRadioClick(event) {
|
|
25007
25191
|
event.preventDefault();
|
|
@@ -25010,11 +25194,20 @@
|
|
|
25010
25194
|
return;
|
|
25011
25195
|
}
|
|
25012
25196
|
this.value = target.value;
|
|
25197
|
+
this._updateInputValue();
|
|
25013
25198
|
const radios = this._radios;
|
|
25014
25199
|
radios.forEach(radio => {
|
|
25015
25200
|
return (radio.checked = radio === target);
|
|
25016
25201
|
});
|
|
25017
25202
|
}
|
|
25203
|
+
/**
|
|
25204
|
+
* when input value is set programatically, need to manually dispatch a change event
|
|
25205
|
+
* In order to prevent race conditions and ensure sequence of events, set input's value here instead of binding to value prop of input
|
|
25206
|
+
*/
|
|
25207
|
+
_updateInputValue(eventName = "change") {
|
|
25208
|
+
this.input.value = this.value;
|
|
25209
|
+
this.input.dispatchEvent(new InputEvent(eventName));
|
|
25210
|
+
}
|
|
25018
25211
|
_handleKeyDown(event) {
|
|
25019
25212
|
var _a;
|
|
25020
25213
|
if (!["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", " "].includes(event.key)) {
|
|
@@ -25036,6 +25229,7 @@
|
|
|
25036
25229
|
radio.tabIndex = -1;
|
|
25037
25230
|
});
|
|
25038
25231
|
this.value = radios[index].value;
|
|
25232
|
+
this._updateInputValue();
|
|
25039
25233
|
radios[index].checked = true;
|
|
25040
25234
|
radios[index].tabIndex = 0;
|
|
25041
25235
|
// preventDefault at the end to allow Tab
|
|
@@ -25044,29 +25238,61 @@
|
|
|
25044
25238
|
_handleSlotChange() {
|
|
25045
25239
|
const radios = this._radios;
|
|
25046
25240
|
radios.forEach(radio => (radio.checked = radio.value === this.value));
|
|
25241
|
+
this._disabledChildRadios();
|
|
25047
25242
|
if (!radios.some(radio => radio.checked)) {
|
|
25048
25243
|
if (radios[0])
|
|
25049
25244
|
radios[0].tabIndex = 0;
|
|
25050
25245
|
}
|
|
25051
25246
|
}
|
|
25052
|
-
_handleInvalid(e) {
|
|
25053
|
-
e.preventDefault();
|
|
25054
|
-
this.invalid = true;
|
|
25055
|
-
this._radios.forEach(radio => (radio.invalid = true));
|
|
25056
|
-
}
|
|
25057
|
-
_showNativeErrorMessage() {
|
|
25058
|
-
this.input.reportValidity();
|
|
25059
|
-
}
|
|
25060
25247
|
_updateCheckedRadio() {
|
|
25061
25248
|
const radios = this._radios;
|
|
25062
25249
|
radios.forEach(radio => (radio.checked = radio.value === this.value));
|
|
25063
|
-
this.invalid = !this.validity.valid;
|
|
25064
|
-
this._radios.forEach(radio => (radio.invalid = this.invalid));
|
|
25065
25250
|
}
|
|
25066
25251
|
_renderHintText() {
|
|
25067
|
-
const hintTextTemplate = html$1 ` <div class="form-text">${this.hintText}</div> `;
|
|
25252
|
+
const hintTextTemplate = html$1 ` <div id="${this._controlId}Help" class="form-text">${this.hintText}</div> `;
|
|
25068
25253
|
return this.hintText && hintTextTemplate;
|
|
25069
25254
|
}
|
|
25255
|
+
/**
|
|
25256
|
+
* Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
|
|
25257
|
+
* 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
|
|
25258
|
+
*/
|
|
25259
|
+
reportValidity() {
|
|
25260
|
+
return this._mixinReportValidity();
|
|
25261
|
+
}
|
|
25262
|
+
/**
|
|
25263
|
+
* Checks for validity without any native error popup message
|
|
25264
|
+
*/
|
|
25265
|
+
checkValidity() {
|
|
25266
|
+
return this._mixinCheckValidity();
|
|
25267
|
+
}
|
|
25268
|
+
/**
|
|
25269
|
+
* Returns the ValidityState object
|
|
25270
|
+
*/
|
|
25271
|
+
get validity() {
|
|
25272
|
+
return this._mixinGetValidity();
|
|
25273
|
+
}
|
|
25274
|
+
/**
|
|
25275
|
+
* Returns the validation message based on the ValidityState
|
|
25276
|
+
*/
|
|
25277
|
+
get validationMessage() {
|
|
25278
|
+
return this._mixinGetValidationMessage();
|
|
25279
|
+
}
|
|
25280
|
+
_handleIsTouched() {
|
|
25281
|
+
if (this._isTouched) {
|
|
25282
|
+
this.invalid = !this.input.checkValidity();
|
|
25283
|
+
}
|
|
25284
|
+
}
|
|
25285
|
+
_handleDisabledChange() {
|
|
25286
|
+
// Disabled form controls are always valid, so we need to recheck validity when the state changes
|
|
25287
|
+
this.setInvalid(false);
|
|
25288
|
+
this._disabledChildRadios();
|
|
25289
|
+
}
|
|
25290
|
+
_disabledChildRadios() {
|
|
25291
|
+
if (this.disabled) {
|
|
25292
|
+
const radios = this._radios;
|
|
25293
|
+
radios.forEach(radio => (radio.disabled = this.disabled));
|
|
25294
|
+
}
|
|
25295
|
+
}
|
|
25070
25296
|
render() {
|
|
25071
25297
|
const defaultSlot = html$1 `
|
|
25072
25298
|
<slot
|
|
@@ -25098,7 +25324,8 @@
|
|
|
25098
25324
|
})}"
|
|
25099
25325
|
?required=${this.required}
|
|
25100
25326
|
tabindex="-1"
|
|
25101
|
-
@
|
|
25327
|
+
@change=${(e) => super._mixinHandleChange(e)}
|
|
25328
|
+
.value=${live(this.value)}
|
|
25102
25329
|
/>
|
|
25103
25330
|
${this.invalid && this.hasFeedback
|
|
25104
25331
|
? html$1 `
|
|
@@ -25109,7 +25336,9 @@
|
|
|
25109
25336
|
fill="#B90000"
|
|
25110
25337
|
/>
|
|
25111
25338
|
</svg>
|
|
25112
|
-
<div id="radio-group-feedback" tabindex="0" class="invalid-feedback"
|
|
25339
|
+
<div id="radio-group-feedback" tabindex="0" class="invalid-feedback">
|
|
25340
|
+
${this.invalidFeedback ? this.invalidFeedback : this.input.validationMessage}
|
|
25341
|
+
</div>
|
|
25113
25342
|
</div>
|
|
25114
25343
|
`
|
|
25115
25344
|
: nothing}
|
|
@@ -25117,34 +25346,16 @@
|
|
|
25117
25346
|
`;
|
|
25118
25347
|
}
|
|
25119
25348
|
}
|
|
25120
|
-
SgdsRadioGroup.styles = [...
|
|
25349
|
+
SgdsRadioGroup.styles = [...FormControlElement.styles, css_248z$e];
|
|
25121
25350
|
__decorate([
|
|
25122
25351
|
query("slot:not([name])")
|
|
25123
25352
|
], SgdsRadioGroup.prototype, "defaultSlot", void 0);
|
|
25124
|
-
__decorate([
|
|
25125
|
-
query(".radio-group-validation-input")
|
|
25126
|
-
], SgdsRadioGroup.prototype, "input", void 0);
|
|
25127
25353
|
__decorate([
|
|
25128
25354
|
state()
|
|
25129
25355
|
], SgdsRadioGroup.prototype, "defaultValue", void 0);
|
|
25130
|
-
__decorate([
|
|
25131
|
-
state()
|
|
25132
|
-
], SgdsRadioGroup.prototype, "customErrorMessage", void 0);
|
|
25133
|
-
__decorate([
|
|
25134
|
-
property({ reflect: true })
|
|
25135
|
-
], SgdsRadioGroup.prototype, "label", void 0);
|
|
25136
|
-
__decorate([
|
|
25137
|
-
property({ type: Boolean, reflect: true })
|
|
25138
|
-
], SgdsRadioGroup.prototype, "invalid", void 0);
|
|
25139
25356
|
__decorate([
|
|
25140
25357
|
property({ reflect: true })
|
|
25141
25358
|
], SgdsRadioGroup.prototype, "value", void 0);
|
|
25142
|
-
__decorate([
|
|
25143
|
-
property({ reflect: true })
|
|
25144
|
-
], SgdsRadioGroup.prototype, "name", void 0);
|
|
25145
|
-
__decorate([
|
|
25146
|
-
property({ type: Boolean, reflect: true })
|
|
25147
|
-
], SgdsRadioGroup.prototype, "required", void 0);
|
|
25148
25359
|
__decorate([
|
|
25149
25360
|
property({ type: String, reflect: true })
|
|
25150
25361
|
], SgdsRadioGroup.prototype, "invalidFeedback", void 0);
|
|
@@ -25152,14 +25363,26 @@
|
|
|
25152
25363
|
property({ type: Boolean, reflect: true })
|
|
25153
25364
|
], SgdsRadioGroup.prototype, "hasFeedback", void 0);
|
|
25154
25365
|
__decorate([
|
|
25155
|
-
property({ reflect: true })
|
|
25156
|
-
], SgdsRadioGroup.prototype, "
|
|
25366
|
+
property({ type: Boolean, reflect: true })
|
|
25367
|
+
], SgdsRadioGroup.prototype, "required", void 0);
|
|
25157
25368
|
__decorate([
|
|
25158
25369
|
watch("value", { waitUntilFirstUpdate: true })
|
|
25159
25370
|
], SgdsRadioGroup.prototype, "_handleValueChange", null);
|
|
25371
|
+
__decorate([
|
|
25372
|
+
watch("invalid", { waitUntilFirstUpdate: true })
|
|
25373
|
+
], SgdsRadioGroup.prototype, "_handleInvalidChange", null);
|
|
25374
|
+
__decorate([
|
|
25375
|
+
state()
|
|
25376
|
+
], SgdsRadioGroup.prototype, "_isTouched", void 0);
|
|
25160
25377
|
__decorate([
|
|
25161
25378
|
queryAssignedElements()
|
|
25162
25379
|
], SgdsRadioGroup.prototype, "_radios", void 0);
|
|
25380
|
+
__decorate([
|
|
25381
|
+
watch("_isTouched", { waitUntilFirstUpdate: true })
|
|
25382
|
+
], SgdsRadioGroup.prototype, "_handleIsTouched", null);
|
|
25383
|
+
__decorate([
|
|
25384
|
+
watch("disabled", { waitUntilFirstUpdate: true })
|
|
25385
|
+
], SgdsRadioGroup.prototype, "_handleDisabledChange", null);
|
|
25163
25386
|
|
|
25164
25387
|
customElements.define("sgds-radio", SgdsRadio);
|
|
25165
25388
|
customElements.define("sgds-radio-group", SgdsRadioGroup);
|
|
@@ -25649,7 +25872,7 @@
|
|
|
25649
25872
|
`;
|
|
25650
25873
|
}
|
|
25651
25874
|
}
|
|
25652
|
-
SgdsSwitch.styles = [...
|
|
25875
|
+
SgdsSwitch.styles = [...SgdsElement.styles, css_248z$V, css_248z$9];
|
|
25653
25876
|
__decorate([
|
|
25654
25877
|
property({ reflect: true, type: String })
|
|
25655
25878
|
], SgdsSwitch.prototype, "size", void 0);
|
|
@@ -25694,6 +25917,7 @@
|
|
|
25694
25917
|
constructor() {
|
|
25695
25918
|
super(...arguments);
|
|
25696
25919
|
/** The metadata of stepper, type `IStepMetaData`, that consist of `stepHeader: string` and `component:unknown`. `stepHeader` is the name of the step and `component` is the content that should appear at the each step. `component` is set to `unknown` to allow users to pass in their desired component based on the framework of choice. e.g. pass in your own react/angular/vue component or it can also be a text content.
|
|
25920
|
+
* It is required to populate this array to properly render the stepper.
|
|
25697
25921
|
*/
|
|
25698
25922
|
this.steps = [];
|
|
25699
25923
|
/** The current state of active step. Defaults to 0 */
|
|
@@ -26459,7 +26683,7 @@
|
|
|
26459
26683
|
|
|
26460
26684
|
customElements.define("sgds-table", SgdsTable);
|
|
26461
26685
|
|
|
26462
|
-
var css_248z$3 = css`.form-control-container{display:flex;flex-direction:column;gap:var(--sgds-form-gap-md)}.form-control-container.disabled{opacity:var(--sgds-opacity-50)}textarea{font-family:inherit;font-size:inherit;line-height:inherit;margin:0;resize:vertical}.form-control{appearance:none;background-clip:padding-box;background-color:var(--sgds-form-bg);border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color);border-radius:var(--sgds-form-border-radius-md);color:var(--sgds-form-color);min-height:var(--sgds-dimension-136);padding:var(--sgds-form-padding-y) var(--sgds-form-padding-x);transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out;width:100%}.form-control[readonly]{border-color:var(--sgds-form-border-color-muted)}@media (prefers-reduced-motion:reduce){.form-control{transition:none}}.form-control:not([disabled]):not(.is-invalid):hover{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis)}.form-control:not([disabled]):not(.is-invalid):focus,.form-control:not([disabled]):not(.is-invalid):focus-visible{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis);box-shadow:var(--sgds-form-box-shadow-focus)
|
|
26686
|
+
var css_248z$3 = css`.form-control-container{display:flex;flex-direction:column;gap:var(--sgds-form-gap-md)}.form-control-container.disabled{opacity:var(--sgds-opacity-50)}textarea{font-family:inherit;font-size:inherit;line-height:inherit;margin:0;resize:vertical}.form-control{appearance:none;background-clip:padding-box;background-color:var(--sgds-form-bg);border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color);border-radius:var(--sgds-form-border-radius-md);color:var(--sgds-form-color);min-height:var(--sgds-dimension-136);outline:0;padding:var(--sgds-form-padding-y) var(--sgds-form-padding-x);transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out;width:100%}.form-control[readonly]{border-color:var(--sgds-form-border-color-muted)}@media (prefers-reduced-motion:reduce){.form-control{transition:none}}.form-control:not([disabled]):not(.is-invalid):hover{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis)}.form-control:not([disabled]):not(.is-invalid):focus,.form-control:not([disabled]):not(.is-invalid):focus-visible{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis);box-shadow:var(--sgds-form-box-shadow-focus)}.form-control.is-invalid{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-danger-border-color)}.form-control:disabled{background-color:var(--sgds-form-bg-muted)}.textarea-resize-none{resize:none}.textarea-resize-vertical{resize:vertical}.textarea-resize-auto{height:auto;overflow-y:hidden;resize:none}.textarea-info-container{display:flex;justify-content:space-between}.word-count{margin-left:auto}`;
|
|
26463
26687
|
|
|
26464
26688
|
/**
|
|
26465
26689
|
* @summary Text areas allow for the collection of input longer than a single line.
|
|
@@ -26469,13 +26693,9 @@
|
|
|
26469
26693
|
* @event sgds-focus - Emitted when textarea is in focus.
|
|
26470
26694
|
* @event sgds-blur - Emitted when textarea loses focus.
|
|
26471
26695
|
*/
|
|
26472
|
-
class SgdsTextarea extends
|
|
26696
|
+
class SgdsTextarea extends SgdsFormValidatorMixin(FormControlElement) {
|
|
26473
26697
|
constructor() {
|
|
26474
26698
|
super(...arguments);
|
|
26475
|
-
/**@internal */
|
|
26476
|
-
this.formSubmitController = new FormSubmitController(this);
|
|
26477
|
-
/**The textarea's label */
|
|
26478
|
-
this.label = "label";
|
|
26479
26699
|
/**The textarea's value attribute. */
|
|
26480
26700
|
this.value = "";
|
|
26481
26701
|
/**Enables spell checking on the textarea */
|
|
@@ -26484,14 +26704,10 @@
|
|
|
26484
26704
|
this.rows = 4;
|
|
26485
26705
|
/**The textarea's placeholder text. */
|
|
26486
26706
|
this.placeholder = "Placeholder";
|
|
26487
|
-
/**
|
|
26707
|
+
/** Custom feedback text for error state when validated */
|
|
26488
26708
|
this.invalidFeedback = "";
|
|
26489
26709
|
/**Autofocus the textarea */
|
|
26490
26710
|
this.autofocus = false;
|
|
26491
|
-
/**Disables the textarea. */
|
|
26492
|
-
this.disabled = false;
|
|
26493
|
-
/**Makes the textarea a required field. */
|
|
26494
|
-
this.required = false;
|
|
26495
26711
|
/** Makes the textarea readonly. */
|
|
26496
26712
|
this.readonly = false;
|
|
26497
26713
|
/** Controls how the textarea can be resized. */
|
|
@@ -26500,32 +26716,44 @@
|
|
|
26500
26716
|
this.defaultValue = "";
|
|
26501
26717
|
/** Allows invalidFeedback, invalid and valid styles to be visible with the input */
|
|
26502
26718
|
this.hasFeedback = false;
|
|
26503
|
-
/**
|
|
26504
|
-
this.
|
|
26719
|
+
/** Makes the textarea as a required field. */
|
|
26720
|
+
this.required = false;
|
|
26505
26721
|
/** The textarea's hint text */
|
|
26506
26722
|
this.hintText = "";
|
|
26507
|
-
|
|
26508
|
-
this.textareaId = genId("textarea", "input");
|
|
26509
|
-
}
|
|
26510
|
-
connectedCallback() {
|
|
26511
|
-
super.connectedCallback();
|
|
26512
|
-
this.resizeObserver = new ResizeObserver(() => this._setTextareaHeight());
|
|
26513
|
-
this.updateComplete.then(() => {
|
|
26514
|
-
this._setTextareaHeight();
|
|
26515
|
-
this.resizeObserver.observe(this.textarea);
|
|
26516
|
-
});
|
|
26517
|
-
}
|
|
26518
|
-
disconnectedCallback() {
|
|
26519
|
-
super.disconnectedCallback();
|
|
26520
|
-
this.resizeObserver.unobserve(this.textarea);
|
|
26723
|
+
this._isTouched = false;
|
|
26521
26724
|
}
|
|
26522
26725
|
/** Sets focus on the textarea. */
|
|
26523
26726
|
focus(options) {
|
|
26524
26727
|
this.textarea.focus(options);
|
|
26525
26728
|
}
|
|
26526
|
-
/**
|
|
26729
|
+
/** Sets blur on the textarea. */
|
|
26730
|
+
blur() {
|
|
26731
|
+
this.textarea.blur();
|
|
26732
|
+
}
|
|
26733
|
+
/**
|
|
26734
|
+
* Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
|
|
26735
|
+
* 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
|
|
26736
|
+
*/
|
|
26527
26737
|
reportValidity() {
|
|
26528
|
-
return this.
|
|
26738
|
+
return this._mixinReportValidity();
|
|
26739
|
+
}
|
|
26740
|
+
/**
|
|
26741
|
+
* Checks for validity without any native error popup message
|
|
26742
|
+
*/
|
|
26743
|
+
checkValidity() {
|
|
26744
|
+
return this._mixinCheckValidity();
|
|
26745
|
+
}
|
|
26746
|
+
/**
|
|
26747
|
+
* Returns the ValidityState object
|
|
26748
|
+
*/
|
|
26749
|
+
get validity() {
|
|
26750
|
+
return this._mixinGetValidity();
|
|
26751
|
+
}
|
|
26752
|
+
/**
|
|
26753
|
+
* Returns the validation message based on the ValidityState
|
|
26754
|
+
*/
|
|
26755
|
+
get validationMessage() {
|
|
26756
|
+
return this._mixinGetValidationMessage();
|
|
26529
26757
|
}
|
|
26530
26758
|
/** Selects all the text in the textarea. */
|
|
26531
26759
|
select() {
|
|
@@ -26535,14 +26763,21 @@
|
|
|
26535
26763
|
e.preventDefault();
|
|
26536
26764
|
this.invalid = true;
|
|
26537
26765
|
}
|
|
26538
|
-
_handleChange(
|
|
26539
|
-
this.value = this.
|
|
26540
|
-
this.emit(
|
|
26766
|
+
_handleChange(e) {
|
|
26767
|
+
this.value = this.input.value;
|
|
26768
|
+
this.emit("sgds-change");
|
|
26769
|
+
super._mixinHandleChange(e);
|
|
26770
|
+
}
|
|
26771
|
+
_handleInputChange(e) {
|
|
26772
|
+
this.value = this.input.value;
|
|
26773
|
+
this.emit("sgds-input");
|
|
26774
|
+
super._mixinHandleInputChange(e);
|
|
26541
26775
|
}
|
|
26542
26776
|
_handleFocus() {
|
|
26543
26777
|
this.emit("sgds-focus");
|
|
26544
26778
|
}
|
|
26545
|
-
|
|
26779
|
+
_handleBlur() {
|
|
26780
|
+
this._isTouched = true;
|
|
26546
26781
|
this.emit("sgds-blur");
|
|
26547
26782
|
}
|
|
26548
26783
|
/** @internal */
|
|
@@ -26559,23 +26794,26 @@
|
|
|
26559
26794
|
}
|
|
26560
26795
|
}
|
|
26561
26796
|
/** @internal */
|
|
26797
|
+
_handleIsTouched() {
|
|
26798
|
+
if (this._isTouched) {
|
|
26799
|
+
this.invalid = !this.textarea.checkValidity();
|
|
26800
|
+
}
|
|
26801
|
+
}
|
|
26802
|
+
/** @internal */
|
|
26562
26803
|
_handleDisabledChange() {
|
|
26563
26804
|
// Disabled form controls are always valid, so we need to recheck validity when the state changes
|
|
26564
|
-
this.
|
|
26565
|
-
this.invalid = !this.textarea.checkValidity();
|
|
26805
|
+
this.setInvalid(false);
|
|
26566
26806
|
}
|
|
26567
26807
|
/** @internal */
|
|
26568
26808
|
_handleValueChange() {
|
|
26569
|
-
this.invalid = !this.textarea.checkValidity();
|
|
26570
26809
|
this.updateComplete.then(() => this._setTextareaHeight());
|
|
26571
26810
|
}
|
|
26572
26811
|
_renderHintText() {
|
|
26573
|
-
const hintTextTemplate = html ` <div id="${this.
|
|
26812
|
+
const hintTextTemplate = html ` <div id="${this._controlId}Help" class="form-text">${this.hintText}</div> `;
|
|
26574
26813
|
return this.hintText && hintTextTemplate;
|
|
26575
26814
|
}
|
|
26576
|
-
|
|
26577
|
-
|
|
26578
|
-
const wordCount = html `
|
|
26815
|
+
_wordCount() {
|
|
26816
|
+
return html `
|
|
26579
26817
|
<div
|
|
26580
26818
|
class="form-text word-count ${classMap({
|
|
26581
26819
|
"invalid-feedback": this.invalid && this.hasFeedback
|
|
@@ -26584,13 +26822,15 @@
|
|
|
26584
26822
|
${this.value.length}/${this.maxlength}
|
|
26585
26823
|
</div>
|
|
26586
26824
|
`;
|
|
26825
|
+
}
|
|
26826
|
+
render() {
|
|
26587
26827
|
return html `
|
|
26588
26828
|
<div
|
|
26589
26829
|
class="form-control-container ${classMap({
|
|
26590
26830
|
disabled: this.disabled
|
|
26591
26831
|
})}"
|
|
26592
26832
|
>
|
|
26593
|
-
<label for=${this.
|
|
26833
|
+
<label for=${this._controlId} class="form-label">${this.label}</label>
|
|
26594
26834
|
<textarea
|
|
26595
26835
|
class=${classMap({
|
|
26596
26836
|
"form-control": true,
|
|
@@ -26599,7 +26839,7 @@
|
|
|
26599
26839
|
"textarea-resize-vertical": this.resize === "vertical",
|
|
26600
26840
|
"textarea-resize-auto": this.resize === "auto"
|
|
26601
26841
|
})}
|
|
26602
|
-
id=${this.
|
|
26842
|
+
id=${this._controlId}
|
|
26603
26843
|
name=${ifDefined(this.name)}
|
|
26604
26844
|
rows=${ifDefined(this.rows)}
|
|
26605
26845
|
placeholder=${ifDefined(this.placeholder)}
|
|
@@ -26614,13 +26854,12 @@
|
|
|
26614
26854
|
?autofocus=${this.autofocus}
|
|
26615
26855
|
autocorrect=${ifDefined(this.autocorrect)}
|
|
26616
26856
|
inputmode=${ifDefined(this.inputmode)}
|
|
26617
|
-
@input=${() => this.
|
|
26618
|
-
@change=${() => this._handleChange(
|
|
26857
|
+
@input=${(e) => this._handleInputChange(e)}
|
|
26858
|
+
@change=${(e) => this._handleChange(e)}
|
|
26619
26859
|
@invalid=${(e) => this._handleInvalid(e)}
|
|
26620
26860
|
@focus=${this._handleFocus}
|
|
26621
|
-
@blur=${this.
|
|
26622
|
-
>
|
|
26623
|
-
</textarea>
|
|
26861
|
+
@blur=${this._handleBlur}
|
|
26862
|
+
></textarea>
|
|
26624
26863
|
<div class="textarea-info-container">
|
|
26625
26864
|
${this.invalid && this.hasFeedback
|
|
26626
26865
|
? html `
|
|
@@ -26631,30 +26870,22 @@
|
|
|
26631
26870
|
fill="#B90000"
|
|
26632
26871
|
/>
|
|
26633
26872
|
</svg>
|
|
26634
|
-
<div id="${this.
|
|
26873
|
+
<div id="${this._controlId}-invalid" class="invalid-feedback">
|
|
26874
|
+
${this.invalidFeedback ? this.invalidFeedback : this.input.validationMessage}
|
|
26875
|
+
</div>
|
|
26635
26876
|
</div>
|
|
26636
26877
|
`
|
|
26637
26878
|
: html `${this._renderHintText()}`}
|
|
26638
|
-
${this.maxlength > 0 ?
|
|
26879
|
+
${this.maxlength > 0 ? this._wordCount() : nothing}
|
|
26639
26880
|
</div>
|
|
26640
26881
|
</div>
|
|
26641
26882
|
`;
|
|
26642
26883
|
}
|
|
26643
26884
|
}
|
|
26644
|
-
SgdsTextarea.styles = [
|
|
26645
|
-
...SgdsElement.styles,
|
|
26646
|
-
css_248z$F,
|
|
26647
|
-
css_248z$T,
|
|
26648
|
-
css_248z$G,
|
|
26649
|
-
css_248z$E,
|
|
26650
|
-
css_248z$3
|
|
26651
|
-
];
|
|
26885
|
+
SgdsTextarea.styles = [...FormControlElement.styles, css_248z$3];
|
|
26652
26886
|
__decorate([
|
|
26653
26887
|
query("textarea.form-control")
|
|
26654
26888
|
], SgdsTextarea.prototype, "textarea", void 0);
|
|
26655
|
-
__decorate([
|
|
26656
|
-
property({ type: String, reflect: true })
|
|
26657
|
-
], SgdsTextarea.prototype, "label", void 0);
|
|
26658
26889
|
__decorate([
|
|
26659
26890
|
property({ type: String, reflect: true })
|
|
26660
26891
|
], SgdsTextarea.prototype, "name", void 0);
|
|
@@ -26682,12 +26913,6 @@
|
|
|
26682
26913
|
__decorate([
|
|
26683
26914
|
property({ type: Boolean, reflect: true })
|
|
26684
26915
|
], SgdsTextarea.prototype, "autofocus", void 0);
|
|
26685
|
-
__decorate([
|
|
26686
|
-
property({ type: Boolean, reflect: true })
|
|
26687
|
-
], SgdsTextarea.prototype, "disabled", void 0);
|
|
26688
|
-
__decorate([
|
|
26689
|
-
property({ type: Boolean, reflect: true })
|
|
26690
|
-
], SgdsTextarea.prototype, "required", void 0);
|
|
26691
26916
|
__decorate([
|
|
26692
26917
|
property({ type: Boolean, reflect: true })
|
|
26693
26918
|
], SgdsTextarea.prototype, "readonly", void 0);
|
|
@@ -26708,13 +26933,19 @@
|
|
|
26708
26933
|
], SgdsTextarea.prototype, "hasFeedback", void 0);
|
|
26709
26934
|
__decorate([
|
|
26710
26935
|
property({ type: Boolean, reflect: true })
|
|
26711
|
-
], SgdsTextarea.prototype, "
|
|
26936
|
+
], SgdsTextarea.prototype, "required", void 0);
|
|
26712
26937
|
__decorate([
|
|
26713
26938
|
property({ reflect: true })
|
|
26714
26939
|
], SgdsTextarea.prototype, "hintText", void 0);
|
|
26940
|
+
__decorate([
|
|
26941
|
+
state()
|
|
26942
|
+
], SgdsTextarea.prototype, "_isTouched", void 0);
|
|
26715
26943
|
__decorate([
|
|
26716
26944
|
watch("rows", { waitUntilFirstUpdate: true })
|
|
26717
26945
|
], SgdsTextarea.prototype, "_handleRowsChange", null);
|
|
26946
|
+
__decorate([
|
|
26947
|
+
watch("_isTouched", { waitUntilFirstUpdate: true })
|
|
26948
|
+
], SgdsTextarea.prototype, "_handleIsTouched", null);
|
|
26718
26949
|
__decorate([
|
|
26719
26950
|
watch("disabled", { waitUntilFirstUpdate: true })
|
|
26720
26951
|
], SgdsTextarea.prototype, "_handleDisabledChange", null);
|
|
@@ -26724,13 +26955,14 @@
|
|
|
26724
26955
|
|
|
26725
26956
|
customElements.define("sgds-textarea", SgdsTextarea);
|
|
26726
26957
|
|
|
26727
|
-
var css_248z$2 = css`:host{--sgds-toast-border-radius:var(--sgds-border-radius-md)}
|
|
26958
|
+
var css_248z$2 = css`:host{--sgds-toast-border-radius:var(--sgds-border-radius-md)}:host([variant=info]) slot[name=icon]::slotted(*){color:var(--sgds-primary-color)}:host([variant=success]) slot[name=icon]::slotted(*){color:var(--sgds-success-color)}:host([variant=danger]) slot[name=icon]::slotted(*){color:var(--sgds-danger-color)}:host([variant=warning]) slot[name=icon]::slotted(*){color:var(--sgds-warning-color)}.toast{align-items:flex-start;background-clip:padding-box;background-color:var(--sgds-neutral-bg-inverse);border-radius:var(--sgds-border-radius-md);box-shadow:0 0 2px 0 rgba(0,0,0,.12),0 8px 16px 0 rgba(0,0,0,.14);display:flex;flex-direction:row;gap:var(--sgds-gap-xs);max-width:var(--sgds-dimension-480);min-width:var(--sgds-dimension-320);padding:var(--sgds-padding-md);pointer-events:auto;width:320px}.toast-content{word-wrap:break-word;gap:var(--sgds-gap-sm)}.toast-body,.toast-content{display:flex;flex-direction:column}.toast-body strong{line-height:var(--sgds-line-height-min)}.toast-body span{color:var(--sgds-default-color-subtle)}.toast-action{word-wrap:break-word;color:var(--sgds-primary-color)}.toast-header strong{margin-right:auto;word-break:break-all}.close-btn{margin-left:auto}.d-none{display:none}`;
|
|
26728
26959
|
|
|
26729
26960
|
/**
|
|
26730
26961
|
* @summary Toast allows you to convey quick messaging notifications to the user.
|
|
26731
26962
|
*
|
|
26732
26963
|
* @slot default - The content to pass into toast's body
|
|
26733
26964
|
* @slot action - The content to pass into toast's action
|
|
26965
|
+
* @slot icon - The icon in toast
|
|
26734
26966
|
*
|
|
26735
26967
|
*
|
|
26736
26968
|
* @event sgds-show - Emitted on show.
|
|
@@ -26756,7 +26988,7 @@
|
|
|
26756
26988
|
/**The variant styles of toast */
|
|
26757
26989
|
this.variant = "info";
|
|
26758
26990
|
/** Controls whether or not the Toast is dismissible */
|
|
26759
|
-
this.
|
|
26991
|
+
this.dismissible = false;
|
|
26760
26992
|
}
|
|
26761
26993
|
/**@internal */
|
|
26762
26994
|
static get scopedElements() {
|
|
@@ -26829,28 +27061,15 @@
|
|
|
26829
27061
|
aria-live="assertive"
|
|
26830
27062
|
aria-atomic="true"
|
|
26831
27063
|
>
|
|
26832
|
-
<
|
|
26833
|
-
<svg
|
|
26834
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
26835
|
-
width="16"
|
|
26836
|
-
height="16"
|
|
26837
|
-
fill="currentColor"
|
|
26838
|
-
class="bi bi-airplane"
|
|
26839
|
-
viewBox="0 0 16 16"
|
|
26840
|
-
>
|
|
26841
|
-
<path
|
|
26842
|
-
d="M6.428 1.151C6.708.591 7.213 0 8 0s1.292.592 1.572 1.151C9.861 1.73 10 2.431 10 3v3.691l5.17 2.585a1.5 1.5 0 0 1 .83 1.342V12a.5.5 0 0 1-.582.493l-5.507-.918-.375 2.253 1.318 1.318A.5.5 0 0 1 10.5 16h-5a.5.5 0 0 1-.354-.854l1.319-1.318-.376-2.253-5.507.918A.5.5 0 0 1 0 12v-1.382a1.5 1.5 0 0 1 .83-1.342L6 6.691V3c0-.568.14-1.271.428-1.849Zm.894.448C7.111 2.02 7 2.569 7 3v4a.5.5 0 0 1-.276.447l-5.448 2.724a.5.5 0 0 0-.276.447v.792l5.418-.903a.5.5 0 0 1 .575.41l.5 3a.5.5 0 0 1-.14.437L6.708 15h2.586l-.647-.646a.5.5 0 0 1-.14-.436l.5-3a.5.5 0 0 1 .576-.411L15 11.41v-.792a.5.5 0 0 0-.276-.447L9.276 7.447A.5.5 0 0 1 9 7V3c0-.432-.11-.979-.322-1.401C8.458 1.159 8.213 1 8 1c-.213 0-.458.158-.678.599Z"
|
|
26843
|
-
></path>
|
|
26844
|
-
</svg>
|
|
26845
|
-
</i>
|
|
27064
|
+
<slot name="icon"></slot>
|
|
26846
27065
|
<div class="toast-content">
|
|
26847
27066
|
<div class="toast-body">
|
|
26848
27067
|
<strong>${this.title}</strong>
|
|
26849
|
-
<slot></slot>
|
|
27068
|
+
<span><slot></slot></span>
|
|
26850
27069
|
</div>
|
|
26851
27070
|
<slot class="toast-action" name="action"></slot>
|
|
26852
27071
|
</div>
|
|
26853
|
-
${this.
|
|
27072
|
+
${this.dismissible
|
|
26854
27073
|
? html$1 `<sgds-close-button
|
|
26855
27074
|
class="close-btn"
|
|
26856
27075
|
ariaLabel="close toast"
|
|
@@ -26885,7 +27104,7 @@
|
|
|
26885
27104
|
], SgdsToast.prototype, "variant", void 0);
|
|
26886
27105
|
__decorate([
|
|
26887
27106
|
property({ type: Boolean, reflect: true })
|
|
26888
|
-
], SgdsToast.prototype, "
|
|
27107
|
+
], SgdsToast.prototype, "dismissible", void 0);
|
|
26889
27108
|
__decorate([
|
|
26890
27109
|
watch("show", { waitUntilFirstUpdate: true })
|
|
26891
27110
|
], SgdsToast.prototype, "handleShowChange", null);
|
|
@@ -27836,8 +28055,8 @@
|
|
|
27836
28055
|
class SgdsTooltip extends SgdsElement {
|
|
27837
28056
|
constructor() {
|
|
27838
28057
|
super(...arguments);
|
|
27839
|
-
this.
|
|
27840
|
-
this.
|
|
28058
|
+
this._myTooltip = createRef();
|
|
28059
|
+
this._bsTooltip = null;
|
|
27841
28060
|
/** The tooltip's content. Content has to be textual */
|
|
27842
28061
|
this.content = "";
|
|
27843
28062
|
/** The placement of tooltip relative to its target */
|
|
@@ -27847,7 +28066,7 @@
|
|
|
27847
28066
|
}
|
|
27848
28067
|
_handleSlotChange() {
|
|
27849
28068
|
// For a11y purpose
|
|
27850
|
-
this.
|
|
28069
|
+
this._tooltipTargetElements.forEach(el => el.setAttribute("data-sgds-tooltip", this.content));
|
|
27851
28070
|
}
|
|
27852
28071
|
_handleClickOutOfElement(e, self) {
|
|
27853
28072
|
if (!e.composedPath().includes(self)) {
|
|
@@ -27866,7 +28085,7 @@
|
|
|
27866
28085
|
document.removeEventListener("click", (event) => this._handleClickOutOfElement(event, this));
|
|
27867
28086
|
document.removeEventListener("touchstart", (event) => this._handleClickOutOfElement(event, this));
|
|
27868
28087
|
}
|
|
27869
|
-
|
|
28088
|
+
_initializeTooltip() {
|
|
27870
28089
|
this.tooltipConfig = {
|
|
27871
28090
|
popperConfig: (defaultConfig) => {
|
|
27872
28091
|
this.popperConfig = defaultConfig;
|
|
@@ -27886,34 +28105,34 @@
|
|
|
27886
28105
|
html: true,
|
|
27887
28106
|
container: this.shadowRoot.querySelector("div") // tooltip to appear inside the shadow root of sgds-tooltip instead of anywhere in the DOM, so that scoped styles can apply
|
|
27888
28107
|
};
|
|
27889
|
-
this.
|
|
28108
|
+
this._bsTooltip = new Tooltip(this._myTooltip.value, this.tooltipConfig);
|
|
27890
28109
|
}
|
|
27891
28110
|
firstUpdated() {
|
|
27892
|
-
this.
|
|
27893
|
-
this.
|
|
28111
|
+
this._initializeTooltip();
|
|
28112
|
+
this._myTooltip.value.addEventListener("show.bs.tooltip", () => {
|
|
27894
28113
|
this.emit("sgds-show");
|
|
27895
28114
|
});
|
|
27896
|
-
this.
|
|
28115
|
+
this._myTooltip.value.addEventListener("shown.bs.tooltip", () => {
|
|
27897
28116
|
this.emit("sgds-after-show");
|
|
27898
28117
|
});
|
|
27899
|
-
this.
|
|
28118
|
+
this._myTooltip.value.addEventListener("hide.bs.tooltip", () => {
|
|
27900
28119
|
this.emit("sgds-hide");
|
|
27901
28120
|
});
|
|
27902
|
-
this.
|
|
28121
|
+
this._myTooltip.value.addEventListener("hidden.bs.tooltip", () => {
|
|
27903
28122
|
this.emit("sgds-after-hide");
|
|
27904
28123
|
});
|
|
27905
28124
|
}
|
|
27906
28125
|
/** Hides the Tooltip */
|
|
27907
28126
|
hide() {
|
|
27908
|
-
this.
|
|
28127
|
+
this._bsTooltip.hide();
|
|
27909
28128
|
}
|
|
27910
28129
|
/** Shows the Tooltip */
|
|
27911
28130
|
show() {
|
|
27912
|
-
this.
|
|
28131
|
+
this._bsTooltip.show();
|
|
27913
28132
|
}
|
|
27914
28133
|
render() {
|
|
27915
28134
|
return html$1 `
|
|
27916
|
-
<div ${ref(this.
|
|
28135
|
+
<div ${ref(this._myTooltip)}>
|
|
27917
28136
|
<slot @slotchange=${this._handleSlotChange}></slot>
|
|
27918
28137
|
</div>
|
|
27919
28138
|
`;
|
|
@@ -27934,7 +28153,7 @@
|
|
|
27934
28153
|
], SgdsTooltip.prototype, "popperConfig", void 0);
|
|
27935
28154
|
__decorate([
|
|
27936
28155
|
queryAssignedElements()
|
|
27937
|
-
], SgdsTooltip.prototype, "
|
|
28156
|
+
], SgdsTooltip.prototype, "_tooltipTargetElements", void 0);
|
|
27938
28157
|
|
|
27939
28158
|
customElements.define("sgds-tooltip", SgdsTooltip);
|
|
27940
28159
|
|