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.
@@ -9,16 +9,7 @@
9
9
  >
10
10
  <div class="origam-field__overlay"/>
11
11
 
12
- <template v-if="loaderConfig.isActive && loaderConfig.kind === 'skeleton'">
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
- <template v-if="!loaderConfig.isActive || loaderConfig.kind !== 'skeleton'">
39
- <div
40
- v-if="hasPrependInner"
41
- key="prependInner"
42
- class="origam-field__prepend-inner"
43
- v-bind="prependInnerCommandAttrs"
44
- @click="handleClickPrependInner"
45
- @keydown="handleKeydownPrependInner"
46
- >
47
- <slot name="prependInner">
48
- <origam-avatar
49
- v-if="prependInnerAvatar"
50
- key="prepend-avatar"
51
- :density="density"
52
- :image="prependInnerAvatar"
53
- />
54
- <origam-icon
55
- v-if="prependInnerIcon"
56
- key="prepend-icon"
57
- :density="density"
58
- :icon="prependInnerIcon"
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
- </div>
67
+ </template>
62
68
 
63
- <div
64
- class="origam-field__field"
65
- data-no-activator=""
69
+ <span
70
+ v-if="hasPrefix"
71
+ class="origam-field__prefix"
66
72
  >
67
- <template v-if="hasLabel">
68
- <slot
69
- name="label"
70
- v-bind="labelProps"
71
- >
72
- <origam-label
73
- v-bind="labelProps"
74
- ref="origamLabelRef"
75
- />
76
- </slot>
77
- </template>
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
- <origam-expand-x
108
- v-if="hasClear"
109
- key="clear"
85
+ <span
86
+ v-if="hasSuffix"
87
+ class="origam-field__suffix"
110
88
  >
111
- <button
112
- v-show="dirty"
113
- type="button"
114
- class="origam-field__clearable"
115
- :aria-label="clearLabel"
116
- @blur="handleBlur"
117
- @focus="handleFocus"
118
- @mousedown="handleMousedownClear"
119
- @keydown="handleKeydownClear"
120
- >
121
- <slot name="clear">
122
- <origam-icon :icon="clearIcon"/>
123
- </slot>
124
- </button>
125
- </origam-expand-x>
126
-
127
- <div
128
- v-if="hasAppendInner"
129
- key="appendInner"
130
- class="origam-field__append-inner"
131
- v-bind="appendInnerCommandAttrs"
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="appendInner">
136
- <origam-avatar
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
- </div>
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
- <div class="origam-field__outlines">
152
- <div class="origam-field__outline origam-field__outline--start"/>
153
- <div class="origam-field__outline origam-field__outline--notch">
154
- <template v-if="hasFloatingLabel">
155
- <slot
156
- name="floatingLabel"
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
- <origam-label
160
- key="floating-label"
161
- v-bind="floatingLabelProps"
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
- </template>
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;
@@ -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" && cfg.kind !== "skeleton";
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
 
@@ -9,7 +9,7 @@ import type { IElevationProps } from '../Commons/elevation.interface';
9
9
  import type { IGroupEmits, IGroupItemProps } from '../Commons/group.interface';
10
10
  import type { IHoverProps } from '../Commons/hover.interface';
11
11
  import type { ILinkProps } from '../Commons/router.interface';
12
- import type { ILoaderProps } from '../Commons/loader.interface';
12
+ import type { IControlLoaderProps } from '../Commons/loader.interface';
13
13
  import type { ILocationProps } from '../Commons/location.interface';
14
14
  import type { IMarginProps } from '../Commons/margin.interface';
15
15
  import type { IPaddingProps } from '../Commons/padding.interface';
@@ -25,7 +25,7 @@ import type { TStatus, TStatusPosition } from '../../types/Commons/status.type';
25
25
  * `icon` prop accepts `boolean | TIcon` (boolean = icon-only mode) which is
26
26
  * wider than `IIconProps.icon?: TIcon`. Pulling the two status props in
27
27
  * directly avoids the TS2430 incompatible-extends error. */
28
- export interface IBtnProps extends ICommonsComponentProps, IColorProps, IBgColorProps, IBorderProps, IDensityProps, IDimensionProps, IElevationProps, IRoundedProps, ITagProps, ISizeProps, ILinkProps, IRippleProps, ILoaderProps, IPositionProps, ILocationProps, IGroupItemProps, IPaddingProps, IMarginProps, IAdjacentProps, IHoverProps, IActiveProps, IActionVariantProps, Pick<ITypographyProps, 'fontSize' | 'fontWeight' | 'lineHeight' | 'letterSpacing'> {
28
+ export interface IBtnProps extends ICommonsComponentProps, IColorProps, IBgColorProps, IBorderProps, IDensityProps, IDimensionProps, IElevationProps, IRoundedProps, ITagProps, ISizeProps, ILinkProps, IRippleProps, IControlLoaderProps, IPositionProps, ILocationProps, IGroupItemProps, IPaddingProps, IMarginProps, IAdjacentProps, IHoverProps, IActiveProps, IActionVariantProps, Pick<ITypographyProps, 'fontSize' | 'fontWeight' | 'lineHeight' | 'letterSpacing'> {
29
29
  /** @deprecated Use `variant="flat"` instead. Kept for backward compat. */
30
30
  flat?: boolean;
31
31
  /** Pass `true` to activate icon-only mode; pass a `TIcon` value to set the icon. */
@@ -62,7 +62,7 @@ export interface IBtnEmits extends IGroupEmits {
62
62
  export interface IBtnSlots extends IAdjacentSlots {
63
63
  /** Overrides the whole loader/prepend/content/append layout. */
64
64
  wrapper?: () => any;
65
- /** Overrides the active loader (line/circular/skeleton), receives the
65
+ /** Overrides the active loader (line/circular), receives the
66
66
  * forwarded `<OrigamProgress>` props. */
67
67
  loader?: (data: Record<string, unknown>) => any;
68
68
  default?: () => any;
@@ -1,6 +1,6 @@
1
1
  import type { IColorProps } from './color.interface';
2
2
  import type { ICommonsComponentProps, ITagProps } from './commons.interface';
3
- import type { TLoaderConfig, TLoaderKind, TLoadingValue } from '../../types/Commons/loader.type';
3
+ import type { TControlLoadingValue, TLoaderConfig, TLoaderKind, TLoadingValue } from '../../types/Commons/loader.type';
4
4
  /*********************************************************
5
5
  * ILoaderProps / IResolvedLoader
6
6
  *
@@ -20,6 +20,18 @@ export interface ILoaderProps extends ICommonsComponentProps, ITagProps, IColorP
20
20
  loading?: TLoadingValue;
21
21
  loadingText?: string;
22
22
  }
23
+ /*********************************************************
24
+ * IControlLoaderProps
25
+ *
26
+ * @description
27
+ * `ILoaderProps` for a CONTROL (`OrigamBtn`, `OrigamSwitch`, `OrigamField`
28
+ * and its derivatives): same surface, but `loading` refuses
29
+ * `{ type: 'skeleton' }` - an action in flight never replaces the control
30
+ * (see `TControlLoaderConfig`).
31
+ ********************************************************/
32
+ export interface IControlLoaderProps extends Omit<ILoaderProps, 'loading'> {
33
+ loading?: TControlLoadingValue;
34
+ }
23
35
  /**
24
36
  * Resolved loader state — what each consumer component reads to decide
25
37
  * which renderer to mount and with which props.
@@ -7,7 +7,7 @@ import type { IDensityProps } from '../Commons/density.interface';
7
7
  import type { IElevationProps } from '../Commons/elevation.interface';
8
8
  import type { IFocusEmits, IFocusProps } from '../Commons/focus.interface';
9
9
  import type { ILabelProps } from '../Label/label.interface';
10
- import type { ILoaderProps } from '../Commons/loader.interface';
10
+ import type { IControlLoaderProps } from '../Commons/loader.interface';
11
11
  import type { IRoundedProps } from '../Commons/rounded.interface';
12
12
  import type { ISizeProps } from '../Commons/size.interface';
13
13
  import type { ITypographyProps } from '../Commons/typography.interface';
@@ -31,7 +31,7 @@ import type { IInputVariantProps } from '../Commons/variant.interface';
31
31
  * `--origam-field---border-*` token channel the three outline legs already
32
32
  * read, so the notch keeps opening under `--active` / `--focused`.
33
33
  ********************************************************/
34
- export interface IFieldProps extends ICommonsComponentProps, ILoaderProps, IColorProps, IBgColorProps, IAdjacentInnerProps, IBorderProps, IFocusProps, IDensityProps, ILabelProps, IActiveProps, IInputVariantProps, IRoundedProps, IElevationProps, ISizeProps, Pick<ITypographyProps, 'fontSize' | 'fontWeight' | 'lineHeight' | 'letterSpacing'> {
34
+ export interface IFieldProps extends ICommonsComponentProps, IControlLoaderProps, IColorProps, IBgColorProps, IAdjacentInnerProps, IBorderProps, IFocusProps, IDensityProps, ILabelProps, IActiveProps, IInputVariantProps, IRoundedProps, IElevationProps, ISizeProps, Pick<ITypographyProps, 'fontSize' | 'fontWeight' | 'lineHeight' | 'letterSpacing'> {
35
35
  centerAffix?: boolean;
36
36
  dirty?: boolean;
37
37
  disabled?: boolean;
@@ -7,13 +7,13 @@ import type { IElevationProps } from '../Commons/elevation.interface';
7
7
  import type { IFocusEmits } from '../Commons/focus.interface';
8
8
  import type { IHoverProps } from '../Commons/hover.interface';
9
9
  import type { IInputProps } from '../Input/input.interface';
10
- import type { ILoaderProps } from '../Commons/loader.interface';
10
+ import type { IControlLoaderProps } from '../Commons/loader.interface';
11
11
  import type { IMarginProps } from '../Commons/margin.interface';
12
12
  import type { IPaddingProps } from '../Commons/padding.interface';
13
13
  import type { IRoundedProps } from '../Commons/rounded.interface';
14
14
  import type { ISelectionControlProps } from '../SelectionControl/selection-control.interface';
15
15
  import type { ISwitchTrackSlotsProps } from './switch-track.interface';
16
- export interface ISwitchProps extends ICommonsComponentProps, ITagProps, IPaddingProps, IMarginProps, IBorderProps, IRoundedProps, IInputProps, ISelectionControlProps, ILoaderProps, IColorProps, IDensityProps, IElevationProps, IActiveProps, IHoverProps {
16
+ export interface ISwitchProps extends ICommonsComponentProps, ITagProps, IPaddingProps, IMarginProps, IBorderProps, IRoundedProps, IInputProps, ISelectionControlProps, IControlLoaderProps, IColorProps, IDensityProps, IElevationProps, IActiveProps, IHoverProps {
17
17
  indeterminate?: boolean;
18
18
  inset?: boolean;
19
19
  }
@@ -35,3 +35,27 @@ export type TLoaderConfig = ({
35
35
  * | `{ type: 'line' \| 'circular' \| 'skeleton', … }` | Loading with explicit kind override and per-instance prop overrides. |
36
36
  */
37
37
  export type TLoadingValue = boolean | number | TLoaderConfig;
38
+ /*********************************************************
39
+ * TControlLoaderConfig / TControlLoadingValue
40
+ *
41
+ * @description
42
+ * Per-kind override config of a CONTROL (`OrigamBtn`, `OrigamSwitch`,
43
+ * `OrigamField` and its derivatives). A control that is mid-action keeps its
44
+ * label, its value and its input rendered: an action in flight is signalled
45
+ * by an indicator (spinner / strip), never by a placeholder that stands in
46
+ * for the control.
47
+ *
48
+ * @description
49
+ * So the `skeleton` member of `TLoaderConfig` is REFUSED at compile time
50
+ * here: `{ type: 'skeleton' }` is a type error on these components.
51
+ * Skeleton placeholders stay available on the containers whose content
52
+ * genuinely does not exist yet (Card, ExpansionPanel, DataTable).
53
+ *
54
+ * @description
55
+ * `TControlLoadingValue` is the `loading` prop value a control accepts:
56
+ * `TLoadingValue` minus the skeleton placeholder.
57
+ ********************************************************/
58
+ export type TControlLoaderConfig = Exclude<TLoaderConfig, {
59
+ type: `${LOADER_KIND.SKELETON}`;
60
+ }>;
61
+ export type TControlLoadingValue = boolean | number | TControlLoaderConfig;