@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,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { SgdsFormControl } from "../../utils/
|
|
1
|
+
import FormControlElement from "../../base/form-control-element";
|
|
2
|
+
import { SgdsFormControl } from "../../utils/formSubmitController";
|
|
3
|
+
declare const SgdsTextarea_base: (new (...args: any[]) => import("../../utils/validatorMixin").ToBeValidatedElementInterface) & typeof FormControlElement;
|
|
3
4
|
/**
|
|
4
5
|
* @summary Text areas allow for the collection of input longer than a single line.
|
|
5
6
|
*
|
|
@@ -8,23 +9,19 @@ import { SgdsFormControl } from "../../utils/form";
|
|
|
8
9
|
* @event sgds-focus - Emitted when textarea is in focus.
|
|
9
10
|
* @event sgds-blur - Emitted when textarea loses focus.
|
|
10
11
|
*/
|
|
11
|
-
export declare class SgdsTextarea extends
|
|
12
|
+
export declare class SgdsTextarea extends SgdsTextarea_base implements SgdsFormControl {
|
|
12
13
|
static styles: import("lit").CSSResult[];
|
|
13
14
|
/**@internal */
|
|
14
15
|
textarea: HTMLTextAreaElement;
|
|
15
16
|
/**@internal */
|
|
16
|
-
private readonly formSubmitController;
|
|
17
|
-
/**@internal */
|
|
18
17
|
private resizeObserver;
|
|
19
|
-
/**The textarea's label */
|
|
20
|
-
label: string;
|
|
21
18
|
/**The textarea's name attribute */
|
|
22
19
|
name: string;
|
|
23
20
|
/**The textarea's value attribute. */
|
|
24
21
|
value: string;
|
|
25
22
|
/**Sets the minimum length of the textarea */
|
|
26
23
|
minlength: number;
|
|
27
|
-
/**Sets the maximum length of the textarea */
|
|
24
|
+
/**Sets the maximum length of the textarea. When maxlength is defined, a word count appears on bottom right of the input*/
|
|
28
25
|
maxlength: number;
|
|
29
26
|
/**Enables spell checking on the textarea */
|
|
30
27
|
spellcheck: boolean;
|
|
@@ -32,14 +29,10 @@ export declare class SgdsTextarea extends SgdsElement implements SgdsFormControl
|
|
|
32
29
|
rows: number;
|
|
33
30
|
/**The textarea's placeholder text. */
|
|
34
31
|
placeholder: string;
|
|
35
|
-
/**
|
|
32
|
+
/** Custom feedback text for error state when validated */
|
|
36
33
|
invalidFeedback: string;
|
|
37
34
|
/**Autofocus the textarea */
|
|
38
35
|
autofocus: boolean;
|
|
39
|
-
/**Disables the textarea. */
|
|
40
|
-
disabled: boolean;
|
|
41
|
-
/**Makes the textarea a required field. */
|
|
42
|
-
required: boolean;
|
|
43
36
|
/** Makes the textarea readonly. */
|
|
44
37
|
readonly: boolean;
|
|
45
38
|
/** Controls how the textarea can be resized. */
|
|
@@ -52,32 +45,50 @@ export declare class SgdsTextarea extends SgdsElement implements SgdsFormControl
|
|
|
52
45
|
defaultValue: string;
|
|
53
46
|
/** Allows invalidFeedback, invalid and valid styles to be visible with the input */
|
|
54
47
|
hasFeedback: boolean;
|
|
55
|
-
/**
|
|
56
|
-
|
|
48
|
+
/** Makes the textarea as a required field. */
|
|
49
|
+
required: boolean;
|
|
57
50
|
/** The textarea's hint text */
|
|
58
51
|
hintText: string;
|
|
59
|
-
|
|
60
|
-
private textareaId;
|
|
61
|
-
connectedCallback(): void;
|
|
62
|
-
disconnectedCallback(): void;
|
|
52
|
+
private _isTouched;
|
|
63
53
|
/** Sets focus on the textarea. */
|
|
64
54
|
focus(options?: FocusOptions): void;
|
|
65
|
-
/**
|
|
55
|
+
/** Sets blur on the textarea. */
|
|
56
|
+
blur(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
|
|
59
|
+
* 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
|
|
60
|
+
*/
|
|
66
61
|
reportValidity(): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Checks for validity without any native error popup message
|
|
64
|
+
*/
|
|
65
|
+
checkValidity(): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Returns the ValidityState object
|
|
68
|
+
*/
|
|
69
|
+
get validity(): ValidityState;
|
|
70
|
+
/**
|
|
71
|
+
* Returns the validation message based on the ValidityState
|
|
72
|
+
*/
|
|
73
|
+
get validationMessage(): string;
|
|
67
74
|
/** Selects all the text in the textarea. */
|
|
68
75
|
select(): void;
|
|
69
76
|
private _handleInvalid;
|
|
70
|
-
|
|
77
|
+
protected _handleChange(e: Event): void;
|
|
78
|
+
private _handleInputChange;
|
|
71
79
|
private _handleFocus;
|
|
72
|
-
private
|
|
80
|
+
private _handleBlur;
|
|
73
81
|
/** @internal */
|
|
74
82
|
_handleRowsChange(): void;
|
|
75
83
|
private _setTextareaHeight;
|
|
76
84
|
/** @internal */
|
|
85
|
+
_handleIsTouched(): void;
|
|
86
|
+
/** @internal */
|
|
77
87
|
_handleDisabledChange(): void;
|
|
78
88
|
/** @internal */
|
|
79
89
|
_handleValueChange(): void;
|
|
80
90
|
protected _renderHintText(): import("lit-html").TemplateResult;
|
|
91
|
+
private _wordCount;
|
|
81
92
|
render(): import("lit-html").TemplateResult;
|
|
82
93
|
}
|
|
83
94
|
export default SgdsTextarea;
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
|
-
import {
|
|
2
|
+
import { nothing } from 'lit';
|
|
3
|
+
import { query, property, state } from 'lit/decorators.js';
|
|
3
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
5
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
6
|
import { live } from 'lit/directives/live.js';
|
|
6
7
|
import { html } from 'lit/static-html.js';
|
|
7
|
-
import
|
|
8
|
+
import FormControlElement from '../../base/form-control-element.js';
|
|
8
9
|
import { defaultValue } from '../../utils/defaultvalue.js';
|
|
9
|
-
import {
|
|
10
|
-
import genId from '../../utils/generateId.js';
|
|
10
|
+
import { SgdsFormValidatorMixin } from '../../utils/validatorMixin.js';
|
|
11
11
|
import { watch } from '../../utils/watch.js';
|
|
12
|
-
import css_248z
|
|
13
|
-
import css_248z$2 from '../../styles/feedback.js';
|
|
14
|
-
import css_248z$1 from '../../styles/form-label.js';
|
|
15
|
-
import css_248z from '../../styles/form-hint.js';
|
|
16
|
-
import css_248z$3 from '../../styles/form-placeholder.js';
|
|
12
|
+
import css_248z from './textarea.js';
|
|
17
13
|
|
|
18
14
|
/**
|
|
19
15
|
* @summary Text areas allow for the collection of input longer than a single line.
|
|
@@ -23,13 +19,9 @@ import css_248z$3 from '../../styles/form-placeholder.js';
|
|
|
23
19
|
* @event sgds-focus - Emitted when textarea is in focus.
|
|
24
20
|
* @event sgds-blur - Emitted when textarea loses focus.
|
|
25
21
|
*/
|
|
26
|
-
class SgdsTextarea extends
|
|
22
|
+
class SgdsTextarea extends SgdsFormValidatorMixin(FormControlElement) {
|
|
27
23
|
constructor() {
|
|
28
24
|
super(...arguments);
|
|
29
|
-
/**@internal */
|
|
30
|
-
this.formSubmitController = new FormSubmitController(this);
|
|
31
|
-
/**The textarea's label */
|
|
32
|
-
this.label = "label";
|
|
33
25
|
/**The textarea's value attribute. */
|
|
34
26
|
this.value = "";
|
|
35
27
|
/**Enables spell checking on the textarea */
|
|
@@ -38,14 +30,10 @@ class SgdsTextarea extends SgdsElement {
|
|
|
38
30
|
this.rows = 4;
|
|
39
31
|
/**The textarea's placeholder text. */
|
|
40
32
|
this.placeholder = "Placeholder";
|
|
41
|
-
/**
|
|
33
|
+
/** Custom feedback text for error state when validated */
|
|
42
34
|
this.invalidFeedback = "";
|
|
43
35
|
/**Autofocus the textarea */
|
|
44
36
|
this.autofocus = false;
|
|
45
|
-
/**Disables the textarea. */
|
|
46
|
-
this.disabled = false;
|
|
47
|
-
/**Makes the textarea a required field. */
|
|
48
|
-
this.required = false;
|
|
49
37
|
/** Makes the textarea readonly. */
|
|
50
38
|
this.readonly = false;
|
|
51
39
|
/** Controls how the textarea can be resized. */
|
|
@@ -54,32 +42,44 @@ class SgdsTextarea extends SgdsElement {
|
|
|
54
42
|
this.defaultValue = "";
|
|
55
43
|
/** Allows invalidFeedback, invalid and valid styles to be visible with the input */
|
|
56
44
|
this.hasFeedback = false;
|
|
57
|
-
/**
|
|
58
|
-
this.
|
|
45
|
+
/** Makes the textarea as a required field. */
|
|
46
|
+
this.required = false;
|
|
59
47
|
/** The textarea's hint text */
|
|
60
48
|
this.hintText = "";
|
|
61
|
-
|
|
62
|
-
this.textareaId = genId("textarea", "input");
|
|
63
|
-
}
|
|
64
|
-
connectedCallback() {
|
|
65
|
-
super.connectedCallback();
|
|
66
|
-
this.resizeObserver = new ResizeObserver(() => this._setTextareaHeight());
|
|
67
|
-
this.updateComplete.then(() => {
|
|
68
|
-
this._setTextareaHeight();
|
|
69
|
-
this.resizeObserver.observe(this.textarea);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
disconnectedCallback() {
|
|
73
|
-
super.disconnectedCallback();
|
|
74
|
-
this.resizeObserver.unobserve(this.textarea);
|
|
49
|
+
this._isTouched = false;
|
|
75
50
|
}
|
|
76
51
|
/** Sets focus on the textarea. */
|
|
77
52
|
focus(options) {
|
|
78
53
|
this.textarea.focus(options);
|
|
79
54
|
}
|
|
80
|
-
/**
|
|
55
|
+
/** Sets blur on the textarea. */
|
|
56
|
+
blur() {
|
|
57
|
+
this.textarea.blur();
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
|
|
61
|
+
* 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
|
|
62
|
+
*/
|
|
81
63
|
reportValidity() {
|
|
82
|
-
return this.
|
|
64
|
+
return this._mixinReportValidity();
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Checks for validity without any native error popup message
|
|
68
|
+
*/
|
|
69
|
+
checkValidity() {
|
|
70
|
+
return this._mixinCheckValidity();
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Returns the ValidityState object
|
|
74
|
+
*/
|
|
75
|
+
get validity() {
|
|
76
|
+
return this._mixinGetValidity();
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Returns the validation message based on the ValidityState
|
|
80
|
+
*/
|
|
81
|
+
get validationMessage() {
|
|
82
|
+
return this._mixinGetValidationMessage();
|
|
83
83
|
}
|
|
84
84
|
/** Selects all the text in the textarea. */
|
|
85
85
|
select() {
|
|
@@ -89,14 +89,21 @@ class SgdsTextarea extends SgdsElement {
|
|
|
89
89
|
e.preventDefault();
|
|
90
90
|
this.invalid = true;
|
|
91
91
|
}
|
|
92
|
-
_handleChange(
|
|
93
|
-
this.value = this.
|
|
94
|
-
this.emit(
|
|
92
|
+
_handleChange(e) {
|
|
93
|
+
this.value = this.input.value;
|
|
94
|
+
this.emit("sgds-change");
|
|
95
|
+
super._mixinHandleChange(e);
|
|
96
|
+
}
|
|
97
|
+
_handleInputChange(e) {
|
|
98
|
+
this.value = this.input.value;
|
|
99
|
+
this.emit("sgds-input");
|
|
100
|
+
super._mixinHandleInputChange(e);
|
|
95
101
|
}
|
|
96
102
|
_handleFocus() {
|
|
97
103
|
this.emit("sgds-focus");
|
|
98
104
|
}
|
|
99
|
-
|
|
105
|
+
_handleBlur() {
|
|
106
|
+
this._isTouched = true;
|
|
100
107
|
this.emit("sgds-blur");
|
|
101
108
|
}
|
|
102
109
|
/** @internal */
|
|
@@ -113,23 +120,26 @@ class SgdsTextarea extends SgdsElement {
|
|
|
113
120
|
}
|
|
114
121
|
}
|
|
115
122
|
/** @internal */
|
|
123
|
+
_handleIsTouched() {
|
|
124
|
+
if (this._isTouched) {
|
|
125
|
+
this.invalid = !this.textarea.checkValidity();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/** @internal */
|
|
116
129
|
_handleDisabledChange() {
|
|
117
130
|
// Disabled form controls are always valid, so we need to recheck validity when the state changes
|
|
118
|
-
this.
|
|
119
|
-
this.invalid = !this.textarea.checkValidity();
|
|
131
|
+
this.setInvalid(false);
|
|
120
132
|
}
|
|
121
133
|
/** @internal */
|
|
122
134
|
_handleValueChange() {
|
|
123
|
-
this.invalid = !this.textarea.checkValidity();
|
|
124
135
|
this.updateComplete.then(() => this._setTextareaHeight());
|
|
125
136
|
}
|
|
126
137
|
_renderHintText() {
|
|
127
|
-
const hintTextTemplate = html ` <div id="${this.
|
|
138
|
+
const hintTextTemplate = html ` <div id="${this._controlId}Help" class="form-text">${this.hintText}</div> `;
|
|
128
139
|
return this.hintText && hintTextTemplate;
|
|
129
140
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const wordCount = html `
|
|
141
|
+
_wordCount() {
|
|
142
|
+
return html `
|
|
133
143
|
<div
|
|
134
144
|
class="form-text word-count ${classMap({
|
|
135
145
|
"invalid-feedback": this.invalid && this.hasFeedback
|
|
@@ -138,13 +148,15 @@ class SgdsTextarea extends SgdsElement {
|
|
|
138
148
|
${this.value.length}/${this.maxlength}
|
|
139
149
|
</div>
|
|
140
150
|
`;
|
|
151
|
+
}
|
|
152
|
+
render() {
|
|
141
153
|
return html `
|
|
142
154
|
<div
|
|
143
155
|
class="form-control-container ${classMap({
|
|
144
156
|
disabled: this.disabled
|
|
145
157
|
})}"
|
|
146
158
|
>
|
|
147
|
-
<label for=${this.
|
|
159
|
+
<label for=${this._controlId} class="form-label">${this.label}</label>
|
|
148
160
|
<textarea
|
|
149
161
|
class=${classMap({
|
|
150
162
|
"form-control": true,
|
|
@@ -153,7 +165,7 @@ class SgdsTextarea extends SgdsElement {
|
|
|
153
165
|
"textarea-resize-vertical": this.resize === "vertical",
|
|
154
166
|
"textarea-resize-auto": this.resize === "auto"
|
|
155
167
|
})}
|
|
156
|
-
id=${this.
|
|
168
|
+
id=${this._controlId}
|
|
157
169
|
name=${ifDefined(this.name)}
|
|
158
170
|
rows=${ifDefined(this.rows)}
|
|
159
171
|
placeholder=${ifDefined(this.placeholder)}
|
|
@@ -168,13 +180,12 @@ class SgdsTextarea extends SgdsElement {
|
|
|
168
180
|
?autofocus=${this.autofocus}
|
|
169
181
|
autocorrect=${ifDefined(this.autocorrect)}
|
|
170
182
|
inputmode=${ifDefined(this.inputmode)}
|
|
171
|
-
@input=${() => this.
|
|
172
|
-
@change=${() => this._handleChange(
|
|
183
|
+
@input=${(e) => this._handleInputChange(e)}
|
|
184
|
+
@change=${(e) => this._handleChange(e)}
|
|
173
185
|
@invalid=${(e) => this._handleInvalid(e)}
|
|
174
186
|
@focus=${this._handleFocus}
|
|
175
|
-
@blur=${this.
|
|
176
|
-
>
|
|
177
|
-
</textarea>
|
|
187
|
+
@blur=${this._handleBlur}
|
|
188
|
+
></textarea>
|
|
178
189
|
<div class="textarea-info-container">
|
|
179
190
|
${this.invalid && this.hasFeedback
|
|
180
191
|
? html `
|
|
@@ -185,30 +196,22 @@ class SgdsTextarea extends SgdsElement {
|
|
|
185
196
|
fill="#B90000"
|
|
186
197
|
/>
|
|
187
198
|
</svg>
|
|
188
|
-
<div id="${this.
|
|
199
|
+
<div id="${this._controlId}-invalid" class="invalid-feedback">
|
|
200
|
+
${this.invalidFeedback ? this.invalidFeedback : this.input.validationMessage}
|
|
201
|
+
</div>
|
|
189
202
|
</div>
|
|
190
203
|
`
|
|
191
204
|
: html `${this._renderHintText()}`}
|
|
192
|
-
${this.maxlength > 0 ?
|
|
205
|
+
${this.maxlength > 0 ? this._wordCount() : nothing}
|
|
193
206
|
</div>
|
|
194
207
|
</div>
|
|
195
208
|
`;
|
|
196
209
|
}
|
|
197
210
|
}
|
|
198
|
-
SgdsTextarea.styles = [
|
|
199
|
-
...SgdsElement.styles,
|
|
200
|
-
css_248z,
|
|
201
|
-
css_248z$1,
|
|
202
|
-
css_248z$2,
|
|
203
|
-
css_248z$3,
|
|
204
|
-
css_248z$4
|
|
205
|
-
];
|
|
211
|
+
SgdsTextarea.styles = [...FormControlElement.styles, css_248z];
|
|
206
212
|
__decorate([
|
|
207
213
|
query("textarea.form-control")
|
|
208
214
|
], SgdsTextarea.prototype, "textarea", void 0);
|
|
209
|
-
__decorate([
|
|
210
|
-
property({ type: String, reflect: true })
|
|
211
|
-
], SgdsTextarea.prototype, "label", void 0);
|
|
212
215
|
__decorate([
|
|
213
216
|
property({ type: String, reflect: true })
|
|
214
217
|
], SgdsTextarea.prototype, "name", void 0);
|
|
@@ -236,12 +239,6 @@ __decorate([
|
|
|
236
239
|
__decorate([
|
|
237
240
|
property({ type: Boolean, reflect: true })
|
|
238
241
|
], SgdsTextarea.prototype, "autofocus", void 0);
|
|
239
|
-
__decorate([
|
|
240
|
-
property({ type: Boolean, reflect: true })
|
|
241
|
-
], SgdsTextarea.prototype, "disabled", void 0);
|
|
242
|
-
__decorate([
|
|
243
|
-
property({ type: Boolean, reflect: true })
|
|
244
|
-
], SgdsTextarea.prototype, "required", void 0);
|
|
245
242
|
__decorate([
|
|
246
243
|
property({ type: Boolean, reflect: true })
|
|
247
244
|
], SgdsTextarea.prototype, "readonly", void 0);
|
|
@@ -262,13 +259,19 @@ __decorate([
|
|
|
262
259
|
], SgdsTextarea.prototype, "hasFeedback", void 0);
|
|
263
260
|
__decorate([
|
|
264
261
|
property({ type: Boolean, reflect: true })
|
|
265
|
-
], SgdsTextarea.prototype, "
|
|
262
|
+
], SgdsTextarea.prototype, "required", void 0);
|
|
266
263
|
__decorate([
|
|
267
264
|
property({ reflect: true })
|
|
268
265
|
], SgdsTextarea.prototype, "hintText", void 0);
|
|
266
|
+
__decorate([
|
|
267
|
+
state()
|
|
268
|
+
], SgdsTextarea.prototype, "_isTouched", void 0);
|
|
269
269
|
__decorate([
|
|
270
270
|
watch("rows", { waitUntilFirstUpdate: true })
|
|
271
271
|
], SgdsTextarea.prototype, "_handleRowsChange", null);
|
|
272
|
+
__decorate([
|
|
273
|
+
watch("_isTouched", { waitUntilFirstUpdate: true })
|
|
274
|
+
], SgdsTextarea.prototype, "_handleIsTouched", null);
|
|
272
275
|
__decorate([
|
|
273
276
|
watch("disabled", { waitUntilFirstUpdate: true })
|
|
274
277
|
], 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","feed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D,UAAA,CAAA;AADC,IAAA,YAAY,EAAE;AACG,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,cAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAE0B,UAAA,CAAA;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAqB,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,aAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGpB,UAAA,CAAA;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAiB,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,SAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAG/B,UAAA,CAAA;AAA5B,IAAA,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAe,CAAA,EAAA,YAAA,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":";;;;;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,CAAA,SAAA,EAAA,UAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAE1B,UAAA,CAAA;AAAhB,IAAA,KAAK,EAAE;AAA4B,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,YAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAoEpC,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;AAYD,UAAA,CAAA;IADC,KAAK,CAAC,YAAY,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAKnD,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,kBAAA,EAAA,IAAA,CAAA,CAAA;AAID,UAAA,CAAA;IADC,KAAK,CAAC,UAAU,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,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;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
|
|
3
|
-
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)
|
|
3
|
+
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}`;
|
|
4
4
|
|
|
5
5
|
export { css_248z as default };
|
|
6
6
|
//# sourceMappingURL=textarea.js.map
|
|
@@ -4550,7 +4550,7 @@
|
|
|
4550
4550
|
*/
|
|
4551
4551
|
const ifDefined = (value) => value ?? nothing;
|
|
4552
4552
|
|
|
4553
|
-
var css_248z$2 = css`:host{--sgds-close-btn-border-radius:var(--sgds-border-radius-sm);display:inline-flex}.btn-close{background-color:var(--sgds-default-bg-transparent);border:0;border:var(--sgds-border-width-1) solid var(--sgds-default-border-color-transparent);border-radius:var(--sgds-close-btn-border-radius);cursor:pointer;height:var(--sgds-dimension-32);padding:0;position:relative;width:var(--sgds-dimension-32)}.btn-close:before{background-color:currentColor;border-radius:var(--sgds-border-radius);box-sizing:content-box;color:var(--sgds-default-color);content:"";height:var(--sgds-icon-size-
|
|
4553
|
+
var css_248z$2 = css`:host{--sgds-close-btn-border-radius:var(--sgds-border-radius-sm);display:inline-flex}.btn-close{background-color:var(--sgds-default-bg-transparent);border:0;border:var(--sgds-border-width-1) solid var(--sgds-default-border-color-transparent);border-radius:var(--sgds-close-btn-border-radius);cursor:pointer;height:var(--sgds-dimension-32);padding:0;position:relative;width:var(--sgds-dimension-32)}.btn-close:before{background-color:currentColor;border-radius:var(--sgds-border-radius);box-sizing:content-box;color:var(--sgds-default-color);content:"";height:var(--sgds-icon-size-md);left:50%;mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M5.614 5.614a.75.75 0 0 1 1.06 0l5.304 5.303 5.303-5.303a.75.75 0 0 1 1.06 1.06l-5.302 5.304 5.303 5.303a.75.75 0 0 1-1.06 1.06l-5.304-5.302-5.303 5.303a.75.75 0 0 1-1.061-1.06l5.303-5.304-5.303-5.303a.75.75 0 0 1 0-1.061Z'/%3E%3C/svg%3E");-webkit-mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M5.614 5.614a.75.75 0 0 1 1.06 0l5.304 5.303 5.303-5.303a.75.75 0 0 1 1.06 1.06l-5.302 5.304 5.303 5.303a.75.75 0 0 1-1.06 1.06l-5.304-5.302-5.303 5.303a.75.75 0 0 1-1.061-1.06l5.303-5.304-5.303-5.303a.75.75 0 0 1 0-1.061Z'/%3E%3C/svg%3E");mask-position:center;-webkit-mask-position:center;mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;position:absolute;top:50%;transform:translate(-50%,-50%);width:var(--sgds-icon-size-md)}.btn-close-light:before{color:var(--sgds-default-color-on-dark)}.btn-close-dark:before{color:var(--sgds-default-color-on-light)}.btn-close:hover{background-color:var(--sgds-default-bg-translucent)}.btn-close:focus,.btn-close:focus-visible{background-color:var(--sgds-default-bg-translucent);box-shadow:var(--sgds-box-shadow-focus);outline:0}.btn-close-sm{height:var(--sgds-dimension-24);width:var(--sgds-dimension-24)}.btn-close.btn-close-sm:before{height:var(--sgds-icon-size-sm);width:var(--sgds-icon-size-sm)}`;
|
|
4554
4554
|
|
|
4555
4555
|
/**
|
|
4556
4556
|
* @license
|
|
@@ -4720,7 +4720,7 @@
|
|
|
4720
4720
|
`;
|
|
4721
4721
|
}
|
|
4722
4722
|
}
|
|
4723
|
-
SgdsCloseButton.styles = [css_248z$2];
|
|
4723
|
+
SgdsCloseButton.styles = [...SgdsElement.styles, css_248z$2];
|
|
4724
4724
|
__decorate([
|
|
4725
4725
|
property({ type: String })
|
|
4726
4726
|
], SgdsCloseButton.prototype, "ariaLabel", void 0);
|
|
@@ -4842,13 +4842,14 @@
|
|
|
4842
4842
|
};
|
|
4843
4843
|
}
|
|
4844
4844
|
|
|
4845
|
-
var css_248z$1 = css`:host{--sgds-toast-border-radius:var(--sgds-border-radius-md)}
|
|
4845
|
+
var css_248z$1 = css`:host{--sgds-toast-border-radius:var(--sgds-border-radius-md)}:host([variant=info]) slot[name=icon]::slotted(*){color:var(--sgds-primary-color)}:host([variant=success]) slot[name=icon]::slotted(*){color:var(--sgds-success-color)}:host([variant=danger]) slot[name=icon]::slotted(*){color:var(--sgds-danger-color)}:host([variant=warning]) slot[name=icon]::slotted(*){color:var(--sgds-warning-color)}.toast{align-items:flex-start;background-clip:padding-box;background-color:var(--sgds-neutral-bg-inverse);border-radius:var(--sgds-border-radius-md);box-shadow:0 0 2px 0 rgba(0,0,0,.12),0 8px 16px 0 rgba(0,0,0,.14);display:flex;flex-direction:row;gap:var(--sgds-gap-xs);max-width:var(--sgds-dimension-480);min-width:var(--sgds-dimension-320);padding:var(--sgds-padding-md);pointer-events:auto;width:320px}.toast-content{word-wrap:break-word;gap:var(--sgds-gap-sm)}.toast-body,.toast-content{display:flex;flex-direction:column}.toast-body strong{line-height:var(--sgds-line-height-min)}.toast-body span{color:var(--sgds-default-color-subtle)}.toast-action{word-wrap:break-word;color:var(--sgds-primary-color)}.toast-header strong{margin-right:auto;word-break:break-all}.close-btn{margin-left:auto}.d-none{display:none}`;
|
|
4846
4846
|
|
|
4847
4847
|
/**
|
|
4848
4848
|
* @summary Toast allows you to convey quick messaging notifications to the user.
|
|
4849
4849
|
*
|
|
4850
4850
|
* @slot default - The content to pass into toast's body
|
|
4851
4851
|
* @slot action - The content to pass into toast's action
|
|
4852
|
+
* @slot icon - The icon in toast
|
|
4852
4853
|
*
|
|
4853
4854
|
*
|
|
4854
4855
|
* @event sgds-show - Emitted on show.
|
|
@@ -4874,7 +4875,7 @@
|
|
|
4874
4875
|
/**The variant styles of toast */
|
|
4875
4876
|
this.variant = "info";
|
|
4876
4877
|
/** Controls whether or not the Toast is dismissible */
|
|
4877
|
-
this.
|
|
4878
|
+
this.dismissible = false;
|
|
4878
4879
|
}
|
|
4879
4880
|
/**@internal */
|
|
4880
4881
|
static get scopedElements() {
|
|
@@ -4947,28 +4948,15 @@
|
|
|
4947
4948
|
aria-live="assertive"
|
|
4948
4949
|
aria-atomic="true"
|
|
4949
4950
|
>
|
|
4950
|
-
<
|
|
4951
|
-
<svg
|
|
4952
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
4953
|
-
width="16"
|
|
4954
|
-
height="16"
|
|
4955
|
-
fill="currentColor"
|
|
4956
|
-
class="bi bi-airplane"
|
|
4957
|
-
viewBox="0 0 16 16"
|
|
4958
|
-
>
|
|
4959
|
-
<path
|
|
4960
|
-
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"
|
|
4961
|
-
></path>
|
|
4962
|
-
</svg>
|
|
4963
|
-
</i>
|
|
4951
|
+
<slot name="icon"></slot>
|
|
4964
4952
|
<div class="toast-content">
|
|
4965
4953
|
<div class="toast-body">
|
|
4966
4954
|
<strong>${this.title}</strong>
|
|
4967
|
-
<slot></slot>
|
|
4955
|
+
<span><slot></slot></span>
|
|
4968
4956
|
</div>
|
|
4969
4957
|
<slot class="toast-action" name="action"></slot>
|
|
4970
4958
|
</div>
|
|
4971
|
-
${this.
|
|
4959
|
+
${this.dismissible
|
|
4972
4960
|
? html$1 `<sgds-close-button
|
|
4973
4961
|
class="close-btn"
|
|
4974
4962
|
ariaLabel="close toast"
|
|
@@ -5003,7 +4991,7 @@
|
|
|
5003
4991
|
], SgdsToast.prototype, "variant", void 0);
|
|
5004
4992
|
__decorate([
|
|
5005
4993
|
property({ type: Boolean, reflect: true })
|
|
5006
|
-
], SgdsToast.prototype, "
|
|
4994
|
+
], SgdsToast.prototype, "dismissible", void 0);
|
|
5007
4995
|
__decorate([
|
|
5008
4996
|
watch("show", { waitUntilFirstUpdate: true })
|
|
5009
4997
|
], SgdsToast.prototype, "handleShowChange", null);
|