origam 2.24.0 → 2.26.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 +44 -0
- package/dist/src/assets/css/main.css +1 -1
- package/dist/src/assets/css/tokens/dark.css +2 -16
- package/dist/src/assets/css/tokens/light.css +1 -8
- package/dist/src/assets/scss/tokens/_dark.scss +2 -16
- package/dist/src/assets/scss/tokens/_light.scss +1 -8
- package/dist/src/components/Btn/OrigamBtn.vue +89 -124
- package/dist/src/components/Card/OrigamCard.vue +80 -13
- package/dist/src/components/DataTable/OrigamDataTable.vue +26 -1
- package/dist/src/components/DataTable/OrigamDataTableRows.vue +58 -12
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanel.vue +4 -2
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelContent.vue +12 -3
- package/dist/src/components/Field/OrigamField.vue +120 -152
- package/dist/src/components/Skeleton/OrigamSkeleton.vue +2 -7
- package/dist/src/components/Switch/OrigamSwitch.vue +1 -69
- package/dist/src/enums/DataTable/data-table.enum.cjs +8 -2
- package/dist/src/enums/DataTable/data-table.enum.d.ts +16 -0
- package/dist/src/enums/DataTable/data-table.enum.js +6 -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.interface.d.ts +13 -0
- package/dist/src/interfaces/Switch/switch.interface.d.ts +2 -2
- package/dist/src/types/Commons/loader.type.d.ts +24 -0
- package/dist/src/types/tokens.type.d.ts +1 -1
- package/dist/src/utils/DataTable/skeleton-cell.util.cjs +13 -0
- package/dist/src/utils/DataTable/skeleton-cell.util.d.ts +12 -0
- package/dist/src/utils/DataTable/skeleton-cell.util.js +7 -0
- package/dist/src/utils/Skeleton/skeleton.util.cjs +30 -0
- package/dist/src/utils/Skeleton/skeleton.util.d.ts +33 -0
- package/dist/src/utils/Skeleton/skeleton.util.js +23 -0
- package/dist/src/utils/index.cjs +22 -0
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/index.js +2 -0
- package/package.json +1 -1
|
@@ -6,11 +6,17 @@
|
|
|
6
6
|
:style="dataTableStyles"
|
|
7
7
|
v-bind="tableProps"
|
|
8
8
|
:aria-rowcount="itemsLength"
|
|
9
|
+
:aria-busy="isSkeletonLoading || undefined"
|
|
9
10
|
>
|
|
10
11
|
<template
|
|
11
|
-
v-if="slots.top"
|
|
12
|
+
v-if="slots.top || isSkeletonLoading"
|
|
12
13
|
#top
|
|
13
14
|
>
|
|
15
|
+
<span
|
|
16
|
+
v-if="isSkeletonLoading"
|
|
17
|
+
class="origam-data-table__announcement"
|
|
18
|
+
role="status"
|
|
19
|
+
>{{ skeletonAnnouncement }}</span>
|
|
14
20
|
<slot name="top"/>
|
|
15
21
|
</template>
|
|
16
22
|
|
|
@@ -144,6 +150,7 @@ import { provideExpanded } from "../../composables/DataTable/expand.composable";
|
|
|
144
150
|
import { provideSelection } from "../../composables/DataTable/select.composable";
|
|
145
151
|
import { useDataTableItems } from "../../composables/DataTable/items.composable";
|
|
146
152
|
import { useFilter } from "../../composables/Commons/filters.composable";
|
|
153
|
+
import { useLocale } from "../../composables/Commons/locale.composable";
|
|
147
154
|
import { useGroupedItems } from "../../composables/DataTable/groupedItems.composable";
|
|
148
155
|
import { useOptions } from "../../composables/DataTable/options.composable";
|
|
149
156
|
import { usePaginatedItems } from "../../composables/DataTable/paginatedItems.composable";
|
|
@@ -155,7 +162,9 @@ import {
|
|
|
155
162
|
pickDataTableHeaderColumnSlotNames,
|
|
156
163
|
pickDataTableRowsSlotNames
|
|
157
164
|
} from "../../utils/DataTable/slot-name.util";
|
|
165
|
+
import { splitSkeletonOverrides } from "../../utils/Skeleton/skeleton.util";
|
|
158
166
|
import { DENSITY } from "../../enums/Commons/density.enum";
|
|
167
|
+
import { LOADER_KIND } from "../../enums/Commons/loader.enum";
|
|
159
168
|
import { MDI_ICONS } from "../../enums/Commons/mdi.enum";
|
|
160
169
|
import { computed, provide, Ref, ref, StyleValue, toRef, useAttrs, useSlots } from "vue";
|
|
161
170
|
const props = defineProps({
|
|
@@ -388,6 +397,16 @@ const slotProps = computed(() => {
|
|
|
388
397
|
const dataTableHeadersProps = computed(() => {
|
|
389
398
|
return origamDataTableHeadersRef.value?.filterProps(props);
|
|
390
399
|
});
|
|
400
|
+
const { t } = useLocale();
|
|
401
|
+
const skeletonConfig = computed(() => {
|
|
402
|
+
const loading = props.loading;
|
|
403
|
+
return typeof loading === "object" && loading !== null && loading.type === LOADER_KIND.SKELETON ? loading : null;
|
|
404
|
+
});
|
|
405
|
+
const isSkeletonLoading = computed(() => skeletonConfig.value !== null);
|
|
406
|
+
const skeletonAnnouncement = computed(() => {
|
|
407
|
+
const { group } = splitSkeletonOverrides(skeletonConfig.value, props.loadingText ?? "origam.data_iterator.loading_text");
|
|
408
|
+
return t(group.label ?? "");
|
|
409
|
+
});
|
|
391
410
|
const dataTableRowsProps = computed(() => {
|
|
392
411
|
return origamDataTableRowsRef.value?.filterProps(props, ["class", "style", "id", "items"]);
|
|
393
412
|
});
|
|
@@ -430,6 +449,12 @@ defineExpose({
|
|
|
430
449
|
</script>
|
|
431
450
|
|
|
432
451
|
<style lang="scss" scoped>
|
|
452
|
+
@use '../../assets/scss/helpers' as ds;
|
|
453
|
+
|
|
454
|
+
.origam-data-table__announcement {
|
|
455
|
+
@include ds.ds-visually-hidden;
|
|
456
|
+
}
|
|
457
|
+
|
|
433
458
|
.origam-data-table {
|
|
434
459
|
width: var(--origam-data-table---width, 100%);
|
|
435
460
|
background-color: var(--origam-data-table---background-color, var(--origam-color__surface---default));
|
|
@@ -6,15 +6,13 @@
|
|
|
6
6
|
:id="skeletonRowId(rowIndex)"
|
|
7
7
|
:key="`skeleton-row_${rowIndex}`"
|
|
8
8
|
class="origam-data-table-rows origam-data-table-rows--skeleton"
|
|
9
|
-
aria-
|
|
9
|
+
aria-hidden="true"
|
|
10
10
|
>
|
|
11
11
|
<td
|
|
12
|
-
v-for="
|
|
13
|
-
:key="
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<origam-skeleton variant="text" :loading="true" />
|
|
17
|
-
</td>
|
|
12
|
+
v-for="cell in skeletonCells"
|
|
13
|
+
:key="cell.key"
|
|
14
|
+
v-bind="cell.attrs"
|
|
15
|
+
/>
|
|
18
16
|
</tr>
|
|
19
17
|
</template>
|
|
20
18
|
<template v-else>
|
|
@@ -136,7 +134,6 @@
|
|
|
136
134
|
<script lang="ts" setup>
|
|
137
135
|
import OrigamDataTableGroupHeaderRow from "./OrigamDataTableGroupHeaderRow.vue";
|
|
138
136
|
import OrigamDataTableRow from "./OrigamDataTableRow.vue";
|
|
139
|
-
import OrigamSkeleton from "../Skeleton/OrigamSkeleton.vue";
|
|
140
137
|
import { useExpanded } from "../../composables/DataTable/expand.composable";
|
|
141
138
|
import { useGroupBy } from "../../composables/DataTable/group.composable";
|
|
142
139
|
import { useHeaders } from "../../composables/DataTable/headers.composable";
|
|
@@ -148,6 +145,8 @@ import { useSelection } from "../../composables/DataTable/select.composable";
|
|
|
148
145
|
import { useTextColor } from "../../composables/Commons/textColor.composable";
|
|
149
146
|
import { LOADER_KIND } from "../../enums/Commons/loader.enum";
|
|
150
147
|
import { getPrefixedEventHandlers } from "../../utils/Commons/event.util";
|
|
148
|
+
import { getSkeletonCellShape } from "../../utils/DataTable/skeleton-cell.util";
|
|
149
|
+
import { getSkeletonHostClasses, splitSkeletonOverrides } from "../../utils/Skeleton/skeleton.util";
|
|
151
150
|
import {
|
|
152
151
|
pickDataTableHeaderColumnSlotNames,
|
|
153
152
|
pickDataTableItemColumnSlotNames
|
|
@@ -182,6 +181,18 @@ const SKELETON_ROW_COUNT = 5;
|
|
|
182
181
|
const skeletonRowId = (index) => props.id ? `${props.id}-skeleton-row-${index}` : void 0;
|
|
183
182
|
const itemRowId = (index) => props.id ? `${props.id}-row-${index}` : void 0;
|
|
184
183
|
const { loaderConfig } = useLoader(props, LOADER_KIND.LINE);
|
|
184
|
+
const skeletonOverrides = computed(() => splitSkeletonOverrides(loaderConfig.value.overrides, props.loadingText));
|
|
185
|
+
const skeletonCells = computed(() => columns.value.map((col) => ({
|
|
186
|
+
key: `skeleton-cell_${col.key}`,
|
|
187
|
+
attrs: {
|
|
188
|
+
"aria-hidden": true,
|
|
189
|
+
class: [
|
|
190
|
+
"origam-data-table-rows__skeleton-cell",
|
|
191
|
+
`origam-data-table-rows__skeleton-cell--${getSkeletonCellShape(col)}`,
|
|
192
|
+
getSkeletonHostClasses(skeletonOverrides.value.group.animation)
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
})));
|
|
185
196
|
const { textColorClasses, textColorStyles } = useTextColor(props, "color");
|
|
186
197
|
const { columns } = useHeaders();
|
|
187
198
|
const { expandOnClick, toggleExpand, isExpanded } = useExpanded();
|
|
@@ -288,10 +299,45 @@ defineExpose({
|
|
|
288
299
|
color: var(--origam-data-table-rows--loading---color, var(--origam-color__text---secondary));
|
|
289
300
|
}
|
|
290
301
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// A placeholder cell is its own host (`.origam--skeleton`, which paints
|
|
305
|
+
// `::after` over the whole cell). It has no content, so it gets the
|
|
306
|
+
// height a real one-line row has, and its `::after` is narrowed to the
|
|
307
|
+
// bar the column would hold. Several rules compete for the `::after`
|
|
308
|
+
// box, so they all live under the same selector and the same `inset`.
|
|
309
|
+
.origam-data-table-rows__skeleton-cell {
|
|
310
|
+
block-size: calc(2 * var(--origam-table__cell---padding-block, 12px) + 1.5em);
|
|
311
|
+
|
|
312
|
+
&::after {
|
|
313
|
+
inset-block: auto;
|
|
314
|
+
inset-block-start: 50%;
|
|
315
|
+
inset-inline: auto;
|
|
316
|
+
inset-inline-start: var(--origam-table__cell---padding-inline, 16px);
|
|
317
|
+
block-size: var(--origam-skeleton---text-height);
|
|
318
|
+
inline-size: 70%;
|
|
319
|
+
translate: 0 -50%;
|
|
320
|
+
border-radius: var(--origam-skeleton---border-radius-pill);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
&--end::after {
|
|
324
|
+
inset-inline-start: auto;
|
|
325
|
+
inset-inline-end: var(--origam-table__cell---padding-inline, 16px);
|
|
326
|
+
inline-size: 40%;
|
|
295
327
|
}
|
|
328
|
+
|
|
329
|
+
&--control::after {
|
|
330
|
+
block-size: var(--origam-skeleton---circular-size);
|
|
331
|
+
inline-size: var(--origam-skeleton---circular-size);
|
|
332
|
+
border-radius: var(--origam-skeleton---border-radius);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
tr:nth-child(2n) > .origam-data-table-rows__skeleton-cell--text::after {
|
|
337
|
+
inline-size: 52%;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
tr:nth-child(3n) > .origam-data-table-rows__skeleton-cell--text::after {
|
|
341
|
+
inline-size: 84%;
|
|
296
342
|
}
|
|
297
343
|
</style>
|
|
@@ -13,9 +13,11 @@
|
|
|
13
13
|
|
|
14
14
|
<template v-if="hasLoading">
|
|
15
15
|
<slot name="loader">
|
|
16
|
-
<div
|
|
16
|
+
<div
|
|
17
|
+
v-if="loaderConfig.kind !== 'skeleton'"
|
|
18
|
+
class="origam-expansion-panel__loader"
|
|
19
|
+
>
|
|
17
20
|
<origam-progress
|
|
18
|
-
v-if="loaderConfig.kind !== 'skeleton'"
|
|
19
21
|
:active="true"
|
|
20
22
|
:indeterminate="loaderConfig.indeterminate"
|
|
21
23
|
:model-value="loaderConfig.modelValue"
|
|
@@ -13,9 +13,11 @@
|
|
|
13
13
|
<div class="origam-expansion-panel-content__wrapper">
|
|
14
14
|
<template v-if="loaderConfig.isActive && loaderConfig.kind === 'skeleton'">
|
|
15
15
|
<slot name="loader">
|
|
16
|
-
<origam-skeleton
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
<origam-skeleton-group v-bind="skeletonOverrides.group">
|
|
17
|
+
<origam-skeleton variant="text" v-bind="skeletonOverrides.block"/>
|
|
18
|
+
<origam-skeleton variant="text" v-bind="skeletonOverrides.block"/>
|
|
19
|
+
<origam-skeleton variant="text" class="origam-expansion-panel-content__skeleton-line--last" v-bind="skeletonOverrides.block"/>
|
|
20
|
+
</origam-skeleton-group>
|
|
19
21
|
</slot>
|
|
20
22
|
</template>
|
|
21
23
|
|
|
@@ -57,6 +59,7 @@ import { computed, inject, StyleValue, toRef, watchEffect } from "vue";
|
|
|
57
59
|
import OrigamExpandY from "../Transition/OrigamExpandY.vue";
|
|
58
60
|
import OrigamProgress from "../Progress/OrigamProgress.vue";
|
|
59
61
|
import OrigamSkeleton from "../Skeleton/OrigamSkeleton.vue";
|
|
62
|
+
import OrigamSkeletonGroup from "../Skeleton/OrigamSkeletonGroup.vue";
|
|
60
63
|
import vContrast from "../../directives/Contrast/contrast.directive";
|
|
61
64
|
import { useBorder } from "../../composables/Commons/border.composable";
|
|
62
65
|
import { useBothColor } from "../../composables/Commons/bothColor.composable";
|
|
@@ -69,6 +72,7 @@ import { useProps } from "../../composables/Commons/props.composable";
|
|
|
69
72
|
import { useRounded } from "../../composables/Commons/rounded.composable";
|
|
70
73
|
import { useStyle } from "../../composables/Commons/style.composable";
|
|
71
74
|
import { LOADER_KIND } from "../../enums/Commons/loader.enum";
|
|
75
|
+
import { splitSkeletonOverrides } from "../../utils/Skeleton/skeleton.util";
|
|
72
76
|
import { PROGRESS_TYPE } from "../../enums/Progress/progress.enum";
|
|
73
77
|
import { ORIGAM_EXPANSION_PANEL_KEY } from "../../consts/ExpansionPanel/expansion-panel.const";
|
|
74
78
|
const props = defineProps({
|
|
@@ -153,6 +157,7 @@ const isComponent = computed(() => {
|
|
|
153
157
|
return typeof props.content !== "string";
|
|
154
158
|
});
|
|
155
159
|
const { loaderClasses, loaderConfig } = useLoader(props, LOADER_KIND.LINE);
|
|
160
|
+
const skeletonOverrides = computed(() => splitSkeletonOverrides(loaderConfig.value.overrides, props.loadingText));
|
|
156
161
|
const { borderClasses, borderStyles } = useBorder(props);
|
|
157
162
|
const { paddingClasses, paddingStyles } = usePadding(props);
|
|
158
163
|
const { marginClasses, marginStyles } = useMargin(props);
|
|
@@ -211,5 +216,9 @@ defineExpose({
|
|
|
211
216
|
flex: var(--origam-expansion-panel__content---flex, 1 1 auto);
|
|
212
217
|
max-width: var(--origam-expansion-panel__content---max-width, 100%);
|
|
213
218
|
}
|
|
219
|
+
|
|
220
|
+
&__skeleton-line--last.origam-skeleton {
|
|
221
|
+
width: 60%;
|
|
222
|
+
}
|
|
214
223
|
}
|
|
215
224
|
</style>
|
|
@@ -9,16 +9,7 @@
|
|
|
9
9
|
>
|
|
10
10
|
<div class="origam-field__overlay"/>
|
|
11
11
|
|
|
12
|
-
<template v-if="
|
|
13
|
-
<origam-skeleton
|
|
14
|
-
class="origam-field__skeleton"
|
|
15
|
-
variant="rectangular"
|
|
16
|
-
:loading="true"
|
|
17
|
-
v-bind="loaderConfig.overrides"
|
|
18
|
-
/>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<template v-if="hasLoader && loaderConfig.kind !== 'skeleton'">
|
|
12
|
+
<template v-if="hasLoader">
|
|
22
13
|
<slot name="loader">
|
|
23
14
|
<div class="origam-field__loader">
|
|
24
15
|
<origam-progress
|
|
@@ -35,138 +26,136 @@
|
|
|
35
26
|
</slot>
|
|
36
27
|
</template>
|
|
37
28
|
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
>
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
29
|
+
<div
|
|
30
|
+
v-if="hasPrependInner"
|
|
31
|
+
key="prependInner"
|
|
32
|
+
class="origam-field__prepend-inner"
|
|
33
|
+
v-bind="prependInnerCommandAttrs"
|
|
34
|
+
@click="handleClickPrependInner"
|
|
35
|
+
@keydown="handleKeydownPrependInner"
|
|
36
|
+
>
|
|
37
|
+
<slot name="prependInner">
|
|
38
|
+
<origam-avatar
|
|
39
|
+
v-if="prependInnerAvatar"
|
|
40
|
+
key="prepend-avatar"
|
|
41
|
+
:density="density"
|
|
42
|
+
:image="prependInnerAvatar"
|
|
43
|
+
/>
|
|
44
|
+
<origam-icon
|
|
45
|
+
v-if="prependInnerIcon"
|
|
46
|
+
key="prepend-icon"
|
|
47
|
+
:density="density"
|
|
48
|
+
:icon="prependInnerIcon"
|
|
49
|
+
/>
|
|
50
|
+
</slot>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<div
|
|
54
|
+
class="origam-field__field"
|
|
55
|
+
data-no-activator=""
|
|
56
|
+
>
|
|
57
|
+
<template v-if="hasLabel">
|
|
58
|
+
<slot
|
|
59
|
+
name="label"
|
|
60
|
+
v-bind="labelProps"
|
|
61
|
+
>
|
|
62
|
+
<origam-label
|
|
63
|
+
v-bind="labelProps"
|
|
64
|
+
ref="origamLabelRef"
|
|
59
65
|
/>
|
|
60
66
|
</slot>
|
|
61
|
-
</
|
|
67
|
+
</template>
|
|
62
68
|
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
<span
|
|
70
|
+
v-if="hasPrefix"
|
|
71
|
+
class="origam-field__prefix"
|
|
66
72
|
>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
<span
|
|
80
|
-
v-if="hasPrefix"
|
|
81
|
-
class="origam-field__prefix"
|
|
82
|
-
>
|
|
83
|
-
<slot name="prefix">
|
|
84
|
-
<span>
|
|
85
|
-
{{ prefix }}
|
|
86
|
-
</span>
|
|
87
|
-
</slot>
|
|
88
|
-
</span>
|
|
89
|
-
|
|
90
|
-
<slot
|
|
91
|
-
name="default"
|
|
92
|
-
v-bind="slotProps"
|
|
93
|
-
/>
|
|
94
|
-
|
|
95
|
-
<span
|
|
96
|
-
v-if="hasSuffix"
|
|
97
|
-
class="origam-field__suffix"
|
|
98
|
-
>
|
|
99
|
-
<slot name="suffix">
|
|
100
|
-
<span>
|
|
101
|
-
{{ suffix }}
|
|
102
|
-
</span>
|
|
103
|
-
</slot>
|
|
104
|
-
</span>
|
|
105
|
-
</div>
|
|
73
|
+
<slot name="prefix">
|
|
74
|
+
<span>
|
|
75
|
+
{{ prefix }}
|
|
76
|
+
</span>
|
|
77
|
+
</slot>
|
|
78
|
+
</span>
|
|
79
|
+
|
|
80
|
+
<slot
|
|
81
|
+
name="default"
|
|
82
|
+
v-bind="slotProps"
|
|
83
|
+
/>
|
|
106
84
|
|
|
107
|
-
<
|
|
108
|
-
v-if="
|
|
109
|
-
|
|
85
|
+
<span
|
|
86
|
+
v-if="hasSuffix"
|
|
87
|
+
class="origam-field__suffix"
|
|
110
88
|
>
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
@click="handleClickAppendInner"
|
|
133
|
-
@keydown="handleKeydownAppendInner"
|
|
89
|
+
<slot name="suffix">
|
|
90
|
+
<span>
|
|
91
|
+
{{ suffix }}
|
|
92
|
+
</span>
|
|
93
|
+
</slot>
|
|
94
|
+
</span>
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
<origam-expand-x
|
|
98
|
+
v-if="hasClear"
|
|
99
|
+
key="clear"
|
|
100
|
+
>
|
|
101
|
+
<button
|
|
102
|
+
v-show="dirty"
|
|
103
|
+
type="button"
|
|
104
|
+
class="origam-field__clearable"
|
|
105
|
+
:aria-label="clearLabel"
|
|
106
|
+
@blur="handleBlur"
|
|
107
|
+
@focus="handleFocus"
|
|
108
|
+
@mousedown="handleMousedownClear"
|
|
109
|
+
@keydown="handleKeydownClear"
|
|
134
110
|
>
|
|
135
|
-
<slot name="
|
|
136
|
-
<origam-
|
|
137
|
-
v-if="appendInnerAvatar"
|
|
138
|
-
key="append-avatar"
|
|
139
|
-
:density="density"
|
|
140
|
-
:image="appendInnerAvatar"
|
|
141
|
-
/>
|
|
142
|
-
<origam-icon
|
|
143
|
-
v-if="appendInnerIcon"
|
|
144
|
-
key="append-icon"
|
|
145
|
-
:density="density"
|
|
146
|
-
:icon="appendInnerIcon"
|
|
147
|
-
/>
|
|
111
|
+
<slot name="clear">
|
|
112
|
+
<origam-icon :icon="clearIcon"/>
|
|
148
113
|
</slot>
|
|
149
|
-
</
|
|
114
|
+
</button>
|
|
115
|
+
</origam-expand-x>
|
|
116
|
+
|
|
117
|
+
<div
|
|
118
|
+
v-if="hasAppendInner"
|
|
119
|
+
key="appendInner"
|
|
120
|
+
class="origam-field__append-inner"
|
|
121
|
+
v-bind="appendInnerCommandAttrs"
|
|
122
|
+
@click="handleClickAppendInner"
|
|
123
|
+
@keydown="handleKeydownAppendInner"
|
|
124
|
+
>
|
|
125
|
+
<slot name="appendInner">
|
|
126
|
+
<origam-avatar
|
|
127
|
+
v-if="appendInnerAvatar"
|
|
128
|
+
key="append-avatar"
|
|
129
|
+
:density="density"
|
|
130
|
+
:image="appendInnerAvatar"
|
|
131
|
+
/>
|
|
132
|
+
<origam-icon
|
|
133
|
+
v-if="appendInnerIcon"
|
|
134
|
+
key="append-icon"
|
|
135
|
+
:density="density"
|
|
136
|
+
:icon="appendInnerIcon"
|
|
137
|
+
/>
|
|
138
|
+
</slot>
|
|
139
|
+
</div>
|
|
150
140
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
141
|
+
<div class="origam-field__outlines">
|
|
142
|
+
<div class="origam-field__outline origam-field__outline--start"/>
|
|
143
|
+
<div class="origam-field__outline origam-field__outline--notch">
|
|
144
|
+
<template v-if="hasFloatingLabel">
|
|
145
|
+
<slot
|
|
146
|
+
name="floatingLabel"
|
|
147
|
+
v-bind="floatingLabelProps"
|
|
148
|
+
>
|
|
149
|
+
<origam-label
|
|
150
|
+
key="floating-label"
|
|
157
151
|
v-bind="floatingLabelProps"
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
ref="origamFloatingLabelRef"
|
|
163
|
-
/>
|
|
164
|
-
</slot>
|
|
165
|
-
</template>
|
|
166
|
-
</div>
|
|
167
|
-
<div class="origam-field__outline origam-field__outline--end"/>
|
|
152
|
+
ref="origamFloatingLabelRef"
|
|
153
|
+
/>
|
|
154
|
+
</slot>
|
|
155
|
+
</template>
|
|
168
156
|
</div>
|
|
169
|
-
|
|
157
|
+
<div class="origam-field__outline origam-field__outline--end"/>
|
|
158
|
+
</div>
|
|
170
159
|
|
|
171
160
|
</div>
|
|
172
161
|
</template>
|
|
@@ -178,7 +167,6 @@ import OrigamExpandX from "../Transition/OrigamExpandX.vue";
|
|
|
178
167
|
import OrigamIcon from "../Icon/OrigamIcon.vue";
|
|
179
168
|
import OrigamLabel from "../Label/OrigamLabel.vue";
|
|
180
169
|
import OrigamProgress from "../Progress/OrigamProgress.vue";
|
|
181
|
-
import OrigamSkeleton from "../Skeleton/OrigamSkeleton.vue";
|
|
182
170
|
import { useAdjacentInner } from "../../composables/Commons/adjacentInner.composable";
|
|
183
171
|
import { useBorder } from "../../composables/Commons/border.composable";
|
|
184
172
|
import { useBothColor } from "../../composables/Commons/bothColor.composable";
|
|
@@ -659,26 +647,6 @@ defineExpose({
|
|
|
659
647
|
backdrop-filter: var(--origam-field---backdrop-filter, none);
|
|
660
648
|
-webkit-backdrop-filter: var(--origam-field---backdrop-filter, none);
|
|
661
649
|
|
|
662
|
-
&__skeleton {
|
|
663
|
-
width: 100%;
|
|
664
|
-
/*
|
|
665
|
-
* ⛔ #595 — FAUX POSITIF de `token-var-channels`, a laisser en
|
|
666
|
-
* baseline. Le repli est `var(--origam-input__control---height, 36px)`,
|
|
667
|
-
* et ce token-la est ECRIT PAR INSTANCE : les quatre modificateurs
|
|
668
|
-
* de taille de ce composant (~l.1532-1550) comme ceux d `OrigamInput`
|
|
669
|
-
* et d `OrigamTextareaField` le posent sur l element
|
|
670
|
-
* (`sm`=28 / `md`=36 / `lg`=44 / `xl`=52px). Declarer
|
|
671
|
-
* `--origam-field__skeleton---min-height` a `:root` avec ce repli
|
|
672
|
-
* substituerait la valeur RACINE (36px) une fois pour toutes : le
|
|
673
|
-
* squelette cesserait de suivre la taille du champ. Meme piege que
|
|
674
|
-
* `---hover-x` sur SliderField.
|
|
675
|
-
*/
|
|
676
|
-
min-height: var(--origam-field__skeleton---min-height, var(--origam-input__control---height, 36px));
|
|
677
|
-
border-radius: var(--origam-field---border-radius, 8px);
|
|
678
|
-
grid-column: 1 / -1;
|
|
679
|
-
grid-row: 1;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
650
|
&__loader {
|
|
683
651
|
position: absolute;
|
|
684
652
|
bottom: 0;
|
|
@@ -69,6 +69,7 @@ import { useRounded } from "../../composables/Commons/rounded.composable";
|
|
|
69
69
|
import { useSize } from "../../composables/Commons/size.composable";
|
|
70
70
|
import { ORIGAM_SKELETON_GROUP_KEY } from "../../consts/Skeleton/skeleton.const";
|
|
71
71
|
import { SKELETON_ANIMATION, SKELETON_VARIANT } from "../../enums/Skeleton/skeleton.enum";
|
|
72
|
+
import { getSkeletonHostClasses } from "../../utils/Skeleton/skeleton.util";
|
|
72
73
|
import { computed, inject, toRef } from "vue";
|
|
73
74
|
defineOptions({ inheritAttrs: false });
|
|
74
75
|
const props = defineProps({
|
|
@@ -120,13 +121,7 @@ const a11yAttrs = computed(() => {
|
|
|
120
121
|
});
|
|
121
122
|
const isListItem = computed(() => props.variant === SKELETON_VARIANT.LIST_ITEM);
|
|
122
123
|
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
|
|
128
|
-
}
|
|
129
|
-
]);
|
|
124
|
+
const animationClasses = computed(() => getSkeletonHostClasses(animation.value));
|
|
130
125
|
const skeletonCircularClasses = computed(() => [
|
|
131
126
|
"origam-skeleton",
|
|
132
127
|
"origam-skeleton--circular",
|
|
@@ -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
|
|