bitboss-ui 3.0.0-beta.73 → 3.0.0-beta.75
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/BbAvatar.md +86 -58
- package/dist/ai/BbBadge.md +5 -5
- package/dist/ai/BbBreadcrumbs.md +2 -2
- package/dist/ai/BbButton.md +2 -2
- package/dist/ai/BbCalendar.md +9 -5
- package/dist/ai/BbCheckboxGroup.md +5 -4
- package/dist/ai/BbColorInput.md +12 -0
- package/dist/ai/BbColorPalette.md +19 -15
- package/dist/ai/BbConfirmPortal.md +1 -1
- package/dist/ai/BbDatePicker.md +16 -3
- package/dist/ai/BbDatePickerInput.md +17 -1
- package/dist/ai/BbDialog.md +16 -4
- package/dist/ai/BbDropdown.md +175 -67
- package/dist/ai/BbDropdownButton.md +27 -8
- package/dist/ai/BbForm.md +4 -1
- package/dist/ai/BbHoverCardPortal.md +1 -1
- package/dist/ai/BbNumberInput.md +8 -4
- package/dist/ai/BbPopoverPortal.md +1 -1
- package/dist/ai/BbRadioGroup.md +4 -4
- package/dist/ai/BbSelect.md +79 -67
- package/dist/ai/BbSelectPopover.md +24 -5
- package/dist/ai/BbSwitchGroup.md +5 -4
- package/dist/ai/BbTable.md +59 -34
- package/dist/ai/BbTimePicker.md +16 -3
- package/dist/ai/BbTimePickerInput.md +15 -1
- package/dist/ai/BbToast.md +3 -2
- package/dist/ai/BbToastPortal.md +1 -1
- package/dist/ai/BbTree.md +5 -1
- package/dist/ai/CommonPopover.md +1 -0
- package/dist/ai/FlatListBox.md +1 -0
- package/dist/ai/GroupedListBox.md +1 -0
- package/dist/ai/ListBox.md +1 -0
- package/dist/ai/OptionsContainer.md +4 -4
- package/dist/ai/changelog.json +215 -6
- package/dist/ai/components.json +77 -43
- package/dist/ai/composables/useToast.md +2 -2
- package/dist/ai/design-tokens.json +60 -0
- package/dist/ai/guides/agent-contract.md +8 -4
- package/dist/ai/guides/design-tokens.md +33 -0
- package/dist/ai/guides/eslint-rules.md +1 -1
- package/dist/ai/guides/fetch-items-playbook.md +7 -11
- package/dist/ai/guides/inertia-helpers.md +613 -53
- package/dist/ai/guides/migration/adoption-checklist.md +5 -5
- package/dist/ai/guides/migration/components/bb-color-palette.md +11 -11
- package/dist/ai/guides/migration/components/bb-dropdown-button.md +1 -0
- package/dist/ai/guides/migration/components/bb-dropdown.md +1 -0
- package/dist/ai/guides/migration/components/bb-table.md +2 -1
- package/dist/ai/guides/migration/components/bb-toast.md +2 -2
- package/dist/ai/guides/migration/v2-to-v3.md +46 -5
- package/dist/ai/guides/migration/v3-beta-tooling.md +4 -0
- package/dist/ai/guides/passthrough.md +3 -3
- 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 +2 -1
- package/dist/ai/manifest/common.json +1 -0
- package/dist/ai/manifest/components/BbAlert.tree.json +1 -1
- package/dist/ai/manifest/components/BbAvatar.json +5 -2
- package/dist/ai/manifest/components/BbAvatar.tree.json +32 -2
- package/dist/ai/manifest/components/BbCalendar.json +2 -2
- package/dist/ai/manifest/components/BbCarousel.json +0 -3
- package/dist/ai/manifest/components/BbCheckboxGroup.json +2 -2
- package/dist/ai/manifest/components/BbCheckboxGroup.tree.json +2 -0
- package/dist/ai/manifest/components/BbColorInput.json +5 -2
- package/dist/ai/manifest/components/BbColorPalette.json +7 -4
- package/dist/ai/manifest/components/BbColorPalette.removed.json +1 -2
- package/dist/ai/manifest/components/BbConfirmPortal.json +1 -1
- package/dist/ai/manifest/components/BbDatePicker.json +6 -3
- package/dist/ai/manifest/components/BbDatePickerInput.json +3 -0
- package/dist/ai/manifest/components/BbDialog.tree.json +7 -1
- package/dist/ai/manifest/components/BbDropdown.json +23 -17
- package/dist/ai/manifest/components/BbDropdown.removed.json +2 -1
- package/dist/ai/manifest/components/BbDropdown.tree.json +16 -5
- package/dist/ai/manifest/components/BbDropdownButton.json +15 -9
- package/dist/ai/manifest/components/BbDropdownButton.removed.json +2 -1
- package/dist/ai/manifest/components/BbDropdownButton.tree.json +2 -0
- 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/BbOffCanvas.tree.json +2 -0
- package/dist/ai/manifest/components/BbPopover.json +1 -1
- package/dist/ai/manifest/components/BbPopoverPortal.json +1 -1
- package/dist/ai/manifest/components/BbRadioGroup.json +2 -2
- package/dist/ai/manifest/components/BbRadioGroup.tree.json +2 -0
- package/dist/ai/manifest/components/BbSelect.json +10 -7
- package/dist/ai/manifest/components/BbSelectPopover.json +7 -4
- package/dist/ai/manifest/components/BbSelectPopover.tree.json +5 -1
- package/dist/ai/manifest/components/BbSwitchGroup.json +2 -2
- package/dist/ai/manifest/components/BbSwitchGroup.tree.json +2 -0
- package/dist/ai/manifest/components/BbTable.json +6 -6
- package/dist/ai/manifest/components/BbTable.tree.json +16 -6
- package/dist/ai/manifest/components/BbTimePicker.json +7 -4
- package/dist/ai/manifest/components/BbTimePickerInput.json +5 -2
- package/dist/ai/manifest/components/BbToastPortal.json +1 -1
- package/dist/ai/manifest/components/BbTree.json +1 -1
- package/dist/ai/manifest/components/CommonPopover.json +2 -1
- package/dist/ai/manifest/components/FlatListBox.json +2 -1
- package/dist/ai/manifest/components/GroupedListBox.json +2 -1
- package/dist/ai/manifest/components/ListBox.json +2 -1
- package/dist/ai/manifest/components/OptionsContainer.json +6 -4
- package/dist/ai/manifest/index.json +2 -2
- package/dist/ai/manifest/meta.json +36 -3
- package/dist/ai/manifest/types.advanced.json +81 -80
- package/dist/ai/manifest/types.api.json +64 -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 +121 -9
- package/dist/ai/source/BbBadge.md +12 -5
- package/dist/ai/source/BbBreadcrumbs.md +56 -55
- package/dist/ai/source/BbButton.md +41 -25
- package/dist/ai/source/BbCalendar.md +22 -12
- package/dist/ai/source/BbCarousel.md +31 -28
- package/dist/ai/source/BbCheckboxGroup.md +15 -9
- package/dist/ai/source/BbColorInput.md +19 -0
- package/dist/ai/source/BbColorPalette.md +59 -12
- package/dist/ai/source/BbConfirm.md +7 -0
- package/dist/ai/source/BbConfirmPortal.md +9 -4
- package/dist/ai/source/BbDatePicker.md +71 -22
- package/dist/ai/source/BbDatePickerInput.md +72 -9
- package/dist/ai/source/BbDialog.md +45 -2
- package/dist/ai/source/BbDropdown.md +263 -63
- package/dist/ai/source/BbDropdownButton.md +27 -2
- package/dist/ai/source/BbDropdownGroup.md +121 -59
- package/dist/ai/source/BbForm.md +73 -6
- package/dist/ai/source/BbGallery.md +76 -55
- package/dist/ai/source/BbHost.md +12 -0
- package/dist/ai/source/BbHoverCard.md +7 -0
- package/dist/ai/source/BbHoverCardPortal.md +9 -5
- package/dist/ai/source/BbNumberInput.md +22 -16
- package/dist/ai/source/BbOffCanvas.md +48 -2
- 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 +19 -10
- package/dist/ai/source/BbSelect.md +35 -20
- package/dist/ai/source/BbSelectPopover.md +116 -8
- package/dist/ai/source/BbSwitchGroup.md +11 -4
- package/dist/ai/source/BbTable.md +126 -32
- package/dist/ai/source/BbTag.md +10 -3
- package/dist/ai/source/BbTimePicker.md +69 -15
- package/dist/ai/source/BbTimePickerInput.md +45 -7
- package/dist/ai/source/BbToast.md +16 -2
- package/dist/ai/source/BbToastPortal.md +18 -6
- package/dist/ai/source/BbTree.md +1 -1
- package/dist/ai/source/CommonFieldInput.md +11 -5
- package/dist/ai/source/CommonPopover.md +28 -2
- package/dist/ai/source/FlatListBox.md +26 -5
- package/dist/ai/source/GroupedListBox.md +63 -11
- package/dist/ai/source/ListBox.md +4 -0
- package/dist/ai/source/OptionsContainer.md +29 -11
- package/dist/components/BbAlert/BbAlert.vue_vue_type_script_setup_true_lang.js +31 -26
- package/dist/components/BbAvatar/BbAvatar.vue.d.ts +1 -0
- package/dist/components/BbAvatar/BbAvatar.vue_vue_type_script_setup_true_lang.js +61 -43
- package/dist/components/BbAvatar/avatarIdentity.js +25 -0
- package/dist/components/BbAvatar/ptKeys.generated.d.ts +5 -1
- package/dist/components/BbAvatar/types.d.ts +24 -5
- package/dist/components/BbAvatar/types.js +5 -1
- package/dist/components/BbBadge/BadgeBodyContent.vue_vue_type_script_setup_true_lang.js +24 -23
- package/dist/components/BbBadge/BbBadge.vue_vue_type_script_setup_true_lang.js +80 -79
- package/dist/components/BbBreadcrumbs/BbBreadcrumbs.vue_vue_type_script_setup_true_lang.js +152 -158
- package/dist/components/BbButton/BbButton.vue_vue_type_script_setup_true_lang.js +100 -85
- 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/useDayGrid.js +120 -123
- package/dist/components/BbCalendar/useDayjsLocale.js +11 -8
- package/dist/components/BbCarousel/BbCarousel.vue_vue_type_script_setup_true_lang.js +7 -7
- package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue_vue_type_script_setup_true_lang.js +126 -122
- package/dist/components/BbCheckboxGroup/types.d.ts +7 -11
- package/dist/components/BbColorInput/BbColorInput.vue.d.ts +2 -0
- package/dist/components/BbColorInput/BbColorInput.vue_vue_type_script_setup_true_lang.js +148 -141
- package/dist/components/BbColorInput/types.d.ts +7 -0
- package/dist/components/BbColorPalette/BbColorPalette.vue.d.ts +2 -0
- package/dist/components/BbColorPalette/BbColorPalette.vue_vue_type_script_setup_true_lang.js +239 -223
- package/dist/components/BbColorPalette/types.d.ts +8 -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 +4 -2
- package/dist/components/BbDatePicker/BbDatePicker.vue_vue_type_script_setup_true_lang.js +160 -143
- package/dist/components/BbDatePicker/types.d.ts +9 -2
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue.d.ts +3 -1
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue_vue_type_script_setup_true_lang.js +483 -496
- package/dist/components/BbDatePickerInput/types.d.ts +7 -0
- package/dist/components/BbDialog/BbDialog.vue_vue_type_script_setup_true_lang.js +252 -236
- package/dist/components/BbDialog/leaveGhost.js +38 -0
- package/dist/components/BbDialog/overlayActions.js +34 -20
- package/dist/components/BbDropdown/AdaptiveDropdown.vue_vue_type_script_setup_true_lang.js +92 -87
- package/dist/components/BbDropdown/BbDropdown.vue.d.ts +3 -0
- package/dist/components/BbDropdown/BbDropdown.vue_vue_type_script_setup_true_lang.js +419 -368
- package/dist/components/BbDropdown/BbDropdownList.vue_vue_type_script_setup_true_lang.js +384 -340
- package/dist/components/BbDropdown/DropdownFailures.vue.js +4 -0
- package/dist/components/BbDropdown/DropdownFailures.vue_vue_type_script_setup_true_lang.js +24 -0
- package/dist/components/BbDropdown/DropdownPipelineResolver.vue_vue_type_script_setup_true_lang.js +133 -119
- package/dist/components/BbDropdown/DropdownRow.vue_vue_type_script_setup_true_lang.js +73 -45
- package/dist/components/BbDropdown/normalizeGroups.js +6 -2
- package/dist/components/BbDropdown/ptKeys.generated.d.ts +8 -0
- package/dist/components/BbDropdown/types.d.ts +73 -58
- package/dist/components/BbDropdown/types.js +1 -0
- package/dist/components/BbDropdownButton/BbDropdownButton.vue.d.ts +2 -0
- package/dist/components/BbDropdownButton/BbDropdownButton.vue_vue_type_script_setup_true_lang.js +93 -72
- package/dist/components/BbDropdownButton/ptKeys.generated.d.ts +48 -0
- package/dist/components/BbDropdownButton/types.d.ts +13 -2
- package/dist/components/BbDropdownButton/types.js +2 -0
- 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/BbGallery/BbGallery.vue_vue_type_script_setup_true_lang.js +318 -296
- package/dist/components/BbHost/BbHost.vue_vue_type_script_setup_true_lang.js +7 -1
- 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 +10 -6
- 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 +425 -409
- 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 +108 -106
- package/dist/components/BbRadioGroup/types.d.ts +4 -7
- package/dist/components/BbSelect/BbSelect.vue.d.ts +3 -1
- package/dist/components/BbSelect/BbSelect.vue_vue_type_script_setup_true_lang.js +167 -163
- package/dist/components/BbSelect/types.d.ts +23 -20
- package/dist/components/BbSelectPopover/BbSelectPopover.vue.d.ts +3 -1
- package/dist/components/BbSelectPopover/BbSelectPopover.vue_vue_type_script_setup_true_lang.js +680 -637
- package/dist/components/BbSelectPopover/types.d.ts +10 -4
- package/dist/components/BbSwitchGroup/BbSwitchGroup.vue_vue_type_script_setup_true_lang.js +159 -155
- package/dist/components/BbSwitchGroup/types.d.ts +3 -6
- package/dist/components/BbTable/BbTable.vue.d.ts +1 -3
- package/dist/components/BbTable/BbTable.vue_vue_type_script_setup_true_lang.js +1182 -1165
- package/dist/components/BbTable/BbTableDataRow.js +96 -96
- package/dist/components/BbTable/types.d.ts +11 -10
- package/dist/components/BbTag/BbTag.vue_vue_type_script_setup_true_lang.js +9 -3
- package/dist/components/BbTimePicker/BbTimePicker.vue.d.ts +4 -2
- package/dist/components/BbTimePicker/BbTimePicker.vue_vue_type_script_setup_true_lang.js +157 -140
- package/dist/components/BbTimePicker/types.d.ts +9 -2
- package/dist/components/BbTimePickerInput/BbTimePickerInput.vue.d.ts +3 -1
- package/dist/components/BbTimePickerInput/BbTimePickerInput.vue_vue_type_script_setup_true_lang.js +278 -268
- package/dist/components/BbTimePickerInput/types.d.ts +7 -0
- package/dist/components/BbToast/BbToastMessage.vue_vue_type_script_setup_true_lang.js +12 -12
- package/dist/components/BbToast/BbToastPortal.vue.d.ts +2 -4
- package/dist/components/BbToast/types.d.ts +7 -2
- package/dist/components/BbTree/BbTreeLevel.vue_vue_type_script_setup_true_lang.js +56 -46
- package/dist/components/BbTree/types.d.ts +1 -1
- 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 +14 -2
- package/dist/components/CommonTimeSelector/useMeridiem.js +6 -6
- package/dist/components/FlatListBox/FlatListBox.vue_vue_type_script_setup_true_lang.js +115 -96
- package/dist/components/GroupedListBox/GroupedListBox.vue_vue_type_script_setup_true_lang.js +194 -166
- package/dist/components/ListBox/ListBox.vue_vue_type_script_setup_true_lang.js +7 -4
- package/dist/components/OptionsContainer/OptionsContainer.vue_vue_type_script_setup_true_lang.js +86 -77
- 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/useItemsGetter.js +34 -32
- package/dist/composables/useOpenModel.js +20 -0
- package/dist/composables/useOwnModel.js +16 -0
- package/dist/composables/useSegmentedFields.js +31 -20
- package/dist/deprecation/ai-deprecations.json.js +1 -1
- package/dist/i18n/currencyDigits.js +58 -0
- package/dist/i18n/locales/ar.json +2 -0
- package/dist/i18n/locales/cs.json +2 -0
- package/dist/i18n/locales/da.json +2 -0
- package/dist/i18n/locales/de-CH.json +2 -0
- package/dist/i18n/locales/de.json +2 -0
- package/dist/i18n/locales/el.json +2 -0
- package/dist/i18n/locales/en-GB.json +2 -0
- package/dist/i18n/locales/en.json +2 -0
- package/dist/i18n/locales/es-MX.json +2 -0
- package/dist/i18n/locales/es.json +2 -0
- package/dist/i18n/locales/fa.json +2 -0
- package/dist/i18n/locales/fi.json +2 -0
- package/dist/i18n/locales/fr.json +2 -0
- package/dist/i18n/locales/he.json +2 -0
- package/dist/i18n/locales/hu.json +2 -0
- package/dist/i18n/locales/it.json +2 -0
- package/dist/i18n/locales/ja.json +2 -0
- package/dist/i18n/locales/ko.json +2 -0
- package/dist/i18n/locales/nb.json +2 -0
- package/dist/i18n/locales/nl.json +2 -0
- package/dist/i18n/locales/pl.json +2 -0
- package/dist/i18n/locales/pt-BR.json +2 -0
- package/dist/i18n/locales/pt-PT.json +2 -0
- package/dist/i18n/locales/ro.json +2 -0
- package/dist/i18n/locales/ru.json +2 -0
- package/dist/i18n/locales/sv.json +2 -0
- package/dist/i18n/locales/tr.json +2 -0
- package/dist/i18n/locales/uk.json +2 -0
- package/dist/i18n/locales/zh-CN.json +2 -0
- package/dist/i18n/locales/zh-HK.json +2 -0
- package/dist/i18n/locales/zh-TW.json +2 -0
- package/dist/i18n/regionDates.js +250 -0
- package/dist/i18n/regionHints.js +30 -41
- package/dist/icon-scan.js +68 -61
- package/dist/index.d.ts +35 -31
- package/dist/llms-full.txt +1428 -400
- package/dist/llms-medium.txt +8 -4
- package/dist/llms.txt +4 -2
- package/dist/locale-blueprint.json +2 -0
- package/dist/styles.css +2 -2
- package/dist/types/ActionButton.d.ts +2 -1
- package/dist/types/CommonProps.d.ts +8 -0
- package/dist/types/Option.d.ts +10 -0
- package/dist/types/ptComponentMap.d.ts +3 -3
- package/dist/utilities/functions/hash.js +97 -64
- package/dist/utilities/functions/isEqual.js +33 -25
- package/dist/utilities/functions/slotContent.js +19 -0
- package/dist/utils/loadRetry.js +8 -0
- package/dist/utils/versionCheck.js +1 -1
- package/dist/vite-plugin.d.ts +2 -1
- package/dist/vite.js +11 -4
- package/llms.txt +4 -2
- package/package.json +3 -2
- package/scripts/README.md +3 -1
- package/scripts/lib/adoption-checklist.json +6 -5
- package/scripts/lib/agent-manifest.mjs +33 -6
- package/scripts/lib/agent-setup.mjs +90 -24
- 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 +37 -2
- package/dist/ai/manifest/components/BbAvatar.removed.json +0 -6
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
props: activatorSlotProps,
|
|
15
15
|
anchorProps: { ref: setAnchorRef },
|
|
16
16
|
open: isOpen,
|
|
17
|
-
value:
|
|
17
|
+
value: ownModel,
|
|
18
18
|
disabled,
|
|
19
19
|
}"
|
|
20
20
|
/>
|
|
@@ -275,6 +275,8 @@ import {
|
|
|
275
275
|
} from '@/utilities/functions/extractDomContainer';
|
|
276
276
|
import { useClosingInert } from '@/composables/useClosingInert';
|
|
277
277
|
import { useId } from '@/composables/useId';
|
|
278
|
+
import { useOwnModel } from '@/composables/useOwnModel';
|
|
279
|
+
import { useOpenModel } from '@/composables/useOpenModel';
|
|
278
280
|
import { useLocale } from '@/composables/useLocale';
|
|
279
281
|
import { useEscapeStackEntry } from '@/composables/useEscapeStackEntry';
|
|
280
282
|
import { useMobile } from '@/composables/useMobile';
|
|
@@ -328,6 +330,18 @@ const emit = defineEmits<BbColorPaletteEvents>();
|
|
|
328
330
|
|
|
329
331
|
defineSlots<BbColorPaletteSlots>();
|
|
330
332
|
|
|
333
|
+
// No `v-model`: the picker keeps its own value, like an input.
|
|
334
|
+
const { model: ownModel, set: setModel } = useOwnModel<
|
|
335
|
+
'modelValue',
|
|
336
|
+
string | null
|
|
337
|
+
>(
|
|
338
|
+
props,
|
|
339
|
+
'modelValue',
|
|
340
|
+
// The palette only ever emits a colour: `null` is the empty value it shows.
|
|
341
|
+
(event, value) => value !== null && emit(event, value),
|
|
342
|
+
() => null
|
|
343
|
+
);
|
|
344
|
+
|
|
331
345
|
/** `all.popoverOffset`: the app's or the scope's gap, read per render. */
|
|
332
346
|
const popoverOffset = useConfigSetting<number>(null, 'popoverOffset');
|
|
333
347
|
|
|
@@ -415,11 +429,30 @@ const onActivatorClick = (event: MouseEvent) => {
|
|
|
415
429
|
isOpen.value = !isOpen.value;
|
|
416
430
|
};
|
|
417
431
|
|
|
418
|
-
|
|
432
|
+
// `v-model:open`: the activator's own open, the same close.
|
|
433
|
+
useOpenModel(props, emit, {
|
|
434
|
+
isOpen: () => isOpen.value,
|
|
435
|
+
open: () => {
|
|
436
|
+
if (props.disabled || props.readonly) return;
|
|
437
|
+
isOpen.value = true;
|
|
438
|
+
},
|
|
439
|
+
close: () => (isOpen.value = false),
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* a click outside the panel closes it. The panel is a modal
|
|
444
|
+
* `<dialog>` whose transparent backdrop the browser does not hit-test, so the
|
|
445
|
+
* click lands on the page, not on the dialog; heard in the capture phase, as
|
|
446
|
+
* a dialog around the picker stops `click` at its root. The activator's own
|
|
447
|
+
* click toggles it itself. Closing hands focus back to the activator.
|
|
448
|
+
*/
|
|
419
449
|
const onClickDocument = (event: Event) => {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
450
|
+
const target = event.target;
|
|
451
|
+
if (!(target instanceof Node)) return;
|
|
452
|
+
const panel = canvasWrapRef.value?.closest('.bb-common-popover');
|
|
453
|
+
if (panel?.contains(target)) return;
|
|
454
|
+
if (activatorEl.value?.contains(target)) return;
|
|
455
|
+
isOpen.value = false;
|
|
423
456
|
};
|
|
424
457
|
|
|
425
458
|
// Side effects only: emit, document listener, focus management
|
|
@@ -433,13 +466,18 @@ watch(isOpen, async (val) => {
|
|
|
433
466
|
: null;
|
|
434
467
|
// The floating <dialog> is modal; the sheet manages its own backdrop.
|
|
435
468
|
if (!useOffcanvas.value) {
|
|
436
|
-
document.addEventListener('click', onClickDocument, {
|
|
469
|
+
document.addEventListener('click', onClickDocument, {
|
|
470
|
+
passive: true,
|
|
471
|
+
capture: true,
|
|
472
|
+
});
|
|
437
473
|
}
|
|
438
474
|
// Wait for the popover to be rendered, then move focus into the picker
|
|
439
475
|
await nextTick();
|
|
440
476
|
canvasWrapRef.value?.focus();
|
|
441
477
|
} else {
|
|
442
|
-
document.removeEventListener('click', onClickDocument
|
|
478
|
+
document.removeEventListener('click', onClickDocument, {
|
|
479
|
+
capture: true,
|
|
480
|
+
});
|
|
443
481
|
// Restore focus to the element that was active before the palette opened
|
|
444
482
|
previousFocus?.focus();
|
|
445
483
|
previousFocus = null;
|
|
@@ -619,7 +657,9 @@ watch(
|
|
|
619
657
|
|
|
620
658
|
onBeforeUnmount(() => {
|
|
621
659
|
cleanupActivator?.();
|
|
622
|
-
document.removeEventListener('click', onClickDocument
|
|
660
|
+
document.removeEventListener('click', onClickDocument, {
|
|
661
|
+
capture: true,
|
|
662
|
+
});
|
|
623
663
|
});
|
|
624
664
|
|
|
625
665
|
// ================================================================================
|
|
@@ -872,7 +912,7 @@ const onPickerMounted = () => {
|
|
|
872
912
|
resizeObserver = new ResizeObserver(initCanvases);
|
|
873
913
|
if (mainCanvasRef.value) resizeObserver.observe(mainCanvasRef.value);
|
|
874
914
|
|
|
875
|
-
setFromHex(
|
|
915
|
+
setFromHex(ownModel.value);
|
|
876
916
|
initCanvases();
|
|
877
917
|
};
|
|
878
918
|
|
|
@@ -921,7 +961,7 @@ const setFromHex = (hex: string | null) => {
|
|
|
921
961
|
};
|
|
922
962
|
|
|
923
963
|
watch(
|
|
924
|
-
() =>
|
|
964
|
+
() => ownModel.value,
|
|
925
965
|
(newVal) => {
|
|
926
966
|
if (!pickerMounted) return;
|
|
927
967
|
if (newVal && newVal === currentHex.value) return;
|
|
@@ -942,7 +982,7 @@ watch(
|
|
|
942
982
|
|
|
943
983
|
// ---- Emit helper ---------------------------------------------------------------
|
|
944
984
|
|
|
945
|
-
const emitColor = () =>
|
|
985
|
+
const emitColor = () => setModel(currentHex.value);
|
|
946
986
|
|
|
947
987
|
// ---- Main canvas (SV) pointer events -------------------------------------------
|
|
948
988
|
|
|
@@ -1323,6 +1363,11 @@ type BbColorPalettePtProps = /* @vue-ignore */ PtCompoundProps<
|
|
|
1323
1363
|
// is a type and lint error instead of a silent no-op.
|
|
1324
1364
|
|
|
1325
1365
|
export type BbColorPaletteProps = BbColorPalettePtProps & {
|
|
1366
|
+
/**
|
|
1367
|
+
* Whether the panel is open (`v-model:open`; `v-model` stays the value).
|
|
1368
|
+
* Bound, the app opens and closes it; unbound, the initial state.
|
|
1369
|
+
*/
|
|
1370
|
+
open?: boolean;
|
|
1326
1371
|
/**
|
|
1327
1372
|
* Passthrough, object form: the same keys as the `pt:*` attributes
|
|
1328
1373
|
* without the prefix. See the `pt:<part>` row.
|
|
@@ -1405,7 +1450,7 @@ export type BbColorPaletteProps = BbColorPalettePtProps & {
|
|
|
1405
1450
|
* v-model: the current color as a `#RRGGBB` hex string (or `#RRGGBBAA` when
|
|
1406
1451
|
* `alpha` is enabled), or `null` when empty.
|
|
1407
1452
|
*/
|
|
1408
|
-
modelValue
|
|
1453
|
+
modelValue?: string | null;
|
|
1409
1454
|
/**
|
|
1410
1455
|
* Space the floating container will maintain from the activator.
|
|
1411
1456
|
*
|
|
@@ -1448,6 +1493,8 @@ export type BbColorPaletteEvents = {
|
|
|
1448
1493
|
(e: 'shown'): void;
|
|
1449
1494
|
/** Emitted as soon as the palette starts to close. */
|
|
1450
1495
|
(e: 'hide'): void;
|
|
1496
|
+
/** The panel opened or closed (`v-model:open`). */
|
|
1497
|
+
(e: 'update:open', value: boolean): void;
|
|
1451
1498
|
/** Emitted once the palette has finished closing. */
|
|
1452
1499
|
(e: 'hidden'): void;
|
|
1453
1500
|
/** Emitted when a color is picked. Payload is a concrete `#RRGGBB` (or `#RRGGBBAA` when alpha is enabled) — the palette always emits a color, never `null`. */
|
|
@@ -371,6 +371,13 @@ export type BbConfirmPortalSlotProps<P = any> = {
|
|
|
371
371
|
/** Resolves the confirm with `false` (through `cancel.onClick` when set). */
|
|
372
372
|
cancel: () => void;
|
|
373
373
|
};
|
|
374
|
+
|
|
375
|
+
/** BbConfirmPortal's slots; index it for one slot's type: `BbConfirmPortalSlots<MyData>['default']`. */
|
|
376
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- `P` defaults to `any` as on BbConfirmPortalSlotProps
|
|
377
|
+
export type BbConfirmPortalSlots<P = any> = {
|
|
378
|
+
/** The confirm's body. */
|
|
379
|
+
default?: (scope: BbConfirmPortalSlotProps<P>) => unknown;
|
|
380
|
+
};
|
|
374
381
|
```
|
|
375
382
|
|
|
376
383
|
## Styles
|
|
@@ -8,16 +8,14 @@
|
|
|
8
8
|
<template></template>
|
|
9
9
|
<script setup lang="ts">
|
|
10
10
|
import { useSlots, watchEffect } from 'vue';
|
|
11
|
-
import type {
|
|
11
|
+
import type { BbConfirmPortalSlots } from './types';
|
|
12
12
|
import { registerNamedPortal } from '@/composables/useConfirm';
|
|
13
13
|
|
|
14
14
|
const props = defineProps<{
|
|
15
15
|
/** The name a confirm passes as `portal: '<name>'` to render this content. */
|
|
16
16
|
name: string;
|
|
17
17
|
}>();
|
|
18
|
-
defineSlots<
|
|
19
|
-
default?: (scope: BbConfirmPortalSlotProps) => any;
|
|
20
|
-
}>();
|
|
18
|
+
defineSlots<BbConfirmPortalSlots>();
|
|
21
19
|
|
|
22
20
|
const slots = useSlots();
|
|
23
21
|
|
|
@@ -155,6 +153,13 @@ export type BbConfirmPortalSlotProps<P = any> = {
|
|
|
155
153
|
/** Resolves the confirm with `false` (through `cancel.onClick` when set). */
|
|
156
154
|
cancel: () => void;
|
|
157
155
|
};
|
|
156
|
+
|
|
157
|
+
/** BbConfirmPortal's slots; index it for one slot's type: `BbConfirmPortalSlots<MyData>['default']`. */
|
|
158
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- `P` defaults to `any` as on BbConfirmPortalSlotProps
|
|
159
|
+
export type BbConfirmPortalSlots<P = any> = {
|
|
160
|
+
/** The confirm's body. */
|
|
161
|
+
default?: (scope: BbConfirmPortalSlotProps<P>) => unknown;
|
|
162
|
+
};
|
|
158
163
|
```
|
|
159
164
|
|
|
160
165
|
## Styles
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
anchorProps: { ref: setAnchorRef },
|
|
24
24
|
open: isOpen,
|
|
25
|
-
value:
|
|
25
|
+
value: ownModel,
|
|
26
26
|
text: activatorText,
|
|
27
27
|
disabled: !!disabled,
|
|
28
28
|
}"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
:floating="floating"
|
|
46
46
|
:max="max"
|
|
47
47
|
:min="min"
|
|
48
|
-
:model-value="
|
|
48
|
+
:model-value="calendarModel"
|
|
49
49
|
:multiple="multiple"
|
|
50
50
|
:number-of-months="useOffcanvas ? 1 : numberOfMonths"
|
|
51
51
|
:pt="
|
|
@@ -165,6 +165,8 @@ import {
|
|
|
165
165
|
type DomHost,
|
|
166
166
|
} from '@/utilities/functions/extractDomContainer';
|
|
167
167
|
import { useId } from '@/composables/useId';
|
|
168
|
+
import { useOwnModel } from '@/composables/useOwnModel';
|
|
169
|
+
import { useOpenModel } from '@/composables/useOpenModel';
|
|
168
170
|
import { useLocale } from '@/composables/useLocale';
|
|
169
171
|
import { useEscapeStackEntry } from '@/composables/useEscapeStackEntry';
|
|
170
172
|
import { useMobile } from '@/composables/useMobile';
|
|
@@ -174,11 +176,12 @@ import { isLabelType } from '@/types/DatePickerType';
|
|
|
174
176
|
import { isoWeekOf } from '@/utilities/functions/isoWeek';
|
|
175
177
|
import {
|
|
176
178
|
formatDateOf,
|
|
179
|
+
spokenClockOf,
|
|
177
180
|
spokenDateOptionsOf,
|
|
178
181
|
spokenTimeOf,
|
|
179
|
-
timeFieldsOf,
|
|
180
182
|
useDayjsLocale,
|
|
181
183
|
} from '../BbCalendar/useDayjsLocale';
|
|
184
|
+
import { useHydrated } from '@/composables/useHydrated';
|
|
182
185
|
import { toInnerValue } from '@/utilities/functions/convertDateValue';
|
|
183
186
|
import {
|
|
184
187
|
calendarSystemOf,
|
|
@@ -252,6 +255,19 @@ const props = declaredProps as unknown as ShapeErasedProps<
|
|
|
252
255
|
>;
|
|
253
256
|
const emit = declaredEmit as unknown as BbDatePickerEvents;
|
|
254
257
|
|
|
258
|
+
type DateModel = Exclude<BbDatePickerProps['modelValue'], undefined>;
|
|
259
|
+
// No `v-model`: the picker keeps its own value, like an input.
|
|
260
|
+
const { model: ownModel, set: setModel } = useOwnModel<'modelValue', DateModel>(
|
|
261
|
+
props,
|
|
262
|
+
'modelValue',
|
|
263
|
+
(event, value) => emit(event, value),
|
|
264
|
+
() => (props.multiple ? [] : null)
|
|
265
|
+
);
|
|
266
|
+
/** The same value, in the caller's `R` / `M` shape, for the generic calendar. */
|
|
267
|
+
const calendarModel = computed(
|
|
268
|
+
() => ownModel.value as (typeof declaredProps)['modelValue']
|
|
269
|
+
);
|
|
270
|
+
|
|
255
271
|
if (process.env.NODE_ENV !== 'production')
|
|
256
272
|
warnRemovedAttrs('BbDatePicker', removedPropsFor('BbDatePicker'));
|
|
257
273
|
|
|
@@ -286,6 +302,7 @@ const config = useConfig();
|
|
|
286
302
|
* reads `start – end`, `multiple` a comma list; empty is `''`. Under another calendar a month or
|
|
287
303
|
* year value is the day it starts on, and reads as that calendar's month ("آبان ۱۴۰۵").
|
|
288
304
|
*/
|
|
305
|
+
const { isHydrated } = useHydrated();
|
|
289
306
|
const activatorText = computed(() => {
|
|
290
307
|
const isDateTime = props.type === 'datetime';
|
|
291
308
|
const floating = !!props.floating || isLabelType(props.type);
|
|
@@ -296,6 +313,9 @@ const activatorText = computed(() => {
|
|
|
296
313
|
? calendarSystemOf(resolved.calendar)
|
|
297
314
|
: undefined;
|
|
298
315
|
const say = (raw: string, index: number) => {
|
|
316
|
+
// Read here, not inside a branch: the flip is what repaints the
|
|
317
|
+
// time in the locale's spelling after hydration.
|
|
318
|
+
const live = isHydrated.value;
|
|
299
319
|
const date = toInnerValue(raw, {
|
|
300
320
|
floating,
|
|
301
321
|
utc: props.utc,
|
|
@@ -329,16 +349,12 @@ const activatorText = computed(() => {
|
|
|
329
349
|
: null;
|
|
330
350
|
const spoken = floating
|
|
331
351
|
? time
|
|
332
|
-
? spokenTimeOf(time, config.locale, !!props.ampm, !!props.seconds)
|
|
352
|
+
? spokenTimeOf(time, config.locale, !!props.ampm, !!props.seconds, live)
|
|
333
353
|
: ''
|
|
334
|
-
:
|
|
335
|
-
date,
|
|
336
|
-
config.locale,
|
|
337
|
-
timeFieldsOf(!!props.ampm, !!props.seconds)
|
|
338
|
-
);
|
|
354
|
+
: spokenClockOf(date, config.locale, !!props.ampm, !!props.seconds, live);
|
|
339
355
|
return spoken ? `${day} ${spoken}` : day;
|
|
340
356
|
};
|
|
341
|
-
const value =
|
|
357
|
+
const value = ownModel.value;
|
|
342
358
|
if (!Array.isArray(value)) return value ? say(value, 0) : '';
|
|
343
359
|
const parts = value.filter(Boolean).map(say);
|
|
344
360
|
return parts.join(props.multiple ? ', ' : ' – ');
|
|
@@ -418,11 +434,30 @@ const onActivatorClick = (event: MouseEvent) => {
|
|
|
418
434
|
isOpen.value = !isOpen.value;
|
|
419
435
|
};
|
|
420
436
|
|
|
421
|
-
|
|
437
|
+
// `v-model:open`: the activator's own open, the same close.
|
|
438
|
+
useOpenModel(props, emit, {
|
|
439
|
+
isOpen: () => isOpen.value,
|
|
440
|
+
open: () => {
|
|
441
|
+
if (props.disabled || props.readonly) return;
|
|
442
|
+
isOpen.value = true;
|
|
443
|
+
},
|
|
444
|
+
close: () => (isOpen.value = false),
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* a click outside the panel closes it. The panel is a modal
|
|
449
|
+
* `<dialog>` whose transparent backdrop the browser does not hit-test, so the
|
|
450
|
+
* click lands on the page, not on the dialog; heard in the capture phase, as
|
|
451
|
+
* a dialog around the picker stops `click` at its root. The activator's own
|
|
452
|
+
* click toggles it itself. Closing hands focus back to the activator.
|
|
453
|
+
*/
|
|
422
454
|
const onClickDocument = (event: Event) => {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
455
|
+
const target = event.target;
|
|
456
|
+
if (!(target instanceof Node)) return;
|
|
457
|
+
const panel = document.getElementById(panelId)?.closest('.bb-common-popover');
|
|
458
|
+
if (panel?.contains(target)) return;
|
|
459
|
+
if (activatorEl.value?.contains(target)) return;
|
|
460
|
+
isOpen.value = false;
|
|
426
461
|
};
|
|
427
462
|
|
|
428
463
|
watch(isOpen, async (val) => {
|
|
@@ -433,7 +468,10 @@ watch(isOpen, async (val) => {
|
|
|
433
468
|
: null;
|
|
434
469
|
// The floating <dialog> is modal; the sheet manages its own backdrop.
|
|
435
470
|
if (!useOffcanvas.value) {
|
|
436
|
-
document.addEventListener('click', onClickDocument, {
|
|
471
|
+
document.addEventListener('click', onClickDocument, {
|
|
472
|
+
passive: true,
|
|
473
|
+
capture: true,
|
|
474
|
+
});
|
|
437
475
|
}
|
|
438
476
|
await nextTick();
|
|
439
477
|
firstFocusableMatch(
|
|
@@ -441,7 +479,9 @@ watch(isOpen, async (val) => {
|
|
|
441
479
|
'[tabindex="0"]'
|
|
442
480
|
)?.focus();
|
|
443
481
|
} else {
|
|
444
|
-
document.removeEventListener('click', onClickDocument
|
|
482
|
+
document.removeEventListener('click', onClickDocument, {
|
|
483
|
+
capture: true,
|
|
484
|
+
});
|
|
445
485
|
previousFocus?.focus();
|
|
446
486
|
previousFocus = null;
|
|
447
487
|
}
|
|
@@ -518,7 +558,9 @@ watch(
|
|
|
518
558
|
|
|
519
559
|
onBeforeUnmount(() => {
|
|
520
560
|
cleanupActivator?.();
|
|
521
|
-
document.removeEventListener('click', onClickDocument
|
|
561
|
+
document.removeEventListener('click', onClickDocument, {
|
|
562
|
+
capture: true,
|
|
563
|
+
});
|
|
522
564
|
});
|
|
523
565
|
|
|
524
566
|
// ---- Adaptive surface (popover on desktop, bottom sheet on mobile) --------------
|
|
@@ -578,13 +620,13 @@ const onSurfaceHidden = () => {
|
|
|
578
620
|
* would have to be reopened for every value. Never under `datetime` either:
|
|
579
621
|
* the time is still to pick.
|
|
580
622
|
*/
|
|
581
|
-
const satisfiesSelection = (value:
|
|
623
|
+
const satisfiesSelection = (value: DateModel) => {
|
|
582
624
|
if (props.multiple || isDateTime.value) return false;
|
|
583
625
|
return props.range ? Array.isArray(value) && value.length === 2 : !!value;
|
|
584
626
|
};
|
|
585
627
|
|
|
586
|
-
const onCalendarModel = (value:
|
|
587
|
-
|
|
628
|
+
const onCalendarModel = (value: DateModel) => {
|
|
629
|
+
setModel(value);
|
|
588
630
|
if (satisfiesSelection(value)) isOpen.value = false;
|
|
589
631
|
};
|
|
590
632
|
|
|
@@ -782,6 +824,11 @@ type BbDatePickerPtProps = /* @vue-ignore */ PtCompoundProps<
|
|
|
782
824
|
// does not substitute a generic alias's type parameters — PASSTHROUGH.md T20).
|
|
783
825
|
|
|
784
826
|
export type BbDatePickerBaseProps = BbDatePickerPtProps & {
|
|
827
|
+
/**
|
|
828
|
+
* Whether the panel is open (`v-model:open`; `v-model` stays the value).
|
|
829
|
+
* Bound, the app opens and closes it; unbound, the initial state.
|
|
830
|
+
*/
|
|
831
|
+
open?: boolean;
|
|
785
832
|
/**
|
|
786
833
|
* Passthrough, object form: the same keys as the `pt:*` attributes
|
|
787
834
|
* without the prefix. See the `pt:<part>` row.
|
|
@@ -807,7 +854,7 @@ export type BbDatePickerBaseProps = BbDatePickerPtProps & {
|
|
|
807
854
|
* `year`), otherwise a zoned
|
|
808
855
|
* ISO instant (carrying the time under `datetime`).
|
|
809
856
|
*/
|
|
810
|
-
modelValue
|
|
857
|
+
modelValue?: string | string[] | null;
|
|
811
858
|
/**
|
|
812
859
|
* Companion time model (`v-model:time`), 24-hour `HH:mm` / `HH:mm:ss`.
|
|
813
860
|
* With `floating` it is the only carrier of the time; otherwise it mirrors
|
|
@@ -954,7 +1001,7 @@ export type BbDatePickerModelProps<
|
|
|
954
1001
|
> = {
|
|
955
1002
|
range?: R;
|
|
956
1003
|
multiple?: M;
|
|
957
|
-
modelValue
|
|
1004
|
+
modelValue?: PtNoInfer<BbDateModel<R, M>>;
|
|
958
1005
|
time?: PtNoInfer<BbTimeModel<R>>;
|
|
959
1006
|
};
|
|
960
1007
|
|
|
@@ -973,6 +1020,8 @@ export type BbDatePickerEvents<
|
|
|
973
1020
|
(e: 'shown'): void;
|
|
974
1021
|
/** Emitted as soon as the calendar surface starts to close. */
|
|
975
1022
|
(e: 'hide'): void;
|
|
1023
|
+
/** The panel opened or closed (`v-model:open`). */
|
|
1024
|
+
(e: 'update:open', value: boolean): void;
|
|
976
1025
|
/** Emitted once the calendar surface has finished closing. */
|
|
977
1026
|
(e: 'hidden'): void;
|
|
978
1027
|
/** Emitted when the selected date value changes (single/range/null). */
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
]"
|
|
143
143
|
:disabled="disabled"
|
|
144
144
|
:inputmode="inputmodeFor(descriptor.field)"
|
|
145
|
-
:maxlength="
|
|
145
|
+
:maxlength="maxlengthOf(descriptor.field)"
|
|
146
146
|
:name="getFieldName(descriptor)"
|
|
147
147
|
:readonly="isInputReadonly"
|
|
148
148
|
:required="fieldRequired"
|
|
@@ -217,9 +217,10 @@
|
|
|
217
217
|
:label="accessibleButtonLabel"
|
|
218
218
|
:max="max"
|
|
219
219
|
:min="min"
|
|
220
|
-
:model-value="
|
|
220
|
+
:model-value="calendarModel"
|
|
221
221
|
:number-of-months="numberOfMonths"
|
|
222
222
|
:off-canvas-props="offCanvasProps"
|
|
223
|
+
:open="openModel"
|
|
223
224
|
:pt="passthrough.forward(PICKER_PARTS, BB_DATE_PICKER_PT.states)"
|
|
224
225
|
:range="props.range"
|
|
225
226
|
:readonly="fieldReadonly"
|
|
@@ -236,6 +237,7 @@
|
|
|
236
237
|
@show="onCalendarShow"
|
|
237
238
|
@shown="emit('shown')"
|
|
238
239
|
@time-pick="onTimeSelect"
|
|
240
|
+
@update:open="setOpenModel"
|
|
239
241
|
>
|
|
240
242
|
<template #activator="{ props: activatorProps }">
|
|
241
243
|
<!-- A saving form leaves the trigger on screen, inert (the
|
|
@@ -318,6 +320,7 @@ import { useConfig } from '@/composables/useConfig';
|
|
|
318
320
|
import { useConfigDefaults } from '@/composables/useConfigDefaults';
|
|
319
321
|
import { useFormBinding } from '@/composables/useFormBinding';
|
|
320
322
|
import { useLocale } from '@/composables/useLocale';
|
|
323
|
+
import { useOpenProp } from '@/composables/useOpenModel';
|
|
321
324
|
import { useLogger } from '@/composables/useLogger';
|
|
322
325
|
import { useMobile } from '@/composables/useMobile';
|
|
323
326
|
import {
|
|
@@ -354,6 +357,7 @@ import {
|
|
|
354
357
|
import { isEmpty } from '@/utilities/functions/empty';
|
|
355
358
|
import { hash } from '@/utilities/functions/hash';
|
|
356
359
|
import { isNotEmpty } from '@/utilities/functions/isNotEmpty';
|
|
360
|
+
import { isNotNil } from '@/utilities/functions/isNotNil';
|
|
357
361
|
import { normalizeDateBound } from '@/utilities/functions/normalizeDateBound';
|
|
358
362
|
import { isDateDisabled as isDateDisabledIn } from '@/utilities/functions/isDateDisabled';
|
|
359
363
|
import { warnRemovedAttrs } from '@/utilities/functions/warnRemovedAttrs';
|
|
@@ -367,11 +371,12 @@ import { foldDigits } from '@/utilities/calendar/digits';
|
|
|
367
371
|
import {
|
|
368
372
|
formatDateOf,
|
|
369
373
|
intlLocaleOf,
|
|
374
|
+
spokenClockOf,
|
|
370
375
|
spokenDateOptionsOf,
|
|
371
|
-
timeFieldsOf,
|
|
372
376
|
useDayjsLocale,
|
|
373
377
|
weekSpanOf,
|
|
374
378
|
} from '../BbCalendar/useDayjsLocale';
|
|
379
|
+
import { useHydrated } from '@/composables/useHydrated';
|
|
375
380
|
import BbDatePicker from '../BbDatePicker/BbDatePicker.vue';
|
|
376
381
|
import {
|
|
377
382
|
BB_DATE_PICKER_PT,
|
|
@@ -473,6 +478,9 @@ const {
|
|
|
473
478
|
componentName: 'BbDatePickerInput',
|
|
474
479
|
identifierFallback: () => declaredProps.label,
|
|
475
480
|
leaveOn: 'inactive',
|
|
481
|
+
// No `v-model`: the calendar gets its own "no date", never `undefined`
|
|
482
|
+
// (its `modelValue` takes `string | string[] | null`).
|
|
483
|
+
emptyValue: () => null,
|
|
476
484
|
});
|
|
477
485
|
|
|
478
486
|
/**
|
|
@@ -517,6 +525,15 @@ const onCalendarHide = () => {
|
|
|
517
525
|
emit('hide');
|
|
518
526
|
};
|
|
519
527
|
|
|
528
|
+
/**
|
|
529
|
+
* `v-model:open`, handed to the hosted picker bound: its
|
|
530
|
+
* own open and close paths run, and every close writes back here.
|
|
531
|
+
*/
|
|
532
|
+
const { model: openModel, set: setOpenModel } = useOpenProp(
|
|
533
|
+
declaredProps,
|
|
534
|
+
declaredEmit
|
|
535
|
+
);
|
|
536
|
+
|
|
520
537
|
// Deactivated (KeepAlive) while in use counts as leaving: the control is off
|
|
521
538
|
// screen, so nothing it listens to on the document can be about it.
|
|
522
539
|
onDeactivated(() => {
|
|
@@ -938,13 +955,19 @@ const onFocusIn = () => {
|
|
|
938
955
|
emit('active');
|
|
939
956
|
active.value = true;
|
|
940
957
|
document.addEventListener('focusin', onDocumentInteraction);
|
|
941
|
-
|
|
958
|
+
// Capture: a dialog around the field stops `click` at its
|
|
959
|
+
// root, so a click elsewhere in it never bubbles here.
|
|
960
|
+
document.addEventListener('click', onDocumentInteraction, true);
|
|
942
961
|
};
|
|
943
962
|
|
|
944
963
|
const onDocumentInteraction = (event: Event) => {
|
|
945
964
|
const target = event.target;
|
|
946
965
|
if (!(target instanceof HTMLElement)) return;
|
|
947
966
|
if (!wrapper.value?.$el) return;
|
|
967
|
+
// a press on the field's own padding or separator parks
|
|
968
|
+
// focus on the nearest focusable ancestor (the dialog around it): not
|
|
969
|
+
// the user going elsewhere. A CLICK on that ancestor still is.
|
|
970
|
+
if (event.type === 'focusin' && target.contains(wrapper.value.$el)) return;
|
|
948
971
|
// The calendar's popover / sheet renders inside the box row (the top layer
|
|
949
972
|
// lifts it visually, not in the DOM), so a grid or time pick counts as still
|
|
950
973
|
// interacting with us and never finalizes the fields.
|
|
@@ -968,7 +991,7 @@ const leave = () => {
|
|
|
968
991
|
resetActiveState();
|
|
969
992
|
emit('inactive');
|
|
970
993
|
document.removeEventListener('focusin', onDocumentInteraction);
|
|
971
|
-
document.removeEventListener('click', onDocumentInteraction);
|
|
994
|
+
document.removeEventListener('click', onDocumentInteraction, true);
|
|
972
995
|
};
|
|
973
996
|
|
|
974
997
|
/**
|
|
@@ -1071,7 +1094,7 @@ const onSegmentFieldFocus = (
|
|
|
1071
1094
|
event: FocusEvent
|
|
1072
1095
|
) => {
|
|
1073
1096
|
lastFocusedSegment.value = descriptor.segment;
|
|
1074
|
-
onFieldFocus(descriptor);
|
|
1097
|
+
onFieldFocus(descriptor, event);
|
|
1075
1098
|
emit('focus', event);
|
|
1076
1099
|
};
|
|
1077
1100
|
|
|
@@ -1113,6 +1136,7 @@ const onTimeSelect = ({ unit, value }: { unit: TimeUnit; value: string }) => {
|
|
|
1113
1136
|
* A month has no day to read out, a year neither.
|
|
1114
1137
|
*/
|
|
1115
1138
|
const spokenDateOptions = computed(() => spokenDateOptionsOf(props.type));
|
|
1139
|
+
const { isHydrated } = useHydrated();
|
|
1116
1140
|
|
|
1117
1141
|
const spokenValue = (value: Dayjs) => {
|
|
1118
1142
|
// A week: its number and its seven days, "week 44, October 26 – November
|
|
@@ -1125,10 +1149,14 @@ const spokenValue = (value: Dayjs) => {
|
|
|
1125
1149
|
).value;
|
|
1126
1150
|
const date = formatDateOf(value, config.locale, spokenDateOptions.value);
|
|
1127
1151
|
if (!isDateTime.value) return date;
|
|
1128
|
-
|
|
1152
|
+
// Before hydration the time is spoken as `HH:mm`: its spelling is CLDR
|
|
1153
|
+
// data that differs between ICU builds.
|
|
1154
|
+
const time = spokenClockOf(
|
|
1129
1155
|
value,
|
|
1130
1156
|
config.locale,
|
|
1131
|
-
|
|
1157
|
+
!!props.ampm,
|
|
1158
|
+
!!props.seconds,
|
|
1159
|
+
isHydrated.value
|
|
1132
1160
|
);
|
|
1133
1161
|
return `${date} ${time}`;
|
|
1134
1162
|
};
|
|
@@ -1237,6 +1265,25 @@ const isDateDisabled = (date: Dayjs) => {
|
|
|
1237
1265
|
return !passing;
|
|
1238
1266
|
};
|
|
1239
1267
|
|
|
1268
|
+
/**
|
|
1269
|
+
* The value the calendar opens on. A complete date the fields show but may
|
|
1270
|
+
* not emit (outside min/max or not `selectable`) waits for the leave to
|
|
1271
|
+
* resolve it, so the model still holds the last date typed on the way there:
|
|
1272
|
+
* the calendar shows the fields' date instead, on its own month, its day
|
|
1273
|
+
* disabled as usual, never that other date as selected.
|
|
1274
|
+
*/
|
|
1275
|
+
const calendarModel = computed(() => {
|
|
1276
|
+
const start = displayedValue('start');
|
|
1277
|
+
// A range without its start shows no range yet.
|
|
1278
|
+
const shown = [
|
|
1279
|
+
start,
|
|
1280
|
+
start && props.range ? displayedValue('end') : null,
|
|
1281
|
+
].filter(isNotNil);
|
|
1282
|
+
if (!shown.some(isDateDisabled)) return fieldModel.value;
|
|
1283
|
+
const values = shown.map(toOuterValue);
|
|
1284
|
+
return props.range ? values : values[0];
|
|
1285
|
+
});
|
|
1286
|
+
|
|
1240
1287
|
const onClickClear = () => {
|
|
1241
1288
|
if (props.range) {
|
|
1242
1289
|
emit('update:modelValue', []);
|
|
@@ -1473,6 +1520,15 @@ const fieldSpecs = computed<Record<DateFieldKey, SegmentedFieldSpec>>(() => ({
|
|
|
1473
1520
|
meridiem: meridiemWords.fieldSpec.value,
|
|
1474
1521
|
...calendarSpecs?.value,
|
|
1475
1522
|
}));
|
|
1523
|
+
/**
|
|
1524
|
+
* Words keep a `maxlength`; a digit field enforces its length on input, where
|
|
1525
|
+
* a digit typed into a full field replaces it (the attribute dropped
|
|
1526
|
+
* the keystroke before any handler ran).
|
|
1527
|
+
*/
|
|
1528
|
+
const maxlengthOf = (field: DateFieldKey) =>
|
|
1529
|
+
fieldSpecs.value[field].kind === 'numeric'
|
|
1530
|
+
? undefined
|
|
1531
|
+
: fieldSpecs.value[field].maxLength;
|
|
1476
1532
|
|
|
1477
1533
|
/**
|
|
1478
1534
|
* Off Gregorian, the calendar's limits (13 months, 30-day months, a year
|
|
@@ -2426,7 +2482,7 @@ const combineFieldsToModelValue = (
|
|
|
2426
2482
|
|
|
2427
2483
|
onBeforeUnmount(() => {
|
|
2428
2484
|
document.removeEventListener('focusin', onDocumentInteraction);
|
|
2429
|
-
document.removeEventListener('click', onDocumentInteraction);
|
|
2485
|
+
document.removeEventListener('click', onDocumentInteraction, true);
|
|
2430
2486
|
});
|
|
2431
2487
|
</script>
|
|
2432
2488
|
|
|
@@ -2717,6 +2773,11 @@ type BbDatePickerInputPtProps = /* @vue-ignore */ PtCompoundProps<
|
|
|
2717
2773
|
BbDatePickerInputPtKeys;
|
|
2718
2774
|
|
|
2719
2775
|
export type BbDatePickerInputBaseProps = BbDatePickerInputPtProps & {
|
|
2776
|
+
/**
|
|
2777
|
+
* Whether the panel is open (`v-model:open`; `v-model` stays the value).
|
|
2778
|
+
* Bound, the app opens and closes it; unbound, the initial state.
|
|
2779
|
+
*/
|
|
2780
|
+
open?: boolean;
|
|
2720
2781
|
/**
|
|
2721
2782
|
* Passthrough, object form: the same keys as the `pt:*` attributes
|
|
2722
2783
|
* without the prefix. See the `pt:<part>` row.
|
|
@@ -3115,6 +3176,8 @@ export type BbDatePickerInputEvents<R extends boolean = boolean> = {
|
|
|
3115
3176
|
(e: 'shown'): void;
|
|
3116
3177
|
/** Emitted as soon as the calendar surface starts to close. */
|
|
3117
3178
|
(e: 'hide'): void;
|
|
3179
|
+
/** The panel opened or closed (`v-model:open`). */
|
|
3180
|
+
(e: 'update:open', value: boolean): void;
|
|
3118
3181
|
/** Emitted once the calendar surface has finished closing. */
|
|
3119
3182
|
(e: 'hidden'): void;
|
|
3120
3183
|
/**
|