@omnitend/dashboard-for-laravel 0.30.0 → 0.31.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/dist/components/extended/DXSwitch.vue.d.ts +9 -0
- package/dist/dashboard-for-laravel.js +12 -8
- package/dist/dashboard-for-laravel.js.map +1 -1
- package/dist/dashboard-for-laravel.umd.cjs +1 -1
- package/dist/dashboard-for-laravel.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +8 -0
- package/docs/public/api-reference.json +10 -3
- package/docs/public/docs-map.md +1 -1
- package/package.json +1 -1
- package/resources/css/theme.scss +126 -12
- package/resources/js/components/extended/DXField.vue +2 -0
- package/resources/js/components/extended/DXSwitch.vue +67 -18
- package/resources/js/types/index.ts +9 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generated": "2026-07-
|
|
2
|
+
"generated": "2026-07-20T09:28:21.390Z",
|
|
3
3
|
"package": {
|
|
4
4
|
"name": "@omnitend/dashboard-for-laravel",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.31.0"
|
|
6
6
|
},
|
|
7
7
|
"components": {
|
|
8
8
|
"base": [
|
|
@@ -2636,7 +2636,7 @@
|
|
|
2636
2636
|
"name": "DXSwitch",
|
|
2637
2637
|
"category": "extended",
|
|
2638
2638
|
"filePath": "resources/js/components/extended/DXSwitch.vue",
|
|
2639
|
-
"description": "DXSwitch — a \"filled box\" toggle switch. An opinionated switch built on `DFormCheckbox` (`switch`): a bordered box sized like a `.form-control` with the label on the left and the toggle on the right, colour-coding its state (a neutral box when off, a
|
|
2639
|
+
"description": "DXSwitch — a \"filled box\" toggle switch. An opinionated switch built on `DFormCheckbox` (`switch`): a bordered box sized like a `.form-control` with the label on the left and the toggle on the right, colour-coding its state. By default (`onVariant=\"success\"`) it reads the house green-on / red-off style — a neutral box + red toggle when off, a soft-green box + green toggle when on. `onVariant=\"neutral\"` (brand primary on / grey off) is for semantically-mixed switches that shouldn't imply good/bad (#158). Used standalone or, internally, by `DXField`'s `switch` field type so a form switch and a lone switch share one look. Usage: ```vue <DXSwitch v-model=\"isCurrent\" label=\"Product is current\" /> ``` For a form field, prefer a `DXField`/`DXForm` `type: 'switch'`; reach for `DXSwitch` directly when you want the styled toggle outside a form. Pass a `label` prop for simple text, or the default slot for richer label content.",
|
|
2640
2640
|
"props": [
|
|
2641
2641
|
{
|
|
2642
2642
|
"name": "modelValue",
|
|
@@ -2662,6 +2662,13 @@
|
|
|
2662
2662
|
"type": "string",
|
|
2663
2663
|
"required": false,
|
|
2664
2664
|
"description": "Text shown when off — overrides `label` in the off state (e.g. \"Product is not current\")."
|
|
2665
|
+
},
|
|
2666
|
+
{
|
|
2667
|
+
"name": "onVariant",
|
|
2668
|
+
"type": "union",
|
|
2669
|
+
"required": false,
|
|
2670
|
+
"default": "\"success\"",
|
|
2671
|
+
"description": "On-state colour. `\"success\"` (default) reads the house green-on / red-off\nstyle — an active/enabled/good switch (\"Product is current\", \"Stock is\ntracked\", \"Visible\"). `\"neutral\"` is for semantically-mixed switches\n(\"contains alcohol\", an allergen toggle, \"hidden on web shop\") that\nshouldn't imply good/bad — it uses the brand primary on / grey off (#158)."
|
|
2665
2672
|
}
|
|
2666
2673
|
],
|
|
2667
2674
|
"events": [
|
package/docs/public/docs-map.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Documentation Map
|
|
2
2
|
|
|
3
3
|
> Auto-generated hierarchical overview of all documentation
|
|
4
|
-
> Last updated: 2026-07-
|
|
4
|
+
> Last updated: 2026-07-20T09:28:21.457Z
|
|
5
5
|
|
|
6
6
|
This file provides a complete map of all available documentation for AI agents and developers.
|
|
7
7
|
|
package/package.json
CHANGED
package/resources/css/theme.scss
CHANGED
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
|
|
17
17
|
// Base $theme-colors carry each hue's READABLE-ON-LIGHT identity (its "emphasis"
|
|
18
18
|
// shade) — this is what `.text-*`, `.link-*`, `.border-*` and outline buttons
|
|
19
|
-
// use, so every one must clear AA on white.
|
|
20
|
-
//
|
|
21
|
-
// overrides after the Bootstrap import, from the $dx-variants map. See
|
|
19
|
+
// use, so every one must clear AA on white. The one bold solid FILL (the primary
|
|
20
|
+
// button) and SOFT tints (soft buttons incl. danger, badges, alerts) are applied
|
|
21
|
+
// as explicit overrides after the Bootstrap import, from the $dx-variants map. See
|
|
22
22
|
// plans/2026-07-18-semantic-colour-system.md.
|
|
23
23
|
$primary: #151e2d; // Omni Tend brand navy (16.73:1 on white)
|
|
24
24
|
$secondary: #475569; // Slate-600 (7.58:1 on white)
|
|
@@ -168,16 +168,22 @@ $badge-padding-x: 0.625rem;
|
|
|
168
168
|
$badge-font-weight: 500;
|
|
169
169
|
|
|
170
170
|
// The ONE source of truth for the semantic colour system. Each variant carries
|
|
171
|
-
// its SOLID fill + same-hue text (primary
|
|
171
|
+
// its SOLID fill + same-hue text (the primary button, solid fills), its SOFT
|
|
172
172
|
// tint pair (soft buttons, badges, alerts, status), its EMPHASIS shade (outline
|
|
173
173
|
// buttons, coloured links, .text-*), and whether its button is solid or soft.
|
|
174
174
|
// The overrides after the Bootstrap import loop over this map. All pairs are
|
|
175
175
|
// WCAG AA verified. See plans/2026-07-18-semantic-colour-system.md.
|
|
176
|
+
//
|
|
177
|
+
// Only PRIMARY is a bold solid button — one loud action (the brand). Everything
|
|
178
|
+
// else, INCLUDING danger, is soft: a soft red "Delete" reads as danger without
|
|
179
|
+
// a heavy fill, and one solid button per screen keeps the hierarchy clear. (Was
|
|
180
|
+
// primary+danger solid; danger's soft was also an off-hue plum — it is now a
|
|
181
|
+
// same-hue light red, matching the danger emphasis and the switch OFF.)
|
|
176
182
|
$dx-variants: (
|
|
177
183
|
"primary": (solid-bg: #151e2d, solid-text: #e9f0f8, soft-bg: #e9f0f8, soft-text: #151e2d, emphasis: #151e2d, button: "solid"),
|
|
178
184
|
"secondary": (solid-bg: #475569, solid-text: #e6ebf2, soft-bg: #e6ebf2, soft-text: #29374a, emphasis: #475569, button: "soft"),
|
|
179
185
|
"success": (solid-bg: #84cc16, solid-text: #203b0e, soft-bg: #cdf9b2, soft-text: #203b0e, emphasis: #4d7c0f, button: "soft"),
|
|
180
|
-
"danger": (solid-bg: #dc2626, solid-text: #ffffff, soft-bg: #
|
|
186
|
+
"danger": (solid-bg: #dc2626, solid-text: #ffffff, soft-bg: #f8d4d4, soft-text: #7a1a1a, emphasis: #dc2626, button: "soft"),
|
|
181
187
|
"warning": (solid-bg: #f59e0b, solid-text: #512d05, soft-bg: #fce5c4, soft-text: #512d05, emphasis: #b45309, button: "soft"),
|
|
182
188
|
"info": (solid-bg: #2563eb, solid-text: #eef4ff, soft-bg: #deebff, soft-text: #12376c, emphasis: #2563eb, button: "soft"),
|
|
183
189
|
);
|
|
@@ -456,10 +462,10 @@ $bootstrap-icons-font-src: url("bootstrap-icons/font/fonts/bootstrap-icons.woff2
|
|
|
456
462
|
// ----------------------------------------------------------------------------
|
|
457
463
|
// One loop over $dx-variants applies the whole system on top of Bootstrap:
|
|
458
464
|
//
|
|
459
|
-
// - Buttons:
|
|
465
|
+
// - Buttons: only PRIMARY is SOLID (fill from the base colour; we only
|
|
460
466
|
// override the label to the same-hue tint, letting Bootstrap shade hover/
|
|
461
|
-
// active). secondary/success/warning/info are SOFT (light tint bg +
|
|
462
|
-
// text, fully overridden incl. hover/active).
|
|
467
|
+
// active). secondary/success/danger/warning/info are SOFT (light tint bg +
|
|
468
|
+
// dark text, fully overridden incl. hover/active).
|
|
463
469
|
// - Outline buttons: the emphasis shade for border/label, the soft tint on hover.
|
|
464
470
|
// - Badges: `.badge.text-bg-*` re-tinted soft — needs `!important` because
|
|
465
471
|
// Bootstrap's `.text-bg-*` helper sets its colours `!important` by design.
|
|
@@ -516,8 +522,15 @@ $bootstrap-icons-font-src: url("bootstrap-icons/font/fonts/bootstrap-icons.woff2
|
|
|
516
522
|
--bs-btn-active-border-color: #{$emphasis};
|
|
517
523
|
}
|
|
518
524
|
|
|
519
|
-
//
|
|
520
|
-
|
|
525
|
+
// `.text-bg-*` — soft tint, everywhere (not just `.badge`). Soft-first is the
|
|
526
|
+
// default across the board: a `.badge`, an `.input-group-text`, a chip or a
|
|
527
|
+
// small status bar built with `.text-bg-success` all get the same soft green
|
|
528
|
+
// as the badge, so a stock indicator can match a "current" badge without
|
|
529
|
+
// hardcoding the hue. `!important` beats Bootstrap's `.text-bg-*` helper
|
|
530
|
+
// (which sets its colours `!important` by design). `.toast` is excluded: it
|
|
531
|
+
// has its own soft handling (a fainter 50%-white mix via `--bs-toast-bg` for
|
|
532
|
+
// its large surface) and themed toasts don't carry `.text-bg-*` anyway.
|
|
533
|
+
.text-bg-#{$name}:not(.toast) {
|
|
521
534
|
background-color: #{$soft-bg} !important;
|
|
522
535
|
color: #{$soft-text} !important;
|
|
523
536
|
}
|
|
@@ -534,9 +547,23 @@ $bootstrap-icons-font-src: url("bootstrap-icons/font/fonts/bootstrap-icons.woff2
|
|
|
534
547
|
// colour IS its emphasis shade, so Bootstrap already renders them legible.
|
|
535
548
|
}
|
|
536
549
|
|
|
550
|
+
// Publish each variant's soft/emphasis shades as CSS variables so components
|
|
551
|
+
// (e.g. DXSwitch's on-box) and consumers can reference the exact soft-first
|
|
552
|
+
// tints on any element — Bootstrap's own `--bs-*-bg-subtle` are a different,
|
|
553
|
+
// greyer family derived from the dark emphasis base, so they don't match the
|
|
554
|
+
// soft badge/alert green. These are the same values the $dx-variants loop paints.
|
|
555
|
+
:root {
|
|
556
|
+
@each $name, $v in $dx-variants {
|
|
557
|
+
--dx-#{$name}-soft-bg: #{map.get($v, "soft-bg")};
|
|
558
|
+
--dx-#{$name}-soft-text: #{map.get($v, "soft-text")};
|
|
559
|
+
--dx-#{$name}-solid-bg: #{map.get($v, "solid-bg")};
|
|
560
|
+
--dx-#{$name}-emphasis: #{map.get($v, "emphasis")};
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
537
564
|
// primary is near-black navy, so Bootstrap's darken-on-hover is imperceptible —
|
|
538
|
-
// the main
|
|
539
|
-
//
|
|
565
|
+
// the main (and now only) solid button would have no visible hover feedback.
|
|
566
|
+
// Lighten instead. (Other variants are soft; their hover is handled in the loop.)
|
|
540
567
|
.btn-primary {
|
|
541
568
|
--bs-btn-hover-bg: #{color.scale($primary, $lightness: 20%)};
|
|
542
569
|
--bs-btn-hover-border-color: #{color.scale($primary, $lightness: 20%)};
|
|
@@ -557,6 +584,93 @@ $bootstrap-icons-font-src: url("bootstrap-icons/font/fonts/bootstrap-icons.woff2
|
|
|
557
584
|
}
|
|
558
585
|
}
|
|
559
586
|
|
|
587
|
+
// ----------------------------------------------------------------------------
|
|
588
|
+
// Switches — green when ON, red when OFF, by default (#158)
|
|
589
|
+
// ----------------------------------------------------------------------------
|
|
590
|
+
// House style (James): an active switch — "Product is current", "Stock is
|
|
591
|
+
// tracked", "Visible" — should read success GREEN when on and RED when off,
|
|
592
|
+
// OUT OF THE BOX, not only when a consumer opts in. Bootstrap's default is a
|
|
593
|
+
// primary (navy) track when on / grey when off. We flip the default here.
|
|
594
|
+
//
|
|
595
|
+
// Semantically-MIXED switches ("contains alcohol", an allergen toggle, "hidden
|
|
596
|
+
// on web shop") shouldn't imply good/bad — those opt OUT with `.switch-neutral`
|
|
597
|
+
// on the `.form-switch`, which restores Bootstrap's grey-off / primary-on.
|
|
598
|
+
//
|
|
599
|
+
// Applies to any bare `.form-switch` (DFormCheckbox `switch`); DXSwitch is the
|
|
600
|
+
// "filled box" form where the whole control (not the toggle) carries the colour
|
|
601
|
+
// and the pill stays a neutral affordance — it reads the same tokens below.
|
|
602
|
+
$dx-switch-on: map.get(map.get($dx-variants, "success"), "solid-bg"); // vivid lime
|
|
603
|
+
$dx-switch-off: map.get(map.get($dx-variants, "danger"), "solid-bg"); // vivid red
|
|
604
|
+
$dx-switch-thumb-white: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
|
|
605
|
+
// A red thumb reads better than white on the light-red OFF track.
|
|
606
|
+
$dx-switch-thumb-red: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23dc2626'/%3e%3c/svg%3e");
|
|
607
|
+
|
|
608
|
+
// Switch fill tokens. The ON fill is the SAME soft green as the success
|
|
609
|
+
// badge/button (its `soft-bg`), so a switch and a success badge read as one
|
|
610
|
+
// green — not a separate, punchier lime. OFF is a LIGHT red (a light tint of the
|
|
611
|
+
// danger solid, NOT the plum `danger` soft — a switch off wants to read "red /
|
|
612
|
+
// stop", which the plum status tint doesn't). Derived from the base tokens so
|
|
613
|
+
// one edit moves them. Used by the DXSwitch filled box; the OFF track reuses them.
|
|
614
|
+
$dx-switch-on-soft: map.get(map.get($dx-variants, "success"), "soft-bg"); // #cdf9b2
|
|
615
|
+
:root {
|
|
616
|
+
--dx-switch-on-bg: #{$dx-switch-on-soft};
|
|
617
|
+
--dx-switch-on-well: #{color.mix($dx-switch-on-soft, #fff, 55%)};
|
|
618
|
+
--dx-switch-on-line: #{color.mix($dx-switch-on-soft, $dx-switch-on, 55%)};
|
|
619
|
+
--dx-switch-on-ink: #{map.get(map.get($dx-variants, "success"), "soft-text")};
|
|
620
|
+
--dx-switch-off-bg: #{color.mix($dx-switch-off, #fff, 20%)};
|
|
621
|
+
--dx-switch-off-well: #{color.mix($dx-switch-off, #fff, 10%)};
|
|
622
|
+
--dx-switch-off-line: #{color.mix($dx-switch-off, #fff, 45%)};
|
|
623
|
+
--dx-switch-off-ink: #{color.mix($dx-switch-off, #000, 30%)};
|
|
624
|
+
--dx-switch-pill: var(--bs-gray-400, #ced4da); // neutral pill in both states
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
.form-switch .form-check-input {
|
|
628
|
+
// OFF: light-red track, red thumb (left).
|
|
629
|
+
background-color: var(--dx-switch-off-bg);
|
|
630
|
+
border-color: var(--dx-switch-off-line);
|
|
631
|
+
--bs-form-switch-bg: #{$dx-switch-thumb-red};
|
|
632
|
+
|
|
633
|
+
&:checked {
|
|
634
|
+
// ON: vivid green track, white thumb (right — Bootstrap positions it).
|
|
635
|
+
background-color: #{$dx-switch-on};
|
|
636
|
+
border-color: #{$dx-switch-on};
|
|
637
|
+
--bs-form-switch-bg: #{$dx-switch-thumb-white};
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
// Neutral grey focus ring (the track carries the state colour, so the brand
|
|
641
|
+
// navy ring would clash); keep the state thumb rather than Bootstrap's navy.
|
|
642
|
+
&:focus {
|
|
643
|
+
--bs-form-switch-bg: #{$dx-switch-thumb-red};
|
|
644
|
+
border-color: var(--dx-switch-off-line);
|
|
645
|
+
box-shadow: 0 0 0 0.25rem rgba($dark, 0.15);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
&:checked:focus {
|
|
649
|
+
border-color: #{$dx-switch-on};
|
|
650
|
+
--bs-form-switch-bg: #{$dx-switch-thumb-white};
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
// Neutral opt-out for mixed-semantics switches: restore Bootstrap's grey-off /
|
|
655
|
+
// primary-on (no good/bad valence).
|
|
656
|
+
.form-switch.switch-neutral .form-check-input {
|
|
657
|
+
background-color: var(--bs-body-bg);
|
|
658
|
+
border-color: var(--bs-border-color);
|
|
659
|
+
// Bootstrap's default faint-grey OFF thumb.
|
|
660
|
+
--bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280, 0, 0, 0.25%29'/%3e%3c/svg%3e");
|
|
661
|
+
|
|
662
|
+
&:checked {
|
|
663
|
+
background-color: var(--bs-primary);
|
|
664
|
+
border-color: var(--bs-primary);
|
|
665
|
+
--bs-form-switch-bg: #{$dx-switch-thumb-white};
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
&:focus {
|
|
669
|
+
border-color: var(--bs-primary);
|
|
670
|
+
box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
|
|
560
674
|
// ----------------------------------------------------------------------------
|
|
561
675
|
// Chart palette (data-viz)
|
|
562
676
|
// ----------------------------------------------------------------------------
|
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
<DXSwitch
|
|
160
160
|
v-else
|
|
161
161
|
v-model="switchModel"
|
|
162
|
+
:on-variant="field.switchVariant"
|
|
162
163
|
:disabled="isDisabled || isReadonly || isPlaintext"
|
|
163
164
|
v-bind="controlPropsWithGuards"
|
|
164
165
|
>
|
|
@@ -201,6 +202,7 @@
|
|
|
201
202
|
<DXSwitch
|
|
202
203
|
v-else
|
|
203
204
|
v-model="switchModel"
|
|
205
|
+
:on-variant="field.switchVariant"
|
|
204
206
|
:disabled="isDisabled || isReadonly || isPlaintext"
|
|
205
207
|
v-bind="controlPropsWithGuards"
|
|
206
208
|
>
|
|
@@ -4,9 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
An opinionated switch built on `DFormCheckbox` (`switch`): a bordered box sized
|
|
6
6
|
like a `.form-control` with the label on the left and the toggle on the right,
|
|
7
|
-
colour-coding its state
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
colour-coding its state. By default (`onVariant="success"`) it reads the house
|
|
8
|
+
green-on / red-off style — a neutral box + red toggle when off, a soft-green
|
|
9
|
+
box + green toggle when on. `onVariant="neutral"` (brand primary on / grey off)
|
|
10
|
+
is for semantically-mixed switches that shouldn't imply good/bad (#158). Used
|
|
11
|
+
standalone or, internally, by `DXField`'s `switch` field type so a form switch
|
|
12
|
+
and a lone switch share one look.
|
|
10
13
|
|
|
11
14
|
Usage:
|
|
12
15
|
```vue
|
|
@@ -18,8 +21,16 @@
|
|
|
18
21
|
`label` prop for simple text, or the default slot for richer label content.
|
|
19
22
|
-->
|
|
20
23
|
<template>
|
|
21
|
-
<div class="dx-switch" :class="{ 'dx-switch--on': isOn }">
|
|
22
|
-
|
|
24
|
+
<div class="dx-switch" :class="[`dx-switch--${onVariant}`, { 'dx-switch--on': isOn }]">
|
|
25
|
+
<!-- For the neutral variant, tag the inner `.form-switch` with
|
|
26
|
+
`switch-neutral` so the global theme restores grey-off / primary-on for
|
|
27
|
+
the toggle itself (the box styling below handles the wrapper). -->
|
|
28
|
+
<DFormCheckbox
|
|
29
|
+
v-model="model"
|
|
30
|
+
switch
|
|
31
|
+
:class="onVariant === 'neutral' ? 'switch-neutral' : undefined"
|
|
32
|
+
v-bind="$attrs"
|
|
33
|
+
>
|
|
23
34
|
<!--
|
|
24
35
|
@slot Label content shown beside the toggle. Falls back to the contextual
|
|
25
36
|
text / `label` prop. Scoped with the current on-state so a caller can vary
|
|
@@ -44,10 +55,19 @@ interface Props {
|
|
|
44
55
|
textWhenTrue?: string;
|
|
45
56
|
/** Text shown when off — overrides `label` in the off state (e.g. "Product is not current"). */
|
|
46
57
|
textWhenFalse?: string;
|
|
58
|
+
/**
|
|
59
|
+
* On-state colour. `"success"` (default) reads the house green-on / red-off
|
|
60
|
+
* style — an active/enabled/good switch ("Product is current", "Stock is
|
|
61
|
+
* tracked", "Visible"). `"neutral"` is for semantically-mixed switches
|
|
62
|
+
* ("contains alcohol", an allergen toggle, "hidden on web shop") that
|
|
63
|
+
* shouldn't imply good/bad — it uses the brand primary on / grey off (#158).
|
|
64
|
+
*/
|
|
65
|
+
onVariant?: "success" | "neutral";
|
|
47
66
|
}
|
|
48
67
|
|
|
49
68
|
const props = withDefaults(defineProps<Props>(), {
|
|
50
69
|
modelValue: false,
|
|
70
|
+
onVariant: "success",
|
|
51
71
|
});
|
|
52
72
|
|
|
53
73
|
const emit = defineEmits<{
|
|
@@ -128,26 +148,55 @@ defineOptions({
|
|
|
128
148
|
cursor: pointer;
|
|
129
149
|
}
|
|
130
150
|
|
|
131
|
-
/*
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
151
|
+
/* Filled box (#158): the WHOLE control carries the colour and the pill stays a
|
|
152
|
+
neutral grey affordance — the box IS the state, so it reads strongest at a
|
|
153
|
+
glance (the house style). `success` (default) is green ON / light-red OFF;
|
|
154
|
+
`neutral` keeps a brand primary panel for mixed-semantics switches. Pair with
|
|
155
|
+
`textWhenTrue`/`textWhenFalse` so the LABEL also names each state. */
|
|
156
|
+
.dx-switch--success :deep(.form-check) {
|
|
157
|
+
background-color: var(--dx-switch-off-bg);
|
|
158
|
+
border-color: var(--dx-switch-off-line);
|
|
137
159
|
}
|
|
138
160
|
|
|
139
|
-
.dx-switch--
|
|
140
|
-
color: var(--
|
|
161
|
+
.dx-switch--success :deep(.form-check-label) {
|
|
162
|
+
color: var(--dx-switch-off-ink);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.dx-switch--success.dx-switch--on :deep(.form-check) {
|
|
166
|
+
background-color: var(--dx-switch-on-bg);
|
|
167
|
+
border-color: var(--dx-switch-on-line);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.dx-switch--success.dx-switch--on :deep(.form-check-label) {
|
|
171
|
+
color: var(--dx-switch-on-ink);
|
|
141
172
|
font-weight: 500;
|
|
142
173
|
}
|
|
143
174
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
175
|
+
/* Neutral grey pill in BOTH states (white thumb, sliding) — overrides the global
|
|
176
|
+
green-on/red-off toggle colours within the box, so only the box carries the
|
|
177
|
+
state. Explicit `:checked`/`:focus` selectors so they out-specify the global
|
|
178
|
+
`.form-switch .form-check-input:checked` rule. */
|
|
179
|
+
.dx-switch--success :deep(.form-check-input),
|
|
180
|
+
.dx-switch--success :deep(.form-check-input:checked),
|
|
181
|
+
.dx-switch--success :deep(.form-check-input:focus) {
|
|
182
|
+
background-color: var(--dx-switch-pill);
|
|
183
|
+
border-color: var(--dx-switch-pill);
|
|
184
|
+
--bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
|
|
147
185
|
}
|
|
148
186
|
|
|
149
|
-
.dx-switch--
|
|
187
|
+
.dx-switch--success :deep(.form-check-input:focus) {
|
|
188
|
+
box-shadow: 0 0 0 0.2rem rgba(0, 0, 0, 0.12);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/* neutral variant (mixed-semantics): brand primary panel when on; the toggle is
|
|
192
|
+
handled by `.switch-neutral` on the inner form-switch (primary-on / grey-off). */
|
|
193
|
+
.dx-switch--neutral.dx-switch--on :deep(.form-check) {
|
|
194
|
+
background-color: var(--bs-primary-bg-subtle);
|
|
150
195
|
border-color: var(--bs-primary);
|
|
151
|
-
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.dx-switch--neutral.dx-switch--on :deep(.form-check-label) {
|
|
199
|
+
color: var(--bs-primary-text-emphasis);
|
|
200
|
+
font-weight: 500;
|
|
152
201
|
}
|
|
153
202
|
</style>
|
|
@@ -196,6 +196,15 @@ export interface FieldDefinition {
|
|
|
196
196
|
*/
|
|
197
197
|
textWhenFalse?: MaybeFn<string>;
|
|
198
198
|
|
|
199
|
+
/**
|
|
200
|
+
* For `switch` fields: the on-state colour. `"success"` (default) is the
|
|
201
|
+
* house green-on / red-off style for an active/enabled/good switch;
|
|
202
|
+
* `"neutral"` (brand primary on / grey off) is for semantically-mixed
|
|
203
|
+
* switches that shouldn't imply good/bad ("contains alcohol", an allergen
|
|
204
|
+
* toggle, "hidden on web shop"). See DXSwitch `onVariant` (#158).
|
|
205
|
+
*/
|
|
206
|
+
switchVariant?: "success" | "neutral";
|
|
207
|
+
|
|
199
208
|
/** CSS class for the form group */
|
|
200
209
|
class?: string;
|
|
201
210
|
|