@omnitend/dashboard-for-laravel 0.48.1 → 0.49.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.
Files changed (32) hide show
  1. package/dist/components/base/DApp.vue.d.ts +12 -0
  2. package/dist/components/base/DFormCheckbox.vue.d.ts +1 -1
  3. package/dist/components/extended/DXFieldAffixGroup.vue.d.ts +26 -0
  4. package/dist/components/extended/DXNumericField.vue.d.ts +5 -0
  5. package/dist/components/extended/DXTable.vue.d.ts +5 -1
  6. package/dist/composables/useToast.d.ts +36 -1
  7. package/dist/dashboard-for-laravel.js +15383 -14546
  8. package/dist/dashboard-for-laravel.js.map +1 -1
  9. package/dist/dashboard-for-laravel.umd.cjs +9 -9
  10. package/dist/dashboard-for-laravel.umd.cjs.map +1 -1
  11. package/dist/index.d.ts +2 -0
  12. package/dist/style.css +4 -4
  13. package/dist/types/index.d.ts +32 -3
  14. package/dist/utils/itemNameCase.d.ts +17 -0
  15. package/docs/public/api-reference.json +93 -8
  16. package/docs/public/docs-map.md +1 -1
  17. package/docs/public/llms.txt +3 -2
  18. package/package.json +10 -11
  19. package/resources/css/theme.scss +22 -3
  20. package/resources/js/components/base/DApp.vue +29 -0
  21. package/resources/js/components/base/DFormCheckbox.vue +21 -3
  22. package/resources/js/components/extended/DXCurrencyInput.vue +3 -2
  23. package/resources/js/components/extended/DXField.vue +51 -0
  24. package/resources/js/components/extended/DXFieldAffixGroup.vue +84 -0
  25. package/resources/js/components/extended/DXNumericField.vue +54 -1
  26. package/resources/js/components/extended/DXTable.vue +10 -2
  27. package/resources/js/components/extended/DXTableEditorModal.vue +2 -4
  28. package/resources/js/composables/useResourceEditor.ts +7 -9
  29. package/resources/js/composables/useToast.ts +105 -15
  30. package/resources/js/index.ts +2 -0
  31. package/resources/js/types/index.ts +39 -3
  32. package/resources/js/utils/itemNameCase.ts +27 -0
@@ -105,6 +105,28 @@ export interface FieldDefinition {
105
105
  /** Min/max for numeric inputs */
106
106
  min?: number | string;
107
107
  max?: number | string;
108
+ /**
109
+ * Short unit text shown in an input-group cell AFTER the input: "minutes"
110
+ * for "Online notice", rather than "Online notice (minutes)" in the label.
111
+ * May be a function of the model, like `hint`.
112
+ *
113
+ * For `number`, `text`, `email`, `url` and `tel` fields; on `currency` it
114
+ * is the trailing unit the price is per ("per case", DXCurrencyInput's
115
+ * `append`), and on `percentage` it replaces the "%" cell. Other types
116
+ * ignore it. The input names the cell in its `aria-describedby`, so a
117
+ * screen reader reads "Online notice, 120, minutes". A `plaintext` field
118
+ * shows the value followed by the unit as text ("120 minutes"), and an
119
+ * empty value shows neither. A field without `append` or `prepend`
120
+ * renders exactly as it did before they existed: no input group.
121
+ */
122
+ append?: MaybeFn<string>;
123
+ /**
124
+ * Short text shown in an input-group cell BEFORE the input ("every",
125
+ * "#"). The counterpart of `append`, on the same field types except
126
+ * `currency`, whose leading cell is `currencySymbol`. May be a function
127
+ * of the model.
128
+ */
129
+ prepend?: MaybeFn<string>;
108
130
  /** Symbol shown for `currency` fields (default: the locale's, "£"). */
109
131
  currencySymbol?: string;
110
132
  /**
@@ -375,13 +397,18 @@ interface WithNumericBounds {
375
397
  min?: number | string;
376
398
  max?: number | string;
377
399
  }
400
+ /** `append`/`prepend` unit text in an input-group cell beside the input. */
401
+ interface WithAffixes {
402
+ append?: MaybeFn<string>;
403
+ prepend?: MaybeFn<string>;
404
+ }
378
405
  interface WithSelectableOptions {
379
406
  options?: FieldOption[];
380
407
  optionsLoader?: OptionsLoader;
381
408
  reloadOptionsOnChange?: boolean;
382
409
  }
383
410
  /** `text` / `email` / `url` / `tel` — a plain text-like `<input>`. */
384
- export interface TextFieldDef extends BaseFieldDef, WithPlaceholder {
411
+ export interface TextFieldDef extends BaseFieldDef, WithPlaceholder, WithAffixes {
385
412
  type: "text" | "email" | "url" | "tel";
386
413
  }
387
414
  /** `password` — text input with an optional reveal (eye) toggle. */
@@ -390,7 +417,7 @@ export interface PasswordFieldDef extends BaseFieldDef, WithPlaceholder {
390
417
  revealable?: boolean;
391
418
  }
392
419
  /** `number` — numeric input with optional bounds. */
393
- export interface NumberFieldDef extends BaseFieldDef, WithPlaceholder, WithNumericBounds {
420
+ export interface NumberFieldDef extends BaseFieldDef, WithPlaceholder, WithNumericBounds, WithAffixes {
394
421
  type: "number";
395
422
  }
396
423
  /** `date` / `datetime` / `datetime-local` / `time` — native date/time controls.
@@ -403,11 +430,13 @@ export interface DateFieldDef extends BaseFieldDef, WithNumericBounds {
403
430
  export interface CurrencyFieldDef extends BaseFieldDef, WithPlaceholder, WithNumericBounds {
404
431
  type: "currency";
405
432
  currencySymbol?: string;
433
+ /** The unit the price is per; the leading cell is `currencySymbol`. */
434
+ append?: MaybeFn<string>;
406
435
  decimals?: number;
407
436
  minorUnits?: boolean;
408
437
  }
409
438
  /** `percentage` — numeric input shown as a 0–100 percentage. */
410
- export interface PercentageFieldDef extends BaseFieldDef, WithPlaceholder, WithNumericBounds {
439
+ export interface PercentageFieldDef extends BaseFieldDef, WithPlaceholder, WithNumericBounds, WithAffixes {
411
440
  type: "percentage";
412
441
  asFraction?: boolean;
413
442
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Casing for a DXTable `itemName` ("booking period") where it is shown.
3
+ *
4
+ * Titles and buttons ("New Booking Period", "Create Booking Period") take
5
+ * Title Case; a sentence that starts with the name ("Booking period
6
+ * created successfully") takes a capital first letter; mid-sentence uses
7
+ * ("No booking periods found") keep the name as written.
8
+ */
9
+ /**
10
+ * Upper-cases the first letter of each space-separated word and leaves the
11
+ * rest as written, so "SKU" stays "SKU" and "product's" does not become
12
+ * "Product'S" (a `\b\w` replace capitalised the letter after an apostrophe).
13
+ * An empty name reads as "Item".
14
+ */
15
+ export declare function titleCaseItemName(itemName: string | undefined): string;
16
+ /** Upper-cases the first character, for text that starts a sentence. */
17
+ export declare function capitaliseFirst(text: string): string;
@@ -1,8 +1,8 @@
1
1
  {
2
- "generated": "2026-10-31T08:04:57.235Z",
2
+ "generated": "2026-11-23T10:27:27.096Z",
3
3
  "package": {
4
4
  "name": "@omnitend/dashboard-for-laravel",
5
- "version": "0.48.1"
5
+ "version": "0.49.0"
6
6
  },
7
7
  "components": {
8
8
  "base": [
@@ -77,6 +77,27 @@
77
77
  ],
78
78
  "methods": []
79
79
  },
80
+ {
81
+ "name": "DApp",
82
+ "category": "base",
83
+ "filePath": "resources/js/components/base/DApp.vue",
84
+ "description": "DApp — wraps bootstrap-vue-next's BApp: the app-root provider that `useToast()` and `useModal()` need above them, and the orchestrator that renders the toasts and modals they create. Mount it once, around the whole app (or around each island in an islands site such as Astro). Usage: ```vue <DApp> <MyApp /> </DApp> ```",
85
+ "props": [],
86
+ "events": [],
87
+ "slots": [
88
+ {
89
+ "name": "name",
90
+ "description": "",
91
+ "bindings": [
92
+ {
93
+ "name": "name",
94
+ "title": "binding"
95
+ }
96
+ ]
97
+ }
98
+ ],
99
+ "methods": []
100
+ },
80
101
  {
81
102
  "name": "DAspect",
82
103
  "category": "base",
@@ -1562,7 +1583,7 @@
1562
1583
  "name": "DXCurrencyInput",
1563
1584
  "category": "extended",
1564
1585
  "filePath": "resources/js/components/extended/DXCurrencyInput.vue",
1565
- "description": "DXCurrencyInput — the money input leaf (#152). A currency-symbol-prefixed numeric input with the display/model split from #69: the MODEL is always a plain number (or null), while the displayed text is padded to the minor-unit precision on blur/seed (`3.8` -> `3.80`) and never reformatted mid-edit. Clearing the input emits `null` — never `NaN`, never `\"\"` — so \"no value\" is one predictable shape (#152). `minorUnits` (#116) edits an integer-minor-unit model (pence) as major units (pounds): display = model / 10^decimals, emit = round(input * 10^decimals). `min`/`max`/`step` and the displayed text are always in MAJOR units — only the model is scaled. `append` puts a trailing affix after the input — the unit the price is per (\"Pint\", \"per case\", \"each\"). Without it a consumer needing a unit beside the amount has to hand-roll a `DInputGroup` + bare number input, which puts every foot-gun above straight back. A plain string covers most cases; the `#append` slot takes arbitrary content (a unit picker, a button) and wins over the prop, the same prop-with-slot-fallback shape `DXFieldShell` uses for `hint`. DXField's `currency` field type renders this leaf; it exists standalone so a money input outside a form (an inline table correction, a quick filter) doesn't re-inline the `£`-prefix + toFixed + parse foot-guns. On a DXField, reach the affix through the field's `inputProps` (`{ append: 'per case' }`) — it binds to this prop like any other.",
1586
+ "description": "DXCurrencyInput — the money input leaf (#152). A currency-symbol-prefixed numeric input with the display/model split from #69: the MODEL is always a plain number (or null), while the displayed text is padded to the minor-unit precision on blur/seed (`3.8` -> `3.80`) and never reformatted mid-edit. Clearing the input emits `null` — never `NaN`, never `\"\"` — so \"no value\" is one predictable shape (#152). `minorUnits` (#116) edits an integer-minor-unit model (pence) as major units (pounds): display = model / 10^decimals, emit = round(input * 10^decimals). `min`/`max`/`step` and the displayed text are always in MAJOR units — only the model is scaled. `append` puts a trailing affix after the input — the unit the price is per (\"Pint\", \"per case\", \"each\"). Without it a consumer needing a unit beside the amount has to hand-roll a `DInputGroup` + bare number input, which puts every foot-gun above straight back. A plain string covers most cases; the `#append` slot takes arbitrary content (a unit picker, a button) and wins over the prop, the same prop-with-slot-fallback shape `DXFieldShell` uses for `hint`. DXField's `currency` field type renders this leaf; it exists standalone so a money input outside a form (an inline table correction, a quick filter) doesn't re-inline the `£`-prefix + toFixed + parse foot-guns. On a DXField, set the field's own `append` (`append: 'per case'`, or a function of the model); `inputProps: { append }` still binds to this prop and wins over it, as `inputProps` always does.",
1566
1587
  "props": [
1567
1588
  {
1568
1589
  "name": "modelValue",
@@ -2404,6 +2425,58 @@
2404
2425
  ],
2405
2426
  "methods": []
2406
2427
  },
2428
+ {
2429
+ "name": "DXFieldAffixGroup",
2430
+ "category": "extended",
2431
+ "filePath": "resources/js/components/extended/DXFieldAffixGroup.vue",
2432
+ "description": "A field's `prepend`/`append` unit text around its input (DXField, and DXNumericField's `number` and `percentage`). DXField renders this ONLY when the field has an affix, so a field without one keeps its bare input: the markup of every other field is unchanged. - Editable or `readonly`: a DInputGroup with an `.input-group-text` cell before and/or after the input (the default slot). Each cell has an id, and the slot's `describedBy` names them (after any id the consumer passed through `inputProps`), so the input reads \"Online notice, 120, minutes\". - `plaintext`: the value followed by the unit as one line of static text, \"120 minutes\". An input group around a borderless input would leave the unit at the far edge of the row in a grey box. An empty value shows neither, rather than a unit with nothing to qualify.",
2433
+ "props": [
2434
+ {
2435
+ "name": "prepend",
2436
+ "type": "string",
2437
+ "required": false,
2438
+ "description": "Resolved leading text. Empty or undefined: no leading cell."
2439
+ },
2440
+ {
2441
+ "name": "append",
2442
+ "type": "string",
2443
+ "required": false,
2444
+ "description": "Resolved trailing text. Empty or undefined: no trailing cell."
2445
+ },
2446
+ {
2447
+ "name": "plaintext",
2448
+ "type": "boolean",
2449
+ "required": false,
2450
+ "description": "Show the value and its unit as static text instead of the group."
2451
+ },
2452
+ {
2453
+ "name": "value",
2454
+ "type": "unknown",
2455
+ "required": false,
2456
+ "description": "The value as the input shows it (plaintext only)."
2457
+ },
2458
+ {
2459
+ "name": "consumerDescribedBy",
2460
+ "type": "string",
2461
+ "required": false,
2462
+ "description": "The consumer's own `aria-describedby` (from `inputProps`), kept first."
2463
+ }
2464
+ ],
2465
+ "events": [],
2466
+ "slots": [
2467
+ {
2468
+ "name": "default",
2469
+ "description": "The input.",
2470
+ "bindings": [
2471
+ {
2472
+ "name": "described-by",
2473
+ "title": "binding"
2474
+ }
2475
+ ]
2476
+ }
2477
+ ],
2478
+ "methods": []
2479
+ },
2407
2480
  {
2408
2481
  "name": "DXFieldLabel",
2409
2482
  "category": "extended",
@@ -3158,7 +3231,7 @@
3158
3231
  "name": "DXNumericField",
3159
3232
  "category": "extended",
3160
3233
  "filePath": "resources/js/components/extended/DXNumericField.vue",
3161
- "description": "The numeric control family for DXField: `currency`, `percentage`, `number`. Extracted from DXField (#135) unchanged. The parent DXField still owns the value/guards/`setValue` coercion — this component only renders the control and emits the raw edited value back up. The `percentage` `asFraction` display scaling (model holds a 0–1 fraction, input shows 0–100) lives here because it is purely presentational to this control.",
3234
+ "description": "The numeric control family for DXField: `currency`, `percentage`, `number`. Extracted from DXField (#135) unchanged. The parent DXField still owns the value/guards/`setValue` coercion — this component only renders the control and emits the raw edited value back up. The `percentage` `asFraction` display scaling (model holds a 0–1 fraction, input shows 0–100) lives here because it is purely presentational to this control. A field's `prepend`/`append` (resolved by DXField) go to the currency's `append`, or wrap a number or percentage in DXFieldAffixGroup; without them each control renders as it did before they existed.",
3162
3235
  "props": [
3163
3236
  {
3164
3237
  "name": "field",
@@ -3201,6 +3274,18 @@
3201
3274
  "type": "Record",
3202
3275
  "required": false,
3203
3276
  "description": "Escape-hatch input props, already guard-merged by DXField."
3277
+ },
3278
+ {
3279
+ "name": "prepend",
3280
+ "type": "string",
3281
+ "required": false,
3282
+ "description": "The field's resolved `prepend` (number and percentage only)."
3283
+ },
3284
+ {
3285
+ "name": "append",
3286
+ "type": "string",
3287
+ "required": false,
3288
+ "description": "The field's resolved `append`: the currency's trailing unit, the\n percentage's trailing cell in place of \"%\", or the number's unit."
3204
3289
  }
3205
3290
  ],
3206
3291
  "events": [
@@ -3672,7 +3757,7 @@
3672
3757
  "type": "string",
3673
3758
  "required": false,
3674
3759
  "default": "\"item\"",
3675
- "description": "Name for item (singular) - automatically pluralized (e.g., \"product\" → \"products\")"
3760
+ "description": "Name for item (singular), as written mid-sentence - automatically\npluralized (e.g., \"product\" → \"products\"). Titles and buttons Title-Case\nit (\"New Booking Period\"); toasts start it with a capital."
3676
3761
  },
3677
3762
  {
3678
3763
  "name": "items",
@@ -4766,8 +4851,8 @@
4766
4851
  ]
4767
4852
  },
4768
4853
  "stats": {
4769
- "totalComponents": 92,
4770
- "baseComponents": 62,
4771
- "extendedComponents": 30
4854
+ "totalComponents": 94,
4855
+ "baseComponents": 63,
4856
+ "extendedComponents": 31
4772
4857
  }
4773
4858
  }
@@ -1,7 +1,7 @@
1
1
  # Documentation Map
2
2
 
3
3
  > Auto-generated hierarchical overview of all documentation
4
- > Last updated: 2026-10-31T08:04:57.296Z
4
+ > Last updated: 2026-11-23T10:27:27.161Z
5
5
 
6
6
  This file provides a complete map of all available documentation for AI agents and developers.
7
7
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Vue 3 dashboard components for Laravel with Bootstrap Vue Next
4
4
  >
5
- > A dual-package library (NPM + Composer) providing 82 Vue 3 components for building Laravel dashboards with Bootstrap Vue Next.
5
+ > A dual-package library (NPM + Composer) providing 83 Vue 3 components for building Laravel dashboards with Bootstrap Vue Next.
6
6
 
7
7
  ## Installation
8
8
 
@@ -19,13 +19,14 @@
19
19
  - [Theming](/guide/theming): Customize appearance with CSS variables
20
20
  - [TypeScript](/guide/typescript): TypeScript types and best practices
21
21
 
22
- ## Base Components (62 components)
22
+ ## Base Components (63 components)
23
23
 
24
24
  Lightweight type-safe wrappers around Bootstrap Vue Next components providing API stability and consistent theming.
25
25
 
26
26
  - [DAccordion](/components/base/daccordion): Bootstrap Vue Next Accordion wrapper
27
27
  - [DAccordionItem](/components/base/daccordionitem): Bootstrap Vue Next AccordionItem wrapper
28
28
  - [DAlert](/components/base/dalert): Bootstrap Vue Next Alert wrapper
29
+ - [DApp](/components/base/dapp): Bootstrap Vue Next App wrapper
29
30
  - [DAspect](/components/base/daspect): Bootstrap Vue Next Aspect wrapper
30
31
  - [DAutocomplete](/components/base/dautocomplete): Bootstrap Vue Next Autocomplete wrapper
31
32
  - [DAvatar](/components/base/davatar): Bootstrap Vue Next Avatar wrapper
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnitend/dashboard-for-laravel",
3
- "version": "0.48.1",
3
+ "version": "0.49.0",
4
4
  "description": "Vue 3 dashboard components for Laravel with Bootstrap Vue Next",
5
5
  "type": "module",
6
6
  "main": "./dist/dashboard-for-laravel.umd.cjs",
@@ -73,14 +73,13 @@
73
73
  }
74
74
  },
75
75
  "dependencies": {
76
- "bootstrap-vue-next": "^0.45.6",
77
- "pluralize": "^8.0.0"
76
+ "bootstrap-vue-next": "^1.2.4"
78
77
  },
79
78
  "devDependencies": {
80
- "@astrojs/markdown-remark": "^7.2.0",
81
- "@astrojs/mdx": "^8.0.3",
79
+ "@astrojs/markdown-remark": "^7.3.8",
80
+ "@astrojs/mdx": "^8.1.5",
82
81
  "@astrojs/sitemap": "^3.7.3",
83
- "@astrojs/vue": "^7.0.3",
82
+ "@astrojs/vue": "^7.1.5",
84
83
  "@iconify-json/lucide": "^1.2.71",
85
84
  "@iconify/json": "^2.2.397",
86
85
  "@inertiajs/vue3": "^2.2.15",
@@ -89,15 +88,15 @@
89
88
  "@vitejs/plugin-vue": "^5.2.4",
90
89
  "@vitest/browser": "^4.1.12",
91
90
  "@vitest/browser-playwright": "^4.1.12",
92
- "@vue/test-utils": "^2.4.6",
93
- "astro": "7.3.8",
94
- "bootstrap": "^5.3.8",
91
+ "@vue/test-utils": "^2.5.1",
92
+ "astro": "7.4.11",
93
+ "bootstrap": "^5.3.9",
95
94
  "bootstrap-icons": "^1.13.1",
96
95
  "chart.js": "^4.5.1",
97
- "happy-dom": "^20.0.8",
98
96
  "highlight.js": "^11.11.1",
99
97
  "pagefind": "^1.4.0",
100
- "playwright": "^1.56.1",
98
+ "playwright": "1.65.1",
99
+ "pluralize": "8.0.0",
101
100
  "rehype-autolink-headings": "^7.1.0",
102
101
  "rehype-slug": "^6.0.0",
103
102
  "sass-embedded": "^1.93.2",
@@ -830,7 +830,7 @@ $dx-display-only-row: '.dx-form--horizontal .row:has(> .col-form-label):not(:has
830
830
  $dx-input-group-control: ':not(.input-group-text, .btn, .dropdown-menu, .dropdown-toggle, [type="hidden"], .valid-feedback, .invalid-feedback, .valid-tooltip, .invalid-tooltip)';
831
831
  $dx-wrapping-input-group: '.input-group:not(.dx-input-group--joined):has(> #{$dx-input-group-control} ~ #{$dx-input-group-control})';
832
832
  $dx-input-group-validation-messages: '';
833
- @each $state in map-keys($form-validation-states) {
833
+ @each $state in map.keys($form-validation-states) {
834
834
  $dx-input-group-validation-messages: $dx-input-group-validation-messages + ':not(.#{$state}-tooltip):not(.#{$state}-feedback)';
835
835
  }
836
836
 
@@ -947,7 +947,7 @@ $dx-input-group-validation-messages: '';
947
947
 
948
948
  &:focus-within:not([aria-disabled="true"]) {
949
949
  border-color: var(--bs-form-invalid-border-color);
950
- box-shadow: map-get(map-get($form-validation-states, "invalid"), "focus-box-shadow");
950
+ box-shadow: map.get(map.get($form-validation-states, "invalid"), "focus-box-shadow");
951
951
  }
952
952
  }
953
953
 
@@ -957,7 +957,7 @@ $dx-input-group-validation-messages: '';
957
957
 
958
958
  &:focus-within:not([aria-disabled="true"]) {
959
959
  border-color: var(--bs-form-valid-border-color);
960
- box-shadow: map-get(map-get($form-validation-states, "valid"), "focus-box-shadow");
960
+ box-shadow: map.get(map.get($form-validation-states, "valid"), "focus-box-shadow");
961
961
  }
962
962
  }
963
963
  }
@@ -1433,6 +1433,13 @@ aside.dashboard-sidebar--light {
1433
1433
  // sets its colours `!important` by design. An untouched (non-themed) variant
1434
1434
  // still falls through to BVN's default `.text-bg-*` styling.
1435
1435
 
1436
+ // The last toast in a stack drops the gap below it (see `.toast` below), so a
1437
+ // bottom stack (useToast's default since 0.49) sits the container's padding
1438
+ // from the edge, as its sides do. `> :last-child >` is BVN's per-toast span.
1439
+ .toast-container > :last-child > .toast {
1440
+ margin-bottom: 0;
1441
+ }
1442
+
1436
1443
  .toast {
1437
1444
  overflow: hidden; // clip the bottom progress bar to the rounded corners
1438
1445
  border: 1px solid $border-color;
@@ -1847,6 +1854,18 @@ fieldset:disabled .input-group > .btn.dx-password-reveal {
1847
1854
  }
1848
1855
  }
1849
1856
 
1857
+ // A field's `prepend`/`append` unit (DXFieldAffixGroup): the same rule as the
1858
+ // currency input above, so a long unit wraps rather than crushing the value.
1859
+ .dx-field-affix {
1860
+ > .form-control {
1861
+ min-width: 5.5rem;
1862
+ }
1863
+
1864
+ > .input-group-text {
1865
+ white-space: normal;
1866
+ }
1867
+ }
1868
+
1850
1869
  // What a stacked card line stretches: a form control, or an element wrapping
1851
1870
  // one. Not buttons, which keep their size.
1852
1871
  $dx-stack-controls: 'input:not([type="hidden"]), select, textarea, .form-control, .form-select, .input-group, [contenteditable]';
@@ -0,0 +1,29 @@
1
+ <!--
2
+ @component
3
+ DApp — wraps bootstrap-vue-next's BApp: the app-root provider that
4
+ `useToast()` and `useModal()` need above them, and the orchestrator that
5
+ renders the toasts and modals they create. Mount it once, around the whole
6
+ app (or around each island in an islands site such as Astro).
7
+
8
+ Usage:
9
+ ```vue
10
+ <DApp>
11
+ <MyApp />
12
+ </DApp>
13
+ ```
14
+ -->
15
+ <template>
16
+ <BApp v-bind="$attrs">
17
+ <template v-for="(_, name) in $slots" :key="name" #[name]="slotProps">
18
+ <slot :name="name" v-bind="slotProps" />
19
+ </template>
20
+ </BApp>
21
+ </template>
22
+
23
+ <script setup lang="ts">
24
+ import { BApp } from "bootstrap-vue-next";
25
+
26
+ defineOptions({
27
+ inheritAttrs: false,
28
+ });
29
+ </script>
@@ -2,13 +2,31 @@
2
2
  import { BFormCheckbox } from "bootstrap-vue-next";
3
3
  import { useSlots } from "vue";
4
4
 
5
+ defineOptions({
6
+ inheritAttrs: false,
7
+ });
8
+
5
9
  const slots = useSlots();
10
+
11
+ /**
12
+ * bvn 0.46 dropped BFormCheckbox's `uncheckedValue` default (`false`) to
13
+ * "no value", so an unticked box emitted `undefined`, which Laravel's
14
+ * `boolean` rule rejects. Restore `false` (DIVERGENCES.md #9). The
15
+ * consumer's attrs spread after the default, so their value wins in either
16
+ * spelling: Vue camelises `unchecked-value` later in the same props object.
17
+ * Not a declared prop, so Vue's Boolean casting never touches the consumer's
18
+ * value (`unchecked-value=""` stays `""`).
19
+ */
20
+ const withUncheckedDefault = (attrs: Record<string, unknown>) => ({
21
+ uncheckedValue: false,
22
+ ...attrs,
23
+ });
6
24
  </script>
7
25
 
8
26
  <template>
9
- <BFormCheckbox v-bind="$attrs">
10
- <template v-for="(_, name) in slots" :key="name" #[name]>
11
- <slot :name="name" />
27
+ <BFormCheckbox v-bind="withUncheckedDefault($attrs)">
28
+ <template v-for="(_, name) in slots" :key="name" #[name]="slotProps">
29
+ <slot :name="name" v-bind="slotProps" />
12
30
  </template>
13
31
  </BFormCheckbox>
14
32
  </template>
@@ -22,8 +22,9 @@
22
22
  DXField's `currency` field type renders this leaf; it exists standalone so a
23
23
  money input outside a form (an inline table correction, a quick filter)
24
24
  doesn't re-inline the `£`-prefix + toFixed + parse foot-guns. On a DXField,
25
- reach the affix through the field's `inputProps` (`{ append: 'per case' }`) —
26
- it binds to this prop like any other.
25
+ set the field's own `append` (`append: 'per case'`, or a function of the
26
+ model); `inputProps: { append }` still binds to this prop and wins over it,
27
+ as `inputProps` always does.
27
28
  -->
28
29
  <template>
29
30
  <!-- `.dx-currency-input` (theme.scss) keeps the amount usable in a narrow
@@ -301,6 +301,8 @@
301
301
  :is-readonly="isReadonly"
302
302
  :is-plaintext="isPlaintext"
303
303
  :input-props="inputPropsWithGuards"
304
+ :prepend="resolvedPrepend"
305
+ :append="resolvedAppend"
304
306
  @update:model-value="setValue"
305
307
  />
306
308
 
@@ -392,6 +394,33 @@
392
394
  </div>
393
395
  </div>
394
396
 
397
+ <!-- A text-like input with the field's `prepend`/`append` unit
398
+ text in input-group cells. Only a field WITH an affix
399
+ takes this branch, so the bare input below keeps its
400
+ markup. -->
401
+ <DXFieldAffixGroup
402
+ v-else-if="hasTextAffixes"
403
+ v-slot="{ describedBy }"
404
+ :prepend="resolvedPrepend"
405
+ :append="resolvedAppend"
406
+ :plaintext="isPlaintext"
407
+ :value="textFieldModel"
408
+ :consumer-described-by="inputPropsWithGuards['aria-describedby']"
409
+ >
410
+ <DFormInput
411
+ v-model="textFieldModel"
412
+ :type="inputType"
413
+ :required="field.required"
414
+ :placeholder="field.placeholder"
415
+ :state="fieldState"
416
+ :disabled="isDisabled"
417
+ :readonly="isReadonly || isPlaintext"
418
+ :plaintext="isPlaintext"
419
+ v-bind="inputPropsWithGuards"
420
+ :aria-describedby="describedBy"
421
+ />
422
+ </DXFieldAffixGroup>
423
+
395
424
  <!-- Text-based inputs (text/email/password/url/tel/date/time/datetime) -->
396
425
  <DFormInput
397
426
  v-else
@@ -437,6 +466,7 @@ import DXFieldLabel from "./DXFieldLabel.vue";
437
466
  import DXFieldShell from "./DXFieldShell.vue";
438
467
  import DXNumericField from "./DXNumericField.vue";
439
468
  import DXChoiceField from "./DXChoiceField.vue";
469
+ import DXFieldAffixGroup from "./DXFieldAffixGroup.vue";
440
470
  import { useAsyncOptions } from "../../composables/useAsyncOptions";
441
471
  import type { UseFormReturn } from "../../composables/useForm";
442
472
  import type {
@@ -814,6 +844,27 @@ const resolvedHint = computed(() => resolveText(props.field.hint));
814
844
 
815
845
  const resolvedInfo = computed(() => resolveText(props.field.info));
816
846
 
847
+ // ————————————————— prepend / append unit text
848
+
849
+ const resolvedPrepend = computed(() => resolveText(props.field.prepend));
850
+
851
+ const resolvedAppend = computed(() => resolveText(props.field.append));
852
+
853
+ /** The text-like types that take `prepend`/`append` (the numeric ones are
854
+ * DXNumericField's). Not password, autocomplete or the date family. */
855
+ const TEXT_AFFIX_TYPES: ReadonlySet<FieldType> = new Set([
856
+ "text",
857
+ "email",
858
+ "url",
859
+ "tel",
860
+ ]);
861
+
862
+ const hasTextAffixes = computed(
863
+ () =>
864
+ TEXT_AFFIX_TYPES.has(props.field.type) &&
865
+ (Boolean(resolvedPrepend.value) || Boolean(resolvedAppend.value)),
866
+ );
867
+
817
868
  // ————————————————— switch-list (#160)
818
869
 
819
870
  // Row grid for switch-list option rows. Deliberately NOT `horizontalAttrs`:
@@ -0,0 +1,84 @@
1
+ <!--
2
+ @component (internal — not exported)
3
+ A field's `prepend`/`append` unit text around its input (DXField, and
4
+ DXNumericField's `number` and `percentage`). DXField renders this ONLY when
5
+ the field has an affix, so a field without one keeps its bare input: the
6
+ markup of every other field is unchanged.
7
+
8
+ - Editable or `readonly`: a DInputGroup with an `.input-group-text` cell
9
+ before and/or after the input (the default slot). Each cell has an id,
10
+ and the slot's `describedBy` names them (after any id the consumer passed
11
+ through `inputProps`), so the input reads "Online notice, 120, minutes".
12
+ - `plaintext`: the value followed by the unit as one line of static text,
13
+ "120 minutes". An input group around a borderless input would leave the
14
+ unit at the far edge of the row in a grey box. An empty value shows
15
+ neither, rather than a unit with nothing to qualify.
16
+ -->
17
+ <template>
18
+ <div
19
+ v-if="plaintext"
20
+ class="form-control-plaintext dx-field-affix-plaintext"
21
+ >{{ plaintextText }}</div>
22
+ <DInputGroup v-else class="dx-field-affix">
23
+ <template v-if="prepend" #prepend>
24
+ <span :id="prependId" class="input-group-text">{{ prepend }}</span>
25
+ </template>
26
+ <!--
27
+ @slot The input.
28
+ @binding {string | undefined} describedBy The value for the input's `aria-describedby`: the affix cells' ids, after the consumer's own.
29
+ -->
30
+ <slot :described-by="describedBy" />
31
+ <template v-if="append" #append>
32
+ <span :id="appendId" class="input-group-text">{{ append }}</span>
33
+ </template>
34
+ </DInputGroup>
35
+ </template>
36
+
37
+ <script setup lang="ts">
38
+ import { computed, useId } from "vue";
39
+ import DInputGroup from "../base/DInputGroup.vue";
40
+
41
+ interface Props {
42
+ /** Resolved leading text. Empty or undefined: no leading cell. */
43
+ prepend?: string;
44
+
45
+ /** Resolved trailing text. Empty or undefined: no trailing cell. */
46
+ append?: string;
47
+
48
+ /** Show the value and its unit as static text instead of the group. */
49
+ plaintext?: boolean;
50
+
51
+ /** The value as the input shows it (plaintext only). */
52
+ value?: unknown;
53
+
54
+ /** The consumer's own `aria-describedby` (from `inputProps`), kept first. */
55
+ consumerDescribedBy?: string;
56
+ }
57
+
58
+ const props = defineProps<Props>();
59
+
60
+ const idBase = useId();
61
+ const prependId = `${idBase}-prepend`;
62
+ const appendId = `${idBase}-append`;
63
+
64
+ const describedBy = computed<string | undefined>(() => {
65
+ const ids = [
66
+ props.consumerDescribedBy,
67
+ props.prepend ? prependId : undefined,
68
+ props.append ? appendId : undefined,
69
+ ].filter((id): id is string => id !== undefined && id !== "");
70
+ return ids.length > 0 ? ids.join(" ") : undefined;
71
+ });
72
+
73
+ const plaintextText = computed(() => {
74
+ const value = props.value;
75
+ if (value === null || value === undefined || value === "") return "";
76
+ let text = String(value);
77
+ if (props.prepend) text = `${props.prepend} ${text}`;
78
+ // "20%", not "20 %": a percent sign sits against its number.
79
+ if (props.append) {
80
+ text += props.append.startsWith("%") ? props.append : ` ${props.append}`;
81
+ }
82
+ return text;
83
+ });
84
+ </script>