origam 2.24.0 → 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.
@@ -331,8 +331,6 @@
331
331
  --origam-btn---overlay-opacity-hover: var(--origam-opacity---12);
332
332
  --origam-btn---overlay-opacity-active: 0.2;
333
333
  --origam-btn---overlay-opacity-active-hover: 0.28;
334
- --origam-btn--loader-skeleton---min-width: 96px;
335
- --origam-btn--loader-skeleton---min-height: 36px;
336
334
  --origam-btn__progress---linear-height: 3px;
337
335
  --origam-btn__progress---linear-position: 0px;
338
336
  --origam-btn__progress---linear-position-top: auto;
@@ -2303,10 +2301,6 @@
2303
2301
  --origam-switch__thumb---border-color: rgba(0, 0, 0, 0.18);
2304
2302
  --origam-switch__thumb---color: currentColor;
2305
2303
  --origam-switch__selection-control---min-height: 56px;
2306
- --origam-switch__skeleton---width: 52px;
2307
- --origam-switch__skeleton---height: 32px;
2308
- --origam-switch__skeleton-track---background-color: color-mix(in srgb, currentColor 14%, transparent);
2309
- --origam-switch__skeleton-thumb---background-color: color-mix(in srgb, currentColor 28%, transparent);
2310
2304
  --origam-switch__track--inset---height: 32px;
2311
2305
  --origam-switch__track--inset---width: 52px;
2312
2306
  --origam-switch---opacity-disabled: var(--origam-opacity---32);
@@ -3351,8 +3345,6 @@
3351
3345
  --origam-btn---overlay-opacity-hover: var(--origam-opacity---12);
3352
3346
  --origam-btn---overlay-opacity-active: 0.2;
3353
3347
  --origam-btn---overlay-opacity-active-hover: 0.28;
3354
- --origam-btn--loader-skeleton---min-width: 96px;
3355
- --origam-btn--loader-skeleton---min-height: 36px;
3356
3348
  --origam-btn__progress---linear-height: 3px;
3357
3349
  --origam-btn__progress---linear-position: 0px;
3358
3350
  --origam-btn__progress---linear-position-top: auto;
@@ -5322,10 +5314,6 @@
5322
5314
  --origam-switch__thumb---border-color: rgba(0, 0, 0, 0.18);
5323
5315
  --origam-switch__thumb---color: currentColor;
5324
5316
  --origam-switch__selection-control---min-height: 56px;
5325
- --origam-switch__skeleton---width: 52px;
5326
- --origam-switch__skeleton---height: 32px;
5327
- --origam-switch__skeleton-track---background-color: color-mix(in srgb, currentColor 14%, transparent);
5328
- --origam-switch__skeleton-thumb---background-color: color-mix(in srgb, currentColor 28%, transparent);
5329
5317
  --origam-switch__track--inset---height: 32px;
5330
5318
  --origam-switch__track--inset---width: 52px;
5331
5319
  --origam-switch---opacity-disabled: var(--origam-opacity---32);
@@ -231,8 +231,6 @@
231
231
  --origam-btn---overlay-opacity-hover: var(--origam-opacity---12);
232
232
  --origam-btn---overlay-opacity-active: 0.2;
233
233
  --origam-btn---overlay-opacity-active-hover: 0.28;
234
- --origam-btn--loader-skeleton---min-width: 96px;
235
- --origam-btn--loader-skeleton---min-height: 36px;
236
234
  --origam-btn__progress---linear-height: 3px;
237
235
  --origam-btn__progress---linear-position: 0px;
238
236
  --origam-btn__progress---linear-position-top: auto;
@@ -2217,10 +2215,6 @@
2217
2215
  --origam-switch__thumb---border-color: rgba(0, 0, 0, 0.18);
2218
2216
  --origam-switch__thumb---color: currentColor;
2219
2217
  --origam-switch__selection-control---min-height: 56px;
2220
- --origam-switch__skeleton---width: 52px;
2221
- --origam-switch__skeleton---height: 32px;
2222
- --origam-switch__skeleton-track---background-color: color-mix(in srgb, currentColor 14%, transparent);
2223
- --origam-switch__skeleton-thumb---background-color: color-mix(in srgb, currentColor 28%, transparent);
2224
2218
  --origam-switch__track--inset---height: 32px;
2225
2219
  --origam-switch__track--inset---width: 52px;
2226
2220
  --origam-switch---opacity-disabled: var(--origam-opacity---32);
@@ -331,8 +331,6 @@
331
331
  --origam-btn---overlay-opacity-hover: var(--origam-opacity---12);
332
332
  --origam-btn---overlay-opacity-active: 0.2;
333
333
  --origam-btn---overlay-opacity-active-hover: 0.28;
334
- --origam-btn--loader-skeleton---min-width: 96px;
335
- --origam-btn--loader-skeleton---min-height: 36px;
336
334
  --origam-btn__progress---linear-height: 3px;
337
335
  --origam-btn__progress---linear-position: 0px;
338
336
  --origam-btn__progress---linear-position-top: auto;
@@ -2303,10 +2301,6 @@
2303
2301
  --origam-switch__thumb---border-color: rgba(0, 0, 0, 0.18);
2304
2302
  --origam-switch__thumb---color: currentColor;
2305
2303
  --origam-switch__selection-control---min-height: 56px;
2306
- --origam-switch__skeleton---width: 52px;
2307
- --origam-switch__skeleton---height: 32px;
2308
- --origam-switch__skeleton-track---background-color: color-mix(in srgb, currentColor 14%, transparent);
2309
- --origam-switch__skeleton-thumb---background-color: color-mix(in srgb, currentColor 28%, transparent);
2310
2304
  --origam-switch__track--inset---height: 32px;
2311
2305
  --origam-switch__track--inset---width: 52px;
2312
2306
  --origam-switch---opacity-disabled: var(--origam-opacity---32);
@@ -3351,8 +3345,6 @@
3351
3345
  --origam-btn---overlay-opacity-hover: var(--origam-opacity---12);
3352
3346
  --origam-btn---overlay-opacity-active: 0.2;
3353
3347
  --origam-btn---overlay-opacity-active-hover: 0.28;
3354
- --origam-btn--loader-skeleton---min-width: 96px;
3355
- --origam-btn--loader-skeleton---min-height: 36px;
3356
3348
  --origam-btn__progress---linear-height: 3px;
3357
3349
  --origam-btn__progress---linear-position: 0px;
3358
3350
  --origam-btn__progress---linear-position-top: auto;
@@ -5322,10 +5314,6 @@
5322
5314
  --origam-switch__thumb---border-color: rgba(0, 0, 0, 0.18);
5323
5315
  --origam-switch__thumb---color: currentColor;
5324
5316
  --origam-switch__selection-control---min-height: 56px;
5325
- --origam-switch__skeleton---width: 52px;
5326
- --origam-switch__skeleton---height: 32px;
5327
- --origam-switch__skeleton-track---background-color: color-mix(in srgb, currentColor 14%, transparent);
5328
- --origam-switch__skeleton-thumb---background-color: color-mix(in srgb, currentColor 28%, transparent);
5329
5317
  --origam-switch__track--inset---height: 32px;
5330
5318
  --origam-switch__track--inset---width: 52px;
5331
5319
  --origam-switch---opacity-disabled: var(--origam-opacity---32);
@@ -231,8 +231,6 @@
231
231
  --origam-btn---overlay-opacity-hover: var(--origam-opacity---12);
232
232
  --origam-btn---overlay-opacity-active: 0.2;
233
233
  --origam-btn---overlay-opacity-active-hover: 0.28;
234
- --origam-btn--loader-skeleton---min-width: 96px;
235
- --origam-btn--loader-skeleton---min-height: 36px;
236
234
  --origam-btn__progress---linear-height: 3px;
237
235
  --origam-btn__progress---linear-position: 0px;
238
236
  --origam-btn__progress---linear-position-top: auto;
@@ -2217,10 +2215,6 @@
2217
2215
  --origam-switch__thumb---border-color: rgba(0, 0, 0, 0.18);
2218
2216
  --origam-switch__thumb---color: currentColor;
2219
2217
  --origam-switch__selection-control---min-height: 56px;
2220
- --origam-switch__skeleton---width: 52px;
2221
- --origam-switch__skeleton---height: 32px;
2222
- --origam-switch__skeleton-track---background-color: color-mix(in srgb, currentColor 14%, transparent);
2223
- --origam-switch__skeleton-thumb---background-color: color-mix(in srgb, currentColor 28%, transparent);
2224
2218
  --origam-switch__track--inset---height: 32px;
2225
2219
  --origam-switch__track--inset---width: 52px;
2226
2220
  --origam-switch---opacity-disabled: var(--origam-opacity---32);
@@ -12,6 +12,7 @@
12
12
  :href="hrefAttr"
13
13
  :type="typeAttr"
14
14
  :value="valueAttr"
15
+ @click.capture="handleClickCapture"
15
16
  @click="handleClick"
16
17
  @mouseenter="handleMouseenter"
17
18
  @mouseleave="handleMouseleave"
@@ -25,99 +26,84 @@
25
26
  class="origam-btn__underlay"
26
27
  />
27
28
 
28
- <origam-progress
29
+ <slot
29
30
  v-if="isOverlayLoading"
30
- ref="origamProgressRef"
31
- class="origam-btn__progress"
31
+ name="loader"
32
32
  v-bind="progressProps"
33
- :thickness="loaderConfig.kind === 'line' ? 3 : undefined"
34
- :color="color"
35
- :active="true"
36
- />
33
+ >
34
+ <origam-progress
35
+ ref="origamProgressRef"
36
+ class="origam-btn__progress"
37
+ v-bind="progressProps"
38
+ tag="span"
39
+ aria-hidden="true"
40
+ :thickness="loaderKind === 'line' ? 3 : undefined"
41
+ :color="color"
42
+ :active="true"
43
+ />
44
+ </slot>
37
45
 
38
46
  <slot name="wrapper">
39
- <origam-loader
40
- :loading="isSkeletonLoading"
41
- class="origam-btn__loader"
42
- >
43
- <template
44
- v-if="hasLoader && isSkeletonLoading"
45
- #loader
47
+ <span class="origam-btn__loader">
48
+ <span
49
+ v-if="hasPrepend"
50
+ key="prepend"
51
+ class="origam-btn__prepend"
52
+ >
53
+ <slot name="prepend">
54
+ <origam-avatar
55
+ v-if="prependAvatar"
56
+ key="prepend-avatar"
57
+ :density="density"
58
+ :image="prependAvatar"
59
+ />
60
+ <origam-icon
61
+ v-if="prependIcon"
62
+ key="prepend-icon"
63
+ :density="density"
64
+ :icon="prependIcon"
65
+ />
66
+ </slot>
67
+ </span>
68
+
69
+ <span
70
+ class="origam-btn__content"
71
+ data-no-activator=""
72
+ >
73
+ <slot name="default">
74
+ <template v-if="hasIcon">
75
+ <origam-icon
76
+ key="content-icon"
77
+ :icon="icon"
78
+ />
79
+ </template>
80
+ <template v-else>
81
+ {{ text }}
82
+ </template>
83
+ </slot>
84
+ </span>
85
+
86
+ <span
87
+ v-if="hasAppend"
88
+ key="append"
89
+ class="origam-btn__append"
46
90
  >
47
- <slot
48
- name="loader"
49
- v-bind="progressProps"
50
- >
51
- <origam-skeleton
52
- variant="rectangular"
53
- :width="'100%'"
54
- :height="'100%'"
55
- v-bind="loaderConfig.overrides"
91
+ <slot name="append">
92
+ <origam-avatar
93
+ v-if="appendAvatar"
94
+ key="append-avatar"
95
+ :density="density"
96
+ :image="appendAvatar"
97
+ />
98
+ <origam-icon
99
+ v-if="appendIcon"
100
+ key="append-icon"
101
+ :density="density"
102
+ :icon="appendIcon"
56
103
  />
57
104
  </slot>
58
- </template>
59
-
60
- <template #default>
61
- <span
62
- v-if="hasPrepend"
63
- key="prepend"
64
- class="origam-btn__prepend"
65
- >
66
- <slot name="prepend">
67
- <origam-avatar
68
- v-if="prependAvatar"
69
- key="prepend-avatar"
70
- :density="density"
71
- :image="prependAvatar"
72
- />
73
- <origam-icon
74
- v-if="prependIcon"
75
- key="prepend-icon"
76
- :density="density"
77
- :icon="prependIcon"
78
- />
79
- </slot>
80
- </span>
81
-
82
- <span
83
- class="origam-btn__content"
84
- data-no-activator=""
85
- >
86
- <slot name="default">
87
- <template v-if="hasIcon">
88
- <origam-icon
89
- key="content-icon"
90
- :icon="icon"
91
- />
92
- </template>
93
- <template v-else>
94
- {{ text }}
95
- </template>
96
- </slot>
97
- </span>
98
-
99
- <span
100
- v-if="hasAppend"
101
- key="append"
102
- class="origam-btn__append"
103
- >
104
- <slot name="append">
105
- <origam-avatar
106
- v-if="appendAvatar"
107
- key="append-avatar"
108
- :density="density"
109
- :image="appendAvatar"
110
- />
111
- <origam-icon
112
- v-if="appendIcon"
113
- key="append-icon"
114
- :density="density"
115
- :icon="appendIcon"
116
- />
117
- </slot>
118
- </span>
119
- </template>
120
- </origam-loader>
105
+ </span>
106
+ </span>
121
107
  </slot>
122
108
  </component>
123
109
  </template>
@@ -126,9 +112,7 @@
126
112
  import { computed, ref, StyleValue, toRef, useAttrs, useSlots, watchEffect } from "vue";
127
113
  import OrigamAvatar from "../Avatar/OrigamAvatar.vue";
128
114
  import OrigamIcon from "../Icon/OrigamIcon.vue";
129
- import OrigamLoader from "../Loader/OrigamLoader.vue";
130
115
  import OrigamProgress from "../Progress/OrigamProgress.vue";
131
- import OrigamSkeleton from "../Skeleton/OrigamSkeleton.vue";
132
116
  import { useAdjacent } from "../../composables/Commons/adjacent.composable";
133
117
  import { useDensity } from "../../composables/Commons/density.composable";
134
118
  import { useDimension } from "../../composables/Commons/dimension.composable";
@@ -290,7 +274,7 @@ const isActive = computed(() => {
290
274
  });
291
275
  const isDisabled = computed(() => group?.disabled.value || props.disabled);
292
276
  const isAnchor = computed(() => link.tag.value === "a");
293
- const ariaDisabled = computed(() => isAnchor.value && isDisabled.value ? "true" : void 0);
277
+ const ariaDisabled = computed(() => isAnchor.value && isDisabled.value || isLoading.value ? "true" : void 0);
294
278
  const hrefAttr = computed(() => isAnchor.value && isDisabled.value ? void 0 : link.href.value);
295
279
  const typeAttr = computed(() => isAnchor.value ? void 0 : "button");
296
280
  const valueAttr = computed(() => {
@@ -306,7 +290,7 @@ const isRipple = computed(() => {
306
290
  });
307
291
  const { densityClasses } = useDensity(props);
308
292
  const { dimensionStyles } = useDimension(props);
309
- const { loaderClasses, loaderConfig } = useLoader(props, LOADER_KIND.CIRCULAR);
293
+ const { loaderClasses, isLoading, loaderConfig } = useLoader(props, LOADER_KIND.CIRCULAR);
310
294
  const { locationStyles } = useLocation(props);
311
295
  const { positionClasses } = usePosition(props);
312
296
  const { sizeClasses, sizeStyles } = useSize(props);
@@ -331,6 +315,11 @@ const {
331
315
  hasAppend,
332
316
  hasPrepend
333
317
  } = useAdjacent(props, prependIcon, appendIcon);
318
+ const handleClickCapture = (e) => {
319
+ if (!isLoading.value) return;
320
+ e.preventDefault();
321
+ e.stopImmediatePropagation();
322
+ };
334
323
  const handleClick = (e) => {
335
324
  if (isDisabled.value || link.isLink.value && (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0 || attrs.target === "_blank")) return;
336
325
  link.navigate?.(e);
@@ -339,9 +328,6 @@ const handleClick = (e) => {
339
328
  const hasIcon = computed(() => {
340
329
  return !!(icon.value && props.icon !== true);
341
330
  });
342
- const hasLoader = computed(() => {
343
- return slots.loader || loaderConfig.value.isActive;
344
- });
345
331
  const isUnnamedIconOnly = computed(() => {
346
332
  if (!hasIcon.value) return false;
347
333
  if (slots.default || props.text) return false;
@@ -357,13 +343,9 @@ if (import.meta.env?.DEV) {
357
343
  }
358
344
  });
359
345
  }
360
- const isSkeletonLoading = computed(() => {
361
- return loaderConfig.value.isActive && loaderConfig.value.kind === "skeleton";
362
- });
363
- const isOverlayLoading = computed(() => {
364
- return loaderConfig.value.isActive && (loaderConfig.value.kind === "line" || loaderConfig.value.kind === "circular");
365
- });
366
- const ariaBusy = computed(() => loaderConfig.value.isActive ? "true" : void 0);
346
+ const isOverlayLoading = computed(() => loaderConfig.value.isActive);
347
+ const loaderKind = computed(() => loaderConfig.value.kind === "line" ? "line" : "circular");
348
+ const ariaBusy = computed(() => isLoading.value ? "true" : void 0);
367
349
  const progressProps = computed(() => {
368
350
  const cfg = loaderConfig.value;
369
351
  return Object.assign(
@@ -371,7 +353,7 @@ const progressProps = computed(() => {
371
353
  size: "23",
372
354
  indeterminate: cfg.indeterminate,
373
355
  modelValue: cfg.modelValue,
374
- type: cfg.kind === "line" ? PROGRESS_TYPE.LINEAR : PROGRESS_TYPE.CIRCULAR
356
+ type: loaderKind.value === "line" ? PROGRESS_TYPE.LINEAR : PROGRESS_TYPE.CIRCULAR
375
357
  },
376
358
  origamProgressRef.value?.filterProps(props, ["class", "style", "id", "tag", "size", "type"]) ?? {},
377
359
  cfg.overrides
@@ -405,14 +387,14 @@ const btnClasses = computed(() => {
405
387
  // so consumers can pick either spelling.
406
388
  "origam-btn--flat": props.flat,
407
389
  "origam-btn--icon": !!props.icon,
408
- "origam-btn--loading": loaderConfig.value.isActive,
390
+ // `origam-btn--loading` comes from `loaderClasses` below: one
391
+ // source, emitted once.
409
392
  // Loader-kind discriminator so SCSS can branch per kind:
410
- // • `--loader-line` → linear progress strip overlay,
393
+ // - `--loader-line` -> linear progress strip overlay,
411
394
  // keeps the label visible (like OrigamCard's loader).
412
- // • `--loader-circular` → centred spinner; label hidden.
413
- // • `--loader-skeleton` → full-box shimmer; label hidden,
414
- // btn keeps a min-width so it doesn't collapse.
415
- [`origam-btn--loader-${loaderConfig.value.kind}`]: loaderConfig.value.isActive,
395
+ // - `--loader-circular` -> centred spinner over the label,
396
+ // which stays in the DOM (width and name preserved).
397
+ [`origam-btn--loader-${loaderKind.value}`]: isLoading.value,
416
398
  "origam-btn--slim": props.slim,
417
399
  "origam-btn--stacked": props.stacked
418
400
  },
@@ -995,23 +977,6 @@ defineExpose({
995
977
  }
996
978
  }
997
979
 
998
- // Skeleton — rectangular placeholder REPLACES the btn content
999
- // entirely (OrigamLoader's #loader branch). The btn collapses to
1000
- // the skeleton's natural size unless we give it a sensible
1001
- // min-width / min-height.
1002
- &--loader-skeleton {
1003
- min-width: var(--origam-btn--loader-skeleton---min-width, 96px);
1004
- min-height: var(--origam-btn--loader-skeleton---min-height, 36px);
1005
-
1006
- :deep(.origam-skeleton--rectangular) {
1007
- position: absolute;
1008
- inset: 0;
1009
- width: 100%;
1010
- height: 100%;
1011
- border-radius: inherit;
1012
- }
1013
- }
1014
-
1015
980
  &--stacked {
1016
981
  #{$this}__loader {
1017
982
  grid-template-areas: "prepend" "content" "append";