yuyeon 0.0.0 → 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/dist/style.css +1 -0
- package/dist/yuyeon.mjs +3607 -0
- package/dist/yuyeon.umd.js +1 -0
- package/lib/components/app/YApp.mjs +30 -0
- package/lib/components/app/YApp.mjs.map +1 -0
- package/lib/components/app/YApp.scss +14 -0
- package/lib/components/app/index.mjs +2 -0
- package/lib/components/app/index.mjs.map +1 -0
- package/lib/components/bench/YBench.mjs +44 -0
- package/lib/components/bench/YBench.mjs.map +1 -0
- package/lib/components/bench/index.mjs +2 -0
- package/lib/components/bench/index.mjs.map +1 -0
- package/lib/components/button/YButton.mjs +138 -0
- package/lib/components/button/YButton.mjs.map +1 -0
- package/{src/components/button/y-btn.scss → lib/components/button/YButton.scss} +67 -29
- package/lib/components/button/index.mjs +2 -0
- package/lib/components/button/index.mjs.map +1 -0
- package/lib/components/card/YCard.mjs +18 -0
- package/lib/components/card/YCard.mjs.map +1 -0
- package/lib/components/card/YCardBody.mjs +10 -0
- package/lib/components/card/YCardBody.mjs.map +1 -0
- package/lib/components/card/YCardFooter.mjs +10 -0
- package/lib/components/card/YCardFooter.mjs.map +1 -0
- package/lib/components/card/YCardHeader.mjs +10 -0
- package/lib/components/card/YCardHeader.mjs.map +1 -0
- package/lib/components/card/index.mjs +6 -0
- package/lib/components/card/index.mjs.map +1 -0
- package/lib/components/checkbox/YCheckbox.mjs +154 -0
- package/lib/components/checkbox/YCheckbox.mjs.map +1 -0
- package/lib/components/checkbox/YInputCheckbox.mjs +113 -0
- package/lib/components/checkbox/YInputCheckbox.mjs.map +1 -0
- package/{src/components/checkbox/y-input-checkbox.scss → lib/components/checkbox/YInputCheckbox.scss} +19 -19
- package/lib/components/checkbox/index.mjs +5 -0
- package/lib/components/checkbox/index.mjs.map +1 -0
- package/{src/components/chip/y-chip.vue → lib/components/chip/YChip.mjs} +26 -27
- package/lib/components/chip/YChip.mjs.map +1 -0
- package/{src/components/chip/y-chip.scss → lib/components/chip/YChip.scss} +0 -4
- package/lib/components/chip/index.mjs +3 -0
- package/lib/components/chip/index.mjs.map +1 -0
- package/lib/components/dialog/YDialog.mjs +97 -0
- package/lib/components/dialog/YDialog.mjs.map +1 -0
- package/lib/components/dialog/index.mjs +2 -0
- package/lib/components/dialog/index.mjs.map +1 -0
- package/lib/components/field-input/YFieldInput.mjs +218 -0
- package/lib/components/field-input/YFieldInput.mjs.map +1 -0
- package/{src/components/field-input/y-field-input.scss → lib/components/field-input/YFieldInput.scss} +2 -4
- package/lib/components/field-input/index.mjs +2 -0
- package/lib/components/field-input/index.mjs.map +1 -0
- package/lib/components/form/YForm.mjs +79 -0
- package/lib/components/form/YForm.mjs.map +1 -0
- package/lib/components/form/index.mjs +4 -0
- package/lib/components/form/index.mjs.map +1 -0
- package/lib/components/icons/YIconCheckbox.mjs +21 -0
- package/lib/components/icons/YIconCheckbox.mjs.map +1 -0
- package/lib/components/icons/YIconClear.mjs +16 -0
- package/lib/components/icons/YIconClear.mjs.map +1 -0
- package/lib/components/icons/YIconExpand.mjs +20 -0
- package/lib/components/icons/YIconExpand.mjs.map +1 -0
- package/lib/components/icons/index.mjs +4 -0
- package/lib/components/icons/index.mjs.map +1 -0
- package/lib/components/index.mjs +24 -0
- package/lib/components/index.mjs.map +1 -0
- package/lib/components/input/YInput.mjs +346 -0
- package/lib/components/input/YInput.mjs.map +1 -0
- package/{src/components/input/y-input.scss → lib/components/input/YInput.scss} +12 -4
- package/lib/components/input/index.mjs +2 -0
- package/lib/components/input/index.mjs.map +1 -0
- package/lib/components/input/index.scss +2 -0
- package/lib/components/layer/YLayer.mjs +193 -0
- package/lib/components/layer/YLayer.mjs.map +1 -0
- package/lib/components/layer/index.mjs +2 -0
- package/lib/components/layer/index.mjs.map +1 -0
- package/lib/components/layer/scroll-strategies.mjs +132 -0
- package/lib/components/layer/scroll-strategies.mjs.map +1 -0
- package/lib/components/list/YList.mjs +16 -0
- package/lib/components/list/YList.mjs.map +1 -0
- package/lib/components/list/YList.scss +3 -0
- package/lib/components/list/YListItem.mjs +37 -0
- package/lib/components/list/YListItem.mjs.map +1 -0
- package/lib/components/list/YListItem.scss +59 -0
- package/lib/components/list/index.mjs +3 -0
- package/lib/components/list/index.mjs.map +1 -0
- package/lib/components/loading/YSpinnerRing.mjs +25 -0
- package/lib/components/loading/YSpinnerRing.mjs.map +1 -0
- package/{src/components/ring-spinner/y-ring-spinner.scss → lib/components/loading/YSpinnerRing.scss} +3 -3
- package/lib/components/loading/index.mjs +2 -0
- package/lib/components/loading/index.mjs.map +1 -0
- package/lib/components/menu/YMenu.mjs +239 -0
- package/lib/components/menu/YMenu.mjs.map +1 -0
- package/lib/components/menu/YMenu.scss +7 -0
- package/lib/components/menu/index.mjs +2 -0
- package/lib/components/menu/index.mjs.map +1 -0
- package/lib/components/navigation/YNavigation.mjs +17 -0
- package/lib/components/navigation/YNavigation.mjs.map +1 -0
- package/lib/components/navigation/index.mjs +2 -0
- package/lib/components/navigation/index.mjs.map +1 -0
- package/lib/components/pagination/YPagination.mjs +61 -0
- package/lib/components/pagination/YPagination.mjs.map +1 -0
- package/lib/components/pagination/YPagination.scss +5 -0
- package/lib/components/pagination/index.mjs +2 -0
- package/lib/components/pagination/index.mjs.map +1 -0
- package/lib/components/panel/YDividePanel.mjs +89 -0
- package/lib/components/panel/YDividePanel.mjs.map +1 -0
- package/lib/components/panel/YDividePanel.scss +43 -0
- package/lib/components/panel/index.mjs +2 -0
- package/lib/components/panel/index.mjs.map +1 -0
- package/lib/components/plate/YPlate.mjs +27 -0
- package/lib/components/plate/YPlate.mjs.map +1 -0
- package/lib/components/plate/YPlate.scss +9 -0
- package/lib/components/plate/index.mjs +2 -0
- package/lib/components/plate/index.mjs.map +1 -0
- package/lib/components/progress-bar/YProgressBar.mjs +110 -0
- package/lib/components/progress-bar/YProgressBar.mjs.map +1 -0
- package/lib/components/progress-bar/YProgressBar.scss +40 -0
- package/lib/components/progress-bar/index.mjs +2 -0
- package/lib/components/progress-bar/index.mjs.map +1 -0
- package/lib/components/snackbar/YSnackbar.mjs +187 -0
- package/lib/components/snackbar/YSnackbar.mjs.map +1 -0
- package/lib/components/snackbar/YSnackbar.scss +38 -0
- package/lib/components/snackbar/index.mjs +2 -0
- package/lib/components/snackbar/index.mjs.map +1 -0
- package/lib/components/switch/YSwitch.mjs +228 -0
- package/lib/components/switch/YSwitch.mjs.map +1 -0
- package/{src/components/switch/y-switch.scss → lib/components/switch/YSwitch.scss} +18 -26
- package/lib/components/switch/index.mjs +2 -0
- package/lib/components/switch/index.mjs.map +1 -0
- package/lib/components/table/YDataTable.mjs +46 -0
- package/lib/components/table/YDataTable.mjs.map +1 -0
- package/lib/components/table/YDataTableBody.mjs +12 -0
- package/lib/components/table/YDataTableBody.mjs.map +1 -0
- package/lib/components/table/YDataTableCell.mjs +55 -0
- package/lib/components/table/YDataTableCell.mjs.map +1 -0
- package/lib/components/table/YDataTableControl.mjs +37 -0
- package/lib/components/table/YDataTableControl.mjs.map +1 -0
- package/lib/components/table/YDataTableControl.scss +6 -0
- package/lib/components/table/YDataTableHead.mjs +12 -0
- package/lib/components/table/YDataTableHead.mjs.map +1 -0
- package/lib/components/table/YDataTableLayer.mjs +14 -0
- package/lib/components/table/YDataTableLayer.mjs.map +1 -0
- package/lib/components/table/YDataTableRow.mjs +12 -0
- package/lib/components/table/YDataTableRow.mjs.map +1 -0
- package/lib/components/table/YDataTableServer.mjs +54 -0
- package/lib/components/table/YDataTableServer.mjs.map +1 -0
- package/lib/components/table/YTable.mjs +53 -0
- package/lib/components/table/YTable.mjs.map +1 -0
- package/lib/components/table/YTable.scss +61 -0
- package/lib/components/table/index.mjs +4 -0
- package/lib/components/table/index.mjs.map +1 -0
- package/lib/components/table/pagination.mjs +21 -0
- package/lib/components/table/pagination.mjs.map +1 -0
- package/lib/components/text-highlighter/YTextHighlighter.mjs +94 -0
- package/lib/components/text-highlighter/YTextHighlighter.mjs.map +1 -0
- package/lib/components/text-highlighter/index.mjs +3 -0
- package/lib/components/text-highlighter/index.mjs.map +1 -0
- package/lib/components/tooltip/YTooltip.mjs +209 -0
- package/lib/components/tooltip/YTooltip.mjs.map +1 -0
- package/lib/components/tooltip/YTooltip.scss +19 -0
- package/lib/components/tooltip/index.mjs +2 -0
- package/lib/components/tooltip/index.mjs.map +1 -0
- package/lib/components/transitions/expand-transition.mjs +88 -0
- package/lib/components/transitions/expand-transition.mjs.map +1 -0
- package/lib/components/transitions/index.mjs +4 -0
- package/lib/components/transitions/index.mjs.map +1 -0
- package/lib/components/tree-view/YTreeView.mjs +92 -0
- package/lib/components/tree-view/YTreeView.mjs.map +1 -0
- package/lib/components/tree-view/YTreeView.scss +46 -0
- package/lib/components/tree-view/YTreeViewNode.mjs +122 -0
- package/lib/components/tree-view/YTreeViewNode.mjs.map +1 -0
- package/lib/components/tree-view/index.mjs +3 -0
- package/lib/components/tree-view/index.mjs.map +1 -0
- package/lib/composables/collections.mjs +2 -0
- package/lib/composables/collections.mjs.map +1 -0
- package/lib/composables/communication.mjs +46 -0
- package/lib/composables/communication.mjs.map +1 -0
- package/lib/composables/component.mjs +8 -0
- package/lib/composables/component.mjs.map +1 -0
- package/{src/composables/layer-group.ts → lib/composables/layer-group.mjs} +8 -10
- package/lib/composables/layer-group.mjs.map +1 -0
- package/lib/composables/layout.mjs +13 -0
- package/lib/composables/layout.mjs.map +1 -0
- package/lib/composables/levitation.mjs +135 -0
- package/lib/composables/levitation.mjs.map +1 -0
- package/{src/composables/progress.ts → lib/composables/progress.mjs} +6 -5
- package/lib/composables/progress.mjs.map +1 -0
- package/lib/composables/resize-observer.mjs +34 -0
- package/lib/composables/resize-observer.mjs.map +1 -0
- package/lib/composables/scope.mjs +27 -0
- package/lib/composables/scope.mjs.map +1 -0
- package/lib/composables/theme/index.mjs +49 -0
- package/lib/composables/theme/index.mjs.map +1 -0
- package/lib/composables/theme/setting.mjs +46 -0
- package/lib/composables/theme/setting.mjs.map +1 -0
- package/lib/composables/timing.mjs +77 -0
- package/lib/composables/timing.mjs.map +1 -0
- package/lib/composables/transition.mjs +50 -0
- package/lib/composables/transition.mjs.map +1 -0
- package/lib/directives/complement-click/index.mjs +78 -0
- package/lib/directives/complement-click/index.mjs.map +1 -0
- package/{src/directives/plate-wave/index.ts → lib/directives/plate-wave/index.mjs} +25 -42
- package/lib/directives/plate-wave/index.mjs.map +1 -0
- package/{src → lib}/directives/plate-wave/plate-wave.scss +1 -1
- package/lib/directives/theme-class.mjs +24 -0
- package/lib/directives/theme-class.mjs.map +1 -0
- package/lib/etc/index.mjs +6 -0
- package/lib/etc/index.mjs.map +1 -0
- package/lib/index.mjs +55 -0
- package/lib/index.mjs.map +1 -0
- package/{src/mixins/di.ts → lib/mixins/di.mjs} +7 -8
- package/lib/mixins/di.mjs.map +1 -0
- package/{src/mixins/rebind-attrs.ts → lib/mixins/rebind-attrs.mjs} +9 -8
- package/lib/mixins/rebind-attrs.mjs.map +1 -0
- package/{src/styles/palette.scss → lib/styles/_palette.scss} +0 -4
- package/lib/styles/base.scss +95 -0
- package/lib/styles/settings/_variables.scss +14 -0
- package/lib/styles/settings/provided.scss +35 -0
- package/lib/styles/theme/dark.scss +21 -0
- package/{src → lib}/styles/theme/index.scss +0 -3
- package/lib/styles/theme/light.scss +21 -0
- package/lib/util/FrameScheduler.mjs +29 -0
- package/lib/util/FrameScheduler.mjs.map +1 -0
- package/lib/util/Rect.mjs +27 -0
- package/lib/util/Rect.mjs.map +1 -0
- package/lib/util/common.mjs +66 -0
- package/lib/util/common.mjs.map +1 -0
- package/lib/util/dom.mjs +8 -0
- package/lib/util/dom.mjs.map +1 -0
- package/lib/util/scroll.mjs +28 -0
- package/lib/util/scroll.mjs.map +1 -0
- package/lib/util/string.mjs +33 -0
- package/lib/util/string.mjs.map +1 -0
- package/lib/util/ui.mjs +83 -0
- package/lib/util/ui.mjs.map +1 -0
- package/lib/util/validation.mjs +5 -0
- package/lib/util/validation.mjs.map +1 -0
- package/lib/util/vue-component.mjs +64 -0
- package/lib/util/vue-component.mjs.map +1 -0
- package/package.json +62 -22
- package/types/components/app/YApp.d.ts +7 -0
- package/types/components/app/index.d.ts +1 -0
- package/types/components/button/YButton.d.ts +122 -0
- package/types/components/button/index.d.ts +1 -0
- package/types/components/card/YCard.d.ts +11 -0
- package/types/components/card/YCardBody.d.ts +2 -0
- package/types/components/card/YCardFooter.d.ts +2 -0
- package/types/components/card/YCardHeader.d.ts +2 -0
- package/types/components/card/index.d.ts +5 -0
- package/types/components/checkbox/YCheckbox.d.ts +46 -0
- package/types/components/checkbox/YInputCheckbox.d.ts +42 -0
- package/types/components/checkbox/index.d.ts +4 -0
- package/types/components/chip/YChip.d.ts +34 -0
- package/types/components/chip/index.d.ts +2 -0
- package/types/components/dialog/YDialog.d.ts +120 -0
- package/types/components/dialog/index.d.ts +1 -0
- package/types/components/field-input/YFieldInput.d.ts +118 -0
- package/types/components/field-input/index.d.ts +1 -0
- package/types/components/form/YForm.d.ts +32 -0
- package/types/components/form/index.d.ts +3 -0
- package/types/components/icons/YIconCheckbox.d.ts +1 -0
- package/types/components/icons/YIconClear.d.ts +1 -0
- package/types/components/icons/YIconExpand.d.ts +1 -0
- package/types/components/icons/index.d.ts +3 -0
- package/types/components/index.d.ts +23 -0
- package/types/components/input/YInput.d.ts +166 -0
- package/types/components/input/index.d.ts +1 -0
- package/types/components/layer/YLayer.d.ts +99 -0
- package/types/components/layer/index.d.ts +1 -0
- package/types/components/list/YList.d.ts +2 -0
- package/types/components/list/YListItem.d.ts +28 -0
- package/types/components/list/index.d.ts +2 -0
- package/types/components/loading/YSpinnerRing.d.ts +1 -0
- package/types/components/loading/index.d.ts +1 -0
- package/types/components/menu/YMenu.d.ts +236 -0
- package/types/components/menu/index.d.ts +1 -0
- package/types/components/pagination/YPagination.d.ts +106 -0
- package/types/components/pagination/index.d.ts +1 -0
- package/types/components/panel/YDividePanel.d.ts +3 -0
- package/types/components/panel/index.d.ts +1 -0
- package/types/components/plate/YPlate.d.ts +10 -0
- package/types/components/plate/index.d.ts +1 -0
- package/types/components/progress-bar/YProgressBar.d.ts +59 -0
- package/types/components/progress-bar/index.d.ts +1 -0
- package/types/components/snackbar/YSnackbar.d.ts +77 -0
- package/types/components/snackbar/index.d.ts +1 -0
- package/types/components/switch/YSwitch.d.ts +106 -0
- package/types/components/switch/index.d.ts +1 -0
- package/types/components/table/YDataTable.d.ts +63 -0
- package/types/components/table/YDataTableBody.d.ts +2 -0
- package/types/components/table/YDataTableControl.d.ts +2 -0
- package/types/components/table/YDataTableHead.d.ts +2 -0
- package/types/components/table/YDataTableLayer.d.ts +2 -0
- package/types/components/table/YDataTableServer.d.ts +82 -0
- package/types/components/table/YTable.d.ts +32 -0
- package/types/components/table/index.d.ts +3 -0
- package/types/components/table/pagination.d.ts +38 -0
- package/types/components/tooltip/YTooltip.d.ts +188 -0
- package/types/components/tooltip/index.d.ts +1 -0
- package/types/components/transitions/expand-transition.d.ts +16 -0
- package/types/components/transitions/index.d.ts +32 -0
- package/types/components/tree-view/YTreeView.d.ts +37 -0
- package/types/components/tree-view/YTreeViewNode.d.ts +51 -0
- package/types/components/tree-view/index.d.ts +2 -0
- package/types/composables/communication.d.ts +1 -0
- package/types/composables/component.d.ts +2 -0
- package/types/composables/layer-group.d.ts +5 -0
- package/types/composables/progress.d.ts +3 -0
- package/types/composables/resize-observer.d.ts +14 -0
- package/types/composables/scope.d.ts +2 -0
- package/types/composables/theme/index.d.ts +15 -0
- package/types/composables/theme/setting.d.ts +12 -0
- package/types/composables/timing.d.ts +15 -0
- package/types/composables/transition.d.ts +21 -0
- package/types/directives/complement-click/index.d.ts +25 -0
- package/types/directives/plate-wave/index.d.ts +13 -0
- package/types/directives/theme-class.d.ts +3 -0
- package/types/etc/index.d.ts +1 -0
- package/types/globals.d.ts +11 -0
- package/types/index.d.ts +9 -0
- package/types/mixins/di.d.ts +2 -0
- package/types/mixins/rebind-attrs.d.ts +5 -0
- package/types/shims.d.ts +71 -0
- package/types/util/common.d.ts +8 -0
- package/types/util/dom.d.ts +1 -0
- package/types/util/string.d.ts +3 -0
- package/types/util/ui.d.ts +9 -0
- package/types/util/vue-component.d.ts +33 -0
- package/types/vite-env.d.ts +1 -0
- package/src/components/button/index.ts +0 -3
- package/src/components/button/y-btn.ts +0 -104
- package/src/components/card/index.ts +0 -6
- package/src/components/card/y-card-body.ts +0 -8
- package/src/components/card/y-card-footer.ts +0 -8
- package/src/components/card/y-card-header.ts +0 -8
- package/src/components/card/y-card.ts +0 -16
- package/src/components/checkbox/IconCheckbox.vue +0 -24
- package/src/components/checkbox/YCheckbox.vue +0 -113
- package/src/components/checkbox/YInputCheckbox.vue +0 -108
- package/src/components/checkbox/index.ts +0 -8
- package/src/components/chip/index.ts +0 -3
- package/src/components/dialog/index.ts +0 -3
- package/src/components/dialog/y-dialog.vue +0 -46
- package/src/components/field-input/index.scss +0 -5
- package/src/components/field-input/index.ts +0 -11
- package/src/components/field-input/y-field-input.ts +0 -214
- package/src/components/form/index.ts +0 -9
- package/src/components/form/y-form.ts +0 -93
- package/src/components/icons/icon-clearable.ts +0 -6
- package/src/components/index.ts +0 -17
- package/src/components/input/index.scss +0 -5
- package/src/components/input/index.ts +0 -9
- package/src/components/input/y-input.ts +0 -368
- package/src/components/layer/index.ts +0 -3
- package/src/components/layer/y-layer.vue +0 -146
- package/src/components/lottie-player.ts +0 -41
- package/src/components/progress-bar/index.ts +0 -3
- package/src/components/progress-bar/y-progress-bar.vue +0 -144
- package/src/components/ring-spinner/y-ring-spinner.vue +0 -31
- package/src/components/switch/YSwitch.vue +0 -217
- package/src/components/switch/index.scss +0 -5
- package/src/components/switch/index.ts +0 -11
- package/src/components/text-highlighter/index.scss +0 -5
- package/src/components/text-highlighter/index.ts +0 -3
- package/src/components/text-highlighter/y-text-highlighter.ts +0 -89
- package/src/composables/lazy.ts +0 -30
- package/src/composables/theme.ts +0 -25
- package/src/directives/complement-click/index.ts +0 -123
- package/src/directives/theme-class.ts +0 -14
- package/src/file-extension.d.ts +0 -14
- package/src/index.ts +0 -21
- package/src/styles/base.scss +0 -28
- package/src/styles/theme/dark.scss +0 -35
- package/src/styles/theme/light.scss +0 -32
- package/src/util/common.ts +0 -59
- package/src/util/date-time.ts +0 -41
- package/src/util/dom.ts +0 -6
- package/src/util/string.ts +0 -9
- package/src/util/ui.ts +0 -39
- package/src/util/validation.ts +0 -9
- package/src/util/vue-component.ts +0 -18
- /package/{src/components/card/y-card.scss → lib/components/card/YCard.scss} +0 -0
- /package/{src/components/checkbox/y-checkbox.scss → lib/components/checkbox/YCheckbox.scss} +0 -0
- /package/{src/components/dialog/y-dialog.scss → lib/components/dialog/YDialog.scss} +0 -0
- /package/{src/components/layer/y-layer.scss → lib/components/layer/YLayer.scss} +0 -0
- /package/{src/components/text-highlighter/y-text-highlighter.scss → lib/components/text-highlighter/YTextHighlighter.scss} +0 -0
- /package/{src/styles/variables.scss → lib/styles/_variables.scss} +0 -0
- /package/{src → lib}/styles/util/helper.scss +0 -0
- /package/{src → lib}/styles/util/theme.scss +0 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { createVNode as _createVNode, Fragment as _Fragment } from "vue";
|
|
2
|
+
import { animate } from 'motion';
|
|
3
|
+
import { computed, defineComponent, ref, watch, withModifiers } from 'vue';
|
|
4
|
+
import { useModelDuplex } from "../../composables/communication.mjs";
|
|
5
|
+
import { useRender } from "../../composables/component.mjs";
|
|
6
|
+
import { useTimer } from "../../composables/timing.mjs";
|
|
7
|
+
import { bindClasses } from "../../util/vue-component.mjs";
|
|
8
|
+
import { YLayer } from "../layer/index.mjs";
|
|
9
|
+
import { YPlate } from "../plate/index.mjs";
|
|
10
|
+
import "./YSnackbar.scss";
|
|
11
|
+
const defaultSnackbarTransition = {
|
|
12
|
+
name: 'y-snackbar',
|
|
13
|
+
onBeforeEnter: direction => el => {
|
|
14
|
+
if (!el.getAttribute('data-transform')) {
|
|
15
|
+
const cache = el.style.getPropertyValue('transform');
|
|
16
|
+
el.setAttribute('data-transform', cache);
|
|
17
|
+
el.style.setProperty('transform', `${cache} translateY(${direction === 'top' ? '-' : ''}40px)`);
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
onEnter(el, done) {
|
|
21
|
+
const cache = el.getAttribute('data-transform');
|
|
22
|
+
const motion = el.getAttribute('data-motion');
|
|
23
|
+
if (motion || !cache) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
el.setAttribute('data-motion', 'true');
|
|
27
|
+
animate(el, {
|
|
28
|
+
transform: `${cache.replace(/translateY(.+)/, 'translateY(0)')}`
|
|
29
|
+
}, {
|
|
30
|
+
duration: 0.1
|
|
31
|
+
}).finished.then(() => {
|
|
32
|
+
el.removeAttribute('data-transform');
|
|
33
|
+
el.removeAttribute('data-motion');
|
|
34
|
+
done();
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
export const YSnackbar = defineComponent({
|
|
39
|
+
name: 'YSnackbar',
|
|
40
|
+
components: {
|
|
41
|
+
YPlate,
|
|
42
|
+
YLayer
|
|
43
|
+
},
|
|
44
|
+
emits: ['update:modelValue', 'click'],
|
|
45
|
+
props: {
|
|
46
|
+
modelValue: {
|
|
47
|
+
type: Boolean
|
|
48
|
+
},
|
|
49
|
+
contentClasses: {
|
|
50
|
+
type: [Array, String, Object]
|
|
51
|
+
},
|
|
52
|
+
position: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: 'top center'
|
|
55
|
+
},
|
|
56
|
+
transition: {
|
|
57
|
+
type: [String, Object],
|
|
58
|
+
default: () => ({
|
|
59
|
+
...defaultSnackbarTransition
|
|
60
|
+
})
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* @property Number
|
|
64
|
+
*
|
|
65
|
+
* The amount of time the snackbar should be displayed.
|
|
66
|
+
* @default 4000
|
|
67
|
+
*/
|
|
68
|
+
duration: {
|
|
69
|
+
type: Number,
|
|
70
|
+
default: 4000
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
setup(props, _ref) {
|
|
74
|
+
let {
|
|
75
|
+
emit,
|
|
76
|
+
slots
|
|
77
|
+
} = _ref;
|
|
78
|
+
const active = useModelDuplex(props);
|
|
79
|
+
const hover = ref(false);
|
|
80
|
+
const classes = computed(() => {
|
|
81
|
+
return {
|
|
82
|
+
'y-snackbar': true
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
const computedContentClasses = computed(() => {
|
|
86
|
+
const boundClasses = bindClasses(props.contentClasses);
|
|
87
|
+
return {
|
|
88
|
+
...boundClasses,
|
|
89
|
+
'y-snackbar__display': true
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
const computedInset = computed(() => {
|
|
93
|
+
const [first, second] = props.position?.split(' ');
|
|
94
|
+
let y = 'top';
|
|
95
|
+
let x = 'left';
|
|
96
|
+
if (second) {
|
|
97
|
+
x = second;
|
|
98
|
+
y = first;
|
|
99
|
+
} else {
|
|
100
|
+
x = first;
|
|
101
|
+
}
|
|
102
|
+
const ret = {
|
|
103
|
+
[x === 'center' ? 'left' : x]: x === 'center' ? `50%` : 0,
|
|
104
|
+
[y]: 0
|
|
105
|
+
};
|
|
106
|
+
if (x === 'center') {
|
|
107
|
+
ret.transform = 'translateX(-50%)';
|
|
108
|
+
}
|
|
109
|
+
return ret;
|
|
110
|
+
});
|
|
111
|
+
function dismiss() {
|
|
112
|
+
active.value = false;
|
|
113
|
+
}
|
|
114
|
+
const {
|
|
115
|
+
start,
|
|
116
|
+
stop,
|
|
117
|
+
reset
|
|
118
|
+
} = useTimer(dismiss, props.duration);
|
|
119
|
+
function setTimer() {
|
|
120
|
+
if (props.duration > 0) {
|
|
121
|
+
start();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
watch(hover, neo => {
|
|
125
|
+
if (neo) {
|
|
126
|
+
stop();
|
|
127
|
+
} else {
|
|
128
|
+
setTimer();
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
watch(active, neo => {
|
|
132
|
+
if (neo) {
|
|
133
|
+
setTimer();
|
|
134
|
+
} else {
|
|
135
|
+
reset();
|
|
136
|
+
}
|
|
137
|
+
}, {
|
|
138
|
+
immediate: true
|
|
139
|
+
});
|
|
140
|
+
function onClickContent(event) {
|
|
141
|
+
emit('click', event);
|
|
142
|
+
active.value = false;
|
|
143
|
+
}
|
|
144
|
+
const proxyTransition = computed(() => {
|
|
145
|
+
const {
|
|
146
|
+
transition,
|
|
147
|
+
position
|
|
148
|
+
} = props;
|
|
149
|
+
if (transition?.name === 'y-snackbar') {
|
|
150
|
+
transition.onBeforeEnter = defaultSnackbarTransition.onBeforeEnter(position.includes('top') ? 'top' : 'bottom');
|
|
151
|
+
return {
|
|
152
|
+
...transition
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
return props.transition;
|
|
156
|
+
});
|
|
157
|
+
useRender(() => {
|
|
158
|
+
return _createVNode(YLayer, {
|
|
159
|
+
"modelValue": active.value,
|
|
160
|
+
"onUpdate:modelValue": v => active.value = v,
|
|
161
|
+
"classes": classes.value,
|
|
162
|
+
"content-classes": computedContentClasses.value,
|
|
163
|
+
"scrim": false,
|
|
164
|
+
"content-styles": computedInset.value,
|
|
165
|
+
"transition": proxyTransition.value,
|
|
166
|
+
"ref": "layer"
|
|
167
|
+
}, {
|
|
168
|
+
default: () => _createVNode(_Fragment, null, [_createVNode(YPlate, null, null), _createVNode("div", {
|
|
169
|
+
"class": "y-snackbar__content",
|
|
170
|
+
"onClick": withModifiers(onClickContent, ['capture']),
|
|
171
|
+
"onMouseenter": () => hover.value = true,
|
|
172
|
+
"onMouseleave": () => hover.value = false
|
|
173
|
+
}, [slots.default?.()])])
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
return {
|
|
177
|
+
active,
|
|
178
|
+
hover,
|
|
179
|
+
classes,
|
|
180
|
+
computedContentClasses,
|
|
181
|
+
computedInset,
|
|
182
|
+
proxyTransition,
|
|
183
|
+
onClickContent
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
//# sourceMappingURL=YSnackbar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YSnackbar.mjs","names":["animate","computed","defineComponent","ref","watch","withModifiers","useModelDuplex","useRender","useTimer","bindClasses","YLayer","YPlate","defaultSnackbarTransition","name","onBeforeEnter","direction","el","getAttribute","cache","style","getPropertyValue","setAttribute","setProperty","onEnter","done","motion","transform","replace","duration","finished","then","removeAttribute","YSnackbar","components","emits","props","modelValue","type","Boolean","contentClasses","Array","String","Object","position","default","transition","Number","setup","_ref","emit","slots","active","hover","classes","computedContentClasses","boundClasses","computedInset","first","second","split","y","x","ret","dismiss","value","start","stop","reset","setTimer","neo","immediate","onClickContent","event","proxyTransition","includes","_createVNode","v","_Fragment","onMouseenter","onMouseleave"],"sources":["../../../src/components/snackbar/YSnackbar.tsx"],"sourcesContent":["import { animate } from 'motion';\nimport {\n PropType,\n computed,\n defineComponent,\n ref,\n watch,\n withModifiers,\n} from 'vue';\n\nimport { useModelDuplex } from '../../composables/communication';\nimport { useRender } from '../../composables/component';\nimport { useTimer } from '../../composables/timing';\nimport { bindClasses } from '../../util/vue-component';\nimport { YLayer } from '../layer';\nimport { YPlate } from '../plate';\n\nimport './YSnackbar.scss';\n\nconst defaultSnackbarTransition = {\n name: 'y-snackbar',\n onBeforeEnter: (direction: 'top' | 'bottom') => (el: HTMLElement) => {\n if (!el.getAttribute('data-transform')) {\n const cache = el.style.getPropertyValue('transform');\n el.setAttribute('data-transform', cache);\n el.style.setProperty(\n 'transform',\n `${cache} translateY(${direction === 'top' ? '-' : ''}40px)`,\n );\n }\n },\n onEnter(el: HTMLElement, done: () => void) {\n const cache = el.getAttribute('data-transform');\n const motion = el.getAttribute('data-motion');\n if (motion || !cache) {\n return;\n }\n el.setAttribute('data-motion', 'true');\n animate(\n el,\n {\n transform: `${cache.replace(/translateY(.+)/, 'translateY(0)')}`,\n },\n { duration: 0.1 },\n ).finished.then(() => {\n el.removeAttribute('data-transform');\n el.removeAttribute('data-motion');\n done();\n });\n },\n};\n\nexport const YSnackbar = defineComponent({\n name: 'YSnackbar',\n components: { YPlate, YLayer },\n emits: ['update:modelValue', 'click'],\n props: {\n modelValue: {\n type: Boolean as PropType<boolean>,\n },\n contentClasses: {\n type: [Array, String, Object] as PropType<\n string[] | string | Record<string, any>\n >,\n },\n position: {\n type: String as PropType<string>,\n default: 'top center',\n },\n transition: {\n type: [String, Object] as PropType<string | any>,\n default: () => ({ ...defaultSnackbarTransition }),\n },\n /**\n * @property Number\n *\n * The amount of time the snackbar should be displayed.\n * @default 4000\n */\n duration: {\n type: Number as PropType<number>,\n default: 4000,\n },\n },\n setup(props, { emit, slots }) {\n const active = useModelDuplex(props);\n const hover = ref(false);\n\n const classes = computed(() => {\n return {\n 'y-snackbar': true,\n };\n });\n\n const computedContentClasses = computed<Record<string, boolean>>(() => {\n const boundClasses = bindClasses(props.contentClasses);\n return {\n ...boundClasses,\n 'y-snackbar__display': true,\n };\n });\n\n const computedInset = computed(() => {\n const [first, second] = props.position?.split(' ');\n let y = 'top';\n let x = 'left';\n if (second) {\n x = second;\n y = first;\n } else {\n x = first;\n }\n const ret = {\n [x === 'center' ? 'left' : x]: x === 'center' ? `50%` : 0,\n [y]: 0,\n } as any;\n if (x === 'center') {\n ret.transform = 'translateX(-50%)';\n }\n return ret;\n });\n\n function dismiss() {\n active.value = false;\n }\n\n const { start, stop, reset } = useTimer(dismiss, props.duration);\n function setTimer() {\n if (props.duration > 0) {\n start();\n }\n }\n\n watch(hover, (neo: boolean) => {\n if (neo) {\n stop();\n } else {\n setTimer();\n }\n });\n\n watch(\n active,\n (neo: boolean) => {\n if (neo) {\n setTimer();\n } else {\n reset();\n }\n },\n { immediate: true },\n );\n\n function onClickContent(event: MouseEvent) {\n emit('click', event);\n active.value = false;\n }\n\n const proxyTransition = computed(() => {\n const { transition, position } = props;\n if (transition?.name === 'y-snackbar') {\n transition.onBeforeEnter = defaultSnackbarTransition.onBeforeEnter(\n position.includes('top') ? 'top' : 'bottom',\n );\n return { ...transition };\n }\n return props.transition;\n });\n\n useRender(() => {\n return (\n <YLayer\n modelValue={active.value}\n onUpdate:modelValue={(v) => (active.value = v)}\n classes={classes.value}\n content-classes={computedContentClasses.value}\n scrim={false}\n content-styles={computedInset.value}\n transition={proxyTransition.value as any}\n ref=\"layer\"\n >\n {{\n default: () => (\n <>\n <YPlate></YPlate>\n <div\n class=\"y-snackbar__content\"\n onClick={withModifiers(onClickContent, ['capture'])}\n onMouseenter={() => (hover.value = true)}\n onMouseleave={() => (hover.value = false)}\n >\n {slots.default?.()}\n </div>\n </>\n ),\n }}\n </YLayer>\n );\n });\n\n return {\n active,\n hover,\n classes,\n computedContentClasses,\n computedInset,\n proxyTransition,\n onClickContent,\n };\n },\n});\n"],"mappings":";AAAA,SAASA,OAAO,QAAQ,QAAQ;AAChC,SAEEC,QAAQ,EACRC,eAAe,EACfC,GAAG,EACHC,KAAK,EACLC,aAAa,QACR,KAAK;AAAC,SAEJC,cAAc;AAAA,SACdC,SAAS;AAAA,SACTC,QAAQ;AAAA,SACRC,WAAW;AAAA,SACXC,MAAM;AAAA,SACNC,MAAM;AAEf;AAEA,MAAMC,yBAAyB,GAAG;EAChCC,IAAI,EAAE,YAAY;EAClBC,aAAa,EAAGC,SAA2B,IAAMC,EAAe,IAAK;IACnE,IAAI,CAACA,EAAE,CAACC,YAAY,CAAC,gBAAgB,CAAC,EAAE;MACtC,MAAMC,KAAK,GAAGF,EAAE,CAACG,KAAK,CAACC,gBAAgB,CAAC,WAAW,CAAC;MACpDJ,EAAE,CAACK,YAAY,CAAC,gBAAgB,EAAEH,KAAK,CAAC;MACxCF,EAAE,CAACG,KAAK,CAACG,WAAW,CAClB,WAAW,EACV,GAAEJ,KAAM,eAAcH,SAAS,KAAK,KAAK,GAAG,GAAG,GAAG,EAAG,OACxD,CAAC;IACH;EACF,CAAC;EACDQ,OAAOA,CAACP,EAAe,EAAEQ,IAAg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FY,CAAC,IAAMzB,MAAM,CAACa,KAAK,GAAGY,CAAE;QAAA,WACrCvB,OAAO,CAACW,KAAK;QAAA,mBACLV,sBAAsB,CAACU,KAAK;QAAA,SACtC,KAAK;QAAA,kBACIR,aAAa,CAACQ,KAAK;QAAA,cACvBS,eAAe,CAACT,KAAK;QAAA,OAC7B;MAAO;QAGTpB,OAAO,EAAEA,CAAA,KAAA+B,YAAA,CAAAE,SAAA,SAAAF,YAAA,CAAAhE,MAAA,eAAAgE,YAAA;UAAA,SAIG,qBAAqB;UAAA,WAClBtE,aAAa,CAACkE,cAAc,EAAE,CAAC,SAAS,CAAC,CAAC;UAAA,gBACrCO,CAAA,KAAO1B,KAAK,CAACY,KAAK,GAAG,IAAK;UAAA,gBAC1Be,CAAA,KAAO3B,KAAK,CAACY,KAAK,GAAG;QAAM,IAExCd,KAAK,CAACN,OAAO,GAAG,CAAC;MAGvB;IAIT,CAAC,CAAC;IAEF,OAAO;MACLO,MAAM;MACNC,KAAK;MACLC,OAAO;MACPC,sBAAsB;MACtBE,aAAa;MACbiB,eAAe;MACfF;IACF,CAAC;EACH;AACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.y-snackbar {
|
|
2
|
+
font-size: 1rem;
|
|
3
|
+
margin: 8px;
|
|
4
|
+
|
|
5
|
+
&__display {
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
min-height: 48px;
|
|
9
|
+
min-width: 240px;
|
|
10
|
+
z-index: inherit;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&__content {
|
|
14
|
+
position: relative;
|
|
15
|
+
flex-grow: 1;
|
|
16
|
+
font-size: 0.875em;
|
|
17
|
+
font-weight: 400;
|
|
18
|
+
line-height: 0.625em;
|
|
19
|
+
padding: 0.875em;
|
|
20
|
+
z-index: inherit;
|
|
21
|
+
color: #fff;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.y-plate {
|
|
25
|
+
background-color: rgba(0, 0, 0, 0.74);
|
|
26
|
+
backdrop-filter: blur(4px);
|
|
27
|
+
box-shadow: 0 0 4px -1px rgba(0, 0, 0, 0.4);
|
|
28
|
+
z-index: inherit;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&-leave-active {
|
|
32
|
+
transition: all 300ms ease-in-out;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&-leave-to {
|
|
36
|
+
opacity: 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/components/snackbar/index.ts"],"sourcesContent":["export * from './YSnackbar';\n"],"mappings":""}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { createVNode as _createVNode } from "vue";
|
|
2
|
+
import { defineComponent, withModifiers } from 'vue';
|
|
3
|
+
import "./YSwitch.scss";
|
|
4
|
+
let uidCounter = 0;
|
|
5
|
+
export const YSwitch = defineComponent({
|
|
6
|
+
name: 'YSwitch',
|
|
7
|
+
model: {
|
|
8
|
+
prop: 'input',
|
|
9
|
+
event: 'change'
|
|
10
|
+
},
|
|
11
|
+
props: {
|
|
12
|
+
input: {
|
|
13
|
+
type: [Boolean, Array],
|
|
14
|
+
default: false
|
|
15
|
+
},
|
|
16
|
+
value: {
|
|
17
|
+
type: [String, Number, Object]
|
|
18
|
+
},
|
|
19
|
+
max: {
|
|
20
|
+
type: Number
|
|
21
|
+
},
|
|
22
|
+
loading: {
|
|
23
|
+
type: Boolean
|
|
24
|
+
},
|
|
25
|
+
disabled: {
|
|
26
|
+
type: Boolean
|
|
27
|
+
},
|
|
28
|
+
stickOut: {
|
|
29
|
+
type: Boolean
|
|
30
|
+
},
|
|
31
|
+
stateLabel: {
|
|
32
|
+
type: Boolean
|
|
33
|
+
},
|
|
34
|
+
color: {
|
|
35
|
+
type: String
|
|
36
|
+
},
|
|
37
|
+
labelOn: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'ON'
|
|
40
|
+
},
|
|
41
|
+
labelOff: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: 'OFF'
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
data() {
|
|
47
|
+
return {
|
|
48
|
+
innerValue: false,
|
|
49
|
+
counterId: '',
|
|
50
|
+
focused: false
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
created() {
|
|
54
|
+
const iid = uidCounter.toString();
|
|
55
|
+
uidCounter += 1;
|
|
56
|
+
this.counterId = iid;
|
|
57
|
+
if (Array.isArray(this.input)) {
|
|
58
|
+
this.inputByValue();
|
|
59
|
+
} else {
|
|
60
|
+
this.innerValue = this.input;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
computed: {
|
|
64
|
+
isMultipleInput() {
|
|
65
|
+
return Array.isArray(this.input);
|
|
66
|
+
},
|
|
67
|
+
multipleInputIndex() {
|
|
68
|
+
if (!Array.isArray(this.input)) {
|
|
69
|
+
return -1;
|
|
70
|
+
}
|
|
71
|
+
return this.input.findIndex(inp => {
|
|
72
|
+
return inp === this.value;
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
inputId() {
|
|
76
|
+
const id = this.counterId;
|
|
77
|
+
return `y-switch--${id}`;
|
|
78
|
+
},
|
|
79
|
+
trackStyles() {
|
|
80
|
+
return {
|
|
81
|
+
backgroundColor: this.color
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
classes() {
|
|
85
|
+
return {
|
|
86
|
+
'y-switch--disabled': this.disabled,
|
|
87
|
+
'y-switch--loading': this.loading,
|
|
88
|
+
'y-switch--active': this.innerValue,
|
|
89
|
+
'y-switch--stick-out': this.stickOut,
|
|
90
|
+
'y-switch--focused': this.focused
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
methods: {
|
|
95
|
+
inputByValue() {
|
|
96
|
+
if (Array.isArray(this.input)) {
|
|
97
|
+
const found = this.input.find(inp => {
|
|
98
|
+
return inp === this.value;
|
|
99
|
+
});
|
|
100
|
+
if (found !== undefined) {
|
|
101
|
+
this.innerValue = true;
|
|
102
|
+
} else {
|
|
103
|
+
this.innerValue = false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
changeMultipleInput(checked) {
|
|
108
|
+
if (Array.isArray(this.input)) {
|
|
109
|
+
const multipleInput = this.input.slice();
|
|
110
|
+
if (checked && this.max !== undefined && multipleInput.length >= this.max) {
|
|
111
|
+
this.$emit('overmax');
|
|
112
|
+
this.nextChange(false, multipleInput);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (checked && this.multipleInputIndex < 0) {
|
|
116
|
+
multipleInput.push(this.value);
|
|
117
|
+
} else if (this.multipleInputIndex > -1) {
|
|
118
|
+
multipleInput.splice(this.multipleInputIndex, 1);
|
|
119
|
+
}
|
|
120
|
+
this.$emit('change', multipleInput);
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
nextChange(checked, value) {
|
|
124
|
+
this.$nextTick(() => {
|
|
125
|
+
this.innerValue = checked;
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
onClick($event) {
|
|
129
|
+
if (this.disabled || this.loading) return;
|
|
130
|
+
this.changeInput(!this.innerValue, $event);
|
|
131
|
+
},
|
|
132
|
+
onFocus() {
|
|
133
|
+
this.focused = true;
|
|
134
|
+
},
|
|
135
|
+
onBlur() {
|
|
136
|
+
this.focused = false;
|
|
137
|
+
},
|
|
138
|
+
onKeydown($event) {
|
|
139
|
+
// nothing
|
|
140
|
+
},
|
|
141
|
+
onChange($event) {
|
|
142
|
+
const $checkbox = $event.target;
|
|
143
|
+
const {
|
|
144
|
+
checked
|
|
145
|
+
} = $checkbox;
|
|
146
|
+
this.changeInput(checked, $event);
|
|
147
|
+
},
|
|
148
|
+
changeInput(checked, event) {
|
|
149
|
+
this.innerValue = checked;
|
|
150
|
+
if (this.isMultipleInput) {
|
|
151
|
+
this.changeMultipleInput(checked);
|
|
152
|
+
} else {
|
|
153
|
+
this.$emit('change', checked);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
watch: {
|
|
158
|
+
input() {
|
|
159
|
+
this.inputByValue();
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
render() {
|
|
163
|
+
const {
|
|
164
|
+
classes,
|
|
165
|
+
onClick,
|
|
166
|
+
onKeydown,
|
|
167
|
+
onFocus,
|
|
168
|
+
onBlur,
|
|
169
|
+
onChange,
|
|
170
|
+
inputId,
|
|
171
|
+
innerValue,
|
|
172
|
+
disabled,
|
|
173
|
+
trackStyles,
|
|
174
|
+
stateLabel,
|
|
175
|
+
labelOn,
|
|
176
|
+
labelOff,
|
|
177
|
+
loading
|
|
178
|
+
} = this;
|
|
179
|
+
return _createVNode("div", {
|
|
180
|
+
"class": {
|
|
181
|
+
'y-switch': true,
|
|
182
|
+
...classes
|
|
183
|
+
}
|
|
184
|
+
}, [_createVNode("div", {
|
|
185
|
+
"class": "y-switch__slot"
|
|
186
|
+
}, [_createVNode("div", {
|
|
187
|
+
"class": "y-switch__input",
|
|
188
|
+
"onClick": withModifiers(onClick, ['capture']),
|
|
189
|
+
"onKeydown": onKeydown
|
|
190
|
+
}, [_createVNode("input", {
|
|
191
|
+
"id": inputId,
|
|
192
|
+
"aria-checked": innerValue,
|
|
193
|
+
"type": "checkbox",
|
|
194
|
+
"role": "switch",
|
|
195
|
+
"onFocus": onFocus,
|
|
196
|
+
"onBlur": onBlur,
|
|
197
|
+
"onChange": onChange,
|
|
198
|
+
"disabled": disabled,
|
|
199
|
+
"checked": innerValue,
|
|
200
|
+
"ref": "checkbox"
|
|
201
|
+
}, null), _createVNode("div", {
|
|
202
|
+
"class": "y-switch__track",
|
|
203
|
+
"style": trackStyles
|
|
204
|
+
}, [stateLabel && _createVNode("div", {
|
|
205
|
+
"class": "y-switch__state"
|
|
206
|
+
}, [_createVNode("span", {
|
|
207
|
+
"class": "y-switch__state-label y-switch__state-label--on"
|
|
208
|
+
}, {
|
|
209
|
+
labelOn
|
|
210
|
+
}), _createVNode("span", {
|
|
211
|
+
"class": "y-switch__state-label y-switch__state-label--off"
|
|
212
|
+
}, {
|
|
213
|
+
labelOff
|
|
214
|
+
})])]), _createVNode("div", {
|
|
215
|
+
"class": "y-switch__thumb"
|
|
216
|
+
}, [loading && _createVNode("div", {
|
|
217
|
+
"class": "y-switch__spinner"
|
|
218
|
+
}, null)])]), _createVNode("label", {
|
|
219
|
+
"for": inputId,
|
|
220
|
+
"class": "y-switch__label"
|
|
221
|
+
}, [_createVNode("slot", {
|
|
222
|
+
"name": "label"
|
|
223
|
+
}, null), _createVNode("input", {
|
|
224
|
+
"hidden": true
|
|
225
|
+
}, null)])])]);
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
//# sourceMappingURL=YSwitch.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YSwitch.mjs","names":["defineComponent","withModifiers","uidCounter","YSwitch","name","model","prop","event","props","input","type","Boolean","Array","default","value","String","Number","Object","max","loading","disabled","stickOut","stateLabel","color","labelOn","labelOff","data","innerValue","counterId","focused","created","iid","toString","isArray","inputByValue","computed","isMultipleInput","multipleInputIndex","findIndex","inp","inputId","id","trackStyles","backgroundColor","classes","methods","found","find","undefined","changeMultipleInput","checked","multipleInput","slice","length","$emit","nextChange","push","splice","$nextTick","onClick","$event","changeInput","onFocus","onBlur","onKeydown","onChange","$checkbox","target","watch","render","_createVNode"],"sources":["../../../src/components/switch/YSwitch.tsx"],"sourcesContent":["import { PropType, defineComponent, withModifiers } from 'vue';\n\nimport './YSwitch.scss';\n\nlet uidCounter = 0;\n\nexport const YSwitch = defineComponent({\n name: 'YSwitch',\n model: {\n prop: 'input',\n event: 'change',\n },\n props: {\n input: {\n type: [Boolean, Array] as PropType<boolean | any[]>,\n default: false,\n },\n value: {\n type: [String, Number, Object] as PropType<any>,\n },\n max: {\n type: Number,\n },\n loading: {\n type: Boolean,\n },\n disabled: {\n type: Boolean,\n },\n stickOut: {\n type: Boolean,\n },\n stateLabel: {\n type: Boolean,\n },\n color: {\n type: String,\n },\n labelOn: {\n type: String,\n default: 'ON',\n },\n labelOff: {\n type: String,\n default: 'OFF',\n },\n },\n data() {\n return {\n innerValue: false,\n counterId: '',\n focused: false,\n };\n },\n created() {\n const iid = uidCounter.toString();\n uidCounter += 1;\n this.counterId = iid;\n if (Array.isArray(this.input)) {\n this.inputByValue();\n } else {\n this.innerValue = this.input;\n }\n },\n computed: {\n isMultipleInput() {\n return Array.isArray(this.input);\n },\n multipleInputIndex() {\n if (!Array.isArray(this.input)) {\n return -1;\n }\n return this.input.findIndex((inp) => {\n return inp === this.value;\n });\n },\n inputId() {\n const id = this.counterId;\n return `y-switch--${id}`;\n },\n trackStyles() {\n return {\n backgroundColor: this.color,\n };\n },\n classes() {\n return {\n 'y-switch--disabled': this.disabled,\n 'y-switch--loading': this.loading,\n 'y-switch--active': this.innerValue,\n 'y-switch--stick-out': this.stickOut,\n 'y-switch--focused': this.focused,\n };\n },\n },\n methods: {\n inputByValue() {\n if (Array.isArray(this.input)) {\n const found = this.input.find((inp: any) => {\n return inp === this.value;\n });\n\n if (found !== undefined) {\n this.innerValue = true;\n } else {\n this.innerValue = false;\n }\n }\n },\n changeMultipleInput(checked: boolean) {\n if (Array.isArray(this.input)) {\n const multipleInput = this.input.slice();\n if (\n checked &&\n this.max !== undefined &&\n multipleInput.length >= this.max\n ) {\n this.$emit('overmax');\n this.nextChange(false, multipleInput);\n return;\n }\n if (checked && this.multipleInputIndex < 0) {\n multipleInput.push(this.value);\n } else if (this.multipleInputIndex > -1) {\n multipleInput.splice(this.multipleInputIndex, 1);\n }\n this.$emit('change', multipleInput);\n }\n },\n nextChange(checked: boolean, value: any) {\n this.$nextTick(() => {\n this.innerValue = checked;\n });\n },\n onClick($event: Event) {\n if (this.disabled || this.loading) return;\n this.changeInput(!this.innerValue, $event);\n },\n onFocus() {\n this.focused = true;\n },\n onBlur() {\n this.focused = false;\n },\n onKeydown($event: KeyboardEvent) {\n // nothing\n },\n onChange($event: Event) {\n const $checkbox = $event.target as HTMLInputElement;\n const { checked } = $checkbox;\n this.changeInput(checked, $event);\n },\n changeInput(checked: boolean, event?: Event) {\n this.innerValue = checked;\n if (this.isMultipleInput) {\n this.changeMultipleInput(checked);\n } else {\n this.$emit('change', checked);\n }\n },\n },\n watch: {\n input() {\n this.inputByValue();\n },\n },\n render() {\n const {\n classes,\n onClick,\n onKeydown,\n onFocus,\n onBlur,\n onChange,\n inputId,\n innerValue,\n disabled,\n trackStyles,\n stateLabel,\n labelOn,\n labelOff,\n loading,\n } = this;\n return (\n <div class={{ 'y-switch': true, ...classes }}>\n <div class=\"y-switch__slot\">\n <div\n class=\"y-switch__input\"\n onClick={withModifiers(onClick, ['capture'])}\n onKeydown={onKeydown}\n >\n <input\n id={inputId}\n aria-checked={innerValue}\n type=\"checkbox\"\n role=\"switch\"\n onFocus={onFocus}\n onBlur={onBlur}\n onChange={onChange}\n disabled={disabled}\n checked={innerValue}\n ref=\"checkbox\"\n />\n <div class=\"y-switch__track\" style={trackStyles}>\n {stateLabel && (<div class=\"y-switch__state\">\n <span class=\"y-switch__state-label y-switch__state-label--on\">\n {{ labelOn }}\n </span>\n <span class=\"y-switch__state-label y-switch__state-label--off\">\n {{ labelOff }}\n </span>\n </div>)}\n </div>\n <div class=\"y-switch__thumb\">\n {loading && (<div class=\"y-switch__spinner\"></div>)}\n </div>\n </div>\n <label for={inputId} class=\"y-switch__label\">\n <slot name=\"label\"></slot>\n <input hidden />\n </label>\n </div>\n </div>\n );\n },\n});\n"],"mappings":";AAAA,SAAmBA,eAAe,EAAEC,aAAa,QAAQ,KAAK;AAE9D;AAEA,IAAIC,UAAU,GAAG,CAAC;AAElB,OAAO,MAAMC,OAAO,GAAGH,eAAe,CAAC;EACrCI,IAAI,EAAE,SAAS;EACfC,KAAK,EAAE;IACLC,IAAI,EAAE,OAAO;IACbC,KAAK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;MAAA,SAEL,iBAAiB;MAAA,SAAQ5B;IAAW,IAC5CpB,UAAU,IAAAgD,YAAA;MAAA,SAAgB;IAAiB,IAAAA,YAAA;MAAA,SAC9B;IAAiD;MACxD9C;IAAO,IAAA8C,YAAA;MAAA,SAEA;IAAkD;MACzD7C;IAAQ,IAER,IAAA6C,YAAA;MAAA,SAEE;IAAiB,IACzBnD,OAAO,IAAAmD,YAAA;MAAA,SAAgB;IAAmB,QAAQ,MAAAA,YAAA;MAAA,OAG3C9B,OAAO;MAAA,SAAQ;IAAiB,IAAA8B,YAAA;MAAA,QAC/B;IAAO,UAAAA,YAAA;MAAA;IAAA;EAM5B;AACF,CAAC,CAAC"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Created by yeonyu 2022.
|
|
3
|
-
*/
|
|
4
1
|
@use '../../styles/palette';
|
|
5
2
|
@use '../../styles/variables';
|
|
6
3
|
|
|
7
4
|
.y-switch {
|
|
8
|
-
|
|
5
|
+
--y-switch__color: rgba(var(--y-theme--primary), 1);
|
|
9
6
|
font-size: 1rem;
|
|
10
7
|
|
|
11
8
|
&__slot {
|
|
@@ -43,7 +40,7 @@
|
|
|
43
40
|
width: 100%;
|
|
44
41
|
height: 100%;
|
|
45
42
|
border-radius: 2em;
|
|
46
|
-
background-color: #
|
|
43
|
+
background-color: #e0e0e0;
|
|
47
44
|
position: absolute;
|
|
48
45
|
left: 0;
|
|
49
46
|
top: 0;
|
|
@@ -53,8 +50,8 @@
|
|
|
53
50
|
&__thumb {
|
|
54
51
|
width: 1.1em;
|
|
55
52
|
height: 1.1em;
|
|
56
|
-
|
|
57
|
-
left: 0.
|
|
53
|
+
align-self: center;
|
|
54
|
+
left: 0.185em;
|
|
58
55
|
border-radius: 50%;
|
|
59
56
|
display: flex;
|
|
60
57
|
justify-content: center;
|
|
@@ -63,6 +60,7 @@
|
|
|
63
60
|
pointer-events: none;
|
|
64
61
|
position: relative;
|
|
65
62
|
transition: 180ms cubic-bezier(0.78, 0.04, 0.9, 0.18);
|
|
63
|
+
will-change: left, transform;
|
|
66
64
|
}
|
|
67
65
|
|
|
68
66
|
&__spinner {
|
|
@@ -95,7 +93,7 @@
|
|
|
95
93
|
border-radius: 50%;
|
|
96
94
|
border-width: 2px 2px 0 0;
|
|
97
95
|
border-style: solid;
|
|
98
|
-
border-color:
|
|
96
|
+
border-color: var(--y-switch__color) transparent;
|
|
99
97
|
}
|
|
100
98
|
|
|
101
99
|
&:after {
|
|
@@ -105,30 +103,23 @@
|
|
|
105
103
|
top: 0;
|
|
106
104
|
right: 0;
|
|
107
105
|
bottom: 0;
|
|
108
|
-
background: linear-gradient(0deg, transparent 60%, rgba(
|
|
106
|
+
background: linear-gradient(0deg, transparent 60%, rgba(var(--y-switch__color), 0.4));
|
|
109
107
|
filter: blur(4px);
|
|
110
108
|
animation: spinner-blur 3s infinite;
|
|
111
109
|
}
|
|
112
110
|
}
|
|
113
111
|
|
|
114
|
-
&:hover:not(&--disabled) {
|
|
115
|
-
.y-switch__thumb {
|
|
116
|
-
//background: map-get($light-theme, 'hover-bg');
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
112
|
&--active {
|
|
121
113
|
.y-switch__track {
|
|
122
|
-
background-color:
|
|
114
|
+
background-color: var(--y-switch__color);
|
|
123
115
|
}
|
|
124
116
|
|
|
125
117
|
.y-switch__thumb {
|
|
126
|
-
left: 1.
|
|
127
|
-
//transform: translateX(1.6em);
|
|
118
|
+
left: calc(100% - 1.1em - 0.24em);
|
|
128
119
|
}
|
|
129
120
|
}
|
|
121
|
+
|
|
130
122
|
&--active:not(&--loading):active &__thumb {
|
|
131
|
-
//left: 0.2em;
|
|
132
123
|
left: 1.8em;
|
|
133
124
|
}
|
|
134
125
|
|
|
@@ -141,21 +132,22 @@
|
|
|
141
132
|
left: 2px;
|
|
142
133
|
right: 2px;
|
|
143
134
|
border-radius: 50%;
|
|
144
|
-
background-color: rgba(
|
|
135
|
+
background-color: rgba(var(--y-switch__color), 0.4);
|
|
145
136
|
}
|
|
146
137
|
}
|
|
147
138
|
|
|
148
139
|
&--stick-out {
|
|
149
140
|
.y-switch__thumb {
|
|
150
|
-
box-shadow: 0 1px 4px 1px rgba(0, 0, 0, 0.
|
|
141
|
+
box-shadow: 2px 2px 5px -2px rgba(0, 0, 0, 0.54), 1px 1px 4px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.08);
|
|
151
142
|
}
|
|
152
143
|
|
|
153
144
|
.y-switch__track {
|
|
154
|
-
width:
|
|
155
|
-
height:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
145
|
+
width: 80%;
|
|
146
|
+
height: 74%;
|
|
147
|
+
top: 50%;
|
|
148
|
+
left: 50%;
|
|
149
|
+
transform: translate(-50%, -50%);
|
|
150
|
+
box-shadow: inset 0 0 4px -1px rgba(0, 0, 0, 0.34);
|
|
159
151
|
}
|
|
160
152
|
}
|
|
161
153
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/components/switch/index.ts"],"sourcesContent":["export * from './YSwitch';\n"],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createVNode as _createVNode, resolveDirective as _resolveDirective, Fragment as _Fragment } from "vue";
|
|
2
|
+
import { computed, defineComponent } from "vue";
|
|
3
|
+
import { useRender } from "../../composables/component.mjs";
|
|
4
|
+
import { YDataTableBody } from "./YDataTableBody.mjs";
|
|
5
|
+
import { YDataTableControl } from "./YDataTableControl.mjs";
|
|
6
|
+
import { YDataTableHead } from "./YDataTableHead.mjs";
|
|
7
|
+
import { YDataTableLayer } from "./YDataTableLayer.mjs";
|
|
8
|
+
import { YTable } from "./YTable.mjs";
|
|
9
|
+
import { propsFactory } from "../../util/vue-component.mjs";
|
|
10
|
+
import { pressDataTablePaginationProps } from "./pagination.mjs";
|
|
11
|
+
export const pressDataTableProps = propsFactory({
|
|
12
|
+
width: [String, Number],
|
|
13
|
+
search: String,
|
|
14
|
+
...pressDataTablePaginationProps()
|
|
15
|
+
}, 'YDataTable');
|
|
16
|
+
export const YDataTable = defineComponent({
|
|
17
|
+
name: 'YDataTable',
|
|
18
|
+
props: {
|
|
19
|
+
...pressDataTableProps()
|
|
20
|
+
},
|
|
21
|
+
setup(props, _ref) {
|
|
22
|
+
let {
|
|
23
|
+
slots
|
|
24
|
+
} = _ref;
|
|
25
|
+
const slotProps = computed(() => {
|
|
26
|
+
return {};
|
|
27
|
+
});
|
|
28
|
+
useRender(() => {
|
|
29
|
+
return _createVNode(YTable, {
|
|
30
|
+
"class": ['y-data-table']
|
|
31
|
+
}, {
|
|
32
|
+
default: () => [{
|
|
33
|
+
top: () => slots.top?.(slotProps.value),
|
|
34
|
+
leading: () => slots.leading ? slots.leading(slotProps.value) : _createVNode(_Fragment, null, [_createVNode(YDataTableLayer, null, slots)]),
|
|
35
|
+
default: () => slots.default ? slots.default(slotProps.value) : _createVNode(_Fragment, null, [_createVNode("thead", null, [_createVNode(YDataTableHead, null, slots)]), slots.thead?.(slotProps.value), _createVNode("tbody", null, [_createVNode(YDataTableBody, null, slots)]), slots.tbody?.(slotProps.value), slots.tfoot?.(slotProps.value)]),
|
|
36
|
+
trailing: () => slots.trailing?.(slotProps.value),
|
|
37
|
+
bottom: () => slots.bottom ? slots.bottom(slotProps.value) : _createVNode(YDataTableControl, null, {
|
|
38
|
+
prepend: slots['control.prepend']
|
|
39
|
+
})
|
|
40
|
+
}],
|
|
41
|
+
...slots
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=YDataTable.mjs.map
|