bitboss-ui 3.0.0-beta.73 → 3.0.0-beta.74
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/README.md +4 -2
- package/bin/bitboss-ui-mcp.mjs +101 -3
- package/bin/bitboss-ui.mjs +6 -1
- package/bin/cli.mjs +31 -5
- package/dist/ai/BbBadge.md +4 -4
- package/dist/ai/BbCalendar.md +4 -3
- package/dist/ai/BbColorPalette.md +8 -9
- package/dist/ai/BbConfirmPortal.md +1 -1
- package/dist/ai/BbDatePicker.md +4 -3
- package/dist/ai/BbDialog.md +14 -4
- package/dist/ai/BbDropdown.md +23 -10
- package/dist/ai/BbDropdownButton.md +2 -2
- package/dist/ai/BbForm.md +4 -1
- package/dist/ai/BbHoverCardPortal.md +1 -1
- package/dist/ai/BbNumberInput.md +5 -3
- package/dist/ai/BbPopoverPortal.md +1 -1
- package/dist/ai/BbTable.md +43 -19
- package/dist/ai/BbTimePicker.md +4 -3
- package/dist/ai/BbToastPortal.md +1 -1
- package/dist/ai/changelog.json +56 -4
- package/dist/ai/components.json +54 -18
- package/dist/ai/guides/design-tokens.md +20 -0
- package/dist/ai/guides/eslint-rules.md +1 -1
- package/dist/ai/guides/inertia-helpers.md +613 -53
- package/dist/ai/guides/migration/adoption-checklist.md +5 -5
- package/dist/ai/guides/migration/v2-to-v3.md +24 -0
- package/dist/ai/guides/migration/v3-beta-tooling.md +3 -0
- package/dist/ai/guides/preset-components.md +15 -2
- package/dist/ai/guides/reporting.md +49 -0
- package/dist/ai/helpers/inertia/manifest.json +33 -38
- package/dist/ai/helpers/inertia/useHasChanged.ts +25 -37
- package/dist/ai/helpers/inertia/useQuery.ts +24 -6
- package/dist/ai/helpers/inertia/utils.ts +552 -3
- package/dist/ai/index.md +1 -0
- package/dist/ai/manifest/components/BbAlert.tree.json +1 -1
- package/dist/ai/manifest/components/BbCalendar.json +2 -2
- package/dist/ai/manifest/components/BbColorPalette.json +3 -3
- package/dist/ai/manifest/components/BbConfirmPortal.json +1 -1
- package/dist/ai/manifest/components/BbDatePicker.json +3 -3
- package/dist/ai/manifest/components/BbDialog.tree.json +5 -1
- package/dist/ai/manifest/components/BbDropdown.json +3 -3
- package/dist/ai/manifest/components/BbDropdown.tree.json +3 -2
- package/dist/ai/manifest/components/BbDropdownButton.json +2 -2
- package/dist/ai/manifest/components/BbForm.json +1 -1
- package/dist/ai/manifest/components/BbHoverCard.json +1 -1
- package/dist/ai/manifest/components/BbHoverCardPortal.json +1 -1
- package/dist/ai/manifest/components/BbNumberInput.json +1 -1
- package/dist/ai/manifest/components/BbPopover.json +1 -1
- package/dist/ai/manifest/components/BbPopoverPortal.json +1 -1
- package/dist/ai/manifest/components/BbSelectPopover.json +1 -1
- package/dist/ai/manifest/components/BbTable.tree.json +12 -6
- package/dist/ai/manifest/components/BbTimePicker.json +3 -3
- package/dist/ai/manifest/components/BbToastPortal.json +1 -1
- package/dist/ai/manifest/components/CommonPopover.json +1 -1
- package/dist/ai/manifest/index.json +2 -2
- package/dist/ai/manifest/meta.json +36 -0
- package/dist/ai/manifest/types.advanced.json +81 -80
- package/dist/ai/manifest/types.api.json +66 -65
- package/dist/ai/manifest/types.wrapper.json +155 -118
- package/dist/ai/recipes/inertia/layout-scaffold.md +3 -1
- package/dist/ai/recipes/nuxt/layout-scaffold.md +3 -1
- package/dist/ai/recipes/vue/layout-scaffold.md +3 -1
- package/dist/ai/source/BbAlert.md +16 -4
- package/dist/ai/source/BbAvatar.md +2 -0
- package/dist/ai/source/BbBreadcrumbs.md +4 -1
- package/dist/ai/source/BbCalendar.md +22 -12
- package/dist/ai/source/BbColorPalette.md +41 -12
- package/dist/ai/source/BbConfirm.md +7 -0
- package/dist/ai/source/BbConfirmPortal.md +9 -4
- package/dist/ai/source/BbDatePicker.md +53 -22
- package/dist/ai/source/BbDatePickerInput.md +32 -8
- package/dist/ai/source/BbDialog.md +31 -1
- package/dist/ai/source/BbDropdown.md +52 -24
- package/dist/ai/source/BbDropdownGroup.md +17 -21
- package/dist/ai/source/BbForm.md +73 -6
- package/dist/ai/source/BbHoverCard.md +7 -0
- package/dist/ai/source/BbHoverCardPortal.md +9 -5
- package/dist/ai/source/BbNumberInput.md +5 -6
- package/dist/ai/source/BbOffCanvas.md +34 -1
- package/dist/ai/source/BbPopover.md +7 -0
- package/dist/ai/source/BbPopoverPortal.md +9 -5
- package/dist/ai/source/BbRadio.md +4 -3
- package/dist/ai/source/BbRadioGroup.md +7 -5
- package/dist/ai/source/BbTable.md +54 -6
- package/dist/ai/source/BbTag.md +10 -3
- package/dist/ai/source/BbTimePicker.md +50 -15
- package/dist/ai/source/BbTimePickerInput.md +30 -7
- package/dist/ai/source/BbToast.md +14 -0
- package/dist/ai/source/BbToastPortal.md +16 -4
- package/dist/ai/source/CommonFieldInput.md +11 -5
- package/dist/ai/source/CommonPopover.md +4 -1
- package/dist/components/BbAlert/BbAlert.vue_vue_type_script_setup_true_lang.js +31 -26
- package/dist/components/BbBreadcrumbs/BbBreadcrumbs.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbCalendar/BbCalendar.vue.d.ts +1 -1
- package/dist/components/BbCalendar/BbCalendar.vue_vue_type_script_setup_true_lang.js +235 -234
- package/dist/components/BbCalendar/types.d.ts +2 -2
- package/dist/components/BbCalendar/useDayjsLocale.js +11 -8
- package/dist/components/BbColorPalette/BbColorPalette.vue_vue_type_script_setup_true_lang.js +197 -192
- package/dist/components/BbColorPalette/types.d.ts +1 -1
- package/dist/components/BbConfirm/BbConfirmPortal.vue.d.ts +2 -4
- package/dist/components/BbConfirm/types.d.ts +5 -0
- package/dist/components/BbDatePicker/BbDatePicker.vue.d.ts +1 -1
- package/dist/components/BbDatePicker/BbDatePicker.vue_vue_type_script_setup_true_lang.js +145 -139
- package/dist/components/BbDatePicker/types.d.ts +2 -2
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue_vue_type_script_setup_true_lang.js +337 -335
- package/dist/components/BbDialog/BbDialog.vue_vue_type_script_setup_true_lang.js +253 -245
- package/dist/components/BbDialog/leaveGhost.js +33 -0
- package/dist/components/BbDialog/overlayActions.js +34 -20
- package/dist/components/BbDropdown/BbDropdown.vue_vue_type_script_setup_true_lang.js +11 -3
- package/dist/components/BbDropdown/BbDropdownList.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/BbDropdown/DropdownPipelineResolver.vue_vue_type_script_setup_true_lang.js +119 -120
- package/dist/components/BbDropdown/types.d.ts +8 -17
- package/dist/components/BbForm/BbForm.vue.d.ts +2 -21
- package/dist/components/BbForm/BbForm.vue_vue_type_script_setup_true_lang.js +229 -227
- package/dist/components/BbForm/types.d.ts +31 -0
- package/dist/components/BbHoverCard/BbHoverCardPortal.vue.d.ts +2 -5
- package/dist/components/BbHoverCard/types.d.ts +5 -0
- package/dist/components/BbNumberInput/BbNumberInput.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbNumberInput/numberDisplay.js +102 -106
- package/dist/components/BbNumberInput/types.d.ts +4 -3
- package/dist/components/BbOffCanvas/BbOffCanvas.vue_vue_type_script_setup_true_lang.js +385 -377
- package/dist/components/BbPopover/BbPopoverPortal.vue.d.ts +2 -5
- package/dist/components/BbPopover/types.d.ts +5 -0
- package/dist/components/BbRadio/types.d.ts +4 -3
- package/dist/components/BbRadioGroup/BbRadioGroup.vue_vue_type_script_setup_true_lang.js +10 -12
- package/dist/components/BbTable/BbTable.vue_vue_type_script_setup_true_lang.js +231 -231
- package/dist/components/BbTable/BbTableDataRow.js +96 -96
- package/dist/components/BbTag/BbTag.vue_vue_type_script_setup_true_lang.js +9 -3
- package/dist/components/BbTimePicker/BbTimePicker.vue.d.ts +1 -1
- package/dist/components/BbTimePicker/BbTimePicker.vue_vue_type_script_setup_true_lang.js +106 -100
- package/dist/components/BbTimePicker/types.d.ts +2 -2
- package/dist/components/BbTimePickerInput/BbTimePickerInput.vue_vue_type_script_setup_true_lang.js +214 -213
- package/dist/components/BbToast/BbToastPortal.vue.d.ts +2 -4
- package/dist/components/BbToast/types.d.ts +5 -0
- package/dist/components/CommonFieldInput/CommonFieldInput.vue_vue_type_script_setup_true_lang.js +36 -36
- package/dist/components/CommonPopover/CommonPopover.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/CommonTimeSelector/useMeridiem.js +6 -6
- package/dist/composables/formSubmitLock.js +2 -1
- package/dist/composables/overlayRegistry.js +52 -42
- package/dist/composables/useActiveInactiveState.js +8 -4
- package/dist/composables/useBbDialog.js +5 -5
- package/dist/composables/useOwnModel.js +16 -0
- package/dist/composables/useSegmentedFields.js +31 -20
- package/dist/i18n/currencyDigits.js +58 -0
- package/dist/i18n/regionDates.js +250 -0
- package/dist/i18n/regionHints.js +30 -41
- package/dist/index.d.ts +34 -30
- package/dist/llms-full.txt +860 -129
- package/dist/llms.txt +3 -1
- package/dist/styles.css +2 -2
- package/dist/types/ActionButton.d.ts +3 -1
- package/dist/types/CommonProps.d.ts +8 -0
- package/dist/utilities/functions/hash.js +97 -64
- package/dist/utilities/functions/isEqual.js +33 -25
- package/dist/utils/versionCheck.js +1 -1
- package/dist/vite-plugin.d.ts +2 -1
- package/dist/vite.js +8 -4
- package/llms.txt +3 -1
- package/package.json +1 -2
- package/scripts/README.md +1 -1
- package/scripts/lib/adoption-checklist.json +6 -5
- package/scripts/lib/agent-manifest.mjs +33 -6
- package/scripts/lib/agent-setup.mjs +54 -6
- package/scripts/lib/cldr-pins.ts +182 -0
- package/scripts/lib/engines-include.d.mts +5 -0
- package/scripts/lib/engines-include.mjs +40 -0
- package/scripts/lib/eslint-plugin.mjs +8 -2
- package/scripts/lib/hidden-label-placeholder.mjs +25 -5
- package/scripts/lib/idiom-scan.mjs +30 -3
- package/scripts/lib/legacy-agent-files.json +152 -0
- package/scripts/lib/mcp-config.mjs +74 -7
- package/scripts/lib/portal-names.mjs +78 -8
- package/scripts/lib/release-results.mjs +5 -2
- package/scripts/lib/report.mjs +340 -0
- package/scripts/lib/run-beat.mjs +14 -0
- package/scripts/lib/run-records.mjs +313 -0
- package/scripts/lib/selector-log.mjs +98 -0
- package/scripts/lib/ticket-beat.mjs +30 -0
- package/scripts/lib/validate-bb-markup.mjs +17 -2
|
@@ -1615,7 +1615,28 @@ const onOutsideInteraction = (event: Event) => {
|
|
|
1615
1615
|
) {
|
|
1616
1616
|
return;
|
|
1617
1617
|
}
|
|
1618
|
+
// Heard in the capture phase: the activator's own click
|
|
1619
|
+
// toggles the menu itself.
|
|
1620
|
+
if (event.type !== 'focusin' && activator.value?.contains(target)) return;
|
|
1618
1621
|
closeDropdown();
|
|
1622
|
+
/*
|
|
1623
|
+
* a click on something that takes no focus, inside the
|
|
1624
|
+
* dialog or off-canvas around the menu, parks focus on that surface: hand
|
|
1625
|
+
* it back to the activator, as Escape does. A click on a field or a
|
|
1626
|
+
* button keeps the focus it gave; one on the page (focus on the body)
|
|
1627
|
+
* stays as the browser left it.
|
|
1628
|
+
*/
|
|
1629
|
+
if (event.type === 'focusin') return;
|
|
1630
|
+
const active = document.activeElement;
|
|
1631
|
+
const el = activator.value;
|
|
1632
|
+
if (
|
|
1633
|
+
el?.isConnected &&
|
|
1634
|
+
active &&
|
|
1635
|
+
active !== document.body &&
|
|
1636
|
+
active !== el &&
|
|
1637
|
+
active.contains(el)
|
|
1638
|
+
)
|
|
1639
|
+
el.focus({ preventScroll: true });
|
|
1619
1640
|
};
|
|
1620
1641
|
|
|
1621
1642
|
/**
|
|
@@ -1687,9 +1708,16 @@ const openDropdown = async () => {
|
|
|
1687
1708
|
`[data-bb-dropdown-surface="${CSS.escape(String(id))}"]`
|
|
1688
1709
|
),
|
|
1689
1710
|
});
|
|
1690
|
-
|
|
1711
|
+
// Capture: a dialog or off-canvas around the menu stops
|
|
1712
|
+
// `click` at its root (overlaySurfaceIsolation), so a click elsewhere in it
|
|
1713
|
+
// never bubbles to the document.
|
|
1714
|
+
document.addEventListener('click', onOutsideInteraction, {
|
|
1715
|
+
passive: true,
|
|
1716
|
+
capture: true,
|
|
1717
|
+
});
|
|
1691
1718
|
document.addEventListener('contextmenu', onOutsideInteraction, {
|
|
1692
1719
|
passive: true,
|
|
1720
|
+
capture: true,
|
|
1693
1721
|
});
|
|
1694
1722
|
document.addEventListener('focusin', onOutsideInteraction, { passive: true });
|
|
1695
1723
|
document.addEventListener('keydown', onEsc, { capture: true });
|
|
@@ -1723,8 +1751,12 @@ registerDropdownHandle({
|
|
|
1723
1751
|
|
|
1724
1752
|
const removeDocumentListeners = () => {
|
|
1725
1753
|
removeEscapeEntry(escapeKey);
|
|
1726
|
-
document.removeEventListener('click', onOutsideInteraction
|
|
1727
|
-
|
|
1754
|
+
document.removeEventListener('click', onOutsideInteraction, {
|
|
1755
|
+
capture: true,
|
|
1756
|
+
});
|
|
1757
|
+
document.removeEventListener('contextmenu', onOutsideInteraction, {
|
|
1758
|
+
capture: true,
|
|
1759
|
+
});
|
|
1728
1760
|
document.removeEventListener('focusin', onOutsideInteraction);
|
|
1729
1761
|
document.removeEventListener('keydown', onEsc, { capture: true });
|
|
1730
1762
|
document.removeEventListener(DROPDOWN_OPEN_EVENT, onPeerOpen);
|
|
@@ -2110,18 +2142,12 @@ export type InternalItem = Omit<
|
|
|
2110
2142
|
* async items load (`'loading'`), when it resolved empty (`'empty'`), or
|
|
2111
2143
|
* when its latest load FAILED (`'failed'`: the footer under whatever rows a
|
|
2112
2144
|
* `stash` keeps listed). Rendered as a non-interactive row that
|
|
2113
|
-
* shows `label` or, when provided, the dropdown's `loading` / `empty` slot
|
|
2145
|
+
* shows `label` or, when provided, the dropdown's `loading` / `empty` slot (a
|
|
2146
|
+
* `'failed'` row always shows its own).
|
|
2114
2147
|
*
|
|
2115
2148
|
* @internal Set by `BbDropdownGroup`.
|
|
2116
2149
|
*/
|
|
2117
2150
|
placeholder?: 'loading' | 'empty' | 'failed';
|
|
2118
|
-
/**
|
|
2119
|
-
* On a `'failed'` placeholder: what the group's `items` load rejected
|
|
2120
|
-
* with, handed to the `empty` slot as `error`.
|
|
2121
|
-
*
|
|
2122
|
-
* @internal Set by the pipeline resolver.
|
|
2123
|
-
*/
|
|
2124
|
-
error?: unknown;
|
|
2125
2151
|
/**
|
|
2126
2152
|
* Marks a row built by the pipeline resolver from a fetched item. Its
|
|
2127
2153
|
* `selectable` predicate already ran against the RAW item there, so
|
|
@@ -2170,7 +2196,9 @@ export type InternalItem = Omit<
|
|
|
2170
2196
|
* `failedText` with the error. Zero-argument providers keep working. An
|
|
2171
2197
|
* unannotated getter reads its context typed (`query` a string on a
|
|
2172
2198
|
* `searchable` group); a provider shared with other components is annotated
|
|
2173
|
-
* `BbDropdownGroupItemsContext`.
|
|
2199
|
+
* `BbDropdownGroupItemsContext`. A group whose `searchable` is a runtime
|
|
2200
|
+
* boolean takes rows or such a provider; a value typed as this union does
|
|
2201
|
+
* not fit it (its query-only member needs `searchable: true`).
|
|
2174
2202
|
*/
|
|
2175
2203
|
export type DropdownGroupItemsGetter = PlainGetter | SearchGetter;
|
|
2176
2204
|
|
|
@@ -3082,14 +3110,8 @@ export type BbDropdownPlaceholderSlotProps = {
|
|
|
3082
3110
|
* e.g. for "Type at least 2 characters" under a remote search's minimum.
|
|
3083
3111
|
*/
|
|
3084
3112
|
query: string;
|
|
3085
|
-
/** Resolved placeholder text (group `loadingText`/`emptyText
|
|
3113
|
+
/** Resolved placeholder text (group `loadingText`/`emptyText` → dropdown default). */
|
|
3086
3114
|
text: string;
|
|
3087
|
-
/**
|
|
3088
|
-
* `empty` slot only: what the group's latest failed `items` load rejected
|
|
3089
|
-
* with, untouched (a nullish rejection becomes an `Error`); `null` when the
|
|
3090
|
-
* group is genuinely empty. Absent on the `loading` slot.
|
|
3091
|
-
*/
|
|
3092
|
-
error?: unknown;
|
|
3093
3115
|
};
|
|
3094
3116
|
|
|
3095
3117
|
/**
|
|
@@ -3125,7 +3147,8 @@ export type BbDropdownSlots = {
|
|
|
3125
3147
|
loading?: (props: BbDropdownPlaceholderSlotProps) => any;
|
|
3126
3148
|
/**
|
|
3127
3149
|
* Replaces the default "no data" placeholder row shown in a pipeline group
|
|
3128
|
-
* that resolved to no items. Rendered once per empty group.
|
|
3150
|
+
* that resolved to no items. Rendered once per empty group. A failed load
|
|
3151
|
+
* is not empty: it keeps its own row (the error icon and `failedText`).
|
|
3129
3152
|
*/
|
|
3130
3153
|
empty?: (props: BbDropdownPlaceholderSlotProps) => any;
|
|
3131
3154
|
/**
|
|
@@ -3697,10 +3720,12 @@ export type BbDropdownGroupEvents = {
|
|
|
3697
3720
|
* append icon were present. Absolute + pad-only-when-selected lets
|
|
3698
3721
|
* unselected labels use the full row.
|
|
3699
3722
|
*/
|
|
3723
|
+
/* sized by the `--icon-size` knob, like the row's
|
|
3724
|
+
icons: a 14px-icon menu gets a 14px check and a matching clearance. */
|
|
3700
3725
|
.item__check {
|
|
3701
|
-
--size:
|
|
3726
|
+
--size: var(--icon-size);
|
|
3702
3727
|
color: var(--bb-text);
|
|
3703
|
-
font-size:
|
|
3728
|
+
font-size: calc(var(--icon-size) - 1px);
|
|
3704
3729
|
inset-inline-end: 6px;
|
|
3705
3730
|
pointer-events: none;
|
|
3706
3731
|
position: absolute;
|
|
@@ -3717,7 +3742,7 @@ export type BbDropdownGroupEvents = {
|
|
|
3717
3742
|
|
|
3718
3743
|
&.bb-dropdown__item--selected {
|
|
3719
3744
|
/* Keep the label clear of the absolute check. */
|
|
3720
|
-
padding-inline-end: calc(6px +
|
|
3745
|
+
padding-inline-end: calc(6px + var(--check-w, var(--icon-size)) + 4px);
|
|
3721
3746
|
|
|
3722
3747
|
.item__check path {
|
|
3723
3748
|
stroke-dashoffset: 0;
|
|
@@ -3800,6 +3825,9 @@ export type BbDropdownGroupEvents = {
|
|
|
3800
3825
|
and passed it again. Tied to the same constant, a title can no longer end
|
|
3801
3826
|
up smaller than the list beneath it whatever that constant becomes. */
|
|
3802
3827
|
--dialog-title-fs: var(--sheet-option-fs, 1rem);
|
|
3828
|
+
/* The sheet reads no `--icon-size` (its rows size their own glyphs): the
|
|
3829
|
+
check's clearance stays 16px whatever the menu sets. */
|
|
3830
|
+
--check-w: 16px;
|
|
3803
3831
|
|
|
3804
3832
|
/* Root sheet title via `offCanvasProps.title` (no drill nav / custom
|
|
3805
3833
|
`#header`): centre it and tighten the title→divider air like BbSelect.
|
|
@@ -4186,6 +4214,6 @@ export type BbDropdownGroupEvents = {
|
|
|
4186
4214
|
* both apply they agree, so nothing shifts on selection.
|
|
4187
4215
|
*/
|
|
4188
4216
|
.bb-dropdown__panel--reserve-check .bb-dropdown__item:has(.item__check) {
|
|
4189
|
-
padding-inline-end: calc(6px +
|
|
4217
|
+
padding-inline-end: calc(6px + var(--check-w, var(--icon-size)) + 4px);
|
|
4190
4218
|
}
|
|
4191
4219
|
```
|
|
@@ -447,18 +447,12 @@ export type InternalItem = Omit<
|
|
|
447
447
|
* async items load (`'loading'`), when it resolved empty (`'empty'`), or
|
|
448
448
|
* when its latest load FAILED (`'failed'`: the footer under whatever rows a
|
|
449
449
|
* `stash` keeps listed). Rendered as a non-interactive row that
|
|
450
|
-
* shows `label` or, when provided, the dropdown's `loading` / `empty` slot
|
|
450
|
+
* shows `label` or, when provided, the dropdown's `loading` / `empty` slot (a
|
|
451
|
+
* `'failed'` row always shows its own).
|
|
451
452
|
*
|
|
452
453
|
* @internal Set by `BbDropdownGroup`.
|
|
453
454
|
*/
|
|
454
455
|
placeholder?: 'loading' | 'empty' | 'failed';
|
|
455
|
-
/**
|
|
456
|
-
* On a `'failed'` placeholder: what the group's `items` load rejected
|
|
457
|
-
* with, handed to the `empty` slot as `error`.
|
|
458
|
-
*
|
|
459
|
-
* @internal Set by the pipeline resolver.
|
|
460
|
-
*/
|
|
461
|
-
error?: unknown;
|
|
462
456
|
/**
|
|
463
457
|
* Marks a row built by the pipeline resolver from a fetched item. Its
|
|
464
458
|
* `selectable` predicate already ran against the RAW item there, so
|
|
@@ -507,7 +501,9 @@ export type InternalItem = Omit<
|
|
|
507
501
|
* `failedText` with the error. Zero-argument providers keep working. An
|
|
508
502
|
* unannotated getter reads its context typed (`query` a string on a
|
|
509
503
|
* `searchable` group); a provider shared with other components is annotated
|
|
510
|
-
* `BbDropdownGroupItemsContext`.
|
|
504
|
+
* `BbDropdownGroupItemsContext`. A group whose `searchable` is a runtime
|
|
505
|
+
* boolean takes rows or such a provider; a value typed as this union does
|
|
506
|
+
* not fit it (its query-only member needs `searchable: true`).
|
|
511
507
|
*/
|
|
512
508
|
export type DropdownGroupItemsGetter = PlainGetter | SearchGetter;
|
|
513
509
|
|
|
@@ -1419,14 +1415,8 @@ export type BbDropdownPlaceholderSlotProps = {
|
|
|
1419
1415
|
* e.g. for "Type at least 2 characters" under a remote search's minimum.
|
|
1420
1416
|
*/
|
|
1421
1417
|
query: string;
|
|
1422
|
-
/** Resolved placeholder text (group `loadingText`/`emptyText
|
|
1418
|
+
/** Resolved placeholder text (group `loadingText`/`emptyText` → dropdown default). */
|
|
1423
1419
|
text: string;
|
|
1424
|
-
/**
|
|
1425
|
-
* `empty` slot only: what the group's latest failed `items` load rejected
|
|
1426
|
-
* with, untouched (a nullish rejection becomes an `Error`); `null` when the
|
|
1427
|
-
* group is genuinely empty. Absent on the `loading` slot.
|
|
1428
|
-
*/
|
|
1429
|
-
error?: unknown;
|
|
1430
1420
|
};
|
|
1431
1421
|
|
|
1432
1422
|
/**
|
|
@@ -1462,7 +1452,8 @@ export type BbDropdownSlots = {
|
|
|
1462
1452
|
loading?: (props: BbDropdownPlaceholderSlotProps) => any;
|
|
1463
1453
|
/**
|
|
1464
1454
|
* Replaces the default "no data" placeholder row shown in a pipeline group
|
|
1465
|
-
* that resolved to no items. Rendered once per empty group.
|
|
1455
|
+
* that resolved to no items. Rendered once per empty group. A failed load
|
|
1456
|
+
* is not empty: it keeps its own row (the error icon and `failedText`).
|
|
1466
1457
|
*/
|
|
1467
1458
|
empty?: (props: BbDropdownPlaceholderSlotProps) => any;
|
|
1468
1459
|
/**
|
|
@@ -2034,10 +2025,12 @@ export type BbDropdownGroupEvents = {
|
|
|
2034
2025
|
* append icon were present. Absolute + pad-only-when-selected lets
|
|
2035
2026
|
* unselected labels use the full row.
|
|
2036
2027
|
*/
|
|
2028
|
+
/* sized by the `--icon-size` knob, like the row's
|
|
2029
|
+
icons: a 14px-icon menu gets a 14px check and a matching clearance. */
|
|
2037
2030
|
.item__check {
|
|
2038
|
-
--size:
|
|
2031
|
+
--size: var(--icon-size);
|
|
2039
2032
|
color: var(--bb-text);
|
|
2040
|
-
font-size:
|
|
2033
|
+
font-size: calc(var(--icon-size) - 1px);
|
|
2041
2034
|
inset-inline-end: 6px;
|
|
2042
2035
|
pointer-events: none;
|
|
2043
2036
|
position: absolute;
|
|
@@ -2054,7 +2047,7 @@ export type BbDropdownGroupEvents = {
|
|
|
2054
2047
|
|
|
2055
2048
|
&.bb-dropdown__item--selected {
|
|
2056
2049
|
/* Keep the label clear of the absolute check. */
|
|
2057
|
-
padding-inline-end: calc(6px +
|
|
2050
|
+
padding-inline-end: calc(6px + var(--check-w, var(--icon-size)) + 4px);
|
|
2058
2051
|
|
|
2059
2052
|
.item__check path {
|
|
2060
2053
|
stroke-dashoffset: 0;
|
|
@@ -2137,6 +2130,9 @@ export type BbDropdownGroupEvents = {
|
|
|
2137
2130
|
and passed it again. Tied to the same constant, a title can no longer end
|
|
2138
2131
|
up smaller than the list beneath it whatever that constant becomes. */
|
|
2139
2132
|
--dialog-title-fs: var(--sheet-option-fs, 1rem);
|
|
2133
|
+
/* The sheet reads no `--icon-size` (its rows size their own glyphs): the
|
|
2134
|
+
check's clearance stays 16px whatever the menu sets. */
|
|
2135
|
+
--check-w: 16px;
|
|
2140
2136
|
|
|
2141
2137
|
/* Root sheet title via `offCanvasProps.title` (no drill nav / custom
|
|
2142
2138
|
`#header`): centre it and tighten the title→divider air like BbSelect.
|
|
@@ -2523,6 +2519,6 @@ export type BbDropdownGroupEvents = {
|
|
|
2523
2519
|
* both apply they agree, so nothing shifts on selection.
|
|
2524
2520
|
*/
|
|
2525
2521
|
.bb-dropdown__panel--reserve-check .bb-dropdown__item:has(.item__check) {
|
|
2526
|
-
padding-inline-end: calc(6px +
|
|
2522
|
+
padding-inline-end: calc(6px + var(--check-w, var(--icon-size)) + 4px);
|
|
2527
2523
|
}
|
|
2528
2524
|
```
|
package/dist/ai/source/BbForm.md
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
form's own validation still gates the submit.
|
|
28
28
|
-->
|
|
29
29
|
<form
|
|
30
|
-
:id="
|
|
30
|
+
:id="formId"
|
|
31
31
|
ref="form-el"
|
|
32
32
|
novalidate
|
|
33
33
|
@reset.prevent="resetAll()"
|
|
@@ -72,6 +72,7 @@ import {
|
|
|
72
72
|
shallowRef,
|
|
73
73
|
toRaw,
|
|
74
74
|
unref,
|
|
75
|
+
useId,
|
|
75
76
|
useTemplateRef,
|
|
76
77
|
watch,
|
|
77
78
|
} from 'vue';
|
|
@@ -92,6 +93,7 @@ import { customFieldsOf } from '@/composables/useBbFormField';
|
|
|
92
93
|
import BbFormCustomField from './BbFormCustomField';
|
|
93
94
|
import { isEqual } from '@/utilities/functions/isEqual';
|
|
94
95
|
import type { ValidationMode } from '@/types/Config';
|
|
96
|
+
import type { BbFormSlots } from './types';
|
|
95
97
|
import {
|
|
96
98
|
type BbFormInvalidPayload,
|
|
97
99
|
type BbFormSchema,
|
|
@@ -207,6 +209,8 @@ const emit = defineEmits<{
|
|
|
207
209
|
'submit-error': [error: unknown];
|
|
208
210
|
}>();
|
|
209
211
|
|
|
212
|
+
defineSlots<BbFormSlots>();
|
|
213
|
+
|
|
210
214
|
/*
|
|
211
215
|
* The two vee-validate `useForm` options BbForm adopts, passed
|
|
212
216
|
* straight through. A Standard Schema is wrapped for vee-validate on the way
|
|
@@ -803,16 +807,24 @@ provide(BB_FORM_SUBMIT_LOCK, {
|
|
|
803
807
|
});
|
|
804
808
|
// the BbDialog / BbOffCanvas around the form refuses user closes
|
|
805
809
|
// while the lock is on (so `disable-submit-lock` releases it too).
|
|
806
|
-
// Its `ok` button submits from outside the form
|
|
807
|
-
//
|
|
810
|
+
// Its `ok` button submits from outside the form: it counts as one of the
|
|
811
|
+
// form's own controls for `focusServerErrors`.
|
|
808
812
|
let overlaySubmitter: Element | undefined;
|
|
813
|
+
const internalId = useId();
|
|
809
814
|
const tellOverlay = joinOverlaySubmitGuard({
|
|
810
815
|
locked: submitLocked,
|
|
816
|
+
pending: () => savesInFlight.value > 0,
|
|
817
|
+
id: () => props.id ?? internalId,
|
|
811
818
|
submit: async (submitter) => {
|
|
812
819
|
overlaySubmitter = submitter;
|
|
813
820
|
return (await onSubmitEvent()) === true;
|
|
814
821
|
},
|
|
815
822
|
});
|
|
823
|
+
// inside a surface the `<form>` always has an id (the
|
|
824
|
+
// written one, else an internal one): its `ok` names it in `form=`.
|
|
825
|
+
const formId = computed(
|
|
826
|
+
() => props.id ?? (tellOverlay ? internalId : undefined)
|
|
827
|
+
);
|
|
816
828
|
|
|
817
829
|
type SubmitListener = (
|
|
818
830
|
values: Record<string, unknown>,
|
|
@@ -914,7 +926,7 @@ const runSubmitListeners = (
|
|
|
914
926
|
}
|
|
915
927
|
}
|
|
916
928
|
if (!listeners.length) {
|
|
917
|
-
tellOverlay({ value: undefined, values: formValues });
|
|
929
|
+
tellOverlay?.({ value: undefined, values: formValues });
|
|
918
930
|
return true;
|
|
919
931
|
}
|
|
920
932
|
|
|
@@ -954,7 +966,7 @@ const runSubmitListeners = (
|
|
|
954
966
|
// Await only what is actually awaitable, so a sync handler keeps the exact
|
|
955
967
|
// timing it has today rather than being pushed a microtask later.
|
|
956
968
|
if (!pending.length) {
|
|
957
|
-
tellOverlay(outcome());
|
|
969
|
+
tellOverlay?.(outcome());
|
|
958
970
|
return !failed;
|
|
959
971
|
}
|
|
960
972
|
// the form locks for exactly as long as the save runs. Its own
|
|
@@ -969,7 +981,7 @@ const runSubmitListeners = (
|
|
|
969
981
|
countSave(submitter, -1);
|
|
970
982
|
})
|
|
971
983
|
.then(() => {
|
|
972
|
-
tellOverlay(outcome());
|
|
984
|
+
tellOverlay?.(outcome());
|
|
973
985
|
return !failed;
|
|
974
986
|
});
|
|
975
987
|
};
|
|
@@ -1256,6 +1268,15 @@ const removeField = (path: string): void => {
|
|
|
1256
1268
|
* errors.
|
|
1257
1269
|
*/
|
|
1258
1270
|
const onSubmitEvent = (event?: Event) => {
|
|
1271
|
+
/*
|
|
1272
|
+
* a submit while a save is pending is
|
|
1273
|
+
* dropped, neither queued nor a second save (Enter, a submit button,
|
|
1274
|
+
* `submit()`, the dialog's `ok`): it did not go through. The lock or not.
|
|
1275
|
+
*/
|
|
1276
|
+
if (savesInFlight.value > 0) {
|
|
1277
|
+
event?.preventDefault();
|
|
1278
|
+
return Promise.resolve(false);
|
|
1279
|
+
}
|
|
1259
1280
|
unmatchedErrors.value = {};
|
|
1260
1281
|
return onSubmit(event);
|
|
1261
1282
|
};
|
|
@@ -1329,3 +1350,49 @@ const publishContext = useBbFormHost(() => props.id, {
|
|
|
1329
1350
|
defineExpose({ $el: formEl });
|
|
1330
1351
|
</script>
|
|
1331
1352
|
```
|
|
1353
|
+
|
|
1354
|
+
## Types
|
|
1355
|
+
|
|
1356
|
+
```ts
|
|
1357
|
+
import type { FormContext, FormMeta, GenericObject } from 'vee-validate';
|
|
1358
|
+
import type {
|
|
1359
|
+
BbFormFieldEntry,
|
|
1360
|
+
BbFormServerErrors,
|
|
1361
|
+
BbFormSetErrorsOptions,
|
|
1362
|
+
} from '@/composables/useBbForm';
|
|
1363
|
+
|
|
1364
|
+
/** BbForm's slots; index it for one slot's type: `BbFormSlots['default']`. */
|
|
1365
|
+
export type BbFormSlots = {
|
|
1366
|
+
/**
|
|
1367
|
+
* The form's fields, with its state and actions in scope: the meta
|
|
1368
|
+
* (`valid`, `dirty`…), `values`, `errors`, `fields`, `unmatchedErrors`,
|
|
1369
|
+
* `isSubmitting`, `submitCount`, `validate`, `resetForm`, `setErrors`,
|
|
1370
|
+
* `snapshot`, `removeField`.
|
|
1371
|
+
*/
|
|
1372
|
+
default?: (
|
|
1373
|
+
scope: FormMeta<GenericObject> & {
|
|
1374
|
+
/** Each field's messages, by name. */
|
|
1375
|
+
errors: Record<string, string[]>;
|
|
1376
|
+
/** Each mounted field, by name. */
|
|
1377
|
+
fields: Record<string, BbFormFieldEntry>;
|
|
1378
|
+
isSubmitting: boolean;
|
|
1379
|
+
/** Drops a path and everything under it from the values, for good. */
|
|
1380
|
+
removeField: (path: string) => void;
|
|
1381
|
+
/** Back to the baseline (or to the state passed). */
|
|
1382
|
+
resetForm: FormContext['resetForm'];
|
|
1383
|
+
/** Lands server errors on their fields. */
|
|
1384
|
+
setErrors: (
|
|
1385
|
+
errors: BbFormServerErrors,
|
|
1386
|
+
options?: BbFormSetErrorsOptions
|
|
1387
|
+
) => void;
|
|
1388
|
+
/** Makes the current values (merged with `next`) the dirty baseline. */
|
|
1389
|
+
snapshot: (next?: Record<string, unknown>) => void;
|
|
1390
|
+
submitCount: number;
|
|
1391
|
+
/** Server errors no mounted field shows, by path. */
|
|
1392
|
+
unmatchedErrors: Record<string, string[]>;
|
|
1393
|
+
validate: FormContext['validate'];
|
|
1394
|
+
values: GenericObject;
|
|
1395
|
+
}
|
|
1396
|
+
) => unknown;
|
|
1397
|
+
};
|
|
1398
|
+
```
|
|
@@ -945,6 +945,13 @@ export type BbHoverCardPortalSlotProps<P = any> = {
|
|
|
945
945
|
/** Closes the card. */
|
|
946
946
|
close: () => void;
|
|
947
947
|
};
|
|
948
|
+
|
|
949
|
+
/** BbHoverCardPortal's slots; index it for one slot's type: `BbHoverCardPortalSlots<MyData>['default']`. */
|
|
950
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- `P` defaults to `any` as on BbHoverCardPortalSlotProps
|
|
951
|
+
export type BbHoverCardPortalSlots<P = any> = {
|
|
952
|
+
/** The card's body. `data` is the directive's `data`; `close` closes the card. */
|
|
953
|
+
default?: (scope: BbHoverCardPortalSlotProps<P>) => any;
|
|
954
|
+
};
|
|
948
955
|
```
|
|
949
956
|
|
|
950
957
|
## Styles
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<template><!-- registers content; renders nothing of its own --></template>
|
|
9
9
|
<script setup lang="ts">
|
|
10
10
|
import { watchEffect } from 'vue';
|
|
11
|
-
import type {
|
|
11
|
+
import type { BbHoverCardPortalSlots } from './types';
|
|
12
12
|
import {
|
|
13
13
|
hoverCardPortals,
|
|
14
14
|
useDirectivePortal,
|
|
@@ -23,10 +23,7 @@ const props = defineProps<{
|
|
|
23
23
|
/** The name a `v-bb-hover-card` passes as its value (`"'name'"`) or as `portal: 'name'`. */
|
|
24
24
|
name: string;
|
|
25
25
|
}>();
|
|
26
|
-
const slots = defineSlots<
|
|
27
|
-
/** The card's body. `data` is the directive's `data`; `close` closes the card. */
|
|
28
|
-
default?: (scope: BbHoverCardPortalSlotProps) => any;
|
|
29
|
-
}>();
|
|
26
|
+
const slots = defineSlots<BbHoverCardPortalSlots>();
|
|
30
27
|
|
|
31
28
|
watchEffect(
|
|
32
29
|
useDirectivePortal(
|
|
@@ -249,6 +246,13 @@ export type BbHoverCardPortalSlotProps<P = any> = {
|
|
|
249
246
|
/** Closes the card. */
|
|
250
247
|
close: () => void;
|
|
251
248
|
};
|
|
249
|
+
|
|
250
|
+
/** BbHoverCardPortal's slots; index it for one slot's type: `BbHoverCardPortalSlots<MyData>['default']`. */
|
|
251
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- `P` defaults to `any` as on BbHoverCardPortalSlotProps
|
|
252
|
+
export type BbHoverCardPortalSlots<P = any> = {
|
|
253
|
+
/** The card's body. `data` is the directive's `data`; `close` closes the card. */
|
|
254
|
+
default?: (scope: BbHoverCardPortalSlotProps<P>) => any;
|
|
255
|
+
};
|
|
252
256
|
```
|
|
253
257
|
|
|
254
258
|
## Styles
|
|
@@ -337,9 +337,7 @@ const affix = computed(() =>
|
|
|
337
337
|
);
|
|
338
338
|
/** The currency's own fraction digits (2 for EUR, 0 for JPY); `null` without one. */
|
|
339
339
|
const currencyDigits = computed(() =>
|
|
340
|
-
affix.value?.kind === 'currency'
|
|
341
|
-
? currencyDigitsOf(affix.value.code, affix.value.tag)
|
|
342
|
-
: null
|
|
340
|
+
affix.value?.kind === 'currency' ? currencyDigitsOf(affix.value.code) : null
|
|
343
341
|
);
|
|
344
342
|
/** An explicit prop wins; else the currency's digits; else 8 (and at least `minPrecision`). */
|
|
345
343
|
const maxPrecision = computed(
|
|
@@ -1688,9 +1686,10 @@ export type BbNumberInputProps = BbNumberInputPtProps & {
|
|
|
1688
1686
|
max?: number;
|
|
1689
1687
|
|
|
1690
1688
|
/**
|
|
1691
|
-
* Maximum
|
|
1692
|
-
*
|
|
1693
|
-
*
|
|
1689
|
+
* Maximum fraction digits the user can TYPE (more are refused, never
|
|
1690
|
+
* rounded); a model with more still shows them all. With `currency`, the
|
|
1691
|
+
* currency's own digits (`2` EUR, `0` JPY and HUF, `3` KWD), or
|
|
1692
|
+
* `minPrecision` when that is larger.
|
|
1694
1693
|
*
|
|
1695
1694
|
* @defaultValue `8`
|
|
1696
1695
|
*/
|
|
@@ -239,6 +239,11 @@ import { useUntil } from '../../composables/useUntil';
|
|
|
239
239
|
import { removedPropsFor } from '@/deprecation/removedProps';
|
|
240
240
|
import { warnRemovedAttrs } from '@/utilities/functions/warnRemovedAttrs';
|
|
241
241
|
import { wait } from '@/utilities/functions/wait';
|
|
242
|
+
import {
|
|
243
|
+
leaveAsGhost,
|
|
244
|
+
surfaceGone,
|
|
245
|
+
surfaceShown,
|
|
246
|
+
} from '../BbDialog/leaveGhost';
|
|
242
247
|
import { animationsSettled } from '@/utilities/functions/animationsSettled';
|
|
243
248
|
import { transitions } from '@/utilities/misc/transitions';
|
|
244
249
|
import { pageText } from '@/utilities/misc/pageText';
|
|
@@ -448,6 +453,7 @@ const footerActions = useOverlayActions({
|
|
|
448
453
|
complete: overlay.complete,
|
|
449
454
|
data: () => overlay.data.value,
|
|
450
455
|
close: () => requestClose(),
|
|
456
|
+
closeLocked: () => isLocked.value,
|
|
451
457
|
block: 'bb-offcanvas',
|
|
452
458
|
});
|
|
453
459
|
const FooterActions = () => footerActions.render();
|
|
@@ -618,6 +624,10 @@ const handleKeyDown = (e: KeyboardEvent) => {
|
|
|
618
624
|
// (CommonPopover/floating-text.css), read at each open.
|
|
619
625
|
const pageStyle = ref<Record<string, string>>();
|
|
620
626
|
let releaseTopLayer: (() => void) | null = null;
|
|
627
|
+
/** When the current close started, `null` while open. */
|
|
628
|
+
let closingSince: number | null = null;
|
|
629
|
+
/** What had focus when it opened. */
|
|
630
|
+
let opener: Element | null = null;
|
|
621
631
|
const toggleDialog = async (value: boolean) => {
|
|
622
632
|
if (value) {
|
|
623
633
|
side.value = resolveOpeningSide();
|
|
@@ -630,7 +640,12 @@ const toggleDialog = async (value: boolean) => {
|
|
|
630
640
|
// Guard against double-open: a reopen during the close transition (below)
|
|
631
641
|
// resumes here while still natively open, and showModal() throws on an
|
|
632
642
|
// already-open dialog. enterStack/registerTopLayerHost dedupe.
|
|
633
|
-
if (dialog.value && !dialog.value.open)
|
|
643
|
+
if (dialog.value && !dialog.value.open) {
|
|
644
|
+
opener = document.activeElement;
|
|
645
|
+
dialog.value.showModal();
|
|
646
|
+
}
|
|
647
|
+
closingSince = null;
|
|
648
|
+
surfaceShown(stackId);
|
|
634
649
|
// Register after showModal so the panel can be measured at full size.
|
|
635
650
|
enterStack();
|
|
636
651
|
setClosing(stackId, false);
|
|
@@ -647,6 +662,7 @@ const toggleDialog = async (value: boolean) => {
|
|
|
647
662
|
} else {
|
|
648
663
|
// the opening's result, the object its promise settles with.
|
|
649
664
|
emit('hide', overlay.closingResult());
|
|
665
|
+
closingSince = performance.now();
|
|
650
666
|
// Leave the stack NOW, not after the slide-out. The parents' push offsets
|
|
651
667
|
// derive from the stack registry, so releasing it here lets them slide
|
|
652
668
|
// back in lockstep with this panel leaving — instead of staying pushed
|
|
@@ -664,6 +680,7 @@ const toggleDialog = async (value: boolean) => {
|
|
|
664
680
|
if (currentOpenedTimes !== openedTimes.value) return;
|
|
665
681
|
removeEscapeListener();
|
|
666
682
|
dialog.value?.close();
|
|
683
|
+
surfaceGone(stackId);
|
|
667
684
|
// Release the top-layer host only after close(): releasing at close-start
|
|
668
685
|
// would re-home body toasts under a still-modal panel, freezing them for
|
|
669
686
|
// the whole transition.
|
|
@@ -731,6 +748,14 @@ onBeforeUnmount(() => {
|
|
|
731
748
|
// Torn down while open (a route change, a `v-if`): close natively so the
|
|
732
749
|
// browser hands focus back to the opener, as a normal close does. Nothing
|
|
733
750
|
// listens for the native `close` event, so this emits nothing.
|
|
751
|
+
// the close still plays, on a copy (leaveGhost.ts).
|
|
752
|
+
leaveAsGhost(dialog.value, {
|
|
753
|
+
id: stackId,
|
|
754
|
+
openClass: 'bb-offcanvas--open',
|
|
755
|
+
duration: props.transitionDuration,
|
|
756
|
+
closingSince,
|
|
757
|
+
opener,
|
|
758
|
+
});
|
|
734
759
|
if (dialog.value?.open) dialog.value.close();
|
|
735
760
|
releaseTopLayer?.();
|
|
736
761
|
releaseTopLayer = null;
|
|
@@ -3104,4 +3129,12 @@ body:has(.bb-offcanvas--visible) {
|
|
|
3104
3129
|
transform: scaleY(1);
|
|
3105
3130
|
}
|
|
3106
3131
|
}
|
|
3132
|
+
|
|
3133
|
+
/* the copy that plays the close of a panel unmounted
|
|
3134
|
+
while open (BbDialog/leaveGhost.ts): its open frame as is, no entry. */
|
|
3135
|
+
.bb-offcanvas.bb-overlay-ghost,
|
|
3136
|
+
.bb-offcanvas.bb-overlay-ghost::backdrop,
|
|
3137
|
+
.bb-offcanvas.bb-overlay-ghost * {
|
|
3138
|
+
transition: none !important;
|
|
3139
|
+
}
|
|
3107
3140
|
```
|
|
@@ -1192,6 +1192,13 @@ export type BbPopoverPortalSlotProps<P = any> = {
|
|
|
1192
1192
|
/** Closes the popover. */
|
|
1193
1193
|
close: () => void;
|
|
1194
1194
|
};
|
|
1195
|
+
|
|
1196
|
+
/** BbPopoverPortal's slots; index it for one slot's type: `BbPopoverPortalSlots<MyData>['default']`. */
|
|
1197
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- `P` defaults to `any` as on BbPopoverPortalSlotProps
|
|
1198
|
+
export type BbPopoverPortalSlots<P = any> = {
|
|
1199
|
+
/** The popover body. `data` is the directive's `data`; `close` closes the popover. */
|
|
1200
|
+
default?: (scope: BbPopoverPortalSlotProps<P>) => any;
|
|
1201
|
+
};
|
|
1195
1202
|
```
|
|
1196
1203
|
|
|
1197
1204
|
## Styles
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<template><!-- registers content; renders nothing of its own --></template>
|
|
9
9
|
<script setup lang="ts">
|
|
10
10
|
import { watchEffect } from 'vue';
|
|
11
|
-
import type {
|
|
11
|
+
import type { BbPopoverPortalSlots } from './types';
|
|
12
12
|
import {
|
|
13
13
|
popoverPortals,
|
|
14
14
|
useDirectivePortal,
|
|
@@ -23,10 +23,7 @@ const props = defineProps<{
|
|
|
23
23
|
/** The name a `v-bb-popover` passes as its value (`"'name'"`) or as `portal: 'name'`. */
|
|
24
24
|
name: string;
|
|
25
25
|
}>();
|
|
26
|
-
const slots = defineSlots<
|
|
27
|
-
/** The popover body. `data` is the directive's `data`; `close` closes the popover. */
|
|
28
|
-
default?: (scope: BbPopoverPortalSlotProps) => any;
|
|
29
|
-
}>();
|
|
26
|
+
const slots = defineSlots<BbPopoverPortalSlots>();
|
|
30
27
|
|
|
31
28
|
watchEffect(
|
|
32
29
|
useDirectivePortal(
|
|
@@ -283,6 +280,13 @@ export type BbPopoverPortalSlotProps<P = any> = {
|
|
|
283
280
|
/** Closes the popover. */
|
|
284
281
|
close: () => void;
|
|
285
282
|
};
|
|
283
|
+
|
|
284
|
+
/** BbPopoverPortal's slots; index it for one slot's type: `BbPopoverPortalSlots<MyData>['default']`. */
|
|
285
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- `P` defaults to `any` as on BbPopoverPortalSlotProps
|
|
286
|
+
export type BbPopoverPortalSlots<P = any> = {
|
|
287
|
+
/** The popover body. `data` is the directive's `data`; `close` closes the popover. */
|
|
288
|
+
default?: (scope: BbPopoverPortalSlotProps<P>) => any;
|
|
289
|
+
};
|
|
286
290
|
```
|
|
287
291
|
|
|
288
292
|
## Styles
|
|
@@ -596,14 +596,15 @@ export type BbRadioIconSlotProps = {
|
|
|
596
596
|
*/
|
|
597
597
|
hasWarnings: boolean;
|
|
598
598
|
/**
|
|
599
|
-
* The `id` attribute of the underlying input
|
|
599
|
+
* The `id` attribute of the underlying input (always set: generated when
|
|
600
|
+
* no `id` is passed).
|
|
600
601
|
*/
|
|
601
|
-
id:
|
|
602
|
+
id: string;
|
|
602
603
|
/**
|
|
603
604
|
* The `name` attribute of the underlying input (the generated fallback when
|
|
604
605
|
* no `name` is passed).
|
|
605
606
|
*/
|
|
606
|
-
name:
|
|
607
|
+
name: string;
|
|
607
608
|
/**
|
|
608
609
|
* The radio value serialized to a string for form submission.
|
|
609
610
|
*/
|
|
@@ -516,10 +516,12 @@ const containerPassthrough = aliasParts(passthrough, { label: 'legend' });
|
|
|
516
516
|
/** Each row's radio input focus — the glyph's `focused` / `focusVisible`. */
|
|
517
517
|
const rowFocus = useToggleListFocus();
|
|
518
518
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
519
|
+
/** A row's input id: the field's id plus the row's hash. */
|
|
520
|
+
const rowIdIn = (option: Option, fieldId: string): string =>
|
|
521
|
+
[fieldId, option.valueHash].filter(Boolean).join('-');
|
|
522
|
+
|
|
523
|
+
const rowId = (option: Option, fieldId: string | undefined) =>
|
|
524
|
+
fieldId ? rowIdIn(option, fieldId) : undefined;
|
|
523
525
|
|
|
524
526
|
/** Every row's native radio back to its option's `selected` (rows render in option order). */
|
|
525
527
|
const syncRowsToData = () => {
|
|
@@ -632,7 +634,7 @@ const rowIconSlotProps = (
|
|
|
632
634
|
focusVisible: rowFocus.focusVisible(option.valueHash),
|
|
633
635
|
hasErrors: !!fieldHasErrors,
|
|
634
636
|
hasWarnings: Boolean(fieldHasWarnings) && !fieldHasErrors,
|
|
635
|
-
id:
|
|
637
|
+
id: rowIdIn(option, fieldId),
|
|
636
638
|
name: resolvedName.value,
|
|
637
639
|
parsedValue: toggleInputValue('radio', option.value),
|
|
638
640
|
readonly: !!props.readonly,
|