@type-dom/ui 0.0.2 → 0.0.3
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 +40 -6
- package/package.json +7 -1
- package/src/aria.d.ts +17 -0
- package/src/aria.js +20 -0
- package/src/{basic → components/basic}/index.d.ts +12 -0
- package/src/components/basic/index.js +48 -0
- package/src/{basic → components/basic}/td-button/td-button.class.d.ts +7 -5
- package/src/components/basic/td-button/td-button.class.js +179 -0
- package/src/{basic → components/basic}/td-button/td-button.interface.d.ts +21 -21
- package/src/{basic → components/basic}/td-button/td-button.style.d.ts +2 -1
- package/src/{basic → components/basic}/td-button/td-button.style.js +34 -30
- package/src/components/basic/td-button-group/td-button-group.class.d.ts +11 -0
- package/src/components/basic/td-button-group/td-button-group.class.js +105 -0
- package/src/components/basic/td-button-group/td-button-group.interface.d.ts +16 -0
- package/src/components/basic/td-container/td-aside/td-aside.class.d.ts +6 -0
- package/src/{basic → components/basic}/td-container/td-aside/td-aside.class.js +4 -4
- package/src/components/basic/td-container/td-aside/td-aside.interface.d.ts +7 -0
- package/src/components/basic/td-container/td-container.class.d.ts +11 -0
- package/src/{basic → components/basic}/td-container/td-container.class.js +4 -4
- package/src/components/basic/td-container/td-container.interface.d.ts +15 -0
- package/src/components/basic/td-container/td-footer/td-footer.class.d.ts +8 -0
- package/src/components/basic/td-container/td-footer/td-footer.class.js +24 -0
- package/src/components/basic/td-container/td-footer/td-footer.interface.d.ts +8 -0
- package/src/components/basic/td-container/td-header/td-header.class.d.ts +9 -0
- package/src/components/basic/td-container/td-header/td-header.class.js +25 -0
- package/src/components/basic/td-container/td-header/td-header.interface.d.ts +8 -0
- package/src/{basic → components/basic}/td-container/td-main/td-main.class.d.ts +2 -2
- package/src/{basic → components/basic}/td-container/td-main/td-main.class.js +5 -8
- package/src/components/basic/td-container/td-main/td-main.interface.d.ts +7 -0
- package/src/{basic → components/basic}/td-icon/td-icon.class.d.ts +7 -3
- package/src/{basic → components/basic}/td-icon/td-icon.class.js +37 -11
- package/src/components/basic/td-icon/td-icon.interface.d.ts +13 -0
- package/src/{basic → components/basic}/td-icon/td-icon.style.d.ts +1 -0
- package/src/{basic → components/basic}/td-icon/td-icon.style.js +4 -3
- package/src/components/basic/td-layout/td-col/td-col.class.d.ts +13 -0
- package/src/components/basic/td-layout/td-col/td-col.class.js +128 -0
- package/src/components/basic/td-layout/td-col/td-col.interface.d.ts +46 -0
- package/src/components/basic/td-layout/td-row/td-row.class.d.ts +10 -0
- package/src/components/basic/td-layout/td-row/td-row.class.js +101 -0
- package/src/components/basic/td-layout/td-row/td-row.interface.d.ts +18 -0
- package/src/components/basic/td-layout/td-row/td-row.interface.js +12 -0
- package/src/components/basic/td-layout/td-row/td-row.style.d.ts +1 -0
- package/src/components/basic/td-layout/td-row/td-row.style.js +8 -0
- package/src/components/basic/td-link/td-link.class.d.ts +11 -0
- package/src/components/basic/td-link/td-link.class.js +105 -0
- package/src/components/basic/td-link/td-link.interface.d.ts +33 -0
- package/src/components/basic/td-link/td-link.style.d.ts +5 -0
- package/src/components/basic/td-link/td-link.style.js +45 -0
- package/src/components/basic/td-scrollbar/bar/bar.class.d.ts +8 -0
- package/src/components/basic/td-scrollbar/bar/bar.class.js +31 -0
- package/src/components/basic/td-scrollbar/bar/bar.interface.d.ts +8 -0
- package/src/components/basic/td-scrollbar/td-scrollbar.class.d.ts +9 -0
- package/src/components/basic/td-scrollbar/td-scrollbar.class.js +51 -0
- package/src/components/basic/td-scrollbar/td-scrollbar.interface.d.ts +63 -0
- package/src/components/basic/td-scrollbar/td-scrollbar.interface.js +5 -0
- package/src/components/basic/td-scrollbar/thumb/thumb.class.d.ts +7 -0
- package/src/components/basic/td-scrollbar/thumb/thumb.class.js +45 -0
- package/src/components/basic/td-scrollbar/thumb/thumb.interface.d.ts +11 -0
- package/src/components/basic/td-space/td-space.class.d.ts +12 -0
- package/src/components/basic/td-space/td-space.class.js +92 -0
- package/src/components/basic/td-space/td-space.const.d.ts +3 -0
- package/src/components/basic/td-space/td-space.const.js +8 -0
- package/src/components/basic/td-space/td-space.interface.d.ts +39 -0
- package/src/components/basic/td-text/td-text.class.d.ts +10 -0
- package/src/components/basic/td-text/td-text.class.js +47 -0
- package/src/components/basic/td-text/td-text.interface.d.ts +21 -0
- package/src/components/basic/td-text/td-text.style.d.ts +6 -0
- package/src/components/basic/td-text/td-text.style.js +59 -0
- package/src/{feedback/dialog/dialog.d.ts → components/feedback/dialog/dialog.class.d.ts} +2 -3
- package/src/{feedback/dialog/dialog.js → components/feedback/dialog/dialog.class.js} +9 -2
- package/src/components/feedback/dialog/dialog.interface.d.ts +5 -0
- package/src/{feedback → components/feedback}/index.d.ts +1 -1
- package/src/{feedback → components/feedback}/index.js +2 -2
- package/src/{feedback → components/feedback}/message-box/message-box.d.ts +2 -3
- package/src/components/feedback/message-box/message-box.interface.d.ts +4 -0
- package/src/{feedback → components/feedback}/message-box/message-box.js +11 -2
- package/src/{feedback → components/feedback}/overlay/container/body/body.js +7 -9
- package/src/{feedback → components/feedback}/overlay/container/container.js +12 -14
- package/src/{feedback → components/feedback}/overlay/container/footer/cancel-button/cancel-button.js +2 -2
- package/src/{feedback → components/feedback}/overlay/container/footer/confirm-button/confirm-button.js +9 -11
- package/src/{feedback → components/feedback}/overlay/container/footer/footer.js +4 -4
- package/src/{feedback → components/feedback}/overlay/container/header/close-button/close-button.js +15 -17
- package/src/{feedback → components/feedback}/overlay/container/header/header.js +2 -2
- package/src/{feedback → components/feedback}/overlay/container/header/title/title.d.ts +1 -1
- package/src/{feedback → components/feedback}/overlay/container/header/title/title.js +9 -11
- package/src/{feedback → components/feedback}/overlay/overlay.abstract.d.ts +0 -3
- package/src/{feedback → components/feedback}/overlay/overlay.abstract.js +5 -11
- package/src/components/feedback/td-focus-trap/td-focus-trap.class.d.ts +8 -0
- package/src/components/feedback/td-focus-trap/td-focus-trap.class.js +81 -0
- package/src/components/feedback/td-focus-trap/td-focus-trap.interface.d.ts +10 -0
- package/src/components/feedback/td-focus-trap/tokens.d.ts +7 -0
- package/src/components/feedback/td-focus-trap/tokens.js +23 -0
- package/src/components/feedback/td-focus-trap/utils.d.ts +25 -0
- package/src/components/feedback/td-focus-trap/utils.js +153 -0
- package/src/components/feedback/td-popper/arrow/arrow.class.d.ts +6 -0
- package/src/components/feedback/td-popper/arrow/arrow.class.js +32 -0
- package/src/components/feedback/td-popper/arrow/arrow.interface.d.ts +11 -0
- package/src/components/feedback/td-popper/arrow/arrow.interface.js +2 -0
- package/src/components/feedback/td-popper/content/content.class.d.ts +7 -0
- package/src/components/feedback/td-popper/content/content.class.js +25 -0
- package/src/components/feedback/td-popper/content/content.interface.d.ts +37 -0
- package/src/components/feedback/td-popper/content/content.interface.js +2 -0
- package/src/components/feedback/td-popper/td-popper.class.d.ts +6 -0
- package/src/components/feedback/td-popper/td-popper.class.js +12 -0
- package/src/components/feedback/td-popper/td-popper.interface.d.ts +12 -0
- package/src/components/feedback/td-popper/td-popper.interface.js +13 -0
- package/src/components/feedback/td-popper/trigger/trigger.class.d.ts +6 -0
- package/src/components/feedback/td-popper/trigger/trigger.class.js +11 -0
- package/src/components/feedback/td-popper/trigger/trigger.interface.d.ts +8 -0
- package/src/components/feedback/td-popper/trigger/trigger.interface.js +2 -0
- package/src/components/feedback/td-tooltip/content/content.class.d.ts +6 -0
- package/src/components/feedback/td-tooltip/content/content.class.js +12 -0
- package/src/components/feedback/td-tooltip/content/content.interface.d.ts +42 -0
- package/src/components/feedback/td-tooltip/content/content.interface.js +2 -0
- package/src/components/feedback/td-tooltip/td-tooltip.class.d.ts +8 -0
- package/src/components/feedback/td-tooltip/td-tooltip.class.js +30 -0
- package/src/components/feedback/td-tooltip/td-tooltip.interface.d.ts +10 -0
- package/src/components/feedback/td-tooltip/td-tooltip.interface.js +2 -0
- package/src/components/feedback/td-tooltip/trigger/trigger.class.d.ts +6 -0
- package/src/components/feedback/td-tooltip/trigger/trigger.class.js +12 -0
- package/src/components/feedback/td-tooltip/trigger/trigger.interface.d.ts +16 -0
- package/src/components/feedback/td-tooltip/trigger/trigger.interface.js +2 -0
- package/src/{form → components/form}/checkbox-group/checkbox-group.class.d.ts +2 -3
- package/src/{form → components/form}/checkbox-group/checkbox-group.class.js +2 -2
- package/src/components/form/checkbox-group/checkbox-group.interface.js +2 -0
- package/src/{form → components/form}/checkbox-group/checkbox-option/checkbox-option.class.d.ts +2 -2
- package/src/{form → components/form}/checkbox-group/checkbox-option/checkbox-option.class.js +7 -7
- package/src/{form → components/form}/checkbox-group/checkbox-option/checkbox-option.interface.d.ts +0 -5
- package/src/components/form/checkbox-group/checkbox-option/checkbox-option.interface.js +2 -0
- package/src/components/form/field-item/cascade/field-cascade.abstract.d.ts +22 -0
- package/src/{form → components/form}/field-item/cascade/field-cascade.abstract.js +38 -42
- package/src/components/form/field-item/field-item.abstract.d.ts +10 -0
- package/src/{form → components/form}/field-item/field-item.abstract.js +5 -10
- package/src/components/form/field-item/field-item.interface.d.ts +5 -0
- package/src/components/form/field-item/field-item.interface.js +2 -0
- package/src/{form → components/form}/field-item/field-item.style.d.ts +1 -1
- package/src/{form → components/form}/field-item/field-item.style.js +2 -2
- package/src/{form → components/form}/field-item/input/field-input.abstract.js +6 -8
- package/src/components/form/field-item/options/field-options.abstract.d.ts +21 -0
- package/src/{form → components/form}/field-item/options/field-options.abstract.js +55 -55
- package/src/{form → components/form}/field-item/radio/field-radio.abstract.d.ts +6 -7
- package/src/{form → components/form}/field-item/radio/field-radio.abstract.js +10 -10
- package/src/{form → components/form}/field-item/select/field-select.abstract.js +7 -9
- package/src/{form → components/form}/field-item/span/field-span.abstract.d.ts +1 -1
- package/src/components/form/field-item/span/field-span.abstract.js +52 -0
- package/src/{form → components/form}/field-item/textarea/field-textarea.abstract.js +8 -8
- package/src/components/form/field-select/field-select.class.d.ts +12 -0
- package/src/{basic/td-select/td-select.class.js → components/form/field-select/field-select.class.js} +7 -7
- package/src/{basic/td-select/td-select.interface.d.ts → components/form/field-select/field-select.interface.d.ts} +2 -2
- package/src/components/form/field-select/field-select.interface.js +2 -0
- package/src/{basic/td-select → components/form/field-select}/option/option.class.d.ts +3 -5
- package/src/{basic/td-select → components/form/field-select}/option/option.class.js +3 -5
- package/src/components/form/field-select/option/option.interface.js +2 -0
- package/src/components/form/index.d.ts +26 -0
- package/src/{form → components/form}/index.js +17 -1
- package/src/{form → components/form}/radio-group/radio-group.class.d.ts +5 -6
- package/src/{form → components/form}/radio-group/radio-group.class.js +11 -4
- package/src/components/form/radio-group/radio-group.interface.d.ts +11 -0
- package/src/components/form/radio-group/radio-group.interface.js +2 -0
- package/src/{form → components/form}/radio-group/radio-option/radio-option.class.d.ts +5 -4
- package/src/components/form/radio-group/radio-option/radio-option.class.js +46 -0
- package/src/components/form/radio-group/radio-option/radio-option.interface.d.ts +10 -0
- package/src/components/form/radio-group/radio-option/radio-option.interface.js +2 -0
- package/src/{form → components/form}/select/select.class.d.ts +4 -5
- package/src/{form → components/form}/select/select.class.js +5 -5
- package/src/components/form/select/select.interface.d.ts +4 -0
- package/src/components/form/select/select.interface.js +2 -0
- package/src/components/form/td-checkbox/td-checkbox.class.d.ts +7 -0
- package/src/components/form/td-checkbox/td-checkbox.class.js +104 -0
- package/src/components/form/td-checkbox/td-checkbox.interface.d.ts +78 -0
- package/src/components/form/td-checkbox/td-checkbox.interface.js +2 -0
- package/src/components/form/td-checkbox/td-checkbox.style.d.ts +14 -0
- package/src/components/form/td-checkbox/td-checkbox.style.js +18 -0
- package/src/components/form/td-checkbox-button/td-checkbox-button.class.d.ts +7 -0
- package/src/components/form/td-checkbox-button/td-checkbox-button.class.js +15 -0
- package/src/components/form/td-checkbox-button/td-checkbox-button.interface.d.ts +6 -0
- package/src/components/form/td-checkbox-button/td-checkbox-button.interface.js +2 -0
- package/src/components/form/td-checkbox-group/td-checkbox-group.class.d.ts +7 -0
- package/src/components/form/td-checkbox-group/td-checkbox-group.class.js +20 -0
- package/src/components/form/td-checkbox-group/td-checkbox-group.interface.d.ts +50 -0
- package/src/components/form/td-checkbox-group/td-checkbox-group.interface.js +2 -0
- package/src/components/form/td-form/td-form.class.d.ts +22 -0
- package/src/components/form/td-form/td-form.class.js +52 -0
- package/src/components/form/td-form/td-form.interface.d.ts +92 -0
- package/src/components/form/td-form/td-form.interface.js +2 -0
- package/src/components/form/td-form/td-form.style.d.ts +4 -0
- package/src/components/form/td-form/td-form.style.js +8 -0
- package/src/components/form/td-form-item/td-form-item.class.d.ts +17 -0
- package/src/components/form/td-form-item/td-form-item.class.js +145 -0
- package/src/components/form/td-form-item/td-form-item.interface.d.ts +57 -0
- package/src/components/form/td-form-item/td-form-item.interface.js +9 -0
- package/src/components/form/td-form-item/td-form-item.style.d.ts +29 -0
- package/src/components/form/td-form-item/td-form-item.style.js +34 -0
- package/src/components/form/td-input/td-input-field.class.d.ts +7 -0
- package/src/{form/td-input/td-input.class.js → components/form/td-input/td-input-field.class.js} +8 -8
- package/src/{form/td-input/td-input.interface.d.ts → components/form/td-input/td-input-field.interface.d.ts} +3 -3
- package/src/components/form/td-input/td-input-field.interface.js +2 -0
- package/src/components/form/td-input/td-input.class.d.ts +21 -0
- package/src/components/form/td-input/td-input.class.js +177 -0
- package/src/components/form/td-input/td-input.interface.d.ts +133 -0
- package/src/components/form/td-input/td-input.interface.js +2 -0
- package/src/components/form/td-input/td-input.style.d.ts +53 -0
- package/src/components/form/td-input/td-input.style.js +66 -0
- package/src/components/form/td-input/widget/prefix.d.ts +10 -0
- package/src/components/form/td-input/widget/prefix.js +63 -0
- package/src/components/form/td-input/widget/suffix.d.ts +13 -0
- package/src/components/form/td-input/widget/suffix.js +120 -0
- package/src/components/form/td-input/widget/td-input-wrapper.class.d.ts +33 -0
- package/src/components/form/td-input/widget/td-input-wrapper.class.js +286 -0
- package/src/components/form/td-input/widget/td-input-wrapper.interface.d.ts +4 -0
- package/src/components/form/td-input/widget/td-input-wrapper.interface.js +2 -0
- package/src/components/form/td-input/widget/td-textarea-wrapper.d.ts +13 -0
- package/src/components/form/td-input/widget/td-textarea-wrapper.js +123 -0
- package/src/components/form/td-input/widget/utils.d.ts +6 -0
- package/src/components/form/td-input/widget/utils.js +81 -0
- package/src/components/form/td-radio/td-radio.class.d.ts +17 -0
- package/src/components/form/td-radio/td-radio.class.js +232 -0
- package/src/components/form/td-radio/td-radio.interface.d.ts +38 -0
- package/src/components/form/td-radio/td-radio.interface.js +2 -0
- package/src/components/form/td-radio-button/td-radio-button.class.d.ts +15 -0
- package/src/components/form/td-radio-button/td-radio-button.class.js +195 -0
- package/src/components/form/td-radio-button/td-radio-button.interface.d.ts +34 -0
- package/src/components/form/td-radio-button/td-radio-button.interface.js +2 -0
- package/src/components/form/td-radio-button/td-radio-button.style.d.ts +1 -0
- package/src/components/form/td-radio-button/td-radio-button.style.js +9 -0
- package/src/components/form/td-radio-group/td-radio-group.class.d.ts +16 -0
- package/src/components/form/td-radio-group/td-radio-group.class.js +105 -0
- package/src/components/form/td-radio-group/td-radio-group.interface.d.ts +47 -0
- package/src/components/form/td-radio-group/td-radio-group.interface.js +2 -0
- package/src/components/form/td-select/dropdown/dropdown.class.d.ts +9 -0
- package/src/components/form/td-select/dropdown/dropdown.class.js +48 -0
- package/src/components/form/td-select/dropdown/dropdown.interface.d.ts +9 -0
- package/src/components/form/td-select/dropdown/dropdown.interface.js +2 -0
- package/src/components/form/td-select/option/option.class.d.ts +6 -0
- package/src/components/form/td-select/option/option.class.js +36 -0
- package/src/components/form/td-select/option/option.interface.d.ts +20 -0
- package/src/components/form/td-select/option/option.interface.js +2 -0
- package/src/components/form/td-select/option-group/option-group.class.d.ts +6 -0
- package/src/components/form/td-select/option-group/option-group.class.js +50 -0
- package/src/components/form/td-select/option-group/option-group.interface.d.ts +14 -0
- package/src/components/form/td-select/option-group/option-group.interface.js +2 -0
- package/src/components/form/td-select/td-select.class.d.ts +6 -0
- package/src/components/form/td-select/td-select.class.js +32 -0
- package/src/components/form/td-select/td-select.interface.d.ts +172 -0
- package/src/components/form/td-select/td-select.interface.js +2 -0
- package/src/components/form/td-select/td-select.style.d.ts +53 -0
- package/src/components/form/td-select/td-select.style.js +76 -0
- package/src/components/form/td-switch/td-switch.class.d.ts +20 -0
- package/src/components/form/td-switch/td-switch.class.js +225 -0
- package/src/components/form/td-switch/td-switch.interface.d.ts +97 -0
- package/src/components/form/td-switch/td-switch.interface.js +2 -0
- package/src/components/form/td-switch/td-switch.style.d.ts +47 -0
- package/src/components/form/td-switch/td-switch.style.js +57 -0
- package/src/components/form/td-switch/widget/td-switch-core.d.ts +17 -0
- package/src/components/form/td-switch/widget/td-switch-core.js +212 -0
- package/src/components/form/td-switch/widget/td-switch-left.d.ts +7 -0
- package/src/components/form/td-switch/widget/td-switch-left.js +26 -0
- package/src/components/form/td-switch/widget/td-switch-right.d.ts +7 -0
- package/src/components/form/td-switch/widget/td-switch-right.js +25 -0
- package/src/components/navigation/index.d.ts +2 -0
- package/src/components/navigation/index.js +5 -0
- package/src/components/navigation/td-menu/td-menu.class.d.ts +7 -0
- package/src/components/navigation/td-menu/td-menu.class.js +42 -0
- package/src/components/navigation/td-menu/td-menu.interface.d.ts +23 -0
- package/src/components/navigation/td-menu/td-menu.interface.js +2 -0
- package/src/{others → components/others}/collapsible-box/collapsible-box.js +10 -11
- package/src/{others → components/others}/collapsible-box/contents/contents.js +9 -11
- package/src/{others → components/others}/collapsible-box/heading/expand-heading.js +28 -26
- package/src/{others → components/others}/index.d.ts +2 -0
- package/src/{others → components/others}/index.js +3 -1
- package/src/components/others/td-divider/td-divider.class.d.ts +6 -0
- package/src/components/others/td-divider/td-divider.class.js +80 -0
- package/src/components/others/td-divider/td-divider.interface.d.ts +18 -0
- package/src/components/others/td-divider/td-divider.interface.js +2 -0
- package/src/index.d.ts +6 -4
- package/src/index.js +7 -5
- package/src/styles/color-scheme.js +12 -12
- package/src/styles/index.d.ts +1 -0
- package/src/styles/index.js +4 -0
- package/src/styles/size.d.ts +7 -0
- package/src/styles/size.js +9 -0
- package/src/styles/var.d.ts +28 -10
- package/src/styles/var.js +59 -28
- package/src/ui/ui.abstract.d.ts +8 -0
- package/src/ui/ui.abstract.js +22 -0
- package/src/ui/ui.interface.d.ts +8 -0
- package/src/ui/ui.interface.js +2 -0
- package/src/basic/index.js +0 -19
- package/src/basic/td-button/td-button.class.js +0 -149
- package/src/basic/td-container/td-aside/td-aside.class.d.ts +0 -6
- package/src/basic/td-container/td-aside/td-aside.interface.d.ts +0 -8
- package/src/basic/td-container/td-container.class.d.ts +0 -10
- package/src/basic/td-container/td-container.interface.d.ts +0 -14
- package/src/basic/td-container/td-footer/td-footer.class.d.ts +0 -6
- package/src/basic/td-container/td-footer/td-footer.class.js +0 -30
- package/src/basic/td-container/td-footer/td-footer.interface.d.ts +0 -11
- package/src/basic/td-container/td-header/td-header.class.d.ts +0 -9
- package/src/basic/td-container/td-header/td-header.class.js +0 -23
- package/src/basic/td-container/td-header/td-header.interface.d.ts +0 -10
- package/src/basic/td-container/td-main/td-main.interface.d.ts +0 -7
- package/src/basic/td-icon/td-icon.interface.d.ts +0 -12
- package/src/basic/td-select/td-select.class.d.ts +0 -14
- package/src/form/field-item/cascade/field-cascade.abstract.d.ts +0 -22
- package/src/form/field-item/field-item.abstract.d.ts +0 -11
- package/src/form/field-item/field-item.interface.d.ts +0 -12
- package/src/form/field-item/options/field-options.abstract.d.ts +0 -22
- package/src/form/field-item/span/field-span.abstract.js +0 -54
- package/src/form/index.d.ts +0 -11
- package/src/form/input-number/td-input-number.class.d.ts +0 -9
- package/src/form/input-number/td-input-number.class.js +0 -55
- package/src/form/input-number/td-input-number.interface.d.ts +0 -9
- package/src/form/radio-group/radio-group.interface.d.ts +0 -6
- package/src/form/radio-group/radio-option/radio-option.class.js +0 -33
- package/src/form/radio-group/radio-option/radio-option.interface.d.ts +0 -5
- package/src/form/select/select.interface.d.ts +0 -10
- package/src/form/td-input/td-input.class.d.ts +0 -9
- /package/src/{basic/td-container/td-aside/td-aside.interface.js → components/basic/td-button/td-button.interface.js} +0 -0
- /package/src/{basic/td-button/td-button.interface.js → components/basic/td-button-group/td-button-group.interface.js} +0 -0
- /package/src/{basic/td-container/td-container.interface.js → components/basic/td-container/td-aside/td-aside.interface.js} +0 -0
- /package/src/{basic → components/basic}/td-container/td-container.d.ts +0 -0
- /package/src/{basic/td-container/td-footer/td-footer.interface.js → components/basic/td-container/td-container.interface.js} +0 -0
- /package/src/{basic → components/basic}/td-container/td-container.js +0 -0
- /package/src/{basic/td-container/td-header/td-header.interface.js → components/basic/td-container/td-footer/td-footer.interface.js} +0 -0
- /package/src/{basic/td-container/td-main/td-main.interface.js → components/basic/td-container/td-header/td-header.interface.js} +0 -0
- /package/src/{basic/td-icon/td-icon.interface.js → components/basic/td-container/td-main/td-main.interface.js} +0 -0
- /package/src/{basic/td-select/option/option.interface.js → components/basic/td-icon/td-icon.interface.js} +0 -0
- /package/src/{basic/td-select/td-select.interface.js → components/basic/td-layout/td-col/td-col.interface.js} +0 -0
- /package/src/{form/checkbox-group/checkbox-group.interface.js → components/basic/td-link/td-link.interface.js} +0 -0
- /package/src/{form/checkbox-group/checkbox-option/checkbox-option.interface.js → components/basic/td-scrollbar/bar/bar.interface.js} +0 -0
- /package/src/{form/field-item/field-item.interface.js → components/basic/td-scrollbar/thumb/thumb.interface.js} +0 -0
- /package/src/{form/input-number/td-input-number.interface.js → components/basic/td-space/td-space.interface.js} +0 -0
- /package/src/{form/radio-group/radio-group.interface.js → components/basic/td-text/td-text.interface.js} +0 -0
- /package/src/{data → components/data}/index.d.ts +0 -0
- /package/src/{data → components/data}/index.js +0 -0
- /package/src/{form/radio-group/radio-option/radio-option.interface.js → components/feedback/dialog/dialog.interface.js} +0 -0
- /package/src/{form/select/select.interface.js → components/feedback/message-box/message-box.interface.js} +0 -0
- /package/src/{feedback → components/feedback}/overlay/container/body/body.d.ts +0 -0
- /package/src/{feedback → components/feedback}/overlay/container/container.d.ts +0 -0
- /package/src/{feedback → components/feedback}/overlay/container/footer/cancel-button/cancel-button.d.ts +0 -0
- /package/src/{feedback → components/feedback}/overlay/container/footer/confirm-button/confirm-button.d.ts +0 -0
- /package/src/{feedback → components/feedback}/overlay/container/footer/footer.d.ts +0 -0
- /package/src/{feedback → components/feedback}/overlay/container/header/close-button/close-button.d.ts +0 -0
- /package/src/{feedback → components/feedback}/overlay/container/header/header.d.ts +0 -0
- /package/src/{form/td-input/td-input.interface.js → components/feedback/td-focus-trap/td-focus-trap.interface.js} +0 -0
- /package/src/{form → components/form}/checkbox-group/checkbox-group.interface.d.ts +0 -0
- /package/src/{form → components/form}/field-item/input/field-input.abstract.d.ts +0 -0
- /package/src/{form → components/form}/field-item/select/field-select.abstract.d.ts +0 -0
- /package/src/{form → components/form}/field-item/textarea/field-textarea.abstract.d.ts +0 -0
- /package/src/{basic/td-select → components/form/field-select}/option/option.interface.d.ts +0 -0
- /package/src/{navigation/index.d.ts → components/navigation/td-menu/td-menu.style.d.ts} +0 -0
- /package/src/{navigation/index.js → components/navigation/td-menu/td-menu.style.js} +0 -0
- /package/src/{others → components/others}/collapsible-box/collapsible-box.d.ts +0 -0
- /package/src/{others → components/others}/collapsible-box/contents/contents.d.ts +0 -0
- /package/src/{others → components/others}/collapsible-box/heading/expand-heading.d.ts +0 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TdSwitch = void 0;
|
|
4
|
+
const utils_1 = require("@type-dom/utils");
|
|
5
|
+
const framework_1 = require("@type-dom/framework");
|
|
6
|
+
const ui_abstract_1 = require("../../../ui/ui.abstract");
|
|
7
|
+
const var_1 = require("../../../styles/var");
|
|
8
|
+
const td_switch_style_1 = require("./td-switch.style");
|
|
9
|
+
const td_switch_core_1 = require("./widget/td-switch-core");
|
|
10
|
+
const td_switch_left_1 = require("./widget/td-switch-left");
|
|
11
|
+
const td_switch_right_1 = require("./widget/td-switch-right");
|
|
12
|
+
class TdSwitch extends ui_abstract_1.UI {
|
|
13
|
+
constructor(config) {
|
|
14
|
+
var _a, _b, _c;
|
|
15
|
+
super();
|
|
16
|
+
this.className = 'TdSwitch';
|
|
17
|
+
this.config = config;
|
|
18
|
+
this.addStyleObj({
|
|
19
|
+
display: 'inline-flex',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
position: 'relative',
|
|
22
|
+
verticalAlign: 'middle',
|
|
23
|
+
fontSize: td_switch_style_1.$switchFontSize[(config === null || config === void 0 ? void 0 : config.size) || 'default'],
|
|
24
|
+
lineHeight: td_switch_style_1.$switchCoreHeight[(config === null || config === void 0 ? void 0 : config.size) || 'default'],
|
|
25
|
+
height: td_switch_style_1.$switchHeight[(config === null || config === void 0 ? void 0 : config.size) || 'default']
|
|
26
|
+
});
|
|
27
|
+
this.modelValue = (_a = config === null || config === void 0 ? void 0 : config.modelValue) !== null && _a !== void 0 ? _a : false;
|
|
28
|
+
this.activeValue = (_b = config === null || config === void 0 ? void 0 : config.activeValue) !== null && _b !== void 0 ? _b : true;
|
|
29
|
+
this.inactiveValue = (_c = config === null || config === void 0 ? void 0 : config.inactiveValue) !== null && _c !== void 0 ? _c : false;
|
|
30
|
+
this.input = new framework_1.Input({
|
|
31
|
+
attrObj: {
|
|
32
|
+
type: 'checkbox',
|
|
33
|
+
role: 'switch'
|
|
34
|
+
},
|
|
35
|
+
styleObj: {
|
|
36
|
+
display: 'none'
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
this.addChild(this.input);
|
|
40
|
+
if (!(config === null || config === void 0 ? void 0 : config.inlinePrompt) && ((config === null || config === void 0 ? void 0 : config.inactiveIcon) || (config === null || config === void 0 ? void 0 : config.inactiveText))) {
|
|
41
|
+
this.left = new td_switch_left_1.TdSwitchLeft(config);
|
|
42
|
+
this.addChild(this.left);
|
|
43
|
+
}
|
|
44
|
+
this.core = new td_switch_core_1.TdSwitchCore(Object.assign({}, config, {
|
|
45
|
+
modelValue: this.modelValue,
|
|
46
|
+
activeValue: this.activeValue,
|
|
47
|
+
inactiveValue: this.inactiveValue
|
|
48
|
+
}));
|
|
49
|
+
this.addChild(this.core);
|
|
50
|
+
if (!(config === null || config === void 0 ? void 0 : config.inlinePrompt) && ((config === null || config === void 0 ? void 0 : config.activeIcon) || (config === null || config === void 0 ? void 0 : config.activeText))) {
|
|
51
|
+
console.log('td-switch right .');
|
|
52
|
+
this.right = new td_switch_right_1.TdSwitchRight(config);
|
|
53
|
+
this.addChild(this.right);
|
|
54
|
+
}
|
|
55
|
+
this.setChecked(this.modelValue === this.activeValue);
|
|
56
|
+
this.setConfig(config);
|
|
57
|
+
}
|
|
58
|
+
setConfig(config) {
|
|
59
|
+
super.setConfig(config);
|
|
60
|
+
// todo
|
|
61
|
+
console.log('td-switch setConfig . ');
|
|
62
|
+
if (config === null || config === void 0 ? void 0 : config.disabled) {
|
|
63
|
+
this.setDisabled(config === null || config === void 0 ? void 0 : config.disabled);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
initEvents() {
|
|
67
|
+
this.addEvents({
|
|
68
|
+
click: (evt) => {
|
|
69
|
+
// changeValue
|
|
70
|
+
evt === null || evt === void 0 ? void 0 : evt.preventDefault();
|
|
71
|
+
this.switchValue();
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
handleChange() {
|
|
76
|
+
console.log('handleChange . ');
|
|
77
|
+
const config = this.config;
|
|
78
|
+
const checked = this.modelValue === this.activeValue;
|
|
79
|
+
// this.modelValue = !this.modelValue;
|
|
80
|
+
this.modelValue = checked ? this.inactiveValue : this.activeValue;
|
|
81
|
+
const val = checked ? this.inactiveValue : this.activeValue;
|
|
82
|
+
// emit(UPDATE_MODEL_EVENT, val)
|
|
83
|
+
// emit(CHANGE_EVENT, val)
|
|
84
|
+
// emit(INPUT_EVENT, val)
|
|
85
|
+
(0, framework_1.nextTick)(() => {
|
|
86
|
+
this.input.dom.checked = !checked;
|
|
87
|
+
console.log('handleChange . this.input.dom.checked is ', checked);
|
|
88
|
+
// this.input.setValue(val);
|
|
89
|
+
this.setChecked(!checked);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
setDisabled(disabled) {
|
|
93
|
+
var _a, _b;
|
|
94
|
+
if (disabled) {
|
|
95
|
+
this.addStyleObj({
|
|
96
|
+
opacity: 0.6
|
|
97
|
+
});
|
|
98
|
+
this.input.addAttrObj({
|
|
99
|
+
disabled: true,
|
|
100
|
+
ariaDisabled: true
|
|
101
|
+
});
|
|
102
|
+
(_a = this.left) === null || _a === void 0 ? void 0 : _a.setStyleObj({
|
|
103
|
+
cursor: framework_1.StyleCursor.notAllowed
|
|
104
|
+
});
|
|
105
|
+
this.core.setStyleObj({
|
|
106
|
+
cursor: framework_1.StyleCursor.notAllowed
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
this.addStyleObj({
|
|
111
|
+
opacity: 1
|
|
112
|
+
});
|
|
113
|
+
this.input.addAttrObj({
|
|
114
|
+
disabled: false,
|
|
115
|
+
ariaDisabled: false
|
|
116
|
+
});
|
|
117
|
+
(_b = this.left) === null || _b === void 0 ? void 0 : _b.setStyleObj({
|
|
118
|
+
cursor: framework_1.StyleCursor.auto
|
|
119
|
+
});
|
|
120
|
+
this.core.setStyleObj({
|
|
121
|
+
cursor: framework_1.StyleCursor.auto
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
setChecked(checked) {
|
|
126
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
127
|
+
if (checked) {
|
|
128
|
+
this.core.setStyleObj({
|
|
129
|
+
backgroundColor: (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.switchOnColor) !== null && _b !== void 0 ? _b : td_switch_style_1.$switchOnColor
|
|
130
|
+
});
|
|
131
|
+
this.core.action.setStyleObj({
|
|
132
|
+
color: td_switch_style_1.$switchOnColor,
|
|
133
|
+
// left: calc(100% - #{map.get($switch-button-size, 'default') + 1px});
|
|
134
|
+
left: 'calc(100% - ' + td_switch_style_1.$switchButtonSize[((_c = this.config) === null || _c === void 0 ? void 0 : _c.size) || 'default'] + ' - 1px)'
|
|
135
|
+
});
|
|
136
|
+
if (this.right) {
|
|
137
|
+
this.right.setStyleObj({
|
|
138
|
+
color: var_1.$colors.primary.base
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
if (this.left) {
|
|
142
|
+
this.left.setStyleObj({
|
|
143
|
+
color: var_1.$colors.default.base
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if ((_d = this.config) === null || _d === void 0 ? void 0 : _d.inlinePrompt) {
|
|
147
|
+
this.core.setInnerChecked(true);
|
|
148
|
+
}
|
|
149
|
+
if ((_e = this.config) === null || _e === void 0 ? void 0 : _e.activeActionIcon) {
|
|
150
|
+
(_f = this.core.actionIcon) === null || _f === void 0 ? void 0 : _f.replaceSvg(this.config.activeActionIcon);
|
|
151
|
+
}
|
|
152
|
+
else if ((_g = this.config) === null || _g === void 0 ? void 0 : _g.activeActionText) {
|
|
153
|
+
(_j = (_h = this.core.actionSpan) === null || _h === void 0 ? void 0 : _h.textNode) === null || _j === void 0 ? void 0 : _j.setText(this.config.activeActionText);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
this.core.setStyleObj({
|
|
158
|
+
backgroundColor: (_l = (_k = this.config) === null || _k === void 0 ? void 0 : _k.switchOffColor) !== null && _l !== void 0 ? _l : td_switch_style_1.$switchOffColor
|
|
159
|
+
});
|
|
160
|
+
this.core.action.setStyleObj({
|
|
161
|
+
left: '1px',
|
|
162
|
+
color: td_switch_style_1.$switchOffColor
|
|
163
|
+
});
|
|
164
|
+
if (this.left) {
|
|
165
|
+
this.left.setStyleObj({
|
|
166
|
+
color: var_1.$colors.primary.base
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
if (this.right) {
|
|
170
|
+
this.right.setStyleObj({
|
|
171
|
+
color: var_1.$colors.default.base
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
if ((_m = this.config) === null || _m === void 0 ? void 0 : _m.inlinePrompt) {
|
|
175
|
+
this.core.setInnerChecked(false);
|
|
176
|
+
}
|
|
177
|
+
if ((_o = this.config) === null || _o === void 0 ? void 0 : _o.inactiveActionIcon) {
|
|
178
|
+
(_p = this.core.actionIcon) === null || _p === void 0 ? void 0 : _p.replaceSvg(this.config.inactiveActionIcon);
|
|
179
|
+
}
|
|
180
|
+
else if ((_q = this.config) === null || _q === void 0 ? void 0 : _q.inactiveActionText) {
|
|
181
|
+
(_s = (_r = this.core.actionSpan) === null || _r === void 0 ? void 0 : _r.textNode) === null || _s === void 0 ? void 0 : _s.setText(this.config.inactiveActionText);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
switchValue() {
|
|
186
|
+
console.log('switchValue . ');
|
|
187
|
+
const config = this.config;
|
|
188
|
+
if ((config === null || config === void 0 ? void 0 : config.loading) || (config === null || config === void 0 ? void 0 : config.disabled)) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const beforeChange = config === null || config === void 0 ? void 0 : config.beforeChange;
|
|
192
|
+
if (!beforeChange) {
|
|
193
|
+
this.handleChange();
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const shouldChange = beforeChange();
|
|
197
|
+
const isPromiseOrBool = [
|
|
198
|
+
(0, utils_1.isPromise)(shouldChange),
|
|
199
|
+
(0, utils_1.isBoolean)(shouldChange)
|
|
200
|
+
].includes(true);
|
|
201
|
+
if (!isPromiseOrBool) {
|
|
202
|
+
// throwError(
|
|
203
|
+
// COMPONENT_NAME,
|
|
204
|
+
// 'beforeChange must return type `Promise<boolean>` or `boolean`'
|
|
205
|
+
// )
|
|
206
|
+
console.error('beforeChange must return type `Promise<boolean>` or `boolean`');
|
|
207
|
+
}
|
|
208
|
+
if ((0, utils_1.isPromise)(shouldChange)) {
|
|
209
|
+
shouldChange
|
|
210
|
+
.then((result) => {
|
|
211
|
+
if (result) {
|
|
212
|
+
this.handleChange();
|
|
213
|
+
}
|
|
214
|
+
})
|
|
215
|
+
.catch((e) => {
|
|
216
|
+
// debugWarn(COMPONENT_NAME, `some error occurred: ${e}`)
|
|
217
|
+
console.error(`some error occurred: ${e}`);
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
else if (shouldChange) {
|
|
221
|
+
this.handleChange();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
exports.TdSwitch = TdSwitch;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { IUI, IUIConfig } from '../../../ui/ui.interface';
|
|
2
|
+
import { TypeSvgSvg } from '@type-dom/framework';
|
|
3
|
+
export interface ITdSwitch extends IUI {
|
|
4
|
+
className: 'TdSwitch';
|
|
5
|
+
}
|
|
6
|
+
export interface ITdSwitchConfig extends IUIConfig {
|
|
7
|
+
/**
|
|
8
|
+
* @description binding value, it should be equivalent to either `active-value` or `inactive-value`, by default it's `boolean` type
|
|
9
|
+
* default: false
|
|
10
|
+
*/
|
|
11
|
+
modelValue?: boolean | number | string;
|
|
12
|
+
/**
|
|
13
|
+
* @description whether Switch is disabled
|
|
14
|
+
* default false
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* @description whether Switch is in loading state
|
|
19
|
+
* default false
|
|
20
|
+
*/
|
|
21
|
+
loading?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* @description size of Switch
|
|
24
|
+
*/
|
|
25
|
+
size?: 'large' | 'default' | 'small';
|
|
26
|
+
/**
|
|
27
|
+
* @description width of Switch
|
|
28
|
+
*/
|
|
29
|
+
width?: number | string;
|
|
30
|
+
/**
|
|
31
|
+
* @description whether icon or text is displayed inside dot, only the first character will be rendered for text
|
|
32
|
+
* default false
|
|
33
|
+
*/
|
|
34
|
+
inlinePrompt?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* @description component of the icon displayed in action when in `off` state
|
|
37
|
+
*/
|
|
38
|
+
inactiveActionIcon?: TypeSvgSvg;
|
|
39
|
+
/**
|
|
40
|
+
* @description component of the icon displayed in action when in `on` state
|
|
41
|
+
*/
|
|
42
|
+
activeActionIcon?: TypeSvgSvg;
|
|
43
|
+
/**
|
|
44
|
+
* @description component of the icon displayed when in `on` state, overrides `active-text`
|
|
45
|
+
*/
|
|
46
|
+
activeIcon?: TypeSvgSvg;
|
|
47
|
+
/**
|
|
48
|
+
* @description component of the icon displayed when in `off` state, overrides `inactive-text`
|
|
49
|
+
*/
|
|
50
|
+
inactiveIcon?: TypeSvgSvg;
|
|
51
|
+
/**
|
|
52
|
+
* @description text displayed when in `on` state
|
|
53
|
+
*/
|
|
54
|
+
activeText?: string;
|
|
55
|
+
/**
|
|
56
|
+
* @description text displayed when in `off` state
|
|
57
|
+
*/
|
|
58
|
+
inactiveText?: string;
|
|
59
|
+
/**
|
|
60
|
+
* @description switch value when in `on` state
|
|
61
|
+
* default true
|
|
62
|
+
*/
|
|
63
|
+
activeValue?: boolean | string | number;
|
|
64
|
+
/**
|
|
65
|
+
* @description switch value when in `off` state
|
|
66
|
+
*/
|
|
67
|
+
inactiveValue?: boolean | string | number;
|
|
68
|
+
/**
|
|
69
|
+
* @description input name of Switch
|
|
70
|
+
*/
|
|
71
|
+
name?: string;
|
|
72
|
+
/**
|
|
73
|
+
* @description whether to trigger form validation
|
|
74
|
+
* default: true
|
|
75
|
+
*/
|
|
76
|
+
validateEvent?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* @description before-change hook before the switch state changes. If `false` is returned or a `Promise` is returned and then is rejected, will stop switching
|
|
79
|
+
*/
|
|
80
|
+
/**
|
|
81
|
+
* @description id for input
|
|
82
|
+
*/
|
|
83
|
+
id?: string;
|
|
84
|
+
/**
|
|
85
|
+
* @description tabindex for input
|
|
86
|
+
*/
|
|
87
|
+
tabindex?: string | number;
|
|
88
|
+
/**
|
|
89
|
+
* @description native input aria-label
|
|
90
|
+
*/
|
|
91
|
+
label?: string;
|
|
92
|
+
switchOnColor?: string;
|
|
93
|
+
switchOffColor?: string;
|
|
94
|
+
activeActionText?: string;
|
|
95
|
+
inactiveActionText?: string;
|
|
96
|
+
beforeChange?: () => boolean;
|
|
97
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { StyleCursor } from '@type-dom/framework';
|
|
2
|
+
export declare const $switchOnColor: string;
|
|
3
|
+
export declare const $switchOffColor: string;
|
|
4
|
+
export declare const $switchBorderColor: string;
|
|
5
|
+
export declare const $switchHeight: {
|
|
6
|
+
large: string;
|
|
7
|
+
default: string;
|
|
8
|
+
small: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const $switchFontSize: {
|
|
11
|
+
large: string;
|
|
12
|
+
default: string;
|
|
13
|
+
small: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const $switchCoreBorderRadius: {
|
|
16
|
+
large: string;
|
|
17
|
+
default: string;
|
|
18
|
+
small: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const $switchCoreWidth: {
|
|
21
|
+
large: string;
|
|
22
|
+
default: string;
|
|
23
|
+
small: string;
|
|
24
|
+
};
|
|
25
|
+
export declare const $switchCoreHeight: {
|
|
26
|
+
large: string;
|
|
27
|
+
default: string;
|
|
28
|
+
small: string;
|
|
29
|
+
};
|
|
30
|
+
export declare const $switchButtonSize: {
|
|
31
|
+
large: string;
|
|
32
|
+
default: string;
|
|
33
|
+
small: string;
|
|
34
|
+
};
|
|
35
|
+
export declare const $switchContentPadding: {
|
|
36
|
+
large: string;
|
|
37
|
+
default: string;
|
|
38
|
+
small: string;
|
|
39
|
+
};
|
|
40
|
+
export declare const $switchLabel: {
|
|
41
|
+
transition: string;
|
|
42
|
+
display: string;
|
|
43
|
+
fontWeight: string;
|
|
44
|
+
cursor: StyleCursor;
|
|
45
|
+
verticalAlign: string;
|
|
46
|
+
color: string;
|
|
47
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.$switchLabel = exports.$switchContentPadding = exports.$switchButtonSize = exports.$switchCoreHeight = exports.$switchCoreWidth = exports.$switchCoreBorderRadius = exports.$switchFontSize = exports.$switchHeight = exports.$switchBorderColor = exports.$switchOffColor = exports.$switchOnColor = void 0;
|
|
4
|
+
const var_1 = require("../../../styles/var");
|
|
5
|
+
const framework_1 = require("@type-dom/framework");
|
|
6
|
+
exports.$switchOnColor = var_1.$colors.primary.base;
|
|
7
|
+
// -switch-on-color: var(--el-color-primary);
|
|
8
|
+
exports.$switchOffColor = var_1.$borderColor.base;
|
|
9
|
+
// --el-switch-off-color: var(--el-border-color);
|
|
10
|
+
exports.$switchBorderColor = var_1.$borderColor.base;
|
|
11
|
+
exports.$switchHeight = {
|
|
12
|
+
large: '40px',
|
|
13
|
+
default: '32px',
|
|
14
|
+
small: '24px'
|
|
15
|
+
};
|
|
16
|
+
exports.$switchFontSize = {
|
|
17
|
+
large: '14px',
|
|
18
|
+
default: '14px',
|
|
19
|
+
small: '12px'
|
|
20
|
+
};
|
|
21
|
+
exports.$switchCoreBorderRadius = {
|
|
22
|
+
large: '12px',
|
|
23
|
+
default: '10px',
|
|
24
|
+
small: '8px'
|
|
25
|
+
};
|
|
26
|
+
exports.$switchCoreWidth = {
|
|
27
|
+
large: '50px',
|
|
28
|
+
default: '40px',
|
|
29
|
+
small: '30px'
|
|
30
|
+
};
|
|
31
|
+
exports.$switchCoreHeight = {
|
|
32
|
+
large: '24px',
|
|
33
|
+
default: '20px',
|
|
34
|
+
small: '16px'
|
|
35
|
+
};
|
|
36
|
+
exports.$switchButtonSize = {
|
|
37
|
+
large: '20px',
|
|
38
|
+
default: '16px',
|
|
39
|
+
small: '12px'
|
|
40
|
+
};
|
|
41
|
+
exports.$switchContentPadding = {
|
|
42
|
+
large: '6px',
|
|
43
|
+
default: '4px',
|
|
44
|
+
small: '2px'
|
|
45
|
+
};
|
|
46
|
+
exports.$switchLabel = {
|
|
47
|
+
// transition: getCssVar('transition-duration-fast'),
|
|
48
|
+
transition: var_1.$transitionDurationFast,
|
|
49
|
+
// height: map.get($switch-core-height, 'default'),
|
|
50
|
+
display: 'inline-flex',
|
|
51
|
+
// font-size: map.get($switch-font-size, 'default'),
|
|
52
|
+
fontWeight: exports.$switchFontSize['default'],
|
|
53
|
+
cursor: framework_1.StyleCursor.pointer,
|
|
54
|
+
verticalAlign: 'middle',
|
|
55
|
+
// color: getCssVar('text-color', 'primary'),
|
|
56
|
+
color: var_1.$textColor.primary
|
|
57
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Div, Span, TypeSpan } from '@type-dom/framework';
|
|
2
|
+
import { TdIcon } from '../../../basic/td-icon/td-icon.class';
|
|
3
|
+
import { ITdSwitchConfig } from '../td-switch.interface';
|
|
4
|
+
import { TdSwitch } from '../td-switch.class';
|
|
5
|
+
export declare class TdSwitchCore extends TypeSpan {
|
|
6
|
+
className: 'TdSwitchCore';
|
|
7
|
+
action: Div;
|
|
8
|
+
parent?: TdSwitch;
|
|
9
|
+
config?: ITdSwitchConfig;
|
|
10
|
+
inner?: Div;
|
|
11
|
+
private innerText?;
|
|
12
|
+
private innerIcon?;
|
|
13
|
+
actionIcon?: TdIcon;
|
|
14
|
+
actionSpan?: Span;
|
|
15
|
+
constructor(config?: ITdSwitchConfig);
|
|
16
|
+
setInnerChecked(checked: boolean): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TdSwitchCore = void 0;
|
|
4
|
+
const framework_1 = require("@type-dom/framework");
|
|
5
|
+
const svgs_1 = require("@type-dom/svgs");
|
|
6
|
+
const var_1 = require("../../../../styles/var");
|
|
7
|
+
const td_icon_class_1 = require("../../../basic/td-icon/td-icon.class");
|
|
8
|
+
const td_switch_style_1 = require("../td-switch.style");
|
|
9
|
+
class TdSwitchCore extends framework_1.TypeSpan {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super();
|
|
12
|
+
this.config = config;
|
|
13
|
+
this.className = 'TdSwitchCore';
|
|
14
|
+
this.addAttrObj({
|
|
15
|
+
name: 'switch-core'
|
|
16
|
+
});
|
|
17
|
+
this.addStyleObj({
|
|
18
|
+
display: 'inline-flex',
|
|
19
|
+
position: 'relative',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
// border: '1px solid var(--el-switch-border-color, var(--el-switch-off-color))',
|
|
22
|
+
border: '1px solid ' + td_switch_style_1.$switchBorderColor,
|
|
23
|
+
outline: 'none',
|
|
24
|
+
borderRadius: '10px',
|
|
25
|
+
boxSizing: 'border-box',
|
|
26
|
+
background: td_switch_style_1.$switchOffColor, // 'var(--el-switch-off-color)',
|
|
27
|
+
// backgroundColor: $switchOnColor,
|
|
28
|
+
cursor: framework_1.StyleCursor.pointer,
|
|
29
|
+
// transition: border-color var(--el-transition-duration), background-color var(--el-transition-duration);
|
|
30
|
+
transition: var_1.$borderColor.base + ' ' + var_1.$transitionDuration + ', background-color ' + var_1.$transitionDuration,
|
|
31
|
+
// minWidth: map.get($switch-core-width, 'default');
|
|
32
|
+
minWidth: td_switch_style_1.$switchCoreWidth[(config === null || config === void 0 ? void 0 : config.size) || 'default'],
|
|
33
|
+
// height: map.get($switch-core-height, 'default');
|
|
34
|
+
height: td_switch_style_1.$switchCoreHeight[(config === null || config === void 0 ? void 0 : config.size) || 'default']
|
|
35
|
+
});
|
|
36
|
+
if (config === null || config === void 0 ? void 0 : config.inlinePrompt) {
|
|
37
|
+
this.inner = new framework_1.Div({
|
|
38
|
+
attrObj: {
|
|
39
|
+
name: 'switch-inner'
|
|
40
|
+
},
|
|
41
|
+
styleObj: {
|
|
42
|
+
width: '100%',
|
|
43
|
+
// transition: all getCssVar('transition-duration'),
|
|
44
|
+
transition: 'all ' + var_1.$transitionDuration,
|
|
45
|
+
// height: map.get($switch-button-size, 'default'),
|
|
46
|
+
height: td_switch_style_1.$switchButtonSize[(config === null || config === void 0 ? void 0 : config.size) || 'default'],
|
|
47
|
+
display: 'flex',
|
|
48
|
+
justifyContent: 'center',
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
overflow: 'hidden',
|
|
51
|
+
// padding: 0 #{map.get($switch-content-padding, 'default')} 0 calc(#{map.get(
|
|
52
|
+
// $switch-button-size,
|
|
53
|
+
// 'default'
|
|
54
|
+
// )} + 2px);
|
|
55
|
+
padding: '0 ' + td_switch_style_1.$switchContentPadding[(config === null || config === void 0 ? void 0 : config.size) || 'default'] + ' 0 calc(' + td_switch_style_1.$switchButtonSize[(config === null || config === void 0 ? void 0 : config.size) || 'default'] + ' + 2px)'
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
this.addChild(this.inner);
|
|
59
|
+
if ((config === null || config === void 0 ? void 0 : config.activeIcon) || (config === null || config === void 0 ? void 0 : config.inactiveIcon)) {
|
|
60
|
+
this.innerIcon = new td_icon_class_1.TdIcon({
|
|
61
|
+
svgObj: (config === null || config === void 0 ? void 0 : config.modelValue) === (config === null || config === void 0 ? void 0 : config.activeValue) ? config === null || config === void 0 ? void 0 : config.activeIcon : config === null || config === void 0 ? void 0 : config.inactiveIcon,
|
|
62
|
+
attrObj: {
|
|
63
|
+
name: 'switch-inner-icon'
|
|
64
|
+
},
|
|
65
|
+
styleObj: {
|
|
66
|
+
fontSize: '12px', // $fontSizes.base,
|
|
67
|
+
// color: var(--el-color-white),
|
|
68
|
+
color: var_1.$colorWhite,
|
|
69
|
+
userSelect: 'none',
|
|
70
|
+
overflow: 'hidden',
|
|
71
|
+
textOverflow: 'ellipsis',
|
|
72
|
+
whiteSpace: 'nowrap'
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
this.inner.addChild(this.innerIcon);
|
|
76
|
+
}
|
|
77
|
+
else if ((config === null || config === void 0 ? void 0 : config.activeText) || (config === null || config === void 0 ? void 0 : config.inactiveText)) {
|
|
78
|
+
this.innerText = new framework_1.Span({
|
|
79
|
+
text: (config === null || config === void 0 ? void 0 : config.modelValue) === (config === null || config === void 0 ? void 0 : config.activeValue) ? config === null || config === void 0 ? void 0 : config.activeText : config === null || config === void 0 ? void 0 : config.inactiveText,
|
|
80
|
+
attrObj: {
|
|
81
|
+
name: 'switch-inner-text'
|
|
82
|
+
},
|
|
83
|
+
styleObj: {
|
|
84
|
+
// fontSize: $switchFontSize[config?.size || 'default'],
|
|
85
|
+
fontSize: '12px', // $fontSizes.base,
|
|
86
|
+
// color: var(--el-color-white),
|
|
87
|
+
color: var_1.$colorWhite,
|
|
88
|
+
userSelect: 'none',
|
|
89
|
+
overflow: 'hidden',
|
|
90
|
+
textOverflow: 'ellipsis',
|
|
91
|
+
whiteSpace: 'nowrap'
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
this.inner.addChild(this.innerText);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
this.action = new framework_1.Div({
|
|
98
|
+
attrObj: {
|
|
99
|
+
name: 'switch-action'
|
|
100
|
+
},
|
|
101
|
+
styleObj: {
|
|
102
|
+
position: 'absolute',
|
|
103
|
+
left: '1px',
|
|
104
|
+
// left: 'calc(100% - 17px)',
|
|
105
|
+
// borderRadius: var(--el-border-radius-circle),
|
|
106
|
+
borderRadius: var_1.$borderRadius.circle,
|
|
107
|
+
// transition: all var(--el-transition-duration),
|
|
108
|
+
transition: 'all ' + var_1.$transitionDuration,
|
|
109
|
+
width: td_switch_style_1.$switchButtonSize[(config === null || config === void 0 ? void 0 : config.size) || 'default'],
|
|
110
|
+
// width: map.get($switch-button-size, 'default');
|
|
111
|
+
height: td_switch_style_1.$switchButtonSize[(config === null || config === void 0 ? void 0 : config.size) || 'default'],
|
|
112
|
+
// height: map.get($switch-button-size, 'default');
|
|
113
|
+
// backgroundColor: var(--el-color-white),
|
|
114
|
+
backgroundColor: var_1.$colorWhite,
|
|
115
|
+
display: 'flex',
|
|
116
|
+
justifyContent: 'center',
|
|
117
|
+
alignItems: 'center',
|
|
118
|
+
// color: var(--el-switch-off-color),
|
|
119
|
+
color: td_switch_style_1.$switchOffColor
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
if (config === null || config === void 0 ? void 0 : config.loading) {
|
|
123
|
+
const loadingIcon = new td_icon_class_1.TdIcon({
|
|
124
|
+
svgObj: new svgs_1.ElLoadingSvg(),
|
|
125
|
+
attrObj: {
|
|
126
|
+
name: 'switch-loading-icon'
|
|
127
|
+
},
|
|
128
|
+
loading: true
|
|
129
|
+
});
|
|
130
|
+
this.action.addChild(loadingIcon);
|
|
131
|
+
}
|
|
132
|
+
else if ((config === null || config === void 0 ? void 0 : config.modelValue) === (config === null || config === void 0 ? void 0 : config.activeValue)) {
|
|
133
|
+
this.action.addStyleObj({
|
|
134
|
+
color: td_switch_style_1.$switchOnColor
|
|
135
|
+
});
|
|
136
|
+
if (config === null || config === void 0 ? void 0 : config.activeActionIcon) {
|
|
137
|
+
this.actionIcon = new td_icon_class_1.TdIcon({
|
|
138
|
+
svgObj: config.activeActionIcon,
|
|
139
|
+
attrObj: {
|
|
140
|
+
name: 'switch-action-icon'
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
this.action.addChild(this.actionIcon);
|
|
144
|
+
}
|
|
145
|
+
else if (config === null || config === void 0 ? void 0 : config.activeActionText) {
|
|
146
|
+
this.actionSpan = new framework_1.Span({
|
|
147
|
+
text: config.activeActionText,
|
|
148
|
+
attrObj: {
|
|
149
|
+
name: 'switch-action-text'
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
this.action.addChild(this.actionSpan);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
else if ((config === null || config === void 0 ? void 0 : config.modelValue) !== (config === null || config === void 0 ? void 0 : config.activeValue)) {
|
|
156
|
+
if (config === null || config === void 0 ? void 0 : config.inactiveActionIcon) {
|
|
157
|
+
this.actionIcon = new td_icon_class_1.TdIcon({
|
|
158
|
+
svgObj: config.inactiveActionIcon,
|
|
159
|
+
attrObj: {
|
|
160
|
+
name: 'switch-action-icon'
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
this.action.addChild(this.actionIcon);
|
|
164
|
+
}
|
|
165
|
+
else if (config === null || config === void 0 ? void 0 : config.inactiveActionText) {
|
|
166
|
+
this.actionSpan = new framework_1.Span({
|
|
167
|
+
text: config.inactiveActionText,
|
|
168
|
+
attrObj: {
|
|
169
|
+
name: 'switch-action-text'
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
this.action.addChild(this.actionSpan);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
this.addChild(this.action);
|
|
176
|
+
}
|
|
177
|
+
setInnerChecked(checked) {
|
|
178
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
179
|
+
if (checked) {
|
|
180
|
+
(_a = this.inner) === null || _a === void 0 ? void 0 : _a.setStyleObj({
|
|
181
|
+
// padding: 0 calc(#{map.get($switch-button-size, 'default')} + 2px) 0 #{map.get(
|
|
182
|
+
// $switch-content-padding,
|
|
183
|
+
// 'default'
|
|
184
|
+
// )};
|
|
185
|
+
padding: '0 ' + 'calc(' + td_switch_style_1.$switchButtonSize[((_b = this.config) === null || _b === void 0 ? void 0 : _b.size) || 'default'] + ' + 2px)' + '0 ' +
|
|
186
|
+
td_switch_style_1.$switchContentPadding[((_c = this.config) === null || _c === void 0 ? void 0 : _c.size) || 'default']
|
|
187
|
+
});
|
|
188
|
+
if (((_d = this.config) === null || _d === void 0 ? void 0 : _d.activeIcon) || ((_e = this.config) === null || _e === void 0 ? void 0 : _e.inactiveIcon)) {
|
|
189
|
+
(_f = this.innerIcon) === null || _f === void 0 ? void 0 : _f.replaceSvg(this.config.activeIcon);
|
|
190
|
+
}
|
|
191
|
+
else if (((_g = this.config) === null || _g === void 0 ? void 0 : _g.activeText) || ((_h = this.config) === null || _h === void 0 ? void 0 : _h.inactiveText)) {
|
|
192
|
+
(_k = (_j = this.innerText) === null || _j === void 0 ? void 0 : _j.textNode) === null || _k === void 0 ? void 0 : _k.setText(((_l = this.config) === null || _l === void 0 ? void 0 : _l.activeText) || '');
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
(_m = this.inner) === null || _m === void 0 ? void 0 : _m.setStyleObj({
|
|
197
|
+
// padding: 0 #{map.get($switch-content-padding, 'default')} 0 calc(#{map.get(
|
|
198
|
+
// $switch-button-size,
|
|
199
|
+
// 'default'
|
|
200
|
+
// )} + 2px);
|
|
201
|
+
padding: '0 ' + td_switch_style_1.$switchContentPadding[((_o = this.config) === null || _o === void 0 ? void 0 : _o.size) || 'default'] + ' 0 calc(' + td_switch_style_1.$switchButtonSize[((_p = this.config) === null || _p === void 0 ? void 0 : _p.size) || 'default'] + ' + 2px)'
|
|
202
|
+
});
|
|
203
|
+
if (((_q = this.config) === null || _q === void 0 ? void 0 : _q.activeIcon) || ((_r = this.config) === null || _r === void 0 ? void 0 : _r.inactiveIcon)) {
|
|
204
|
+
(_s = this.innerIcon) === null || _s === void 0 ? void 0 : _s.replaceSvg(this.config.inactiveIcon);
|
|
205
|
+
}
|
|
206
|
+
else if (((_t = this.config) === null || _t === void 0 ? void 0 : _t.activeText) || ((_u = this.config) === null || _u === void 0 ? void 0 : _u.inactiveText)) {
|
|
207
|
+
(_w = (_v = this.innerText) === null || _v === void 0 ? void 0 : _v.textNode) === null || _w === void 0 ? void 0 : _w.setText(((_x = this.config) === null || _x === void 0 ? void 0 : _x.inactiveText) || '');
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
exports.TdSwitchCore = TdSwitchCore;
|