origam 2.10.0 → 2.11.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.
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <component
3
- :is="tag"
3
+ :is="props.tag"
4
4
  :id="id"
5
5
  :class="avatarClasses"
6
6
  @click="handleClick"
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <component
3
- :is="tag"
3
+ :is="props.tag"
4
4
  :id="id"
5
5
  role="group"
6
6
  :class="btnGroupClasses"
@@ -30,6 +30,7 @@ import { OrigamBtn, OrigamDefaultsProvider } from "../../components";
30
30
  import {
31
31
  useDefaults,
32
32
  useDensity,
33
+ usePassedProps,
33
34
  useProps,
34
35
  useSize,
35
36
  useStateEffect,
@@ -37,6 +38,7 @@ import {
37
38
  useVariant
38
39
  } from "../../composables";
39
40
  import { DENSITY } from "../../enums";
41
+ import { omitUndefined } from "../../utils";
40
42
  import { computed, StyleValue, useSlots } from "vue";
41
43
  const _props = defineProps({
42
44
  divided: { type: Boolean, required: false },
@@ -89,19 +91,33 @@ const _props = defineProps({
89
91
  });
90
92
  const props = useDefaults(_props);
91
93
  const { filterProps } = useProps(props);
94
+ const wasPropPassed = usePassedProps(props);
92
95
  const slotDefaults = computed(() => ({
93
- "origam-btn": {
96
+ "origam-btn": omitUndefined({
97
+ // `variant` is the ONE deliberate exception, kept unconditional:
98
+ // `--variant-text` (the group's own root default, and every
99
+ // child's own component default) has NO active-state background
100
+ // rule at all — only `outlined`/`tonal` paint a filled surface
101
+ // on the selected segment (see OrigamBtn.vue's
102
+ // `&--variant-outlined { &--active { background-color: ... } }`).
103
+ // The group's OWN resolved `variant` (whether explicitly passed,
104
+ // or resolved from a theme's `'origam-btn-group'` defaults) must
105
+ // always reach the children — else a themed
106
+ // `<origam-btn-toggle variant="outlined">` gets the right root
107
+ // chrome but every child silently stays on 'text', so the active
108
+ // segment never fills — no visible selection at all.
94
109
  variant: props.variant,
95
- density: props.density,
96
- color: props.color,
97
- bgColor: props.bgColor,
98
- size: props.size,
110
+ density: wasPropPassed("density") ? props.density : void 0,
111
+ color: wasPropPassed("color") ? props.color : void 0,
112
+ bgColor: wasPropPassed("bgColor") ? props.bgColor : void 0,
113
+ size: wasPropPassed("size") ? props.size : void 0,
99
114
  // New API: `hover` / `active` accept boolean | IHoverState |
100
115
  // IActiveState; pass-through propagates the parent's intent
101
- // override to each child OrigamBtn.
102
- hover: props.hover,
103
- active: props.active
104
- }
116
+ // override to each child OrigamBtn — only when the consumer
117
+ // actually set it.
118
+ hover: wasPropPassed("hover") ? props.hover : void 0,
119
+ active: wasPropPassed("active") ? props.active : void 0
120
+ })
105
121
  }));
106
122
  const items = computed(() => props.items ?? []);
107
123
  const slots = useSlots();
@@ -77,7 +77,26 @@ const props = defineProps({
77
77
  bgColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
78
78
  active: { type: [Boolean, Object], required: false },
79
79
  activeClass: { type: String, required: false },
80
- hover: { type: [Boolean, Object], required: false }
80
+ hover: { type: [Boolean, Object], required: false },
81
+ border: { type: [Boolean, Number, String, Array], required: false, skipCheck: true },
82
+ borderTop: { type: [Boolean, Number, String], required: false },
83
+ borderLeft: { type: [Boolean, Number, String], required: false },
84
+ borderBottom: { type: [Boolean, Number, String], required: false },
85
+ borderRight: { type: [Boolean, Number, String], required: false },
86
+ borderBlock: { type: [Boolean, Number, String], required: false },
87
+ borderInline: { type: [Boolean, Number, String], required: false },
88
+ borderColor: { type: String, required: false },
89
+ borderStyle: { type: String, required: false },
90
+ borderTopColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
91
+ borderRightColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
92
+ borderBottomColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
93
+ borderLeftColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
94
+ rounded: { type: [Boolean, Number, String, null], required: false, skipCheck: true },
95
+ roundedTopRight: { type: [Boolean, Number, String], required: false },
96
+ roundedTopLeft: { type: [Boolean, Number, String], required: false },
97
+ roundedBottomLeft: { type: [Boolean, Number, String], required: false },
98
+ roundedBottomRight: { type: [Boolean, Number, String], required: false },
99
+ elevation: { type: [Number, String], required: false }
81
100
  });
82
101
  const emits = defineEmits(["update:indeterminate", "update:modelValue", "update:focused", "click:label"]);
83
102
  defineSlots();
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <component
3
- :is="tag"
3
+ :is="props.tag"
4
4
  v-contrast
5
5
  :class="expansionPanelClasses"
6
6
  :style="expansionPanelStyles"
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <component
3
- :is="tag"
3
+ :is="props.tag"
4
4
  :id="id"
5
5
  v-contrast
6
6
  :class="labelClasses"
@@ -4,7 +4,7 @@
4
4
  :transition="transition"
5
5
  >
6
6
  <component
7
- :is="tag"
7
+ :is="props.tag"
8
8
  :class="messagesClasses"
9
9
  :style="[messagesStyles, rootTypographyStyles]"
10
10
  aria-live="polite"
@@ -73,7 +73,26 @@ const props = defineProps({
73
73
  bgColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
74
74
  active: { type: [Boolean, Object], required: false },
75
75
  activeClass: { type: String, required: false },
76
- hover: { type: [Boolean, Object], required: false }
76
+ hover: { type: [Boolean, Object], required: false },
77
+ border: { type: [Boolean, Number, String, Array], required: false, skipCheck: true },
78
+ borderTop: { type: [Boolean, Number, String], required: false },
79
+ borderLeft: { type: [Boolean, Number, String], required: false },
80
+ borderBottom: { type: [Boolean, Number, String], required: false },
81
+ borderRight: { type: [Boolean, Number, String], required: false },
82
+ borderBlock: { type: [Boolean, Number, String], required: false },
83
+ borderInline: { type: [Boolean, Number, String], required: false },
84
+ borderColor: { type: String, required: false },
85
+ borderStyle: { type: String, required: false },
86
+ borderTopColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
87
+ borderRightColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
88
+ borderBottomColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
89
+ borderLeftColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
90
+ rounded: { type: [Boolean, Number, String, null], required: false, skipCheck: true },
91
+ roundedTopRight: { type: [Boolean, Number, String], required: false },
92
+ roundedTopLeft: { type: [Boolean, Number, String], required: false },
93
+ roundedBottomLeft: { type: [Boolean, Number, String], required: false },
94
+ roundedBottomRight: { type: [Boolean, Number, String], required: false },
95
+ elevation: { type: [Number, String], required: false }
77
96
  });
78
97
  const emits = defineEmits(["update:modelValue", "update:focused", "click:label"]);
79
98
  const { filterProps } = useProps(props);
@@ -15,7 +15,8 @@
15
15
 
16
16
  <div
17
17
  v-ripple="rippleProp"
18
- class="origam-selection-control__input"
18
+ :class="selectionControlInputClasses"
19
+ :style="selectionControlInputStyles"
19
20
  >
20
21
  <slot
21
22
  name="input"
@@ -69,10 +70,13 @@ import { computed, inject, nextTick, ref, shallowRef, StyleValue, useAttrs } fro
69
70
  import { ORIGAM_SELECTION_CONTROL_GROUP_KEY } from "../../consts";
70
71
  import { OrigamIcon, OrigamLabel } from "../../components";
71
72
  import {
73
+ useBorder,
72
74
  useDefaults,
73
75
  useDensity,
76
+ useElevation,
74
77
  useHover,
75
78
  useProps,
79
+ useRounded,
76
80
  useStateEffect,
77
81
  useStyle,
78
82
  useTextColor,
@@ -108,7 +112,26 @@ const _props = defineProps({
108
112
  bgColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
109
113
  active: { type: [Boolean, Object], required: false },
110
114
  activeClass: { type: String, required: false },
111
- hover: { type: [Boolean, Object], required: false }
115
+ hover: { type: [Boolean, Object], required: false },
116
+ border: { type: [Boolean, Number, String, Array], required: false, skipCheck: true },
117
+ borderTop: { type: [Boolean, Number, String], required: false },
118
+ borderLeft: { type: [Boolean, Number, String], required: false },
119
+ borderBottom: { type: [Boolean, Number, String], required: false },
120
+ borderRight: { type: [Boolean, Number, String], required: false },
121
+ borderBlock: { type: [Boolean, Number, String], required: false },
122
+ borderInline: { type: [Boolean, Number, String], required: false },
123
+ borderColor: { type: String, required: false },
124
+ borderStyle: { type: String, required: false },
125
+ borderTopColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
126
+ borderRightColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
127
+ borderBottomColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
128
+ borderLeftColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
129
+ rounded: { type: [Boolean, Number, String, null], required: false, skipCheck: true },
130
+ roundedTopRight: { type: [Boolean, Number, String], required: false },
131
+ roundedTopLeft: { type: [Boolean, Number, String], required: false },
132
+ roundedBottomLeft: { type: [Boolean, Number, String], required: false },
133
+ roundedBottomRight: { type: [Boolean, Number, String], required: false },
134
+ elevation: { type: [Number, String], required: false }
112
135
  });
113
136
  const props = useDefaults(_props);
114
137
  const emits = defineEmits(["click:label", "update:modelValue"]);
@@ -202,6 +225,9 @@ const bgColor = computed(() => {
202
225
  return model.value ? props.activeBgColor || props.bgColor : props.bgColor;
203
226
  });
204
227
  const { textColorClasses: wrapperColorClasses, textColorStyles: wrapperColorStyles } = useTextColor(color);
228
+ const { borderClasses, borderStyles } = useBorder(props);
229
+ const { roundedClasses, roundedStyles } = useRounded(props);
230
+ const { elevationClasses, elevationStyles } = useElevation(props);
205
231
  const rippleProp = computed(() => {
206
232
  if (props.ripple) {
207
233
  return [!props.disabled && !props.readonly, null, ["center", "circle"]];
@@ -219,6 +245,21 @@ const selectionControlWrapperClasses = computed(() => {
219
245
  wrapperColorClasses.value
220
246
  ];
221
247
  });
248
+ const selectionControlInputClasses = computed(() => {
249
+ return [
250
+ "origam-selection-control__input",
251
+ borderClasses.value,
252
+ roundedClasses.value,
253
+ elevationClasses.value
254
+ ];
255
+ });
256
+ const selectionControlInputStyles = computed(() => {
257
+ return [
258
+ borderStyles.value,
259
+ roundedStyles.value,
260
+ elevationStyles.value
261
+ ];
262
+ });
222
263
  const selectionControlClasses = computed(() => {
223
264
  return [
224
265
  "origam-selection-control",
@@ -254,7 +295,6 @@ defineExpose(forwardRefs({
254
295
  contain: layout;
255
296
  display: flex;
256
297
  flex: 1 0;
257
- grid-area: control;
258
298
  position: relative;
259
299
  user-select: none;
260
300
 
@@ -307,7 +347,11 @@ defineExpose(forwardRefs({
307
347
  left: 0;
308
348
  width: 100%;
309
349
  height: 100%;
310
- border-radius: 100%;
350
+ // Le halo suit la forme du contrôle. Codé en dur à 100%, il restait
351
+ // circulaire même sous `rounded="md"` : la seule surface que la prop
352
+ // pouvait peindre au repos ignorait la prop. `inherit` reprend le
353
+ // border-radius résolu par `useRounded` sur `__input`.
354
+ border-radius: inherit;
311
355
  background-color: currentColor;
312
356
  opacity: 0;
313
357
  pointer-events: none;
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <component
3
- :is="tag"
3
+ :is="props.tag"
4
4
  :id="tabDomId"
5
5
  ref="rootRef"
6
6
  v-contrast
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <component
3
- :is="tag"
3
+ :is="props.tag"
4
4
  :id="id"
5
5
  ref="rootRef"
6
6
  role="tablist"
@@ -1,6 +1,17 @@
1
- import type { IActiveProps, IBgColorProps, IColorProps, ICommonsComponentEmits, ICommonsComponentProps, IDensityProps, ISelectionControlGroupProps, IHoverProps } from '../../interfaces';
1
+ import type { IActiveProps, IBgColorProps, IBorderProps, IColorProps, ICommonsComponentEmits, ICommonsComponentProps, IDensityProps, IElevationProps, ISelectionControlGroupProps, IHoverProps, IRoundedProps } from '../../interfaces';
2
2
  import type { TColor, TIcon } from '../../types';
3
- export interface ISelectionControlProps extends ICommonsComponentProps, Partial<Omit<ISelectionControlGroupProps, 'items'>>, IColorProps, IBgColorProps, IActiveProps, IHoverProps, IDensityProps {
3
+ /**
4
+ * `border` / `rounded` / `elevation` (props-first, issue #241) — declared
5
+ * here so `OrigamSelectionControl` (the element that owns the visible
6
+ * state-layer box behind the Checkbox/Radio glyph) can consume them via
7
+ * the standard `useBorder` / `useRounded` / `useElevation` composables,
8
+ * mirroring the `ISwitchTrackProps` pattern (the track owns the surface,
9
+ * not the outer `OrigamSwitch`). `ICheckboxBtnProps` / `IRadioBtnProps`
10
+ * extend this interface, so `OrigamCheckbox(Btn)` / `OrigamRadio(Btn)`
11
+ * forward these values down automatically through `filterProps` without
12
+ * any additional wiring.
13
+ */
14
+ export interface ISelectionControlProps extends ICommonsComponentProps, Partial<Omit<ISelectionControlGroupProps, 'items'>>, IColorProps, IBgColorProps, IActiveProps, IHoverProps, IDensityProps, IBorderProps, IRoundedProps, IElevationProps {
4
15
  label?: string;
5
16
  trueValue?: any;
6
17
  falseValue?: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "origam",
3
- "version": "2.10.0",
3
+ "version": "2.11.0",
4
4
  "type": "module",
5
5
  "description": "origam — a Vue 3 design system with multi-theme design tokens, CSS-first components and TypeScript types.",
6
6
  "keywords": [