@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
|
@@ -1618,8 +1618,8 @@
|
|
|
1618
1618
|
*/
|
|
1619
1619
|
const rawTextElement = /^(?:script|style|textarea|title)$/i;
|
|
1620
1620
|
/** TemplateResult types */
|
|
1621
|
-
const HTML_RESULT
|
|
1622
|
-
const SVG_RESULT
|
|
1621
|
+
const HTML_RESULT = 1;
|
|
1622
|
+
const SVG_RESULT = 2;
|
|
1623
1623
|
const MATHML_RESULT = 3;
|
|
1624
1624
|
// TemplatePart types
|
|
1625
1625
|
// IMPORTANT: these must match the values in PartType
|
|
@@ -1671,7 +1671,7 @@
|
|
|
1671
1671
|
* if a template comes from the same expression as a previously rendered result,
|
|
1672
1672
|
* it's efficiently updated instead of replaced.
|
|
1673
1673
|
*/
|
|
1674
|
-
const html$1 = tag(HTML_RESULT
|
|
1674
|
+
const html$1 = tag(HTML_RESULT);
|
|
1675
1675
|
/**
|
|
1676
1676
|
* A sentinel value that signals that a value was handled by a directive and
|
|
1677
1677
|
* should not be written to the DOM.
|
|
@@ -1760,7 +1760,7 @@
|
|
|
1760
1760
|
// parts. ElementParts are also reflected in this array as undefined
|
|
1761
1761
|
// rather than a string, to disambiguate from attribute bindings.
|
|
1762
1762
|
const attrNames = [];
|
|
1763
|
-
let html = type === SVG_RESULT
|
|
1763
|
+
let html = type === SVG_RESULT ? '<svg>' : type === MATHML_RESULT ? '<math>' : '';
|
|
1764
1764
|
// When we're inside a raw text tag (not it's text content), the regex
|
|
1765
1765
|
// will still be tagRegex so we can find attributes, but will switch to
|
|
1766
1766
|
// this regex when the tag ends.
|
|
@@ -1886,7 +1886,7 @@
|
|
|
1886
1886
|
}
|
|
1887
1887
|
const htmlResult = html +
|
|
1888
1888
|
(strings[l] || '<?>') +
|
|
1889
|
-
(type === SVG_RESULT
|
|
1889
|
+
(type === SVG_RESULT ? '</svg>' : type === MATHML_RESULT ? '</math>' : '');
|
|
1890
1890
|
// Returned as an array for terseness
|
|
1891
1891
|
return [trustFromTemplateString(strings, htmlResult), attrNames];
|
|
1892
1892
|
};
|
|
@@ -1905,7 +1905,7 @@
|
|
|
1905
1905
|
this.el = Template.createElement(html, options);
|
|
1906
1906
|
walker.currentNode = this.el.content;
|
|
1907
1907
|
// Re-parent SVG or MathML nodes into template root
|
|
1908
|
-
if (type === SVG_RESULT
|
|
1908
|
+
if (type === SVG_RESULT || type === MATHML_RESULT) {
|
|
1909
1909
|
const wrapper = this.el.content.firstChild;
|
|
1910
1910
|
wrapper.replaceWith(...wrapper.childNodes);
|
|
1911
1911
|
}
|
|
@@ -4498,6 +4498,59 @@
|
|
|
4498
4498
|
});
|
|
4499
4499
|
}
|
|
4500
4500
|
|
|
4501
|
+
/**
|
|
4502
|
+
* @license
|
|
4503
|
+
* Copyright 2017 Google LLC
|
|
4504
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
4505
|
+
*/
|
|
4506
|
+
// Note, in the future, we may extend this decorator to support the use case
|
|
4507
|
+
// where the queried element may need to do work to become ready to interact
|
|
4508
|
+
// with (e.g. load some implementation code). If so, we might elect to
|
|
4509
|
+
// add a second argument defining a function that can be run to make the
|
|
4510
|
+
// queried element loaded/updated/ready.
|
|
4511
|
+
/**
|
|
4512
|
+
* A property decorator that converts a class property into a getter that
|
|
4513
|
+
* returns a promise that resolves to the result of a querySelector on the
|
|
4514
|
+
* element's renderRoot done after the element's `updateComplete` promise
|
|
4515
|
+
* resolves. When the queried property may change with element state, this
|
|
4516
|
+
* decorator can be used instead of requiring users to await the
|
|
4517
|
+
* `updateComplete` before accessing the property.
|
|
4518
|
+
*
|
|
4519
|
+
* @param selector A DOMString containing one or more selectors to match.
|
|
4520
|
+
*
|
|
4521
|
+
* See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector
|
|
4522
|
+
*
|
|
4523
|
+
* ```ts
|
|
4524
|
+
* class MyElement {
|
|
4525
|
+
* @queryAsync('#first')
|
|
4526
|
+
* first: Promise<HTMLDivElement>;
|
|
4527
|
+
*
|
|
4528
|
+
* render() {
|
|
4529
|
+
* return html`
|
|
4530
|
+
* <div id="first"></div>
|
|
4531
|
+
* <div id="second"></div>
|
|
4532
|
+
* `;
|
|
4533
|
+
* }
|
|
4534
|
+
* }
|
|
4535
|
+
*
|
|
4536
|
+
* // external usage
|
|
4537
|
+
* async doSomethingWithFirst() {
|
|
4538
|
+
* (await aMyElement.first).doSomething();
|
|
4539
|
+
* }
|
|
4540
|
+
* ```
|
|
4541
|
+
* @category Decorator
|
|
4542
|
+
*/
|
|
4543
|
+
function queryAsync(selector) {
|
|
4544
|
+
return ((obj, name) => {
|
|
4545
|
+
return desc(obj, name, {
|
|
4546
|
+
async get() {
|
|
4547
|
+
await this.updateComplete;
|
|
4548
|
+
return this.renderRoot?.querySelector(selector) ?? null;
|
|
4549
|
+
},
|
|
4550
|
+
});
|
|
4551
|
+
});
|
|
4552
|
+
}
|
|
4553
|
+
|
|
4501
4554
|
/**
|
|
4502
4555
|
* @license
|
|
4503
4556
|
* Copyright 2020 Google LLC
|
|
@@ -4926,77 +4979,7 @@
|
|
|
4926
4979
|
*/
|
|
4927
4980
|
const ref = directive(RefDirective);
|
|
4928
4981
|
|
|
4929
|
-
|
|
4930
|
-
* @license
|
|
4931
|
-
* Copyright 2017 Google LLC
|
|
4932
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4933
|
-
*/
|
|
4934
|
-
const HTML_RESULT = 1;
|
|
4935
|
-
class UnsafeHTMLDirective extends Directive {
|
|
4936
|
-
constructor(partInfo) {
|
|
4937
|
-
super(partInfo);
|
|
4938
|
-
this._value = nothing;
|
|
4939
|
-
if (partInfo.type !== PartType.CHILD) {
|
|
4940
|
-
throw new Error(`${this.constructor.directiveName}() can only be used in child bindings`);
|
|
4941
|
-
}
|
|
4942
|
-
}
|
|
4943
|
-
render(value) {
|
|
4944
|
-
if (value === nothing || value == null) {
|
|
4945
|
-
this._templateResult = undefined;
|
|
4946
|
-
return (this._value = value);
|
|
4947
|
-
}
|
|
4948
|
-
if (value === noChange) {
|
|
4949
|
-
return value;
|
|
4950
|
-
}
|
|
4951
|
-
if (typeof value != 'string') {
|
|
4952
|
-
throw new Error(`${this.constructor.directiveName}() called with a non-string value`);
|
|
4953
|
-
}
|
|
4954
|
-
if (value === this._value) {
|
|
4955
|
-
return this._templateResult;
|
|
4956
|
-
}
|
|
4957
|
-
this._value = value;
|
|
4958
|
-
const strings = [value];
|
|
4959
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4960
|
-
strings.raw = strings;
|
|
4961
|
-
// WARNING: impersonating a TemplateResult like this is extremely
|
|
4962
|
-
// dangerous. Third-party directives should not do this.
|
|
4963
|
-
return (this._templateResult = {
|
|
4964
|
-
// Cast to a known set of integers that satisfy ResultType so that we
|
|
4965
|
-
// don't have to export ResultType and possibly encourage this pattern.
|
|
4966
|
-
// This property needs to remain unminified.
|
|
4967
|
-
['_$litType$']: this.constructor
|
|
4968
|
-
.resultType,
|
|
4969
|
-
strings,
|
|
4970
|
-
values: [],
|
|
4971
|
-
});
|
|
4972
|
-
}
|
|
4973
|
-
}
|
|
4974
|
-
UnsafeHTMLDirective.directiveName = 'unsafeHTML';
|
|
4975
|
-
UnsafeHTMLDirective.resultType = HTML_RESULT;
|
|
4976
|
-
|
|
4977
|
-
/**
|
|
4978
|
-
* @license
|
|
4979
|
-
* Copyright 2017 Google LLC
|
|
4980
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
4981
|
-
*/
|
|
4982
|
-
const SVG_RESULT = 2;
|
|
4983
|
-
class UnsafeSVGDirective extends UnsafeHTMLDirective {
|
|
4984
|
-
}
|
|
4985
|
-
UnsafeSVGDirective.directiveName = 'unsafeSVG';
|
|
4986
|
-
UnsafeSVGDirective.resultType = SVG_RESULT;
|
|
4987
|
-
/**
|
|
4988
|
-
* Renders the result as SVG, rather than text.
|
|
4989
|
-
*
|
|
4990
|
-
* The values `undefined`, `null`, and `nothing`, will all result in no content
|
|
4991
|
-
* (empty string) being rendered.
|
|
4992
|
-
*
|
|
4993
|
-
* Note, this is unsafe to use with any user-provided input that hasn't been
|
|
4994
|
-
* sanitized or escaped, as it may lead to cross-site-scripting
|
|
4995
|
-
* vulnerabilities.
|
|
4996
|
-
*/
|
|
4997
|
-
const unsafeSVG = directive(UnsafeSVGDirective);
|
|
4998
|
-
|
|
4999
|
-
var css_248z$6 = 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}}`;
|
|
4982
|
+
var css_248z$9 = 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}}`;
|
|
5000
4983
|
|
|
5001
4984
|
/**
|
|
5002
4985
|
* @cssprop --sgds-{stateColor} - State colors in hexadecimal value
|
|
@@ -5014,7 +4997,22 @@
|
|
|
5014
4997
|
return event;
|
|
5015
4998
|
}
|
|
5016
4999
|
}
|
|
5017
|
-
SgdsElement.styles = [css_248z$
|
|
5000
|
+
SgdsElement.styles = [css_248z$9];
|
|
5001
|
+
|
|
5002
|
+
/**
|
|
5003
|
+
* @license
|
|
5004
|
+
* Copyright 2018 Google LLC
|
|
5005
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5006
|
+
*/
|
|
5007
|
+
/**
|
|
5008
|
+
* For AttributeParts, sets the attribute if the value is defined and removes
|
|
5009
|
+
* the attribute if the value is undefined.
|
|
5010
|
+
*
|
|
5011
|
+
* For other part types, this directive is a no-op.
|
|
5012
|
+
*/
|
|
5013
|
+
const ifDefined = (value) => value ?? nothing;
|
|
5014
|
+
|
|
5015
|
+
var css_248z$8 = 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)}`;
|
|
5018
5016
|
|
|
5019
5017
|
/**
|
|
5020
5018
|
* @license
|
|
@@ -5101,17 +5099,51 @@
|
|
|
5101
5099
|
const classMap = directive(ClassMapDirective);
|
|
5102
5100
|
|
|
5103
5101
|
/**
|
|
5104
|
-
* @
|
|
5105
|
-
*
|
|
5106
|
-
*
|
|
5107
|
-
*/
|
|
5108
|
-
/**
|
|
5109
|
-
* For AttributeParts, sets the attribute if the value is defined and removes
|
|
5110
|
-
* the attribute if the value is undefined.
|
|
5102
|
+
* @summary Close button for closing actions. Used in Modal, Drawer, Alert and Toast.
|
|
5103
|
+
*
|
|
5104
|
+
* @cssprop --sgds-close-btn-border-radius - The border radius of close button border
|
|
5111
5105
|
*
|
|
5112
|
-
* For other part types, this directive is a no-op.
|
|
5113
5106
|
*/
|
|
5114
|
-
|
|
5107
|
+
class SgdsCloseButton extends SgdsElement {
|
|
5108
|
+
constructor() {
|
|
5109
|
+
super(...arguments);
|
|
5110
|
+
this.ariaLabel = "Close button";
|
|
5111
|
+
/** Specifies a large or small button */
|
|
5112
|
+
this.size = "md";
|
|
5113
|
+
this.variant = "default";
|
|
5114
|
+
this._clickHandler = () => {
|
|
5115
|
+
return;
|
|
5116
|
+
};
|
|
5117
|
+
}
|
|
5118
|
+
_handleClick() {
|
|
5119
|
+
this.removeEventListener("click", this._clickHandler);
|
|
5120
|
+
this.addEventListener("click", this._clickHandler);
|
|
5121
|
+
}
|
|
5122
|
+
render() {
|
|
5123
|
+
return html$1 `
|
|
5124
|
+
<button
|
|
5125
|
+
class=${classMap({
|
|
5126
|
+
"btn-close": true,
|
|
5127
|
+
[`btn-close-${this.size}`]: this.size,
|
|
5128
|
+
"btn-close-light": this.variant === "light",
|
|
5129
|
+
"btn-close-dark": this.variant === "dark"
|
|
5130
|
+
})}
|
|
5131
|
+
aria-label=${ifDefined(this.ariaLabel)}
|
|
5132
|
+
@click=${this._handleClick}
|
|
5133
|
+
></button>
|
|
5134
|
+
`;
|
|
5135
|
+
}
|
|
5136
|
+
}
|
|
5137
|
+
SgdsCloseButton.styles = [...SgdsElement.styles, css_248z$8];
|
|
5138
|
+
__decorate([
|
|
5139
|
+
property({ type: String })
|
|
5140
|
+
], SgdsCloseButton.prototype, "ariaLabel", void 0);
|
|
5141
|
+
__decorate([
|
|
5142
|
+
property({ type: String, reflect: true })
|
|
5143
|
+
], SgdsCloseButton.prototype, "size", void 0);
|
|
5144
|
+
__decorate([
|
|
5145
|
+
property({ type: String, reflect: true })
|
|
5146
|
+
], SgdsCloseButton.prototype, "variant", void 0);
|
|
5115
5147
|
|
|
5116
5148
|
/**
|
|
5117
5149
|
* @license
|
|
@@ -5227,7 +5259,7 @@
|
|
|
5227
5259
|
*/
|
|
5228
5260
|
const html = withStatic(html$1);
|
|
5229
5261
|
|
|
5230
|
-
var css_248z$
|
|
5262
|
+
var css_248z$7 = 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)}`;
|
|
5231
5263
|
|
|
5232
5264
|
class ButtonElement extends SgdsElement {
|
|
5233
5265
|
constructor() {
|
|
@@ -5269,7 +5301,7 @@
|
|
|
5269
5301
|
}
|
|
5270
5302
|
}
|
|
5271
5303
|
}
|
|
5272
|
-
ButtonElement.styles = [...SgdsElement.styles, css_248z$
|
|
5304
|
+
ButtonElement.styles = [...SgdsElement.styles, css_248z$7];
|
|
5273
5305
|
__decorate([
|
|
5274
5306
|
query(".btn")
|
|
5275
5307
|
], ButtonElement.prototype, "button", void 0);
|
|
@@ -5298,103 +5330,30 @@
|
|
|
5298
5330
|
property({ type: String })
|
|
5299
5331
|
], ButtonElement.prototype, "ariaLabel", void 0);
|
|
5300
5332
|
|
|
5301
|
-
var css_248z$
|
|
5333
|
+
var css_248z$6 = 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}`;
|
|
5302
5334
|
|
|
5303
|
-
|
|
5335
|
+
/**
|
|
5336
|
+
* A controller to help with form submission
|
|
5337
|
+
*/
|
|
5304
5338
|
class FormSubmitController {
|
|
5305
5339
|
constructor(host, options) {
|
|
5306
5340
|
(this.host = host).addController(this);
|
|
5307
5341
|
this.options = Object.assign({ form: (input) => {
|
|
5308
5342
|
return input.closest("form");
|
|
5309
|
-
}, name: (input) => input.name, value: (input) => input.value, defaultValue: (input) => input.defaultValue, disabled: (input) => input.disabled, reportValidity: (input) => {
|
|
5310
|
-
return typeof input.reportValidity === "function" ? input.reportValidity() : true;
|
|
5311
|
-
}, setValue: (input, value) => {
|
|
5312
|
-
input.value = value;
|
|
5313
5343
|
} }, options);
|
|
5314
|
-
this.handleFormData = this.handleFormData.bind(this);
|
|
5315
|
-
this.handleFormSubmit = this.handleFormSubmit.bind(this);
|
|
5316
|
-
this.handleFormReset = this.handleFormReset.bind(this);
|
|
5317
|
-
this.reportFormValidity = this.reportFormValidity.bind(this);
|
|
5318
5344
|
}
|
|
5319
5345
|
hostConnected() {
|
|
5320
5346
|
this.form = this.options.form(this.host);
|
|
5321
|
-
if (this.form) {
|
|
5322
|
-
this.form.addEventListener("formdata", this.handleFormData);
|
|
5323
|
-
this.form.addEventListener("submit", this.handleFormSubmit);
|
|
5324
|
-
this.form.addEventListener("reset", this.handleFormReset);
|
|
5325
|
-
// Overload the form's reportValidity() method so it looks at Shoelace form controls
|
|
5326
|
-
if (!reportValidityOverloads.has(this.form)) {
|
|
5327
|
-
reportValidityOverloads.set(this.form, this.form.reportValidity);
|
|
5328
|
-
this.form.reportValidity = () => this.reportFormValidity();
|
|
5329
|
-
}
|
|
5330
|
-
}
|
|
5331
5347
|
}
|
|
5332
5348
|
hostDisconnected() {
|
|
5333
5349
|
if (this.form) {
|
|
5334
|
-
this.form.removeEventListener("formdata", this.handleFormData);
|
|
5335
|
-
this.form.removeEventListener("submit", this.handleFormSubmit);
|
|
5336
|
-
this.form.removeEventListener("reset", this.handleFormReset);
|
|
5337
|
-
// Remove the overload and restore the original method
|
|
5338
|
-
if (reportValidityOverloads.has(this.form)) {
|
|
5339
|
-
this.form.reportValidity = reportValidityOverloads.get(this.form);
|
|
5340
|
-
reportValidityOverloads.delete(this.form);
|
|
5341
|
-
}
|
|
5342
5350
|
this.form = undefined;
|
|
5343
5351
|
}
|
|
5344
5352
|
}
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
if (!disabled && typeof name === "string" && typeof value !== "undefined") {
|
|
5350
|
-
if (Array.isArray(value)) {
|
|
5351
|
-
value.forEach(val => {
|
|
5352
|
-
event.formData.append(name, val.toString());
|
|
5353
|
-
});
|
|
5354
|
-
}
|
|
5355
|
-
else {
|
|
5356
|
-
event.formData.append(name, value.toString());
|
|
5357
|
-
}
|
|
5358
|
-
}
|
|
5359
|
-
}
|
|
5360
|
-
handleFormSubmit(event) {
|
|
5361
|
-
const disabled = this.options.disabled(this.host);
|
|
5362
|
-
const reportValidity = this.options.reportValidity;
|
|
5363
|
-
if (this.form && !this.form.noValidate && !disabled && !reportValidity(this.host)) {
|
|
5364
|
-
event.preventDefault();
|
|
5365
|
-
event.stopImmediatePropagation();
|
|
5366
|
-
}
|
|
5367
|
-
}
|
|
5368
|
-
handleFormReset() {
|
|
5369
|
-
this.options.setValue(this.host, this.options.defaultValue(this.host));
|
|
5370
|
-
}
|
|
5371
|
-
reportFormValidity() {
|
|
5372
|
-
//
|
|
5373
|
-
// Shoelace form controls work hard to act like regular form controls. They support the Constraint Validation API
|
|
5374
|
-
// and its associated methods such as setCustomValidity() and reportValidity(). However, the HTMLFormElement also
|
|
5375
|
-
// has a reportValidity() method that will trigger validation on all child controls. Since we're not yet using
|
|
5376
|
-
// ElementInternals, we need to overload this method so it looks for any element with the reportValidity() method.
|
|
5377
|
-
//
|
|
5378
|
-
// We preserve the original method in a WeakMap, but we don't call it from the overload because that would trigger
|
|
5379
|
-
// validations in an unexpected order. When the element disconnects, we revert to the original behavior. This won't
|
|
5380
|
-
// be necessary once we can use ElementInternals.
|
|
5381
|
-
//
|
|
5382
|
-
// Note that we're also honoring the form's novalidate attribute.
|
|
5383
|
-
//
|
|
5384
|
-
if (this.form && !this.form.noValidate) {
|
|
5385
|
-
// This seems sloppy, but checking all elements will cover native inputs, Shoelace inputs, and other custom
|
|
5386
|
-
// elements that support the constraint validation API.
|
|
5387
|
-
const elements = this.form.querySelectorAll("*");
|
|
5388
|
-
for (const element of elements) {
|
|
5389
|
-
if (typeof element.reportValidity === "function") {
|
|
5390
|
-
if (!element.reportValidity()) {
|
|
5391
|
-
return false;
|
|
5392
|
-
}
|
|
5393
|
-
}
|
|
5394
|
-
}
|
|
5395
|
-
}
|
|
5396
|
-
return true;
|
|
5397
|
-
}
|
|
5353
|
+
/**
|
|
5354
|
+
* Creates a temporary native HTML button that can participate in form and invoke form submits and reset
|
|
5355
|
+
* Button is removed once action is performed
|
|
5356
|
+
*/
|
|
5398
5357
|
doAction(type, invoker) {
|
|
5399
5358
|
if (this.form) {
|
|
5400
5359
|
const button = document.createElement("button");
|
|
@@ -5430,7 +5389,7 @@
|
|
|
5430
5389
|
}
|
|
5431
5390
|
}
|
|
5432
5391
|
|
|
5433
|
-
var css_248z$
|
|
5392
|
+
var css_248z$5 = 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)}`;
|
|
5434
5393
|
|
|
5435
5394
|
/**
|
|
5436
5395
|
* @summary Custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more.
|
|
@@ -5534,7 +5493,7 @@
|
|
|
5534
5493
|
`;
|
|
5535
5494
|
}
|
|
5536
5495
|
}
|
|
5537
|
-
SgdsButton.styles = [...ButtonElement.styles, css_248z$
|
|
5496
|
+
SgdsButton.styles = [...ButtonElement.styles, css_248z$6, css_248z$5];
|
|
5538
5497
|
__decorate([
|
|
5539
5498
|
state()
|
|
5540
5499
|
], SgdsButton.prototype, "_hasLeftIcon", void 0);
|
|
@@ -5563,64 +5522,383 @@
|
|
|
5563
5522
|
property({ type: Boolean, reflect: true })
|
|
5564
5523
|
], SgdsButton.prototype, "fullWidth", void 0);
|
|
5565
5524
|
|
|
5566
|
-
var css_248z$
|
|
5525
|
+
var css_248z$4 = 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}`;
|
|
5526
|
+
|
|
5527
|
+
var css_248z$3 = 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)}`;
|
|
5528
|
+
|
|
5529
|
+
var css_248z$2 = css`.form-text{color:var(--sgds-form-color-subtle);font-size:var(--sgds-font-size-1)}.form-text.disabled{opacity:var(--sgds-opacity-50)}`;
|
|
5530
|
+
|
|
5531
|
+
var css_248z$1 = 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}`;
|
|
5567
5532
|
|
|
5568
|
-
|
|
5533
|
+
var css_248z = 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)}`;
|
|
5534
|
+
|
|
5535
|
+
function generateId (componentName = "", elementName = "") {
|
|
5569
5536
|
return `id-${Math.random().toString().substring(2, 6)}-sgds-${componentName}-${elementName}`;
|
|
5570
5537
|
}
|
|
5571
5538
|
|
|
5572
|
-
|
|
5539
|
+
class FormControlElement extends SgdsElement {
|
|
5540
|
+
constructor() {
|
|
5541
|
+
super(...arguments);
|
|
5542
|
+
/** The input's label */
|
|
5543
|
+
this.label = "";
|
|
5544
|
+
/** The input's hint text */
|
|
5545
|
+
this.hintText = "";
|
|
5546
|
+
/** Disables the input. */
|
|
5547
|
+
this.disabled = false;
|
|
5548
|
+
/** Marks the component as invalid. Replace the pseudo :invalid selector for absent in custom elements */
|
|
5549
|
+
this.invalid = false;
|
|
5550
|
+
this._controlId = generateId("input");
|
|
5551
|
+
this._labelId = generateId("label");
|
|
5552
|
+
}
|
|
5553
|
+
/** Programatically sets the invalid state of the input. Pass in boolean value in the argument */
|
|
5554
|
+
setInvalid(bool) {
|
|
5555
|
+
this.invalid = bool;
|
|
5556
|
+
if (bool) {
|
|
5557
|
+
this.emit("sgds-invalid");
|
|
5558
|
+
}
|
|
5559
|
+
else {
|
|
5560
|
+
this.emit("sgds-valid");
|
|
5561
|
+
}
|
|
5562
|
+
}
|
|
5563
|
+
}
|
|
5564
|
+
FormControlElement.styles = [...SgdsElement.styles, css_248z$3, css_248z$2, css_248z$1, css_248z];
|
|
5565
|
+
__decorate([
|
|
5566
|
+
property({ reflect: true })
|
|
5567
|
+
], FormControlElement.prototype, "label", void 0);
|
|
5568
|
+
__decorate([
|
|
5569
|
+
property({ reflect: true })
|
|
5570
|
+
], FormControlElement.prototype, "hintText", void 0);
|
|
5571
|
+
__decorate([
|
|
5572
|
+
property({ reflect: true })
|
|
5573
|
+
], FormControlElement.prototype, "name", void 0);
|
|
5574
|
+
__decorate([
|
|
5575
|
+
property({ type: Boolean, reflect: true })
|
|
5576
|
+
], FormControlElement.prototype, "disabled", void 0);
|
|
5577
|
+
__decorate([
|
|
5578
|
+
property({ type: Boolean, reflect: true })
|
|
5579
|
+
], FormControlElement.prototype, "invalid", void 0);
|
|
5580
|
+
|
|
5581
|
+
/**
|
|
5582
|
+
* SGDS custom form validation methods and behaviours
|
|
5583
|
+
*/
|
|
5584
|
+
class InputValidationController {
|
|
5585
|
+
constructor(host, options) {
|
|
5586
|
+
(this.host = host).addController(this);
|
|
5587
|
+
this._internals = this.host.attachInternals();
|
|
5588
|
+
this.options = Object.assign({ setInvalid: (host, value) => {
|
|
5589
|
+
host.invalid = value;
|
|
5590
|
+
}, value: (host) => {
|
|
5591
|
+
return host.value;
|
|
5592
|
+
}, input: (host) => host.input }, options);
|
|
5593
|
+
}
|
|
5594
|
+
hostConnected() {
|
|
5595
|
+
this.host.addEventListener("invalid", e => this.handleInvalid(e));
|
|
5596
|
+
}
|
|
5597
|
+
hostDisconnected() {
|
|
5598
|
+
this.host.removeEventListener("invalid", e => this.handleInvalid(e));
|
|
5599
|
+
}
|
|
5600
|
+
/**
|
|
5601
|
+
* Prevents the native browser error message pop up when reportValidity() called by
|
|
5602
|
+
* associated form or the component's reportValidity during constraint validation
|
|
5603
|
+
* Sets invalid reactive prop to true
|
|
5604
|
+
*/
|
|
5605
|
+
handleInvalid(e) {
|
|
5606
|
+
e.preventDefault();
|
|
5607
|
+
this.options.setInvalid(this.host, true);
|
|
5608
|
+
}
|
|
5609
|
+
/**
|
|
5610
|
+
* Sets invalid to false when invoked and
|
|
5611
|
+
* Updates the ValidityState based on new value, but
|
|
5612
|
+
* does not update invalid reactive prop
|
|
5613
|
+
* @param e
|
|
5614
|
+
*/
|
|
5615
|
+
handleInput(e) {
|
|
5616
|
+
const input = e.target;
|
|
5617
|
+
this.options.setInvalid(this.host, false);
|
|
5618
|
+
this.validateInput(input);
|
|
5619
|
+
}
|
|
5620
|
+
/**
|
|
5621
|
+
* Validate the input's new value after onChange and
|
|
5622
|
+
* update invalid reactive prop
|
|
5623
|
+
* @param e
|
|
5624
|
+
*/
|
|
5625
|
+
handleChange(e) {
|
|
5626
|
+
const input = e.target;
|
|
5627
|
+
this.validateInput(input);
|
|
5628
|
+
this.options.setInvalid(this.host, !this.checkValidity());
|
|
5629
|
+
}
|
|
5630
|
+
get form() {
|
|
5631
|
+
return this._internals.form;
|
|
5632
|
+
}
|
|
5633
|
+
get validity() {
|
|
5634
|
+
return this._internals.validity;
|
|
5635
|
+
}
|
|
5636
|
+
get validationMessage() {
|
|
5637
|
+
return this._internals.validationMessage;
|
|
5638
|
+
}
|
|
5639
|
+
get willValidate() {
|
|
5640
|
+
return this._internals.willValidate;
|
|
5641
|
+
}
|
|
5642
|
+
/**
|
|
5643
|
+
* Checks the validity and updates the invalid reactive prop of form components
|
|
5644
|
+
*/
|
|
5645
|
+
updateInvalidState() {
|
|
5646
|
+
this.options.setInvalid(this.host, !this.checkValidity());
|
|
5647
|
+
}
|
|
5648
|
+
/**
|
|
5649
|
+
* Resets the ValidityState of the control
|
|
5650
|
+
*/
|
|
5651
|
+
resetValidity() {
|
|
5652
|
+
return this._internals.setValidity({});
|
|
5653
|
+
}
|
|
5654
|
+
/**
|
|
5655
|
+
* Reports the validity
|
|
5656
|
+
*/
|
|
5657
|
+
checkValidity() {
|
|
5658
|
+
return this._internals.checkValidity();
|
|
5659
|
+
}
|
|
5660
|
+
/**
|
|
5661
|
+
* Reports the validity with a error popup message
|
|
5662
|
+
*/
|
|
5663
|
+
reportValidity() {
|
|
5664
|
+
return this._internals.reportValidity();
|
|
5665
|
+
}
|
|
5666
|
+
/**
|
|
5667
|
+
* Sets the form control value into FormData,
|
|
5668
|
+
* making the value of control accessible via FormData
|
|
5669
|
+
*/
|
|
5670
|
+
setFormValue() {
|
|
5671
|
+
const value = this.options.value(this.host);
|
|
5672
|
+
this._internals.setFormValue(value);
|
|
5673
|
+
}
|
|
5674
|
+
/**
|
|
5675
|
+
* Updates the ValidityState of the input in form component at current state
|
|
5676
|
+
*/
|
|
5677
|
+
validateInput(input) {
|
|
5678
|
+
/** When the form control is disabled, its always valid */
|
|
5679
|
+
if (this.options.input(this.host).disabled) {
|
|
5680
|
+
return this._internals.setValidity({});
|
|
5681
|
+
}
|
|
5682
|
+
// get the validity of the internal <input>
|
|
5683
|
+
const validState = input.validity;
|
|
5684
|
+
// if the input is invalid, show the correct error
|
|
5685
|
+
if (!validState.valid) {
|
|
5686
|
+
// loop through the error reasons
|
|
5687
|
+
for (const state in validState) {
|
|
5688
|
+
// if there is an error and corresponding attribute holding
|
|
5689
|
+
// the message
|
|
5690
|
+
if (validState[state]) {
|
|
5691
|
+
this.validationError = state.toString();
|
|
5692
|
+
// set the validity error reason and the corresponding
|
|
5693
|
+
// message
|
|
5694
|
+
this._internals.setValidity({ [this.validationError]: true }, input.validationMessage, input);
|
|
5695
|
+
}
|
|
5696
|
+
}
|
|
5697
|
+
}
|
|
5698
|
+
else {
|
|
5699
|
+
this._internals.setValidity({});
|
|
5700
|
+
}
|
|
5701
|
+
}
|
|
5702
|
+
}
|
|
5703
|
+
|
|
5704
|
+
/**
|
|
5705
|
+
* @summary The FormValidationMixin used by the form components
|
|
5706
|
+
* @param superClass
|
|
5707
|
+
* @returns
|
|
5708
|
+
*/
|
|
5709
|
+
const SgdsFormValidatorMixin = (superClass) => {
|
|
5710
|
+
class ToBeValidatedElement extends superClass {
|
|
5711
|
+
constructor() {
|
|
5712
|
+
super(...arguments);
|
|
5713
|
+
this._isTouched = false;
|
|
5714
|
+
}
|
|
5715
|
+
connectedCallback() {
|
|
5716
|
+
super.connectedCallback();
|
|
5717
|
+
this.inputValidationController = new InputValidationController(this);
|
|
5718
|
+
}
|
|
5719
|
+
async firstUpdated(changedProperties) {
|
|
5720
|
+
super.firstUpdated(changedProperties);
|
|
5721
|
+
/* Either input or sgds-input. For example, quantity-toggle uses sgds-input */
|
|
5722
|
+
this.input =
|
|
5723
|
+
this.shadowRoot.querySelector("input") || (await this.sgdsInput) || this.shadowRoot.querySelector("textarea");
|
|
5724
|
+
this._mixinValidate(this.input);
|
|
5725
|
+
}
|
|
5726
|
+
/**
|
|
5727
|
+
* Native lifecycle of Form-Associated Custom Element Callbacks
|
|
5728
|
+
*/
|
|
5729
|
+
formResetCallback() {
|
|
5730
|
+
if (this._mixinResetFormControl) {
|
|
5731
|
+
this._mixinResetFormControl();
|
|
5732
|
+
}
|
|
5733
|
+
else {
|
|
5734
|
+
this.value = this.defaultValue;
|
|
5735
|
+
this._mixinResetValidity(this.input);
|
|
5736
|
+
}
|
|
5737
|
+
this._mixinSetFormValue();
|
|
5738
|
+
}
|
|
5739
|
+
/**
|
|
5740
|
+
*
|
|
5741
|
+
* Methods use by classes using this mixin
|
|
5742
|
+
*/
|
|
5743
|
+
/**
|
|
5744
|
+
* OnChange of form component
|
|
5745
|
+
* 1. Make value of control accessible via FormData
|
|
5746
|
+
* 2. Run change handler
|
|
5747
|
+
*/
|
|
5748
|
+
_mixinHandleChange(e) {
|
|
5749
|
+
this._mixinSetFormValue();
|
|
5750
|
+
this.inputValidationController.handleChange(e);
|
|
5751
|
+
}
|
|
5752
|
+
/**
|
|
5753
|
+
* OnChange of form component
|
|
5754
|
+
* 1. Make value of control accessible via FormData
|
|
5755
|
+
* 2. Run input handler
|
|
5756
|
+
*/
|
|
5757
|
+
_mixinHandleInputChange(e) {
|
|
5758
|
+
this._mixinSetFormValue();
|
|
5759
|
+
this.inputValidationController.handleInput(e);
|
|
5760
|
+
}
|
|
5761
|
+
/**
|
|
5762
|
+
* During form resetting,
|
|
5763
|
+
* 1. ValidityState is reset
|
|
5764
|
+
* 2. invalid reactive prop is updated after the reset
|
|
5765
|
+
* 3. Revalidates the ValidityState (but do not update invalid prop)
|
|
5766
|
+
* to prepare for the next validity check
|
|
5767
|
+
* 4. Reset touched state to false for a pristine form
|
|
5768
|
+
*/
|
|
5769
|
+
_mixinResetValidity(input) {
|
|
5770
|
+
this.inputValidationController.resetValidity();
|
|
5771
|
+
this.inputValidationController.updateInvalidState();
|
|
5772
|
+
this.inputValidationController.validateInput(input);
|
|
5773
|
+
this._isTouched ? (this._isTouched = false) : null;
|
|
5774
|
+
}
|
|
5775
|
+
_mixinValidate(input) {
|
|
5776
|
+
this.inputValidationController.validateInput(input);
|
|
5777
|
+
}
|
|
5778
|
+
_mixinSetFormValue() {
|
|
5779
|
+
this.inputValidationController.setFormValue();
|
|
5780
|
+
}
|
|
5781
|
+
_mixinCheckValidity() {
|
|
5782
|
+
return this.inputValidationController.checkValidity();
|
|
5783
|
+
}
|
|
5784
|
+
_mixinReportValidity() {
|
|
5785
|
+
return this.inputValidationController.reportValidity();
|
|
5786
|
+
}
|
|
5787
|
+
_mixinGetValidity() {
|
|
5788
|
+
return this.inputValidationController.validity;
|
|
5789
|
+
}
|
|
5790
|
+
_mixinGetValidationMessage() {
|
|
5791
|
+
return this.inputValidationController.validationMessage;
|
|
5792
|
+
}
|
|
5793
|
+
}
|
|
5794
|
+
ToBeValidatedElement.formAssociated = true;
|
|
5795
|
+
__decorate([
|
|
5796
|
+
queryAsync("sgds-input")
|
|
5797
|
+
], ToBeValidatedElement.prototype, "sgdsInput", void 0);
|
|
5798
|
+
return ToBeValidatedElement;
|
|
5799
|
+
};
|
|
5573
5800
|
|
|
5574
|
-
|
|
5801
|
+
// @watch decorator
|
|
5802
|
+
//
|
|
5803
|
+
// Runs when an observed property changes, e.g. @property or @state, but before the component updates.
|
|
5804
|
+
//
|
|
5805
|
+
// To wait for an update to complete after a change occurs, use `await this.updateComplete` in the handler. To start
|
|
5806
|
+
// watching after the initial update/render, use `{ waitUntilFirstUpdate: true }` or `this.hasUpdated` in the handler.
|
|
5807
|
+
//
|
|
5808
|
+
// Usage:
|
|
5809
|
+
//
|
|
5810
|
+
// @watch('propName')
|
|
5811
|
+
// handlePropChange(oldValue, newValue) {
|
|
5812
|
+
// ...
|
|
5813
|
+
// }
|
|
5814
|
+
function watch(propName, options) {
|
|
5815
|
+
const resolvedOptions = Object.assign({ waitUntilFirstUpdate: false }, options);
|
|
5816
|
+
return (proto, decoratedFnName) => {
|
|
5817
|
+
// @ts-expect-error -- update is a protected property
|
|
5818
|
+
const { update } = proto;
|
|
5819
|
+
if (propName in proto) {
|
|
5820
|
+
const propNameKey = propName;
|
|
5821
|
+
// @ts-expect-error -- update is a protected property
|
|
5822
|
+
proto.update = function (changedProps) {
|
|
5823
|
+
if (changedProps.has(propNameKey)) {
|
|
5824
|
+
const oldValue = changedProps.get(propNameKey);
|
|
5825
|
+
const newValue = this[propNameKey];
|
|
5826
|
+
if (oldValue !== newValue) {
|
|
5827
|
+
if (!resolvedOptions.waitUntilFirstUpdate || this.hasUpdated) {
|
|
5828
|
+
this[decoratedFnName](oldValue, newValue);
|
|
5829
|
+
}
|
|
5830
|
+
}
|
|
5831
|
+
}
|
|
5832
|
+
update.call(this, changedProps);
|
|
5833
|
+
};
|
|
5834
|
+
}
|
|
5835
|
+
};
|
|
5836
|
+
}
|
|
5575
5837
|
|
|
5576
5838
|
/**
|
|
5577
5839
|
* @summary Allows users to upload files of various sizes and formats
|
|
5578
5840
|
* @slot default - Label for file upload button
|
|
5579
5841
|
*
|
|
5580
|
-
* @event sgds-files-selected - Emitted when files are selected for uploading
|
|
5581
|
-
*
|
|
5582
|
-
* @cssproperty --file-upload-file-icon-color - Left icon color
|
|
5583
|
-
* @cssproperty --file-upload-remove-icon-color - Remove icon color
|
|
5584
|
-
* @cssproperty --file-upload-remove-icon-hover-color - Remove icon hover color
|
|
5842
|
+
* @event sgds-files-selected - Emitted when files are selected for uploading. Access the selected files with event.target.detail
|
|
5585
5843
|
*/
|
|
5586
|
-
class SgdsFileUpload extends ScopedElementsMixin(
|
|
5844
|
+
class SgdsFileUpload extends SgdsFormValidatorMixin(ScopedElementsMixin(FormControlElement)) {
|
|
5587
5845
|
constructor() {
|
|
5588
5846
|
super(...arguments);
|
|
5589
|
-
/** The button's variant. */
|
|
5590
|
-
this.variant = "primary";
|
|
5591
|
-
//** Disable the fileuploader button */
|
|
5592
|
-
this.disabled = false;
|
|
5593
5847
|
/** Allows multiple files to be listed for uploading */
|
|
5594
5848
|
this.multiple = false;
|
|
5595
5849
|
/** Specify the acceptable file type */
|
|
5596
5850
|
this.accept = "";
|
|
5597
|
-
/** Customize the check icon with SVG */
|
|
5598
|
-
|
|
5599
|
-
/**
|
|
5600
|
-
this.
|
|
5601
|
-
/**
|
|
5602
|
-
this.
|
|
5603
|
-
/** @internal */
|
|
5851
|
+
// /** Customize the check icon with SVG */
|
|
5852
|
+
// @property({ type: String }) checkedIcon = "";
|
|
5853
|
+
/** Allows invalidFeedback, invalid and valid styles to be visible with the input */
|
|
5854
|
+
this.hasFeedback = false;
|
|
5855
|
+
/** Makes the input as a required field. */
|
|
5856
|
+
this.required = false;
|
|
5604
5857
|
this.selectedFiles = [];
|
|
5605
|
-
// Create a ref to the input element
|
|
5606
|
-
/** @internal */
|
|
5607
5858
|
this.inputRef = createRef();
|
|
5608
|
-
/**@internal */
|
|
5609
|
-
this.inputId = genId("input", "file");
|
|
5610
5859
|
}
|
|
5611
5860
|
/**@internal */
|
|
5612
5861
|
static get scopedElements() {
|
|
5613
5862
|
return {
|
|
5614
|
-
"sgds-button": SgdsButton
|
|
5863
|
+
"sgds-button": SgdsButton,
|
|
5864
|
+
"sgds-close-button": SgdsCloseButton
|
|
5615
5865
|
};
|
|
5616
5866
|
}
|
|
5867
|
+
/**
|
|
5868
|
+
* Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
|
|
5869
|
+
* 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
|
|
5870
|
+
*/
|
|
5871
|
+
reportValidity() {
|
|
5872
|
+
return this._mixinReportValidity();
|
|
5873
|
+
}
|
|
5874
|
+
/**
|
|
5875
|
+
* Checks for validity without any native error popup message
|
|
5876
|
+
*/
|
|
5877
|
+
checkValidity() {
|
|
5878
|
+
return this._mixinCheckValidity();
|
|
5879
|
+
}
|
|
5880
|
+
/**
|
|
5881
|
+
* Returns the ValidityState object
|
|
5882
|
+
*/
|
|
5883
|
+
get validity() {
|
|
5884
|
+
return this._mixinGetValidity();
|
|
5885
|
+
}
|
|
5886
|
+
/**
|
|
5887
|
+
* Returns the validation message based on the ValidityState
|
|
5888
|
+
*/
|
|
5889
|
+
get validationMessage() {
|
|
5890
|
+
return this._mixinGetValidationMessage();
|
|
5891
|
+
}
|
|
5892
|
+
/**
|
|
5893
|
+
* Returns files selected for upload
|
|
5894
|
+
*/
|
|
5895
|
+
get files() {
|
|
5896
|
+
return this.selectedFiles;
|
|
5897
|
+
}
|
|
5617
5898
|
_setFileList(files) {
|
|
5618
|
-
this.files
|
|
5619
|
-
this.emit("sgds-files-selected");
|
|
5620
|
-
//Possible to pass in the files
|
|
5899
|
+
this.emit("sgds-files-selected", { detail: files });
|
|
5621
5900
|
}
|
|
5622
|
-
|
|
5623
|
-
handleClick(event) {
|
|
5901
|
+
_handleClick(event) {
|
|
5624
5902
|
event.preventDefault();
|
|
5625
5903
|
if (!this.disabled) {
|
|
5626
5904
|
// Get a reference to the input element using the inputRef
|
|
@@ -5629,8 +5907,7 @@
|
|
|
5629
5907
|
inputElement.click();
|
|
5630
5908
|
}
|
|
5631
5909
|
}
|
|
5632
|
-
|
|
5633
|
-
handleInputChange(event) {
|
|
5910
|
+
_handleChange(event) {
|
|
5634
5911
|
const inputElement = event.target;
|
|
5635
5912
|
const files = inputElement.files;
|
|
5636
5913
|
if (files.length > 0) {
|
|
@@ -5639,6 +5916,7 @@
|
|
|
5639
5916
|
// Trigger a re-render of the component to update the list of selected files
|
|
5640
5917
|
this._setFileList(files);
|
|
5641
5918
|
this.requestUpdate();
|
|
5919
|
+
super._mixinHandleChange(event);
|
|
5642
5920
|
}
|
|
5643
5921
|
_removeFileHandler(index) {
|
|
5644
5922
|
const inputElement = this.inputRef.value;
|
|
@@ -5655,19 +5933,56 @@
|
|
|
5655
5933
|
this.selectedFiles = Array.from(fileBuffer.files);
|
|
5656
5934
|
// Trigger a re-render of the component to update the list of selected files
|
|
5657
5935
|
this.requestUpdate();
|
|
5936
|
+
this._mixinValidate(this.input);
|
|
5937
|
+
}
|
|
5938
|
+
_clearAllFiles() {
|
|
5939
|
+
const inputElement = this.inputRef.value;
|
|
5940
|
+
const fileBuffer = new DataTransfer();
|
|
5941
|
+
inputElement.files = fileBuffer.files;
|
|
5942
|
+
this._setFileList(fileBuffer.files);
|
|
5943
|
+
this.selectedFiles = Array.from(fileBuffer.files);
|
|
5944
|
+
}
|
|
5945
|
+
/**
|
|
5946
|
+
* fileupload requries a custom _mixinResetFormControl for clearing files
|
|
5947
|
+
*/
|
|
5948
|
+
_mixinResetFormControl() {
|
|
5949
|
+
this._clearAllFiles();
|
|
5950
|
+
this._mixinResetValidity(this.input);
|
|
5951
|
+
}
|
|
5952
|
+
_handleDisabledChange() {
|
|
5953
|
+
// Disabled form controls are always valid, so we need to recheck validity when the state changes
|
|
5954
|
+
this.setInvalid(false);
|
|
5955
|
+
}
|
|
5956
|
+
_renderLabel() {
|
|
5957
|
+
const labelTemplate = html$1 `
|
|
5958
|
+
<label for=${this._controlId} id=${this._labelId} class="form-label"> ${this.label} </label>
|
|
5959
|
+
`;
|
|
5960
|
+
return this.label && labelTemplate;
|
|
5658
5961
|
}
|
|
5659
5962
|
_renderHintText() {
|
|
5660
|
-
const hintTextTemplate = html$1 ` <
|
|
5963
|
+
const hintTextTemplate = html$1 ` <div id="${this._controlId}Help" class="form-text">${this.hintText}</div> `;
|
|
5661
5964
|
return this.hintText && hintTextTemplate;
|
|
5662
5965
|
}
|
|
5663
|
-
|
|
5664
|
-
return
|
|
5966
|
+
_renderFeedback() {
|
|
5967
|
+
return html$1 `
|
|
5968
|
+
<div class="invalid-feedback-container">
|
|
5969
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
5970
|
+
<path
|
|
5971
|
+
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"
|
|
5972
|
+
fill="#B90000"
|
|
5973
|
+
/>
|
|
5974
|
+
</svg>
|
|
5975
|
+
<div id="${this._controlId}-invalid" class="invalid-feedback">
|
|
5976
|
+
${this.invalidFeedback ? this.invalidFeedback : this.input.validationMessage}
|
|
5977
|
+
</div>
|
|
5978
|
+
</div>
|
|
5979
|
+
`;
|
|
5665
5980
|
}
|
|
5666
5981
|
render() {
|
|
5667
|
-
const getCheckedIcon = (
|
|
5668
|
-
if (checkedIcon) {
|
|
5669
|
-
|
|
5670
|
-
}
|
|
5982
|
+
const getCheckedIcon = () => {
|
|
5983
|
+
// if (checkedIcon) {
|
|
5984
|
+
// return html`${unsafeSVG(checkedIcon)}`;
|
|
5985
|
+
// }
|
|
5671
5986
|
return html$1 ` <svg
|
|
5672
5987
|
xmlns="http://www.w3.org/2000/svg"
|
|
5673
5988
|
width="16"
|
|
@@ -5679,67 +5994,62 @@
|
|
|
5679
5994
|
<path
|
|
5680
5995
|
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"
|
|
5681
5996
|
/>
|
|
5682
|
-
</svg>`;
|
|
5683
|
-
};
|
|
5684
|
-
const getCancelIcon = (cancelIcon) => {
|
|
5685
|
-
if (cancelIcon) {
|
|
5686
|
-
return html$1 `${unsafeSVG(cancelIcon)}`;
|
|
5687
|
-
}
|
|
5688
|
-
return html$1 `<svg
|
|
5689
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
5690
|
-
width="16"
|
|
5691
|
-
height="16"
|
|
5692
|
-
fill="currentColor"
|
|
5693
|
-
class="bi bi-x-circle"
|
|
5694
|
-
viewBox="0 0 16 16"
|
|
5695
|
-
>
|
|
5696
|
-
<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" />
|
|
5697
|
-
<path
|
|
5698
|
-
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"
|
|
5699
|
-
/>
|
|
5700
5997
|
</svg>`;
|
|
5701
5998
|
};
|
|
5702
5999
|
const listItems = this.selectedFiles.map((file, index) => html$1 `
|
|
5703
|
-
<li key=${index} class="
|
|
5704
|
-
<span>${getCheckedIcon(
|
|
6000
|
+
<li key=${index} class="file-upload-list-item">
|
|
6001
|
+
<span>${getCheckedIcon()}</span>
|
|
5705
6002
|
<span class="filename">${file.name}</span>
|
|
5706
|
-
<
|
|
6003
|
+
<sgds-close-button
|
|
6004
|
+
aria-label="remove the file"
|
|
6005
|
+
@click=${() => this._removeFileHandler(index)}
|
|
6006
|
+
></sgds-close-button>
|
|
5707
6007
|
</li>
|
|
5708
6008
|
`);
|
|
5709
6009
|
return html$1 `
|
|
5710
|
-
<
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
<sgds-button
|
|
5720
|
-
size=${this.size}
|
|
5721
|
-
variant=${this._sanitizeVariant(this.variant)}
|
|
5722
|
-
?outlined=${this.variant.includes("outline")}
|
|
6010
|
+
<div class="file-upload">
|
|
6011
|
+
<input
|
|
6012
|
+
${ref(this.inputRef)}
|
|
6013
|
+
type="file"
|
|
6014
|
+
@change=${this._handleChange}
|
|
6015
|
+
?multiple=${this.multiple}
|
|
6016
|
+
accept=${this.accept}
|
|
6017
|
+
id=${this._controlId}
|
|
6018
|
+
?required=${this.required}
|
|
5723
6019
|
?disabled=${this.disabled}
|
|
5724
|
-
|
|
5725
|
-
>
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
6020
|
+
/>
|
|
6021
|
+
<div class="file-upload-container">
|
|
6022
|
+
${this._renderLabel()}
|
|
6023
|
+
<sgds-button variant="outline" ?disabled=${this.disabled} @click=${this._handleClick}>
|
|
6024
|
+
<label for=${this._controlId}><slot></slot></label>
|
|
6025
|
+
<svg
|
|
6026
|
+
slot="rightIcon"
|
|
6027
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
6028
|
+
width="24"
|
|
6029
|
+
height="24"
|
|
6030
|
+
viewBox="0 0 24 24"
|
|
6031
|
+
fill="none"
|
|
6032
|
+
>
|
|
6033
|
+
<path
|
|
6034
|
+
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"
|
|
6035
|
+
fill="currentColor"
|
|
6036
|
+
/>
|
|
6037
|
+
<path
|
|
6038
|
+
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"
|
|
6039
|
+
fill="currentColor"
|
|
6040
|
+
/>
|
|
6041
|
+
</svg>
|
|
6042
|
+
</sgds-button>
|
|
6043
|
+
${this.hasFeedback && this.invalid ? this._renderFeedback() : this._renderHintText()}
|
|
6044
|
+
</div>
|
|
6045
|
+
<ul class="file-upload-list">
|
|
5730
6046
|
${listItems}
|
|
5731
6047
|
</ul>
|
|
5732
6048
|
</div>
|
|
5733
6049
|
`;
|
|
5734
6050
|
}
|
|
5735
6051
|
}
|
|
5736
|
-
SgdsFileUpload.styles = [...
|
|
5737
|
-
__decorate([
|
|
5738
|
-
property({ reflect: true })
|
|
5739
|
-
], SgdsFileUpload.prototype, "variant", void 0);
|
|
5740
|
-
__decorate([
|
|
5741
|
-
property({ type: Boolean, reflect: true })
|
|
5742
|
-
], SgdsFileUpload.prototype, "disabled", void 0);
|
|
6052
|
+
SgdsFileUpload.styles = [...FormControlElement.styles, css_248z$4];
|
|
5743
6053
|
__decorate([
|
|
5744
6054
|
property({ type: Boolean, reflect: true })
|
|
5745
6055
|
], SgdsFileUpload.prototype, "multiple", void 0);
|
|
@@ -5747,23 +6057,20 @@
|
|
|
5747
6057
|
property({ type: String, reflect: true })
|
|
5748
6058
|
], SgdsFileUpload.prototype, "accept", void 0);
|
|
5749
6059
|
__decorate([
|
|
5750
|
-
property({ reflect: true })
|
|
5751
|
-
], SgdsFileUpload.prototype, "
|
|
5752
|
-
__decorate([
|
|
5753
|
-
property({ type: String })
|
|
5754
|
-
], SgdsFileUpload.prototype, "checkedIcon", void 0);
|
|
5755
|
-
__decorate([
|
|
5756
|
-
property({ type: String })
|
|
5757
|
-
], SgdsFileUpload.prototype, "cancelIcon", void 0);
|
|
6060
|
+
property({ type: Boolean, reflect: true })
|
|
6061
|
+
], SgdsFileUpload.prototype, "hasFeedback", void 0);
|
|
5758
6062
|
__decorate([
|
|
5759
|
-
property({ reflect: true })
|
|
5760
|
-
], SgdsFileUpload.prototype, "
|
|
6063
|
+
property({ type: String, reflect: true })
|
|
6064
|
+
], SgdsFileUpload.prototype, "invalidFeedback", void 0);
|
|
5761
6065
|
__decorate([
|
|
5762
|
-
property({ type:
|
|
5763
|
-
], SgdsFileUpload.prototype, "
|
|
6066
|
+
property({ type: Boolean, reflect: true })
|
|
6067
|
+
], SgdsFileUpload.prototype, "required", void 0);
|
|
5764
6068
|
__decorate([
|
|
5765
|
-
|
|
6069
|
+
state()
|
|
5766
6070
|
], SgdsFileUpload.prototype, "selectedFiles", void 0);
|
|
6071
|
+
__decorate([
|
|
6072
|
+
watch("disabled", { waitUntilFirstUpdate: true })
|
|
6073
|
+
], SgdsFileUpload.prototype, "_handleDisabledChange", null);
|
|
5767
6074
|
|
|
5768
6075
|
customElements.define("sgds-file-upload", SgdsFileUpload);
|
|
5769
6076
|
|