@happyvertical/smrt-ui 0.53.1 → 0.53.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/package.json +3 -3
- package/dist/actions/__tests__/ripple.test.js +0 -82
- package/dist/actions/__tests__/swipe-dismiss.test.js +0 -69
- package/dist/components/calendar/__tests__/CalendarView.test.js +0 -226
- package/dist/components/calendar/__tests__/calendar-model.test.js +0 -138
- package/dist/components/chat/__tests__/chat-primitives.test.js +0 -118
- package/dist/components/data/__tests__/CollectionList.test.js +0 -37
- package/dist/components/data/__tests__/DataTable.test.js +0 -807
- package/dist/components/data/__tests__/DataTableConformance.test.js +0 -212
- package/dist/components/data/__tests__/DataTableController.test.js +0 -371
- package/dist/components/data/__tests__/DataTableIdentity.test.js +0 -29
- package/dist/components/data/__tests__/DataTableLayout.test.js +0 -195
- package/dist/components/data/__tests__/DataTablePerformance.test.js +0 -21
- package/dist/components/data/__tests__/DataTableResponsive.test.js +0 -80
- package/dist/components/data/__tests__/DataTableVirtualization.test.js +0 -80
- package/dist/components/data/__tests__/DataTableVirtualizationComponent.test.js +0 -255
- package/dist/components/data/__tests__/SortableHeader.test.js +0 -101
- package/dist/components/data/__tests__/data-surface.test.js +0 -746
- package/dist/components/data/__tests__/data-table-helpers.test.js +0 -36
- package/dist/components/data/__tests__/data-table-surface.test.js +0 -49
- package/dist/components/data/__tests__/link-step-surface.test.js +0 -172
- package/dist/components/data/__tests__/list-sort-state.svelte.test.js +0 -71
- package/dist/components/data/__tests__/list-sort.test.js +0 -91
- package/dist/components/data/__tests__/mounted-data-surface.test.js +0 -794
- package/dist/components/data/__tests__/responsive-table.fixture.svelte +0 -29
- package/dist/components/data/__tests__/responsive-table.fixture.svelte.d.ts +0 -7
- package/dist/components/data/__tests__/responsive-table.fixture.svelte.d.ts.map +0 -1
- package/dist/components/data/__tests__/surface-navigation.test.js +0 -121
- package/dist/components/display/__tests__/ConfidenceBadge.test.js +0 -109
- package/dist/components/display/__tests__/CurrencyDisplay.test.js +0 -304
- package/dist/components/display/__tests__/CurrencyDisplayI18nHarness.svelte +0 -20
- package/dist/components/display/__tests__/CurrencyDisplayI18nHarness.svelte.d.ts +0 -19
- package/dist/components/display/__tests__/CurrencyDisplayI18nHarness.svelte.d.ts.map +0 -1
- package/dist/components/display/__tests__/CurrencyDisplaySsrHarness.svelte +0 -7
- package/dist/components/display/__tests__/CurrencyDisplaySsrHarness.svelte.d.ts +0 -19
- package/dist/components/display/__tests__/CurrencyDisplaySsrHarness.svelte.d.ts.map +0 -1
- package/dist/components/display/__tests__/DateDisplay.test.js +0 -195
- package/dist/components/display/__tests__/Icon.test.js +0 -223
- package/dist/components/display/__tests__/StatusBadge.test.js +0 -191
- package/dist/components/feedback/__tests__/ConfirmDialog.test.js +0 -181
- package/dist/components/feedback/__tests__/LoadingOverlay.test.js +0 -113
- package/dist/components/feedback/__tests__/Modal.test.js +0 -72
- package/dist/components/feedback/__tests__/PhoneSheet.test.js +0 -101
- package/dist/components/feedback/__tests__/ProgressBar.test.js +0 -89
- package/dist/components/feedback/__tests__/WorkingStrip.test.js +0 -172
- package/dist/components/feedback/__tests__/confirm-message.fixture.svelte +0 -9
- package/dist/components/feedback/__tests__/confirm-message.fixture.svelte.d.ts +0 -19
- package/dist/components/feedback/__tests__/confirm-message.fixture.svelte.d.ts.map +0 -1
- package/dist/components/feedback/__tests__/toast.test.js +0 -190
- package/dist/components/forms/__tests__/CameraCapture.test.js +0 -504
- package/dist/components/forms/__tests__/Combobox.test.js +0 -354
- package/dist/components/forms/__tests__/ControlHitArea.test.js +0 -73
- package/dist/components/forms/__tests__/DictationButton.test.js +0 -176
- package/dist/components/forms/__tests__/Fieldset.test.js +0 -37
- package/dist/components/forms/__tests__/Form.test.js +0 -201
- package/dist/components/forms/__tests__/FormActionBar.test.js +0 -22
- package/dist/components/forms/__tests__/FormGroup.test.js +0 -48
- package/dist/components/forms/__tests__/Input.test.js +0 -49
- package/dist/components/forms/__tests__/Listbox.test.js +0 -303
- package/dist/components/forms/__tests__/MultiSelect.test.js +0 -281
- package/dist/components/forms/__tests__/SearchInput.test.js +0 -92
- package/dist/components/forms/__tests__/Select.test.js +0 -37
- package/dist/components/forms/__tests__/SignaturePad.test.js +0 -338
- package/dist/components/forms/__tests__/StagedControlReview.test.js +0 -702
- package/dist/components/forms/__tests__/Textarea.test.js +0 -39
- package/dist/components/forms/__tests__/Toggle.test.js +0 -87
- package/dist/components/forms/__tests__/camera-capture-session.test.js +0 -207
- package/dist/components/forms/__tests__/capture-form-retry.test.js +0 -166
- package/dist/components/forms/__tests__/capture-form.fixture.svelte +0 -38
- package/dist/components/forms/__tests__/capture-form.fixture.svelte.d.ts +0 -10
- package/dist/components/forms/__tests__/capture-form.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/capture-test-env.d.ts +0 -70
- package/dist/components/forms/__tests__/capture-test-env.d.ts.map +0 -1
- package/dist/components/forms/__tests__/capture-test-env.js +0 -122
- package/dist/components/forms/__tests__/capture-touch.fixture.svelte +0 -15
- package/dist/components/forms/__tests__/capture-touch.fixture.svelte.d.ts +0 -8
- package/dist/components/forms/__tests__/capture-touch.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/combobox-form.fixture.svelte +0 -29
- package/dist/components/forms/__tests__/combobox-form.fixture.svelte.d.ts +0 -14
- package/dist/components/forms/__tests__/combobox-form.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/combobox-labels.fixture.svelte +0 -19
- package/dist/components/forms/__tests__/combobox-labels.fixture.svelte.d.ts +0 -11
- package/dist/components/forms/__tests__/combobox-labels.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/composite-controls.fixture.svelte +0 -47
- package/dist/components/forms/__tests__/composite-controls.fixture.svelte.d.ts +0 -12
- package/dist/components/forms/__tests__/composite-controls.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/composite-controls.test.js +0 -128
- package/dist/components/forms/__tests__/composite-registration.fixture.svelte +0 -29
- package/dist/components/forms/__tests__/composite-registration.fixture.svelte.d.ts +0 -8
- package/dist/components/forms/__tests__/composite-registration.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/composite-user-edit.fixture.svelte +0 -41
- package/dist/components/forms/__tests__/composite-user-edit.fixture.svelte.d.ts +0 -13
- package/dist/components/forms/__tests__/composite-user-edit.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/control-interaction.test.js +0 -3421
- package/dist/components/forms/__tests__/control-proposals.test.js +0 -63
- package/dist/components/forms/__tests__/core-controls.fixture.svelte +0 -50
- package/dist/components/forms/__tests__/core-controls.fixture.svelte.d.ts +0 -9
- package/dist/components/forms/__tests__/core-controls.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/core-controls.test.js +0 -311
- package/dist/components/forms/__tests__/decimal-sliders.fixture.svelte +0 -25
- package/dist/components/forms/__tests__/decimal-sliders.fixture.svelte.d.ts +0 -8
- package/dist/components/forms/__tests__/decimal-sliders.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/dictation-recording.test.js +0 -582
- package/dist/components/forms/__tests__/dictation.test.js +0 -486
- package/dist/components/forms/__tests__/form-attachment.fixture.svelte +0 -28
- package/dist/components/forms/__tests__/form-attachment.fixture.svelte.d.ts +0 -11
- package/dist/components/forms/__tests__/form-attachment.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/form-group-input.fixture.svelte +0 -16
- package/dist/components/forms/__tests__/form-group-input.fixture.svelte.d.ts +0 -9
- package/dist/components/forms/__tests__/form-group-input.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/form-retry-form.fixture.svelte +0 -31
- package/dist/components/forms/__tests__/form-retry-form.fixture.svelte.d.ts +0 -13
- package/dist/components/forms/__tests__/form-retry-form.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/form-retry-form.test.js +0 -107
- package/dist/components/forms/__tests__/hidden-controls-form-retry.test.js +0 -69
- package/dist/components/forms/__tests__/hidden-controls-form.fixture.svelte +0 -29
- package/dist/components/forms/__tests__/hidden-controls-form.fixture.svelte.d.ts +0 -9
- package/dist/components/forms/__tests__/hidden-controls-form.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/listbox-form.fixture.svelte +0 -27
- package/dist/components/forms/__tests__/listbox-form.fixture.svelte.d.ts +0 -13
- package/dist/components/forms/__tests__/listbox-form.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/long-press.test.js +0 -175
- package/dist/components/forms/__tests__/multiselect-form.fixture.svelte +0 -27
- package/dist/components/forms/__tests__/multiselect-form.fixture.svelte.d.ts +0 -13
- package/dist/components/forms/__tests__/multiselect-form.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/native-file-field.test.js +0 -177
- package/dist/components/forms/__tests__/place-picker.fixture.svelte +0 -33
- package/dist/components/forms/__tests__/place-picker.fixture.svelte.d.ts +0 -12
- package/dist/components/forms/__tests__/place-picker.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/segmented-posting.fixture.svelte +0 -28
- package/dist/components/forms/__tests__/segmented-posting.fixture.svelte.d.ts +0 -12
- package/dist/components/forms/__tests__/segmented-posting.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/segmented-posting.test.js +0 -92
- package/dist/components/forms/__tests__/select-interaction.fixture.svelte +0 -25
- package/dist/components/forms/__tests__/select-interaction.fixture.svelte.d.ts +0 -9
- package/dist/components/forms/__tests__/select-interaction.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/signature-pad-logic.test.js +0 -54
- package/dist/components/forms/__tests__/staged-review-fieldset.fixture.svelte +0 -21
- package/dist/components/forms/__tests__/staged-review-fieldset.fixture.svelte.d.ts +0 -8
- package/dist/components/forms/__tests__/staged-review-fieldset.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/staged-review-outer-fieldset.fixture.svelte +0 -23
- package/dist/components/forms/__tests__/staged-review-outer-fieldset.fixture.svelte.d.ts +0 -8
- package/dist/components/forms/__tests__/staged-review-outer-fieldset.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/staged-review.fixture.svelte +0 -56
- package/dist/components/forms/__tests__/staged-review.fixture.svelte.d.ts +0 -12
- package/dist/components/forms/__tests__/staged-review.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/touch-density.fixture.svelte +0 -34
- package/dist/components/forms/__tests__/touch-density.fixture.svelte.d.ts +0 -8
- package/dist/components/forms/__tests__/touch-density.fixture.svelte.d.ts.map +0 -1
- package/dist/components/forms/__tests__/touch-density.test.js +0 -66
- package/dist/components/forms/form-retry/__tests__/boundaries.test.js +0 -23
- package/dist/components/forms/form-retry/__tests__/content-digest.test.js +0 -70
- package/dist/components/forms/form-retry/__tests__/controller.test.js +0 -802
- package/dist/components/forms/form-retry/__tests__/fake-kit.d.ts +0 -82
- package/dist/components/forms/form-retry/__tests__/fake-kit.d.ts.map +0 -1
- package/dist/components/forms/form-retry/__tests__/fake-kit.js +0 -180
- package/dist/components/forms/form-retry/__tests__/form-draft.test.js +0 -169
- package/dist/components/forms/form-retry/__tests__/ssr.test.js +0 -37
- package/dist/components/forms/form-retry/__tests__/storage.d.ts +0 -26
- package/dist/components/forms/form-retry/__tests__/storage.d.ts.map +0 -1
- package/dist/components/forms/form-retry/__tests__/storage.js +0 -63
- package/dist/components/forms/form-retry/__tests__/submission-key.test.js +0 -236
- package/dist/components/forms/form-retry/__tests__/submitted-draft.test.js +0 -334
- package/dist/components/layout/__tests__/Container.test.js +0 -62
- package/dist/components/layout/__tests__/EmptyState.test.js +0 -83
- package/dist/components/layout/__tests__/Footer.test.js +0 -50
- package/dist/components/layout/__tests__/Grid.test.js +0 -121
- package/dist/components/layout/__tests__/Header.test.js +0 -48
- package/dist/components/layout/__tests__/Masthead.test.js +0 -93
- package/dist/components/layout/__tests__/PageHeader.test.js +0 -166
- package/dist/components/layout/__tests__/SummaryCard.test.js +0 -104
- package/dist/components/nav/__tests__/FilterChips.test.js +0 -94
- package/dist/components/nav/__tests__/LinkTabs.test.js +0 -117
- package/dist/components/nav/__tests__/Tabs.test.js +0 -128
- package/dist/components/roles/__tests__/RoleSelector.test.js +0 -134
- package/dist/components/ui/__tests__/Badge.test.js +0 -76
- package/dist/components/ui/__tests__/Button.test.js +0 -166
- package/dist/components/ui/__tests__/Card.test.js +0 -103
- package/dist/components/ui/__tests__/IconToggle.test.js +0 -59
- package/dist/components/ui/__tests__/IconToggleGroup.test.js +0 -30
- package/dist/components/ui/__tests__/Pagination.test.js +0 -113
- package/dist/components/ui/__tests__/Popover.test.js +0 -44
- package/dist/components/ui/__tests__/dropdown-popover-icon.test.js +0 -125
- package/dist/components/ui/__tests__/gap-primitives-interactive.test.js +0 -112
- package/dist/components/ui/__tests__/gap-primitives.test.js +0 -84
- package/dist/components/ui/__tests__/interaction-primitives.fixture.svelte +0 -13
- package/dist/components/ui/__tests__/interaction-primitives.fixture.svelte.d.ts +0 -19
- package/dist/components/ui/__tests__/interaction-primitives.fixture.svelte.d.ts.map +0 -1
- package/dist/components/ui/__tests__/interaction-primitives.test.js +0 -31
- package/dist/components/ui/__tests__/phone-touch-targets.test.js +0 -39
- package/dist/i18n/__tests__/i18n.test.js +0 -74
- package/dist/i18n/__tests__/render-parity.spec.js +0 -37
- package/dist/svelte/__tests__/playground.test.js +0 -20
- package/dist/themes/__tests__/control-boundary-contrast.test.js +0 -112
- package/dist/themes/__tests__/create-theme.test.js +0 -79
- package/dist/themes/__tests__/css-generator.test.js +0 -129
- package/dist/themes/__tests__/happyvertical-theme.test.js +0 -231
- package/dist/themes/__tests__/registry.test.js +0 -43
- package/dist/themes/__tests__/styles-lockstep.test.js +0 -32
- package/dist/themes/__tests__/theme-provider.test.js +0 -147
- package/dist/themes/__tests__/theme-script.test.js +0 -130
- package/dist/themes/__tests__/token-aliases.test.js +0 -178
- package/dist/utils/forms/__tests__/formatters.test.js +0 -27
- package/dist/utils/theme/__tests__/color.test.js +0 -89
- package/dist/utils/theme/__tests__/typography.test.js +0 -11
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { useControlRegistration } from '../index.js';
|
|
3
|
-
|
|
4
|
-
type Place = { name: string; latitude: number; longitude: number };
|
|
5
|
-
interface Props {
|
|
6
|
-
value: Place | null;
|
|
7
|
-
}
|
|
8
|
-
let { value = $bindable(null) }: Props = $props();
|
|
9
|
-
|
|
10
|
-
// A composite: search text, a result list, and hidden coordinates — one value.
|
|
11
|
-
useControlRegistration(() => ({
|
|
12
|
-
controlId: 'place',
|
|
13
|
-
metadata: {
|
|
14
|
-
kind: 'custom',
|
|
15
|
-
label: 'Town location',
|
|
16
|
-
valueSchema: {
|
|
17
|
-
type: 'object',
|
|
18
|
-
required: ['name', 'latitude', 'longitude'],
|
|
19
|
-
properties: {
|
|
20
|
-
name: { type: 'string' },
|
|
21
|
-
latitude: { type: 'number' },
|
|
22
|
-
longitude: { type: 'number' },
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
getValue: () => value,
|
|
27
|
-
setValue: (next) => {
|
|
28
|
-
value = next as Place;
|
|
29
|
-
},
|
|
30
|
-
}));
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
|
-
<div class="place-picker"><span>{value?.name ?? 'Pick a town'}</span></div>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
type Place = {
|
|
2
|
-
name: string;
|
|
3
|
-
latitude: number;
|
|
4
|
-
longitude: number;
|
|
5
|
-
};
|
|
6
|
-
interface Props {
|
|
7
|
-
value: Place | null;
|
|
8
|
-
}
|
|
9
|
-
declare const PlacePicker: import("svelte").Component<Props, {}, "value">;
|
|
10
|
-
type PlacePicker = ReturnType<typeof PlacePicker>;
|
|
11
|
-
export default PlacePicker;
|
|
12
|
-
//# sourceMappingURL=place-picker.fixture.svelte.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"place-picker.fixture.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/__tests__/place-picker.fixture.svelte.ts"],"names":[],"mappings":"AAMA,KAAK,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AACnE,UAAU,KAAK;IACb,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAkCD,QAAA,MAAM,WAAW,gDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import SegmentedControl from '../SegmentedControl.svelte';
|
|
3
|
-
|
|
4
|
-
let {
|
|
5
|
-
required = false,
|
|
6
|
-
disabled = false,
|
|
7
|
-
outerDisabled = false,
|
|
8
|
-
initial = 'one',
|
|
9
|
-
named = true,
|
|
10
|
-
onvaluechange,
|
|
11
|
-
}: {
|
|
12
|
-
required?: boolean;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
outerDisabled?: boolean;
|
|
15
|
-
initial?: string | number;
|
|
16
|
-
named?: boolean;
|
|
17
|
-
onvaluechange?: (value: string | number) => void;
|
|
18
|
-
} = $props();
|
|
19
|
-
let value = $state(initial);
|
|
20
|
-
</script>
|
|
21
|
-
<form>
|
|
22
|
-
<fieldset disabled={outerDisabled}>
|
|
23
|
-
<SegmentedControl name={named ? 'kind' : undefined} label="Kind" bind:value {onvaluechange} {required} {disabled}
|
|
24
|
-
options={[{ value: 'one', label: 'One' }, { value: 'off', label: 'Disabled', disabled: true }, { value: 0, label: 'Zero' }]} density="touch" />
|
|
25
|
-
</fieldset>
|
|
26
|
-
<span data-bound-value data-bound-type={typeof value}>{String(value)}</span>
|
|
27
|
-
<button type="reset">Reset</button>
|
|
28
|
-
</form>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
type $$ComponentProps = {
|
|
2
|
-
required?: boolean;
|
|
3
|
-
disabled?: boolean;
|
|
4
|
-
outerDisabled?: boolean;
|
|
5
|
-
initial?: string | number;
|
|
6
|
-
named?: boolean;
|
|
7
|
-
onvaluechange?: (value: string | number) => void;
|
|
8
|
-
};
|
|
9
|
-
declare const SegmentedPosting: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
10
|
-
type SegmentedPosting = ReturnType<typeof SegmentedPosting>;
|
|
11
|
-
export default SegmentedPosting;
|
|
12
|
-
//# sourceMappingURL=segmented-posting.fixture.svelte.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"segmented-posting.fixture.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/__tests__/segmented-posting.fixture.svelte.ts"],"names":[],"mappings":"AAKC,KAAK,gBAAgB,GAAI;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;CAClD,CAAC;AAwBF,QAAA,MAAM,gBAAgB,sDAAwC,CAAC;AAC/D,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC5D,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { fireEvent, render, screen, waitFor } from '@testing-library/svelte';
|
|
2
|
-
import userEvent from '@testing-library/user-event';
|
|
3
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
4
|
-
import Fixture from './segmented-posting.fixture.svelte';
|
|
5
|
-
function form(container) {
|
|
6
|
-
return container.querySelector('form');
|
|
7
|
-
}
|
|
8
|
-
describe('SegmentedControl native forms', () => {
|
|
9
|
-
it('posts selected values and preserves numeric zero in bindings', async () => {
|
|
10
|
-
const { container } = render(Fixture);
|
|
11
|
-
expect(new FormData(form(container)).get('kind')).toBe('one');
|
|
12
|
-
await userEvent.click(screen.getByRole('radio', { name: 'Zero' }));
|
|
13
|
-
expect(new FormData(form(container)).get('kind')).toBe('0');
|
|
14
|
-
expect(container.querySelector('[data-bound-value]')).toHaveTextContent('0');
|
|
15
|
-
});
|
|
16
|
-
it.each([
|
|
17
|
-
{ disabled: true },
|
|
18
|
-
{ outerDisabled: true },
|
|
19
|
-
{ initial: 'off' },
|
|
20
|
-
{ initial: 'missing' },
|
|
21
|
-
{ named: false },
|
|
22
|
-
])('omits disabled, unmatched, or unnamed values %j', (props) => {
|
|
23
|
-
const { container } = render(Fixture, { props });
|
|
24
|
-
expect(new FormData(form(container)).has('kind')).toBe(false);
|
|
25
|
-
});
|
|
26
|
-
it('requires an enabled selection including zero', async () => {
|
|
27
|
-
const { container } = render(Fixture, {
|
|
28
|
-
props: { required: true, initial: 'missing' },
|
|
29
|
-
});
|
|
30
|
-
expect(form(container).checkValidity()).toBe(false);
|
|
31
|
-
await userEvent.click(screen.getByRole('radio', { name: 'Zero' }));
|
|
32
|
-
expect(form(container).checkValidity()).toBe(true);
|
|
33
|
-
});
|
|
34
|
-
it('validates required unnamed controls without posting a generated field', async () => {
|
|
35
|
-
const { container } = render(Fixture, {
|
|
36
|
-
props: { required: true, named: false, initial: 'missing' },
|
|
37
|
-
});
|
|
38
|
-
expect(form(container).checkValidity()).toBe(false);
|
|
39
|
-
await userEvent.click(screen.getByRole('radio', { name: 'Zero' }));
|
|
40
|
-
expect(form(container).checkValidity()).toBe(true);
|
|
41
|
-
expect([...new FormData(form(container)).keys()]).toEqual([]);
|
|
42
|
-
});
|
|
43
|
-
it('resets to the initial selection and binding and honors reset cancellation', async () => {
|
|
44
|
-
const { container } = render(Fixture);
|
|
45
|
-
await userEvent.click(screen.getByRole('radio', { name: 'Zero' }));
|
|
46
|
-
await userEvent.click(screen.getByRole('button', { name: 'Reset' }));
|
|
47
|
-
await waitFor(() => expect(new FormData(form(container)).get('kind')).toBe('one'));
|
|
48
|
-
await waitFor(() => expect(container.querySelector('[data-bound-value]')).toHaveTextContent('one'));
|
|
49
|
-
await userEvent.click(screen.getByRole('radio', { name: 'Zero' }));
|
|
50
|
-
form(container).addEventListener('reset', (e) => e.preventDefault());
|
|
51
|
-
await userEvent.click(screen.getByRole('button', { name: 'Reset' }));
|
|
52
|
-
expect(new FormData(form(container)).get('kind')).toBe('0');
|
|
53
|
-
});
|
|
54
|
-
it('resets a numeric initial value and clears unmatched initial values', async () => {
|
|
55
|
-
const { container, unmount } = render(Fixture, { props: { initial: 0 } });
|
|
56
|
-
await userEvent.click(screen.getByRole('radio', { name: 'One' }));
|
|
57
|
-
form(container).reset();
|
|
58
|
-
await waitFor(() => expect(container.querySelector('[data-bound-value]')).toHaveTextContent('0'));
|
|
59
|
-
expect(container.querySelector('[data-bound-value]')).toHaveAttribute('data-bound-type', 'number');
|
|
60
|
-
unmount();
|
|
61
|
-
const second = render(Fixture, {
|
|
62
|
-
props: { initial: 'missing', required: true },
|
|
63
|
-
});
|
|
64
|
-
await userEvent.click(screen.getByRole('radio', { name: 'One' }));
|
|
65
|
-
form(second.container).reset();
|
|
66
|
-
await waitFor(() => expect(second.container.querySelector('[data-bound-value]')).toHaveTextContent('undefined'));
|
|
67
|
-
expect(form(second.container).checkValidity()).toBe(false);
|
|
68
|
-
expect(new FormData(form(second.container)).has('kind')).toBe(false);
|
|
69
|
-
});
|
|
70
|
-
it('emits one native change and one value callback per pointer selection', async () => {
|
|
71
|
-
const onvaluechange = vi.fn();
|
|
72
|
-
const { container } = render(Fixture, { props: { onvaluechange } });
|
|
73
|
-
const onchange = vi.fn();
|
|
74
|
-
form(container).addEventListener('change', onchange);
|
|
75
|
-
await userEvent.click(screen.getByRole('radio', { name: 'Zero' }));
|
|
76
|
-
expect(onvaluechange).toHaveBeenCalledExactlyOnceWith(0);
|
|
77
|
-
expect(onchange).toHaveBeenCalledTimes(1);
|
|
78
|
-
});
|
|
79
|
-
it('supports arrow/home/end navigation while skipping disabled options', async () => {
|
|
80
|
-
render(Fixture);
|
|
81
|
-
const one = screen.getByRole('radio', { name: 'One' });
|
|
82
|
-
one.focus();
|
|
83
|
-
await fireEvent.keyDown(one, { key: 'ArrowRight' });
|
|
84
|
-
expect(screen.getByRole('radio', { name: 'Zero' })).toBeChecked();
|
|
85
|
-
expect(screen.getByRole('radio', { name: 'Zero' })).toHaveFocus();
|
|
86
|
-
await fireEvent.keyDown(screen.getByRole('radio', { name: 'Zero' }), {
|
|
87
|
-
key: 'Home',
|
|
88
|
-
});
|
|
89
|
-
expect(one).toBeChecked();
|
|
90
|
-
expect(screen.getByRole('radio', { name: 'Disabled' })).toBeDisabled();
|
|
91
|
-
});
|
|
92
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { ControlInteractionRegistry } from '../control-interaction.js';
|
|
3
|
-
import Form from '../Form.svelte';
|
|
4
|
-
import Select from '../Select.svelte';
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
registry,
|
|
8
|
-
required = false,
|
|
9
|
-
}: {
|
|
10
|
-
registry: ControlInteractionRegistry;
|
|
11
|
-
required?: boolean;
|
|
12
|
-
} = $props();
|
|
13
|
-
let role = $state('user');
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<Form formId="account" interactionRegistry={registry} aria-label="Account form">
|
|
17
|
-
<Select name="role" aria-label="Role" {required} bind:value={role}>
|
|
18
|
-
<option value="">Choose a role</option>
|
|
19
|
-
<option value="user">User</option>
|
|
20
|
-
<option value="admin" disabled>Administrator</option>
|
|
21
|
-
<optgroup label="Unavailable roles" disabled>
|
|
22
|
-
<option value="owner">Owner</option>
|
|
23
|
-
</optgroup>
|
|
24
|
-
</Select>
|
|
25
|
-
</Form>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ControlInteractionRegistry } from '../control-interaction.js';
|
|
2
|
-
type $$ComponentProps = {
|
|
3
|
-
registry: ControlInteractionRegistry;
|
|
4
|
-
required?: boolean;
|
|
5
|
-
};
|
|
6
|
-
declare const SelectInteraction: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
-
type SelectInteraction = ReturnType<typeof SelectInteraction>;
|
|
8
|
-
export default SelectInteraction;
|
|
9
|
-
//# sourceMappingURL=select-interaction.fixture.svelte.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"select-interaction.fixture.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/__tests__/select-interaction.fixture.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAI3E,KAAK,gBAAgB,GAAI;IACxB,QAAQ,EAAE,0BAA0B,CAAC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AA0BF,QAAA,MAAM,iBAAiB,sDAAwC,CAAC;AAChE,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure SignaturePad input logic, no DOM (smrt#3290). Ported from teamworks-os
|
|
3
|
-
* `signature-pad-logic.test.ts`.
|
|
4
|
-
*/
|
|
5
|
-
import { describe, expect, it } from 'vitest';
|
|
6
|
-
import { isAcceptedPointerType, mapPointerToCanvasPoint, } from '../signature-pad-logic.js';
|
|
7
|
-
describe('isAcceptedPointerType', () => {
|
|
8
|
-
it('accepts only pen input when stylusOnly is true', () => {
|
|
9
|
-
expect(isAcceptedPointerType('pen', true)).toBe(true);
|
|
10
|
-
expect(isAcceptedPointerType('touch', true)).toBe(false);
|
|
11
|
-
expect(isAcceptedPointerType('mouse', true)).toBe(false);
|
|
12
|
-
});
|
|
13
|
-
it('accepts pen, touch, and mouse when stylusOnly is false', () => {
|
|
14
|
-
expect(isAcceptedPointerType('pen', false)).toBe(true);
|
|
15
|
-
expect(isAcceptedPointerType('touch', false)).toBe(true);
|
|
16
|
-
expect(isAcceptedPointerType('mouse', false)).toBe(true);
|
|
17
|
-
});
|
|
18
|
-
it('rejects unknown and empty pointer types in both modes', () => {
|
|
19
|
-
for (const stylusOnly of [true, false]) {
|
|
20
|
-
expect(isAcceptedPointerType('unknown', stylusOnly)).toBe(false);
|
|
21
|
-
expect(isAcceptedPointerType('', stylusOnly)).toBe(false);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
describe('mapPointerToCanvasPoint', () => {
|
|
26
|
-
it('subtracts the rect offset unscaled when display and backing sizes match', () => {
|
|
27
|
-
const rect = { left: 10, top: 20, width: 600, height: 240 };
|
|
28
|
-
expect(mapPointerToCanvasPoint(110, 70, rect, 600, 240)).toEqual({
|
|
29
|
-
x: 100,
|
|
30
|
-
y: 50,
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
it('scales up when displayed smaller than the backing resolution', () => {
|
|
34
|
-
const rect = { left: 0, top: 0, width: 300, height: 120 };
|
|
35
|
-
expect(mapPointerToCanvasPoint(30, 12, rect, 600, 240)).toEqual({
|
|
36
|
-
x: 60,
|
|
37
|
-
y: 24,
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
it('scales down when displayed larger than the backing resolution', () => {
|
|
41
|
-
const rect = { left: 0, top: 0, width: 1200, height: 480 };
|
|
42
|
-
expect(mapPointerToCanvasPoint(1200, 480, rect, 600, 240)).toEqual({
|
|
43
|
-
x: 600,
|
|
44
|
-
y: 240,
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
it('falls back to 1:1 for a zero-size (not laid out) rect', () => {
|
|
48
|
-
const rect = { left: 5, top: 5, width: 0, height: 0 };
|
|
49
|
-
expect(mapPointerToCanvasPoint(15, 25, rect, 600, 240)).toEqual({
|
|
50
|
-
x: 10,
|
|
51
|
-
y: 20,
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { ControlInteractionRegistry } from '../control-interaction.js';
|
|
3
|
-
import Form from '../Form.svelte';
|
|
4
|
-
import FormGroup from '../FormGroup.svelte';
|
|
5
|
-
import Input from '../Input.svelte';
|
|
6
|
-
|
|
7
|
-
let {
|
|
8
|
-
registry,
|
|
9
|
-
}: {
|
|
10
|
-
registry: ControlInteractionRegistry;
|
|
11
|
-
} = $props();
|
|
12
|
-
let displayName = $state('Ada');
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<Form formId="profile" interactionRegistry={registry} aria-label="Profile form">
|
|
16
|
-
<fieldset>
|
|
17
|
-
<FormGroup label="Display name">
|
|
18
|
-
<Input name="display-name" bind:value={displayName} required minlength={3} />
|
|
19
|
-
</FormGroup>
|
|
20
|
-
</fieldset>
|
|
21
|
-
</Form>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ControlInteractionRegistry } from '../control-interaction.js';
|
|
2
|
-
type $$ComponentProps = {
|
|
3
|
-
registry: ControlInteractionRegistry;
|
|
4
|
-
};
|
|
5
|
-
declare const StagedReviewFieldset: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type StagedReviewFieldset = ReturnType<typeof StagedReviewFieldset>;
|
|
7
|
-
export default StagedReviewFieldset;
|
|
8
|
-
//# sourceMappingURL=staged-review-fieldset.fixture.svelte.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"staged-review-fieldset.fixture.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/__tests__/staged-review-fieldset.fixture.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAK3E,KAAK,gBAAgB,GAAI;IACxB,QAAQ,EAAE,0BAA0B,CAAC;CACtC,CAAC;AAuBF,QAAA,MAAM,oBAAoB,sDAAwC,CAAC;AACnE,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACpE,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { ControlInteractionRegistry } from '../control-interaction.js';
|
|
3
|
-
import Form from '../Form.svelte';
|
|
4
|
-
import FormGroup from '../FormGroup.svelte';
|
|
5
|
-
import Input from '../Input.svelte';
|
|
6
|
-
|
|
7
|
-
let {
|
|
8
|
-
registry,
|
|
9
|
-
}: {
|
|
10
|
-
registry: ControlInteractionRegistry;
|
|
11
|
-
} = $props();
|
|
12
|
-
let displayName = $state('Ada');
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<fieldset>
|
|
16
|
-
<fieldset>
|
|
17
|
-
<Form formId="profile" interactionRegistry={registry} aria-label="Profile form">
|
|
18
|
-
<FormGroup label="Display name">
|
|
19
|
-
<Input name="display-name" bind:value={displayName} required minlength={3} />
|
|
20
|
-
</FormGroup>
|
|
21
|
-
</Form>
|
|
22
|
-
</fieldset>
|
|
23
|
-
</fieldset>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ControlInteractionRegistry } from '../control-interaction.js';
|
|
2
|
-
type $$ComponentProps = {
|
|
3
|
-
registry: ControlInteractionRegistry;
|
|
4
|
-
};
|
|
5
|
-
declare const StagedReviewOuterFieldset: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type StagedReviewOuterFieldset = ReturnType<typeof StagedReviewOuterFieldset>;
|
|
7
|
-
export default StagedReviewOuterFieldset;
|
|
8
|
-
//# sourceMappingURL=staged-review-outer-fieldset.fixture.svelte.d.ts.map
|
package/dist/components/forms/__tests__/staged-review-outer-fieldset.fixture.svelte.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"staged-review-outer-fieldset.fixture.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/__tests__/staged-review-outer-fieldset.fixture.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAK3E,KAAK,gBAAgB,GAAI;IACxB,QAAQ,EAAE,0BAA0B,CAAC;CACtC,CAAC;AAyBF,QAAA,MAAM,yBAAyB,sDAAwC,CAAC;AACxE,KAAK,yBAAyB,GAAG,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC9E,eAAe,yBAAyB,CAAC"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
ControlInteractionRegistry,
|
|
4
|
-
ControlSubject,
|
|
5
|
-
} from '../control-interaction.js';
|
|
6
|
-
import Form from '../Form.svelte';
|
|
7
|
-
import FormGroup from '../FormGroup.svelte';
|
|
8
|
-
import Input from '../Input.svelte';
|
|
9
|
-
import Slider from '../Slider.svelte';
|
|
10
|
-
|
|
11
|
-
let {
|
|
12
|
-
registry,
|
|
13
|
-
subject,
|
|
14
|
-
displayNameLabel = 'Display name',
|
|
15
|
-
formOnInput,
|
|
16
|
-
formId = 'profile',
|
|
17
|
-
}: {
|
|
18
|
-
registry: ControlInteractionRegistry;
|
|
19
|
-
subject?: ControlSubject;
|
|
20
|
-
displayNameLabel?: string;
|
|
21
|
-
formOnInput?: (event: Event) => void;
|
|
22
|
-
formId?: string;
|
|
23
|
-
} = $props();
|
|
24
|
-
let displayName = $state('Ada');
|
|
25
|
-
let apiToken = $state('token');
|
|
26
|
-
let volume = $state(25);
|
|
27
|
-
let score = $state<string | number>(1);
|
|
28
|
-
let birthday = $state('');
|
|
29
|
-
let meetingTime = $state('');
|
|
30
|
-
let intensity = $state(50);
|
|
31
|
-
let mutableSubject = $state<ControlSubject | undefined>();
|
|
32
|
-
$effect(() => {
|
|
33
|
-
mutableSubject = subject ? { ...subject } : undefined;
|
|
34
|
-
});
|
|
35
|
-
function mutateSubject() {
|
|
36
|
-
if (mutableSubject) mutableSubject.id = 'two';
|
|
37
|
-
}
|
|
38
|
-
</script>
|
|
39
|
-
|
|
40
|
-
<Form {formId} interactionRegistry={registry} aria-label="Profile form" oninput={formOnInput}>
|
|
41
|
-
<FormGroup label={displayNameLabel}>
|
|
42
|
-
<Input name="display-name" interaction={mutableSubject ? { subject: mutableSubject } : undefined} bind:value={displayName} required minlength={3} />
|
|
43
|
-
</FormGroup>
|
|
44
|
-
<FormGroup label="API token" interaction={{ sensitivity: 'secret' }}>
|
|
45
|
-
<Input name="api-token" type="password" bind:value={apiToken} />
|
|
46
|
-
</FormGroup>
|
|
47
|
-
<Slider name="volume" label="Volume" bind:value={volume} />
|
|
48
|
-
<Input name="score" aria-label="Score" type="number" bind:value={score} />
|
|
49
|
-
<Input name="birthday" aria-label="Birthday" type="date" bind:value={birthday} />
|
|
50
|
-
<Input name="meeting-time" aria-label="Meeting time" type="time" bind:value={meetingTime} />
|
|
51
|
-
<Input name="intensity" aria-label="Intensity" type="range" min="10" max="90" bind:value={intensity} />
|
|
52
|
-
<button type="reset">Reset</button>
|
|
53
|
-
{#if mutableSubject}
|
|
54
|
-
<button type="button" onclick={mutateSubject}>Mutate subject</button>
|
|
55
|
-
{/if}
|
|
56
|
-
</Form>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ControlInteractionRegistry, ControlSubject } from '../control-interaction.js';
|
|
2
|
-
type $$ComponentProps = {
|
|
3
|
-
registry: ControlInteractionRegistry;
|
|
4
|
-
subject?: ControlSubject;
|
|
5
|
-
displayNameLabel?: string;
|
|
6
|
-
formOnInput?: (event: Event) => void;
|
|
7
|
-
formId?: string;
|
|
8
|
-
};
|
|
9
|
-
declare const StagedReview: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
10
|
-
type StagedReview = ReturnType<typeof StagedReview>;
|
|
11
|
-
export default StagedReview;
|
|
12
|
-
//# sourceMappingURL=staged-review.fixture.svelte.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"staged-review.fixture.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/__tests__/staged-review.fixture.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,0BAA0B,EAC1B,cAAc,EACf,MAAM,2BAA2B,CAAC;AAMlC,KAAK,gBAAgB,GAAI;IACxB,QAAQ,EAAE,0BAA0B,CAAC;IACrC,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAmDF,QAAA,MAAM,YAAY,sDAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import ThemeProvider from '../../../themes/ThemeProvider.svelte';
|
|
3
|
-
import DataTable from '../../data/DataTable.svelte';
|
|
4
|
-
import FilterChips from '../../nav/FilterChips.svelte';
|
|
5
|
-
import Button from '../../ui/Button.svelte';
|
|
6
|
-
import Checkbox from '../Checkbox.svelte';
|
|
7
|
-
import Input from '../Input.svelte';
|
|
8
|
-
import Radio from '../Radio.svelte';
|
|
9
|
-
import RadioGroup from '../RadioGroup.svelte';
|
|
10
|
-
import SegmentedControl from '../SegmentedControl.svelte';
|
|
11
|
-
import Select from '../Select.svelte';
|
|
12
|
-
import Switch from '../Switch.svelte';
|
|
13
|
-
import Textarea from '../Textarea.svelte';
|
|
14
|
-
|
|
15
|
-
let {
|
|
16
|
-
density = 'touch',
|
|
17
|
-
target = '48px',
|
|
18
|
-
}: { density?: 'comfortable' | 'touch'; target?: string } = $props();
|
|
19
|
-
</script>
|
|
20
|
-
<ThemeProvider {density} overrides={{ '--smrt-touch-target-min': target }} persist={false} inlineVariables>
|
|
21
|
-
<Input aria-label="Name" name="name" size={12} />
|
|
22
|
-
<Select aria-label="Choice"><option value="one">One</option></Select>
|
|
23
|
-
<Textarea aria-label="Notes" />
|
|
24
|
-
<Checkbox label="Approve" />
|
|
25
|
-
<Switch label="Enable" />
|
|
26
|
-
<RadioGroup name="radio" label="Radio"><Radio value="one" label="Option one" /></RadioGroup>
|
|
27
|
-
<Button size="sm">Save</Button>
|
|
28
|
-
<Button href="/details" size="sm">Details</Button>
|
|
29
|
-
<FilterChips size="sm" options={[{ value: 'one', label: 'One' }, { value: 'off', label: 'Disabled', disabled: true }]} selected="one" />
|
|
30
|
-
<SegmentedControl label="Segments" options={[{ value: 'one', label: 'One' }, { value: 'two', label: 'Two' }]} />
|
|
31
|
-
<DataTable data={[{ id: 'one', title: 'Item' }]} columns={[{ id: 'title', label: 'Title', sortable: true }]} sortable rowKey="id" />
|
|
32
|
-
<Input aria-label="Local touch" density="touch" />
|
|
33
|
-
<Input aria-label="Local comfortable" density="comfortable" />
|
|
34
|
-
</ThemeProvider>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
type $$ComponentProps = {
|
|
2
|
-
density?: 'comfortable' | 'touch';
|
|
3
|
-
target?: string;
|
|
4
|
-
};
|
|
5
|
-
declare const TouchDensity: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type TouchDensity = ReturnType<typeof TouchDensity>;
|
|
7
|
-
export default TouchDensity;
|
|
8
|
-
//# sourceMappingURL=touch-density.fixture.svelte.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"touch-density.fixture.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/__tests__/touch-density.fixture.svelte.ts"],"names":[],"mappings":"AAgBC,KAAK,gBAAgB,GAAI;IAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAsCjF,QAAA,MAAM,YAAY,sDAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { render, screen } from '@testing-library/svelte';
|
|
2
|
-
import { createRawSnippet } from 'svelte';
|
|
3
|
-
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
|
-
import DataTable from '../../data/DataTable.svelte';
|
|
5
|
-
import FilterChips from '../../nav/FilterChips.svelte';
|
|
6
|
-
import Button from '../../ui/Button.svelte';
|
|
7
|
-
import Checkbox from '../Checkbox.svelte';
|
|
8
|
-
import Input from '../Input.svelte';
|
|
9
|
-
import RadioGroup from '../RadioGroup.svelte';
|
|
10
|
-
import SegmentedControl from '../SegmentedControl.svelte';
|
|
11
|
-
import Select from '../Select.svelte';
|
|
12
|
-
import Switch from '../Switch.svelte';
|
|
13
|
-
import Textarea from '../Textarea.svelte';
|
|
14
|
-
import TouchDensityFixture from './touch-density.fixture.svelte';
|
|
15
|
-
describe('touch density', () => {
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
window.matchMedia = vi.fn().mockReturnValue({
|
|
18
|
-
matches: false,
|
|
19
|
-
addEventListener: vi.fn(),
|
|
20
|
-
removeEventListener: vi.fn(),
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
it.each([
|
|
24
|
-
['Input', Input, {}],
|
|
25
|
-
[
|
|
26
|
-
'RadioGroup',
|
|
27
|
-
RadioGroup,
|
|
28
|
-
{
|
|
29
|
-
name: 'choice',
|
|
30
|
-
children: createRawSnippet(() => ({
|
|
31
|
-
render: () => '<span>Options</span>',
|
|
32
|
-
})),
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
[
|
|
36
|
-
'Select',
|
|
37
|
-
Select,
|
|
38
|
-
{
|
|
39
|
-
children: createRawSnippet(() => ({
|
|
40
|
-
render: () => '<option value="one">One</option>',
|
|
41
|
-
})),
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
['Textarea', Textarea, {}],
|
|
45
|
-
['Checkbox', Checkbox, {}],
|
|
46
|
-
['Switch', Switch, {}],
|
|
47
|
-
['Button', Button, {}],
|
|
48
|
-
['FilterChips', FilterChips, { options: [], selected: '' }],
|
|
49
|
-
['SegmentedControl', SegmentedControl, { options: [], label: 'Segments' }],
|
|
50
|
-
['DataTable', DataTable, { columns: [], data: [] }],
|
|
51
|
-
])('%s consumes density on its target root', (_name, component, props) => {
|
|
52
|
-
const { container } = render(component, {
|
|
53
|
-
props: { ...props, density: 'touch' },
|
|
54
|
-
});
|
|
55
|
-
expect(container.querySelector('[data-density="touch"]')).toBeTruthy();
|
|
56
|
-
expect(container.querySelector('[density]')).toBeNull();
|
|
57
|
-
});
|
|
58
|
-
it('inherits global density while preserving native size and local overrides', () => {
|
|
59
|
-
const { container } = render(TouchDensityFixture);
|
|
60
|
-
expect(container.querySelector('.smrt-theme-root')).toHaveAttribute('style', expect.stringContaining('--smrt-control-target-min: var(--smrt-touch-target-min, 48px)'));
|
|
61
|
-
expect(screen.getByRole('textbox', { name: 'Name' })).toHaveAttribute('size', '12');
|
|
62
|
-
expect(screen.getByRole('textbox', { name: 'Name' })).not.toHaveAttribute('data-density');
|
|
63
|
-
expect(screen.getByRole('textbox', { name: 'Local comfortable' })).toHaveAttribute('data-density', 'comfortable');
|
|
64
|
-
expect(screen.getByRole('textbox', { name: 'Local touch' })).toHaveAttribute('data-density', 'touch');
|
|
65
|
-
});
|
|
66
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* smrt-ui is the dependency leaf, and the form-retry entry is published
|
|
3
|
-
* Svelte-free (#3291): its sources must never import `@sveltejs/kit` or
|
|
4
|
-
* `svelte`, so plain SvelteKit apps, smrt-svelte and plain Node can load it.
|
|
5
|
-
*/
|
|
6
|
-
import { readdirSync, readFileSync } from 'node:fs';
|
|
7
|
-
import { dirname, join } from 'node:path';
|
|
8
|
-
import { fileURLToPath } from 'node:url';
|
|
9
|
-
import { describe, expect, it } from 'vitest';
|
|
10
|
-
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
11
|
-
describe('form-retry import boundary', () => {
|
|
12
|
-
it('imports neither @sveltejs/kit nor svelte', () => {
|
|
13
|
-
const sources = readdirSync(root).filter((name) => name.endsWith('.ts'));
|
|
14
|
-
expect(sources.length).toBeGreaterThan(0);
|
|
15
|
-
for (const name of sources) {
|
|
16
|
-
const text = readFileSync(join(root, name), 'utf8');
|
|
17
|
-
const imports = [...text.matchAll(/from\s+['"]([^'"]+)['"]/g)].map((match) => match[1]);
|
|
18
|
-
for (const specifier of imports) {
|
|
19
|
-
expect(specifier, `${name} imports ${specifier}`).toMatch(/^\.\//);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
});
|