@happyvertical/smrt-ui 0.53.3 → 0.53.5
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 +26 -0
- package/dist/components/forms/CodeSelect.svelte +50 -0
- package/dist/components/forms/CodeSelect.svelte.d.ts +12 -0
- package/dist/components/forms/CodeSelect.svelte.d.ts.map +1 -0
- package/dist/components/forms/CountrySelect.svelte +23 -0
- package/dist/components/forms/CountrySelect.svelte.d.ts +10 -0
- package/dist/components/forms/CountrySelect.svelte.d.ts.map +1 -0
- package/dist/components/forms/CurrencySelect.svelte +23 -0
- package/dist/components/forms/CurrencySelect.svelte.d.ts +10 -0
- package/dist/components/forms/CurrencySelect.svelte.d.ts.map +1 -0
- package/dist/components/forms/ProvinceSelect.svelte +24 -0
- package/dist/components/forms/ProvinceSelect.svelte.d.ts +10 -0
- package/dist/components/forms/ProvinceSelect.svelte.d.ts.map +1 -0
- package/dist/components/forms/StagedControlReview.svelte +3 -1
- package/dist/components/forms/StagedControlReview.svelte.d.ts.map +1 -1
- package/dist/components/forms/code-select-options.d.ts +8 -0
- package/dist/components/forms/code-select-options.d.ts.map +1 -0
- package/dist/components/forms/code-select-options.js +315 -0
- package/dist/components/forms/code-select-types.d.ts +42 -0
- package/dist/components/forms/code-select-types.d.ts.map +1 -0
- package/dist/components/forms/code-select-types.js +1 -0
- package/dist/components/forms/index.d.ts +4 -0
- package/dist/components/forms/index.d.ts.map +1 -1
- package/dist/components/forms/index.js +3 -0
- package/dist/svelte/playground/CodeSelectorsPreview.svelte +29 -0
- package/dist/svelte/playground/CodeSelectorsPreview.svelte.d.ts +4 -0
- package/dist/svelte/playground/CodeSelectorsPreview.svelte.d.ts.map +1 -0
- package/dist/svelte/playground.d.ts +1 -1
- package/dist/svelte/playground.d.ts.map +1 -1
- package/dist/svelte/playground.js +9 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1087,3 +1087,29 @@ their empty shape. Names and paths must be nonempty strings; invalid mixed sets
|
|
|
1087
1087
|
are rejected atomically. Sets are snapshotted, so later caller mutations do not
|
|
1088
1088
|
change glyphs. Register static application assets, never request or identity data,
|
|
1089
1089
|
and install the same application set for SSR and client hydration.
|
|
1090
|
+
|
|
1091
|
+
### Currency, country, and province controls
|
|
1092
|
+
|
|
1093
|
+
Import `CurrencySelect`, `CountrySelect`, `ProvinceSelect`, their named `*Props`
|
|
1094
|
+
interfaces, and `CodeSelectOption` from `@happyvertical/smrt-ui/forms`. Each composes
|
|
1095
|
+
shared Select/Input controls, accepts a bindable string `value`, native Select
|
|
1096
|
+
attributes (except children/multiple), density and interaction configuration,
|
|
1097
|
+
`locale` (default `en`), `placeholder` (default `—`), and `readOnly`.
|
|
1098
|
+
|
|
1099
|
+
Currency choices use existing ISO 4217 metadata. Countries cover 249 ISO 3166-1
|
|
1100
|
+
alpha-2 codes; both use Intl.DisplayNames and invalid locales fall back to English.
|
|
1101
|
+
ProvinceSelect accepts `country?: string`: built-ins cover Canada's 13 subdivisions
|
|
1102
|
+
and the United States' 57 ISO subdivisions (50 states, DC and six territories).
|
|
1103
|
+
Region labels default to English. Other/missing countries use a free-text Input.
|
|
1104
|
+
Provide `options?: readonly CodeSelectOption[]` to replace built-ins and localize
|
|
1105
|
+
region labels; even an empty array deliberately selects the custom Select mode.
|
|
1106
|
+
Each option has `value`, optional `label`, and optional `disabled`.
|
|
1107
|
+
|
|
1108
|
+
Blank values stay blank; unknown values and country/options changes preserve the
|
|
1109
|
+
exact raw string. Callers validate permitted values server-side. Disabled options
|
|
1110
|
+
retain native FormData omission. `readOnly` disables the visible control and submits
|
|
1111
|
+
the original value via a hidden input, including external `form` association;
|
|
1112
|
+
`disabled` and disabled fieldsets omit it. Province event targets can be either
|
|
1113
|
+
HTMLInputElement or HTMLSelectElement. All controls expose `focus()` and
|
|
1114
|
+
`getElement()`. The Workbench code-selectors entry demonstrates changing countries
|
|
1115
|
+
and inspecting native payloads without a provider.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ComponentProps } from 'svelte';
|
|
3
|
+
import type { CodeSelectProps } from './code-select-types.js';
|
|
4
|
+
import Input from './Input.svelte';
|
|
5
|
+
import Select from './Select.svelte';
|
|
6
|
+
|
|
7
|
+
interface Props extends CodeSelectProps {
|
|
8
|
+
/** Internal region fallback for countries without a built-in option list. */
|
|
9
|
+
freeText?: boolean;
|
|
10
|
+
}
|
|
11
|
+
let {
|
|
12
|
+
value = $bindable(''),
|
|
13
|
+
options = [],
|
|
14
|
+
placeholder = '—',
|
|
15
|
+
readOnly = false,
|
|
16
|
+
disabled = false,
|
|
17
|
+
freeText = false,
|
|
18
|
+
locale: _locale,
|
|
19
|
+
name,
|
|
20
|
+
form,
|
|
21
|
+
...rest
|
|
22
|
+
}: Props = $props();
|
|
23
|
+
const hiddenId = $props.id();
|
|
24
|
+
let select: Select | undefined = $state();
|
|
25
|
+
let input: Input | undefined = $state();
|
|
26
|
+
const choices = $derived(options.filter((option) => option.value !== ''));
|
|
27
|
+
const retained = $derived(
|
|
28
|
+
value !== '' && !choices.some((option) => option.value === value),
|
|
29
|
+
);
|
|
30
|
+
// Only ProvinceSelect uses freeText; its public event types expose both targets.
|
|
31
|
+
const inputRest = $derived(rest as Omit<ComponentProps<typeof Input>, 'value'>);
|
|
32
|
+
/** Focus the active shared control. */
|
|
33
|
+
export function focus(): void {
|
|
34
|
+
(freeText ? input : select)?.focus();
|
|
35
|
+
}
|
|
36
|
+
/** Return the active native element. */
|
|
37
|
+
export function getElement(): HTMLInputElement | HTMLSelectElement | null {
|
|
38
|
+
return (freeText ? input : select)?.getElement() ?? null;
|
|
39
|
+
}
|
|
40
|
+
</script>
|
|
41
|
+
{#if freeText}
|
|
42
|
+
<Input {...inputRest} bind:this={input} bind:value type="text" {name} {form} {placeholder} disabled={disabled || readOnly} />
|
|
43
|
+
{:else}
|
|
44
|
+
<Select {...rest} bind:this={select} bind:value {name} {form} disabled={disabled || readOnly}>
|
|
45
|
+
<option value="">{placeholder}</option>
|
|
46
|
+
{#if retained}<option value={value}>{value}</option>{/if}
|
|
47
|
+
{#each choices as option}<option value={option.value} disabled={option.disabled}>{option.label ?? option.value}</option>{/each}
|
|
48
|
+
</Select>
|
|
49
|
+
{/if}
|
|
50
|
+
{#if readOnly}<Input id={hiddenId} type="hidden" {name} {form} {value} {disabled} interaction={false} />{/if}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CodeSelectProps } from './code-select-types.js';
|
|
2
|
+
interface Props extends CodeSelectProps {
|
|
3
|
+
/** Internal region fallback for countries without a built-in option list. */
|
|
4
|
+
freeText?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const CodeSelect: import("svelte").Component<Props, {
|
|
7
|
+
focus: () => void;
|
|
8
|
+
getElement: () => HTMLInputElement | HTMLSelectElement | null;
|
|
9
|
+
}, "value">;
|
|
10
|
+
type CodeSelect = ReturnType<typeof CodeSelect>;
|
|
11
|
+
export default CodeSelect;
|
|
12
|
+
//# sourceMappingURL=CodeSelect.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeSelect.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/forms/CodeSelect.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAK9D,UAAU,KAAM,SAAQ,eAAe;IACrC,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAkDD,QAAA,MAAM,UAAU;iBArBG,IAAI;sBAIC,gBAAgB,GAAG,iBAAiB,GAAG,IAAI;WAiBX,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import CodeSelect from './CodeSelect.svelte';
|
|
3
|
+
import { countryOptions } from './code-select-options.js';
|
|
4
|
+
import type { CountrySelectProps } from './code-select-types.js';
|
|
5
|
+
export interface Props extends CountrySelectProps {}
|
|
6
|
+
let {
|
|
7
|
+
value = $bindable(''),
|
|
8
|
+
options,
|
|
9
|
+
locale = 'en',
|
|
10
|
+
...rest
|
|
11
|
+
}: Props = $props();
|
|
12
|
+
let control: CodeSelect | undefined = $state();
|
|
13
|
+
const choices = $derived(options ?? countryOptions(locale));
|
|
14
|
+
/** Focus the active native control. */
|
|
15
|
+
export function focus(): void {
|
|
16
|
+
control?.focus();
|
|
17
|
+
}
|
|
18
|
+
/** Return the actual native control, or null before mounting. */
|
|
19
|
+
export function getElement() {
|
|
20
|
+
return control?.getElement() ?? null;
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
<CodeSelect {...rest} bind:this={control} bind:value options={choices} />
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CountrySelectProps } from './code-select-types.js';
|
|
2
|
+
export interface Props extends CountrySelectProps {
|
|
3
|
+
}
|
|
4
|
+
declare const CountrySelect: import("svelte").Component<Props, {
|
|
5
|
+
focus: () => void;
|
|
6
|
+
getElement: () => HTMLInputElement | HTMLSelectElement | null;
|
|
7
|
+
}, "value">;
|
|
8
|
+
type CountrySelect = ReturnType<typeof CountrySelect>;
|
|
9
|
+
export default CountrySelect;
|
|
10
|
+
//# sourceMappingURL=CountrySelect.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CountrySelect.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/forms/CountrySelect.svelte.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,MAAM,WAAW,KAAM,SAAQ,kBAAkB;CAAG;AA2BpD,QAAA,MAAM,aAAa;iBAZA,IAAI;;WAYoC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import CodeSelect from './CodeSelect.svelte';
|
|
3
|
+
import { currencyOptions } from './code-select-options.js';
|
|
4
|
+
import type { CurrencySelectProps } from './code-select-types.js';
|
|
5
|
+
export interface Props extends CurrencySelectProps {}
|
|
6
|
+
let {
|
|
7
|
+
value = $bindable(''),
|
|
8
|
+
options,
|
|
9
|
+
locale = 'en',
|
|
10
|
+
...rest
|
|
11
|
+
}: Props = $props();
|
|
12
|
+
let control: CodeSelect | undefined = $state();
|
|
13
|
+
const choices = $derived(options ?? currencyOptions(locale));
|
|
14
|
+
/** Focus the active native control. */
|
|
15
|
+
export function focus(): void {
|
|
16
|
+
control?.focus();
|
|
17
|
+
}
|
|
18
|
+
/** Return the actual native control, or null before mounting. */
|
|
19
|
+
export function getElement() {
|
|
20
|
+
return control?.getElement() ?? null;
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
<CodeSelect {...rest} bind:this={control} bind:value options={choices} />
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CurrencySelectProps } from './code-select-types.js';
|
|
2
|
+
export interface Props extends CurrencySelectProps {
|
|
3
|
+
}
|
|
4
|
+
declare const CurrencySelect: import("svelte").Component<Props, {
|
|
5
|
+
focus: () => void;
|
|
6
|
+
getElement: () => HTMLInputElement | HTMLSelectElement | null;
|
|
7
|
+
}, "value">;
|
|
8
|
+
type CurrencySelect = ReturnType<typeof CurrencySelect>;
|
|
9
|
+
export default CurrencySelect;
|
|
10
|
+
//# sourceMappingURL=CurrencySelect.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CurrencySelect.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/forms/CurrencySelect.svelte.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElE,MAAM,WAAW,KAAM,SAAQ,mBAAmB;CAAG;AA2BrD,QAAA,MAAM,cAAc;iBAZD,IAAI;;WAYqC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import CodeSelect from './CodeSelect.svelte';
|
|
3
|
+
import { provinceOptions } from './code-select-options.js';
|
|
4
|
+
import type { ProvinceSelectProps } from './code-select-types.js';
|
|
5
|
+
export interface Props extends ProvinceSelectProps {}
|
|
6
|
+
let {
|
|
7
|
+
value = $bindable(''),
|
|
8
|
+
options,
|
|
9
|
+
locale = 'en',
|
|
10
|
+
country = '',
|
|
11
|
+
...rest
|
|
12
|
+
}: Props = $props();
|
|
13
|
+
let control: CodeSelect | undefined = $state();
|
|
14
|
+
const choices = $derived(options ?? provinceOptions(country));
|
|
15
|
+
/** Focus the active native control. */
|
|
16
|
+
export function focus(): void {
|
|
17
|
+
control?.focus();
|
|
18
|
+
}
|
|
19
|
+
/** Return the actual native control, or null before mounting. */
|
|
20
|
+
export function getElement() {
|
|
21
|
+
return control?.getElement() ?? null;
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
<CodeSelect {...rest} bind:this={control} bind:value options={choices} freeText={choices === undefined} />
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ProvinceSelectProps } from './code-select-types.js';
|
|
2
|
+
export interface Props extends ProvinceSelectProps {
|
|
3
|
+
}
|
|
4
|
+
declare const ProvinceSelect: import("svelte").Component<Props, {
|
|
5
|
+
focus: () => void;
|
|
6
|
+
getElement: () => HTMLInputElement | HTMLSelectElement | null;
|
|
7
|
+
}, "value">;
|
|
8
|
+
type ProvinceSelect = ReturnType<typeof ProvinceSelect>;
|
|
9
|
+
export default ProvinceSelect;
|
|
10
|
+
//# sourceMappingURL=ProvinceSelect.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProvinceSelect.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/forms/ProvinceSelect.svelte.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElE,MAAM,WAAW,KAAM,SAAQ,mBAAmB;CAAG;AA4BrD,QAAA,MAAM,cAAc;iBAZD,IAAI;;WAYqC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}
|
|
@@ -153,7 +153,9 @@ $effect(() => {
|
|
|
153
153
|
$effect(() => {
|
|
154
154
|
if (!formElement) return;
|
|
155
155
|
const element = formElement;
|
|
156
|
-
|
|
156
|
+
// Removing a focused input can dispatch change during a Svelte block effect.
|
|
157
|
+
// This DOM event refresh is independent of the block's reactive evaluation.
|
|
158
|
+
const refreshAfterFieldEdit = () => untrack(refresh);
|
|
157
159
|
const refreshAfterReset = () => queueMicrotask(refresh);
|
|
158
160
|
const discardAfterResetGesture = (event: MouseEvent) => {
|
|
159
161
|
const target = event.target;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StagedControlReview.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/forms/StagedControlReview.svelte.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,0BAA0B,EAE3B,MAAM,0BAA0B,CAAC;AAKlC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAG5E,MAAM,WAAW,KAAK;IACpB,gEAAgE;IAChE,QAAQ,EAAE,0BAA0B,CAAC;IACrC,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,WAAW,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IACrC,2DAA2D;IAC3D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uDAAuD;IACvD,MAAM,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAC7C;
|
|
1
|
+
{"version":3,"file":"StagedControlReview.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/forms/StagedControlReview.svelte.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,0BAA0B,EAE3B,MAAM,0BAA0B,CAAC;AAKlC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAG5E,MAAM,WAAW,KAAK;IACpB,gEAAgE;IAChE,QAAQ,EAAE,0BAA0B,CAAC;IACrC,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,WAAW,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IACrC,2DAA2D;IAC3D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uDAAuD;IACvD,MAAM,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAC7C;AA6kBD,QAAA,MAAM,mBAAmB,2CAAwC,CAAC;AAClE,KAAK,mBAAmB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAClE,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CodeSelectOption } from './code-select-types.js';
|
|
2
|
+
/** Build localized choices from the shared ISO currency metadata. */
|
|
3
|
+
export declare function currencyOptions(locale: string): CodeSelectOption[];
|
|
4
|
+
/** Build localized ISO alpha-2 country choices. */
|
|
5
|
+
export declare function countryOptions(locale: string): CodeSelectOption[];
|
|
6
|
+
/** Return CA/US subdivision choices, or undefined for free-text countries. */
|
|
7
|
+
export declare function provinceOptions(country: string): readonly CodeSelectOption[] | undefined;
|
|
8
|
+
//# sourceMappingURL=code-select-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-select-options.d.ts","sourceRoot":"","sources":["../../../src/components/forms/code-select-options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAiT/D,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAMlE;AACD,mDAAmD;AACnD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAGjE;AACD,8EAA8E;AAC9E,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,GACd,SAAS,gBAAgB,EAAE,GAAG,SAAS,CAEzC"}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { ISO_4217_MINOR_UNITS } from '../display/currency-metadata.js';
|
|
2
|
+
// ISO 3166-1 alpha-2 and ISO 3166-2 CA/US snapshot from iso-codes 4.20.1.
|
|
3
|
+
// https://salsa.debian.org/iso-codes-team/iso-codes (data, no runtime dependency).
|
|
4
|
+
const countries = 'AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW'.split(' ');
|
|
5
|
+
const regions = {
|
|
6
|
+
CA: [
|
|
7
|
+
{
|
|
8
|
+
value: 'AB',
|
|
9
|
+
label: 'Alberta',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
value: 'BC',
|
|
13
|
+
label: 'British Columbia',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
value: 'MB',
|
|
17
|
+
label: 'Manitoba',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
value: 'NB',
|
|
21
|
+
label: 'New Brunswick',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
value: 'NL',
|
|
25
|
+
label: 'Newfoundland and Labrador',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
value: 'NS',
|
|
29
|
+
label: 'Nova Scotia',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
value: 'NT',
|
|
33
|
+
label: 'Northwest Territories',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
value: 'NU',
|
|
37
|
+
label: 'Nunavut',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
value: 'ON',
|
|
41
|
+
label: 'Ontario',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
value: 'PE',
|
|
45
|
+
label: 'Prince Edward Island',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
value: 'QC',
|
|
49
|
+
label: 'Quebec',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
value: 'SK',
|
|
53
|
+
label: 'Saskatchewan',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
value: 'YT',
|
|
57
|
+
label: 'Yukon',
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
US: [
|
|
61
|
+
{
|
|
62
|
+
value: 'AK',
|
|
63
|
+
label: 'Alaska',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
value: 'AL',
|
|
67
|
+
label: 'Alabama',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
value: 'AR',
|
|
71
|
+
label: 'Arkansas',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
value: 'AS',
|
|
75
|
+
label: 'American Samoa',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
value: 'AZ',
|
|
79
|
+
label: 'Arizona',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
value: 'CA',
|
|
83
|
+
label: 'California',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
value: 'CO',
|
|
87
|
+
label: 'Colorado',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
value: 'CT',
|
|
91
|
+
label: 'Connecticut',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
value: 'DC',
|
|
95
|
+
label: 'District of Columbia',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
value: 'DE',
|
|
99
|
+
label: 'Delaware',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
value: 'FL',
|
|
103
|
+
label: 'Florida',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
value: 'GA',
|
|
107
|
+
label: 'Georgia',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
value: 'GU',
|
|
111
|
+
label: 'Guam',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
value: 'HI',
|
|
115
|
+
label: 'Hawaii',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
value: 'IA',
|
|
119
|
+
label: 'Iowa',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
value: 'ID',
|
|
123
|
+
label: 'Idaho',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
value: 'IL',
|
|
127
|
+
label: 'Illinois',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
value: 'IN',
|
|
131
|
+
label: 'Indiana',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
value: 'KS',
|
|
135
|
+
label: 'Kansas',
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
value: 'KY',
|
|
139
|
+
label: 'Kentucky',
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
value: 'LA',
|
|
143
|
+
label: 'Louisiana',
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
value: 'MA',
|
|
147
|
+
label: 'Massachusetts',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
value: 'MD',
|
|
151
|
+
label: 'Maryland',
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
value: 'ME',
|
|
155
|
+
label: 'Maine',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
value: 'MI',
|
|
159
|
+
label: 'Michigan',
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
value: 'MN',
|
|
163
|
+
label: 'Minnesota',
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
value: 'MO',
|
|
167
|
+
label: 'Missouri',
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
value: 'MP',
|
|
171
|
+
label: 'Northern Mariana Islands',
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
value: 'MS',
|
|
175
|
+
label: 'Mississippi',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
value: 'MT',
|
|
179
|
+
label: 'Montana',
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
value: 'NC',
|
|
183
|
+
label: 'North Carolina',
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
value: 'ND',
|
|
187
|
+
label: 'North Dakota',
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
value: 'NE',
|
|
191
|
+
label: 'Nebraska',
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
value: 'NH',
|
|
195
|
+
label: 'New Hampshire',
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
value: 'NJ',
|
|
199
|
+
label: 'New Jersey',
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
value: 'NM',
|
|
203
|
+
label: 'New Mexico',
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
value: 'NV',
|
|
207
|
+
label: 'Nevada',
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
value: 'NY',
|
|
211
|
+
label: 'New York',
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
value: 'OH',
|
|
215
|
+
label: 'Ohio',
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
value: 'OK',
|
|
219
|
+
label: 'Oklahoma',
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
value: 'OR',
|
|
223
|
+
label: 'Oregon',
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
value: 'PA',
|
|
227
|
+
label: 'Pennsylvania',
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
value: 'PR',
|
|
231
|
+
label: 'Puerto Rico',
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
value: 'RI',
|
|
235
|
+
label: 'Rhode Island',
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
value: 'SC',
|
|
239
|
+
label: 'South Carolina',
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
value: 'SD',
|
|
243
|
+
label: 'South Dakota',
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
value: 'TN',
|
|
247
|
+
label: 'Tennessee',
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
value: 'TX',
|
|
251
|
+
label: 'Texas',
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
value: 'UM',
|
|
255
|
+
label: 'United States Minor Outlying Islands',
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
value: 'UT',
|
|
259
|
+
label: 'Utah',
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
value: 'VA',
|
|
263
|
+
label: 'Virginia',
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
value: 'VI',
|
|
267
|
+
label: 'Virgin Islands, U.S.',
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
value: 'VT',
|
|
271
|
+
label: 'Vermont',
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
value: 'WA',
|
|
275
|
+
label: 'Washington',
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
value: 'WI',
|
|
279
|
+
label: 'Wisconsin',
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
value: 'WV',
|
|
283
|
+
label: 'West Virginia',
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
value: 'WY',
|
|
287
|
+
label: 'Wyoming',
|
|
288
|
+
},
|
|
289
|
+
],
|
|
290
|
+
};
|
|
291
|
+
function displayNames(locale, type) {
|
|
292
|
+
try {
|
|
293
|
+
return new Intl.DisplayNames(locale, { type });
|
|
294
|
+
}
|
|
295
|
+
catch {
|
|
296
|
+
return new Intl.DisplayNames('en', { type });
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/** Build localized choices from the shared ISO currency metadata. */
|
|
300
|
+
export function currencyOptions(locale) {
|
|
301
|
+
const names = displayNames(locale, 'currency');
|
|
302
|
+
return [...ISO_4217_MINOR_UNITS.keys()].sort().map((value) => ({
|
|
303
|
+
value,
|
|
304
|
+
label: `${value} — ${names.of(value) ?? value}`,
|
|
305
|
+
}));
|
|
306
|
+
}
|
|
307
|
+
/** Build localized ISO alpha-2 country choices. */
|
|
308
|
+
export function countryOptions(locale) {
|
|
309
|
+
const names = displayNames(locale, 'region');
|
|
310
|
+
return countries.map((value) => ({ value, label: names.of(value) ?? value }));
|
|
311
|
+
}
|
|
312
|
+
/** Return CA/US subdivision choices, or undefined for free-text countries. */
|
|
313
|
+
export function provinceOptions(country) {
|
|
314
|
+
return regions[country.toUpperCase()];
|
|
315
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { DOMAttributes, HTMLSelectAttributes } from 'svelte/elements';
|
|
2
|
+
import type { ControlInteractionOptions } from './control-interaction.js';
|
|
3
|
+
/** A caller-authorized native choice; supplied labels are displayed verbatim. */
|
|
4
|
+
export interface CodeSelectOption {
|
|
5
|
+
/** Exact submitted code, never normalized by the control. */
|
|
6
|
+
value: string;
|
|
7
|
+
/** Optional localized text; defaults to the code. */
|
|
8
|
+
label?: string;
|
|
9
|
+
/** Native disabled option; selected disabled options are omitted from FormData. */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** Shared single-choice contract; children and multiple are intentionally excluded. */
|
|
13
|
+
export interface CodeSelectProps extends Omit<HTMLSelectAttributes, 'children' | 'multiple' | 'value' | 'class'> {
|
|
14
|
+
/** Exact bound and submitted value. */
|
|
15
|
+
value?: string;
|
|
16
|
+
/** Additional CSS classes. */
|
|
17
|
+
class?: string;
|
|
18
|
+
/** Control target density. */
|
|
19
|
+
density?: 'comfortable' | 'touch';
|
|
20
|
+
/** Optional shared agent interaction registration. */
|
|
21
|
+
interaction?: ControlInteractionOptions | false;
|
|
22
|
+
/** Custom choices replace defaults; an empty list is an intentional override. */
|
|
23
|
+
options?: readonly CodeSelectOption[];
|
|
24
|
+
/** Locale used for built-in currency/country display names; invalid locales use English. */
|
|
25
|
+
locale?: string;
|
|
26
|
+
/** Empty choice label. Defaults to an em dash and never auto-selects a code. */
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
/** Disable editing while submitting the unchanged value through a hidden input. */
|
|
29
|
+
readOnly?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** Currency control with existing ISO 4217 defaults. */
|
|
32
|
+
export interface CurrencySelectProps extends CodeSelectProps {
|
|
33
|
+
}
|
|
34
|
+
/** Country control with ISO 3166-1 alpha-2 defaults. */
|
|
35
|
+
export interface CountrySelectProps extends CodeSelectProps {
|
|
36
|
+
}
|
|
37
|
+
/** Region control; event targets may be Select or the unsupported-country Input fallback. */
|
|
38
|
+
export interface ProvinceSelectProps extends Omit<CodeSelectProps, keyof DOMAttributes<HTMLSelectElement>>, Omit<DOMAttributes<HTMLInputElement | HTMLSelectElement>, 'children'> {
|
|
39
|
+
/** Country code selecting CA/US subdivisions; other countries permit free text. */
|
|
40
|
+
country?: string;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=code-select-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-select-types.d.ts","sourceRoot":"","sources":["../../../src/components/forms/code-select-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAE1E,iFAAiF;AACjF,MAAM,WAAW,gBAAgB;IAC/B,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,uFAAuF;AACvF,MAAM,WAAW,eACf,SAAQ,IAAI,CACV,oBAAoB,EACpB,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,CAC5C;IACD,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC;IAClC,sDAAsD;IACtD,WAAW,CAAC,EAAE,yBAAyB,GAAG,KAAK,CAAC;IAChD,iFAAiF;IACjF,OAAO,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACtC,4FAA4F;IAC5F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,wDAAwD;AACxD,MAAM,WAAW,mBAAoB,SAAQ,eAAe;CAAG;AAC/D,wDAAwD;AACxD,MAAM,WAAW,kBAAmB,SAAQ,eAAe;CAAG;AAC9D,6FAA6F;AAC7F,MAAM,WAAW,mBACf,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,aAAa,CAAC,iBAAiB,CAAC,CAAC,EACnE,IAAI,CAAC,aAAa,CAAC,gBAAgB,GAAG,iBAAiB,CAAC,EAAE,UAAU,CAAC;IACvE,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -15,7 +15,10 @@ export { canCaptureDictationAudio, createMediaRecorderCapture, DICTATION_AUDIO_M
|
|
|
15
15
|
export { default as CameraCapture } from './CameraCapture.svelte';
|
|
16
16
|
export { default as Checkbox } from './Checkbox.svelte';
|
|
17
17
|
export { default as Combobox } from './Combobox.svelte';
|
|
18
|
+
export { default as CountrySelect } from './CountrySelect.svelte';
|
|
19
|
+
export { default as CurrencySelect } from './CurrencySelect.svelte';
|
|
18
20
|
export { type CameraCaptureErrorKind, type CameraFacingMode, type CameraSession, type CameraSessionDeps, type CameraSessionResult, classifyGetUserMediaError, createCameraSession, isCameraApiSupported, type MediaDevicesLike, } from './camera-capture-session.js';
|
|
21
|
+
export type { CodeSelectOption, CountrySelectProps, CurrencySelectProps, ProvinceSelectProps, } from './code-select-types.js';
|
|
19
22
|
export { emitControlChange, focusControl, highlightControl, revealControl, } from './control-dom.js';
|
|
20
23
|
export { type ControlBatchResult, type ControlCapability, type ControlCommand, type ControlCommandAction, type ControlCommandContext, type ControlCommandResult, type ControlCommandSource, type ControlConstraints, type ControlExtensionContext, type ControlIdentity, type ControlInteractionEvent, type ControlInteractionOptions, type ControlInteractionPolicy, type ControlInteractionRegistry, type ControlKind, type ControlMetadata, type ControlOption, type ControlRegistration, type ControlRuntimeState, type ControlSensitivity, type ControlSnapshot, type ControlStagedEntry, type ControlStagedProvenance, type ControlSubject, type ControlValueValidationResult, createControlInteractionRegistry, executeLocalControlBatch, executeLocalControlCommand, } from './control-interaction.js';
|
|
21
24
|
export { type ControlInteractionContextValue, getControlInteractionContext, recordControlUserEdit, setControlInteractionContext, tryGetControlInteractionContext, } from './control-interaction-context.js';
|
|
@@ -40,6 +43,7 @@ export { default as Listbox } from './Listbox.svelte';
|
|
|
40
43
|
export { createLongPress, LONG_PRESS_DEFAULT_DELAY_MS, LONG_PRESS_DEFAULT_MOVE_TOLERANCE_PX, type LongPressController, type LongPressDetail, type LongPressOptions, longPress, } from './long-press.js';
|
|
41
44
|
export { default as MultiSelect } from './MultiSelect.svelte';
|
|
42
45
|
export { detectNativeFileFieldStrategy, type NativeFileFieldStrategy, } from './native-file-field.js';
|
|
46
|
+
export { default as ProvinceSelect } from './ProvinceSelect.svelte';
|
|
43
47
|
export { default as Radio } from './Radio.svelte';
|
|
44
48
|
export { default as RadioGroup } from './RadioGroup.svelte';
|
|
45
49
|
export { default as RangeSlider } from './RangeSlider.svelte';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/forms/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,cAAc,EACd,KAAK,kBAAkB,EACvB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,yBAAyB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,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChE,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,6BAA6B,EAClC,sBAAsB,GACvB,MAAM,sCAAsC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/forms/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,cAAc,EACd,KAAK,kBAAkB,EACvB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,gBAAgB,GACtB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,gBAAgB,EAChB,kBAA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,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChE,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,6BAA6B,EAClC,sBAAsB,GACvB,MAAM,sCAAsC,CAAC"}
|
|
@@ -16,6 +16,8 @@ export { canCaptureDictationAudio, createMediaRecorderCapture, DICTATION_AUDIO_M
|
|
|
16
16
|
export { default as CameraCapture } from './CameraCapture.svelte';
|
|
17
17
|
export { default as Checkbox } from './Checkbox.svelte';
|
|
18
18
|
export { default as Combobox } from './Combobox.svelte';
|
|
19
|
+
export { default as CountrySelect } from './CountrySelect.svelte';
|
|
20
|
+
export { default as CurrencySelect } from './CurrencySelect.svelte';
|
|
19
21
|
export { classifyGetUserMediaError, createCameraSession, isCameraApiSupported, } from './camera-capture-session.js';
|
|
20
22
|
export { emitControlChange, focusControl, highlightControl, revealControl, } from './control-dom.js';
|
|
21
23
|
export { createControlInteractionRegistry, executeLocalControlBatch, executeLocalControlCommand, } from './control-interaction.js';
|
|
@@ -42,6 +44,7 @@ export { default as Listbox } from './Listbox.svelte';
|
|
|
42
44
|
export { createLongPress, LONG_PRESS_DEFAULT_DELAY_MS, LONG_PRESS_DEFAULT_MOVE_TOLERANCE_PX, longPress, } from './long-press.js';
|
|
43
45
|
export { default as MultiSelect } from './MultiSelect.svelte';
|
|
44
46
|
export { detectNativeFileFieldStrategy, } from './native-file-field.js';
|
|
47
|
+
export { default as ProvinceSelect } from './ProvinceSelect.svelte';
|
|
45
48
|
export { default as Radio } from './Radio.svelte';
|
|
46
49
|
export { default as RadioGroup } from './RadioGroup.svelte';
|
|
47
50
|
export { default as RangeSlider } from './RangeSlider.svelte';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
CountrySelect,
|
|
4
|
+
CurrencySelect,
|
|
5
|
+
Form,
|
|
6
|
+
FormGroup,
|
|
7
|
+
ProvinceSelect,
|
|
8
|
+
} from '../../components/forms/index.js';
|
|
9
|
+
import Button from '../../components/ui/Button.svelte';
|
|
10
|
+
|
|
11
|
+
let currency = $state('CAD');
|
|
12
|
+
let country = $state('CA');
|
|
13
|
+
let province = $state('ON');
|
|
14
|
+
let submitted = $state('');
|
|
15
|
+
</script>
|
|
16
|
+
<div class="selectors">
|
|
17
|
+
<p>Localized country and currency choices. Province choices cover Canada and the United States; other countries accept free text. Changing country preserves the entered region for review.</p>
|
|
18
|
+
<Form onsubmit={(event) => { submitted = JSON.stringify(Object.fromEntries(new FormData(event.currentTarget))); }}>
|
|
19
|
+
<FormGroup label="Currency"><CurrencySelect name="currency" bind:value={currency} /></FormGroup>
|
|
20
|
+
<FormGroup label="Country"><CountrySelect name="country" bind:value={country} /></FormGroup>
|
|
21
|
+
<FormGroup label="Province / state"><ProvinceSelect name="province" {country} bind:value={province} /></FormGroup>
|
|
22
|
+
<Button type="submit">Inspect values</Button>
|
|
23
|
+
</Form>
|
|
24
|
+
<output aria-label="Submitted codes">{submitted}</output>
|
|
25
|
+
</div>
|
|
26
|
+
<style>
|
|
27
|
+
.selectors { display: grid; gap: 1rem; max-width: 40rem; color: var(--smrt-color-on-surface); }
|
|
28
|
+
output { overflow-wrap: anywhere; }
|
|
29
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeSelectorsPreview.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/playground/CodeSelectorsPreview.svelte.ts"],"names":[],"mappings":"AAmCA,QAAA,MAAM,oBAAoB,2DAAwC,CAAC;AACnE,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACpE,eAAe,oBAAoB,CAAC"}
|
|
@@ -6,7 +6,7 @@ declare const _default: {
|
|
|
6
6
|
id: string;
|
|
7
7
|
title: string;
|
|
8
8
|
description: string;
|
|
9
|
-
loadComponent: () => Promise<typeof import("./playground/
|
|
9
|
+
loadComponent: () => Promise<typeof import("./playground/CodeSelectorsPreview.svelte")>;
|
|
10
10
|
order: number;
|
|
11
11
|
tags: string[];
|
|
12
12
|
modes: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../../src/svelte/playground.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAUA,
|
|
1
|
+
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../../src/svelte/playground.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAUA,wBA+FE"}
|
|
@@ -10,6 +10,15 @@ export default {
|
|
|
10
10
|
displayName: 'UI Foundation',
|
|
11
11
|
description: 'Provider-free controls and data primitives rendered in the active s-m-r-t theme.',
|
|
12
12
|
entries: [
|
|
13
|
+
{
|
|
14
|
+
id: 'code-selectors',
|
|
15
|
+
title: 'Currency, Country & Province',
|
|
16
|
+
description: 'Localized code choices, retained values, and free-text regions.',
|
|
17
|
+
loadComponent: () => import('./playground/CodeSelectorsPreview.svelte'),
|
|
18
|
+
order: 8,
|
|
19
|
+
tags: ['forms', 'currency', 'address'],
|
|
20
|
+
modes: { mock: { label: 'Interactive' } },
|
|
21
|
+
},
|
|
13
22
|
{
|
|
14
23
|
id: 'base-controls',
|
|
15
24
|
title: 'Base Controls',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-ui",
|
|
3
|
-
"version": "0.53.
|
|
3
|
+
"version": "0.53.5",
|
|
4
4
|
"smrtJsdoc": "strict",
|
|
5
5
|
"description": "Domain-agnostic Svelte 5 UI runtime for SMRT: primitives, i18n client, theme system, and module UI registry",
|
|
6
6
|
"type": "module",
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
"access": "public"
|
|
135
135
|
},
|
|
136
136
|
"dependencies": {
|
|
137
|
-
"@happyvertical/smrt-types": "0.53.
|
|
137
|
+
"@happyvertical/smrt-types": "0.53.5",
|
|
138
138
|
"esm-env": "^1.2.2"
|
|
139
139
|
},
|
|
140
140
|
"peerDependencies": {
|