srcdev-nuxt-components 9.1.55 → 9.1.56
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/.claude/settings.json +29 -2
- package/.claude/skills/components/alert-content-inner.md +60 -0
- package/.claude/skills/components/display-dialog.md +80 -0
- package/.claude/skills/components/display-prompt.md +163 -0
- package/.claude/skills/components/display-toast.md +235 -0
- package/.claude/skills/index.md +7 -3
- package/.claude/skills/theming-colour-ramps.md +328 -0
- package/.claude/skills/theming-override-default.md +115 -186
- package/.claude/skills/theming-partial-override.md +88 -75
- package/README.md +166 -0
- package/app/app.config.ts +44 -0
- package/app/assets/styles/setup/01.config/_head.css +3 -3
- package/app/assets/styles/setup/02.colours/_amber.css +12 -10
- package/app/assets/styles/setup/02.colours/_blue.css +10 -9
- package/app/assets/styles/setup/02.colours/_green.css +12 -11
- package/app/assets/styles/setup/02.colours/_orange.css +12 -10
- package/app/assets/styles/setup/02.colours/_red.css +10 -9
- package/app/assets/styles/setup/02.colours/_slate.css +12 -11
- package/app/assets/styles/setup/02.colours/_sunset.css +12 -10
- package/app/assets/styles/setup/02.colours/_theme-params.css +18 -0
- package/app/assets/styles/setup/02.colours/index.css +1 -0
- package/app/assets/styles/setup/03.theming/_default.css +87 -0
- package/app/assets/styles/setup/03.theming/_error.css +14 -0
- package/app/assets/styles/setup/03.theming/_success.css +4 -0
- package/app/assets/styles/setup/03.theming/_theme-slots.css +16 -0
- package/app/assets/styles/setup/03.theming/_warning.css +13 -0
- package/app/assets/styles/setup/03.theming/index.css +6 -4
- package/app/assets/styles/setup/03.theming/theme-ramp.css +19 -0
- package/app/assets/styles/setup/04.elements/forms/00.element-defaults.css +0 -7
- package/app/assets/styles/setup/04.elements/forms/06.button-geometry.css +1 -1
- package/app/assets/styles/setup/index.css +1 -1
- package/app/components/01.atoms/display-dialog/DisplayDialog.vue +74 -24
- package/app/components/01.atoms/display-dialog/tests/DisplayDialog.spec.ts +148 -14
- package/app/components/01.atoms/display-dialog/tests/__snapshots__/DisplayDialog.spec.ts.snap +3 -3
- package/app/components/01.atoms/prompt/DisplayPrompt.vue +113 -0
- package/app/components/01.atoms/prompt/stories/DisplayPrompt.stories.ts +112 -0
- package/app/components/01.atoms/prompt/tests/DisplayPrompt.spec.ts +205 -0
- package/app/components/01.atoms/toast/DisplayToast.vue +327 -0
- package/app/components/01.atoms/toast/DisplayToastProvider.vue +362 -0
- package/app/components/01.atoms/toast/stories/DisplayToast.stories.ts +195 -0
- package/app/components/01.atoms/toast/stories/DisplayToastProvider.stories.ts +142 -0
- package/app/components/01.atoms/toast/tests/DisplayToast.spec.ts +266 -0
- package/app/components/01.atoms/toast/tests/DisplayToastProvider.spec.ts +256 -0
- package/app/components/02.molecules/action-menu/ActionMenu.vue +8 -1
- package/app/components/02.molecules/action-menu/ActionMenuItemCore.vue +11 -3
- package/app/components/02.molecules/alert-content/AlertContent.vue +67 -0
- package/app/components/02.molecules/alert-content/AlertContentInner.vue +153 -0
- package/app/components/02.molecules/alert-content/stories/AlertContent.stories.ts +131 -0
- package/app/components/02.molecules/alert-content/tests/AlertContent.spec.ts +135 -0
- package/app/components/02.molecules/alert-content/tests/AlertContentInner.spec.ts +135 -0
- package/app/components/02.molecules/alert-masked-content/AlertMaskedContent.vue +78 -0
- package/app/components/02.molecules/alert-masked-content/stories/AlertMaskedContent.stories.ts +132 -0
- package/app/components/02.molecules/alert-masked-content/tests/AlertMaskedContent.spec.ts +149 -0
- package/app/components/05.forms/input-button/InputButtonCore.vue +35 -39
- package/app/components/05.forms/input-checkbox-radio/InputCheckboxRadioButton.vue +8 -8
- package/app/components/05.forms/input-checkbox-radio/InputCheckboxRadioCore.vue +5 -5
- package/app/components/05.forms/input-copy/InputCopyCore.vue +7 -7
- package/app/components/05.forms/input-number/InputNumberCore.vue +5 -5
- package/app/components/05.forms/input-select/InputSelectCore.vue +6 -6
- package/app/components/05.forms/input-text/InputTextCore.vue +6 -6
- package/app/components/05.forms/input-text/variants/InputTextAsNumberWithLabel.vue +2 -2
- package/app/components/05.forms/input-textarea/InputTextareaCore.vue +5 -5
- package/app/components/05.forms/pending-effect/PendingEffect.vue +60 -60
- package/app/components/05.forms/toggle-switch/ToggleSwitchCore.vue +10 -10
- package/app/components/05.forms/triple-toggle-switch/TripleToggleSwitchCore.vue +4 -4
- package/app/components/display-theme-switch/DisplayThemeSwitch.vue +4 -4
- package/app/components/display-tooltip/DisplayTooltip.vue +4 -4
- package/app/composables/useBodyLock.ts +21 -0
- package/app/composables/useDialogControls.ts +11 -11
- package/app/composables/useToastQueue.ts +39 -0
- package/app/layouts/default.vue +1 -1
- package/app/pages/ui/display-dialog.vue +275 -127
- package/app/pages/ui/display-prompt.vue +255 -52
- package/app/pages/ui/display-toast.vue +278 -299
- package/app/pages/ui/mask-element.vue +25 -3
- package/app/pages/ui/settings.vue +9 -35
- package/app/types/app-config.d.ts +41 -0
- package/app/types/components/display-prompt.d.ts +11 -0
- package/app/types/components/display-toast.d.ts +11 -9
- package/app/types/components/index.ts +2 -0
- package/app/types/components/semantic-theme.d.ts +1 -0
- package/nuxt.config.ts +16 -0
- package/package.json +6 -4
- package/app/assets/styles/setup/03.theming/default/_dark.css +0 -156
- package/app/assets/styles/setup/03.theming/default/_light.css +0 -166
- package/app/assets/styles/setup/03.theming/default/index.css +0 -2
- package/app/assets/styles/setup/03.theming/error/_dark.css +0 -56
- package/app/assets/styles/setup/03.theming/error/_light.css +0 -74
- package/app/assets/styles/setup/03.theming/error/index.css +0 -2
- package/app/assets/styles/setup/03.theming/success/_dark.css +0 -50
- package/app/assets/styles/setup/03.theming/success/_light.css +0 -65
- package/app/assets/styles/setup/03.theming/success/index.css +0 -2
- package/app/assets/styles/setup/03.theming/warning/_dark.css +0 -50
- package/app/assets/styles/setup/03.theming/warning/_light.css +0 -64
- package/app/assets/styles/setup/03.theming/warning/index.css +0 -2
- package/app/components/display-prompt/DisplayPromptCore.vue +0 -228
- package/app/components/display-prompt/variants/DisplayPromptError.vue +0 -53
- package/app/components/display-toast/DisplayToast.vue +0 -447
- package/app/components/display-toast/molecules/DefaultToastContent.vue +0 -163
- package/app/components/display-toast/stories/DisplayToast.stories.ts +0 -380
|
@@ -94,23 +94,23 @@ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
|
94
94
|
position: relative;
|
|
95
95
|
|
|
96
96
|
&.normal {
|
|
97
|
-
border: var(--form-element-border-width) solid var(--theme-
|
|
97
|
+
border: var(--form-element-border-width) solid var(--theme-border);
|
|
98
98
|
border-radius: var(--form-input-border-radius);
|
|
99
|
-
outline: var(--form-element-outline-width) solid
|
|
99
|
+
outline: var(--form-element-outline-width) solid transparent;
|
|
100
100
|
|
|
101
101
|
&:has(textarea:focus-visible) {
|
|
102
|
-
outline: var(--form-element-outline-width-focus) solid var(--theme-
|
|
102
|
+
outline: var(--form-element-outline-width-focus) solid var(--theme-border-focus);
|
|
103
103
|
outline-offset: var(--form-element-outline-offset-focus);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
&:has(textarea:is(:hover)) {
|
|
107
|
-
outline: var(--form-element-outline-width-focus) solid var(--theme-
|
|
107
|
+
outline: var(--form-element-outline-width-focus) solid var(--theme-border-focus);
|
|
108
108
|
outline-offset: var(--form-element-outline-offset-focus);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
&.underlined {
|
|
113
|
-
border-bottom: var(--form-element-border-bottom-width-underlined) solid var(--theme-
|
|
113
|
+
border-bottom: var(--form-element-border-bottom-width-underlined) solid var(--theme-border);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
display: flex;
|
|
@@ -21,81 +21,81 @@ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
|
21
21
|
|
|
22
22
|
<style lang="css">
|
|
23
23
|
@layer components {
|
|
24
|
-
.pending-effect {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
.pending-effect {
|
|
25
|
+
--pending-line-color: var(--theme-surface);
|
|
26
|
+
--pending-line-thickness: 0.1rem;
|
|
27
|
+
--pending-line-length: 2rem;
|
|
28
|
+
--pending-blur-color: var(--theme-surface);
|
|
29
|
+
--pending-blur-size: 0rem; /* 0.3rem */
|
|
30
|
+
--pending-offset: 1rem;
|
|
31
|
+
--animation-speed: 3000ms;
|
|
32
|
+
/* do not change, used for calculations */
|
|
33
|
+
--container-offset: 10rem;
|
|
34
|
+
position: relative;
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
.pending-container {
|
|
37
|
+
pointer-events: none;
|
|
38
|
+
position: absolute;
|
|
39
|
+
inset: calc(var(--container-offset) / -2);
|
|
40
|
+
width: calc(100% + var(--container-offset));
|
|
41
|
+
height: calc(100% + var(--container-offset));
|
|
42
|
+
opacity: 0;
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
44
|
+
.pending-blur,
|
|
45
|
+
.pending-line {
|
|
46
|
+
width: calc(100% - var(--container-offset) + var(--pending-offset));
|
|
47
|
+
height: calc(100% - var(--container-offset) + var(--pending-offset));
|
|
48
|
+
x: calc((var(--container-offset) / 2) + calc(var(--pending-offset) / -2));
|
|
49
|
+
y: calc((var(--container-offset) / 2) + calc(var(--pending-offset) / -2));
|
|
50
|
+
rx: 0.8rem;
|
|
51
|
+
fill: transparent;
|
|
52
|
+
stroke: black;
|
|
53
|
+
stroke-width: 0.5rem;
|
|
54
|
+
stroke-dasharray: var(--pending-line-length) calc(5rem - var(--pending-line-length));
|
|
55
|
+
}
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
.pending-line {
|
|
58
|
+
stroke: var(--pending-line-color);
|
|
59
|
+
stroke-width: var(--pending-line-thickness);
|
|
60
|
+
}
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
.pending-blur {
|
|
63
|
+
filter: blur(var(--pending-blur-size));
|
|
64
|
+
stroke: var(--pending-blur-color);
|
|
65
|
+
stroke-width: var(--pending-blur-size);
|
|
66
|
+
}
|
|
66
67
|
}
|
|
67
|
-
}
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
&:is(.icon-only) {
|
|
70
|
+
.pending-container {
|
|
71
|
+
.pending-blur,
|
|
72
|
+
.pending-line {
|
|
73
|
+
rx: 100vw;
|
|
74
|
+
}
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
|
-
}
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
&:is(.is-pending) {
|
|
79
|
+
pointer-events: none;
|
|
80
|
+
cursor: wait;
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
83
|
+
animation: stroke-dashoffset var(--animation-speed) infinite linear;
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
.pending-container {
|
|
86
|
+
opacity: 1;
|
|
87
|
+
}
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
|
-
}
|
|
91
91
|
|
|
92
|
-
@keyframes stroke-dashoffset {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
@keyframes stroke-dashoffset {
|
|
93
|
+
0% {
|
|
94
|
+
stroke-dashoffset: 0;
|
|
95
|
+
}
|
|
96
|
+
100% {
|
|
97
|
+
stroke-dashoffset: -10rem;
|
|
98
|
+
}
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
|
-
}
|
|
101
101
|
</style>
|
|
@@ -117,7 +117,7 @@ const toggleSwitchValue = () => {
|
|
|
117
117
|
|
|
118
118
|
&:focus-visible {
|
|
119
119
|
+ .symbol-wrapper {
|
|
120
|
-
outline: var(--form-element-outline-width-focus) solid var(--theme-
|
|
120
|
+
outline: var(--form-element-outline-width-focus) solid var(--theme-border-focus);
|
|
121
121
|
outline-offset: var(--form-element-outline-offset-focus);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -138,14 +138,14 @@ const toggleSwitchValue = () => {
|
|
|
138
138
|
|
|
139
139
|
/* UI */
|
|
140
140
|
background-color: var(--theme-checkbox-symbol-surface);
|
|
141
|
-
border: var(--form-element-border-width) solid var(--theme-
|
|
142
|
-
outline: var(--form-element-outline-width) solid
|
|
141
|
+
border: var(--form-element-border-width) solid var(--theme-border);
|
|
142
|
+
outline: var(--form-element-outline-width) solid transparent;
|
|
143
143
|
border-radius: 100vw;
|
|
144
144
|
width: 72px;
|
|
145
145
|
padding: calc(var(--input-toggle-wrapper-padding) + var(--input-toggle-symbol-outline-width));
|
|
146
146
|
|
|
147
147
|
&:hover {
|
|
148
|
-
background-color: var(--theme-
|
|
148
|
+
background-color: var(--theme-surface-subtle);
|
|
149
149
|
cursor: pointer;
|
|
150
150
|
}
|
|
151
151
|
|
|
@@ -163,16 +163,16 @@ const toggleSwitchValue = () => {
|
|
|
163
163
|
|
|
164
164
|
/* UI */
|
|
165
165
|
/* padding: calc(calc(var(--input-toggle-symbol-size) - var(--_icon-font-size)) / 2); */
|
|
166
|
-
border: var(--input-toggle-symbol-border-width) solid var(--theme-
|
|
167
|
-
outline: var(--input-toggle-symbol-outline-width) solid
|
|
166
|
+
border: var(--input-toggle-symbol-border-width) solid var(--theme-text);
|
|
167
|
+
outline: var(--input-toggle-symbol-outline-width) solid transparent;
|
|
168
168
|
border-radius: 100vw;
|
|
169
|
-
background-color: var(--theme-
|
|
169
|
+
background-color: var(--theme-on-surface);
|
|
170
170
|
transition:
|
|
171
171
|
translate 0.4s ease,
|
|
172
172
|
background-color 0.4s linear;
|
|
173
173
|
|
|
174
174
|
&.checked {
|
|
175
|
-
background-color: var(--theme-
|
|
175
|
+
background-color: var(--theme-surface);
|
|
176
176
|
/* left: calc(
|
|
177
177
|
100% - var(--input-toggle-symbol-size) - var(--_switch-padding) - (2 * var(--_toggle-symbol-border-width))
|
|
178
178
|
); */
|
|
@@ -202,11 +202,11 @@ const toggleSwitchValue = () => {
|
|
|
202
202
|
color var(--theme-form-transition-duration);
|
|
203
203
|
|
|
204
204
|
&.icon-on {
|
|
205
|
-
color: var(--theme-
|
|
205
|
+
color: var(--theme-on-surface);
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
&.icon-off {
|
|
209
|
-
color: var(--theme-
|
|
209
|
+
color: var(--theme-surface);
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
&.active {
|
|
@@ -153,15 +153,15 @@ onMounted(() => {
|
|
|
153
153
|
width: fit-content;
|
|
154
154
|
|
|
155
155
|
background-color: var(--theme-input-surface);
|
|
156
|
-
border: var(--form-element-border-width) solid var(--theme-
|
|
157
|
-
outline: var(--form-element-outline-width) solid
|
|
156
|
+
border: var(--form-element-border-width) solid var(--theme-border);
|
|
157
|
+
outline: var(--form-element-outline-width) solid transparent;
|
|
158
158
|
border-radius: 100vw;
|
|
159
159
|
padding: var(--_form-padding);
|
|
160
160
|
|
|
161
161
|
transition: all var(--theme-form-transition-duration) ease-in-out;
|
|
162
162
|
|
|
163
163
|
&:has(input:focus-visible) {
|
|
164
|
-
outline: var(--form-element-outline-width) solid var(--theme-
|
|
164
|
+
outline: var(--form-element-outline-width) solid var(--theme-ring);
|
|
165
165
|
outline-offset: 0.2rem;
|
|
166
166
|
}
|
|
167
167
|
|
|
@@ -223,7 +223,7 @@ onMounted(() => {
|
|
|
223
223
|
outline: var(--form-element-outline-width) solid light-dark(var(--slate-10), var(--slate-00));
|
|
224
224
|
}
|
|
225
225
|
&:has(input:focus-visible) {
|
|
226
|
-
outline: var(--form-element-outline-width) solid var(--theme-
|
|
226
|
+
outline: var(--form-element-outline-width) solid var(--theme-ring);
|
|
227
227
|
outline-offset: 0.2rem;
|
|
228
228
|
}
|
|
229
229
|
|
|
@@ -112,12 +112,12 @@ watch(colorModeVal, (val) => {
|
|
|
112
112
|
|
|
113
113
|
.triple-toggle-switch-wrapper {
|
|
114
114
|
background-color: var(--theme-input-surface);
|
|
115
|
-
border: var(--form-element-border-width) solid var(--theme-
|
|
116
|
-
outline: var(--form-element-outline-width) solid
|
|
115
|
+
border: var(--form-element-border-width) solid var(--theme-border);
|
|
116
|
+
outline: var(--form-element-outline-width) solid transparent;
|
|
117
117
|
padding: var(--_form-padding);
|
|
118
118
|
|
|
119
119
|
&:has(input:focus-visible) {
|
|
120
|
-
outline: var(--form-element-outline-width) solid var(--theme-
|
|
120
|
+
outline: var(--form-element-outline-width) solid var(--theme-ring);
|
|
121
121
|
outline-offset: 0.2rem;
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -144,7 +144,7 @@ watch(colorModeVal, (val) => {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
&:has(input:focus-visible) {
|
|
147
|
-
outline: var(--form-element-outline-width) solid var(--theme-
|
|
147
|
+
outline: var(--form-element-outline-width) solid var(--theme-ring);
|
|
148
148
|
outline-offset: 0.2rem;
|
|
149
149
|
}
|
|
150
150
|
|
|
@@ -137,8 +137,8 @@ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
|
137
137
|
all: unset;
|
|
138
138
|
cursor: pointer;
|
|
139
139
|
color: var(--nuxt-text-accessibility-blue);
|
|
140
|
-
border: 1px solid var(--theme-
|
|
141
|
-
outline: 1px solid var(--theme-
|
|
140
|
+
border: 1px solid var(--theme-border);
|
|
141
|
+
outline: 1px solid var(--theme-ring);
|
|
142
142
|
|
|
143
143
|
font-weight: 600;
|
|
144
144
|
padding: 8px 12px;
|
|
@@ -146,8 +146,8 @@ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
|
|
|
146
146
|
&:hover,
|
|
147
147
|
&:focus {
|
|
148
148
|
text-decoration: underline;
|
|
149
|
-
border: 1px solid var(--theme-
|
|
150
|
-
outline: 1px solid var(--theme-
|
|
149
|
+
border: 1px solid var(--theme-surface);
|
|
150
|
+
outline: 1px solid var(--theme-surface);
|
|
151
151
|
outline-offset: 2px;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const getCount = (): number => Number(document.body.dataset.lockCount ?? 0);
|
|
2
|
+
|
|
3
|
+
const setCount = (n: number) => {
|
|
4
|
+
if (n > 0) document.body.dataset.lockCount = String(n);
|
|
5
|
+
else delete document.body.dataset.lockCount;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const useBodyLock = () => {
|
|
9
|
+
const lock = () => {
|
|
10
|
+
setCount(getCount() + 1);
|
|
11
|
+
document.body.classList.add("lock");
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const unlock = () => {
|
|
15
|
+
const next = Math.max(0, getCount() - 1);
|
|
16
|
+
setCount(next);
|
|
17
|
+
if (next === 0) document.body.classList.remove("lock");
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return { lock, unlock };
|
|
21
|
+
};
|
|
@@ -3,27 +3,27 @@ type DialogCallbacks = {
|
|
|
3
3
|
onCancel?: () => void;
|
|
4
4
|
};
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const dialogsConfig = reactive<Record<string, boolean>>(
|
|
10
|
-
Object.fromEntries(Object.keys(config).map((id) => [id, false]))
|
|
6
|
+
export const useDialogControls = <T extends string>(config: Record<T, DialogCallbacks> = {} as Record<T, DialogCallbacks>) => {
|
|
7
|
+
const dialogsConfig = reactive<Record<T, boolean>>(
|
|
8
|
+
Object.fromEntries(Object.keys(config).map((id) => [id, false])) as Record<T, boolean>
|
|
11
9
|
);
|
|
12
10
|
|
|
13
|
-
const
|
|
14
|
-
|
|
11
|
+
const state = dialogsConfig as Record<T, boolean>;
|
|
12
|
+
|
|
13
|
+
const openDialog = (name: T) => {
|
|
14
|
+
state[name] = true;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
const closeDialog = (name:
|
|
18
|
-
if (action
|
|
17
|
+
const closeDialog = (name: T, action?: "confirm" | "cancel") => {
|
|
18
|
+
if (action) {
|
|
19
19
|
if (action === "confirm") config[name].onConfirm?.();
|
|
20
20
|
else if (action === "cancel") config[name].onCancel?.();
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
state[name] = false;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
return {
|
|
26
|
-
dialogsConfig,
|
|
26
|
+
dialogsConfig: state,
|
|
27
27
|
openDialog,
|
|
28
28
|
closeDialog,
|
|
29
29
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { DisplayToastConfig, ToastQueueEntry } from "~/types/components";
|
|
2
|
+
|
|
3
|
+
const _queue = ref<ToastQueueEntry[]>([]);
|
|
4
|
+
|
|
5
|
+
const _promote = (id: string) => {
|
|
6
|
+
const entry = _queue.value.find((e) => e.id === id);
|
|
7
|
+
if (entry) entry.status = "visible";
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const _dismiss = (id: string) => {
|
|
11
|
+
_queue.value = _queue.value.filter((e) => e.id !== id);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function useToastQueue() {
|
|
15
|
+
const show = (config: DisplayToastConfig): string => {
|
|
16
|
+
const id = `toast-${crypto.randomUUID()}`;
|
|
17
|
+
_queue.value = [..._queue.value, { id, config, status: "pending" }];
|
|
18
|
+
return id;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const clear = () => {
|
|
22
|
+
_queue.value = [];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
queue: readonly(_queue),
|
|
27
|
+
show,
|
|
28
|
+
dismiss: _dismiss,
|
|
29
|
+
clear,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function useToastQueueProvider() {
|
|
34
|
+
return {
|
|
35
|
+
queue: readonly(_queue),
|
|
36
|
+
promote: _promote,
|
|
37
|
+
dismiss: _dismiss,
|
|
38
|
+
};
|
|
39
|
+
}
|
package/app/layouts/default.vue
CHANGED
|
@@ -79,12 +79,12 @@ const responsiveNavLinks = {
|
|
|
79
79
|
{ name: "Card Core", path: "/ui/card-core" },
|
|
80
80
|
{ name: "Glowing Border", path: "/ui/glowing-border" },
|
|
81
81
|
{ name: "Display Toast", path: "/ui/display-toast" },
|
|
82
|
+
{ name: "Prompts", path: "/ui/display-prompt" },
|
|
82
83
|
{ name: "Masked Alert", path: "/ui/mask-element" },
|
|
83
84
|
{ name: "Expanding Panel", path: "/ui/expanding-panel" },
|
|
84
85
|
{ name: "Dialogs", path: "/ui/display-dialog" },
|
|
85
86
|
{ name: "Tabs X", path: "/ui/tabs" },
|
|
86
87
|
{ name: "Tabs Y", path: "/ui/tabs-y" },
|
|
87
|
-
{ name: "Prompts", path: "/ui/display-prompt" },
|
|
88
88
|
{ name: "Rotating Carousel", path: "/ui/rotating-carousel" },
|
|
89
89
|
{ name: "Clipped Panels", path: "/ui/clipped-panels" },
|
|
90
90
|
{ name: "Display Chip", path: "/ui/display-chip" },
|