origam 2.23.2 → 2.25.0
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/CHANGELOG.md +52 -0
- package/dist/src/assets/css/main.css +1 -1
- package/dist/src/assets/css/tokens/dark.css +24 -22
- package/dist/src/assets/css/tokens/light.css +12 -11
- package/dist/src/assets/css/tokens/origam-utilities.css +84 -0
- package/dist/src/assets/css/tokens/primitive.css +1 -0
- package/dist/src/assets/scss/tokens/_dark.scss +24 -22
- package/dist/src/assets/scss/tokens/_light.scss +12 -11
- package/dist/src/assets/scss/tokens/_origam-utilities.scss +84 -0
- package/dist/src/assets/scss/tokens/_primitive.scss +1 -0
- package/dist/src/components/Btn/OrigamBtn.vue +89 -124
- package/dist/src/components/Field/OrigamField.vue +120 -152
- package/dist/src/components/Skeleton/OrigamSkeleton.vue +89 -125
- package/dist/src/components/Skeleton/OrigamSkeletonGroup.vue +52 -0
- package/dist/src/components/Skeleton/index.cjs +7 -0
- package/dist/src/components/Skeleton/index.d.ts +1 -0
- package/dist/src/components/Skeleton/index.js +1 -0
- package/dist/src/components/Switch/OrigamSwitch.vue +1 -69
- package/dist/src/consts/Skeleton/skeleton.const.cjs +7 -0
- package/dist/src/consts/Skeleton/skeleton.const.d.ts +11 -0
- package/dist/src/consts/Skeleton/skeleton.const.js +1 -0
- package/dist/src/consts/index.cjs +11 -0
- package/dist/src/consts/index.d.ts +1 -0
- package/dist/src/consts/index.js +1 -0
- package/dist/src/enums/Skeleton/skeleton.enum.cjs +9 -2
- package/dist/src/enums/Skeleton/skeleton.enum.d.ts +27 -4
- package/dist/src/enums/Skeleton/skeleton.enum.js +7 -0
- package/dist/src/interfaces/Btn/btn.interface.d.ts +3 -3
- package/dist/src/interfaces/Commons/loader.interface.d.ts +13 -1
- package/dist/src/interfaces/Field/field.interface.d.ts +2 -2
- package/dist/src/interfaces/Skeleton/skeleton-group.interface.cjs +1 -0
- package/dist/src/interfaces/Skeleton/skeleton-group.interface.d.ts +34 -0
- package/dist/src/interfaces/Skeleton/skeleton-group.interface.js +0 -0
- package/dist/src/interfaces/Skeleton/skeleton.interface.d.ts +27 -10
- package/dist/src/interfaces/Switch/switch.interface.d.ts +2 -2
- package/dist/src/interfaces/index.cjs +11 -0
- package/dist/src/interfaces/index.d.ts +1 -0
- package/dist/src/interfaces/index.js +1 -0
- package/dist/src/themes/origam.theme.cjs +2 -4
- package/dist/src/themes/origam.theme.js +2 -2
- package/dist/src/types/Commons/loader.type.d.ts +24 -0
- package/dist/src/types/Skeleton/skeleton.type.d.ts +4 -1
- package/dist/src/types/tokens.type.d.ts +1 -1
- package/package.json +1 -1
|
@@ -4,39 +4,51 @@
|
|
|
4
4
|
</template>
|
|
5
5
|
|
|
6
6
|
<div
|
|
7
|
-
v-else-if="
|
|
7
|
+
v-else-if="isListItem"
|
|
8
8
|
:id="id"
|
|
9
9
|
:class="skeletonContainerClasses"
|
|
10
10
|
:style="skeletonContainerStyles"
|
|
11
|
-
|
|
12
|
-
aria-busy="true"
|
|
13
|
-
role="status"
|
|
14
|
-
v-bind="{ ...$attrs }"
|
|
11
|
+
v-bind="{ ...a11yAttrs, ...$attrs }"
|
|
15
12
|
>
|
|
16
13
|
<div
|
|
17
14
|
:class="skeletonCircularClasses"
|
|
18
|
-
|
|
15
|
+
aria-hidden="true"
|
|
19
16
|
/>
|
|
20
17
|
<div class="origam-skeleton__lines">
|
|
21
|
-
<div
|
|
22
|
-
|
|
18
|
+
<div
|
|
19
|
+
:class="skeletonTextClasses"
|
|
20
|
+
aria-hidden="true"
|
|
21
|
+
/>
|
|
22
|
+
<div
|
|
23
|
+
:class="skeletonTextClasses"
|
|
24
|
+
aria-hidden="true"
|
|
25
|
+
/>
|
|
23
26
|
</div>
|
|
24
27
|
</div>
|
|
25
28
|
|
|
26
29
|
<div
|
|
27
|
-
v-else-if="
|
|
30
|
+
v-else-if="isCard"
|
|
28
31
|
:id="id"
|
|
29
32
|
:class="skeletonContainerClasses"
|
|
30
33
|
:style="skeletonContainerStyles"
|
|
31
|
-
|
|
32
|
-
aria-busy="true"
|
|
33
|
-
role="status"
|
|
34
|
-
v-bind="{ ...$attrs }"
|
|
34
|
+
v-bind="{ ...a11yAttrs, ...$attrs }"
|
|
35
35
|
>
|
|
36
|
-
<div
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
<div
|
|
37
|
+
:class="skeletonRectangularClasses"
|
|
38
|
+
aria-hidden="true"
|
|
39
|
+
/>
|
|
40
|
+
<div
|
|
41
|
+
:class="skeletonTextClasses"
|
|
42
|
+
aria-hidden="true"
|
|
43
|
+
/>
|
|
44
|
+
<div
|
|
45
|
+
:class="skeletonTextClasses"
|
|
46
|
+
aria-hidden="true"
|
|
47
|
+
/>
|
|
48
|
+
<div
|
|
49
|
+
:class="skeletonTextClasses"
|
|
50
|
+
aria-hidden="true"
|
|
51
|
+
/>
|
|
40
52
|
</div>
|
|
41
53
|
|
|
42
54
|
<div
|
|
@@ -44,29 +56,25 @@
|
|
|
44
56
|
:id="id"
|
|
45
57
|
:class="skeletonClasses"
|
|
46
58
|
:style="skeletonStyles"
|
|
47
|
-
|
|
48
|
-
aria-busy="true"
|
|
49
|
-
role="status"
|
|
50
|
-
v-bind="{ ...$attrs }"
|
|
59
|
+
v-bind="{ ...a11yAttrs, ...$attrs }"
|
|
51
60
|
/>
|
|
52
61
|
</template>
|
|
53
62
|
|
|
54
63
|
<script lang="ts" setup>
|
|
55
64
|
import { useBothColor } from "../../composables/Commons/bothColor.composable";
|
|
65
|
+
import { useDimension } from "../../composables/Commons/dimension.composable";
|
|
56
66
|
import { useLocale } from "../../composables/Commons/locale.composable";
|
|
57
67
|
import { useProps } from "../../composables/Commons/props.composable";
|
|
58
68
|
import { useRounded } from "../../composables/Commons/rounded.composable";
|
|
59
69
|
import { useSize } from "../../composables/Commons/size.composable";
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import { computed, toRef } from "vue";
|
|
70
|
+
import { ORIGAM_SKELETON_GROUP_KEY } from "../../consts/Skeleton/skeleton.const";
|
|
71
|
+
import { SKELETON_ANIMATION, SKELETON_VARIANT } from "../../enums/Skeleton/skeleton.enum";
|
|
72
|
+
import { computed, inject, toRef } from "vue";
|
|
63
73
|
defineOptions({ inheritAttrs: false });
|
|
64
74
|
const props = defineProps({
|
|
65
75
|
variant: { type: null, required: false, default: "rectangular" },
|
|
66
|
-
width: { type: [String, Number], required: false },
|
|
67
|
-
height: { type: [String, Number], required: false },
|
|
68
76
|
loading: { type: Boolean, required: false, default: true },
|
|
69
|
-
|
|
77
|
+
animation: { type: null, required: false },
|
|
70
78
|
label: { type: String, required: false, default: "origam.loading" },
|
|
71
79
|
id: { type: String, required: false },
|
|
72
80
|
class: { type: [String, Array, Object], required: false },
|
|
@@ -82,7 +90,13 @@ const props = defineProps({
|
|
|
82
90
|
roundedStartStart: { type: [Boolean, Number, String], required: false },
|
|
83
91
|
roundedStartEnd: { type: [Boolean, Number, String], required: false },
|
|
84
92
|
roundedEndStart: { type: [Boolean, Number, String], required: false },
|
|
85
|
-
roundedEndEnd: { type: [Boolean, Number, String], required: false }
|
|
93
|
+
roundedEndEnd: { type: [Boolean, Number, String], required: false },
|
|
94
|
+
height: { type: [Number, String], required: false },
|
|
95
|
+
maxHeight: { type: [Number, String], required: false },
|
|
96
|
+
maxWidth: { type: [Number, String], required: false },
|
|
97
|
+
minHeight: { type: [Number, String], required: false },
|
|
98
|
+
minWidth: { type: [Number, String], required: false },
|
|
99
|
+
width: { type: [Number, String], required: false }
|
|
86
100
|
});
|
|
87
101
|
const { filterProps } = useProps(props);
|
|
88
102
|
defineEmits([]);
|
|
@@ -90,40 +104,43 @@ defineSlots();
|
|
|
90
104
|
const { t } = useLocale();
|
|
91
105
|
const { roundedClasses, roundedStyles } = useRounded(props);
|
|
92
106
|
const { sizeClasses, sizeStyles } = useSize(props);
|
|
93
|
-
const
|
|
107
|
+
const { dimensionStyles } = useDimension(props);
|
|
94
108
|
const { colorClasses, colorStyles } = useBothColor(toRef(props, "bgColor"), toRef(props, "color"));
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
109
|
+
const group = inject(ORIGAM_SKELETON_GROUP_KEY, null);
|
|
110
|
+
const isGrouped = computed(() => group !== null);
|
|
111
|
+
const animation = computed(() => props.animation ?? group?.animation.value ?? SKELETON_ANIMATION.PULSE);
|
|
112
|
+
const skeletonAriaLabel = computed(() => t(props.label));
|
|
113
|
+
const a11yAttrs = computed(() => {
|
|
114
|
+
if (isGrouped.value) return { "aria-hidden": true };
|
|
115
|
+
return {
|
|
116
|
+
"role": "status",
|
|
117
|
+
"aria-busy": true,
|
|
118
|
+
"aria-label": skeletonAriaLabel.value
|
|
119
|
+
};
|
|
98
120
|
});
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
121
|
+
const isListItem = computed(() => props.variant === SKELETON_VARIANT.LIST_ITEM);
|
|
122
|
+
const isCard = computed(() => props.variant === SKELETON_VARIANT.CARD);
|
|
123
|
+
const animationClasses = computed(() => [
|
|
124
|
+
"origam--skeleton",
|
|
125
|
+
{
|
|
126
|
+
"origam--skeleton-wave": animation.value === SKELETON_ANIMATION.WAVE,
|
|
127
|
+
"origam--skeleton-none": animation.value === SKELETON_ANIMATION.NONE
|
|
102
128
|
}
|
|
103
|
-
|
|
104
|
-
return props.width != null ? convertToUnit(props.width) : void 0;
|
|
105
|
-
}
|
|
106
|
-
return props.height != null ? convertToUnit(props.height) : void 0;
|
|
107
|
-
});
|
|
108
|
-
const circularSize = computed(() => props.width != null ? convertToUnit(props.width) : "36px");
|
|
109
|
-
const circularStyle = computed(() => ({
|
|
110
|
-
width: circularSize.value,
|
|
111
|
-
height: circularSize.value
|
|
112
|
-
}));
|
|
129
|
+
]);
|
|
113
130
|
const skeletonCircularClasses = computed(() => [
|
|
114
131
|
"origam-skeleton",
|
|
115
|
-
|
|
116
|
-
|
|
132
|
+
"origam-skeleton--circular",
|
|
133
|
+
animationClasses.value
|
|
117
134
|
]);
|
|
118
135
|
const skeletonTextClasses = computed(() => [
|
|
119
136
|
"origam-skeleton",
|
|
120
|
-
|
|
121
|
-
|
|
137
|
+
"origam-skeleton--text",
|
|
138
|
+
animationClasses.value
|
|
122
139
|
]);
|
|
123
140
|
const skeletonRectangularClasses = computed(() => [
|
|
124
141
|
"origam-skeleton",
|
|
125
|
-
|
|
126
|
-
|
|
142
|
+
"origam-skeleton--rectangular",
|
|
143
|
+
animationClasses.value
|
|
127
144
|
]);
|
|
128
145
|
const skeletonContainerClasses = computed(() => [
|
|
129
146
|
"origam-skeleton-wrapper",
|
|
@@ -134,102 +151,53 @@ const skeletonContainerStyles = computed(() => [props.style]);
|
|
|
134
151
|
const skeletonClasses = computed(() => [
|
|
135
152
|
"origam-skeleton",
|
|
136
153
|
`origam-skeleton--${props.variant}`,
|
|
137
|
-
|
|
154
|
+
animationClasses.value,
|
|
138
155
|
colorClasses.value,
|
|
139
156
|
roundedClasses.value,
|
|
140
157
|
sizeClasses.value,
|
|
141
158
|
props.class
|
|
142
159
|
]);
|
|
143
|
-
const skeletonStyles = computed(() =>
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
160
|
+
const skeletonStyles = computed(() => [
|
|
161
|
+
dimensionStyles.value,
|
|
162
|
+
colorStyles.value,
|
|
163
|
+
roundedStyles.value,
|
|
164
|
+
sizeStyles.value,
|
|
165
|
+
props.style
|
|
166
|
+
]);
|
|
150
167
|
defineExpose({
|
|
151
|
-
filterProps
|
|
152
|
-
css,
|
|
153
|
-
id,
|
|
154
|
-
load,
|
|
155
|
-
unload,
|
|
156
|
-
isLoaded
|
|
168
|
+
filterProps
|
|
157
169
|
});
|
|
158
170
|
</script>
|
|
159
171
|
|
|
160
172
|
<style lang="scss" scoped>
|
|
161
|
-
@keyframes origam-skeleton-wave {
|
|
162
|
-
0% { background-position: -200% 0 }
|
|
163
|
-
100% { background-position: 200% 0 }
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
@keyframes origam-skeleton-spin {
|
|
167
|
-
from { transform: rotate(0deg) }
|
|
168
|
-
to { transform: rotate(360deg) }
|
|
169
|
-
}
|
|
170
|
-
|
|
171
173
|
.origam-skeleton {
|
|
172
174
|
display: block;
|
|
173
|
-
background-color: var(--origam-skeleton---background-color);
|
|
174
175
|
border-radius: var(--origam-skeleton---border-radius);
|
|
175
|
-
width: 100%;
|
|
176
|
-
height: var(--origam-skeleton---text-height);
|
|
177
176
|
|
|
178
177
|
&--text {
|
|
178
|
+
width: 100%;
|
|
179
179
|
height: var(--origam-skeleton---text-height);
|
|
180
|
-
|
|
180
|
+
margin-block: var(--origam-skeleton---text-margin-block);
|
|
181
|
+
border-radius: var(--origam-skeleton---border-radius-pill);
|
|
181
182
|
}
|
|
182
183
|
|
|
183
184
|
&--rectangular {
|
|
184
|
-
|
|
185
|
+
width: 100%;
|
|
185
186
|
height: 100%;
|
|
186
187
|
}
|
|
187
188
|
|
|
188
189
|
&--circular {
|
|
189
|
-
border-radius: var(--origam-skeleton---border-radius-circular, 50%);
|
|
190
190
|
flex-shrink: 0;
|
|
191
|
+
width: var(--origam-skeleton---circular-size);
|
|
192
|
+
aspect-ratio: 1;
|
|
193
|
+
border-radius: var(--origam-skeleton---border-radius-circular);
|
|
191
194
|
}
|
|
192
195
|
|
|
193
|
-
&--
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
&--text.origam-skeleton--pulse,
|
|
199
|
-
&--rectangular.origam-skeleton--pulse {
|
|
200
|
-
background-image: linear-gradient(
|
|
201
|
-
90deg,
|
|
202
|
-
transparent 0%,
|
|
203
|
-
var(
|
|
204
|
-
--origam-skeleton---wave-color,
|
|
205
|
-
color-mix(in srgb, var(--origam-skeleton---background-color) 50%, white)
|
|
206
|
-
) 50%,
|
|
207
|
-
transparent 100%
|
|
208
|
-
);
|
|
209
|
-
background-repeat: no-repeat;
|
|
210
|
-
background-size: 200% 100%;
|
|
211
|
-
animation: origam-skeleton-wave var(--origam-skeleton---animation-duration, 1500ms) linear infinite;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
&--circular.origam-skeleton--pulse {
|
|
215
|
-
background:
|
|
216
|
-
conic-gradient(
|
|
217
|
-
from 0deg,
|
|
218
|
-
transparent 0deg,
|
|
219
|
-
var(
|
|
220
|
-
--origam-skeleton---wave-color,
|
|
221
|
-
color-mix(in srgb, var(--origam-skeleton---background-color) 50%, white)
|
|
222
|
-
) 90deg,
|
|
223
|
-
var(--origam-skeleton---background-color) 270deg
|
|
224
|
-
);
|
|
225
|
-
animation: origam-skeleton-spin var(--origam-skeleton---animation-duration, 1500ms) linear infinite;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
@media (prefers-reduced-motion: reduce) {
|
|
230
|
-
.origam-skeleton--pulse {
|
|
231
|
-
animation: none;
|
|
232
|
-
background-image: none;
|
|
196
|
+
&--pill {
|
|
197
|
+
flex-shrink: 0;
|
|
198
|
+
width: var(--origam-skeleton---pill-width);
|
|
199
|
+
height: var(--origam-skeleton---pill-height);
|
|
200
|
+
border-radius: var(--origam-skeleton---border-radius-pill);
|
|
233
201
|
}
|
|
234
202
|
}
|
|
235
203
|
|
|
@@ -239,10 +207,6 @@ defineExpose({
|
|
|
239
207
|
gap: var(--origam-skeleton---gap, 12px);
|
|
240
208
|
align-items: center;
|
|
241
209
|
|
|
242
|
-
> .origam-skeleton--circular {
|
|
243
|
-
flex-shrink: 0;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
210
|
> .origam-skeleton__lines {
|
|
247
211
|
flex: 1;
|
|
248
212
|
display: flex;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:id="id"
|
|
4
|
+
:class="groupClasses"
|
|
5
|
+
:style="groupStyles"
|
|
6
|
+
role="status"
|
|
7
|
+
aria-busy="true"
|
|
8
|
+
:aria-label="groupAriaLabel"
|
|
9
|
+
v-bind="{ ...$attrs }"
|
|
10
|
+
>
|
|
11
|
+
<slot name="default"/>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script lang="ts" setup>
|
|
16
|
+
import { useLocale } from "../../composables/Commons/locale.composable";
|
|
17
|
+
import { useProps } from "../../composables/Commons/props.composable";
|
|
18
|
+
import { ORIGAM_SKELETON_GROUP_KEY } from "../../consts/Skeleton/skeleton.const";
|
|
19
|
+
import { SKELETON_ANIMATION } from "../../enums/Skeleton/skeleton.enum";
|
|
20
|
+
import { computed, provide } from "vue";
|
|
21
|
+
defineOptions({ inheritAttrs: false });
|
|
22
|
+
const props = defineProps({
|
|
23
|
+
animation: { type: null, required: false, default: "pulse" },
|
|
24
|
+
label: { type: String, required: false, default: "origam.loading" },
|
|
25
|
+
id: { type: String, required: false },
|
|
26
|
+
class: { type: [String, Array, Object], required: false },
|
|
27
|
+
style: { type: [String, Array, Object, Boolean, null], required: false, skipCheck: true }
|
|
28
|
+
});
|
|
29
|
+
const { filterProps } = useProps(props);
|
|
30
|
+
defineEmits([]);
|
|
31
|
+
defineSlots();
|
|
32
|
+
const { t } = useLocale();
|
|
33
|
+
const groupAriaLabel = computed(() => t(props.label));
|
|
34
|
+
const animation = computed(() => props.animation ?? SKELETON_ANIMATION.PULSE);
|
|
35
|
+
provide(ORIGAM_SKELETON_GROUP_KEY, { animation });
|
|
36
|
+
const groupClasses = computed(() => [
|
|
37
|
+
"origam-skeleton-group",
|
|
38
|
+
{ "origam--skeleton-group-pulse": animation.value === SKELETON_ANIMATION.PULSE },
|
|
39
|
+
props.class
|
|
40
|
+
]);
|
|
41
|
+
const groupStyles = computed(() => [props.style]);
|
|
42
|
+
defineExpose({
|
|
43
|
+
filterProps
|
|
44
|
+
});
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<style lang="scss" scoped>
|
|
48
|
+
.origam-skeleton-group {
|
|
49
|
+
display: grid;
|
|
50
|
+
gap: var(--origam-skeleton---gap);
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
@@ -9,5 +9,12 @@ Object.defineProperty(exports, "OrigamSkeleton", {
|
|
|
9
9
|
return _OrigamSkeleton.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "OrigamSkeletonGroup", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _OrigamSkeletonGroup.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
12
18
|
var _OrigamSkeleton = _interopRequireDefault(require("./OrigamSkeleton.vue"));
|
|
19
|
+
var _OrigamSkeletonGroup = _interopRequireDefault(require("./OrigamSkeletonGroup.vue"));
|
|
13
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
v-if="isSkeletonLoading"
|
|
4
|
-
class="origam-switch__skeleton"
|
|
5
|
-
:class="{ 'origam-switch__skeleton--inset': inset }"
|
|
6
|
-
aria-busy="true"
|
|
7
|
-
:aria-label="loadingLabel"
|
|
8
|
-
role="status"
|
|
9
|
-
data-cy="origam-switch-skeleton"
|
|
10
|
-
>
|
|
11
|
-
<span class="origam-switch__skeleton-track"/>
|
|
12
|
-
<span class="origam-switch__skeleton-thumb"/>
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
2
|
<origam-input
|
|
16
|
-
v-else
|
|
17
3
|
:id="id"
|
|
18
4
|
ref="origamInputRef"
|
|
19
5
|
v-model="model"
|
|
@@ -145,7 +131,6 @@ import OrigamSwitchTrack from "./OrigamSwitchTrack.vue";
|
|
|
145
131
|
import OrigamTranslateScale from "../Transition/OrigamTranslateScale.vue";
|
|
146
132
|
import { useFocus } from "../../composables/Commons/focus.composable";
|
|
147
133
|
import { useLoader } from "../../composables/Commons/loader.composable";
|
|
148
|
-
import { useLocale } from "../../composables/Commons/locale.composable";
|
|
149
134
|
import { useProps } from "../../composables/Commons/props.composable";
|
|
150
135
|
import { useRounded } from "../../composables/Commons/rounded.composable";
|
|
151
136
|
import { useStateEffect } from "../../composables/Commons/stateEffect.composable";
|
|
@@ -288,8 +273,6 @@ const { isFocused, onFocus: handleFocus, onBlur: handleBlur } = useFocus(props);
|
|
|
288
273
|
const attrs = useAttrs();
|
|
289
274
|
const slots = useSlots();
|
|
290
275
|
const { loaderClasses, loaderConfig } = useLoader(props, LOADER_KIND.CIRCULAR);
|
|
291
|
-
const { t } = useLocale();
|
|
292
|
-
const loadingLabel = computed(() => t("origam.loading"));
|
|
293
276
|
const uid = getUid();
|
|
294
277
|
const id = computed(() => {
|
|
295
278
|
return props.id || `switch-${uid}`;
|
|
@@ -316,16 +299,13 @@ const controlProps = computed(() => {
|
|
|
316
299
|
const trackProps = computed(() => {
|
|
317
300
|
return origamSwitchTrackRef.value?.filterProps(props, ["modelValue", "disabled", "readonly", "error", "inset", "isValid", "bgColor", "color", "class", "style", "id"]);
|
|
318
301
|
});
|
|
319
|
-
const isSkeletonLoading = computed(() => {
|
|
320
|
-
return loaderConfig.value.isActive && loaderConfig.value.kind === "skeleton";
|
|
321
|
-
});
|
|
322
302
|
const isLineLoading = computed(() => {
|
|
323
303
|
return loaderConfig.value.isActive && loaderConfig.value.kind === "line";
|
|
324
304
|
});
|
|
325
305
|
const hasCircularLoading = computed(() => {
|
|
326
306
|
if (slots.loader) return true;
|
|
327
307
|
const cfg = loaderConfig.value;
|
|
328
|
-
return cfg.isActive && cfg.kind !== "line"
|
|
308
|
+
return cfg.isActive && cfg.kind !== "line";
|
|
329
309
|
});
|
|
330
310
|
const switchStyles = computed(() => {
|
|
331
311
|
return [
|
|
@@ -368,54 +348,6 @@ defineExpose({
|
|
|
368
348
|
</script>
|
|
369
349
|
|
|
370
350
|
<style lang="scss" scoped>
|
|
371
|
-
@keyframes origam-switch-skeleton-pulse {
|
|
372
|
-
0%, 100% {
|
|
373
|
-
opacity: 1;
|
|
374
|
-
}
|
|
375
|
-
50% {
|
|
376
|
-
opacity: 0.55;
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
.origam-switch__skeleton {
|
|
381
|
-
position: relative;
|
|
382
|
-
display: inline-block;
|
|
383
|
-
width: var(--origam-switch__skeleton---width, 52px);
|
|
384
|
-
height: var(--origam-switch__skeleton---height, 32px);
|
|
385
|
-
animation: origam-switch-skeleton-pulse 1.6s ease-in-out infinite;
|
|
386
|
-
|
|
387
|
-
@media (prefers-reduced-motion: reduce) {
|
|
388
|
-
animation: none;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
.origam-switch__skeleton-track {
|
|
392
|
-
position: absolute;
|
|
393
|
-
inset: 0;
|
|
394
|
-
border-radius: 999px;
|
|
395
|
-
background-color: var(--origam-switch__skeleton-track---background-color, color-mix(in srgb, currentColor 14%, transparent));
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
.origam-switch__skeleton-thumb {
|
|
399
|
-
position: absolute;
|
|
400
|
-
top: 50%;
|
|
401
|
-
left: 6px;
|
|
402
|
-
width: 20px;
|
|
403
|
-
height: 20px;
|
|
404
|
-
border-radius: 50%;
|
|
405
|
-
transform: translateY(-50%);
|
|
406
|
-
background-color: var(--origam-switch__skeleton-thumb---background-color, color-mix(in srgb, currentColor 28%, transparent));
|
|
407
|
-
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
&--inset {
|
|
411
|
-
.origam-switch__skeleton-thumb {
|
|
412
|
-
width: 24px;
|
|
413
|
-
height: 24px;
|
|
414
|
-
left: 4px;
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
351
|
.origam-switch {
|
|
420
352
|
$this: &;
|
|
421
353
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { InjectionKey } from 'vue';
|
|
2
|
+
import type { ISkeletonGroupProvide } from '../../interfaces/Skeleton/skeleton-group.interface';
|
|
3
|
+
/*********************************************************
|
|
4
|
+
* ORIGAM_SKELETON_GROUP_KEY
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* Provided by `<OrigamSkeletonGroup>`; read by every `<OrigamSkeleton>` below
|
|
8
|
+
* it, which then follows the group's animation and stays out of the
|
|
9
|
+
* accessibility tree (the group announces the loading ONCE).
|
|
10
|
+
********************************************************/
|
|
11
|
+
export declare const ORIGAM_SKELETON_GROUP_KEY: InjectionKey<ISkeletonGroupProvide>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ORIGAM_SKELETON_GROUP_KEY = /* @__PURE__ */ Symbol.for("origam:skeleton-group");
|
|
@@ -696,6 +696,17 @@ Object.keys(_expansionPanel).forEach(function (key) {
|
|
|
696
696
|
}
|
|
697
697
|
});
|
|
698
698
|
});
|
|
699
|
+
var _skeleton = require("./Skeleton/skeleton.const.cjs");
|
|
700
|
+
Object.keys(_skeleton).forEach(function (key) {
|
|
701
|
+
if (key === "default" || key === "__esModule") return;
|
|
702
|
+
if (key in exports && exports[key] === _skeleton[key]) return;
|
|
703
|
+
Object.defineProperty(exports, key, {
|
|
704
|
+
enumerable: true,
|
|
705
|
+
get: function () {
|
|
706
|
+
return _skeleton[key];
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
});
|
|
699
710
|
var _dataTable = require("./DataTable/data-table.const.cjs");
|
|
700
711
|
Object.keys(_dataTable).forEach(function (key) {
|
|
701
712
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -61,6 +61,7 @@ export * from './TextField/text-field.const';
|
|
|
61
61
|
export * from './TextareaField/textarea-field.const';
|
|
62
62
|
export * from './EmptyState/empty-state.const';
|
|
63
63
|
export * from './ExpansionPanel/expansion-panel.const';
|
|
64
|
+
export * from './Skeleton/skeleton.const';
|
|
64
65
|
export * from './DataTable/data-table.const';
|
|
65
66
|
export * from './PasswordField/password-field.const';
|
|
66
67
|
export * from './Sheet/sheet.const';
|
package/dist/src/consts/index.js
CHANGED
|
@@ -61,6 +61,7 @@ export * from "./TextField/text-field.const.js";
|
|
|
61
61
|
export * from "./TextareaField/textarea-field.const.js";
|
|
62
62
|
export * from "./EmptyState/empty-state.const.js";
|
|
63
63
|
export * from "./ExpansionPanel/expansion-panel.const.js";
|
|
64
|
+
export * from "./Skeleton/skeleton.const.js";
|
|
64
65
|
export * from "./DataTable/data-table.const.js";
|
|
65
66
|
export * from "./PasswordField/password-field.const.js";
|
|
66
67
|
export * from "./Sheet/sheet.const.js";
|
|
@@ -3,12 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.SKELETON_VARIANT = void 0;
|
|
6
|
+
exports.SKELETON_VARIANT = exports.SKELETON_ANIMATION = void 0;
|
|
7
7
|
var SKELETON_VARIANT = exports.SKELETON_VARIANT = /* @__PURE__ */(SKELETON_VARIANT2 => {
|
|
8
8
|
SKELETON_VARIANT2["TEXT"] = "text";
|
|
9
9
|
SKELETON_VARIANT2["RECTANGULAR"] = "rectangular";
|
|
10
10
|
SKELETON_VARIANT2["CIRCULAR"] = "circular";
|
|
11
|
+
SKELETON_VARIANT2["PILL"] = "pill";
|
|
11
12
|
SKELETON_VARIANT2["CARD"] = "card";
|
|
12
13
|
SKELETON_VARIANT2["LIST_ITEM"] = "list-item";
|
|
13
14
|
return SKELETON_VARIANT2;
|
|
14
|
-
})(SKELETON_VARIANT || {});
|
|
15
|
+
})(SKELETON_VARIANT || {});
|
|
16
|
+
var SKELETON_ANIMATION = exports.SKELETON_ANIMATION = /* @__PURE__ */(SKELETON_ANIMATION2 => {
|
|
17
|
+
SKELETON_ANIMATION2["PULSE"] = "pulse";
|
|
18
|
+
SKELETON_ANIMATION2["WAVE"] = "wave";
|
|
19
|
+
SKELETON_ANIMATION2["NONE"] = "none";
|
|
20
|
+
return SKELETON_ANIMATION2;
|
|
21
|
+
})(SKELETON_ANIMATION || {});
|
|
@@ -1,11 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
|
|
1
|
+
/*********************************************************
|
|
2
|
+
* SKELETON_VARIANT
|
|
3
|
+
*
|
|
4
|
+
* @description
|
|
5
|
+
* Shape presets for `<OrigamSkeleton>`. `text`, `rectangular`, `circular`
|
|
6
|
+
* and `pill` are the PRIMITIVES — the bricks a component assembles to mimic
|
|
7
|
+
* its own anatomy. `card` and `list-item` are fixed composite templates kept
|
|
8
|
+
* until the components that consume them have moved to primitives.
|
|
9
|
+
********************************************************/
|
|
5
10
|
export declare enum SKELETON_VARIANT {
|
|
6
11
|
TEXT = "text",
|
|
7
12
|
RECTANGULAR = "rectangular",
|
|
8
13
|
CIRCULAR = "circular",
|
|
14
|
+
PILL = "pill",
|
|
9
15
|
CARD = "card",
|
|
10
16
|
LIST_ITEM = "list-item"
|
|
11
17
|
}
|
|
18
|
+
/*********************************************************
|
|
19
|
+
* SKELETON_ANIMATION
|
|
20
|
+
*
|
|
21
|
+
* @description
|
|
22
|
+
* How a placeholder moves while content is loading. `pulse` is the default:
|
|
23
|
+
* a calm opacity breath. `wave` adds a shimmer that sweeps across the block.
|
|
24
|
+
* `none` is static.
|
|
25
|
+
*
|
|
26
|
+
* @description
|
|
27
|
+
* There is deliberately no spin — a rotating placeholder reads as a spinner,
|
|
28
|
+
* which is `<OrigamLoader>`'s job.
|
|
29
|
+
********************************************************/
|
|
30
|
+
export declare enum SKELETON_ANIMATION {
|
|
31
|
+
PULSE = "pulse",
|
|
32
|
+
WAVE = "wave",
|
|
33
|
+
NONE = "none"
|
|
34
|
+
}
|
|
@@ -2,7 +2,14 @@ export var SKELETON_VARIANT = /* @__PURE__ */ ((SKELETON_VARIANT2) => {
|
|
|
2
2
|
SKELETON_VARIANT2["TEXT"] = "text";
|
|
3
3
|
SKELETON_VARIANT2["RECTANGULAR"] = "rectangular";
|
|
4
4
|
SKELETON_VARIANT2["CIRCULAR"] = "circular";
|
|
5
|
+
SKELETON_VARIANT2["PILL"] = "pill";
|
|
5
6
|
SKELETON_VARIANT2["CARD"] = "card";
|
|
6
7
|
SKELETON_VARIANT2["LIST_ITEM"] = "list-item";
|
|
7
8
|
return SKELETON_VARIANT2;
|
|
8
9
|
})(SKELETON_VARIANT || {});
|
|
10
|
+
export var SKELETON_ANIMATION = /* @__PURE__ */ ((SKELETON_ANIMATION2) => {
|
|
11
|
+
SKELETON_ANIMATION2["PULSE"] = "pulse";
|
|
12
|
+
SKELETON_ANIMATION2["WAVE"] = "wave";
|
|
13
|
+
SKELETON_ANIMATION2["NONE"] = "none";
|
|
14
|
+
return SKELETON_ANIMATION2;
|
|
15
|
+
})(SKELETON_ANIMATION || {});
|