@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
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { __decorate } from 'tslib';
|
|
3
|
-
import {
|
|
3
|
+
import { nothing } from 'lit';
|
|
4
|
+
import { query, property, state } from 'lit/decorators.js';
|
|
4
5
|
import { classMap } from 'lit/directives/class-map.js';
|
|
5
6
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
7
|
import { live } from 'lit/directives/live.js';
|
|
7
8
|
import { html } from 'lit/static-html.js';
|
|
8
|
-
import
|
|
9
|
+
import FormControlElement from '../../base/form-control-element.js';
|
|
9
10
|
import { defaultValue } from '../../utils/defaultvalue.js';
|
|
10
|
-
import {
|
|
11
|
-
import genId from '../../utils/generateId.js';
|
|
11
|
+
import { SgdsFormValidatorMixin } from '../../utils/validatorMixin.js';
|
|
12
12
|
import { watch } from '../../utils/watch.js';
|
|
13
|
-
import css_248z
|
|
14
|
-
import css_248z$2 from '../../styles/feedback.js';
|
|
15
|
-
import css_248z$1 from '../../styles/form-label.js';
|
|
16
|
-
import css_248z from '../../styles/form-hint.js';
|
|
17
|
-
import css_248z$3 from '../../styles/form-placeholder.js';
|
|
13
|
+
import css_248z from './textarea.js';
|
|
18
14
|
|
|
19
15
|
/**
|
|
20
16
|
* @summary Text areas allow for the collection of input longer than a single line.
|
|
@@ -24,13 +20,9 @@ import css_248z$3 from '../../styles/form-placeholder.js';
|
|
|
24
20
|
* @event sgds-focus - Emitted when textarea is in focus.
|
|
25
21
|
* @event sgds-blur - Emitted when textarea loses focus.
|
|
26
22
|
*/
|
|
27
|
-
class SgdsTextarea extends
|
|
23
|
+
class SgdsTextarea extends SgdsFormValidatorMixin(FormControlElement) {
|
|
28
24
|
constructor() {
|
|
29
25
|
super(...arguments);
|
|
30
|
-
/**@internal */
|
|
31
|
-
this.formSubmitController = new FormSubmitController(this);
|
|
32
|
-
/**The textarea's label */
|
|
33
|
-
this.label = "label";
|
|
34
26
|
/**The textarea's value attribute. */
|
|
35
27
|
this.value = "";
|
|
36
28
|
/**Enables spell checking on the textarea */
|
|
@@ -39,14 +31,10 @@ class SgdsTextarea extends SgdsElement {
|
|
|
39
31
|
this.rows = 4;
|
|
40
32
|
/**The textarea's placeholder text. */
|
|
41
33
|
this.placeholder = "Placeholder";
|
|
42
|
-
/**
|
|
34
|
+
/** Custom feedback text for error state when validated */
|
|
43
35
|
this.invalidFeedback = "";
|
|
44
36
|
/**Autofocus the textarea */
|
|
45
37
|
this.autofocus = false;
|
|
46
|
-
/**Disables the textarea. */
|
|
47
|
-
this.disabled = false;
|
|
48
|
-
/**Makes the textarea a required field. */
|
|
49
|
-
this.required = false;
|
|
50
38
|
/** Makes the textarea readonly. */
|
|
51
39
|
this.readonly = false;
|
|
52
40
|
/** Controls how the textarea can be resized. */
|
|
@@ -55,32 +43,44 @@ class SgdsTextarea extends SgdsElement {
|
|
|
55
43
|
this.defaultValue = "";
|
|
56
44
|
/** Allows invalidFeedback, invalid and valid styles to be visible with the input */
|
|
57
45
|
this.hasFeedback = false;
|
|
58
|
-
/**
|
|
59
|
-
this.
|
|
46
|
+
/** Makes the textarea as a required field. */
|
|
47
|
+
this.required = false;
|
|
60
48
|
/** The textarea's hint text */
|
|
61
49
|
this.hintText = "";
|
|
62
|
-
|
|
63
|
-
this.textareaId = genId("textarea", "input");
|
|
64
|
-
}
|
|
65
|
-
connectedCallback() {
|
|
66
|
-
super.connectedCallback();
|
|
67
|
-
this.resizeObserver = new ResizeObserver(() => this._setTextareaHeight());
|
|
68
|
-
this.updateComplete.then(() => {
|
|
69
|
-
this._setTextareaHeight();
|
|
70
|
-
this.resizeObserver.observe(this.textarea);
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
disconnectedCallback() {
|
|
74
|
-
super.disconnectedCallback();
|
|
75
|
-
this.resizeObserver.unobserve(this.textarea);
|
|
50
|
+
this._isTouched = false;
|
|
76
51
|
}
|
|
77
52
|
/** Sets focus on the textarea. */
|
|
78
53
|
focus(options) {
|
|
79
54
|
this.textarea.focus(options);
|
|
80
55
|
}
|
|
81
|
-
/**
|
|
56
|
+
/** Sets blur on the textarea. */
|
|
57
|
+
blur() {
|
|
58
|
+
this.textarea.blur();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
|
|
62
|
+
* 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
|
|
63
|
+
*/
|
|
82
64
|
reportValidity() {
|
|
83
|
-
return this.
|
|
65
|
+
return this._mixinReportValidity();
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Checks for validity without any native error popup message
|
|
69
|
+
*/
|
|
70
|
+
checkValidity() {
|
|
71
|
+
return this._mixinCheckValidity();
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Returns the ValidityState object
|
|
75
|
+
*/
|
|
76
|
+
get validity() {
|
|
77
|
+
return this._mixinGetValidity();
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Returns the validation message based on the ValidityState
|
|
81
|
+
*/
|
|
82
|
+
get validationMessage() {
|
|
83
|
+
return this._mixinGetValidationMessage();
|
|
84
84
|
}
|
|
85
85
|
/** Selects all the text in the textarea. */
|
|
86
86
|
select() {
|
|
@@ -90,14 +90,21 @@ class SgdsTextarea extends SgdsElement {
|
|
|
90
90
|
e.preventDefault();
|
|
91
91
|
this.invalid = true;
|
|
92
92
|
}
|
|
93
|
-
_handleChange(
|
|
94
|
-
this.value = this.
|
|
95
|
-
this.emit(
|
|
93
|
+
_handleChange(e) {
|
|
94
|
+
this.value = this.input.value;
|
|
95
|
+
this.emit("sgds-change");
|
|
96
|
+
super._mixinHandleChange(e);
|
|
97
|
+
}
|
|
98
|
+
_handleInputChange(e) {
|
|
99
|
+
this.value = this.input.value;
|
|
100
|
+
this.emit("sgds-input");
|
|
101
|
+
super._mixinHandleInputChange(e);
|
|
96
102
|
}
|
|
97
103
|
_handleFocus() {
|
|
98
104
|
this.emit("sgds-focus");
|
|
99
105
|
}
|
|
100
|
-
|
|
106
|
+
_handleBlur() {
|
|
107
|
+
this._isTouched = true;
|
|
101
108
|
this.emit("sgds-blur");
|
|
102
109
|
}
|
|
103
110
|
/** @internal */
|
|
@@ -114,23 +121,26 @@ class SgdsTextarea extends SgdsElement {
|
|
|
114
121
|
}
|
|
115
122
|
}
|
|
116
123
|
/** @internal */
|
|
124
|
+
_handleIsTouched() {
|
|
125
|
+
if (this._isTouched) {
|
|
126
|
+
this.invalid = !this.textarea.checkValidity();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/** @internal */
|
|
117
130
|
_handleDisabledChange() {
|
|
118
131
|
// Disabled form controls are always valid, so we need to recheck validity when the state changes
|
|
119
|
-
this.
|
|
120
|
-
this.invalid = !this.textarea.checkValidity();
|
|
132
|
+
this.setInvalid(false);
|
|
121
133
|
}
|
|
122
134
|
/** @internal */
|
|
123
135
|
_handleValueChange() {
|
|
124
|
-
this.invalid = !this.textarea.checkValidity();
|
|
125
136
|
this.updateComplete.then(() => this._setTextareaHeight());
|
|
126
137
|
}
|
|
127
138
|
_renderHintText() {
|
|
128
|
-
const hintTextTemplate = html ` <div id="${this.
|
|
139
|
+
const hintTextTemplate = html ` <div id="${this._controlId}Help" class="form-text">${this.hintText}</div> `;
|
|
129
140
|
return this.hintText && hintTextTemplate;
|
|
130
141
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const wordCount = html `
|
|
142
|
+
_wordCount() {
|
|
143
|
+
return html `
|
|
134
144
|
<div
|
|
135
145
|
class="form-text word-count ${classMap({
|
|
136
146
|
"invalid-feedback": this.invalid && this.hasFeedback
|
|
@@ -139,13 +149,15 @@ class SgdsTextarea extends SgdsElement {
|
|
|
139
149
|
${this.value.length}/${this.maxlength}
|
|
140
150
|
</div>
|
|
141
151
|
`;
|
|
152
|
+
}
|
|
153
|
+
render() {
|
|
142
154
|
return html `
|
|
143
155
|
<div
|
|
144
156
|
class="form-control-container ${classMap({
|
|
145
157
|
disabled: this.disabled
|
|
146
158
|
})}"
|
|
147
159
|
>
|
|
148
|
-
<label for=${this.
|
|
160
|
+
<label for=${this._controlId} class="form-label">${this.label}</label>
|
|
149
161
|
<textarea
|
|
150
162
|
class=${classMap({
|
|
151
163
|
"form-control": true,
|
|
@@ -154,7 +166,7 @@ class SgdsTextarea extends SgdsElement {
|
|
|
154
166
|
"textarea-resize-vertical": this.resize === "vertical",
|
|
155
167
|
"textarea-resize-auto": this.resize === "auto"
|
|
156
168
|
})}
|
|
157
|
-
id=${this.
|
|
169
|
+
id=${this._controlId}
|
|
158
170
|
name=${ifDefined(this.name)}
|
|
159
171
|
rows=${ifDefined(this.rows)}
|
|
160
172
|
placeholder=${ifDefined(this.placeholder)}
|
|
@@ -169,13 +181,12 @@ class SgdsTextarea extends SgdsElement {
|
|
|
169
181
|
?autofocus=${this.autofocus}
|
|
170
182
|
autocorrect=${ifDefined(this.autocorrect)}
|
|
171
183
|
inputmode=${ifDefined(this.inputmode)}
|
|
172
|
-
@input=${() => this.
|
|
173
|
-
@change=${() => this._handleChange(
|
|
184
|
+
@input=${(e) => this._handleInputChange(e)}
|
|
185
|
+
@change=${(e) => this._handleChange(e)}
|
|
174
186
|
@invalid=${(e) => this._handleInvalid(e)}
|
|
175
187
|
@focus=${this._handleFocus}
|
|
176
|
-
@blur=${this.
|
|
177
|
-
>
|
|
178
|
-
</textarea>
|
|
188
|
+
@blur=${this._handleBlur}
|
|
189
|
+
></textarea>
|
|
179
190
|
<div class="textarea-info-container">
|
|
180
191
|
${this.invalid && this.hasFeedback
|
|
181
192
|
? html `
|
|
@@ -186,30 +197,22 @@ class SgdsTextarea extends SgdsElement {
|
|
|
186
197
|
fill="#B90000"
|
|
187
198
|
/>
|
|
188
199
|
</svg>
|
|
189
|
-
<div id="${this.
|
|
200
|
+
<div id="${this._controlId}-invalid" class="invalid-feedback">
|
|
201
|
+
${this.invalidFeedback ? this.invalidFeedback : this.input.validationMessage}
|
|
202
|
+
</div>
|
|
190
203
|
</div>
|
|
191
204
|
`
|
|
192
205
|
: html `${this._renderHintText()}`}
|
|
193
|
-
${this.maxlength > 0 ?
|
|
206
|
+
${this.maxlength > 0 ? this._wordCount() : nothing}
|
|
194
207
|
</div>
|
|
195
208
|
</div>
|
|
196
209
|
`;
|
|
197
210
|
}
|
|
198
211
|
}
|
|
199
|
-
SgdsTextarea.styles = [
|
|
200
|
-
...SgdsElement.styles,
|
|
201
|
-
css_248z,
|
|
202
|
-
css_248z$1,
|
|
203
|
-
css_248z$2,
|
|
204
|
-
css_248z$3,
|
|
205
|
-
css_248z$4
|
|
206
|
-
];
|
|
212
|
+
SgdsTextarea.styles = [...FormControlElement.styles, css_248z];
|
|
207
213
|
__decorate([
|
|
208
214
|
query("textarea.form-control")
|
|
209
215
|
], SgdsTextarea.prototype, "textarea", void 0);
|
|
210
|
-
__decorate([
|
|
211
|
-
property({ type: String, reflect: true })
|
|
212
|
-
], SgdsTextarea.prototype, "label", void 0);
|
|
213
216
|
__decorate([
|
|
214
217
|
property({ type: String, reflect: true })
|
|
215
218
|
], SgdsTextarea.prototype, "name", void 0);
|
|
@@ -237,12 +240,6 @@ __decorate([
|
|
|
237
240
|
__decorate([
|
|
238
241
|
property({ type: Boolean, reflect: true })
|
|
239
242
|
], SgdsTextarea.prototype, "autofocus", void 0);
|
|
240
|
-
__decorate([
|
|
241
|
-
property({ type: Boolean, reflect: true })
|
|
242
|
-
], SgdsTextarea.prototype, "disabled", void 0);
|
|
243
|
-
__decorate([
|
|
244
|
-
property({ type: Boolean, reflect: true })
|
|
245
|
-
], SgdsTextarea.prototype, "required", void 0);
|
|
246
243
|
__decorate([
|
|
247
244
|
property({ type: Boolean, reflect: true })
|
|
248
245
|
], SgdsTextarea.prototype, "readonly", void 0);
|
|
@@ -263,13 +260,19 @@ __decorate([
|
|
|
263
260
|
], SgdsTextarea.prototype, "hasFeedback", void 0);
|
|
264
261
|
__decorate([
|
|
265
262
|
property({ type: Boolean, reflect: true })
|
|
266
|
-
], SgdsTextarea.prototype, "
|
|
263
|
+
], SgdsTextarea.prototype, "required", void 0);
|
|
267
264
|
__decorate([
|
|
268
265
|
property({ reflect: true })
|
|
269
266
|
], SgdsTextarea.prototype, "hintText", void 0);
|
|
267
|
+
__decorate([
|
|
268
|
+
state()
|
|
269
|
+
], SgdsTextarea.prototype, "_isTouched", void 0);
|
|
270
270
|
__decorate([
|
|
271
271
|
watch("rows", { waitUntilFirstUpdate: true })
|
|
272
272
|
], SgdsTextarea.prototype, "_handleRowsChange", null);
|
|
273
|
+
__decorate([
|
|
274
|
+
watch("_isTouched", { waitUntilFirstUpdate: true })
|
|
275
|
+
], SgdsTextarea.prototype, "_handleIsTouched", null);
|
|
273
276
|
__decorate([
|
|
274
277
|
watch("disabled", { waitUntilFirstUpdate: true })
|
|
275
278
|
], SgdsTextarea.prototype, "_handleDisabledChange", null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sgds-textarea.js","sources":["../../../../src/components/Textarea/sgds-textarea.ts"],"sourcesContent":["import { property, query } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { live } from \"lit/directives/live.js\";\nimport { html } from \"lit/static-html.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { defaultValue } from \"../../utils/defaultvalue\";\nimport { FormSubmitController, SgdsFormControl } from \"../../utils/form\";\nimport genId from \"../../utils/generateId\";\nimport { watch } from \"../../utils/watch\";\nimport textareaStyle from \"./textarea.css\";\nimport feedbackStyles from \"../../styles/feedback.css\";\nimport formLabelStyles from \"../../styles/form-label.css\";\nimport formHintStyles from \"../../styles/form-hint.css\";\nimport fromPlaceholderStyles from \"../../styles/form-placeholder.css\";\n\n/**\n * @summary Text areas allow for the collection of input longer than a single line.\n *\n * @event sgds-change - Emitted when an alteration to the control's value is committed by the user.\n * @event sgds-input - Emitted when the control receives input and its value changes.\n * @event sgds-focus - Emitted when textarea is in focus.\n * @event sgds-blur - Emitted when textarea loses focus.\n */\nexport class SgdsTextarea extends SgdsElement implements SgdsFormControl {\n static styles = [\n ...SgdsElement.styles,\n formHintStyles,\n formLabelStyles,\n feedbackStyles,\n fromPlaceholderStyles,\n textareaStyle\n ];\n /**@internal */\n @query(\"textarea.form-control\") textarea: HTMLTextAreaElement;\n /**@internal */\n private readonly formSubmitController = new FormSubmitController(this);\n /**@internal */\n private resizeObserver: ResizeObserver;\n /**The textarea's label */\n @property({ type: String, reflect: true }) label = \"label\";\n /**The textarea's name attribute */\n @property({ type: String, reflect: true }) name: string;\n /**The textarea's value attribute. */\n @property({ type: String, reflect: true }) value = \"\";\n /**Sets the minimum length of the textarea */\n @property({ type: Number, reflect: true }) minlength: number;\n /**Sets the maximum length of the textarea */\n @property({ type: Number, reflect: true }) maxlength: number;\n /**Enables spell checking on the textarea */\n @property({ type: Boolean, reflect: true }) spellcheck = false;\n /** The number of rows to display by default. */\n @property({ type: Number }) rows = 4;\n /**The textarea's placeholder text. */\n @property({ type: String, reflect: true }) placeholder = \"Placeholder\";\n /**Feedback text for error state when validated */\n @property({ type: String, reflect: true }) invalidFeedback = \"\";\n /**Autofocus the textarea */\n @property({ type: Boolean, reflect: true }) autofocus = false;\n /**Disables the textarea. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n /**Makes the textarea a required field. */\n @property({ type: Boolean, reflect: true }) required = false;\n /** Makes the textarea readonly. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n\n /** Controls how the textarea can be resized. */\n @property({ type: String, reflect: true }) resize: \"none\" | \"vertical\" | \"auto\" = \"vertical\";\n /** The native textarea's inputmode attribute. It hints at the type of data that might be entered by the user while editing the element or its contents. This allows a browser to display an appropriate virtual keyboard. */\n @property({ type: String, reflect: true }) inputmode:\n | \"none\"\n | \"text\"\n | \"decimal\"\n | \"numeric\"\n | \"tel\"\n | \"search\"\n | \"email\"\n | \"url\";\n /** The native textarea's autocorrect attribute. */\n @property({ type: String, reflect: true }) autocorrect: string;\n /** Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */\n @defaultValue()\n defaultValue = \"\";\n /** Allows invalidFeedback, invalid and valid styles to be visible with the input */\n @property({ type: Boolean, reflect: true }) hasFeedback = false;\n\n /** Marks the component as invalid. Replace the pseudo :invalid selector for absent in custom elements */\n @property({ type: Boolean, reflect: true }) invalid = false;\n\n /** The textarea's hint text */\n @property({ reflect: true }) hintText = \"\";\n\n /** @internal The textarea's unique id */\n private textareaId = genId(\"textarea\", \"input\");\n\n connectedCallback() {\n super.connectedCallback();\n this.resizeObserver = new ResizeObserver(() => this._setTextareaHeight());\n\n this.updateComplete.then(() => {\n this._setTextareaHeight();\n this.resizeObserver.observe(this.textarea);\n });\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.resizeObserver.unobserve(this.textarea);\n }\n\n /** Sets focus on the textarea. */\n public focus(options?: FocusOptions) {\n this.textarea.focus(options);\n }\n\n /** Checks for validity and shows the browser's validation message if the control is invalid. */\n public reportValidity() {\n return this.textarea.reportValidity();\n }\n /** Selects all the text in the textarea. */\n public select() {\n this.textarea.select();\n }\n private _handleInvalid(e: Event) {\n e.preventDefault();\n this.invalid = true;\n }\n\n private _handleChange(event: string) {\n this.value = this.textarea.value;\n this.emit(event);\n }\n\n private _handleFocus() {\n this.emit(\"sgds-focus\");\n }\n\n private handleBlur() {\n this.emit(\"sgds-blur\");\n }\n\n /** @internal */\n @watch(\"rows\", { waitUntilFirstUpdate: true })\n _handleRowsChange() {\n this._setTextareaHeight();\n }\n\n private _setTextareaHeight() {\n if (this.resize === \"auto\") {\n this.textarea.style.height = \"auto\";\n this.textarea.style.height = `${this.textarea.scrollHeight}px`;\n } else {\n (this.textarea.style.height as string | undefined) = undefined;\n }\n }\n\n /** @internal */\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.textarea.disabled = this.disabled;\n this.invalid = !this.textarea.checkValidity();\n }\n\n /** @internal */\n @watch(\"value\", { waitUntilFirstUpdate: true })\n _handleValueChange() {\n this.invalid = !this.textarea.checkValidity();\n this.updateComplete.then(() => this._setTextareaHeight());\n }\n\n protected _renderHintText() {\n const hintTextTemplate = html` <div id=\"${this.textareaId}Help\" class=\"form-text\">${this.hintText}</div> `;\n return this.hintText && hintTextTemplate;\n }\n\n render() {\n // if maxlength is defined\n const wordCount = html`\n <div\n class=\"form-text word-count ${classMap({\n \"invalid-feedback\": this.invalid && this.hasFeedback\n })}\"\n >\n ${this.value.length}/${this.maxlength}\n </div>\n `;\n\n return html`\n <div\n class=\"form-control-container ${classMap({\n disabled: this.disabled\n })}\"\n >\n <label for=${this.textareaId} class=\"form-label\">${this.label}</label>\n <textarea\n class=${classMap({\n \"form-control\": true,\n \"is-invalid\": this.hasFeedback && this.invalid,\n \"textarea-resize-none\": this.resize === \"none\",\n \"textarea-resize-vertical\": this.resize === \"vertical\",\n \"textarea-resize-auto\": this.resize === \"auto\"\n })}\n id=${this.textareaId}\n name=${ifDefined(this.name)}\n rows=${ifDefined(this.rows)}\n placeholder=${ifDefined(this.placeholder)}\n minlength=${ifDefined(this.minlength)}\n maxlength=${ifDefined(this.maxlength)}\n .value=${live(this.value)}\n aria-invalid=${this.invalid ? \"true\" : \"false\"}\n spellcheck=${ifDefined(this.spellcheck)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n ?autofocus=${this.autofocus}\n autocorrect=${ifDefined(this.autocorrect)}\n inputmode=${ifDefined(this.inputmode)}\n @input=${() => this._handleChange(\"sgds-input\")}\n @change=${() => this._handleChange(\"sgds-change\")}\n @invalid=${(e: Event) => this._handleInvalid(e)}\n @focus=${this._handleFocus}\n @blur=${this.handleBlur}\n >\n </textarea>\n <div class=\"textarea-info-container\">\n ${this.invalid && this.hasFeedback\n ? 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.textareaId}-invalid\" class=\"invalid-feedback\">${this.invalidFeedback}</div>\n </div>\n `\n : html`${this._renderHintText()}`}\n ${this.maxlength > 0 ? wordCount : undefined}\n </div>\n </div>\n `;\n }\n}\n\nexport default SgdsTextarea;\n"],"names":["formHintStyles","formLabelStyles","feedbackStyles","fromPlaceholderStyles","textareaStyle"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA;;;;;;;AAOG;AACG,MAAO,YAAa,SAAQ,WAAW,CAAA;AAA7C,IAAA,WAAA,GAAA;;;AAYmB,QAAA,IAAA,CAAA,oBAAoB,GAAG,IAAI,oBAAoB,CAAC,IAAI,CAAC,CAAC;;QAI5B,IAAK,CAAA,KAAA,GAAG,OAAO,CAAC;;QAIhB,IAAK,CAAA,KAAA,GAAG,EAAE,CAAC;;QAMV,IAAU,CAAA,UAAA,GAAG,KAAK,CAAC;;QAEnC,IAAI,CAAA,IAAA,GAAG,CAAC,CAAC;;QAEM,IAAW,CAAA,WAAA,GAAG,aAAa,CAAC;;QAE5B,IAAe,CAAA,eAAA,GAAG,EAAE,CAAC;;QAEpB,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;;QAElB,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;;QAE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CAAA,SAAA,EAAA,UAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAqD3C,UAAA,CAAA;IADC,KAAK,CAAC,MAAM,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAG7C,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,mBAAA,EAAA,IAAA,CAAA,CAAA;AAaD,UAAA,CAAA;IADC,KAAK,CAAC,UAAU,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAKjD,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,uBAAA,EAAA,IAAA,CAAA,CAAA;AAID,UAAA,CAAA;IADC,KAAK,CAAC,OAAO,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAI9C,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,oBAAA,EAAA,IAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"sgds-textarea.js","sources":["../../../../src/components/Textarea/sgds-textarea.ts"],"sourcesContent":["import { nothing } from \"lit\";\nimport { property, query, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { live } from \"lit/directives/live.js\";\nimport { html } from \"lit/static-html.js\";\nimport FormControlElement from \"../../base/form-control-element\";\nimport { defaultValue } from \"../../utils/defaultvalue\";\nimport { SgdsFormControl } from \"../../utils/formSubmitController\";\nimport { SgdsFormValidatorMixin } from \"../../utils/validatorMixin\";\nimport { watch } from \"../../utils/watch\";\nimport textareaStyle from \"./textarea.css\";\n\n/**\n * @summary Text areas allow for the collection of input longer than a single line.\n *\n * @event sgds-change - Emitted when an alteration to the control's value is committed by the user.\n * @event sgds-input - Emitted when the control receives input and its value changes.\n * @event sgds-focus - Emitted when textarea is in focus.\n * @event sgds-blur - Emitted when textarea loses focus.\n */\nexport class SgdsTextarea extends SgdsFormValidatorMixin(FormControlElement) implements SgdsFormControl {\n static styles = [...FormControlElement.styles, textareaStyle];\n /**@internal */\n @query(\"textarea.form-control\") textarea: HTMLTextAreaElement;\n /**@internal */\n private resizeObserver: ResizeObserver;\n /**The textarea's name attribute */\n @property({ type: String, reflect: true }) name: string;\n /**The textarea's value attribute. */\n @property({ type: String, reflect: true }) value = \"\";\n /**Sets the minimum length of the textarea */\n @property({ type: Number, reflect: true }) minlength: number;\n /**Sets the maximum length of the textarea. When maxlength is defined, a word count appears on bottom right of the input*/\n @property({ type: Number, reflect: true }) maxlength: number;\n /**Enables spell checking on the textarea */\n @property({ type: Boolean, reflect: true }) spellcheck = false;\n /** The number of rows to display by default. */\n @property({ type: Number }) rows = 4;\n /**The textarea's placeholder text. */\n @property({ type: String, reflect: true }) placeholder = \"Placeholder\";\n /** Custom feedback text for error state when validated */\n @property({ type: String, reflect: true }) invalidFeedback = \"\";\n /**Autofocus the textarea */\n @property({ type: Boolean, reflect: true }) autofocus = false;\n /** Makes the textarea readonly. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n\n /** Controls how the textarea can be resized. */\n @property({ type: String, reflect: true }) resize: \"none\" | \"vertical\" | \"auto\" = \"vertical\";\n /** The native textarea's inputmode attribute. It hints at the type of data that might be entered by the user while editing the element or its contents. This allows a browser to display an appropriate virtual keyboard. */\n @property({ type: String, reflect: true }) inputmode:\n | \"none\"\n | \"text\"\n | \"decimal\"\n | \"numeric\"\n | \"tel\"\n | \"search\"\n | \"email\"\n | \"url\";\n /** The native textarea's autocorrect attribute. */\n @property({ type: String, reflect: true }) autocorrect: string;\n /** Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */\n @defaultValue()\n defaultValue = \"\";\n /** Allows invalidFeedback, invalid and valid styles to be visible with the input */\n @property({ type: Boolean, reflect: true }) hasFeedback = false;\n\n /** Makes the textarea as a required field. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n /** The textarea's hint text */\n @property({ reflect: true }) hintText = \"\";\n\n @state() private _isTouched = false;\n\n /** Sets focus on the textarea. */\n public focus(options?: FocusOptions) {\n this.textarea.focus(options);\n }\n /** Sets blur on the textarea. */\n public blur() {\n this.textarea.blur();\n }\n\n /**\n * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state\n * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput\n */\n public reportValidity(): boolean {\n return this._mixinReportValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public checkValidity(): boolean {\n return this._mixinCheckValidity();\n }\n /**\n * Returns the ValidityState object\n */\n public get validity(): ValidityState {\n return this._mixinGetValidity();\n }\n /**\n * Returns the validation message based on the ValidityState\n */\n public get validationMessage() {\n return this._mixinGetValidationMessage();\n }\n\n /** Selects all the text in the textarea. */\n public select() {\n this.textarea.select();\n }\n private _handleInvalid(e: Event) {\n e.preventDefault();\n this.invalid = true;\n }\n\n protected _handleChange(e: Event) {\n this.value = this.input.value;\n this.emit(\"sgds-change\");\n super._mixinHandleChange(e);\n }\n private _handleInputChange(e: Event) {\n this.value = this.input.value;\n this.emit(\"sgds-input\");\n super._mixinHandleInputChange(e);\n }\n\n private _handleFocus() {\n this.emit(\"sgds-focus\");\n }\n\n private _handleBlur() {\n this._isTouched = true;\n this.emit(\"sgds-blur\");\n }\n\n /** @internal */\n @watch(\"rows\", { waitUntilFirstUpdate: true })\n _handleRowsChange() {\n this._setTextareaHeight();\n }\n\n private _setTextareaHeight() {\n if (this.resize === \"auto\") {\n this.textarea.style.height = \"auto\";\n this.textarea.style.height = `${this.textarea.scrollHeight}px`;\n } else {\n (this.textarea.style.height as string | undefined) = undefined;\n }\n }\n /** @internal */\n @watch(\"_isTouched\", { waitUntilFirstUpdate: true })\n _handleIsTouched() {\n if (this._isTouched) {\n this.invalid = !this.textarea.checkValidity();\n }\n }\n\n /** @internal */\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\n /** @internal */\n @watch(\"value\", { waitUntilFirstUpdate: true })\n _handleValueChange() {\n this.updateComplete.then(() => this._setTextareaHeight());\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 private _wordCount() {\n return html`\n <div\n class=\"form-text word-count ${classMap({\n \"invalid-feedback\": this.invalid && this.hasFeedback\n })}\"\n >\n ${this.value.length}/${this.maxlength}\n </div>\n `;\n }\n render() {\n return html`\n <div\n class=\"form-control-container ${classMap({\n disabled: this.disabled\n })}\"\n >\n <label for=${this._controlId} class=\"form-label\">${this.label}</label>\n <textarea\n class=${classMap({\n \"form-control\": true,\n \"is-invalid\": this.hasFeedback && this.invalid,\n \"textarea-resize-none\": this.resize === \"none\",\n \"textarea-resize-vertical\": this.resize === \"vertical\",\n \"textarea-resize-auto\": this.resize === \"auto\"\n })}\n id=${this._controlId}\n name=${ifDefined(this.name)}\n rows=${ifDefined(this.rows)}\n placeholder=${ifDefined(this.placeholder)}\n minlength=${ifDefined(this.minlength)}\n maxlength=${ifDefined(this.maxlength)}\n .value=${live(this.value)}\n aria-invalid=${this.invalid ? \"true\" : \"false\"}\n spellcheck=${ifDefined(this.spellcheck)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n ?autofocus=${this.autofocus}\n autocorrect=${ifDefined(this.autocorrect)}\n inputmode=${ifDefined(this.inputmode)}\n @input=${(e: Event) => this._handleInputChange(e)}\n @change=${(e: Event) => this._handleChange(e)}\n @invalid=${(e: Event) => this._handleInvalid(e)}\n @focus=${this._handleFocus}\n @blur=${this._handleBlur}\n ></textarea>\n <div class=\"textarea-info-container\">\n ${this.invalid && this.hasFeedback\n ? 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 : html`${this._renderHintText()}`}\n ${this.maxlength > 0 ? this._wordCount() : nothing}\n </div>\n </div>\n `;\n }\n}\n\nexport default SgdsTextarea;\n"],"names":["textareaStyle"],"mappings":";;;;;;;;;;;;;;AAaA;;;;;;;AAOG;MACU,YAAa,SAAQ,sBAAsB,CAAC,kBAAkB,CAAC,CAAA;AAA5E,IAAA,WAAA,GAAA;;;QAS6C,IAAK,CAAA,KAAA,GAAG,EAAE,CAAC;;QAMV,IAAU,CAAA,UAAA,GAAG,KAAK,CAAC;;QAEnC,IAAI,CAAA,IAAA,GAAG,CAAC,CAAC;;QAEM,IAAW,CAAA,WAAA,GAAG,aAAa,CAAC;;QAE5B,IAAe,CAAA,eAAA,GAAG,EAAE,CAAC;;QAEpB,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;;QAElB,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;;QAGlB,IAAM,CAAA,MAAA,GAAiC,UAAU,CAAC;;QAe7F,IAAY,CAAA,YAAA,GAAG,EAAE,CAAC;;QAE0B,IAAW,CAAA,WAAA,GAAG,KAAK,CAAC;;QAGpB,IAAQ,CAAA,QA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AE,CAAC;AAIjD,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,uBAAA,EAAA,IAAA,CAAA,CAAA;AAID,UAAA,CAAA;IADC,KAAK,CAAC,OAAO,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAG9C,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,oBAAA,EAAA,IAAA,CAAA;;;;"}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var lit = require('lit');
|
|
7
7
|
|
|
8
|
-
var css_248z = lit.css`.form-control-container{display:flex;flex-direction:column;gap:var(--sgds-form-gap-md)}.form-control-container.disabled{opacity:var(--sgds-opacity-50)}textarea{font-family:inherit;font-size:inherit;line-height:inherit;margin:0;resize:vertical}.form-control{appearance:none;background-clip:padding-box;background-color:var(--sgds-form-bg);border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color);border-radius:var(--sgds-form-border-radius-md);color:var(--sgds-form-color);min-height:var(--sgds-dimension-136);padding:var(--sgds-form-padding-y) var(--sgds-form-padding-x);transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out;width:100%}.form-control[readonly]{border-color:var(--sgds-form-border-color-muted)}@media (prefers-reduced-motion:reduce){.form-control{transition:none}}.form-control:not([disabled]):not(.is-invalid):hover{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis)}.form-control:not([disabled]):not(.is-invalid):focus,.form-control:not([disabled]):not(.is-invalid):focus-visible{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis);box-shadow:var(--sgds-form-box-shadow-focus)
|
|
8
|
+
var css_248z = lit.css`.form-control-container{display:flex;flex-direction:column;gap:var(--sgds-form-gap-md)}.form-control-container.disabled{opacity:var(--sgds-opacity-50)}textarea{font-family:inherit;font-size:inherit;line-height:inherit;margin:0;resize:vertical}.form-control{appearance:none;background-clip:padding-box;background-color:var(--sgds-form-bg);border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color);border-radius:var(--sgds-form-border-radius-md);color:var(--sgds-form-color);min-height:var(--sgds-dimension-136);outline:0;padding:var(--sgds-form-padding-y) var(--sgds-form-padding-x);transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out;width:100%}.form-control[readonly]{border-color:var(--sgds-form-border-color-muted)}@media (prefers-reduced-motion:reduce){.form-control{transition:none}}.form-control:not([disabled]):not(.is-invalid):hover{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis)}.form-control:not([disabled]):not(.is-invalid):focus,.form-control:not([disabled]):not(.is-invalid):focus-visible{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis);box-shadow:var(--sgds-form-box-shadow-focus)}.form-control.is-invalid{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-danger-border-color)}.form-control:disabled{background-color:var(--sgds-form-bg-muted)}.textarea-resize-none{resize:none}.textarea-resize-vertical{resize:vertical}.textarea-resize-auto{height:auto;overflow-y:hidden;resize:none}.textarea-info-container{display:flex;justify-content:space-between}.word-count{margin-left:auto}`;
|
|
9
9
|
|
|
10
10
|
exports["default"] = css_248z;
|
|
11
11
|
//# sourceMappingURL=textarea.cjs.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { css } from 'lit';
|
|
3
3
|
|
|
4
|
-
var css_248z = css`.form-control-container{display:flex;flex-direction:column;gap:var(--sgds-form-gap-md)}.form-control-container.disabled{opacity:var(--sgds-opacity-50)}textarea{font-family:inherit;font-size:inherit;line-height:inherit;margin:0;resize:vertical}.form-control{appearance:none;background-clip:padding-box;background-color:var(--sgds-form-bg);border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color);border-radius:var(--sgds-form-border-radius-md);color:var(--sgds-form-color);min-height:var(--sgds-dimension-136);padding:var(--sgds-form-padding-y) var(--sgds-form-padding-x);transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out;width:100%}.form-control[readonly]{border-color:var(--sgds-form-border-color-muted)}@media (prefers-reduced-motion:reduce){.form-control{transition:none}}.form-control:not([disabled]):not(.is-invalid):hover{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis)}.form-control:not([disabled]):not(.is-invalid):focus,.form-control:not([disabled]):not(.is-invalid):focus-visible{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis);box-shadow:var(--sgds-form-box-shadow-focus)
|
|
4
|
+
var css_248z = css`.form-control-container{display:flex;flex-direction:column;gap:var(--sgds-form-gap-md)}.form-control-container.disabled{opacity:var(--sgds-opacity-50)}textarea{font-family:inherit;font-size:inherit;line-height:inherit;margin:0;resize:vertical}.form-control{appearance:none;background-clip:padding-box;background-color:var(--sgds-form-bg);border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color);border-radius:var(--sgds-form-border-radius-md);color:var(--sgds-form-color);min-height:var(--sgds-dimension-136);outline:0;padding:var(--sgds-form-padding-y) var(--sgds-form-padding-x);transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out;width:100%}.form-control[readonly]{border-color:var(--sgds-form-border-color-muted)}@media (prefers-reduced-motion:reduce){.form-control{transition:none}}.form-control:not([disabled]):not(.is-invalid):hover{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis)}.form-control:not([disabled]):not(.is-invalid):focus,.form-control:not([disabled]):not(.is-invalid):focus-visible{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis);box-shadow:var(--sgds-form-box-shadow-focus)}.form-control.is-invalid{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-danger-border-color)}.form-control:disabled{background-color:var(--sgds-form-bg-muted)}.textarea-resize-none{resize:none}.textarea-resize-vertical{resize:vertical}.textarea-resize-auto{height:auto;overflow-y:hidden;resize:none}.textarea-info-container{display:flex;justify-content:space-between}.word-count{margin-left:auto}`;
|
|
5
5
|
|
|
6
6
|
export { css_248z as default };
|
|
7
7
|
//# sourceMappingURL=textarea.js.map
|
|
@@ -20,6 +20,7 @@ var toast = require('./toast.cjs.js');
|
|
|
20
20
|
*
|
|
21
21
|
* @slot default - The content to pass into toast's body
|
|
22
22
|
* @slot action - The content to pass into toast's action
|
|
23
|
+
* @slot icon - The icon in toast
|
|
23
24
|
*
|
|
24
25
|
*
|
|
25
26
|
* @event sgds-show - Emitted on show.
|
|
@@ -45,7 +46,7 @@ class SgdsToast extends scopedElements.ScopedElementsMixin(sgdsElement["default"
|
|
|
45
46
|
/**The variant styles of toast */
|
|
46
47
|
this.variant = "info";
|
|
47
48
|
/** Controls whether or not the Toast is dismissible */
|
|
48
|
-
this.
|
|
49
|
+
this.dismissible = false;
|
|
49
50
|
}
|
|
50
51
|
/**@internal */
|
|
51
52
|
static get scopedElements() {
|
|
@@ -118,28 +119,15 @@ class SgdsToast extends scopedElements.ScopedElementsMixin(sgdsElement["default"
|
|
|
118
119
|
aria-live="assertive"
|
|
119
120
|
aria-atomic="true"
|
|
120
121
|
>
|
|
121
|
-
<
|
|
122
|
-
<svg
|
|
123
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
124
|
-
width="16"
|
|
125
|
-
height="16"
|
|
126
|
-
fill="currentColor"
|
|
127
|
-
class="bi bi-airplane"
|
|
128
|
-
viewBox="0 0 16 16"
|
|
129
|
-
>
|
|
130
|
-
<path
|
|
131
|
-
d="M6.428 1.151C6.708.591 7.213 0 8 0s1.292.592 1.572 1.151C9.861 1.73 10 2.431 10 3v3.691l5.17 2.585a1.5 1.5 0 0 1 .83 1.342V12a.5.5 0 0 1-.582.493l-5.507-.918-.375 2.253 1.318 1.318A.5.5 0 0 1 10.5 16h-5a.5.5 0 0 1-.354-.854l1.319-1.318-.376-2.253-5.507.918A.5.5 0 0 1 0 12v-1.382a1.5 1.5 0 0 1 .83-1.342L6 6.691V3c0-.568.14-1.271.428-1.849Zm.894.448C7.111 2.02 7 2.569 7 3v4a.5.5 0 0 1-.276.447l-5.448 2.724a.5.5 0 0 0-.276.447v.792l5.418-.903a.5.5 0 0 1 .575.41l.5 3a.5.5 0 0 1-.14.437L6.708 15h2.586l-.647-.646a.5.5 0 0 1-.14-.436l.5-3a.5.5 0 0 1 .576-.411L15 11.41v-.792a.5.5 0 0 0-.276-.447L9.276 7.447A.5.5 0 0 1 9 7V3c0-.432-.11-.979-.322-1.401C8.458 1.159 8.213 1 8 1c-.213 0-.458.158-.678.599Z"
|
|
132
|
-
></path>
|
|
133
|
-
</svg>
|
|
134
|
-
</i>
|
|
122
|
+
<slot name="icon"></slot>
|
|
135
123
|
<div class="toast-content">
|
|
136
124
|
<div class="toast-body">
|
|
137
125
|
<strong>${this.title}</strong>
|
|
138
|
-
<slot></slot>
|
|
126
|
+
<span><slot></slot></span>
|
|
139
127
|
</div>
|
|
140
128
|
<slot class="toast-action" name="action"></slot>
|
|
141
129
|
</div>
|
|
142
|
-
${this.
|
|
130
|
+
${this.dismissible
|
|
143
131
|
? lit.html `<sgds-close-button
|
|
144
132
|
class="close-btn"
|
|
145
133
|
ariaLabel="close toast"
|
|
@@ -174,7 +162,7 @@ tslib.__decorate([
|
|
|
174
162
|
], SgdsToast.prototype, "variant", void 0);
|
|
175
163
|
tslib.__decorate([
|
|
176
164
|
decorators_js.property({ type: Boolean, reflect: true })
|
|
177
|
-
], SgdsToast.prototype, "
|
|
165
|
+
], SgdsToast.prototype, "dismissible", void 0);
|
|
178
166
|
tslib.__decorate([
|
|
179
167
|
watch.watch("show", { waitUntilFirstUpdate: true })
|
|
180
168
|
], SgdsToast.prototype, "handleShowChange", null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sgds-toast.cjs.js","sources":["../../../../src/components/Toast/sgds-toast.ts"],"sourcesContent":["import { ScopedElementsMixin } from \"@open-wc/scoped-elements\";\nimport { html, nothing } from \"lit\";\nimport { property, query, queryAssignedNodes } from \"lit/decorators.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport SgdsCloseButton from \"../../internals/CloseButton/sgds-close-button\";\nimport { animateTo } from \"../../utils/animate\";\nimport { getAnimation, setDefaultAnimation } from \"../../utils/animation-registry\";\nimport { waitForEvent } from \"../../utils/event\";\nimport { watch } from \"../../utils/watch\";\nimport toastStyle from \"./toast.css\";\n/**\n * @summary Toast allows you to convey quick messaging notifications to the user.\n *\n * @slot default - The content to pass into toast's body \n * @slot action - The content to pass into toast's action \n * \n *\n * @event sgds-show - Emitted on show.\n * @event sgds-after-show - Emitted on show after animation has completed.\n * @event sgds-hide - Emitted on hide.\n * @event sgds-after-hide - Emitted on hide after animation has completed.\n \n * @cssproperty --toast-icon-margin-right - The margin right between toast's icon and title in its header.\n */\nexport class SgdsToast extends ScopedElementsMixin(SgdsElement) {\n static styles = [...SgdsElement.styles, toastStyle];\n /**@internal */\n static get scopedElements() {\n return {\n \"sgds-close-button\": SgdsCloseButton\n };\n }\n\n /**@internal */\n @query(\"div.toast\") toast: HTMLElement;\n /** Controls the appearance of toast */\n @property({ type: Boolean, reflect: true }) show = false;\n /** The header title of toast. It is required to assign a title to toast */\n @property({ type: String, reflect: true }) title = \"Title\";\n /** Controls whether the toast has fade animation during its appearance/disappearance */\n @property({ type: Boolean, reflect: true }) noAnimation = false;\n /** Controls if the toast will hide itself after the delay time. Works with delay property */\n @property({ type: Boolean, reflect: true }) autohide = false;\n /** The amount of time taken in miliseconds for toast to disappear after its first render. It takes effect only when autohide is set to true. Defaults to 5000ms */\n @property({ type: Number, reflect: true }) delay = 5000;\n /**The variant styles of toast */\n @property({ type: String, reflect: true }) variant: \"success\" | \"warning\" | \"danger\" | \"info\" = \"info\";\n /** Controls whether or not the Toast is dismissible */\n @property({ type: Boolean, reflect: true }) dismissable = false;\n\n /** Shows the toast */\n public async showToast() {\n if (this.show) {\n return;\n }\n\n this.show = true;\n return waitForEvent(this, \"sgds-after-show\");\n }\n\n /** Hide the toast */\n public async hideToast() {\n if (!this.show) {\n return;\n }\n this.show = false;\n return waitForEvent(this, \"sgds-after-hide\");\n }\n\n /** @internal */\n handleCloseClick() {\n this.show = false;\n this.emit(\"sgds-close\");\n }\n /**@internal */\n @watch(\"show\", { waitUntilFirstUpdate: true })\n async handleShowChange() {\n if (this.show) {\n this.emit(\"sgds-show\");\n this.toast.classList.remove(\"d-none\");\n const toastAnimation = getAnimation(this, \"toast.show\");\n\n if (!this.noAnimation) {\n await animateTo(this.toast, toastAnimation.keyframes, toastAnimation.options);\n }\n\n this.emit(\"sgds-after-show\");\n } else {\n this.emit(\"sgds-hide\");\n\n const toastAnimation = getAnimation(this, \"toast.hide\");\n if (!this.noAnimation) {\n await animateTo(this.toast, toastAnimation.keyframes, toastAnimation.options);\n }\n this.toast.classList.add(\"d-none\");\n\n this.emit(\"sgds-after-hide\");\n }\n }\n\n protected firstUpdated(): void {\n if (!this.show) {\n this.toast.classList.add(\"d-none\");\n }\n\n if (this._actionNodes.length === 0) {\n return this.shadowRoot.querySelector(\"slot[name='action']\")?.classList.add(\"d-none\");\n }\n }\n\n @queryAssignedNodes({ slot: \"action\", flatten: true })\n _actionNodes!: Array<Node>;\n\n render() {\n if (this.autohide && this.show) {\n setTimeout(() => {\n this.show = false;\n }, this.delay);\n }\n return html`\n <div\n class=\"toast\"\n role=\"alert\"\n aria-hidden=${this.show ? \"false\" : \"true\"}\n aria-live=\"assertive\"\n aria-atomic=\"true\"\n >\n <i>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n fill=\"currentColor\"\n class=\"bi bi-airplane\"\n viewBox=\"0 0 16 16\"\n >\n <path\n d=\"M6.428 1.151C6.708.591 7.213 0 8 0s1.292.592 1.572 1.151C9.861 1.73 10 2.431 10 3v3.691l5.17 2.585a1.5 1.5 0 0 1 .83 1.342V12a.5.5 0 0 1-.582.493l-5.507-.918-.375 2.253 1.318 1.318A.5.5 0 0 1 10.5 16h-5a.5.5 0 0 1-.354-.854l1.319-1.318-.376-2.253-5.507.918A.5.5 0 0 1 0 12v-1.382a1.5 1.5 0 0 1 .83-1.342L6 6.691V3c0-.568.14-1.271.428-1.849Zm.894.448C7.111 2.02 7 2.569 7 3v4a.5.5 0 0 1-.276.447l-5.448 2.724a.5.5 0 0 0-.276.447v.792l5.418-.903a.5.5 0 0 1 .575.41l.5 3a.5.5 0 0 1-.14.437L6.708 15h2.586l-.647-.646a.5.5 0 0 1-.14-.436l.5-3a.5.5 0 0 1 .576-.411L15 11.41v-.792a.5.5 0 0 0-.276-.447L9.276 7.447A.5.5 0 0 1 9 7V3c0-.432-.11-.979-.322-1.401C8.458 1.159 8.213 1 8 1c-.213 0-.458.158-.678.599Z\"\n ></path>\n </svg>\n </i>\n <div class=\"toast-content\">\n <div class=\"toast-body\">\n <strong>${this.title}</strong>\n <slot></slot>\n </div>\n <slot class=\"toast-action\" name=\"action\"></slot>\n </div>\n ${this.dismissable\n ? html`<sgds-close-button\n class=\"close-btn\"\n ariaLabel=\"close toast\"\n @click=${this.handleCloseClick}\n ></sgds-close-button>`\n : nothing}\n </div>\n `;\n }\n}\n\nexport default SgdsToast;\n\nsetDefaultAnimation(\"toast.show\", {\n keyframes: [{ opacity: 0 }, { opacity: 1 }],\n options: { duration: 400, easing: \"ease\" }\n});\nsetDefaultAnimation(\"toast.hide\", {\n keyframes: [{ opacity: 1 }, { opacity: 0 }],\n options: { duration: 400, easing: \"ease\" }\n});\n"],"names":["ScopedElementsMixin","SgdsElement","SgdsCloseButton","waitForEvent","getAnimation","animateTo","html","nothing","toastStyle","__decorate","query","property","watch","queryAssignedNodes","setDefaultAnimation"],"mappings":";;;;;;;;;;;;;;;;;AAUA;;;;;;;;;;;;;AAaG;MACU,SAAU,SAAQA,kCAAmB,CAACC,sBAAW,CAAC,CAAA;AAA/D,IAAA,WAAA,GAAA;;;QAY8C,IAAI,CAAA,IAAA,GAAG,KAAK,CAAC;;QAEd,IAAK,CAAA,KAAA,GAAG,OAAO,CAAC;;QAEf,IAAW,CAAA,WAAA,GAAG,KAAK,CAAC;;QAEpB,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;;QAElB,IAAK,CAAA,KAAA,GAAG,I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EAAE,MAAM,EAAE;AAC3C,CAAA,CAAC;;;;;"}
|
|
1
|
+
{"version":3,"file":"sgds-toast.cjs.js","sources":["../../../../src/components/Toast/sgds-toast.ts"],"sourcesContent":["import { ScopedElementsMixin } from \"@open-wc/scoped-elements\";\nimport { html, nothing } from \"lit\";\nimport { property, query, queryAssignedNodes } from \"lit/decorators.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport SgdsCloseButton from \"../../internals/CloseButton/sgds-close-button\";\nimport { animateTo } from \"../../utils/animate\";\nimport { getAnimation, setDefaultAnimation } from \"../../utils/animation-registry\";\nimport { waitForEvent } from \"../../utils/event\";\nimport { watch } from \"../../utils/watch\";\nimport toastStyle from \"./toast.css\";\n/**\n * @summary Toast allows you to convey quick messaging notifications to the user.\n *\n * @slot default - The content to pass into toast's body \n * @slot action - The content to pass into toast's action \n * @slot icon - The icon in toast\n * \n *\n * @event sgds-show - Emitted on show.\n * @event sgds-after-show - Emitted on show after animation has completed.\n * @event sgds-hide - Emitted on hide.\n * @event sgds-after-hide - Emitted on hide after animation has completed.\n \n * @cssproperty --toast-icon-margin-right - The margin right between toast's icon and title in its header.\n */\nexport class SgdsToast extends ScopedElementsMixin(SgdsElement) {\n static styles = [...SgdsElement.styles, toastStyle];\n /**@internal */\n static get scopedElements() {\n return {\n \"sgds-close-button\": SgdsCloseButton\n };\n }\n\n /**@internal */\n @query(\"div.toast\") toast: HTMLElement;\n /** Controls the appearance of toast */\n @property({ type: Boolean, reflect: true }) show = false;\n /** The header title of toast. It is required to assign a title to toast */\n @property({ type: String, reflect: true }) title = \"Title\";\n /** Controls whether the toast has fade animation during its appearance/disappearance */\n @property({ type: Boolean, reflect: true }) noAnimation = false;\n /** Controls if the toast will hide itself after the delay time. Works with delay property */\n @property({ type: Boolean, reflect: true }) autohide = false;\n /** The amount of time taken in miliseconds for toast to disappear after its first render. It takes effect only when autohide is set to true. Defaults to 5000ms */\n @property({ type: Number, reflect: true }) delay = 5000;\n /**The variant styles of toast */\n @property({ type: String, reflect: true }) variant: \"success\" | \"warning\" | \"danger\" | \"info\" = \"info\";\n /** Controls whether or not the Toast is dismissible */\n @property({ type: Boolean, reflect: true }) dismissible = false;\n\n /** Shows the toast */\n public async showToast() {\n if (this.show) {\n return;\n }\n\n this.show = true;\n return waitForEvent(this, \"sgds-after-show\");\n }\n\n /** Hide the toast */\n public async hideToast() {\n if (!this.show) {\n return;\n }\n this.show = false;\n return waitForEvent(this, \"sgds-after-hide\");\n }\n\n /** @internal */\n handleCloseClick() {\n this.show = false;\n this.emit(\"sgds-close\");\n }\n /**@internal */\n @watch(\"show\", { waitUntilFirstUpdate: true })\n async handleShowChange() {\n if (this.show) {\n this.emit(\"sgds-show\");\n this.toast.classList.remove(\"d-none\");\n const toastAnimation = getAnimation(this, \"toast.show\");\n\n if (!this.noAnimation) {\n await animateTo(this.toast, toastAnimation.keyframes, toastAnimation.options);\n }\n\n this.emit(\"sgds-after-show\");\n } else {\n this.emit(\"sgds-hide\");\n\n const toastAnimation = getAnimation(this, \"toast.hide\");\n if (!this.noAnimation) {\n await animateTo(this.toast, toastAnimation.keyframes, toastAnimation.options);\n }\n this.toast.classList.add(\"d-none\");\n\n this.emit(\"sgds-after-hide\");\n }\n }\n\n protected firstUpdated(): void {\n if (!this.show) {\n this.toast.classList.add(\"d-none\");\n }\n\n if (this._actionNodes.length === 0) {\n return this.shadowRoot.querySelector(\"slot[name='action']\")?.classList.add(\"d-none\");\n }\n }\n\n @queryAssignedNodes({ slot: \"action\", flatten: true })\n _actionNodes!: Array<Node>;\n\n render() {\n if (this.autohide && this.show) {\n setTimeout(() => {\n this.show = false;\n }, this.delay);\n }\n return html`\n <div\n class=\"toast\"\n role=\"alert\"\n aria-hidden=${this.show ? \"false\" : \"true\"}\n aria-live=\"assertive\"\n aria-atomic=\"true\"\n >\n <slot name=\"icon\"></slot>\n <div class=\"toast-content\">\n <div class=\"toast-body\">\n <strong>${this.title}</strong>\n <span><slot></slot></span>\n </div>\n <slot class=\"toast-action\" name=\"action\"></slot>\n </div>\n ${this.dismissible\n ? html`<sgds-close-button\n class=\"close-btn\"\n ariaLabel=\"close toast\"\n @click=${this.handleCloseClick}\n ></sgds-close-button>`\n : nothing}\n </div>\n `;\n }\n}\n\nexport default SgdsToast;\n\nsetDefaultAnimation(\"toast.show\", {\n keyframes: [{ opacity: 0 }, { opacity: 1 }],\n options: { duration: 400, easing: \"ease\" }\n});\nsetDefaultAnimation(\"toast.hide\", {\n keyframes: [{ opacity: 1 }, { opacity: 0 }],\n options: { duration: 400, easing: \"ease\" }\n});\n"],"names":["ScopedElementsMixin","SgdsElement","SgdsCloseButton","waitForEvent","getAnimation","animateTo","html","nothing","toastStyle","__decorate","query","property","watch","queryAssignedNodes","setDefaultAnimation"],"mappings":";;;;;;;;;;;;;;;;;AAUA;;;;;;;;;;;;;;AAcG;MACU,SAAU,SAAQA,kCAAmB,CAACC,sBAAW,CAAC,CAAA;AAA/D,IAAA,WAAA,GAAA;;;QAY8C,IAAI,CAAA,IAAA,GAAG,KAAK,CAAC;;QAEd,IAAK,CAAA,KAAA,GAAG,OAAO,CAAC;;QAEf,IAAW,CAAA,WAAA,GAAG,KAAK,CAAC;;QAEpB,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;;QAElB,IAAK,CAAA,KAAA,GAAG,IAAI,CAAC;;QAEb,IAAO,CAAA,OAAA,GAA8C,MAAM,CAAC;;QAE3D,IAAW,CAAA,WAAA,GAAG,KAAK,CAAC;KAiGjE;;AAtHC,IAAA,WAAW,cAAc,GAAA;QACvB,OAAO;AACL,YAAA,mBAAmB,EAAEC,+BAAe;SACrC,CAAC;KACH;;AAoBM,IAAA,MAAM,SAAS,GAAA;AACpB,QAAA,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,OAAO;SACR;AAED,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACjB,QAAA,OAAOC,kBAAY,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;KAC9C;;AAGM,I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AAA,CAAA,CAAA;AA4B1DF,gBAAA,CAAA;IADLG,WAAK,CAAC,MAAM,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAuB7C,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,kBAAA,EAAA,IAAA,CAAA,CAAA;AAaDH,gBAAA,CAAA;IADCI,gCAAkB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,cAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAsC7BC,qCAAmB,CAAC,YAAY,EAAE;AAChC,IAAA,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IAC3C,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE;AAC3C,CAAA,CAAC,CAAC;AACHA,qCAAmB,CAAC,YAAY,EAAE;AAChC,IAAA,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IAC3C,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE;AAC3C,CAAA,CAAC;;;;;"}
|
|
@@ -16,6 +16,7 @@ import css_248z from './toast.js';
|
|
|
16
16
|
*
|
|
17
17
|
* @slot default - The content to pass into toast's body
|
|
18
18
|
* @slot action - The content to pass into toast's action
|
|
19
|
+
* @slot icon - The icon in toast
|
|
19
20
|
*
|
|
20
21
|
*
|
|
21
22
|
* @event sgds-show - Emitted on show.
|
|
@@ -41,7 +42,7 @@ class SgdsToast extends ScopedElementsMixin(SgdsElement) {
|
|
|
41
42
|
/**The variant styles of toast */
|
|
42
43
|
this.variant = "info";
|
|
43
44
|
/** Controls whether or not the Toast is dismissible */
|
|
44
|
-
this.
|
|
45
|
+
this.dismissible = false;
|
|
45
46
|
}
|
|
46
47
|
/**@internal */
|
|
47
48
|
static get scopedElements() {
|
|
@@ -114,28 +115,15 @@ class SgdsToast extends ScopedElementsMixin(SgdsElement) {
|
|
|
114
115
|
aria-live="assertive"
|
|
115
116
|
aria-atomic="true"
|
|
116
117
|
>
|
|
117
|
-
<
|
|
118
|
-
<svg
|
|
119
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
120
|
-
width="16"
|
|
121
|
-
height="16"
|
|
122
|
-
fill="currentColor"
|
|
123
|
-
class="bi bi-airplane"
|
|
124
|
-
viewBox="0 0 16 16"
|
|
125
|
-
>
|
|
126
|
-
<path
|
|
127
|
-
d="M6.428 1.151C6.708.591 7.213 0 8 0s1.292.592 1.572 1.151C9.861 1.73 10 2.431 10 3v3.691l5.17 2.585a1.5 1.5 0 0 1 .83 1.342V12a.5.5 0 0 1-.582.493l-5.507-.918-.375 2.253 1.318 1.318A.5.5 0 0 1 10.5 16h-5a.5.5 0 0 1-.354-.854l1.319-1.318-.376-2.253-5.507.918A.5.5 0 0 1 0 12v-1.382a1.5 1.5 0 0 1 .83-1.342L6 6.691V3c0-.568.14-1.271.428-1.849Zm.894.448C7.111 2.02 7 2.569 7 3v4a.5.5 0 0 1-.276.447l-5.448 2.724a.5.5 0 0 0-.276.447v.792l5.418-.903a.5.5 0 0 1 .575.41l.5 3a.5.5 0 0 1-.14.437L6.708 15h2.586l-.647-.646a.5.5 0 0 1-.14-.436l.5-3a.5.5 0 0 1 .576-.411L15 11.41v-.792a.5.5 0 0 0-.276-.447L9.276 7.447A.5.5 0 0 1 9 7V3c0-.432-.11-.979-.322-1.401C8.458 1.159 8.213 1 8 1c-.213 0-.458.158-.678.599Z"
|
|
128
|
-
></path>
|
|
129
|
-
</svg>
|
|
130
|
-
</i>
|
|
118
|
+
<slot name="icon"></slot>
|
|
131
119
|
<div class="toast-content">
|
|
132
120
|
<div class="toast-body">
|
|
133
121
|
<strong>${this.title}</strong>
|
|
134
|
-
<slot></slot>
|
|
122
|
+
<span><slot></slot></span>
|
|
135
123
|
</div>
|
|
136
124
|
<slot class="toast-action" name="action"></slot>
|
|
137
125
|
</div>
|
|
138
|
-
${this.
|
|
126
|
+
${this.dismissible
|
|
139
127
|
? html `<sgds-close-button
|
|
140
128
|
class="close-btn"
|
|
141
129
|
ariaLabel="close toast"
|
|
@@ -170,7 +158,7 @@ __decorate([
|
|
|
170
158
|
], SgdsToast.prototype, "variant", void 0);
|
|
171
159
|
__decorate([
|
|
172
160
|
property({ type: Boolean, reflect: true })
|
|
173
|
-
], SgdsToast.prototype, "
|
|
161
|
+
], SgdsToast.prototype, "dismissible", void 0);
|
|
174
162
|
__decorate([
|
|
175
163
|
watch("show", { waitUntilFirstUpdate: true })
|
|
176
164
|
], SgdsToast.prototype, "handleShowChange", null);
|