srcdev-nuxt-components 9.4.3 → 9.4.4

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.
@@ -104,7 +104,11 @@ Key CSS custom properties:
104
104
  | -------- | ------- | -------- |
105
105
  | `--colour-text-accent` | — | Colour of `.accent` spans and the icon |
106
106
  | `--hero-text-{scale}` | — | Font size per `fontSize` prop value |
107
+ | `--hero-text-font-family` | `"Playfair Display"` | Font family of the whole component |
108
+ | `--hero-text-margin` | `0` | Margin on the root element |
109
+ | `--hero-text-horizontal-gap` | `0.5ch` | Gap between segments in `axis="horizontal"` mode |
107
110
  | `--hero-text-vertical-gap` | `0.4em` | Gap between segments in `axis="vertical"` mode |
111
+ | `--hero-text-accent-offset` | `0.2em` | Underline-clearance offset on `.accent` spans (`padding-bottom` and the matching negative `margin-bottom`) |
108
112
 
109
113
  **`--hero-text-vertical-gap`** controls `gap` on the flex column in vertical axis. Override at theme or page level:
110
114
 
@@ -0,0 +1,16 @@
1
+ {
2
+ "SRCDEV HeroText": {
3
+ "description": "HeroText — mixed normal/accent heading with configurable size and axis",
4
+ "scope": "vue,html",
5
+ "body": [
6
+ "<HeroText",
7
+ " tag=\"$1h1\"",
8
+ " fontSize=\"$2title\"",
9
+ " :textContent=\"[",
10
+ " { text: '$3Designing', styleClass: 'normal' },",
11
+ " { text: '$4Artistry', styleClass: 'accent' },",
12
+ " ]\"",
13
+ "/>"
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "SRCDEV ToggleSwitchCore": {
3
+ "description": "ToggleSwitchCore — bare toggle switch (no label, use ToggleSwitchWithLabel for that)",
4
+ "scope": "vue,html",
5
+ "body": [
6
+ "<ToggleSwitchCore",
7
+ " v-model=\"$1modelValue\"",
8
+ " id=\"$2toggle-id\"",
9
+ " name=\"$3toggleName\"",
10
+ "/>"
11
+ ]
12
+ }
13
+ }
@@ -44,18 +44,18 @@ const normalisedContent = computed(() =>
44
44
  <style lang="css">
45
45
  @layer components {
46
46
  .hero-text {
47
- font-family: "Playfair Display";
47
+ font-family: var(--hero-text-font-family, "Playfair Display");
48
48
  font-weight: 400;
49
49
  font-variation-settings:
50
50
  "wght" 400,
51
51
  "ital" 1;
52
52
  line-height: 1;
53
53
 
54
- margin: 0;
54
+ margin: var(--hero-text-margin, 0);
55
55
 
56
56
  &.axis-horizontal {
57
57
  flex-direction: row;
58
- gap: 0.5ch;
58
+ gap: var(--hero-text-horizontal-gap, 0.5ch);
59
59
  }
60
60
  &.axis-vertical {
61
61
  display: flex;
@@ -93,12 +93,14 @@ const normalisedContent = computed(() =>
93
93
  }
94
94
 
95
95
  .accent {
96
+ --_hero-text-accent-offset: var(--hero-text-accent-offset, 0.2em);
97
+
96
98
  background-clip: text;
97
99
  background-image: var(--hero-text-bg-img);
98
100
  font-style: italic;
99
101
  color: transparent;
100
- padding-bottom: 0.2em;
101
- margin-bottom: -0.2em;
102
+ padding-bottom: var(--_hero-text-accent-offset);
103
+ margin-bottom: calc(var(--_hero-text-accent-offset) * -1);
102
104
  }
103
105
  }
104
106
  }
@@ -23,6 +23,23 @@ token-rename pass, not a redesign.
23
23
  Geometry (`--input-toggle-*`, `--form-element-*`) is shared across every `05.forms` component and
24
24
  untouched by this — see `theming-form-geometry-tokens.md`.
25
25
 
26
+ ### Track width
27
+
28
+ `--toggle-switch-track-width` overrides the track's width directly. Left unset, the track derives
29
+ its width from the shared `--input-toggle-*`/`--form-element-*` geometry tokens so it always scales
30
+ with `--input-toggle-symbol-size` — resize the thumb and the track resizes to match, no separate
31
+ width to keep in sync:
32
+
33
+ ```css
34
+ .my-compact-toggle {
35
+ --input-toggle-symbol-size: 2.2rem;
36
+ /* Track width now follows automatically — no --toggle-switch-track-width override needed. */
37
+ }
38
+ ```
39
+
40
+ Only set `--toggle-switch-track-width` if you need a width the formula doesn't produce (e.g. a
41
+ fixed width independent of symbol size).
42
+
26
43
  > Five private locals (`--_icon-on-opacity`, `--_icon-off-opacity`, `--_symbol-background-color`,
27
44
  > `--_symbol-margin-inline-start`, `--_symbol-checked-offset`) were removed during this migration —
28
45
  > declared but never actually read by any property in the component, confirmed by grep. Not part
@@ -132,6 +132,23 @@ const toggleSwitchValue = () => {
132
132
 
133
133
  .symbol-wrapper {
134
134
  /* Geometry */
135
+
136
+ /* Track width has no direct public token — it's derived from the same geometry tokens
137
+ that size the thumb, so the track always scales with --input-toggle-symbol-size instead
138
+ of clipping/floating it. Breakdown at the default 0.1rem tokens (= 72px total):
139
+ 2×symbol-size (6rem) + 2×form-element-border-width (0.2rem, wrapper border) +
140
+ 2×wrapper-padding (0.2rem) + 3×symbol-outline-width (0.3rem) +
141
+ 3×symbol-border-width (0.3rem) + 2×symbol-margin (0.2rem). Override
142
+ --toggle-switch-track-width directly if you need a value the formula doesn't produce. */
143
+ --_track-width: var(
144
+ --toggle-switch-track-width,
145
+ calc(
146
+ (2 * var(--input-toggle-symbol-size)) + (2 * var(--form-element-border-width)) +
147
+ (2 * var(--input-toggle-wrapper-padding)) + (3 * var(--input-toggle-symbol-outline-width)) +
148
+ (3 * var(--input-toggle-symbol-border-width)) + (2 * var(--input-toggle-symbol-margin))
149
+ )
150
+ );
151
+
135
152
  display: inline-flex;
136
153
  align-items: center;
137
154
  justify-content: start;
@@ -148,7 +165,7 @@ const toggleSwitchValue = () => {
148
165
  border: var(--form-element-border-width) solid var(--_border);
149
166
  outline: var(--form-element-outline-width) solid transparent;
150
167
  border-radius: 100vw;
151
- width: 72px;
168
+ width: var(--_track-width);
152
169
  padding: calc(var(--input-toggle-wrapper-padding) + var(--input-toggle-symbol-outline-width));
153
170
 
154
171
  &:hover {
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryFn } from "@nuxtjs/storybook";
2
- import { ref } from "vue";
2
+ import { computed, ref } from "vue";
3
3
  import StorybookComponent from "../ToggleSwitchCore.vue";
4
4
  import type { FormUiTheme } from "~/types/forms/types.forms.d";
5
5
 
@@ -17,6 +17,7 @@ interface ToggleSwitchCoreStoryArgs {
17
17
  useCustomIcons: boolean;
18
18
  iconOnContent: string;
19
19
  iconOffContent: string;
20
+ symbolSize: string;
20
21
  }
21
22
 
22
23
  export default {
@@ -126,6 +127,15 @@ export default {
126
127
  category: "Icons",
127
128
  },
128
129
  },
130
+ symbolSize: {
131
+ control: { type: "select" },
132
+ options: ["2rem", "2.2rem", "2.4rem", "3rem", "3.6rem"],
133
+ description:
134
+ "`--input-toggle-symbol-size` — thumb size. Track width has no separate control: it's derived from this token (see ToggleSwitchCore's `--_track-width` comment), so it scales automatically.",
135
+ table: {
136
+ category: "Styling",
137
+ },
138
+ },
129
139
  },
130
140
  } as Meta<ToggleSwitchCoreStoryArgs>;
131
141
 
@@ -134,7 +144,10 @@ const Template: StoryFn<ToggleSwitchCoreStoryArgs> = (_args, { argTypes }) => ({
134
144
  props: Object.keys(argTypes),
135
145
  setup() {
136
146
  const modelValue = ref(false);
137
- return { args: _args, modelValue };
147
+ const cssTokenStyle = computed(() => ({
148
+ "--input-toggle-symbol-size": _args.symbolSize,
149
+ }));
150
+ return { args: _args, modelValue, cssTokenStyle };
138
151
  },
139
152
  template: `
140
153
  <StorybookComponent
@@ -149,6 +162,7 @@ const Template: StoryFn<ToggleSwitchCoreStoryArgs> = (_args, { argTypes }) => ({
149
162
  :theme="args.theme"
150
163
  :round="args.round"
151
164
  :aria-describedby="args.ariaDescribedby"
165
+ :style="cssTokenStyle"
152
166
  >
153
167
  <template v-if="args.useCustomIcons" #iconOn>
154
168
  <span v-html="args.iconOnContent"></span>
@@ -178,6 +192,7 @@ Default.args = {
178
192
  useCustomIcons: false,
179
193
  iconOnContent: "✓",
180
194
  iconOffContent: "✗",
195
+ symbolSize: "3rem",
181
196
  };
182
197
 
183
198
  export const WithCustomIcons = Template.bind({});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-components",
3
3
  "type": "module",
4
- "version": "9.4.3",
4
+ "version": "9.4.4",
5
5
  "main": "nuxt.config.ts",
6
6
  "types": "types.d.ts",
7
7
  "license": "MIT",