@toife/vue 2.2.0 → 3.0.1
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 +224 -0
- package/package.json +39 -10
- package/src/components/action/action.composable.ts +32 -0
- package/src/components/action/action.html +25 -0
- package/src/components/action/action.md +115 -0
- package/src/components/action/action.scss +105 -0
- package/src/components/action/action.type.ts +35 -0
- package/src/components/action/action.vue +70 -0
- package/src/components/action/index.ts +9 -0
- package/src/components/app/app.constants.ts +1 -0
- package/src/components/app/app.html +24 -0
- package/src/components/app/app.md +77 -0
- package/src/components/app/app.scss +27 -0
- package/src/components/app/app.type.ts +21 -0
- package/src/components/app/app.vue +45 -0
- package/src/components/app/index.ts +3 -0
- package/src/components/avatar/avatar.html +3 -0
- package/src/components/avatar/avatar.md +64 -0
- package/src/components/avatar/avatar.scss +35 -0
- package/src/components/avatar/avatar.type.ts +6 -0
- package/src/components/avatar/avatar.vue +45 -0
- package/src/components/avatar/index.ts +2 -0
- package/src/components/button/button.html +6 -0
- package/src/components/button/button.md +66 -0
- package/src/components/button/button.scss +113 -0
- package/src/components/button/button.type.ts +14 -0
- package/src/components/button/button.vue +61 -0
- package/src/components/button/index.ts +2 -0
- package/src/components/cable/cable.constants.ts +1 -0
- package/src/components/cable/cable.html +3 -0
- package/src/components/cable/cable.md +57 -0
- package/src/components/cable/cable.scss +37 -0
- package/src/components/cable/cable.type.ts +11 -0
- package/src/components/cable/cable.vue +33 -0
- package/src/components/cable/index.ts +3 -0
- package/src/components/card/card/card.constants.ts +1 -0
- package/src/components/card/card/card.html +3 -0
- package/src/components/card/card/card.md +57 -0
- package/src/components/card/card/card.scss +34 -0
- package/src/components/card/card/card.type.ts +14 -0
- package/src/components/card/card/card.vue +62 -0
- package/src/components/card/card/index.ts +3 -0
- package/src/components/card/card-body/card-body.html +3 -0
- package/src/components/card/card-body/card-body.md +34 -0
- package/src/components/card/card-body/card-body.scss +23 -0
- package/src/components/card/card-body/card-body.vue +9 -0
- package/src/components/card/card-body/index.ts +1 -0
- package/src/components/card/card-footer/card-footer.html +3 -0
- package/src/components/card/card-footer/card-footer.md +42 -0
- package/src/components/card/card-footer/card-footer.scss +31 -0
- package/src/components/card/card-footer/card-footer.vue +25 -0
- package/src/components/card/card-footer/index.ts +1 -0
- package/src/components/card/card-header/card-header.html +3 -0
- package/src/components/card/card-header/card-header.md +44 -0
- package/src/components/card/card-header/card-header.scss +31 -0
- package/src/components/card/card-header/card-header.vue +25 -0
- package/src/components/card/card-header/index.ts +1 -0
- package/src/components/card/index.ts +4 -0
- package/src/components/checkbox/checkbox.html +13 -0
- package/src/components/checkbox/checkbox.md +60 -0
- package/src/components/checkbox/checkbox.scss +138 -0
- package/src/components/checkbox/checkbox.type.ts +17 -0
- package/src/components/checkbox/checkbox.vue +78 -0
- package/src/components/checkbox/index.ts +2 -0
- package/src/components/collapse/collapse.html +16 -0
- package/src/components/collapse/collapse.md +59 -0
- package/src/components/collapse/collapse.scss +59 -0
- package/src/components/collapse/collapse.type.ts +11 -0
- package/src/components/collapse/collapse.vue +131 -0
- package/src/components/collapse/index.ts +2 -0
- package/src/components/container/container.html +1 -0
- package/src/components/container/container.md +38 -0
- package/src/components/container/container.scss +10 -0
- package/src/components/container/container.vue +9 -0
- package/src/components/container/index.ts +1 -0
- package/src/components/decision-modal/decision-modal.composable.ts +32 -0
- package/src/components/decision-modal/decision-modal.html +29 -0
- package/src/components/decision-modal/decision-modal.md +79 -0
- package/src/components/decision-modal/decision-modal.scss +136 -0
- package/src/components/decision-modal/decision-modal.type.ts +35 -0
- package/src/components/decision-modal/decision-modal.vue +98 -0
- package/src/components/decision-modal/index.ts +9 -0
- package/src/components/divider/divider.html +1 -0
- package/src/components/divider/divider.md +42 -0
- package/src/components/divider/divider.scss +29 -0
- package/src/components/divider/divider.type.ts +6 -0
- package/src/components/divider/divider.vue +31 -0
- package/src/components/divider/index.ts +2 -0
- package/src/components/field/field.html +1 -0
- package/src/components/field/field.md +68 -0
- package/src/components/field/field.type.ts +43 -0
- package/src/components/field/field.vue +85 -0
- package/src/components/field/index.ts +2 -0
- package/src/components/field/outline/index.ts +1 -0
- package/src/components/field/outline/outline-field.md +44 -0
- package/src/components/field/outline/outline.html +32 -0
- package/src/components/field/outline/outline.scss +224 -0
- package/src/components/field/outline/outline.vue +243 -0
- package/src/components/form-group/form-group.html +3 -0
- package/src/components/form-group/form-group.md +41 -0
- package/src/components/form-group/form-group.scss +91 -0
- package/src/components/form-group/form-group.type.ts +5 -0
- package/src/components/form-group/form-group.vue +21 -0
- package/src/components/form-group/index.ts +2 -0
- package/src/components/gesture-indicator/gesture-indicator.html +1 -0
- package/src/components/gesture-indicator/gesture-indicator.md +42 -0
- package/src/components/gesture-indicator/gesture-indicator.scss +45 -0
- package/{dist/components/gesture-indicator/gesture-indicator.type.d.ts → src/components/gesture-indicator/gesture-indicator.type.ts} +2 -1
- package/src/components/gesture-indicator/gesture-indicator.vue +29 -0
- package/src/components/gesture-indicator/index.ts +1 -0
- package/src/components/image/image.html +1 -0
- package/src/components/image/image.md +41 -0
- package/src/components/image/image.scss +1 -0
- package/src/components/image/image.type.ts +5 -0
- package/src/components/image/image.vue +25 -0
- package/src/components/image/index.ts +2 -0
- package/src/components/index.ts +27 -0
- package/src/components/modal/index.ts +2 -0
- package/src/components/modal/modal.html +20 -0
- package/src/components/modal/modal.md +65 -0
- package/src/components/modal/modal.scss +78 -0
- package/src/components/modal/modal.type.ts +21 -0
- package/src/components/modal/modal.vue +186 -0
- package/src/components/page/index.ts +1 -0
- package/src/components/page/page.html +3 -0
- package/src/components/page/page.md +39 -0
- package/src/components/page/page.scss +17 -0
- package/src/components/page/page.vue +9 -0
- package/src/components/present/index.ts +3 -0
- package/src/components/present/present.composable.ts +21 -0
- package/src/components/present/present.html +9 -0
- package/src/components/present/present.md +60 -0
- package/src/components/present/present.scss +81 -0
- package/src/components/present/present.type.ts +26 -0
- package/src/components/present/present.vue +198 -0
- package/src/components/radio/index.ts +2 -0
- package/src/components/radio/radio/index.ts +2 -0
- package/src/components/radio/radio/radio.html +11 -0
- package/src/components/radio/radio/radio.md +53 -0
- package/src/components/radio/radio/radio.scss +125 -0
- package/src/components/radio/radio/radio.type.ts +11 -0
- package/src/components/radio/radio/radio.vue +99 -0
- package/src/components/radio/radio-group/index.ts +7 -0
- package/src/components/radio/radio-group/radio-group.constants.ts +1 -0
- package/src/components/radio/radio-group/radio-group.html +3 -0
- package/src/components/radio/radio-group/radio-group.md +62 -0
- package/src/components/radio/radio-group/radio-group.scss +16 -0
- package/src/components/radio/radio-group/radio-group.type.ts +28 -0
- package/src/components/radio/radio-group/radio-group.vue +57 -0
- package/src/components/refresher/index.ts +2 -0
- package/src/components/refresher/refresher.html +6 -0
- package/src/components/refresher/refresher.md +53 -0
- package/src/components/refresher/refresher.scss +36 -0
- package/src/components/refresher/refresher.type.ts +16 -0
- package/src/components/refresher/refresher.vue +137 -0
- package/src/components/route/index.ts +5 -0
- package/src/components/route/route-navigator/index.ts +2 -0
- package/src/components/route/route-navigator/route-navigator.html +19 -0
- package/src/components/route/route-navigator/route-navigator.md +50 -0
- package/src/components/route/route-navigator/route-navigator.scss +127 -0
- package/src/components/route/route-navigator/route-navigator.type.ts +12 -0
- package/src/components/route/route-navigator/route-navigator.vue +255 -0
- package/src/components/route/route-outlet/index.ts +1 -0
- package/src/components/route/route-outlet/route-outlet.html +1 -0
- package/src/components/route/route-outlet/route-outlet.md +30 -0
- package/src/components/route/route-outlet/route-outlet.vue +30 -0
- package/src/components/route/route-provider/index.ts +3 -0
- package/src/components/route/route-provider/route-provider.constant.ts +1 -0
- package/src/components/route/route-provider/route-provider.html +1 -0
- package/src/components/route/route-provider/route-provider.md +46 -0
- package/src/components/route/route-provider/route-provider.type.ts +10 -0
- package/src/components/route/route-provider/route-provider.vue +20 -0
- package/src/components/route/route-wrapper/index.ts +3 -0
- package/src/components/route/route-wrapper/route-wrapper.composable.ts +58 -0
- package/src/components/route/route-wrapper/route-wrapper.html +3 -0
- package/src/components/route/route-wrapper/route-wrapper.md +45 -0
- package/src/components/route/route-wrapper/route-wrapper.type.ts +7 -0
- package/src/components/route/route-wrapper/route-wrapper.vue +51 -0
- package/src/components/route/route.type.ts +8 -0
- package/src/components/route/route.util.ts +8 -0
- package/src/components/segmented-field/index.ts +7 -0
- package/src/components/segmented-field/segmented-field.html +17 -0
- package/src/components/segmented-field/segmented-field.md +58 -0
- package/src/components/segmented-field/segmented-field.scss +52 -0
- package/src/components/segmented-field/segmented-field.type.ts +29 -0
- package/src/components/segmented-field/segmented-field.vue +145 -0
- package/src/components/skeleton/index.ts +2 -0
- package/src/components/skeleton/skeleton.html +1 -0
- package/src/components/skeleton/skeleton.md +47 -0
- package/src/components/skeleton/skeleton.scss +45 -0
- package/src/components/skeleton/skeleton.type.ts +7 -0
- package/src/components/skeleton/skeleton.vue +38 -0
- package/src/components/switch/index.ts +2 -0
- package/src/components/switch/switch.html +15 -0
- package/src/components/switch/switch.md +57 -0
- package/src/components/switch/switch.scss +134 -0
- package/src/components/switch/switch.type.ts +13 -0
- package/src/components/switch/switch.vue +81 -0
- package/src/components/tabs/index.ts +2 -0
- package/src/components/tabs/tab/index.ts +2 -0
- package/src/components/tabs/tab/tab.html +5 -0
- package/src/components/tabs/tab/tab.md +52 -0
- package/src/components/tabs/tab/tab.type.ts +5 -0
- package/src/components/tabs/tab/tab.vue +38 -0
- package/src/components/tabs/tabs/index.ts +9 -0
- package/src/components/tabs/tabs/tabs.constants.ts +1 -0
- package/src/components/tabs/tabs/tabs.html +3 -0
- package/src/components/tabs/tabs/tabs.md +59 -0
- package/src/components/tabs/tabs/tabs.scss +270 -0
- package/src/components/tabs/tabs/tabs.type.ts +36 -0
- package/src/components/tabs/tabs/tabs.vue +157 -0
- package/src/components/toast/index.ts +4 -0
- package/src/components/toast/toast/index.ts +1 -0
- package/src/components/toast/toast/toast.html +9 -0
- package/src/components/toast/toast/toast.md +56 -0
- package/src/components/toast/toast/toast.scss +61 -0
- package/src/components/toast/toast/toast.vue +34 -0
- package/src/components/toast/toast-content/index.ts +1 -0
- package/src/components/toast/toast-content/toast-content.html +1 -0
- package/src/components/toast/toast-content/toast-content.md +41 -0
- package/src/components/toast/toast-content/toast-content.scss +41 -0
- package/src/components/toast/toast-content/toast-content.vue +53 -0
- package/src/components/toast/toast.composable.ts +22 -0
- package/src/components/toast/toast.type.ts +25 -0
- package/src/components/toolbar/index.ts +2 -0
- package/src/components/toolbar/toolbar.html +5 -0
- package/src/components/toolbar/toolbar.md +57 -0
- package/src/components/toolbar/toolbar.scss +79 -0
- package/src/components/toolbar/toolbar.type.ts +7 -0
- package/src/components/toolbar/toolbar.vue +41 -0
- package/src/env.d.ts +7 -0
- package/src/factory.ts +83 -0
- package/src/index.ts +4 -0
- package/{dist/type.d.ts → src/type.ts} +1 -1
- package/src/utils/element.md +33 -0
- package/src/utils/element.ts +16 -0
- package/src/utils/events.md +29 -0
- package/src/utils/events.ts +12 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/style/index.ts +42 -0
- package/src/utils/style.md +49 -0
- package/dist/components/action/action.type.d.ts +0 -17
- package/dist/components/action/action.vue.d.ts +0 -14
- package/dist/components/action/factory.d.ts +0 -3
- package/dist/components/action/index.d.ts +0 -2
- package/dist/components/alert/alert.type.d.ts +0 -16
- package/dist/components/alert/alert.vue.d.ts +0 -14
- package/dist/components/alert/factory.d.ts +0 -3
- package/dist/components/alert/index.d.ts +0 -2
- package/dist/components/app/app.type.d.ts +0 -1
- package/dist/components/app/app.vue.d.ts +0 -3
- package/dist/components/app/index.d.ts +0 -1
- package/dist/components/avatar/avatar.type.d.ts +0 -4
- package/dist/components/avatar/avatar.vue.d.ts +0 -6
- package/dist/components/avatar/index.d.ts +0 -1
- package/dist/components/back-button/back-button.type.d.ts +0 -4
- package/dist/components/back-button/back-button.vue.d.ts +0 -3
- package/dist/components/back-button/index.d.ts +0 -1
- package/dist/components/button/button.type.d.ts +0 -10
- package/dist/components/button/button.vue.d.ts +0 -12
- package/dist/components/button/index.d.ts +0 -1
- package/dist/components/cable/cable.type.d.ts +0 -4
- package/dist/components/cable/cable.vue.d.ts +0 -6
- package/dist/components/cable/index.d.ts +0 -1
- package/dist/components/card/card.type.d.ts +0 -3
- package/dist/components/card/card.vue.d.ts +0 -5
- package/dist/components/card/index.d.ts +0 -1
- package/dist/components/checkbox/checkbox.type.d.ts +0 -12
- package/dist/components/checkbox/checkbox.vue.d.ts +0 -14
- package/dist/components/checkbox/index.d.ts +0 -1
- package/dist/components/collapse/collapse.type.d.ts +0 -6
- package/dist/components/collapse/collapse.vue.d.ts +0 -7
- package/dist/components/collapse/index.d.ts +0 -1
- package/dist/components/content/content.type.d.ts +0 -1
- package/dist/components/content/content.vue.d.ts +0 -3
- package/dist/components/content/index.d.ts +0 -1
- package/dist/components/divider/divider.type.d.ts +0 -3
- package/dist/components/divider/divider.vue.d.ts +0 -5
- package/dist/components/divider/index.d.ts +0 -1
- package/dist/components/flex/flex.type.d.ts +0 -4
- package/dist/components/flex/flex.vue.d.ts +0 -6
- package/dist/components/flex/index.d.ts +0 -1
- package/dist/components/gesture-indicator/gesture-indicator.vue.d.ts +0 -5
- package/dist/components/gesture-indicator/index.d.ts +0 -1
- package/dist/components/grid/grid.type.d.ts +0 -4
- package/dist/components/grid/grid.vue.d.ts +0 -6
- package/dist/components/grid/index.d.ts +0 -1
- package/dist/components/icon-spinner/icon-spinner.type.d.ts +0 -4
- package/dist/components/icon-spinner/icon-spinner.vue.d.ts +0 -6
- package/dist/components/icon-spinner/index.d.ts +0 -1
- package/dist/components/image/image.type.d.ts +0 -4
- package/dist/components/image/image.vue.d.ts +0 -3
- package/dist/components/image/index.d.ts +0 -1
- package/dist/components/index.d.ts +0 -36
- package/dist/components/input/index.d.ts +0 -1
- package/dist/components/input/input.type.d.ts +0 -15
- package/dist/components/input/input.vue.d.ts +0 -16
- package/dist/components/keyboard-space/factory.d.ts +0 -3
- package/dist/components/keyboard-space/index.d.ts +0 -2
- package/dist/components/keyboard-space/keyboard-space.type.d.ts +0 -1
- package/dist/components/keyboard-space/keyboard-space.vue.d.ts +0 -3
- package/dist/components/loading/factory.d.ts +0 -4
- package/dist/components/loading/index.d.ts +0 -2
- package/dist/components/loading/loading.type.d.ts +0 -6
- package/dist/components/loading/loading.vue.d.ts +0 -12
- package/dist/components/present/factory.d.ts +0 -1
- package/dist/components/present/index.d.ts +0 -2
- package/dist/components/present/present.type.d.ts +0 -13
- package/dist/components/present/present.vue.d.ts +0 -17
- package/dist/components/refresher/index.d.ts +0 -1
- package/dist/components/refresher/refresher.type.d.ts +0 -11
- package/dist/components/refresher/refresher.vue.d.ts +0 -17
- package/dist/components/richtext/index.d.ts +0 -1
- package/dist/components/richtext/richtext.type.d.ts +0 -1
- package/dist/components/richtext/richtext.vue.d.ts +0 -3
- package/dist/components/ripple/index.d.ts +0 -1
- package/dist/components/ripple/ripple.type.d.ts +0 -3
- package/dist/components/ripple/ripple.vue.d.ts +0 -5
- package/dist/components/screen/index.d.ts +0 -1
- package/dist/components/screen/screen.type.d.ts +0 -1
- package/dist/components/screen/screen.vue.d.ts +0 -3
- package/dist/components/screen-router/factory.d.ts +0 -19
- package/dist/components/screen-router/index.d.ts +0 -2
- package/dist/components/screen-router/screen-router.type.d.ts +0 -8
- package/dist/components/screen-router/screen-router.vue.d.ts +0 -9
- package/dist/components/sheet/index.d.ts +0 -1
- package/dist/components/sheet/sheet.type.d.ts +0 -18
- package/dist/components/sheet/sheet.vue.d.ts +0 -18
- package/dist/components/skeleton/index.d.ts +0 -1
- package/dist/components/skeleton/skeleton.type.d.ts +0 -6
- package/dist/components/skeleton/skeleton.vue.d.ts +0 -8
- package/dist/components/switch/index.d.ts +0 -1
- package/dist/components/switch/switch.type.d.ts +0 -7
- package/dist/components/switch/switch.vue.d.ts +0 -9
- package/dist/components/tab/index.d.ts +0 -1
- package/dist/components/tab/tab.type.d.ts +0 -4
- package/dist/components/tab/tab.vue.d.ts +0 -5
- package/dist/components/tabs/index.d.ts +0 -1
- package/dist/components/tabs/tabs.type.d.ts +0 -13
- package/dist/components/tabs/tabs.vue.d.ts +0 -15
- package/dist/components/text/index.d.ts +0 -1
- package/dist/components/text/text.type.d.ts +0 -4
- package/dist/components/text/text.vue.d.ts +0 -6
- package/dist/components/textarea/index.d.ts +0 -1
- package/dist/components/textarea/textarea.type.d.ts +0 -1
- package/dist/components/textarea/textarea.vue.d.ts +0 -3
- package/dist/components/toast/factory.d.ts +0 -3
- package/dist/components/toast/index.d.ts +0 -2
- package/dist/components/toast/toast.type.d.ts +0 -11
- package/dist/components/toast/toast.vue.d.ts +0 -16
- package/dist/components/toggle-password/index.d.ts +0 -1
- package/dist/components/toggle-password/toggle-password.type.d.ts +0 -6
- package/dist/components/toggle-password/toggle-password.vue.d.ts +0 -9
- package/dist/components/toolbar/index.d.ts +0 -1
- package/dist/components/toolbar/toolbar.type.d.ts +0 -5
- package/dist/components/toolbar/toolbar.vue.d.ts +0 -7
- package/dist/factory.d.ts +0 -4
- package/dist/index.css +0 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.es.js +0 -1836
- package/dist/index.umd.js +0 -1
- package/dist/utils/element.d.ts +0 -2
- package/dist/utils/events.d.ts +0 -1
- package/dist/utils/index.d.ts +0 -2
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
@use "@toife/sass-layer-generator" as sass;
|
|
2
|
+
|
|
3
|
+
// Class name
|
|
4
|
+
$tabs: sass.fn-naming-prefix("tabs");
|
|
5
|
+
$tab: sass.fn-naming-prefix("tab");
|
|
6
|
+
$button: sass.fn-naming-prefix("button");
|
|
7
|
+
|
|
8
|
+
// Property name
|
|
9
|
+
$space-x: sass.fn-naming-var("spacing", "x");
|
|
10
|
+
$space-y: sass.fn-naming-var("spacing", "y");
|
|
11
|
+
|
|
12
|
+
// layer: tabs
|
|
13
|
+
$button-color: sass.fn-naming-var("tabs", "color");
|
|
14
|
+
$border-radius: sass.fn-naming-var("border-radius");
|
|
15
|
+
$border-width: sass.fn-naming-var("stroke", "width");
|
|
16
|
+
$border-color: sass.fn-naming-var("tabs", "border-color");
|
|
17
|
+
|
|
18
|
+
$transition-duration: sass.fn-naming-var("motion", "duration");
|
|
19
|
+
$background-color: sass.fn-naming-var("tabs", "background-color");
|
|
20
|
+
|
|
21
|
+
$highlight-top: sass.fn-naming-var("highlight", "top");
|
|
22
|
+
$highlight-left: sass.fn-naming-var("highlight", "left");
|
|
23
|
+
$highlight-width: sass.fn-naming-var("highlight", "width");
|
|
24
|
+
$highlight-height: sass.fn-naming-var("highlight", "height");
|
|
25
|
+
$highlight-space-x: sass.fn-naming-var("highlight", "space-x");
|
|
26
|
+
$highlight-space-y: sass.fn-naming-var("highlight", "space-y");
|
|
27
|
+
|
|
28
|
+
.#{$tabs} {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
position: relative;
|
|
32
|
+
margin: 0;
|
|
33
|
+
list-style: none;
|
|
34
|
+
border: #{$border-width} solid transparent;
|
|
35
|
+
transition:
|
|
36
|
+
box-shadow #{$transition-duration} ease,
|
|
37
|
+
border-color #{$transition-duration} ease,
|
|
38
|
+
background-color #{$transition-duration} ease,
|
|
39
|
+
color #{$transition-duration} ease,
|
|
40
|
+
border-radius #{$transition-duration} ease;
|
|
41
|
+
|
|
42
|
+
> * {
|
|
43
|
+
z-index: 1;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&::before {
|
|
47
|
+
content: "";
|
|
48
|
+
z-index: 1;
|
|
49
|
+
display: block;
|
|
50
|
+
position: absolute;
|
|
51
|
+
top: 0;
|
|
52
|
+
left: 0;
|
|
53
|
+
width: #{$highlight-width};
|
|
54
|
+
height: #{$highlight-height};
|
|
55
|
+
transform: translate(#{$highlight-left}, #{$highlight-top});
|
|
56
|
+
box-sizing: border-box;
|
|
57
|
+
background-color: rgb(#{$background-color});
|
|
58
|
+
border-radius: #{$border-radius};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&.top-start,
|
|
62
|
+
&.bottom-start,
|
|
63
|
+
&.left-start,
|
|
64
|
+
&.right-start {
|
|
65
|
+
justify-content: flex-start;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&.top-end,
|
|
69
|
+
&.bottom-end,
|
|
70
|
+
&.left-end,
|
|
71
|
+
&.right-end {
|
|
72
|
+
justify-content: flex-end;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&.top-center,
|
|
76
|
+
&.bottom-center,
|
|
77
|
+
&.left-center,
|
|
78
|
+
&.right-center {
|
|
79
|
+
justify-content: center;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Direction
|
|
83
|
+
&.top-start,
|
|
84
|
+
&.top-center,
|
|
85
|
+
&.top-end,
|
|
86
|
+
&.bottom-start,
|
|
87
|
+
&.bottom-center,
|
|
88
|
+
&.bottom-end {
|
|
89
|
+
flex-direction: row;
|
|
90
|
+
height: fit-content;
|
|
91
|
+
width: 100%;
|
|
92
|
+
|
|
93
|
+
> * {
|
|
94
|
+
height: 100%;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&.left-start,
|
|
99
|
+
&.left-center,
|
|
100
|
+
&.left-end,
|
|
101
|
+
&.right-start,
|
|
102
|
+
&.right-center,
|
|
103
|
+
&.right-end {
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
width: fit-content;
|
|
106
|
+
height: 100%;
|
|
107
|
+
|
|
108
|
+
> * {
|
|
109
|
+
width: 100%;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&.divider {
|
|
114
|
+
&.top-start,
|
|
115
|
+
&.top-center,
|
|
116
|
+
&.top-end {
|
|
117
|
+
border-bottom-color: rgb(#{$border-color});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&.bottom-start,
|
|
121
|
+
&.bottom-center,
|
|
122
|
+
&.bottom-end {
|
|
123
|
+
border-top-color: rgb(#{$border-color});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&.left-start,
|
|
127
|
+
&.left-center,
|
|
128
|
+
&.left-end {
|
|
129
|
+
border-right-color: rgb(#{$border-color});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&.right-start,
|
|
133
|
+
&.right-center,
|
|
134
|
+
&.right-end {
|
|
135
|
+
border-left-color: rgb(#{$border-color});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&.underline {
|
|
140
|
+
&.top-start,
|
|
141
|
+
&.top-center,
|
|
142
|
+
&.top-end,
|
|
143
|
+
&.bottom-start,
|
|
144
|
+
&.bottom-center,
|
|
145
|
+
&.bottom-end {
|
|
146
|
+
padding-top: #{$highlight-space-y};
|
|
147
|
+
padding-bottom: #{$highlight-space-y};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
&.left-start,
|
|
151
|
+
&.left-center,
|
|
152
|
+
&.left-end,
|
|
153
|
+
&.right-start,
|
|
154
|
+
&.right-center,
|
|
155
|
+
&.right-end {
|
|
156
|
+
padding-left: #{$highlight-space-x};
|
|
157
|
+
padding-right: #{$highlight-space-x};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&.fill {
|
|
162
|
+
:deep(.#{$tab}) {
|
|
163
|
+
&.active {
|
|
164
|
+
.#{$button} {
|
|
165
|
+
color: rgb(#{$button-color}) !important;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&.top-start,
|
|
171
|
+
&.top-center,
|
|
172
|
+
&.top-end,
|
|
173
|
+
&.bottom-start,
|
|
174
|
+
&.bottom-center,
|
|
175
|
+
&.bottom-end {
|
|
176
|
+
padding-top: calc(#{$highlight-space-y} + #{$space-y});
|
|
177
|
+
padding-bottom: calc(#{$highlight-space-y} + #{$space-y});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&.left-start,
|
|
181
|
+
&.left-center,
|
|
182
|
+
&.left-end,
|
|
183
|
+
&.right-start,
|
|
184
|
+
&.right-center,
|
|
185
|
+
&.right-end {
|
|
186
|
+
padding-left: calc(#{$highlight-space-x} + #{$space-x});
|
|
187
|
+
padding-right: calc(#{$highlight-space-x} + #{$space-x});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
&.text {
|
|
192
|
+
&::before {
|
|
193
|
+
display: none;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
:deep(.#{$tab}) {
|
|
197
|
+
&.active {
|
|
198
|
+
.#{$button} {
|
|
199
|
+
color: rgb(#{$background-color});
|
|
200
|
+
text-shadow: 0 0 rgb(#{$background-color});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&.top-start,
|
|
206
|
+
&.top-center,
|
|
207
|
+
&.top-end,
|
|
208
|
+
&.bottom-start,
|
|
209
|
+
&.bottom-center,
|
|
210
|
+
&.bottom-end {
|
|
211
|
+
padding-top: calc(#{$highlight-space-y} + #{$space-y});
|
|
212
|
+
padding-bottom: calc(#{$highlight-space-y} + #{$space-y});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
&.left-start,
|
|
216
|
+
&.left-center,
|
|
217
|
+
&.left-end,
|
|
218
|
+
&.right-start,
|
|
219
|
+
&.right-center,
|
|
220
|
+
&.right-end {
|
|
221
|
+
padding-left: calc(#{$highlight-space-x} + #{$space-x});
|
|
222
|
+
padding-right: calc(#{$highlight-space-x} + #{$space-x});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
&.transition {
|
|
227
|
+
&::before {
|
|
228
|
+
transition:
|
|
229
|
+
background-color #{$transition-duration} ease,
|
|
230
|
+
color #{$transition-duration} ease,
|
|
231
|
+
border-color #{$transition-duration} ease,
|
|
232
|
+
border-radius #{$transition-duration} ease,
|
|
233
|
+
transform #{$transition-duration} ease,
|
|
234
|
+
width #{$transition-duration} ease,
|
|
235
|
+
height #{$transition-duration} ease;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
:deep(.#{$tab}) {
|
|
239
|
+
display: flex;
|
|
240
|
+
justify-content: center;
|
|
241
|
+
align-items: center;
|
|
242
|
+
|
|
243
|
+
.#{$button} {
|
|
244
|
+
transition:
|
|
245
|
+
box-shadow #{$transition-duration} ease,
|
|
246
|
+
border-color #{$transition-duration} ease,
|
|
247
|
+
background-color #{$transition-duration} ease,
|
|
248
|
+
color #{$transition-duration} ease,
|
|
249
|
+
border-radius #{$transition-duration} ease;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
:deep(.#{$tab}) {
|
|
255
|
+
display: flex;
|
|
256
|
+
justify-content: center;
|
|
257
|
+
align-items: center;
|
|
258
|
+
|
|
259
|
+
.#{$button} {
|
|
260
|
+
padding: #{$space-y} calc(#{$space-x} * 4);
|
|
261
|
+
color: unset;
|
|
262
|
+
cursor: pointer;
|
|
263
|
+
background-color: transparent !important;
|
|
264
|
+
border: none !important;
|
|
265
|
+
box-shadow: none !important;
|
|
266
|
+
border-radius: 0 !important;
|
|
267
|
+
transition: none;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ComputedRef } from "vue";
|
|
2
|
+
|
|
3
|
+
export type TabsVariant = "fill" | "underline" | "text";
|
|
4
|
+
export type TabsPlacement =
|
|
5
|
+
| "top-start"
|
|
6
|
+
| "top-end"
|
|
7
|
+
| "bottom-start"
|
|
8
|
+
| "bottom-end"
|
|
9
|
+
| "left-start"
|
|
10
|
+
| "left-end"
|
|
11
|
+
| "right-start"
|
|
12
|
+
| "right-end";
|
|
13
|
+
|
|
14
|
+
// Define
|
|
15
|
+
export type TabsProps = {
|
|
16
|
+
placement?: TabsPlacement;
|
|
17
|
+
variant?: TabsVariant;
|
|
18
|
+
role?: string;
|
|
19
|
+
modelValue?: string;
|
|
20
|
+
border?: number;
|
|
21
|
+
margin?: number[];
|
|
22
|
+
shape?: string;
|
|
23
|
+
divider?: boolean;
|
|
24
|
+
transition?: boolean;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type TabsEmit = {
|
|
28
|
+
(e: "update:modelValue", value: string): void;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type TabsProviderState = {
|
|
32
|
+
activeValue: ComputedRef<string>;
|
|
33
|
+
role: ComputedRef<string>;
|
|
34
|
+
shape: ComputedRef<string>;
|
|
35
|
+
setValue: (val: string) => void;
|
|
36
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<style lang="scss" src="./tabs.scss" scoped></style>
|
|
2
|
+
<template src="./tabs.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { computed, inject, nextTick, onMounted, onUnmounted, provide, ref, watch } from "vue";
|
|
5
|
+
import { type TabsProps, type TabsEmit, type TabsProviderState } from "./tabs.type";
|
|
6
|
+
import { property, withPrefix } from "../../../utils";
|
|
7
|
+
import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../../app";
|
|
8
|
+
import { TABS_PROVIDER_STATE_KEY } from "./tabs.constants";
|
|
9
|
+
|
|
10
|
+
/// Define
|
|
11
|
+
/// ------------------------------------------------------------
|
|
12
|
+
const props = withDefaults(defineProps<TabsProps>(), {
|
|
13
|
+
placement: "top-start",
|
|
14
|
+
margin: () => [0, 0],
|
|
15
|
+
border: 2,
|
|
16
|
+
divider: undefined,
|
|
17
|
+
transition: true,
|
|
18
|
+
});
|
|
19
|
+
const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
|
|
20
|
+
const emit = defineEmits<TabsEmit>();
|
|
21
|
+
|
|
22
|
+
/// State
|
|
23
|
+
/// ------------------------------------------------------------
|
|
24
|
+
const width = ref(0);
|
|
25
|
+
const height = ref(0);
|
|
26
|
+
const top = ref(0);
|
|
27
|
+
const left = ref(0);
|
|
28
|
+
const container = ref();
|
|
29
|
+
|
|
30
|
+
/// Computed
|
|
31
|
+
/// ------------------------------------------------------------
|
|
32
|
+
const role = computed(() => {
|
|
33
|
+
return props.role || appState?.role.value || "";
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const shape = computed(() => {
|
|
37
|
+
return props.shape || appState?.shape.value || "";
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const activeValue = computed(() => {
|
|
41
|
+
return props.modelValue || "";
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const tabsAttrs = computed(() => {
|
|
45
|
+
const divider =
|
|
46
|
+
(props.divider !== undefined ? props.divider : appState?.divider.value || false) ?? false;
|
|
47
|
+
let l = left.value;
|
|
48
|
+
let t = top.value;
|
|
49
|
+
let w = width.value;
|
|
50
|
+
let h = height.value;
|
|
51
|
+
|
|
52
|
+
t = t - props.margin[0];
|
|
53
|
+
l = l - props.margin[1];
|
|
54
|
+
h = h + props.margin[0] * 2;
|
|
55
|
+
w = w + props.margin[1] * 2;
|
|
56
|
+
|
|
57
|
+
if (props.variant === "underline") {
|
|
58
|
+
/// Top, Bottom
|
|
59
|
+
if (props.placement.startsWith("top-")) {
|
|
60
|
+
t = h - props.border;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (props.placement.startsWith("bottom-")) {
|
|
64
|
+
t = 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (props.placement.startsWith("top-") || props.placement.startsWith("bottom-")) {
|
|
68
|
+
h = props.border + 0.5;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Left, Right
|
|
72
|
+
if (props.placement.startsWith("left-")) {
|
|
73
|
+
l = w - props.border;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (props.placement.startsWith("right-")) {
|
|
77
|
+
l = 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (props.placement.startsWith("left-") || props.placement.startsWith("right-")) {
|
|
81
|
+
w = props.border;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
class: [
|
|
87
|
+
withPrefix(["layer", "tabs"]),
|
|
88
|
+
withPrefix(["role", role.value]),
|
|
89
|
+
withPrefix(["shape", shape.value]),
|
|
90
|
+
withPrefix("tabs"),
|
|
91
|
+
props.variant,
|
|
92
|
+
props.placement,
|
|
93
|
+
{
|
|
94
|
+
divider,
|
|
95
|
+
transition: props.transition,
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
style: {
|
|
99
|
+
[property("highlight-top")]: typeof t === "string" ? t : t + "px",
|
|
100
|
+
[property("highlight-left")]: typeof l === "string" ? l : l + "px",
|
|
101
|
+
[property("highlight-width")]: typeof w === "string" ? w : w + "px",
|
|
102
|
+
[property("highlight-height")]: typeof h === "string" ? h : h + "px",
|
|
103
|
+
[property("highlight-space-x")]: (props.margin[1] > 0 ? props.margin[1] : 0) + "px",
|
|
104
|
+
[property("highlight-space-y")]: (props.margin[0] > 0 ? props.margin[0] : 0) + "px",
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
/// Methods
|
|
110
|
+
/// ------------------------------------------------------------
|
|
111
|
+
const calcPosition = () => {
|
|
112
|
+
let active = container.value.querySelector(".active");
|
|
113
|
+
if (active) {
|
|
114
|
+
width.value = active.offsetWidth;
|
|
115
|
+
height.value = active.offsetHeight;
|
|
116
|
+
left.value =
|
|
117
|
+
active.getBoundingClientRect().left -
|
|
118
|
+
container.value.getBoundingClientRect().left +
|
|
119
|
+
container.value.scrollLeft;
|
|
120
|
+
top.value =
|
|
121
|
+
active.getBoundingClientRect().top -
|
|
122
|
+
container.value.getBoundingClientRect().top +
|
|
123
|
+
container.value.scrollTop;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// Lifecycle
|
|
128
|
+
/// ------------------------------------------------------------
|
|
129
|
+
watch(
|
|
130
|
+
() => props.modelValue,
|
|
131
|
+
async () => {
|
|
132
|
+
await nextTick();
|
|
133
|
+
calcPosition();
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
onMounted(async () => {
|
|
138
|
+
await nextTick();
|
|
139
|
+
calcPosition();
|
|
140
|
+
window.addEventListener("resize", calcPosition);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
onUnmounted(() => {
|
|
144
|
+
window.removeEventListener("resize", calcPosition);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// Export, Expose
|
|
148
|
+
/// ------------------------------------------------------------
|
|
149
|
+
provide<TabsProviderState>(TABS_PROVIDER_STATE_KEY, {
|
|
150
|
+
activeValue,
|
|
151
|
+
role,
|
|
152
|
+
shape,
|
|
153
|
+
setValue: (val: unknown) => {
|
|
154
|
+
emit("update:modelValue", val as string);
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Toast } from "./toast.vue";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# `<t-toast>`
|
|
2
|
+
|
|
3
|
+
> Default prefix is `t-` — change via `createToife({ prefix: "..." })`.
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
Toast region for a given `placement`; messages come from the singleton `useToast()` store. `t-app` mounts several instances with different placements.
|
|
8
|
+
|
|
9
|
+
## Requirements / dependencies
|
|
10
|
+
|
|
11
|
+
| Item | Notes |
|
|
12
|
+
| ----- | ------------------------------------------------------------------ |
|
|
13
|
+
| Vue | ^3.5 |
|
|
14
|
+
| Other | Call `useToast().open()` anywhere to push messages (shared store). |
|
|
15
|
+
|
|
16
|
+
## Basic usage
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { useToast } from "@toife/vue";
|
|
20
|
+
|
|
21
|
+
const toast = useToast();
|
|
22
|
+
toast.open({
|
|
23
|
+
message: "Saved",
|
|
24
|
+
placement: "bottom-center",
|
|
25
|
+
duration: 2000,
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```vue
|
|
30
|
+
<!-- One region; placement must match `open` -->
|
|
31
|
+
<t-toast placement="bottom-center" />
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Props
|
|
35
|
+
|
|
36
|
+
| Prop | Type | Default | Description |
|
|
37
|
+
| ----------- | ---------------- | -------------- | --------------------------------------- |
|
|
38
|
+
| `placement` | `ToastPlacement` | `"bottom-end"` | Only shows messages for this placement. |
|
|
39
|
+
|
|
40
|
+
**Type source:** `src/components/toast/toast.type.ts`
|
|
41
|
+
|
|
42
|
+
## Events (emits)
|
|
43
|
+
|
|
44
|
+
_None._
|
|
45
|
+
|
|
46
|
+
## Slots
|
|
47
|
+
|
|
48
|
+
| Slot | Description |
|
|
49
|
+
| --------- | ----------------------------------------- |
|
|
50
|
+
| `content` | Replaces the default `ToastContent` list. |
|
|
51
|
+
|
|
52
|
+
## See also
|
|
53
|
+
|
|
54
|
+
- Source: `src/components/toast/toast`
|
|
55
|
+
- `toast.composable.ts` — `useToast`
|
|
56
|
+
- [toast-content.md](../toast-content/toast-content.md)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
@use "@toife/sass-layer-generator" as sass;
|
|
2
|
+
|
|
3
|
+
// Class name
|
|
4
|
+
$toast: sass.fn-naming-prefix("toast");
|
|
5
|
+
$toastContent: sass.fn-naming-prefix("toast-content");
|
|
6
|
+
|
|
7
|
+
// Properties
|
|
8
|
+
$max-width: sass.fn-naming-var("overlay", "max-width");
|
|
9
|
+
$space-x: sass.fn-naming-var("spacing", "x");
|
|
10
|
+
$safe-area-right: sass.fn-naming-var("safe-area", "right");
|
|
11
|
+
$safe-area-left: sass.fn-naming-var("safe-area", "left");
|
|
12
|
+
$safe-area-bottom: sass.fn-naming-var("safe-area", "bottom");
|
|
13
|
+
$safe-area-top: sass.fn-naming-var("safe-area", "top");
|
|
14
|
+
|
|
15
|
+
.#{$toast} {
|
|
16
|
+
width: fit-content;
|
|
17
|
+
height: fit-content;
|
|
18
|
+
max-width: #{$max-width};
|
|
19
|
+
position: absolute;
|
|
20
|
+
z-index: 999;
|
|
21
|
+
font-size: 0.8em;
|
|
22
|
+
line-height: 0.8em;
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
gap: #{$space-x};
|
|
26
|
+
|
|
27
|
+
&.bottom-start {
|
|
28
|
+
bottom: calc(#{$safe-area-bottom} + #{$space-x} * 4);
|
|
29
|
+
left: calc(#{$space-x} * 4);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.bottom-center {
|
|
33
|
+
bottom: calc(#{$safe-area-bottom} + #{$space-x} * 4);
|
|
34
|
+
left: 50%;
|
|
35
|
+
transform: translateX(-50%);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&.bottom-end {
|
|
39
|
+
bottom: calc(#{$safe-area-bottom} + #{$space-x} * 4);
|
|
40
|
+
right: calc(#{$space-x} * 4);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&.top-start {
|
|
44
|
+
top: calc(#{$safe-area-top} + #{$space-x} * 4);
|
|
45
|
+
left: calc(#{$space-x} * 4);
|
|
46
|
+
flex-direction: column-reverse;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&.top-center {
|
|
50
|
+
top: calc(#{$safe-area-top} + #{$space-x} * 4);
|
|
51
|
+
left: 50%;
|
|
52
|
+
transform: translateX(-50%);
|
|
53
|
+
flex-direction: column-reverse;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&.top-end {
|
|
57
|
+
top: calc(#{$safe-area-top} + #{$space-x} * 4);
|
|
58
|
+
right: calc(#{$space-x} * 4);
|
|
59
|
+
flex-direction: column-reverse;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<style lang="scss" src="./toast.scss" scoped></style>
|
|
2
|
+
<template src="./toast.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { computed } from "vue";
|
|
5
|
+
import { type ToastProps } from "../toast.type";
|
|
6
|
+
import { withPrefix } from "../../../utils";
|
|
7
|
+
import { useToast } from "../toast.composable";
|
|
8
|
+
import { ToastContent } from "../toast-content";
|
|
9
|
+
|
|
10
|
+
/// Define
|
|
11
|
+
/// ------------------------------------------------------------
|
|
12
|
+
const props = withDefaults(defineProps<ToastProps>(), {
|
|
13
|
+
placement: "bottom-end",
|
|
14
|
+
});
|
|
15
|
+
const toast = useToast();
|
|
16
|
+
|
|
17
|
+
/// Computed
|
|
18
|
+
/// ------------------------------------------------------------
|
|
19
|
+
const toastAttrs = computed(() => {
|
|
20
|
+
return {
|
|
21
|
+
class: [withPrefix("toast"), props.placement],
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const toastMessages = computed(() => {
|
|
26
|
+
return toast.messages.value.filter((item) => item.placement == props.placement);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
/// Methods
|
|
30
|
+
/// ------------------------------------------------------------
|
|
31
|
+
const dismiss = (id: number) => {
|
|
32
|
+
toast.close(id);
|
|
33
|
+
};
|
|
34
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ToastContent } from "./toast-content.vue";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div v-bind="contentAttrs">{{ props.message }}</div>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# `<t-toast-content>`
|
|
2
|
+
|
|
3
|
+
> Default prefix is `t-` — change via `createToife({ prefix: "..." })`.
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
Single toast line: shows `message`, auto-dismisses after `duration`, emits `close` after the exit animation (usually handled by `t-toast` → `useToast().close(id)`).
|
|
8
|
+
|
|
9
|
+
## Requirements / dependencies
|
|
10
|
+
|
|
11
|
+
| Item | Notes |
|
|
12
|
+
| ----- | -------------------------------------------------------------- |
|
|
13
|
+
| Vue | ^3.5 |
|
|
14
|
+
| Other | `t-app` for theme; usually rendered by `t-toast` in a `v-for`. |
|
|
15
|
+
|
|
16
|
+
## Props
|
|
17
|
+
|
|
18
|
+
| Prop | Type | Default | Description |
|
|
19
|
+
| ---------------- | --------------------- | -------- | --------------------------------- |
|
|
20
|
+
| `id` | `number` | — | Message id (`useToast` store). |
|
|
21
|
+
| `message` | `string` | `""` | Text. |
|
|
22
|
+
| `duration` | `number` | `2000` | ms before close animation starts. |
|
|
23
|
+
| `role` / `shape` | `string` | — | Theme. |
|
|
24
|
+
| `variant` | `ToastContentVariant` | `"fill"` | `fill` \| `text`. |
|
|
25
|
+
| `placement` | `ToastPlacement` | — | Set when pushing to the store. |
|
|
26
|
+
|
|
27
|
+
**Type source:** `src/components/toast/toast.type.ts`
|
|
28
|
+
|
|
29
|
+
## Events (emits)
|
|
30
|
+
|
|
31
|
+
| Event | Payload | Description |
|
|
32
|
+
| ------- | ------- | -------------------------------- |
|
|
33
|
+
| `close` | — | After delay + closing animation. |
|
|
34
|
+
|
|
35
|
+
## Slots
|
|
36
|
+
|
|
37
|
+
_None_ — single text `div`.
|
|
38
|
+
|
|
39
|
+
## See also
|
|
40
|
+
|
|
41
|
+
- Source: `src/components/toast/toast-content`
|