@govtechsg/sgds-web-component 3.0.0-rc.0 → 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/Masthead/index.js +1 -1
- 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 +9 -10
- package/components/Badge/index.umd.js.map +1 -1
- package/components/Badge/sgds-badge.d.ts +4 -5
- package/components/Badge/sgds-badge.js +6 -7
- 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/Masthead/index.umd.js +1 -1
- package/components/Masthead/masthead.js +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 +2 -1
- 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/Stepper/stepper.js +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 +1320 -1126
- package/components/index.umd.js.map +1 -1
- package/css/reboot.css +39 -6
- package/css/sgds.css +0 -2
- 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 +1340 -1121
- 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 +6 -7
- package/react/components/Badge/sgds-badge.cjs.js.map +1 -1
- package/react/components/Badge/sgds-badge.js +6 -7
- 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/Masthead/masthead.cjs.js +1 -1
- package/react/components/Masthead/masthead.js +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/Stepper/stepper.cjs.js +1 -1
- package/react/components/Stepper/stepper.js +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 +2 -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/css/body.css +0 -28
- package/css/caption.css +0 -7
- package/css/label.css +0 -28
- 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
|
@@ -1,54 +1,66 @@
|
|
|
1
|
-
import
|
|
1
|
+
import SgdsCloseButton from "../../internals/CloseButton/sgds-close-button";
|
|
2
2
|
import { SgdsButton } from "../Button/sgds-button";
|
|
3
|
-
|
|
4
|
-
declare const SgdsFileUpload_base: typeof
|
|
3
|
+
import FormControlElement from "../../base/form-control-element";
|
|
4
|
+
declare const SgdsFileUpload_base: (new (...args: any[]) => import("../../utils/validatorMixin").ToBeValidatedElementInterface) & typeof FormControlElement & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
|
|
5
5
|
/**
|
|
6
6
|
* @summary Allows users to upload files of various sizes and formats
|
|
7
7
|
* @slot default - Label for file upload button
|
|
8
8
|
*
|
|
9
|
-
* @event sgds-files-selected - Emitted when files are selected for uploading
|
|
10
|
-
*
|
|
11
|
-
* @cssproperty --file-upload-file-icon-color - Left icon color
|
|
12
|
-
* @cssproperty --file-upload-remove-icon-color - Remove icon color
|
|
13
|
-
* @cssproperty --file-upload-remove-icon-hover-color - Remove icon hover color
|
|
9
|
+
* @event sgds-files-selected - Emitted when files are selected for uploading. Access the selected files with event.target.detail
|
|
14
10
|
*/
|
|
15
11
|
export declare class SgdsFileUpload extends SgdsFileUpload_base {
|
|
16
12
|
static styles: import("lit").CSSResult[];
|
|
17
13
|
/**@internal */
|
|
18
14
|
static get scopedElements(): {
|
|
19
15
|
"sgds-button": typeof SgdsButton;
|
|
16
|
+
"sgds-close-button": typeof SgdsCloseButton;
|
|
20
17
|
};
|
|
21
|
-
/** The button's variant. */
|
|
22
|
-
variant: FileUploadButtonVariant;
|
|
23
|
-
disabled: boolean;
|
|
24
18
|
/** Allows multiple files to be listed for uploading */
|
|
25
19
|
multiple: boolean;
|
|
26
20
|
/** Specify the acceptable file type */
|
|
27
21
|
accept: string;
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
/** The input's hint text below the label */
|
|
35
|
-
hintText: string;
|
|
36
|
-
/** @internal */
|
|
37
|
-
private files;
|
|
38
|
-
/** @internal */
|
|
22
|
+
/** Allows invalidFeedback, invalid and valid styles to be visible with the input */
|
|
23
|
+
hasFeedback: boolean;
|
|
24
|
+
/**Feedback text for error state when validated */
|
|
25
|
+
invalidFeedback: string;
|
|
26
|
+
/** Makes the input as a required field. */
|
|
27
|
+
required: boolean;
|
|
39
28
|
private selectedFiles;
|
|
29
|
+
/**
|
|
30
|
+
* Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
|
|
31
|
+
* 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
|
|
32
|
+
*/
|
|
33
|
+
reportValidity(): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Checks for validity without any native error popup message
|
|
36
|
+
*/
|
|
37
|
+
checkValidity(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Returns the ValidityState object
|
|
40
|
+
*/
|
|
41
|
+
get validity(): ValidityState;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the validation message based on the ValidityState
|
|
44
|
+
*/
|
|
45
|
+
get validationMessage(): string;
|
|
46
|
+
/**
|
|
47
|
+
* Returns files selected for upload
|
|
48
|
+
*/
|
|
49
|
+
get files(): File[];
|
|
40
50
|
private _setFileList;
|
|
41
|
-
/** @internal */
|
|
42
51
|
private inputRef;
|
|
43
|
-
|
|
44
|
-
private
|
|
45
|
-
/** @internal */
|
|
46
|
-
private handleInputChange;
|
|
52
|
+
private _handleClick;
|
|
53
|
+
private _handleChange;
|
|
47
54
|
private _removeFileHandler;
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
private _clearAllFiles;
|
|
56
|
+
/**
|
|
57
|
+
* fileupload requries a custom _mixinResetFormControl for clearing files
|
|
58
|
+
*/
|
|
59
|
+
private _mixinResetFormControl;
|
|
60
|
+
_handleDisabledChange(): void;
|
|
61
|
+
protected _renderLabel(): import("lit-html").TemplateResult<1>;
|
|
50
62
|
protected _renderHintText(): import("lit-html").TemplateResult<1>;
|
|
51
|
-
|
|
63
|
+
protected _renderFeedback(): import("lit-html").TemplateResult<1>;
|
|
52
64
|
render(): import("lit-html").TemplateResult<1>;
|
|
53
65
|
}
|
|
54
66
|
export default SgdsFileUpload;
|
|
@@ -1,64 +1,79 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
2
|
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
|
|
3
3
|
import { html } from 'lit';
|
|
4
|
-
import { property } from 'lit/decorators.js';
|
|
4
|
+
import { property, state } from 'lit/decorators.js';
|
|
5
5
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
6
|
-
import {
|
|
7
|
-
import SgdsElement from '../../base/sgds-element.js';
|
|
6
|
+
import { SgdsCloseButton } from '../../internals/CloseButton/sgds-close-button.js';
|
|
8
7
|
import { SgdsButton } from '../Button/sgds-button.js';
|
|
9
|
-
import css_248z
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
8
|
+
import css_248z from './file-upload.js';
|
|
9
|
+
import FormControlElement from '../../base/form-control-element.js';
|
|
10
|
+
import { SgdsFormValidatorMixin } from '../../utils/validatorMixin.js';
|
|
11
|
+
import { watch } from '../../utils/watch.js';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* @summary Allows users to upload files of various sizes and formats
|
|
16
15
|
* @slot default - Label for file upload button
|
|
17
16
|
*
|
|
18
|
-
* @event sgds-files-selected - Emitted when files are selected for uploading
|
|
19
|
-
*
|
|
20
|
-
* @cssproperty --file-upload-file-icon-color - Left icon color
|
|
21
|
-
* @cssproperty --file-upload-remove-icon-color - Remove icon color
|
|
22
|
-
* @cssproperty --file-upload-remove-icon-hover-color - Remove icon hover color
|
|
17
|
+
* @event sgds-files-selected - Emitted when files are selected for uploading. Access the selected files with event.target.detail
|
|
23
18
|
*/
|
|
24
|
-
class SgdsFileUpload extends ScopedElementsMixin(
|
|
19
|
+
class SgdsFileUpload extends SgdsFormValidatorMixin(ScopedElementsMixin(FormControlElement)) {
|
|
25
20
|
constructor() {
|
|
26
21
|
super(...arguments);
|
|
27
|
-
/** The button's variant. */
|
|
28
|
-
this.variant = "primary";
|
|
29
|
-
//** Disable the fileuploader button */
|
|
30
|
-
this.disabled = false;
|
|
31
22
|
/** Allows multiple files to be listed for uploading */
|
|
32
23
|
this.multiple = false;
|
|
33
24
|
/** Specify the acceptable file type */
|
|
34
25
|
this.accept = "";
|
|
35
|
-
/** Customize the check icon with SVG */
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
this.
|
|
39
|
-
/**
|
|
40
|
-
this.
|
|
41
|
-
/** @internal */
|
|
26
|
+
// /** Customize the check icon with SVG */
|
|
27
|
+
// @property({ type: String }) checkedIcon = "";
|
|
28
|
+
/** Allows invalidFeedback, invalid and valid styles to be visible with the input */
|
|
29
|
+
this.hasFeedback = false;
|
|
30
|
+
/** Makes the input as a required field. */
|
|
31
|
+
this.required = false;
|
|
42
32
|
this.selectedFiles = [];
|
|
43
|
-
// Create a ref to the input element
|
|
44
|
-
/** @internal */
|
|
45
33
|
this.inputRef = createRef();
|
|
46
|
-
/**@internal */
|
|
47
|
-
this.inputId = genId("input", "file");
|
|
48
34
|
}
|
|
49
35
|
/**@internal */
|
|
50
36
|
static get scopedElements() {
|
|
51
37
|
return {
|
|
52
|
-
"sgds-button": SgdsButton
|
|
38
|
+
"sgds-button": SgdsButton,
|
|
39
|
+
"sgds-close-button": SgdsCloseButton
|
|
53
40
|
};
|
|
54
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
|
|
44
|
+
* 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
|
|
45
|
+
*/
|
|
46
|
+
reportValidity() {
|
|
47
|
+
return this._mixinReportValidity();
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Checks for validity without any native error popup message
|
|
51
|
+
*/
|
|
52
|
+
checkValidity() {
|
|
53
|
+
return this._mixinCheckValidity();
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Returns the ValidityState object
|
|
57
|
+
*/
|
|
58
|
+
get validity() {
|
|
59
|
+
return this._mixinGetValidity();
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Returns the validation message based on the ValidityState
|
|
63
|
+
*/
|
|
64
|
+
get validationMessage() {
|
|
65
|
+
return this._mixinGetValidationMessage();
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Returns files selected for upload
|
|
69
|
+
*/
|
|
70
|
+
get files() {
|
|
71
|
+
return this.selectedFiles;
|
|
72
|
+
}
|
|
55
73
|
_setFileList(files) {
|
|
56
|
-
this.files
|
|
57
|
-
this.emit("sgds-files-selected");
|
|
58
|
-
//Possible to pass in the files
|
|
74
|
+
this.emit("sgds-files-selected", { detail: files });
|
|
59
75
|
}
|
|
60
|
-
|
|
61
|
-
handleClick(event) {
|
|
76
|
+
_handleClick(event) {
|
|
62
77
|
event.preventDefault();
|
|
63
78
|
if (!this.disabled) {
|
|
64
79
|
// Get a reference to the input element using the inputRef
|
|
@@ -67,8 +82,7 @@ class SgdsFileUpload extends ScopedElementsMixin(SgdsElement) {
|
|
|
67
82
|
inputElement.click();
|
|
68
83
|
}
|
|
69
84
|
}
|
|
70
|
-
|
|
71
|
-
handleInputChange(event) {
|
|
85
|
+
_handleChange(event) {
|
|
72
86
|
const inputElement = event.target;
|
|
73
87
|
const files = inputElement.files;
|
|
74
88
|
if (files.length > 0) {
|
|
@@ -77,6 +91,7 @@ class SgdsFileUpload extends ScopedElementsMixin(SgdsElement) {
|
|
|
77
91
|
// Trigger a re-render of the component to update the list of selected files
|
|
78
92
|
this._setFileList(files);
|
|
79
93
|
this.requestUpdate();
|
|
94
|
+
super._mixinHandleChange(event);
|
|
80
95
|
}
|
|
81
96
|
_removeFileHandler(index) {
|
|
82
97
|
const inputElement = this.inputRef.value;
|
|
@@ -93,19 +108,56 @@ class SgdsFileUpload extends ScopedElementsMixin(SgdsElement) {
|
|
|
93
108
|
this.selectedFiles = Array.from(fileBuffer.files);
|
|
94
109
|
// Trigger a re-render of the component to update the list of selected files
|
|
95
110
|
this.requestUpdate();
|
|
111
|
+
this._mixinValidate(this.input);
|
|
112
|
+
}
|
|
113
|
+
_clearAllFiles() {
|
|
114
|
+
const inputElement = this.inputRef.value;
|
|
115
|
+
const fileBuffer = new DataTransfer();
|
|
116
|
+
inputElement.files = fileBuffer.files;
|
|
117
|
+
this._setFileList(fileBuffer.files);
|
|
118
|
+
this.selectedFiles = Array.from(fileBuffer.files);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* fileupload requries a custom _mixinResetFormControl for clearing files
|
|
122
|
+
*/
|
|
123
|
+
_mixinResetFormControl() {
|
|
124
|
+
this._clearAllFiles();
|
|
125
|
+
this._mixinResetValidity(this.input);
|
|
126
|
+
}
|
|
127
|
+
_handleDisabledChange() {
|
|
128
|
+
// Disabled form controls are always valid, so we need to recheck validity when the state changes
|
|
129
|
+
this.setInvalid(false);
|
|
130
|
+
}
|
|
131
|
+
_renderLabel() {
|
|
132
|
+
const labelTemplate = html `
|
|
133
|
+
<label for=${this._controlId} id=${this._labelId} class="form-label"> ${this.label} </label>
|
|
134
|
+
`;
|
|
135
|
+
return this.label && labelTemplate;
|
|
96
136
|
}
|
|
97
137
|
_renderHintText() {
|
|
98
|
-
const hintTextTemplate = html ` <
|
|
138
|
+
const hintTextTemplate = html ` <div id="${this._controlId}Help" class="form-text">${this.hintText}</div> `;
|
|
99
139
|
return this.hintText && hintTextTemplate;
|
|
100
140
|
}
|
|
101
|
-
|
|
102
|
-
return
|
|
141
|
+
_renderFeedback() {
|
|
142
|
+
return html `
|
|
143
|
+
<div class="invalid-feedback-container">
|
|
144
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
145
|
+
<path
|
|
146
|
+
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"
|
|
147
|
+
fill="#B90000"
|
|
148
|
+
/>
|
|
149
|
+
</svg>
|
|
150
|
+
<div id="${this._controlId}-invalid" class="invalid-feedback">
|
|
151
|
+
${this.invalidFeedback ? this.invalidFeedback : this.input.validationMessage}
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
`;
|
|
103
155
|
}
|
|
104
156
|
render() {
|
|
105
|
-
const getCheckedIcon = (
|
|
106
|
-
if (checkedIcon) {
|
|
107
|
-
|
|
108
|
-
}
|
|
157
|
+
const getCheckedIcon = () => {
|
|
158
|
+
// if (checkedIcon) {
|
|
159
|
+
// return html`${unsafeSVG(checkedIcon)}`;
|
|
160
|
+
// }
|
|
109
161
|
return html ` <svg
|
|
110
162
|
xmlns="http://www.w3.org/2000/svg"
|
|
111
163
|
width="16"
|
|
@@ -117,67 +169,62 @@ class SgdsFileUpload extends ScopedElementsMixin(SgdsElement) {
|
|
|
117
169
|
<path
|
|
118
170
|
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"
|
|
119
171
|
/>
|
|
120
|
-
</svg>`;
|
|
121
|
-
};
|
|
122
|
-
const getCancelIcon = (cancelIcon) => {
|
|
123
|
-
if (cancelIcon) {
|
|
124
|
-
return html `${unsafeSVG(cancelIcon)}`;
|
|
125
|
-
}
|
|
126
|
-
return html `<svg
|
|
127
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
128
|
-
width="16"
|
|
129
|
-
height="16"
|
|
130
|
-
fill="currentColor"
|
|
131
|
-
class="bi bi-x-circle"
|
|
132
|
-
viewBox="0 0 16 16"
|
|
133
|
-
>
|
|
134
|
-
<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" />
|
|
135
|
-
<path
|
|
136
|
-
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"
|
|
137
|
-
/>
|
|
138
172
|
</svg>`;
|
|
139
173
|
};
|
|
140
174
|
const listItems = this.selectedFiles.map((file, index) => html `
|
|
141
|
-
<li key=${index} class="
|
|
142
|
-
<span>${getCheckedIcon(
|
|
175
|
+
<li key=${index} class="file-upload-list-item">
|
|
176
|
+
<span>${getCheckedIcon()}</span>
|
|
143
177
|
<span class="filename">${file.name}</span>
|
|
144
|
-
<
|
|
178
|
+
<sgds-close-button
|
|
179
|
+
aria-label="remove the file"
|
|
180
|
+
@click=${() => this._removeFileHandler(index)}
|
|
181
|
+
></sgds-close-button>
|
|
145
182
|
</li>
|
|
146
183
|
`);
|
|
147
184
|
return html `
|
|
148
|
-
<
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
<sgds-button
|
|
158
|
-
size=${this.size}
|
|
159
|
-
variant=${this._sanitizeVariant(this.variant)}
|
|
160
|
-
?outlined=${this.variant.includes("outline")}
|
|
185
|
+
<div class="file-upload">
|
|
186
|
+
<input
|
|
187
|
+
${ref(this.inputRef)}
|
|
188
|
+
type="file"
|
|
189
|
+
@change=${this._handleChange}
|
|
190
|
+
?multiple=${this.multiple}
|
|
191
|
+
accept=${this.accept}
|
|
192
|
+
id=${this._controlId}
|
|
193
|
+
?required=${this.required}
|
|
161
194
|
?disabled=${this.disabled}
|
|
162
|
-
|
|
163
|
-
>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
195
|
+
/>
|
|
196
|
+
<div class="file-upload-container">
|
|
197
|
+
${this._renderLabel()}
|
|
198
|
+
<sgds-button variant="outline" ?disabled=${this.disabled} @click=${this._handleClick}>
|
|
199
|
+
<label for=${this._controlId}><slot></slot></label>
|
|
200
|
+
<svg
|
|
201
|
+
slot="rightIcon"
|
|
202
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
203
|
+
width="24"
|
|
204
|
+
height="24"
|
|
205
|
+
viewBox="0 0 24 24"
|
|
206
|
+
fill="none"
|
|
207
|
+
>
|
|
208
|
+
<path
|
|
209
|
+
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"
|
|
210
|
+
fill="currentColor"
|
|
211
|
+
/>
|
|
212
|
+
<path
|
|
213
|
+
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"
|
|
214
|
+
fill="currentColor"
|
|
215
|
+
/>
|
|
216
|
+
</svg>
|
|
217
|
+
</sgds-button>
|
|
218
|
+
${this.hasFeedback && this.invalid ? this._renderFeedback() : this._renderHintText()}
|
|
219
|
+
</div>
|
|
220
|
+
<ul class="file-upload-list">
|
|
168
221
|
${listItems}
|
|
169
222
|
</ul>
|
|
170
223
|
</div>
|
|
171
224
|
`;
|
|
172
225
|
}
|
|
173
226
|
}
|
|
174
|
-
SgdsFileUpload.styles = [...
|
|
175
|
-
__decorate([
|
|
176
|
-
property({ reflect: true })
|
|
177
|
-
], SgdsFileUpload.prototype, "variant", void 0);
|
|
178
|
-
__decorate([
|
|
179
|
-
property({ type: Boolean, reflect: true })
|
|
180
|
-
], SgdsFileUpload.prototype, "disabled", void 0);
|
|
227
|
+
SgdsFileUpload.styles = [...FormControlElement.styles, css_248z];
|
|
181
228
|
__decorate([
|
|
182
229
|
property({ type: Boolean, reflect: true })
|
|
183
230
|
], SgdsFileUpload.prototype, "multiple", void 0);
|
|
@@ -185,23 +232,20 @@ __decorate([
|
|
|
185
232
|
property({ type: String, reflect: true })
|
|
186
233
|
], SgdsFileUpload.prototype, "accept", void 0);
|
|
187
234
|
__decorate([
|
|
188
|
-
property({ reflect: true })
|
|
189
|
-
], SgdsFileUpload.prototype, "
|
|
190
|
-
__decorate([
|
|
191
|
-
property({ type: String })
|
|
192
|
-
], SgdsFileUpload.prototype, "checkedIcon", void 0);
|
|
193
|
-
__decorate([
|
|
194
|
-
property({ type: String })
|
|
195
|
-
], SgdsFileUpload.prototype, "cancelIcon", void 0);
|
|
235
|
+
property({ type: Boolean, reflect: true })
|
|
236
|
+
], SgdsFileUpload.prototype, "hasFeedback", void 0);
|
|
196
237
|
__decorate([
|
|
197
|
-
property({ reflect: true })
|
|
198
|
-
], SgdsFileUpload.prototype, "
|
|
238
|
+
property({ type: String, reflect: true })
|
|
239
|
+
], SgdsFileUpload.prototype, "invalidFeedback", void 0);
|
|
199
240
|
__decorate([
|
|
200
|
-
property({ type:
|
|
201
|
-
], SgdsFileUpload.prototype, "
|
|
241
|
+
property({ type: Boolean, reflect: true })
|
|
242
|
+
], SgdsFileUpload.prototype, "required", void 0);
|
|
202
243
|
__decorate([
|
|
203
|
-
|
|
244
|
+
state()
|
|
204
245
|
], SgdsFileUpload.prototype, "selectedFiles", void 0);
|
|
246
|
+
__decorate([
|
|
247
|
+
watch("disabled", { waitUntilFirstUpdate: true })
|
|
248
|
+
], SgdsFileUpload.prototype, "_handleDisabledChange", null);
|
|
205
249
|
|
|
206
250
|
export { SgdsFileUpload, SgdsFileUpload as default };
|
|
207
251
|
//# sourceMappingURL=sgds-file-upload.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sgds-file-upload.js","sources":["../../../src/components/FileUpload/sgds-file-upload.ts"],"sourcesContent":["import { ScopedElementsMixin } from \"@open-wc/scoped-elements\";\nimport { html } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { createRef, ref } from \"lit/directives/ref.js\";\nimport { unsafeSVG } from \"lit/directives/unsafe-svg.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { SgdsButton, type ButtonVariant } from \"../Button/sgds-button\";\nimport fileUploadStyle from \"./file-upload.css\";\nimport genId from \"../../utils/generateId\";\nimport svgStyles from \"../../styles/svg.css\";\nimport formHintStyles from \"../../styles/form-hint.css\";\nexport type FileUploadButtonVariant =\n | \"primary\"\n | \"secondary\"\n | \"success\"\n | \"danger\"\n | \"warning\"\n | \"info\"\n | \"light\"\n | \"dark\"\n | \"link\"\n | \"outline-primary\"\n | \"outline-secondary\"\n | \"outline-success\"\n | \"outline-danger\"\n | \"outline-warning\"\n | \"outline-info\"\n | \"outline-light\"\n | \"outline-dark\";\n\n/**\n * @summary Allows users to upload files of various sizes and formats\n * @slot default - Label for file upload button\n *\n * @event sgds-files-selected - Emitted when files are selected for uploading\n *\n * @cssproperty --file-upload-file-icon-color - Left icon color\n * @cssproperty --file-upload-remove-icon-color - Remove icon color\n * @cssproperty --file-upload-remove-icon-hover-color - Remove icon hover color\n */\n\nexport class SgdsFileUpload extends ScopedElementsMixin(SgdsElement) {\n static styles = [...SgdsElement.styles, svgStyles, formHintStyles, fileUploadStyle];\n /**@internal */\n static get scopedElements() {\n return {\n \"sgds-button\": SgdsButton\n };\n }\n /** The button's variant. */\n @property({ reflect: true }) variant: FileUploadButtonVariant = \"primary\";\n\n //** Disable the fileuploader button */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /** Allows multiple files to be listed for uploading */\n @property({ type: Boolean, reflect: true })\n multiple = false;\n\n /** Specify the acceptable file type */\n @property({ type: String, reflect: true })\n accept = \"\";\n\n /** Specifies a large or small button */\n @property({ reflect: true }) size: \"sm\" | \"lg\";\n\n /** Customize the check icon with SVG */\n @property({ type: String })\n checkedIcon = \"\";\n\n /** Customize the cancel icon with SVG */\n @property({ type: String })\n cancelIcon = \"\";\n\n /** The input's hint text below the label */\n @property({ reflect: true }) hintText = \"\";\n\n /** @internal */\n @property({ type: Object, state: true })\n private files: FileList | undefined;\n\n /** @internal */\n @property({ type: Array })\n private selectedFiles: File[] = [];\n\n private _setFileList(files: FileList) {\n this.files = files;\n this.emit(\"sgds-files-selected\");\n //Possible to pass in the files\n }\n\n // Create a ref to the input element\n /** @internal */\n private inputRef = createRef<HTMLInputElement>();\n\n /** @internal */\n private handleClick(event: Event) {\n event.preventDefault();\n if (!this.disabled) {\n // Get a reference to the input element using the inputRef\n const inputElement = this.inputRef.value;\n // Do something with the input element\n inputElement.click();\n }\n }\n\n /** @internal */\n private handleInputChange(event: Event) {\n const inputElement = event.target as HTMLInputElement;\n const files = inputElement.files as FileList;\n\n if (files.length > 0) {\n this.selectedFiles = Array.from(files);\n }\n // Trigger a re-render of the component to update the list of selected files\n this._setFileList(files);\n this.requestUpdate();\n }\n\n private _removeFileHandler(index: number) {\n const inputElement = this.inputRef.value;\n const attachments = inputElement.files;\n\n const fileBuffer = new DataTransfer();\n for (let i = 0; i < attachments.length; i++) {\n if (index !== i) fileBuffer.items.add(attachments[i]);\n }\n\n // Assign buffer to file input\n inputElement.files = fileBuffer.files;\n // Re-populate selected files to the lists\n this._setFileList(fileBuffer.files);\n this.selectedFiles = Array.from(fileBuffer.files);\n\n // Trigger a re-render of the component to update the list of selected files\n this.requestUpdate();\n }\n\n /**@internal */\n protected inputId: string = genId(\"input\", \"file\");\n\n protected _renderHintText() {\n const hintTextTemplate = html` <small id=\"${this.inputId}Help\" class=\"form-text\">${this.hintText}</small> `;\n return this.hintText && hintTextTemplate;\n }\n\n private _sanitizeVariant(variant: FileUploadButtonVariant) {\n return variant.replace(\"outline-\", \"\") as ButtonVariant;\n }\n render() {\n const getCheckedIcon = (checkedIcon: string) => {\n if (checkedIcon) {\n return html`${unsafeSVG(checkedIcon)}`;\n }\n return html` <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n class=\"bi bi-check-lg\"\n viewBox=\"0 0 16 16\"\n >\n <path\n 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\"\n />\n </svg>`;\n };\n\n const getCancelIcon = (cancelIcon: string) => {\n if (cancelIcon) {\n return html`${unsafeSVG(cancelIcon)}`;\n }\n return html`<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n class=\"bi bi-x-circle\"\n viewBox=\"0 0 16 16\"\n >\n <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\" />\n <path\n 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\"\n />\n </svg>`;\n };\n\n const listItems = this.selectedFiles.map(\n (file, index) => html`\n <li key=${index} class=\"fileupload-list-item\">\n <span>${getCheckedIcon(this.checkedIcon)}</span>\n <span class=\"filename\">${file.name}</span>\n <span @click=${() => this._removeFileHandler(index)}>${getCancelIcon(this.cancelIcon)}</span>\n </li>\n `\n );\n\n return html`\n <input\n ${ref(this.inputRef)}\n type=\"file\"\n @change=${this.handleInputChange}\n ?multiple=${this.multiple}\n accept=${this.accept}\n id=${this.inputId}\n />\n <div class=\"fileupload-container\">\n <sgds-button\n size=${this.size}\n variant=${this._sanitizeVariant(this.variant)}\n ?outlined=${this.variant.includes(\"outline\")}\n ?disabled=${this.disabled}\n @click=${this.handleClick}\n >\n <label for=${this.inputId} class=\"file-upload-label\"><slot></slot></label>\n </sgds-button>\n ${this._renderHintText()}\n <ul class=\"sgds fileupload-list\">\n ${listItems}\n </ul>\n </div>\n `;\n }\n}\n\nexport default SgdsFileUpload;\n"],"names":["svgStyles","formHintStyles","fileUploadStyle"],"mappings":";;;;;;;;;;;;;AA8BA;;;;;;;;;AASG;MAEU,cAAe,SAAQ,mBAAmB,CAAC,WAAW,CAAC,CAAA;AAApE,IAAA,WAAA,GAAA;;;QAS+B,IAAO,CAAA,OAAA,GAA4B,SAAS,CAAC;;QAI1E,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;;QAIjB,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;;QAIjB,IAAM,CAAA,MAAA,GAAG,EAAE,CAAC;;QAOZ,IAAW,CAAA,WAAA,GAAG,EAAE,CAAC;;QAIjB,IAAU,CAAA,UAAA,GAAG,EAAE,CAAC;;QAGa,IAAQ,CAAA,QAAA,GAAG,EAAE,CAAC;;QAQnC,IAAa,CAAA,aAAA,GAAW,EAAE,CAAC;;;QAU3B,IAAQ,CAAA,QAAA,GAAG,SAAS,EAAoB,CAAC;;AA8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A,KAAA,CAAA,CAAA,CAAA;AAInC,UAAA,CAAA;IADP,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACJ,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAI5B,UAAA,CAAA;AADP,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACS,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,eAAA,EAAA,KAAA,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"sgds-file-upload.js","sources":["../../../src/components/FileUpload/sgds-file-upload.ts"],"sourcesContent":["import { ScopedElementsMixin } from \"@open-wc/scoped-elements\";\nimport { html } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { createRef, ref } from \"lit/directives/ref.js\";\nimport SgdsCloseButton from \"../../internals/CloseButton/sgds-close-button\";\nimport { SgdsButton } from \"../Button/sgds-button\";\nimport fileUploadStyles from \"./file-upload.css\";\n\nimport FormControlElement from \"../../base/form-control-element\";\nimport { SgdsFormValidatorMixin } from \"../../utils/validatorMixin\";\nimport { watch } from \"../../utils/watch\";\n\n/**\n * @summary Allows users to upload files of various sizes and formats\n * @slot default - Label for file upload button\n *\n * @event sgds-files-selected - Emitted when files are selected for uploading. Access the selected files with event.target.detail\n */\n\nexport class SgdsFileUpload extends SgdsFormValidatorMixin(ScopedElementsMixin(FormControlElement)) {\n static styles = [...FormControlElement.styles, fileUploadStyles];\n /**@internal */\n static get scopedElements() {\n return {\n \"sgds-button\": SgdsButton,\n \"sgds-close-button\": SgdsCloseButton\n };\n }\n\n /** Allows multiple files to be listed for uploading */\n @property({ type: Boolean, reflect: true }) multiple = false;\n\n /** Specify the acceptable file type */\n @property({ type: String, reflect: true }) accept = \"\";\n\n // /** Customize the check icon with SVG */\n // @property({ type: String }) checkedIcon = \"\";\n\n /** Allows invalidFeedback, invalid and valid styles to be visible with the input */\n @property({ type: Boolean, reflect: true }) hasFeedback = false;\n\n /**Feedback text for error state when validated */\n @property({ type: String, reflect: true }) invalidFeedback: string;\n\n /** Makes the input as a required field. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n @state()\n private selectedFiles: File[] = [];\n\n /**\n * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state\n * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput\n */\n public reportValidity(): boolean {\n return this._mixinReportValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public checkValidity(): boolean {\n return this._mixinCheckValidity();\n }\n /**\n * Returns the ValidityState object\n */\n public get validity(): ValidityState {\n return this._mixinGetValidity();\n }\n /**\n * Returns the validation message based on the ValidityState\n */\n public get validationMessage(): string {\n return this._mixinGetValidationMessage();\n }\n /**\n * Returns files selected for upload\n */\n public get files(): File[] {\n return this.selectedFiles;\n }\n\n private _setFileList(files: FileList) {\n this.emit(\"sgds-files-selected\", { detail: files });\n }\n\n private inputRef = createRef<HTMLInputElement>();\n\n private _handleClick(event: Event) {\n event.preventDefault();\n if (!this.disabled) {\n // Get a reference to the input element using the inputRef\n const inputElement = this.inputRef.value;\n // Do something with the input element\n inputElement.click();\n }\n }\n\n private _handleChange(event: Event) {\n const inputElement = event.target as HTMLInputElement;\n const files = inputElement.files as FileList;\n\n if (files.length > 0) {\n this.selectedFiles = Array.from(files);\n }\n // Trigger a re-render of the component to update the list of selected files\n this._setFileList(files);\n this.requestUpdate();\n super._mixinHandleChange(event);\n }\n\n private _removeFileHandler(index: number) {\n const inputElement = this.inputRef.value;\n const attachments = inputElement.files;\n\n const fileBuffer = new DataTransfer();\n for (let i = 0; i < attachments.length; i++) {\n if (index !== i) fileBuffer.items.add(attachments[i]);\n }\n\n // Assign buffer to file input\n inputElement.files = fileBuffer.files;\n // Re-populate selected files to the lists\n this._setFileList(fileBuffer.files);\n this.selectedFiles = Array.from(fileBuffer.files);\n\n // Trigger a re-render of the component to update the list of selected files\n this.requestUpdate();\n this._mixinValidate(this.input);\n }\n\n private _clearAllFiles() {\n const inputElement = this.inputRef.value;\n const fileBuffer = new DataTransfer();\n inputElement.files = fileBuffer.files;\n this._setFileList(fileBuffer.files);\n this.selectedFiles = Array.from(fileBuffer.files);\n }\n\n /**\n * fileupload requries a custom _mixinResetFormControl for clearing files\n */\n private _mixinResetFormControl() {\n this._clearAllFiles();\n this._mixinResetValidity(this.input);\n }\n @watch(\"disabled\", { waitUntilFirstUpdate: true })\n _handleDisabledChange() {\n // Disabled form controls are always valid, so we need to recheck validity when the state changes\n this.setInvalid(false);\n }\n protected _renderLabel() {\n const labelTemplate = html`\n <label for=${this._controlId} id=${this._labelId} class=\"form-label\"> ${this.label} </label>\n `;\n return this.label && labelTemplate;\n }\n\n protected _renderHintText() {\n const hintTextTemplate = html` <div id=\"${this._controlId}Help\" class=\"form-text\">${this.hintText}</div> `;\n return this.hintText && hintTextTemplate;\n }\n\n protected _renderFeedback() {\n return html`\n <div class=\"invalid-feedback-container\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\">\n <path\n 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\"\n fill=\"#B90000\"\n />\n </svg>\n <div id=\"${this._controlId}-invalid\" class=\"invalid-feedback\">\n ${this.invalidFeedback ? this.invalidFeedback : this.input.validationMessage}\n </div>\n </div>\n `;\n }\n render() {\n const getCheckedIcon = () => {\n // if (checkedIcon) {\n // return html`${unsafeSVG(checkedIcon)}`;\n // }\n return html` <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n class=\"bi bi-check-lg\"\n viewBox=\"0 0 16 16\"\n >\n <path\n 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\"\n />\n </svg>`;\n };\n\n const listItems = this.selectedFiles.map(\n (file, index) => html`\n <li key=${index} class=\"file-upload-list-item\">\n <span>${getCheckedIcon()}</span>\n <span class=\"filename\">${file.name}</span>\n <sgds-close-button\n aria-label=\"remove the file\"\n @click=${() => this._removeFileHandler(index)}\n ></sgds-close-button>\n </li>\n `\n );\n\n return html`\n <div class=\"file-upload\">\n <input\n ${ref(this.inputRef)}\n type=\"file\"\n @change=${this._handleChange}\n ?multiple=${this.multiple}\n accept=${this.accept}\n id=${this._controlId}\n ?required=${this.required}\n ?disabled=${this.disabled}\n />\n <div class=\"file-upload-container\">\n ${this._renderLabel()}\n <sgds-button variant=\"outline\" ?disabled=${this.disabled} @click=${this._handleClick}>\n <label for=${this._controlId}><slot></slot></label>\n <svg\n slot=\"rightIcon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n >\n <path\n 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\"\n fill=\"currentColor\"\n />\n <path\n 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\"\n fill=\"currentColor\"\n />\n </svg>\n </sgds-button>\n ${this.hasFeedback && this.invalid ? this._renderFeedback() : this._renderHintText()}\n </div>\n <ul class=\"file-upload-list\">\n ${listItems}\n </ul>\n </div>\n `;\n }\n}\n\nexport default SgdsFileUpload;\n"],"names":["fileUploadStyles"],"mappings":";;;;;;;;;;;;AAYA;;;;;AAKG;AAEG,MAAO,cAAe,SAAQ,sBAAsB,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,CAAC,CAAA;AAAnG,IAAA,WAAA,GAAA;;;QAW8C,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;;QAGlB,IAAM,CAAA,MAAA,GAAG,EAAE,CAAC;;;;QAMX,IAAW,CAAA,WAAA,GAAG,KAAK,CAAC;;QAMpB,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;QAGrD,IAAa,CAAA,aAAA,GAAW,EAAE,CAAC;QAsC3B,IAAQ,CAAA,QAAA,GAAG,SAAS,EAAoB,CAAC;KAsKlD;;AAtOC,IAAA,WAAW,cAAc,GAAA;QACvB,OAAO;AACL,YAAA,aAAa,EAAE,UAAU;AACzB,YAAA,mBAAmB,EAAE,eAAe;SACrC,CAAC;KACH;AAuBD;;;AAGG;IACI,cAAc,GAAA;AACnB,QAAA,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC;KACpC;AACD;;AAEG;IACI,aAAa,GAAA;AAClB,QAAA,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC;KACnC;AACD;;AAEG;AACH,IAAA,IAAW,QAAQ,GAAA;AACjB,QAAA,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;KACjC;AACD;;AAEG;AACH,IAAA,IAAW,iBAAiB,GAAA;AAC1B,QAAA,OAAO,IAAI,CAAC,0BAA0B,EAAE,CAAC;KAC1C;AACD;;AAEG;AACH,IAAA,IAAW,KAAK,GAAA;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;KAC3B;AAEO,IAAA,YAAY,CAAC,KAAe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CAAA,CAAA,CAAA;AAGrD,UAAA,CAAA;AADP,IAAA,KAAK,EAAE;AAC2B,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,eAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAmGnC,UAAA,CAAA;IADC,KAAK,CAAC,UAAU,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAIjD,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,uBAAA,EAAA,IAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
var css_248z = 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}`;
|
|
4
|
+
|
|
5
|
+
export { css_248z as default };
|
|
6
|
+
//# sourceMappingURL=footer-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"footer-item.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
|
|
3
|
-
var css_248z = css
|
|
3
|
+
var css_248z = 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}}`;
|
|
4
4
|
|
|
5
5
|
export { css_248z as default };
|
|
6
6
|
//# sourceMappingURL=footer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Footer/index.ts"],"sourcesContent":["import { SgdsFooter } from \"./sgds-footer\";\n\ncustomElements.define(\"sgds-footer\", SgdsFooter);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"sgds-footer\": SgdsFooter;\n }\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Footer/index.ts"],"sourcesContent":["import { SgdsFooter } from \"./sgds-footer\";\nimport { SgdsFooterItem } from \"./sgds-footer-item\";\n\ncustomElements.define(\"sgds-footer\", SgdsFooter);\ncustomElements.define(\"sgds-footer-item\", SgdsFooterItem);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"sgds-footer\": SgdsFooter;\n \"sgds-footer-item\": SgdsFooterItem;\n }\n}\n"],"names":[],"mappings":";;;AAGA,cAAc,CAAC,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;AACjD,cAAc,CAAC,MAAM,CAAC,kBAAkB,EAAE,cAAc,CAAC"}
|