bitboss-ui 3.0.0-beta.72 → 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 +34 -7
- 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 +17 -4
- package/dist/ai/BbDropdown.md +23 -10
- package/dist/ai/BbDropdownButton.md +2 -2
- package/dist/ai/BbForm.md +11 -7
- 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 +60 -4
- package/dist/ai/components.json +56 -20
- 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/components/use-confirm.md +4 -1
- 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/BbConfirm.removed.json +4 -4
- package/dist/ai/manifest/components/BbConfirmPortal.json +1 -1
- package/dist/ai/manifest/components/BbConfirmPortal.removed.json +2 -2
- 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/BbToast.removed.json +1 -1
- 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 +80 -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/deprecation/ai-deprecations.json.js +1 -1
- 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 +874 -136
- 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 +123 -3
- package/dist/utilities/functions/isEqual.js +69 -3
- package/dist/utils/versionCheck.js +1 -1
- package/dist/vite-plugin.d.ts +2 -1
- package/dist/vite.js +8 -5
- package/llms.txt +3 -1
- package/package.json +2 -3
- package/scripts/README.md +43 -43
- 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/helpers-add.mjs +21 -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 +153 -6
- 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
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FormContext, FormMeta, GenericObject } from 'vee-validate';
|
|
2
|
+
import { BbFormFieldEntry, BbFormServerErrors, BbFormSetErrorsOptions } from '../../composables/useBbForm.js';
|
|
3
|
+
/** BbForm's slots; index it for one slot's type: `BbFormSlots['default']`. */
|
|
4
|
+
export type BbFormSlots = {
|
|
5
|
+
/**
|
|
6
|
+
* The form's fields, with its state and actions in scope: the meta
|
|
7
|
+
* (`valid`, `dirty`…), `values`, `errors`, `fields`, `unmatchedErrors`,
|
|
8
|
+
* `isSubmitting`, `submitCount`, `validate`, `resetForm`, `setErrors`,
|
|
9
|
+
* `snapshot`, `removeField`.
|
|
10
|
+
*/
|
|
11
|
+
default?: (scope: FormMeta<GenericObject> & {
|
|
12
|
+
/** Each field's messages, by name. */
|
|
13
|
+
errors: Record<string, string[]>;
|
|
14
|
+
/** Each mounted field, by name. */
|
|
15
|
+
fields: Record<string, BbFormFieldEntry>;
|
|
16
|
+
isSubmitting: boolean;
|
|
17
|
+
/** Drops a path and everything under it from the values, for good. */
|
|
18
|
+
removeField: (path: string) => void;
|
|
19
|
+
/** Back to the baseline (or to the state passed). */
|
|
20
|
+
resetForm: FormContext['resetForm'];
|
|
21
|
+
/** Lands server errors on their fields. */
|
|
22
|
+
setErrors: (errors: BbFormServerErrors, options?: BbFormSetErrorsOptions) => void;
|
|
23
|
+
/** Makes the current values (merged with `next`) the dirty baseline. */
|
|
24
|
+
snapshot: (next?: Record<string, unknown>) => void;
|
|
25
|
+
submitCount: number;
|
|
26
|
+
/** Server errors no mounted field shows, by path. */
|
|
27
|
+
unmatchedErrors: Record<string, string[]>;
|
|
28
|
+
validate: FormContext['validate'];
|
|
29
|
+
values: GenericObject;
|
|
30
|
+
}) => unknown;
|
|
31
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BbHoverCardPortalSlots } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Content for `v-bb-hover-card="'<name>'"` (or `{ portal: '<name>' }`),
|
|
4
4
|
* declared once in a template. Renders nothing in place: the card renders the
|
|
@@ -8,10 +8,7 @@ type __VLS_Props = {
|
|
|
8
8
|
/** The name a `v-bb-hover-card` passes as its value (`"'name'"`) or as `portal: 'name'`. */
|
|
9
9
|
name: string;
|
|
10
10
|
};
|
|
11
|
-
type __VLS_Slots =
|
|
12
|
-
/** The card's body. `data` is the directive's `data`; `close` closes the card. */
|
|
13
|
-
default?: (scope: BbHoverCardPortalSlotProps) => any;
|
|
14
|
-
};
|
|
11
|
+
type __VLS_Slots = BbHoverCardPortalSlots;
|
|
15
12
|
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
16
13
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
17
14
|
declare const _default: typeof __VLS_export;
|
|
@@ -184,3 +184,8 @@ export type BbHoverCardPortalSlotProps<P = any> = {
|
|
|
184
184
|
/** Closes the card. */
|
|
185
185
|
close: () => void;
|
|
186
186
|
};
|
|
187
|
+
/** BbHoverCardPortal's slots; index it for one slot's type: `BbHoverCardPortalSlots<MyData>['default']`. */
|
|
188
|
+
export type BbHoverCardPortalSlots<P = any> = {
|
|
189
|
+
/** The card's body. `data` is the directive's `data`; `close` closes the card. */
|
|
190
|
+
default?: (scope: BbHoverCardPortalSlotProps<P>) => any;
|
|
191
|
+
};
|
|
@@ -262,7 +262,7 @@ var Re = [
|
|
|
262
262
|
...p.variant,
|
|
263
263
|
current: () => C.variant ?? "outline"
|
|
264
264
|
}
|
|
265
|
-
}), M = v(null), N = m(() => A.value ? null : le(oe(Ge.locale), C.currency, C.unit)), Ye = m(() => N.value?.kind === "currency" ? de(N.value.code
|
|
265
|
+
}), M = v(null), N = m(() => A.value ? null : le(oe(Ge.locale), C.currency, C.unit)), Ye = m(() => N.value?.kind === "currency" ? de(N.value.code) : null), P = m(() => k.maxPrecision ?? (Ye.value ? Math.max(Ye.value.max, C.minPrecision ?? 0) : 8)), Xe = m(() => C.minPrecision ?? Ye.value?.min ?? 0), F = m(() => A.value && !(Xe.value > 0)), I = m(() => A.value ? ce : he(oe(Ge.locale), N.value?.kind === "currency" ? N.value.code : void 0)), L = m(() => Math.max(0, Math.min(Xe.value, P.value))), Ze = () => ({
|
|
266
266
|
maxPrecision: P.value,
|
|
267
267
|
minPrecision: Xe.value,
|
|
268
268
|
max: C.max,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { CURRENCY_DIGITS as e } from "../../i18n/currencyDigits.js";
|
|
1
2
|
// src/components/BbNumberInput/numberDisplay.ts
|
|
2
|
-
var
|
|
3
|
+
var t = {
|
|
3
4
|
tag: "en",
|
|
4
5
|
decimal: ".",
|
|
5
6
|
group: "",
|
|
@@ -7,33 +8,33 @@ var e = {
|
|
|
7
8
|
secondary: 3,
|
|
8
9
|
groupInt: null,
|
|
9
10
|
minusPrefix: "-"
|
|
10
|
-
},
|
|
11
|
-
let r =
|
|
11
|
+
}, n = /[\u200e\u200f\u061c]/g, r = " \xA0 ", i = "'’‘ʼʹ´`′", a = "٫", o = "-−﹣-", s = /* @__PURE__ */ new Map(), c = (e, t) => {
|
|
12
|
+
let r = t ? `${e}|${t}` : e, i = s.get(r);
|
|
12
13
|
if (i) return i;
|
|
13
|
-
let a,
|
|
14
|
+
let a, o = null;
|
|
14
15
|
try {
|
|
15
16
|
a = new Intl.NumberFormat(e, {
|
|
16
17
|
maximumFractionDigits: 0,
|
|
17
18
|
numberingSystem: "latn",
|
|
18
19
|
useGrouping: "auto"
|
|
19
|
-
}),
|
|
20
|
+
}), t && (o = new Intl.NumberFormat(e, {
|
|
20
21
|
style: "currency",
|
|
21
|
-
currency:
|
|
22
|
+
currency: t,
|
|
22
23
|
maximumFractionDigits: 0,
|
|
23
24
|
numberingSystem: "latn",
|
|
24
25
|
useGrouping: "auto"
|
|
25
26
|
}));
|
|
26
27
|
} catch {
|
|
27
|
-
return
|
|
28
|
+
return c(t ? e : "en");
|
|
28
29
|
}
|
|
29
30
|
let l = new Intl.NumberFormat(e, {
|
|
30
|
-
...
|
|
31
|
+
...t ? {
|
|
31
32
|
style: "currency",
|
|
32
|
-
currency:
|
|
33
|
+
currency: t
|
|
33
34
|
} : {},
|
|
34
35
|
numberingSystem: "latn",
|
|
35
36
|
useGrouping: "always"
|
|
36
|
-
}).formatToParts(1234567890.5), u = l.find((e) => e.type === "decimal")?.value ?? (
|
|
37
|
+
}).formatToParts(1234567890.5), u = l.find((e) => e.type === "decimal")?.value ?? (t ? c(e).decimal : "."), d = l.find((e) => e.type === "group")?.value ?? "", f = l.filter((e) => e.type === "integer").map((e) => e.value), p = f.length > 1 ? f[f.length - 1].length : 3, m = f.length > 2 ? f[f.length - 2].length : p, h = "";
|
|
37
38
|
for (let e of a.formatToParts(-1)) {
|
|
38
39
|
if (e.type === "integer") break;
|
|
39
40
|
e.type === "minusSign" ? h += "-" : e.type === "literal" && (h += e.value.replace(/[^\u200e\u200f\u061c]/g, ""));
|
|
@@ -41,41 +42,32 @@ var e = {
|
|
|
41
42
|
h.includes("-") || (h = "-");
|
|
42
43
|
let g = {
|
|
43
44
|
tag: e,
|
|
44
|
-
decimal: u.replace(
|
|
45
|
-
group: d.replace(
|
|
45
|
+
decimal: u.replace(n, ""),
|
|
46
|
+
group: d.replace(n, ""),
|
|
46
47
|
primary: p,
|
|
47
48
|
secondary: m,
|
|
48
|
-
groupInt:
|
|
49
|
+
groupInt: o ? (e) => o.formatToParts(e).filter((e) => e.type === "integer" || e.type === "group").map((e) => e.value).join("").replace(n, "") : (e) => a.format(e).replace(n, "").replace(/^[-\u2212]/, ""),
|
|
49
50
|
minusPrefix: h
|
|
50
51
|
};
|
|
51
|
-
return
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
currency: e
|
|
60
|
-
}).resolvedOptions();
|
|
61
|
-
r = {
|
|
62
|
-
min: n ?? 0,
|
|
63
|
-
max: i ?? 0
|
|
64
|
-
};
|
|
65
|
-
} catch {
|
|
66
|
-
r = null;
|
|
67
|
-
}
|
|
68
|
-
return c.set(n, r), r;
|
|
52
|
+
return s.set(r, g), g;
|
|
53
|
+
}, l = (t) => {
|
|
54
|
+
if (!/^[a-z]{3}$/i.test(t)) return null;
|
|
55
|
+
let n = e[t.toUpperCase()] ?? 2;
|
|
56
|
+
return {
|
|
57
|
+
min: n,
|
|
58
|
+
max: n
|
|
59
|
+
};
|
|
69
60
|
}, u = (e) => {
|
|
70
61
|
let t = e;
|
|
71
62
|
for (; t > 0 && /\p{Nd}/u.test(String.fromCodePoint(t - 1));) t--;
|
|
72
63
|
return t;
|
|
73
64
|
}, d = (e) => {
|
|
65
|
+
if (i.includes(e)) return e;
|
|
74
66
|
let t = e.normalize("NFKC");
|
|
75
67
|
if (t.length !== 1 && [...t].length !== 1) return t;
|
|
76
68
|
let n = t.codePointAt(0);
|
|
77
|
-
return n >= 48 && n <= 57 ? t :
|
|
78
|
-
}, f = (e) => [...e.replace(
|
|
69
|
+
return n >= 48 && n <= 57 ? t : o.includes(t) ? "-" : /\p{Nd}/u.test(t) ? String((n - u(n)) % 10) : t;
|
|
70
|
+
}, f = (e) => [...e.replace(n, "")].map(d).join(""), p = (e) => e >= "0" && e <= "9", m = (e, t, n) => {
|
|
79
71
|
let r = e.startsWith("-"), i = r ? e.slice(1) : e, a = i.indexOf("."), o = a === -1 ? i : i.slice(0, a), s = a === -1 ? "" : i.slice(a + 1), c = o.length > 1 && o.startsWith("0"), l = o && t.groupInt && !c ? t.groupInt(o) : o, u = [], d = "";
|
|
80
72
|
r && (u.push(t.minusPrefix.indexOf("-")), d = t.minusPrefix);
|
|
81
73
|
for (let e of l) p(e) && u.push(d.length), d += e;
|
|
@@ -169,41 +161,41 @@ var e = {
|
|
|
169
161
|
digits: s,
|
|
170
162
|
negative: n
|
|
171
163
|
};
|
|
172
|
-
},
|
|
164
|
+
}, ee = (e, t, n) => {
|
|
173
165
|
let r = w(t, n), i = b(e, r.digits), a = (e) => i ? i.formatToParts(e) : [];
|
|
174
166
|
return C(a(r.text)) ?? C(a(r.negative ? "-5" : "5")) ?? {
|
|
175
167
|
before: "",
|
|
176
168
|
after: "",
|
|
177
169
|
minusAt: -1
|
|
178
170
|
};
|
|
179
|
-
},
|
|
171
|
+
}, T = /* @__PURE__ */ new Set([
|
|
180
172
|
"Arab",
|
|
181
173
|
"Hebr",
|
|
182
174
|
"Thaa",
|
|
183
175
|
"Syrc",
|
|
184
176
|
"Nkoo",
|
|
185
177
|
"Adlm"
|
|
186
|
-
]),
|
|
187
|
-
let t =
|
|
178
|
+
]), E = /* @__PURE__ */ new Map(), D = (e) => {
|
|
179
|
+
let t = E.get(e);
|
|
188
180
|
if (t === void 0) {
|
|
189
181
|
try {
|
|
190
|
-
t =
|
|
182
|
+
t = T.has(new Intl.Locale(e).maximize().script ?? "");
|
|
191
183
|
} catch {
|
|
192
184
|
t = !1;
|
|
193
185
|
}
|
|
194
|
-
|
|
186
|
+
E.set(e, t);
|
|
195
187
|
}
|
|
196
188
|
return t;
|
|
197
|
-
},
|
|
189
|
+
}, O = (e, t, n, r) => {
|
|
198
190
|
let i = m(e, t, n);
|
|
199
191
|
if (!r || !/\d/.test(e)) return i;
|
|
200
|
-
let a = e.startsWith("-"), o =
|
|
192
|
+
let a = e.startsWith("-"), o = ee(r, e, n.minPrecision), { before: s, minusAt: c } = o, l = i.text, u = i.positions;
|
|
201
193
|
if (a) {
|
|
202
194
|
let e = t.minusPrefix.length;
|
|
203
195
|
l = l.slice(e), u = u.slice(1).map((t) => t - e), c === -1 && (c = s.length, s += "-");
|
|
204
196
|
}
|
|
205
197
|
let { after: d } = o;
|
|
206
|
-
|
|
198
|
+
D(r.tag) && /[\p{Script=Latin}\p{Sc}#%°‰]$/u.test(d) && (d += "");
|
|
207
199
|
let f = s.length;
|
|
208
200
|
return {
|
|
209
201
|
text: s + l + d,
|
|
@@ -211,113 +203,113 @@ var e = {
|
|
|
211
203
|
hole: [f, f + l.length],
|
|
212
204
|
shell: `${s}\u0000${d}`
|
|
213
205
|
};
|
|
214
|
-
},
|
|
206
|
+
}, k = ["¥", "¥"], A = [
|
|
215
207
|
"0",
|
|
216
208
|
"1",
|
|
217
209
|
"2",
|
|
218
210
|
"5",
|
|
219
211
|
"1.5",
|
|
220
212
|
"1234.5"
|
|
221
|
-
],
|
|
222
|
-
let
|
|
213
|
+
], j = /* @__PURE__ */ new Map(), M = (e) => {
|
|
214
|
+
let t = `${e.tag}|${e.kind}|${e.code}`, r = j.get(t);
|
|
223
215
|
if (r) return r;
|
|
224
216
|
let i = /* @__PURE__ */ new Set(), a = b(e, null);
|
|
225
|
-
for (let e of
|
|
226
|
-
return e.kind === "currency" && i.add(e.code.toUpperCase()), [...i].some((e) =>
|
|
227
|
-
},
|
|
228
|
-
if (!
|
|
229
|
-
let r = e.replace(
|
|
230
|
-
for (let e of
|
|
217
|
+
for (let e of A) for (let t of [e, `-${e}`]) for (let e of a?.formatToParts(t) ?? []) (e.type === "currency" || e.type === "unit") && i.add(e.value.replace(n, "").trim());
|
|
218
|
+
return e.kind === "currency" && i.add(e.code.toUpperCase()), [...i].some((e) => k.includes(e)) && k.forEach((e) => i.add(e)), i.delete(""), r = [...i].sort((e, t) => t.length - e.length), j.set(t, r), r;
|
|
219
|
+
}, N = /^([-−﹣-(+]?\s*)\p{L}[\p{L}\p{M}.]*\s*(?=[-−﹣-(\p{Sc}\p{Nd}])/u, P = (e, t) => {
|
|
220
|
+
if (!t) return e;
|
|
221
|
+
let r = e.replace(n, "");
|
|
222
|
+
for (let e of M(t)) {
|
|
231
223
|
let t = /\p{L}$/u.test(e) ? `${e}.` : null;
|
|
232
224
|
t && (r = r.split(t).join("")), r = r.split(e).join("");
|
|
233
225
|
}
|
|
234
|
-
return r.trim().replace(
|
|
235
|
-
},
|
|
226
|
+
return r.trim().replace(N, "$1");
|
|
227
|
+
}, te = (e, t, n) => {
|
|
236
228
|
let r = w(e, t), i = b(n, r.digits, "name");
|
|
237
229
|
return i ? i.format(r.text) : e;
|
|
238
|
-
},
|
|
230
|
+
}, F = /* @__PURE__ */ new Map(), I = (e, t) => {
|
|
239
231
|
if (!Number.isFinite(e)) return "";
|
|
240
|
-
let n = Math.max(0, Math.min(100, t)), r =
|
|
232
|
+
let n = Math.max(0, Math.min(100, t)), r = F.get(n);
|
|
241
233
|
r || (r = new Intl.NumberFormat("en", {
|
|
242
234
|
maximumFractionDigits: n,
|
|
243
235
|
numberingSystem: "latn",
|
|
244
236
|
useGrouping: !1
|
|
245
|
-
}),
|
|
237
|
+
}), F.set(n, r));
|
|
246
238
|
let i = r.format(e);
|
|
247
239
|
return i === "-0" ? "0" : i;
|
|
248
|
-
},
|
|
240
|
+
}, L = (e) => {
|
|
249
241
|
if (e === "") return null;
|
|
250
242
|
if (!/\d/.test(e)) return;
|
|
251
243
|
let t = Number(e.endsWith(".") ? e.slice(0, -1) : e);
|
|
252
244
|
if (Number.isFinite(t)) return t === 0 ? 0 : t;
|
|
253
|
-
},
|
|
245
|
+
}, R = (e) => {
|
|
254
246
|
let { group: t } = e;
|
|
255
|
-
return t ?
|
|
256
|
-
},
|
|
257
|
-
let t = `${e.tag}|${e.decimal}|${e.group}`, n =
|
|
247
|
+
return t ? r.includes(t) || i.includes(t) ? r + i : t : "";
|
|
248
|
+
}, z = (e) => e.replace(/[\\\]^-]/g, "\\$&"), B = /* @__PURE__ */ new Map(), V = (e) => {
|
|
249
|
+
let t = `${e.tag}|${e.decimal}|${e.group}`, n = B.get(t);
|
|
258
250
|
if (n) return n;
|
|
259
|
-
let r =
|
|
260
|
-
return n = RegExp(`^(-?)(\\d*|${o})(?:${s}(\\d*))?$`),
|
|
261
|
-
},
|
|
262
|
-
let n = f(e.trim()), r =
|
|
251
|
+
let r = R(e), i = e.primary, a = e.secondary, o = r ? `\\d{1,${a}}(?:[${z(r)}]\\d{${a}})*[${z(r)}]\\d{${i}}` : "(?!)", s = e.decimal.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
252
|
+
return n = RegExp(`^(-?)(\\d*|${o})(?:${s}(\\d*))?$`), B.set(t, n), n;
|
|
253
|
+
}, H = (e, t) => {
|
|
254
|
+
let n = f(e.trim()), r = V(t).exec(n);
|
|
263
255
|
if (!r) return null;
|
|
264
256
|
let [, i, a, o] = r, s = a.replace(/\D/g, "");
|
|
265
257
|
return !s && o === void 0 ? i ? "-" : "" : `${i}${s}${o === void 0 ? "" : `.${o}`}`;
|
|
266
|
-
},
|
|
258
|
+
}, U = (e) => {
|
|
267
259
|
let t = "";
|
|
268
|
-
for (let n of f(e)) n ===
|
|
260
|
+
for (let n of f(e)) n === a ? t += "." : (p(n) || n === "." || n === "," || n === "-") && (t += n);
|
|
269
261
|
let n = /^[^\d]*-/.test(t);
|
|
270
262
|
t = t.replace(/-/g, "");
|
|
271
|
-
let r = t.lastIndexOf(","),
|
|
272
|
-
if (r !== -1 &&
|
|
273
|
-
let e = Math.max(r,
|
|
263
|
+
let r = t.lastIndexOf(","), i = t.lastIndexOf("."), o;
|
|
264
|
+
if (r !== -1 && i !== -1) {
|
|
265
|
+
let e = Math.max(r, i);
|
|
274
266
|
o = [...t].map((t, n) => t === "," || t === "." ? n === e ? "." : "" : t).join("");
|
|
275
267
|
} else {
|
|
276
268
|
let e = r === -1 ? "." : ",";
|
|
277
269
|
o = t.split(e).length - 1 > 1 ? t.replaceAll(e, "") : t.replace(",", ".");
|
|
278
270
|
}
|
|
279
271
|
return `${n ? "-" : ""}${o}`;
|
|
280
|
-
},
|
|
272
|
+
}, W = /\p{Nd}/u, G = (e) => {
|
|
281
273
|
let t = e?.normalize("NFKC");
|
|
282
|
-
return t === "." || t === "," || t ===
|
|
283
|
-
},
|
|
284
|
-
let t = [...e], n = t.findIndex((e) =>
|
|
274
|
+
return t === "." || t === "," || t === a;
|
|
275
|
+
}, K = /^(\d+(?:[.,]\d+)?)[eE]([+-]?\d+)$/, q = `.,\u066b\u066c${r}${i}`, J = (e) => {
|
|
276
|
+
let t = [...e], n = t.findIndex((e) => W.test(e));
|
|
285
277
|
if (n === -1) return null;
|
|
286
|
-
let r = (e) => e < t.length &&
|
|
278
|
+
let r = (e) => e < t.length && W.test(t[e]), i = n, a = !1;
|
|
287
279
|
for (; i < t.length;) {
|
|
288
280
|
let e = t[i];
|
|
289
|
-
if (
|
|
290
|
-
else if (
|
|
291
|
-
else if (!
|
|
292
|
-
let e =
|
|
281
|
+
if (W.test(e)) i++;
|
|
282
|
+
else if (q.includes(d(e)) && r(i + 1)) i++;
|
|
283
|
+
else if (!a && (e === "e" || e === "E")) {
|
|
284
|
+
let e = o.includes(t[i + 1]) || t[i + 1] === "+";
|
|
293
285
|
if (!r(i + (e ? 2 : 1))) break;
|
|
294
|
-
|
|
286
|
+
a = !0, i += e ? 2 : 1;
|
|
295
287
|
} else break;
|
|
296
288
|
}
|
|
297
289
|
let s = n;
|
|
298
|
-
|
|
299
|
-
let c = f(t.slice(0, s).join("")), l = t.slice(i).join(""), u = c.includes("-") || c.includes("(") && l.includes(")"),
|
|
300
|
-
if (
|
|
301
|
-
let e =
|
|
290
|
+
G(t[s - 1]) && s--, G(t[i]) && i++;
|
|
291
|
+
let c = f(t.slice(0, s).join("")), l = t.slice(i).join(""), u = c.includes("-") || c.includes("(") && l.includes(")"), p = f(t.slice(s, i).join("")), m = K.exec(p);
|
|
292
|
+
if (m) {
|
|
293
|
+
let e = I(Number(`${m[1].replace(",", ".")}e${m[2]}`), 20);
|
|
302
294
|
return e && u ? `-${e}` : e;
|
|
303
295
|
}
|
|
304
|
-
return `${u ? "-" : ""}${
|
|
305
|
-
},
|
|
306
|
-
let n =
|
|
307
|
-
return
|
|
308
|
-
},
|
|
309
|
-
let
|
|
310
|
-
if (p(
|
|
296
|
+
return `${u ? "-" : ""}${p}`;
|
|
297
|
+
}, Y = (e, t) => {
|
|
298
|
+
let n = J(e) ?? e;
|
|
299
|
+
return H(n, t) ?? U(n);
|
|
300
|
+
}, X = 20, Z = (e, t, n, r) => {
|
|
301
|
+
let i = d(n), { raw: o } = e;
|
|
302
|
+
if (p(i)) {
|
|
311
303
|
let n = t === 0 && o.startsWith("-") ? 1 : t;
|
|
312
304
|
return {
|
|
313
305
|
state: {
|
|
314
306
|
...e,
|
|
315
|
-
raw: o.slice(0, n) +
|
|
307
|
+
raw: o.slice(0, n) + i + o.slice(n)
|
|
316
308
|
},
|
|
317
309
|
caret: n + 1
|
|
318
310
|
};
|
|
319
311
|
}
|
|
320
|
-
if (
|
|
312
|
+
if (i === "-") return o.startsWith("-") ? {
|
|
321
313
|
state: {
|
|
322
314
|
...e,
|
|
323
315
|
raw: o.slice(1)
|
|
@@ -330,7 +322,7 @@ var e = {
|
|
|
330
322
|
},
|
|
331
323
|
caret: t + 1
|
|
332
324
|
};
|
|
333
|
-
let s =
|
|
325
|
+
let s = i === a ? "." : i;
|
|
334
326
|
if (s !== "," && s !== "." || s === e.groupChar) return null;
|
|
335
327
|
let c = o.indexOf(".");
|
|
336
328
|
if (c === -1) return t === 0 && o.startsWith("-") ? null : {
|
|
@@ -369,7 +361,7 @@ var e = {
|
|
|
369
361
|
},
|
|
370
362
|
caret: t - 1
|
|
371
363
|
};
|
|
372
|
-
},
|
|
364
|
+
}, ne = (e, t, n) => {
|
|
373
365
|
let r = e, i = t, a = +!!r.startsWith("-");
|
|
374
366
|
r[a] === "." && (r = `${r.slice(0, a)}0${r.slice(a)}`, i > a && i++);
|
|
375
367
|
let o = r.indexOf(".");
|
|
@@ -377,13 +369,13 @@ var e = {
|
|
|
377
369
|
let e = Math.max(0, n.maxPrecision);
|
|
378
370
|
r.length - o - 1 > e && (r = r.slice(0, o + 1 + e));
|
|
379
371
|
}
|
|
380
|
-
let s = r.length >
|
|
381
|
-
return s && (r = r.slice(0,
|
|
372
|
+
let s = r.length > X;
|
|
373
|
+
return s && (r = r.slice(0, X)), {
|
|
382
374
|
raw: r,
|
|
383
375
|
caret: Math.min(i, r.length),
|
|
384
376
|
cut: s
|
|
385
377
|
};
|
|
386
|
-
},
|
|
378
|
+
}, re = (e, t, n) => {
|
|
387
379
|
let r = Math.min(n.minPrecision, n.maxPrecision), { raw: i } = e, a = Math.max(0, Math.min(t.start, i.length)), o = Math.max(a, Math.min(t.end, i.length)), s = {
|
|
388
380
|
...e,
|
|
389
381
|
caret: a,
|
|
@@ -400,7 +392,7 @@ var e = {
|
|
|
400
392
|
});
|
|
401
393
|
let r = !c;
|
|
402
394
|
for (let e of t.text) {
|
|
403
|
-
let t =
|
|
395
|
+
let t = Z(d, f, e, n);
|
|
404
396
|
t && (d = t.state, f = t.caret, r = !0);
|
|
405
397
|
}
|
|
406
398
|
if (!r) return {
|
|
@@ -411,7 +403,7 @@ var e = {
|
|
|
411
403
|
}
|
|
412
404
|
case "paste": {
|
|
413
405
|
let e = i.slice(0, a) + i.slice(o), r = t.raw;
|
|
414
|
-
if (r.startsWith("-") && (a !== 0 || e.startsWith("-")) && (r = r.slice(1)), r.replace(/^-/, "").length >
|
|
406
|
+
if (r.startsWith("-") && (a !== 0 || e.startsWith("-")) && (r = r.slice(1)), r.replace(/^-/, "").length > X || (n.maxPrecision <= 0 && (r = r.replace(/\.\d*$/, "")), r.includes(".") && e.includes("."))) return {
|
|
415
407
|
...s,
|
|
416
408
|
caret: o
|
|
417
409
|
};
|
|
@@ -469,7 +461,7 @@ var e = {
|
|
|
469
461
|
...d,
|
|
470
462
|
decChar: ""
|
|
471
463
|
});
|
|
472
|
-
let p =
|
|
464
|
+
let p = ne(d.raw, f, n);
|
|
473
465
|
if ((t.type === "insert" || t.type === "paste") && p.cut) return {
|
|
474
466
|
...s,
|
|
475
467
|
caret: o
|
|
@@ -479,9 +471,9 @@ var e = {
|
|
|
479
471
|
raw: p.raw,
|
|
480
472
|
caret: p.caret,
|
|
481
473
|
rejected: !1
|
|
482
|
-
}, h =
|
|
474
|
+
}, h = L(m.raw);
|
|
483
475
|
if (typeof h == "number" && h > n.max) {
|
|
484
|
-
let e =
|
|
476
|
+
let e = I(n.max, n.maxPrecision);
|
|
485
477
|
m = {
|
|
486
478
|
raw: e,
|
|
487
479
|
decChar: "",
|
|
@@ -492,7 +484,11 @@ var e = {
|
|
|
492
484
|
}
|
|
493
485
|
return {
|
|
494
486
|
...m,
|
|
495
|
-
raw:
|
|
487
|
+
raw: Q(m.raw, r)
|
|
496
488
|
};
|
|
497
|
-
},
|
|
498
|
-
|
|
489
|
+
}, Q = (e, t) => t > 0 && /\d/.test(e) && !e.includes(".") ? `${e}.` : e, $ = (e) => {
|
|
490
|
+
if (!Number.isFinite(e)) return 0;
|
|
491
|
+
let [t, n = "0"] = String(Math.abs(e)).split("e"), r = t.split(".")[1]?.length ?? 0;
|
|
492
|
+
return Math.max(0, r - Number(n));
|
|
493
|
+
}, ie = (e, t) => typeof e == "number" ? I(e, Math.max(t, $(e))) : "", ae = { span: "minimal" };
|
|
494
|
+
export { t as PLAIN_SYMBOLS, x as affixOf, re as applyEdit, l as currencyDigitsOf, h as displayIndexOf, O as formatAffixed, m as formatRaw, $ as fractionDigitsOf, v as isShellOnly, d as normalizeChar, c as numberSymbolsOf, H as parseLocaleText, U as parseLooseText, ie as rawAtRest, g as rawIndexOf, I as rawOfNumber, Y as readText, _ as snapOffset, te as spokenAffixed, P as stripAffix, L as valueOfRaw, Q as withPaddedMark, ae as writeStrategy };
|
|
@@ -198,9 +198,10 @@ export type BbNumberInputProps = BbNumberInputPtProps & {
|
|
|
198
198
|
*/
|
|
199
199
|
max?: number;
|
|
200
200
|
/**
|
|
201
|
-
* Maximum
|
|
202
|
-
*
|
|
203
|
-
*
|
|
201
|
+
* Maximum fraction digits the user can TYPE (more are refused, never
|
|
202
|
+
* rounded); a model with more still shows them all. With `currency`, the
|
|
203
|
+
* currency's own digits (`2` EUR, `0` JPY and HUF, `3` KWD), or
|
|
204
|
+
* `minPrecision` when that is larger.
|
|
204
205
|
*
|
|
205
206
|
* @defaultValue `8`
|
|
206
207
|
*/
|