@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 @@
|
|
|
1
|
+
export const APP_PROVIDER_STATE_KEY = "app-state";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<div v-bind="appAttrs">
|
|
2
|
+
<slot />
|
|
3
|
+
<slot name="global"></slot>
|
|
4
|
+
<Toast placement="top-start" />
|
|
5
|
+
<Toast placement="bottom-start" />
|
|
6
|
+
<Toast placement="bottom-center" />
|
|
7
|
+
<Toast placement="bottom-end" />
|
|
8
|
+
<Toast placement="top-center" />
|
|
9
|
+
<Toast placement="top-end" />
|
|
10
|
+
<Action
|
|
11
|
+
v-if="action.data.value"
|
|
12
|
+
:visible="action.visible.value"
|
|
13
|
+
v-bind="action.data.value"
|
|
14
|
+
@close="action.close"
|
|
15
|
+
@choose="action.choose"
|
|
16
|
+
/>
|
|
17
|
+
<DecisionModal
|
|
18
|
+
v-if="decisionModal.data.value"
|
|
19
|
+
:visible="decisionModal.visible.value"
|
|
20
|
+
v-bind="decisionModal.data.value"
|
|
21
|
+
@close="decisionModal.close"
|
|
22
|
+
@choose="decisionModal.choose"
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# `<t-app>`
|
|
2
|
+
|
|
3
|
+
> Default prefix is `t-` — change via `createToife({ prefix: "..." })`.
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
Library root layout: provides theme/context (`provide`) for descendants, mounts multiple `Toast` regions by placement, and hosts `Action` / `DecisionModal` when using `useAction` / `useDecisionModal`.
|
|
8
|
+
|
|
9
|
+
## Requirements / dependencies
|
|
10
|
+
|
|
11
|
+
| Item | Notes |
|
|
12
|
+
| ----- | -------------------- |
|
|
13
|
+
| Vue | ^3.5 |
|
|
14
|
+
| Other | Router not required. |
|
|
15
|
+
|
|
16
|
+
## Basic usage
|
|
17
|
+
|
|
18
|
+
```vue
|
|
19
|
+
<template>
|
|
20
|
+
<t-app>
|
|
21
|
+
<t-page>App content</t-page>
|
|
22
|
+
</t-app>
|
|
23
|
+
</template>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Props
|
|
27
|
+
|
|
28
|
+
| Prop | Type | Default | Description |
|
|
29
|
+
| ----------- | ------------------- | -------- | ------------------------------------------------ |
|
|
30
|
+
| `shape` | `string` | `"pill"` | Default shape for children (buttons, fields, …). |
|
|
31
|
+
| `divider` | `boolean` | `false` | Default divider flag. |
|
|
32
|
+
| `role` | `string` | `"mode"` | Default theme role. |
|
|
33
|
+
| `shadow` | `boolean` | `false` | Default shadow. |
|
|
34
|
+
| `triple` | `boolean` | `false` | Layout flag (provided to children). |
|
|
35
|
+
| `direction` | `"left" \| "right"` | `"left"` | Direction (fields, …). |
|
|
36
|
+
|
|
37
|
+
**Type source:** `src/components/app/app.type.ts`
|
|
38
|
+
|
|
39
|
+
## Events (emits)
|
|
40
|
+
|
|
41
|
+
_No public emits._
|
|
42
|
+
|
|
43
|
+
## Slots
|
|
44
|
+
|
|
45
|
+
| Slot | Description |
|
|
46
|
+
| --------- | ----------------------------------------------------- |
|
|
47
|
+
| `default` | Main app content. |
|
|
48
|
+
| `global` | Extra slot (after default, before internal overlays). |
|
|
49
|
+
|
|
50
|
+
## `v-model`
|
|
51
|
+
|
|
52
|
+
No.
|
|
53
|
+
|
|
54
|
+
## Provide / inject / context
|
|
55
|
+
|
|
56
|
+
`provide(APP_PROVIDER_STATE_KEY)`: `{ shape, divider, role, shadow, triple, direction }` — children inject for consistent theming.
|
|
57
|
+
|
|
58
|
+
## Expose
|
|
59
|
+
|
|
60
|
+
Nothing.
|
|
61
|
+
|
|
62
|
+
## Special behavior
|
|
63
|
+
|
|
64
|
+
- Renders several `Toast` instances with fixed placements (top/bottom × start/center/end).
|
|
65
|
+
- When `useAction()` / `useDecisionModal()` has `data`, renders the matching `Action` / `DecisionModal`.
|
|
66
|
+
|
|
67
|
+
## Accessibility (a11y)
|
|
68
|
+
|
|
69
|
+
Wrapper only; no special root role.
|
|
70
|
+
|
|
71
|
+
## Style / class notes
|
|
72
|
+
|
|
73
|
+
Classes: `layer`, `base`, `shape`, `app`.
|
|
74
|
+
|
|
75
|
+
## See also
|
|
76
|
+
|
|
77
|
+
- Source: `src/components/app`
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@use "@toife/sass-layer-generator" as sass;
|
|
2
|
+
|
|
3
|
+
// Class name
|
|
4
|
+
$app: sass.fn-naming-prefix("app");
|
|
5
|
+
|
|
6
|
+
// Property name - layer: app
|
|
7
|
+
$background-color: sass.fn-naming-var("app", "background-color");
|
|
8
|
+
$color: sass.fn-naming-var("app", "color");
|
|
9
|
+
$transition-duration: sass.fn-naming-var("motion", "duration");
|
|
10
|
+
|
|
11
|
+
.#{$app} {
|
|
12
|
+
width: #{sass.fn-naming-var("viewport", "width")};
|
|
13
|
+
max-width: #{sass.fn-naming-var("viewport", "max-width")};
|
|
14
|
+
height: #{sass.fn-naming-var("viewport", "height")};
|
|
15
|
+
max-height: #{sass.fn-naming-var("viewport", "max-height")};
|
|
16
|
+
background-color: rgb(#{$background-color});
|
|
17
|
+
color: rgb(#{$color});
|
|
18
|
+
transition:
|
|
19
|
+
background-color #{$transition-duration} ease,
|
|
20
|
+
color #{$transition-duration} ease,
|
|
21
|
+
border-color #{$transition-duration} ease;
|
|
22
|
+
position: absolute;
|
|
23
|
+
top: 0;
|
|
24
|
+
left: 0;
|
|
25
|
+
right: 0;
|
|
26
|
+
bottom: 0;
|
|
27
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Ref } from "vue";
|
|
2
|
+
|
|
3
|
+
export type AppDirection = "left" | "right";
|
|
4
|
+
|
|
5
|
+
export type AppProps = {
|
|
6
|
+
shape?: string;
|
|
7
|
+
divider?: boolean;
|
|
8
|
+
role?: string;
|
|
9
|
+
shadow?: boolean;
|
|
10
|
+
triple?: boolean;
|
|
11
|
+
direction?: AppDirection;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type AppProviderState = {
|
|
15
|
+
shape: Ref<string>;
|
|
16
|
+
divider: Ref<boolean>;
|
|
17
|
+
role: Ref<string>;
|
|
18
|
+
shadow: Ref<boolean>;
|
|
19
|
+
triple: Ref<boolean>;
|
|
20
|
+
direction: Ref<AppDirection>;
|
|
21
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<style lang="scss" src="./app.scss" scoped></style>
|
|
2
|
+
<template src="./app.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { withPrefix } from "../../utils";
|
|
5
|
+
import { computed, provide, toRefs } from "vue";
|
|
6
|
+
import { Toast } from "../toast";
|
|
7
|
+
import { Action, useAction } from "../action";
|
|
8
|
+
import { DecisionModal, useDecisionModal } from "../decision-modal";
|
|
9
|
+
import { type AppProviderState, type AppProps } from "./app.type";
|
|
10
|
+
import { APP_PROVIDER_STATE_KEY } from "./app.constants";
|
|
11
|
+
|
|
12
|
+
/// Define
|
|
13
|
+
/// ------------------------------------------------------------
|
|
14
|
+
const props = withDefaults(defineProps<AppProps>(), {
|
|
15
|
+
shape: "pill",
|
|
16
|
+
divider: false,
|
|
17
|
+
role: "mode",
|
|
18
|
+
shadow: false,
|
|
19
|
+
triple: false,
|
|
20
|
+
direction: "left",
|
|
21
|
+
});
|
|
22
|
+
const { shape, divider, role, shadow, triple, direction } = toRefs(props);
|
|
23
|
+
const decisionModal = useDecisionModal();
|
|
24
|
+
const action = useAction();
|
|
25
|
+
|
|
26
|
+
/// Computed
|
|
27
|
+
/// ------------------------------------------------------------
|
|
28
|
+
// Present attributes
|
|
29
|
+
const appAttrs = computed(() => {
|
|
30
|
+
return {
|
|
31
|
+
class: [withPrefix(["layer", "app"]), withPrefix(["shape", shape.value]), withPrefix("app")],
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Export, Expose
|
|
36
|
+
/// ------------------------------------------------------------
|
|
37
|
+
provide<AppProviderState>(APP_PROVIDER_STATE_KEY, {
|
|
38
|
+
shape,
|
|
39
|
+
divider,
|
|
40
|
+
role,
|
|
41
|
+
shadow,
|
|
42
|
+
triple,
|
|
43
|
+
direction,
|
|
44
|
+
});
|
|
45
|
+
</script>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# `<t-avatar>`
|
|
2
|
+
|
|
3
|
+
> Default prefix is `t-` — change via `createToife({ prefix: "..." })`.
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
Displays an avatar image as a CSS `background-image` inside a themed frame (shape/role from app when omitted).
|
|
8
|
+
|
|
9
|
+
## Requirements / dependencies
|
|
10
|
+
|
|
11
|
+
| Item | Notes |
|
|
12
|
+
| ----- | ------------------------------------------------- |
|
|
13
|
+
| Vue | ^3.5 |
|
|
14
|
+
| Other | `t-app` recommended for default `role` / `shape`. |
|
|
15
|
+
|
|
16
|
+
## Basic usage
|
|
17
|
+
|
|
18
|
+
```vue
|
|
19
|
+
<t-avatar src="/user.png" size="40px" />
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Props
|
|
23
|
+
|
|
24
|
+
| Prop | Type | Default | Description |
|
|
25
|
+
| ------- | ------------------ | -------- | ------------------------------------- |
|
|
26
|
+
| `shape` | `string` | — | Shape override; default from `t-app`. |
|
|
27
|
+
| `size` | `string \| number` | `"22px"` | Size (number is treated as px). |
|
|
28
|
+
| `src` | `string` | `""` | Image URL for background. |
|
|
29
|
+
|
|
30
|
+
**Type source:** `src/components/avatar/avatar.type.ts`
|
|
31
|
+
|
|
32
|
+
## Events (emits)
|
|
33
|
+
|
|
34
|
+
_None._
|
|
35
|
+
|
|
36
|
+
## Slots
|
|
37
|
+
|
|
38
|
+
| Slot | Description |
|
|
39
|
+
| --------- | ------------------------------ |
|
|
40
|
+
| `default` | Optional inner content (rare). |
|
|
41
|
+
|
|
42
|
+
## `v-model`
|
|
43
|
+
|
|
44
|
+
No.
|
|
45
|
+
|
|
46
|
+
## Provide / inject
|
|
47
|
+
|
|
48
|
+
Injects `AppProviderState` for `role` / `shape`.
|
|
49
|
+
|
|
50
|
+
## Expose
|
|
51
|
+
|
|
52
|
+
Nothing.
|
|
53
|
+
|
|
54
|
+
## Accessibility (a11y)
|
|
55
|
+
|
|
56
|
+
Decorative background image — add `aria-label` on a parent if a name must be announced.
|
|
57
|
+
|
|
58
|
+
## Style / class notes
|
|
59
|
+
|
|
60
|
+
CSS variable `--<prefix>-width` via `property("width")`.
|
|
61
|
+
|
|
62
|
+
## See also
|
|
63
|
+
|
|
64
|
+
- Source: `src/components/avatar`
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@use "@toife/sass-layer-generator" as sass;
|
|
2
|
+
|
|
3
|
+
// Class
|
|
4
|
+
$avatar: sass.fn-naming-prefix("avatar");
|
|
5
|
+
$shape-pill: sass.fn-naming-prefix("shape-pill");
|
|
6
|
+
|
|
7
|
+
// Property - layer: avatar
|
|
8
|
+
$border-radius: sass.fn-naming-var("border-radius");
|
|
9
|
+
$background-color: sass.fn-naming-var("avatar", "background-color");
|
|
10
|
+
$width: sass.fn-naming-var("width");
|
|
11
|
+
$transition-duration: sass.fn-naming-var("motion", "duration");
|
|
12
|
+
|
|
13
|
+
// Avatar default is circle
|
|
14
|
+
// With props square then is square
|
|
15
|
+
.#{$avatar} {
|
|
16
|
+
position: relative;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
background-color: rgb(#{$background-color});
|
|
19
|
+
width: #{$width};
|
|
20
|
+
aspect-ratio: 1/1;
|
|
21
|
+
border-radius: #{$border-radius};
|
|
22
|
+
background-repeat: no-repeat;
|
|
23
|
+
background-size: cover;
|
|
24
|
+
transition:
|
|
25
|
+
background-color #{$transition-duration} ease,
|
|
26
|
+
color #{$transition-duration} ease,
|
|
27
|
+
border-color #{$transition-duration} ease,
|
|
28
|
+
box-shadow #{$transition-duration} ease,
|
|
29
|
+
border-radius #{$transition-duration} ease;
|
|
30
|
+
display: inline-block;
|
|
31
|
+
|
|
32
|
+
&.#{$shape-pill} {
|
|
33
|
+
border-radius: 50%;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<style lang="scss" src="./avatar.scss" scoped></style>
|
|
2
|
+
<template src="./avatar.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { computed, inject } from "vue";
|
|
5
|
+
import { type AvatarProps } from "./avatar.type";
|
|
6
|
+
import { property, withPrefix } from "../../utils";
|
|
7
|
+
import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
|
|
8
|
+
|
|
9
|
+
/// Define
|
|
10
|
+
/// ------------------------------------------------------------
|
|
11
|
+
const props = withDefaults(defineProps<AvatarProps>(), {
|
|
12
|
+
size: "22px",
|
|
13
|
+
src: "",
|
|
14
|
+
});
|
|
15
|
+
const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
|
|
16
|
+
|
|
17
|
+
/// Computed
|
|
18
|
+
/// ------------------------------------------------------------
|
|
19
|
+
const avatarAttrs = computed(() => {
|
|
20
|
+
const shape = props?.shape || appState?.shape.value || "";
|
|
21
|
+
const role = appState?.role.value || "";
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
class: [
|
|
25
|
+
withPrefix(["layer", "avatar"]),
|
|
26
|
+
withPrefix(["role", role]),
|
|
27
|
+
withPrefix(["shape", shape]),
|
|
28
|
+
withPrefix("avatar"),
|
|
29
|
+
],
|
|
30
|
+
style: {
|
|
31
|
+
[property("width")]: props.size + (typeof props.size === "number" ? "px" : ""),
|
|
32
|
+
backgroundImage: `url(${props.src})`,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/// Methods
|
|
38
|
+
/// ------------------------------------------------------------
|
|
39
|
+
|
|
40
|
+
// Lifecycle
|
|
41
|
+
/// ------------------------------------------------------------
|
|
42
|
+
|
|
43
|
+
// Export, Expose
|
|
44
|
+
/// ------------------------------------------------------------
|
|
45
|
+
</script>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# `<t-button>`
|
|
2
|
+
|
|
3
|
+
> Default prefix is `t-` — change via `createToife({ prefix: "..." })`.
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
Button with variants, sizes, loading state, and theming from `t-app`.
|
|
8
|
+
|
|
9
|
+
## Requirements / dependencies
|
|
10
|
+
|
|
11
|
+
| Item | Notes |
|
|
12
|
+
| ----- | ---------------------------------------------------- |
|
|
13
|
+
| Vue | ^3.5 |
|
|
14
|
+
| Other | `t-app` recommended for `shape` / `role` / `shadow`. |
|
|
15
|
+
|
|
16
|
+
## Basic usage
|
|
17
|
+
|
|
18
|
+
```vue
|
|
19
|
+
<t-button variant="fill" @click="save">Save</t-button>
|
|
20
|
+
<t-button loading>Loading</t-button>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Props
|
|
24
|
+
|
|
25
|
+
| Prop | Type | Default | Description |
|
|
26
|
+
| --------- | ---------------------------------- | ------------ | ---------------------------------------- |
|
|
27
|
+
| `role` | `string` | — | Theme role; default from app. |
|
|
28
|
+
| `size` | `"small" \| "standard" \| "large"` | `"standard"` | Size. |
|
|
29
|
+
| `shape` | `string` | — | Shape; default from app. |
|
|
30
|
+
| `block` | `boolean` | `false` | Full-width button. |
|
|
31
|
+
| `loading` | `boolean` | `false` | Hides label, shows `loading` slot. |
|
|
32
|
+
| `variant` | `ButtonVariant` | `"fill"` | `fill` \| `outline` \| `text` \| `link`. |
|
|
33
|
+
| `shadow` | `boolean` | — | Default from app if unset. |
|
|
34
|
+
|
|
35
|
+
**Type source:** `src/components/button/button.type.ts`
|
|
36
|
+
|
|
37
|
+
## Events (emits)
|
|
38
|
+
|
|
39
|
+
_No declared emits_ — use native DOM listeners (`@click`).
|
|
40
|
+
|
|
41
|
+
## Slots
|
|
42
|
+
|
|
43
|
+
| Slot | Description |
|
|
44
|
+
| --------- | ------------------------------------- |
|
|
45
|
+
| `default` | Button label (hidden when `loading`). |
|
|
46
|
+
| `loading` | Content when `loading`. |
|
|
47
|
+
|
|
48
|
+
## `v-model`
|
|
49
|
+
|
|
50
|
+
No.
|
|
51
|
+
|
|
52
|
+
## Provide / inject
|
|
53
|
+
|
|
54
|
+
Injects theme from `t-app`.
|
|
55
|
+
|
|
56
|
+
## Expose
|
|
57
|
+
|
|
58
|
+
Nothing.
|
|
59
|
+
|
|
60
|
+
## Accessibility (a11y)
|
|
61
|
+
|
|
62
|
+
Native `<button>`; focus/blur styling handled internally.
|
|
63
|
+
|
|
64
|
+
## See also
|
|
65
|
+
|
|
66
|
+
- Source: `src/components/button`
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
@use "@toife/sass-layer-generator" as sass;
|
|
2
|
+
|
|
3
|
+
// Class name
|
|
4
|
+
$button: sass.fn-naming-prefix("button");
|
|
5
|
+
$loader: sass.fn-naming-prefix("loader");
|
|
6
|
+
|
|
7
|
+
// Property name
|
|
8
|
+
$border-radius: sass.fn-naming-var("border-radius");
|
|
9
|
+
$border-width: sass.fn-naming-var("stroke", "width");
|
|
10
|
+
$transition-duration: sass.fn-naming-var("motion", "duration");
|
|
11
|
+
$spacing-x: sass.fn-naming-var("spacing", "x");
|
|
12
|
+
$spacing-y: sass.fn-naming-var("spacing", "y");
|
|
13
|
+
|
|
14
|
+
$color: sass.fn-naming-var("button", "color");
|
|
15
|
+
|
|
16
|
+
$border-color: sass.fn-naming-var("button", "border-color");
|
|
17
|
+
$border-color-hover: sass.fn-naming-var("button", "border-color", "strong");
|
|
18
|
+
$border-color-focus: sass.fn-naming-var("button", "border-color", "heavy");
|
|
19
|
+
$border-color-active: sass.fn-naming-var("button", "border-color", "heavy");
|
|
20
|
+
$border-color-disabled: sass.fn-naming-var("button", "border-color");
|
|
21
|
+
$border-color-inactive: sass.fn-naming-var("button", "border-color", "soft");
|
|
22
|
+
|
|
23
|
+
$size-font-size: sass.fn-naming-var("font-size");
|
|
24
|
+
$size-height: sass.fn-naming-var("height");
|
|
25
|
+
$size-coefficient-x: sass.fn-naming-var("coefficient-x");
|
|
26
|
+
$size-coefficient-y: sass.fn-naming-var("coefficient-y");
|
|
27
|
+
$size-line-height: sass.fn-naming-var("line-height");
|
|
28
|
+
|
|
29
|
+
$background-color: sass.fn-naming-var("button", "background-color");
|
|
30
|
+
$background-color-hover: sass.fn-naming-var("button", "background-color", "strong");
|
|
31
|
+
$background-color-focus: sass.fn-naming-var("button", "background-color", "heavy");
|
|
32
|
+
$background-color-active: sass.fn-naming-var("button", "background-color", "heavy");
|
|
33
|
+
$background-color-disabled: sass.fn-naming-var("button", "background-color");
|
|
34
|
+
$background-color-inactive: sass.fn-naming-var("button", "background-color", "soft");
|
|
35
|
+
|
|
36
|
+
.#{$button} {
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
align-items: center;
|
|
40
|
+
position: relative;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
color: rgb(#{$color});
|
|
43
|
+
background: rgb(#{$background-color});
|
|
44
|
+
border-color: rgb(#{$border-color});
|
|
45
|
+
border-style: solid;
|
|
46
|
+
border-width: #{$border-width};
|
|
47
|
+
white-space: nowrap;
|
|
48
|
+
border-radius: #{$border-radius};
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
transition:
|
|
51
|
+
color #{$transition-duration} ease,
|
|
52
|
+
background-color #{$transition-duration} ease,
|
|
53
|
+
border-color #{$transition-duration} ease,
|
|
54
|
+
border-radius #{$transition-duration} ease,
|
|
55
|
+
box-shadow #{$transition-duration} ease;
|
|
56
|
+
box-shadow: none;
|
|
57
|
+
|
|
58
|
+
padding: calc(#{$spacing-y} * #{$size-coefficient-y}) calc(#{$spacing-x} * #{$size-coefficient-x});
|
|
59
|
+
font-size: #{$size-font-size};
|
|
60
|
+
height: #{$size-height};
|
|
61
|
+
line-height: #{$size-line-height};
|
|
62
|
+
|
|
63
|
+
&:hover {
|
|
64
|
+
border-color: rgb(#{$border-color-hover});
|
|
65
|
+
background-color: rgb(#{$background-color-hover});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&.focus,
|
|
69
|
+
&:focus {
|
|
70
|
+
border-color: rgb(#{$border-color-focus});
|
|
71
|
+
background-color: rgb(#{$background-color-focus});
|
|
72
|
+
|
|
73
|
+
&.shadow {
|
|
74
|
+
box-shadow: 0 0 0 0.25rem rgb(#{$border-color}, 0.25);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&:active,
|
|
79
|
+
&.active {
|
|
80
|
+
border-color: rgb(#{$border-color-active});
|
|
81
|
+
background-color: rgb(#{$background-color-active});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&:disabled,
|
|
85
|
+
&.disabled {
|
|
86
|
+
border-color: rgba(#{$border-color-disabled}, 0.5);
|
|
87
|
+
background-color: rgba(#{$background-color-disabled}, 0.5);
|
|
88
|
+
cursor: not-allowed;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Case is block, then display full width
|
|
92
|
+
&.block {
|
|
93
|
+
width: 100%;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Style for loading icon
|
|
97
|
+
.#{$loader} {
|
|
98
|
+
position: absolute;
|
|
99
|
+
top: 0;
|
|
100
|
+
left: 0;
|
|
101
|
+
width: 100%;
|
|
102
|
+
height: 100%;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Style for content of button
|
|
106
|
+
> span {
|
|
107
|
+
display: flex;
|
|
108
|
+
justify-content: center;
|
|
109
|
+
align-items: center;
|
|
110
|
+
font-size: inherit;
|
|
111
|
+
line-height: inherit;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Define
|
|
2
|
+
export type ButtonVariant = "fill" | "outline" | "text" | "link";
|
|
3
|
+
|
|
4
|
+
export type ButtonSize = "small" | "standard" | "large";
|
|
5
|
+
|
|
6
|
+
export type ButtonProps = {
|
|
7
|
+
role?: string;
|
|
8
|
+
size?: ButtonSize;
|
|
9
|
+
shape?: string;
|
|
10
|
+
block?: boolean;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
variant?: ButtonVariant;
|
|
13
|
+
shadow?: boolean;
|
|
14
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<style lang="scss" src="./button.scss" scoped></style>
|
|
2
|
+
<template src="./button.html"></template>
|
|
3
|
+
<script lang="ts" setup>
|
|
4
|
+
import { computed, inject, ref } from "vue";
|
|
5
|
+
import { type ButtonProps } from "./button.type";
|
|
6
|
+
import { withPrefix } from "../../utils";
|
|
7
|
+
import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
|
|
8
|
+
|
|
9
|
+
/// Define
|
|
10
|
+
/// ------------------------------------------------------------
|
|
11
|
+
const props = withDefaults(defineProps<ButtonProps>(), {
|
|
12
|
+
size: "standard",
|
|
13
|
+
block: false,
|
|
14
|
+
loading: false,
|
|
15
|
+
variant: "fill",
|
|
16
|
+
shadow: undefined,
|
|
17
|
+
});
|
|
18
|
+
const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
|
|
19
|
+
|
|
20
|
+
/// State
|
|
21
|
+
/// ------------------------------------------------------------
|
|
22
|
+
const isFocused = ref(false);
|
|
23
|
+
|
|
24
|
+
/// Computed
|
|
25
|
+
/// ------------------------------------------------------------
|
|
26
|
+
const buttonAttrs = computed(() => {
|
|
27
|
+
const shape = props.shape || appState?.shape.value || "";
|
|
28
|
+
const role = props.role || appState?.role.value || "";
|
|
29
|
+
const shadow = (props?.shadow !== undefined ? props.shadow : appState?.shadow.value) ?? false;
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
class: [
|
|
33
|
+
withPrefix(["layer", "button"]),
|
|
34
|
+
withPrefix(["role", role]),
|
|
35
|
+
withPrefix(["shape", shape]),
|
|
36
|
+
withPrefix("button"),
|
|
37
|
+
withPrefix(["size", props.size]),
|
|
38
|
+
props.variant,
|
|
39
|
+
{
|
|
40
|
+
block: props.block,
|
|
41
|
+
shadow,
|
|
42
|
+
focus: isFocused.value,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const loaderAttrs = {
|
|
49
|
+
class: [withPrefix("loader")],
|
|
50
|
+
} as const;
|
|
51
|
+
|
|
52
|
+
/// Methods
|
|
53
|
+
/// ------------------------------------------------------------
|
|
54
|
+
const onFocus = () => {
|
|
55
|
+
isFocused.value = true;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const onBlur = () => {
|
|
59
|
+
isFocused.value = false;
|
|
60
|
+
};
|
|
61
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CABLE_PROVIDER_STATE_KEY = "cable-state";
|