@urbicon-ui/blocks 6.19.1 → 6.19.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CurrencyInput/CurrencyInput.svelte +10 -4
- package/dist/components/CurrencyInput/index.d.ts +13 -11
- package/dist/primitives/Combobox/Combobox.svelte +8 -1
- package/dist/primitives/Combobox/combobox.variants.d.ts +29 -0
- package/dist/primitives/Combobox/combobox.variants.js +22 -7
- package/dist/primitives/Select/Select.svelte +0 -1
- package/package.json +3 -3
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Input } from '../../primitives/Input';
|
|
3
|
+
import { useI18n } from '@urbicon-ui/i18n';
|
|
3
4
|
import type { CurrencyInputProps } from './index';
|
|
4
5
|
|
|
5
6
|
let {
|
|
6
7
|
value = $bindable(null),
|
|
7
|
-
locale = '
|
|
8
|
+
locale = 'auto',
|
|
8
9
|
currency = 'EUR',
|
|
9
10
|
symbolPosition = 'suffix',
|
|
10
11
|
precision = 2,
|
|
@@ -15,9 +16,14 @@
|
|
|
15
16
|
...inputProps
|
|
16
17
|
}: CurrencyInputProps = $props();
|
|
17
18
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
)
|
|
19
|
+
const i18n = useI18n();
|
|
20
|
+
|
|
21
|
+
// `'auto'` (the default) follows the active `<I18nProvider>` locale — SSR-safe
|
|
22
|
+
// (server and client resolve the same locale) and consistent with the rest of
|
|
23
|
+
// the library's number formatting (CompositionBar/Sankey read `i18n.locale`
|
|
24
|
+
// too). Falls back to the base locale (`en`) when no provider is mounted. An
|
|
25
|
+
// explicit BCP 47 string overrides it.
|
|
26
|
+
const resolvedLocale = $derived(locale === 'auto' ? i18n.locale : locale);
|
|
21
27
|
|
|
22
28
|
const decimalSeparator = $derived(
|
|
23
29
|
new Intl.NumberFormat(resolvedLocale).formatToParts(1.1).find((p) => p.type === 'decimal')
|
|
@@ -24,10 +24,11 @@ export type CurrencySymbolPosition = 'prefix' | 'suffix' | 'none';
|
|
|
24
24
|
* @tag form
|
|
25
25
|
* @related Input
|
|
26
26
|
*
|
|
27
|
-
* @example Default —
|
|
27
|
+
* @example Default — follows the active i18n locale
|
|
28
28
|
* ```svelte
|
|
29
29
|
* <script>
|
|
30
|
-
*
|
|
30
|
+
* // "1.234,56 €" under a `de` provider, "1,234.56 €" under `en` (the default)
|
|
31
|
+
* let priceCents = $state(1234_56);
|
|
31
32
|
* </script>
|
|
32
33
|
* <CurrencyInput label="Price" bind:value={priceCents} />
|
|
33
34
|
* ```
|
|
@@ -68,15 +69,16 @@ export interface CurrencyInputProps extends Omit<InputProps, 'type' | 'value' |
|
|
|
68
69
|
*/
|
|
69
70
|
name?: string;
|
|
70
71
|
/**
|
|
71
|
-
* BCP 47 locale used for formatting (`Intl.NumberFormat`). Controls
|
|
72
|
-
* grouping separator (`.` vs `,`) and decimal separator.
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* `
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
72
|
+
* BCP 47 locale used for formatting (`Intl.NumberFormat`). Controls the
|
|
73
|
+
* grouping separator (`.` vs `,`) and decimal separator. Defaults to
|
|
74
|
+
* `'auto'`, which follows the active `<I18nProvider>` locale — SSR-safe
|
|
75
|
+
* (server and client resolve the same locale, no hydration flash) and
|
|
76
|
+
* consistent with the rest of the library's number formatting. Falls back
|
|
77
|
+
* to the base locale (`en`) when no provider is mounted. Pass an explicit
|
|
78
|
+
* BCP 47 string (e.g. `'de-DE'`, `'ja-JP'`) to override. `currency` is
|
|
79
|
+
* intentionally **not** auto-detected, since it is orthogonal to locale
|
|
80
|
+
* (a `de-CH` user may still bill in EUR).
|
|
81
|
+
* @default 'auto'
|
|
80
82
|
*/
|
|
81
83
|
locale?: string;
|
|
82
84
|
/**
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
required = false,
|
|
28
28
|
filter,
|
|
29
29
|
tier,
|
|
30
|
+
variant = 'outlined',
|
|
30
31
|
size = 'md',
|
|
31
32
|
clearable = false,
|
|
32
33
|
disabled = false,
|
|
@@ -89,7 +90,13 @@
|
|
|
89
90
|
return options.filter((o) => filterFn(o, query.trim()));
|
|
90
91
|
});
|
|
91
92
|
|
|
92
|
-
const variantProps: ComboboxVariants = $derived({
|
|
93
|
+
const variantProps: ComboboxVariants = $derived({
|
|
94
|
+
variant,
|
|
95
|
+
tier: effectiveTier,
|
|
96
|
+
size,
|
|
97
|
+
open,
|
|
98
|
+
disabled
|
|
99
|
+
});
|
|
93
100
|
const styles = $derived(comboboxVariants(variantProps));
|
|
94
101
|
|
|
95
102
|
const slotClasses = $derived(
|
|
@@ -8,6 +8,20 @@ export declare const comboboxVariants: (props?: import("../../utils/variants.js"
|
|
|
8
8
|
input: string;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
+
variant: {
|
|
12
|
+
outlined: {
|
|
13
|
+
input: string;
|
|
14
|
+
};
|
|
15
|
+
filled: {
|
|
16
|
+
input: string;
|
|
17
|
+
};
|
|
18
|
+
ghost: {
|
|
19
|
+
input: string;
|
|
20
|
+
};
|
|
21
|
+
underline: {
|
|
22
|
+
input: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
11
25
|
size: {
|
|
12
26
|
sm: {
|
|
13
27
|
input: string;
|
|
@@ -35,6 +49,7 @@ export declare const comboboxVariants: (props?: import("../../utils/variants.js"
|
|
|
35
49
|
}> | undefined) => {
|
|
36
50
|
base: (props?: ({
|
|
37
51
|
tier?: "commit" | "modify" | undefined;
|
|
52
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
38
53
|
size?: "sm" | "md" | "lg" | undefined;
|
|
39
54
|
open?: boolean | undefined;
|
|
40
55
|
disabled?: boolean | undefined;
|
|
@@ -44,6 +59,7 @@ export declare const comboboxVariants: (props?: import("../../utils/variants.js"
|
|
|
44
59
|
}) | undefined) => string;
|
|
45
60
|
label: (props?: ({
|
|
46
61
|
tier?: "commit" | "modify" | undefined;
|
|
62
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
47
63
|
size?: "sm" | "md" | "lg" | undefined;
|
|
48
64
|
open?: boolean | undefined;
|
|
49
65
|
disabled?: boolean | undefined;
|
|
@@ -53,6 +69,7 @@ export declare const comboboxVariants: (props?: import("../../utils/variants.js"
|
|
|
53
69
|
}) | undefined) => string;
|
|
54
70
|
requiredMark: (props?: ({
|
|
55
71
|
tier?: "commit" | "modify" | undefined;
|
|
72
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
56
73
|
size?: "sm" | "md" | "lg" | undefined;
|
|
57
74
|
open?: boolean | undefined;
|
|
58
75
|
disabled?: boolean | undefined;
|
|
@@ -62,6 +79,7 @@ export declare const comboboxVariants: (props?: import("../../utils/variants.js"
|
|
|
62
79
|
}) | undefined) => string;
|
|
63
80
|
inputWrapper: (props?: ({
|
|
64
81
|
tier?: "commit" | "modify" | undefined;
|
|
82
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
65
83
|
size?: "sm" | "md" | "lg" | undefined;
|
|
66
84
|
open?: boolean | undefined;
|
|
67
85
|
disabled?: boolean | undefined;
|
|
@@ -71,6 +89,7 @@ export declare const comboboxVariants: (props?: import("../../utils/variants.js"
|
|
|
71
89
|
}) | undefined) => string;
|
|
72
90
|
input: (props?: ({
|
|
73
91
|
tier?: "commit" | "modify" | undefined;
|
|
92
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
74
93
|
size?: "sm" | "md" | "lg" | undefined;
|
|
75
94
|
open?: boolean | undefined;
|
|
76
95
|
disabled?: boolean | undefined;
|
|
@@ -80,6 +99,7 @@ export declare const comboboxVariants: (props?: import("../../utils/variants.js"
|
|
|
80
99
|
}) | undefined) => string;
|
|
81
100
|
message: (props?: ({
|
|
82
101
|
tier?: "commit" | "modify" | undefined;
|
|
102
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
83
103
|
size?: "sm" | "md" | "lg" | undefined;
|
|
84
104
|
open?: boolean | undefined;
|
|
85
105
|
disabled?: boolean | undefined;
|
|
@@ -89,6 +109,7 @@ export declare const comboboxVariants: (props?: import("../../utils/variants.js"
|
|
|
89
109
|
}) | undefined) => string;
|
|
90
110
|
hint: (props?: ({
|
|
91
111
|
tier?: "commit" | "modify" | undefined;
|
|
112
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
92
113
|
size?: "sm" | "md" | "lg" | undefined;
|
|
93
114
|
open?: boolean | undefined;
|
|
94
115
|
disabled?: boolean | undefined;
|
|
@@ -98,6 +119,7 @@ export declare const comboboxVariants: (props?: import("../../utils/variants.js"
|
|
|
98
119
|
}) | undefined) => string;
|
|
99
120
|
listbox: (props?: ({
|
|
100
121
|
tier?: "commit" | "modify" | undefined;
|
|
122
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
101
123
|
size?: "sm" | "md" | "lg" | undefined;
|
|
102
124
|
open?: boolean | undefined;
|
|
103
125
|
disabled?: boolean | undefined;
|
|
@@ -107,6 +129,7 @@ export declare const comboboxVariants: (props?: import("../../utils/variants.js"
|
|
|
107
129
|
}) | undefined) => string;
|
|
108
130
|
option: (props?: ({
|
|
109
131
|
tier?: "commit" | "modify" | undefined;
|
|
132
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
110
133
|
size?: "sm" | "md" | "lg" | undefined;
|
|
111
134
|
open?: boolean | undefined;
|
|
112
135
|
disabled?: boolean | undefined;
|
|
@@ -116,6 +139,7 @@ export declare const comboboxVariants: (props?: import("../../utils/variants.js"
|
|
|
116
139
|
}) | undefined) => string;
|
|
117
140
|
optionActive: (props?: ({
|
|
118
141
|
tier?: "commit" | "modify" | undefined;
|
|
142
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
119
143
|
size?: "sm" | "md" | "lg" | undefined;
|
|
120
144
|
open?: boolean | undefined;
|
|
121
145
|
disabled?: boolean | undefined;
|
|
@@ -125,6 +149,7 @@ export declare const comboboxVariants: (props?: import("../../utils/variants.js"
|
|
|
125
149
|
}) | undefined) => string;
|
|
126
150
|
optionSelected: (props?: ({
|
|
127
151
|
tier?: "commit" | "modify" | undefined;
|
|
152
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
128
153
|
size?: "sm" | "md" | "lg" | undefined;
|
|
129
154
|
open?: boolean | undefined;
|
|
130
155
|
disabled?: boolean | undefined;
|
|
@@ -134,6 +159,7 @@ export declare const comboboxVariants: (props?: import("../../utils/variants.js"
|
|
|
134
159
|
}) | undefined) => string;
|
|
135
160
|
noResults: (props?: ({
|
|
136
161
|
tier?: "commit" | "modify" | undefined;
|
|
162
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
137
163
|
size?: "sm" | "md" | "lg" | undefined;
|
|
138
164
|
open?: boolean | undefined;
|
|
139
165
|
disabled?: boolean | undefined;
|
|
@@ -143,6 +169,7 @@ export declare const comboboxVariants: (props?: import("../../utils/variants.js"
|
|
|
143
169
|
}) | undefined) => string;
|
|
144
170
|
clear: (props?: ({
|
|
145
171
|
tier?: "commit" | "modify" | undefined;
|
|
172
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
146
173
|
size?: "sm" | "md" | "lg" | undefined;
|
|
147
174
|
open?: boolean | undefined;
|
|
148
175
|
disabled?: boolean | undefined;
|
|
@@ -152,6 +179,7 @@ export declare const comboboxVariants: (props?: import("../../utils/variants.js"
|
|
|
152
179
|
}) | undefined) => string;
|
|
153
180
|
chevronButton: (props?: ({
|
|
154
181
|
tier?: "commit" | "modify" | undefined;
|
|
182
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
155
183
|
size?: "sm" | "md" | "lg" | undefined;
|
|
156
184
|
open?: boolean | undefined;
|
|
157
185
|
disabled?: boolean | undefined;
|
|
@@ -161,6 +189,7 @@ export declare const comboboxVariants: (props?: import("../../utils/variants.js"
|
|
|
161
189
|
}) | undefined) => string;
|
|
162
190
|
chevron: (props?: ({
|
|
163
191
|
tier?: "commit" | "modify" | undefined;
|
|
192
|
+
variant?: "ghost" | "filled" | "outlined" | "underline" | undefined;
|
|
164
193
|
size?: "sm" | "md" | "lg" | undefined;
|
|
165
194
|
open?: boolean | undefined;
|
|
166
195
|
disabled?: boolean | undefined;
|
|
@@ -6,13 +6,10 @@ export const comboboxVariants = tv({
|
|
|
6
6
|
requiredMark: 'text-danger ml-0.5',
|
|
7
7
|
inputWrapper: 'relative w-full',
|
|
8
8
|
input: [
|
|
9
|
-
// Radius driven by `tier` axis below
|
|
10
|
-
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
// `border-neutral` intent token is reserved for Action surfaces
|
|
14
|
-
// (Outline-Button, Menu) where the border needs to read as clickable.
|
|
15
|
-
'border-border-subtle hover:border-border-default placeholder:text-text-tertiary',
|
|
9
|
+
// Radius driven by `tier` axis below; the `underline` variant overrides
|
|
10
|
+
// it to `rounded-none`. Border color and background come from the
|
|
11
|
+
// `variant` axis (default `outlined` keeps the historical look).
|
|
12
|
+
'w-full border bg-surface-base text-text-primary placeholder:text-text-tertiary',
|
|
16
13
|
'transition-colors duration-[var(--blocks-duration-fast)]',
|
|
17
14
|
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:border-primary',
|
|
18
15
|
'disabled:opacity-50 disabled:cursor-not-allowed'
|
|
@@ -70,6 +67,23 @@ export const comboboxVariants = tv({
|
|
|
70
67
|
modify: { input: 'rounded-modify' },
|
|
71
68
|
commit: { input: 'rounded-commit' }
|
|
72
69
|
},
|
|
70
|
+
// Visual style, at parity with Input / Textarea / Select. Default
|
|
71
|
+
// `outlined` reproduces the historical Combobox frame exactly.
|
|
72
|
+
variant: {
|
|
73
|
+
// Surface-family border: form-control frames stay quiet (`border-subtle`);
|
|
74
|
+
// the `border-neutral` intent token is reserved for Action surfaces
|
|
75
|
+
// (Outline-Button, Menu) where the border must read as clickable.
|
|
76
|
+
outlined: { input: 'border-border-subtle hover:border-border-default' },
|
|
77
|
+
filled: {
|
|
78
|
+
input: 'bg-surface-interactive border-transparent hover:bg-surface-hover focus-visible:bg-surface-base'
|
|
79
|
+
},
|
|
80
|
+
ghost: {
|
|
81
|
+
input: 'bg-transparent border-transparent hover:bg-surface-subtle focus-visible:bg-surface-base focus-visible:border-border-subtle'
|
|
82
|
+
},
|
|
83
|
+
underline: {
|
|
84
|
+
input: 'bg-transparent border-0 border-b-2 border-border-subtle rounded-none focus-visible:ring-0'
|
|
85
|
+
}
|
|
86
|
+
},
|
|
73
87
|
size: {
|
|
74
88
|
sm: {
|
|
75
89
|
// `pointer-coarse:text-base` floors the input to 16px on touch-primary
|
|
@@ -95,6 +109,7 @@ export const comboboxVariants = tv({
|
|
|
95
109
|
},
|
|
96
110
|
defaultVariants: {
|
|
97
111
|
tier: 'modify',
|
|
112
|
+
variant: 'outlined',
|
|
98
113
|
size: 'md',
|
|
99
114
|
open: false,
|
|
100
115
|
disabled: false
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
// `<Select bind:value={x: T | null}>` narrow correctly. Internally we
|
|
64
64
|
// dispatch through a loose alias so the component code can hand either
|
|
65
65
|
// shape into `onValueChange` without per-branch casts at every call site.
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- internal dispatch escape hatch (see comment above)
|
|
67
66
|
const dispatchValueChange = onValueChange as ((v: any) => void) | undefined;
|
|
68
67
|
|
|
69
68
|
/** Resolved null option config — `null` when prop is unset or `groups` is in use. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@urbicon-ui/blocks",
|
|
3
|
-
"version": "6.19.
|
|
3
|
+
"version": "6.19.2",
|
|
4
4
|
"description": "Svelte 5 UI component library with Tailwind CSS 4, OKLCH design tokens and zero runtime dependencies",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
"@sveltejs/package": "^2.5.8",
|
|
92
92
|
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
93
93
|
"@tailwindcss/vite": "^4.3.1",
|
|
94
|
-
"@urbicon-ui/i18n": "6.19.
|
|
95
|
-
"@urbicon-ui/shared-types": "6.19.
|
|
94
|
+
"@urbicon-ui/i18n": "6.19.2",
|
|
95
|
+
"@urbicon-ui/shared-types": "6.19.2",
|
|
96
96
|
"prettier": "^3.8.4",
|
|
97
97
|
"prettier-plugin-svelte": "^4.1.1",
|
|
98
98
|
"prettier-plugin-tailwindcss": "^0.8.0",
|