fuma 2.0.50 → 2.1.0
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/action/index.d.ts +2 -5
- package/dist/action/index.js +2 -5
- package/dist/action/list/handlers.d.ts +6 -6
- package/dist/action/list/handlers.js +6 -5
- package/dist/action/list/index.d.ts +1 -1
- package/dist/action/list/index.js +11 -5
- package/dist/action/list/trigger.js +6 -2
- package/dist/action/list/utils.js +1 -1
- package/dist/action/tip.js +2 -2
- package/dist/command/command.svelte.d.ts +16 -0
- package/dist/command/command.svelte.js +68 -0
- package/dist/command/index.d.ts +1 -0
- package/dist/command/index.js +1 -0
- package/dist/data.d.ts +87 -0
- package/dist/data.js +51 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/input/InputBoolean.svelte +107 -0
- package/dist/input/InputBoolean.svelte.d.ts +12 -0
- package/dist/input/InputNumber.svelte +33 -0
- package/dist/input/InputNumber.svelte.d.ts +10 -0
- package/dist/input/InputRadio.svelte +56 -0
- package/dist/input/InputRadio.svelte.d.ts +11 -0
- package/dist/input/InputRange.svelte +30 -0
- package/dist/input/InputRange.svelte.d.ts +10 -0
- package/dist/input/InputRelation.svelte +119 -0
- package/dist/input/InputRelation.svelte.d.ts +39 -0
- package/dist/input/InputSelect.svelte +113 -0
- package/dist/input/InputSelect.svelte.d.ts +37 -0
- package/dist/input/InputSelectNative.svelte +56 -0
- package/dist/input/InputSelectNative.svelte.d.ts +12 -0
- package/dist/input/InputString.svelte +48 -0
- package/dist/input/InputString.svelte.d.ts +11 -0
- package/dist/input/InputTextarea.svelte +47 -0
- package/dist/input/InputTextarea.svelte.d.ts +11 -0
- package/dist/input/Issues.svelte +21 -0
- package/dist/input/Issues.svelte.d.ts +7 -0
- package/dist/input/index.d.ts +11 -0
- package/dist/input/index.js +10 -0
- package/dist/input/type.d.ts +5 -0
- package/dist/input/type.js +1 -0
- package/dist/popover/Popover.svelte +50 -0
- package/dist/popover/index.d.ts +2 -0
- package/dist/popover/index.js +2 -0
- package/dist/popover/popover.svelte.d.ts +26 -0
- package/dist/popover/popover.svelte.js +101 -0
- package/dist/remote/useForm.d.ts +6 -0
- package/dist/remote/useForm.js +22 -0
- package/dist/search/Spans.svelte +15 -0
- package/dist/search/Spans.svelte.d.ts +7 -0
- package/dist/search/index.d.ts +2 -0
- package/dist/search/index.js +2 -0
- package/dist/search/search.js +96 -0
- package/dist/server/index.d.ts +0 -4
- package/dist/server/index.js +0 -4
- package/dist/server/parseQuery.js +1 -1
- package/dist/server/sse.js +4 -4
- package/dist/server/table.js +1 -1
- package/dist/state/index.d.ts +1 -0
- package/dist/state/index.js +1 -0
- package/dist/state/param.svelte.d.ts +18 -0
- package/dist/state/param.svelte.js +66 -0
- package/dist/ui/button/ButtonDelete.svelte +49 -28
- package/dist/ui/button/ButtonDelete.svelte.d.ts +12 -31
- package/dist/ui/button/index.d.ts +0 -1
- package/dist/ui/button/index.js +0 -1
- package/dist/ui/copy/ButtonCopy.svelte +43 -0
- package/dist/ui/copy/ButtonCopy.svelte.d.ts +17 -0
- package/dist/ui/copy/index.d.ts +2 -0
- package/dist/ui/copy/index.js +2 -0
- package/dist/ui/copy/useCopy.svelte.d.ts +10 -0
- package/dist/ui/copy/useCopy.svelte.js +36 -0
- package/dist/ui/dialog/Dialog.svelte +56 -26
- package/dist/ui/dialog/Dialog.svelte.d.ts +14 -35
- package/dist/ui/dialog/index.d.ts +0 -1
- package/dist/ui/dialog/index.js +0 -1
- package/dist/ui/drawer/Drawer.svelte +53 -45
- package/dist/ui/drawer/Drawer.svelte.d.ts +8 -63
- package/dist/ui/drawer/drawerFly.js +1 -1
- package/dist/ui/drawer/useLayer.svelte.d.ts +5 -0
- package/dist/ui/drawer/useLayer.svelte.js +33 -0
- package/dist/ui/index.d.ts +4 -12
- package/dist/ui/index.js +4 -12
- package/dist/ui/menu/ContextMenu.svelte +27 -26
- package/dist/ui/menu/ContextMenu.svelte.d.ts +9 -35
- package/dist/ui/menu/DropDown.svelte +44 -26
- package/dist/ui/menu/DropDown.svelte.d.ts +18 -43
- package/dist/ui/menu/DropDownMenu.svelte +51 -41
- package/dist/ui/menu/DropDownMenu.svelte.d.ts +7 -29
- package/dist/ui/menu/dropdown.css +4 -4
- package/dist/ui/menu/index.d.ts +1 -1
- package/dist/ui/menu/index.js +2 -1
- package/dist/ui/mode/ToggleMode.svelte +25 -14
- package/dist/ui/mode/ToggleMode.svelte.d.ts +10 -35
- package/dist/ui/mode/index.d.ts +1 -1
- package/dist/ui/mode/index.js +1 -1
- package/dist/ui/mode/useMode.svelte.d.ts +8 -0
- package/dist/ui/mode/useMode.svelte.js +40 -0
- package/dist/ui/pagination/Pagination.svelte +18 -14
- package/dist/ui/pagination/Pagination.svelte.d.ts +4 -18
- package/dist/ui/range/RangePicker.svelte +3 -2
- package/dist/ui/range/RangePickerButton.svelte +49 -37
- package/dist/ui/range/RangePickerButton.svelte.d.ts +7 -21
- package/dist/ui/range/index.d.ts +1 -1
- package/dist/ui/range/index.js +1 -1
- package/dist/ui/table/Table.svelte +15 -21
- package/dist/ui/table/Table.svelte.d.ts +1 -1
- package/dist/ui/table/TableBody.svelte +1 -1
- package/dist/ui/table/TableBody.svelte.d.ts +1 -1
- package/dist/ui/table/TableFieldsEdition.svelte +90 -78
- package/dist/ui/table/TableFieldsEdition.svelte.d.ts +14 -13
- package/dist/ui/table/TableHead.svelte +1 -1
- package/dist/ui/table/TableViewSelect.svelte +69 -69
- package/dist/ui/table/TableViewSelect.svelte.d.ts +10 -23
- package/dist/ui/table/cell/TableCellArray.svelte +1 -1
- package/dist/ui/table/cell/TableCellBoolean.svelte +3 -4
- package/dist/ui/table/cell/index.d.ts +1 -1
- package/dist/ui/table/cell/index.js +1 -1
- package/dist/ui/table/head/OrderButtons.svelte +18 -13
- package/dist/ui/table/head/OrderButtons.svelte.d.ts +11 -23
- package/dist/ui/table/head/TableHeadBoolean.svelte +3 -3
- package/dist/ui/table/head/TableHeadDate.svelte +41 -53
- package/dist/ui/table/head/TableHeadDate.svelte.d.ts +1 -1
- package/dist/ui/table/head/TableHeadDefault.svelte +2 -1
- package/dist/ui/table/head/TableHeadNumber.svelte +94 -108
- package/dist/ui/table/head/TableHeadNumber.svelte.d.ts +13 -10
- package/dist/ui/table/head/TableHeadSelect.svelte +55 -52
- package/dist/ui/table/head/TableHeadSelect.svelte.d.ts +13 -10
- package/dist/ui/table/head/TableHeadString.svelte +28 -34
- package/dist/ui/table/head/index.d.ts +3 -3
- package/dist/ui/table/head/index.js +3 -3
- package/dist/ui/table/index.d.ts +5 -5
- package/dist/ui/table/index.js +4 -5
- package/dist/utils/csv.js +1 -1
- package/dist/utils/eventEmitter.d.ts +2 -2
- package/dist/utils/eventEmitter.js +18 -11
- package/dist/utils/index.d.ts +4 -6
- package/dist/utils/index.js +4 -6
- package/dist/utils/normalizePath.js +1 -1
- package/dist/utils/options.d.ts +6 -5
- package/dist/utils/options.js +3 -2
- package/dist/utils/tippy.d.ts +1 -1
- package/dist/utils/tippy.js +1 -1
- package/dist/validation/index.d.ts +0 -1
- package/dist/validation/index.js +0 -1
- package/dist/validation/zod.d.ts +12 -393
- package/dist/validation/zod.js +22 -82
- package/package.json +111 -134
- package/dist/action/heightScreen.d.ts +0 -10
- package/dist/action/heightScreen.js +0 -24
- package/dist/action/portal.d.ts +0 -3
- package/dist/action/portal.js +0 -9
- package/dist/action/selector.d.ts +0 -15
- package/dist/action/selector.js +0 -71
- package/dist/api/client.d.ts +0 -3
- package/dist/api/client.js +0 -24
- package/dist/api/config.d.ts +0 -46
- package/dist/api/config.js +0 -7
- package/dist/api/index.d.ts +0 -3
- package/dist/api/index.js +0 -3
- package/dist/api/server.d.ts +0 -11
- package/dist/api/server.js +0 -17
- package/dist/private/Meta.svelte +0 -16
- package/dist/private/Meta.svelte.d.ts +0 -30
- package/dist/private/api.d.ts +0 -61
- package/dist/private/api.js +0 -10
- package/dist/private/constant.d.ts +0 -14
- package/dist/private/constant.js +0 -6
- package/dist/private/model.d.ts +0 -70
- package/dist/private/model.js +0 -25
- package/dist/private/prisma.d.ts +0 -2
- package/dist/private/prisma.js +0 -2
- package/dist/private/store.d.ts +0 -1
- package/dist/private/store.js +0 -2
- package/dist/server/auth.d.ts +0 -12
- package/dist/server/auth.js +0 -15
- package/dist/server/formAction.d.ts +0 -13
- package/dist/server/formAction.js +0 -8
- package/dist/server/json.d.ts +0 -1
- package/dist/server/json.js +0 -16
- package/dist/server/parseFormData.d.ts +0 -10
- package/dist/server/parseFormData.js +0 -85
- package/dist/server/try.d.ts +0 -9
- package/dist/server/try.js +0 -41
- package/dist/store/index.d.ts +0 -2
- package/dist/store/index.js +0 -2
- package/dist/store/isSmallScreen.d.ts +0 -1
- package/dist/store/isSmallScreen.js +0 -14
- package/dist/store/param.d.ts +0 -22
- package/dist/store/param.js +0 -61
- package/dist/store/session.d.ts +0 -1
- package/dist/store/session.js +0 -13
- package/dist/ui/badge/Badge.svelte +0 -9
- package/dist/ui/badge/Badge.svelte.d.ts +0 -21
- package/dist/ui/badge/index.d.ts +0 -1
- package/dist/ui/badge/index.js +0 -1
- package/dist/ui/button/ButtonCopy.svelte +0 -59
- package/dist/ui/button/ButtonCopy.svelte.d.ts +0 -27
- package/dist/ui/card/Card.svelte +0 -43
- package/dist/ui/card/Card.svelte.d.ts +0 -41
- package/dist/ui/card/CardBasic.svelte +0 -15
- package/dist/ui/card/CardBasic.svelte.d.ts +0 -31
- package/dist/ui/card/CardCollapse.svelte +0 -71
- package/dist/ui/card/CardCollapse.svelte.d.ts +0 -39
- package/dist/ui/card/CardFullScreen.svelte +0 -31
- package/dist/ui/card/CardFullScreen.svelte.d.ts +0 -38
- package/dist/ui/card/CardLink.svelte +0 -22
- package/dist/ui/card/CardLink.svelte.d.ts +0 -31
- package/dist/ui/card/index.d.ts +0 -5
- package/dist/ui/card/index.js +0 -5
- package/dist/ui/context.d.ts +0 -6
- package/dist/ui/context.js +0 -12
- package/dist/ui/dialog/DialogConfirm.svelte +0 -24
- package/dist/ui/dialog/DialogConfirm.svelte.d.ts +0 -35
- package/dist/ui/drawer/layers.d.ts +0 -7
- package/dist/ui/drawer/layers.js +0 -68
- package/dist/ui/form/Form.svelte +0 -168
- package/dist/ui/form/Form.svelte.d.ts +0 -62
- package/dist/ui/form/FormInput.svelte +0 -15
- package/dist/ui/form/FormSection.svelte +0 -78
- package/dist/ui/form/FormSection.svelte.d.ts +0 -39
- package/dist/ui/form/form.d.ts +0 -37
- package/dist/ui/form/form.js +0 -57
- package/dist/ui/form/formInput.js +0 -33
- package/dist/ui/form/index.d.ts +0 -3
- package/dist/ui/form/index.js +0 -3
- package/dist/ui/icon/Icon.svelte +0 -53
- package/dist/ui/icon/Icon.svelte.d.ts +0 -29
- package/dist/ui/icon/index.d.ts +0 -1
- package/dist/ui/icon/index.js +0 -1
- package/dist/ui/input/FormControl.svelte +0 -77
- package/dist/ui/input/FormControl.svelte.d.ts +0 -34
- package/dist/ui/input/InputBoolean.svelte +0 -33
- package/dist/ui/input/InputBoolean.svelte.d.ts +0 -46
- package/dist/ui/input/InputCheckboxs.svelte +0 -71
- package/dist/ui/input/InputCheckboxs.svelte.d.ts +0 -57
- package/dist/ui/input/InputCheckboxsMenu.svelte +0 -106
- package/dist/ui/input/InputCheckboxsMenu.svelte.d.ts +0 -59
- package/dist/ui/input/InputCheckboxsTree.svelte +0 -18
- package/dist/ui/input/InputCheckboxsTree.svelte.d.ts +0 -25
- package/dist/ui/input/InputCheckboxsTreeNodes.svelte +0 -68
- package/dist/ui/input/InputCheckboxsTreeNodes.svelte.d.ts +0 -27
- package/dist/ui/input/InputCombo.svelte +0 -99
- package/dist/ui/input/InputCombo.svelte.d.ts +0 -59
- package/dist/ui/input/InputDate.svelte +0 -47
- package/dist/ui/input/InputDate.svelte.d.ts +0 -46
- package/dist/ui/input/InputDateTime.svelte +0 -41
- package/dist/ui/input/InputDateTime.svelte.d.ts +0 -23
- package/dist/ui/input/InputImage.svelte +0 -116
- package/dist/ui/input/InputImage.svelte.d.ts +0 -48
- package/dist/ui/input/InputImagePreview.svelte +0 -60
- package/dist/ui/input/InputImagePreview.svelte.d.ts +0 -27
- package/dist/ui/input/InputNumber.svelte +0 -31
- package/dist/ui/input/InputNumber.svelte.d.ts +0 -23
- package/dist/ui/input/InputOptionInParam.svelte +0 -36
- package/dist/ui/input/InputOptionInParam.svelte.d.ts +0 -24
- package/dist/ui/input/InputOptions.svelte +0 -85
- package/dist/ui/input/InputOptions.svelte.d.ts +0 -21
- package/dist/ui/input/InputPassword.svelte +0 -25
- package/dist/ui/input/InputPassword.svelte.d.ts +0 -45
- package/dist/ui/input/InputRadio.svelte +0 -84
- package/dist/ui/input/InputRadio.svelte.d.ts +0 -56
- package/dist/ui/input/InputRelation.svelte +0 -171
- package/dist/ui/input/InputRelation.svelte.d.ts +0 -76
- package/dist/ui/input/InputRelations.svelte +0 -166
- package/dist/ui/input/InputRelations.svelte.d.ts +0 -55
- package/dist/ui/input/InputSearch.svelte +0 -59
- package/dist/ui/input/InputSearch.svelte.d.ts +0 -29
- package/dist/ui/input/InputSelect.svelte +0 -84
- package/dist/ui/input/InputSelect.svelte.d.ts +0 -29
- package/dist/ui/input/InputText.svelte +0 -46
- package/dist/ui/input/InputText.svelte.d.ts +0 -30
- package/dist/ui/input/InputTextarea.svelte +0 -23
- package/dist/ui/input/InputTextarea.svelte.d.ts +0 -23
- package/dist/ui/input/InputTime.svelte +0 -47
- package/dist/ui/input/InputTime.svelte.d.ts +0 -46
- package/dist/ui/input/RelationAfter.svelte +0 -34
- package/dist/ui/input/RelationAfter.svelte.d.ts +0 -26
- package/dist/ui/input/SelectorList.svelte +0 -50
- package/dist/ui/input/SelectorList.svelte.d.ts +0 -49
- package/dist/ui/input/action.d.ts +0 -13
- package/dist/ui/input/action.js +0 -56
- package/dist/ui/input/index.d.ts +0 -26
- package/dist/ui/input/index.js +0 -26
- package/dist/ui/input/textRich/InputTextRich.svelte +0 -72
- package/dist/ui/input/textRich/InputTextRich.svelte.d.ts +0 -48
- package/dist/ui/input/textRich/SuggesionList.svelte +0 -25
- package/dist/ui/input/textRich/SuggesionList.svelte.d.ts +0 -23
- package/dist/ui/input/textRich/ToolMark.svelte +0 -22
- package/dist/ui/input/textRich/ToolMark.svelte.d.ts +0 -25
- package/dist/ui/input/textRich/ToolMarkColor.svelte +0 -36
- package/dist/ui/input/textRich/ToolMarkColor.svelte.d.ts +0 -23
- package/dist/ui/input/textRich/ToolMarkLink.svelte +0 -72
- package/dist/ui/input/textRich/ToolMarkLink.svelte.d.ts +0 -21
- package/dist/ui/input/textRich/ToolMenu.svelte +0 -66
- package/dist/ui/input/textRich/ToolMenu.svelte.d.ts +0 -33
- package/dist/ui/input/textRich/ToolMenuAlign.svelte +0 -50
- package/dist/ui/input/textRich/ToolMenuAlign.svelte.d.ts +0 -21
- package/dist/ui/input/textRich/ToolMenuInsert.svelte +0 -54
- package/dist/ui/input/textRich/ToolMenuInsert.svelte.d.ts +0 -23
- package/dist/ui/input/textRich/ToolMenuNode.svelte +0 -60
- package/dist/ui/input/textRich/ToolMenuNode.svelte.d.ts +0 -21
- package/dist/ui/input/textRich/ToolsBar.svelte +0 -61
- package/dist/ui/input/textRich/ToolsBar.svelte.d.ts +0 -24
- package/dist/ui/input/textRich/extensions.d.ts +0 -2
- package/dist/ui/input/textRich/extensions.js +0 -62
- package/dist/ui/input/textRich/indent.d.ts +0 -13
- package/dist/ui/input/textRich/indent.js +0 -112
- package/dist/ui/input/textRich/index.d.ts +0 -3
- package/dist/ui/input/textRich/index.js +0 -3
- package/dist/ui/input/textRich/suggestion.d.ts +0 -7
- package/dist/ui/input/textRich/suggestion.js +0 -55
- package/dist/ui/input/textRich/tiptapParser.d.ts +0 -4
- package/dist/ui/input/textRich/tiptapParser.js +0 -29
- package/dist/ui/input/types.d.ts +0 -15
- package/dist/ui/input/types.js +0 -1
- package/dist/ui/login/Login.svelte +0 -99
- package/dist/ui/login/Login.svelte.d.ts +0 -20
- package/dist/ui/login/index.d.ts +0 -1
- package/dist/ui/login/index.js +0 -1
- package/dist/ui/placeholder/Placeholder.svelte +0 -12
- package/dist/ui/placeholder/Placeholder.svelte.d.ts +0 -30
- package/dist/ui/placeholder/PlaceholderImage.svelte +0 -16
- package/dist/ui/placeholder/PlaceholderImage.svelte.d.ts +0 -30
- package/dist/ui/placeholder/index.d.ts +0 -2
- package/dist/ui/placeholder/index.js +0 -2
- package/dist/ui/tabs/Tabs.svelte +0 -32
- package/dist/ui/tabs/Tabs.svelte.d.ts +0 -22
- package/dist/ui/tabs/TabsIcon.svelte +0 -60
- package/dist/ui/tabs/TabsIcon.svelte.d.ts +0 -24
- package/dist/ui/tabs/index.d.ts +0 -8
- package/dist/ui/tabs/index.js +0 -2
- package/dist/utils/avatar.d.ts +0 -1
- package/dist/utils/avatar.js +0 -5
- package/dist/utils/component.d.ts +0 -6
- package/dist/utils/component.js +0 -3
- package/dist/validation/form.d.ts +0 -34
- package/dist/validation/form.js +0 -103
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { RemoteFormField } from '@sveltejs/kit'
|
|
3
|
+
import Issues from './Issues.svelte'
|
|
4
|
+
import type { InputProps } from './type.ts'
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
label,
|
|
8
|
+
field,
|
|
9
|
+
value = $bindable(),
|
|
10
|
+
class: klass,
|
|
11
|
+
...props
|
|
12
|
+
}: {
|
|
13
|
+
label: string
|
|
14
|
+
field?: RemoteFormField<number>
|
|
15
|
+
value?: number
|
|
16
|
+
} & InputProps = $props()
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<label>
|
|
20
|
+
<div class="flex gap-2 px-3 text-sm">
|
|
21
|
+
<span class="label">{label}</span>
|
|
22
|
+
<span class="ml-auto">{field?.value() ?? value}</span>
|
|
23
|
+
</div>
|
|
24
|
+
{#if field}
|
|
25
|
+
<input class={['range range-sm', klass]} {...field.as('range')} {...props} />
|
|
26
|
+
{:else}
|
|
27
|
+
<input class={['range range-sm', klass]} type="range" bind:value {...props} />
|
|
28
|
+
{/if}
|
|
29
|
+
<Issues {field} />
|
|
30
|
+
</label>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RemoteFormField } from '@sveltejs/kit';
|
|
2
|
+
import type { InputProps } from './type.ts';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
label: string;
|
|
5
|
+
field?: RemoteFormField<number>;
|
|
6
|
+
value?: number;
|
|
7
|
+
} & InputProps;
|
|
8
|
+
declare const InputRange: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
9
|
+
type InputRange = ReturnType<typeof InputRange>;
|
|
10
|
+
export default InputRange;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<script lang="ts" generics="Item">
|
|
2
|
+
import { ChevronsUpDownIcon } from '@lucide/svelte'
|
|
3
|
+
import type { RemoteFormField, RemoteQueryFunction } from '@sveltejs/kit'
|
|
4
|
+
import type { Snippet } from 'svelte'
|
|
5
|
+
import { useCommand } from '../command/command.svelte.ts'
|
|
6
|
+
import { usePopover } from '../popover/popover.svelte.ts'
|
|
7
|
+
import Issues from './Issues.svelte'
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
label,
|
|
11
|
+
searchItems,
|
|
12
|
+
getValue,
|
|
13
|
+
selected,
|
|
14
|
+
proposal,
|
|
15
|
+
field,
|
|
16
|
+
value = $bindable()
|
|
17
|
+
}: {
|
|
18
|
+
label: string
|
|
19
|
+
searchItems: RemoteQueryFunction<{ search: string }, Item[]>
|
|
20
|
+
getValue: (item: Item) => string
|
|
21
|
+
selected?: Snippet<[Item]>
|
|
22
|
+
proposal?: Snippet<[Item, { isSelected: boolean; isFocus: boolean }]>
|
|
23
|
+
field?: RemoteFormField<string>
|
|
24
|
+
value?: string
|
|
25
|
+
} = $props()
|
|
26
|
+
|
|
27
|
+
let search = $state('')
|
|
28
|
+
const items = $derived.by(() => searchItems({ search }))
|
|
29
|
+
|
|
30
|
+
let selectedItem = $state<Item | undefined>(undefined)
|
|
31
|
+
|
|
32
|
+
$effect(() => {
|
|
33
|
+
const targetValue = field?.value() ?? value
|
|
34
|
+
selectedItem = items.current?.find((item) => getValue(item) === targetValue)
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
const popover = usePopover({ listenFocus: false })
|
|
38
|
+
const command = useCommand({
|
|
39
|
+
isEnable: () => popover.isOpen,
|
|
40
|
+
onSelect: (index) => {
|
|
41
|
+
popover.hide()
|
|
42
|
+
const item = items.current?.[index]
|
|
43
|
+
if (!item) return
|
|
44
|
+
selectedItem = item
|
|
45
|
+
if (field) {
|
|
46
|
+
field.set(getValue(item))
|
|
47
|
+
} else {
|
|
48
|
+
value = getValue(item)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
{#if field?.value() !== undefined}
|
|
55
|
+
<input {...field.as('hidden', field.value() as string)} />
|
|
56
|
+
{/if}
|
|
57
|
+
|
|
58
|
+
<div>
|
|
59
|
+
<label class="floating-label">
|
|
60
|
+
<span>{label}</span>
|
|
61
|
+
<button
|
|
62
|
+
class={['input', field?.issues.length && 'input-error']}
|
|
63
|
+
{...popover.trigger}
|
|
64
|
+
type="button"
|
|
65
|
+
>
|
|
66
|
+
<div class="grow text-left">
|
|
67
|
+
{#if !selectedItem}
|
|
68
|
+
<span class="opacity-60">Select a value</span>
|
|
69
|
+
{:else if selected}
|
|
70
|
+
<!-- item.icon not rerender if not wrapped in #key -->
|
|
71
|
+
{#key selectedItem}{@render selected(selectedItem)}{/key}
|
|
72
|
+
{:else}
|
|
73
|
+
{getValue(selectedItem)}
|
|
74
|
+
{/if}
|
|
75
|
+
</div>
|
|
76
|
+
<ChevronsUpDownIcon size={14} />
|
|
77
|
+
</button>
|
|
78
|
+
</label>
|
|
79
|
+
|
|
80
|
+
<div
|
|
81
|
+
{...popover.content}
|
|
82
|
+
class={['my-2 rounded-box border bg-base-100 shadow-xl']}
|
|
83
|
+
style="min-width: anchor-size(width);"
|
|
84
|
+
tabindex="-1"
|
|
85
|
+
>
|
|
86
|
+
<div class="sticky top-0 z-10 bg-base-100 p-2">
|
|
87
|
+
<input type="search" {...command.trigger} class="input input-sm" bind:value={search} />
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<ul class="menu max-h-80 w-full flex-nowrap pt-0">
|
|
91
|
+
{#each items.current as item, index (item)}
|
|
92
|
+
{@const isSelected = index === command.selectedIndex}
|
|
93
|
+
{@const isFocus = index === command.focusIndex}
|
|
94
|
+
<li>
|
|
95
|
+
<button
|
|
96
|
+
{...command.item(index, '')}
|
|
97
|
+
class={[isFocus && 'menu-focus', 'scroll-mt-13 scroll-mb-2']}
|
|
98
|
+
type="button"
|
|
99
|
+
tabindex="-1"
|
|
100
|
+
role="option"
|
|
101
|
+
>
|
|
102
|
+
{#if proposal}
|
|
103
|
+
{@render proposal(item, { isSelected, isFocus })}
|
|
104
|
+
{:else}
|
|
105
|
+
{getValue(item)}
|
|
106
|
+
{/if}
|
|
107
|
+
</button>
|
|
108
|
+
</li>
|
|
109
|
+
{/each}
|
|
110
|
+
</ul>
|
|
111
|
+
</div>
|
|
112
|
+
<Issues {field} />
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
<style>
|
|
116
|
+
div[popover] {
|
|
117
|
+
border-color: color-mix(in oklab, var(--color-base-content) 20%, #0000);
|
|
118
|
+
}
|
|
119
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { RemoteFormField, RemoteQueryFunction } from '@sveltejs/kit';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
declare function $$render<Item>(): {
|
|
4
|
+
props: {
|
|
5
|
+
label: string;
|
|
6
|
+
searchItems: RemoteQueryFunction<{
|
|
7
|
+
search: string;
|
|
8
|
+
}, Item[]>;
|
|
9
|
+
getValue: (item: Item) => string;
|
|
10
|
+
selected?: Snippet<[Item]>;
|
|
11
|
+
proposal?: Snippet<[Item, {
|
|
12
|
+
isSelected: boolean;
|
|
13
|
+
isFocus: boolean;
|
|
14
|
+
}]>;
|
|
15
|
+
field?: RemoteFormField<string>;
|
|
16
|
+
value?: string;
|
|
17
|
+
};
|
|
18
|
+
exports: {};
|
|
19
|
+
bindings: "value";
|
|
20
|
+
slots: {};
|
|
21
|
+
events: {};
|
|
22
|
+
};
|
|
23
|
+
declare class __sveltets_Render<Item> {
|
|
24
|
+
props(): ReturnType<typeof $$render<Item>>['props'];
|
|
25
|
+
events(): ReturnType<typeof $$render<Item>>['events'];
|
|
26
|
+
slots(): ReturnType<typeof $$render<Item>>['slots'];
|
|
27
|
+
bindings(): "value";
|
|
28
|
+
exports(): {};
|
|
29
|
+
}
|
|
30
|
+
interface $$IsomorphicComponent {
|
|
31
|
+
new <Item>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Item>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Item>['props']>, ReturnType<__sveltets_Render<Item>['events']>, ReturnType<__sveltets_Render<Item>['slots']>> & {
|
|
32
|
+
$$bindings?: ReturnType<__sveltets_Render<Item>['bindings']>;
|
|
33
|
+
} & ReturnType<__sveltets_Render<Item>['exports']>;
|
|
34
|
+
<Item>(internal: unknown, props: ReturnType<__sveltets_Render<Item>['props']> & {}): ReturnType<__sveltets_Render<Item>['exports']>;
|
|
35
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
36
|
+
}
|
|
37
|
+
declare const InputRelation: $$IsomorphicComponent;
|
|
38
|
+
type InputRelation<Item> = InstanceType<typeof InputRelation<Item>>;
|
|
39
|
+
export default InputRelation;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<script lang="ts" generics="Item">
|
|
2
|
+
import { ChevronsUpDownIcon } from '@lucide/svelte'
|
|
3
|
+
import type { RemoteFormField } from '@sveltejs/kit'
|
|
4
|
+
import type { Snippet } from 'svelte'
|
|
5
|
+
import { useCommand } from '../command/command.svelte.ts'
|
|
6
|
+
import { usePopover } from '../popover/popover.svelte.ts'
|
|
7
|
+
import Issues from './Issues.svelte'
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
label,
|
|
11
|
+
items,
|
|
12
|
+
getValue,
|
|
13
|
+
selected,
|
|
14
|
+
proposal,
|
|
15
|
+
field,
|
|
16
|
+
value = $bindable()
|
|
17
|
+
}: {
|
|
18
|
+
label: string
|
|
19
|
+
items: Item[]
|
|
20
|
+
getValue: (item: Item) => string
|
|
21
|
+
selected?: Snippet<[Item]>
|
|
22
|
+
proposal?: Snippet<[Item, { isSelected: boolean; isFocus: boolean }]>
|
|
23
|
+
field?: RemoteFormField<string>
|
|
24
|
+
value?: string
|
|
25
|
+
} = $props()
|
|
26
|
+
|
|
27
|
+
let selectedItem = $state<Item | undefined>(undefined)
|
|
28
|
+
|
|
29
|
+
$effect(() => {
|
|
30
|
+
const targetValue = field?.value() ?? value
|
|
31
|
+
selectedItem = items.find((item) => getValue(item) === targetValue)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const popover = usePopover({ listenFocus: false })
|
|
35
|
+
const command = useCommand({
|
|
36
|
+
isEnable: () => popover.isOpen,
|
|
37
|
+
onSelect: (index) => {
|
|
38
|
+
popover.hide()
|
|
39
|
+
const item = items[index]
|
|
40
|
+
if (!item) return
|
|
41
|
+
selectedItem = item
|
|
42
|
+
if (field) {
|
|
43
|
+
field.set(getValue(item))
|
|
44
|
+
} else {
|
|
45
|
+
value = getValue(item)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
{#if field?.value() !== undefined}
|
|
52
|
+
<input {...field.as('hidden', field.value() as string)} />
|
|
53
|
+
{/if}
|
|
54
|
+
|
|
55
|
+
<div>
|
|
56
|
+
<label class="floating-label">
|
|
57
|
+
<span>{label}</span>
|
|
58
|
+
<button
|
|
59
|
+
type="button"
|
|
60
|
+
class={['input', field?.issues.length && 'input-error']}
|
|
61
|
+
{...popover.trigger}
|
|
62
|
+
{...command.trigger}
|
|
63
|
+
>
|
|
64
|
+
<div class="grow text-left">
|
|
65
|
+
{#if !selectedItem}
|
|
66
|
+
<span class="opacity-60">Select a value</span>
|
|
67
|
+
{:else if selected}
|
|
68
|
+
<!-- item.icon not rerender if not wrapped in #key -->
|
|
69
|
+
{#key selectedItem}{@render selected(selectedItem)}{/key}
|
|
70
|
+
{:else}
|
|
71
|
+
{getValue(selectedItem)}
|
|
72
|
+
{/if}
|
|
73
|
+
</div>
|
|
74
|
+
<ChevronsUpDownIcon size={14} />
|
|
75
|
+
</button>
|
|
76
|
+
</label>
|
|
77
|
+
|
|
78
|
+
<div
|
|
79
|
+
{...popover.content}
|
|
80
|
+
class={['my-2 rounded-box border bg-base-100 shadow-xl']}
|
|
81
|
+
style="width: anchor-size(width);"
|
|
82
|
+
tabindex="-1"
|
|
83
|
+
>
|
|
84
|
+
<ul class="menu max-h-80 w-full flex-nowrap">
|
|
85
|
+
{#each items as item, index (item)}
|
|
86
|
+
{@const isSelected = index === command.selectedIndex}
|
|
87
|
+
{@const isFocus = index === command.focusIndex}
|
|
88
|
+
<li>
|
|
89
|
+
<button
|
|
90
|
+
{...command.item(index)}
|
|
91
|
+
class={[isFocus && 'menu-focus']}
|
|
92
|
+
type="button"
|
|
93
|
+
tabindex="-1"
|
|
94
|
+
role="option"
|
|
95
|
+
>
|
|
96
|
+
{#if proposal}
|
|
97
|
+
{@render proposal(item, { isSelected, isFocus })}
|
|
98
|
+
{:else}
|
|
99
|
+
{getValue(item)}
|
|
100
|
+
{/if}
|
|
101
|
+
</button>
|
|
102
|
+
</li>
|
|
103
|
+
{/each}
|
|
104
|
+
</ul>
|
|
105
|
+
</div>
|
|
106
|
+
<Issues {field} />
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<style>
|
|
110
|
+
div[popover] {
|
|
111
|
+
border-color: color-mix(in oklab, var(--color-base-content) 20%, #0000);
|
|
112
|
+
}
|
|
113
|
+
</style>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { RemoteFormField } from '@sveltejs/kit';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
declare function $$render<Item>(): {
|
|
4
|
+
props: {
|
|
5
|
+
label: string;
|
|
6
|
+
items: Item[];
|
|
7
|
+
getValue: (item: Item) => string;
|
|
8
|
+
selected?: Snippet<[Item]>;
|
|
9
|
+
proposal?: Snippet<[Item, {
|
|
10
|
+
isSelected: boolean;
|
|
11
|
+
isFocus: boolean;
|
|
12
|
+
}]>;
|
|
13
|
+
field?: RemoteFormField<string>;
|
|
14
|
+
value?: string;
|
|
15
|
+
};
|
|
16
|
+
exports: {};
|
|
17
|
+
bindings: "value";
|
|
18
|
+
slots: {};
|
|
19
|
+
events: {};
|
|
20
|
+
};
|
|
21
|
+
declare class __sveltets_Render<Item> {
|
|
22
|
+
props(): ReturnType<typeof $$render<Item>>['props'];
|
|
23
|
+
events(): ReturnType<typeof $$render<Item>>['events'];
|
|
24
|
+
slots(): ReturnType<typeof $$render<Item>>['slots'];
|
|
25
|
+
bindings(): "value";
|
|
26
|
+
exports(): {};
|
|
27
|
+
}
|
|
28
|
+
interface $$IsomorphicComponent {
|
|
29
|
+
new <Item>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Item>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Item>['props']>, ReturnType<__sveltets_Render<Item>['events']>, ReturnType<__sveltets_Render<Item>['slots']>> & {
|
|
30
|
+
$$bindings?: ReturnType<__sveltets_Render<Item>['bindings']>;
|
|
31
|
+
} & ReturnType<__sveltets_Render<Item>['exports']>;
|
|
32
|
+
<Item>(internal: unknown, props: ReturnType<__sveltets_Render<Item>['props']> & {}): ReturnType<__sveltets_Render<Item>['exports']>;
|
|
33
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
34
|
+
}
|
|
35
|
+
declare const InputSelect: $$IsomorphicComponent;
|
|
36
|
+
type InputSelect<Item> = InstanceType<typeof InputSelect<Item>>;
|
|
37
|
+
export default InputSelect;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { RemoteFormField } from '@sveltejs/kit'
|
|
3
|
+
import { type Options, parseOptions } from '../index.ts'
|
|
4
|
+
import Issues from './Issues.svelte'
|
|
5
|
+
import type { SelectProps } from './type.ts'
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
label,
|
|
9
|
+
field,
|
|
10
|
+
value = $bindable(),
|
|
11
|
+
options: optionsProp,
|
|
12
|
+
class: klass,
|
|
13
|
+
multiple,
|
|
14
|
+
...props
|
|
15
|
+
}: {
|
|
16
|
+
label: string
|
|
17
|
+
options: Options
|
|
18
|
+
field?: RemoteFormField<string | string[]>
|
|
19
|
+
value?: string | string[]
|
|
20
|
+
} & SelectProps = $props()
|
|
21
|
+
|
|
22
|
+
const options = $derived(parseOptions(optionsProp))
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<div>
|
|
26
|
+
<label class="floating-label">
|
|
27
|
+
<span>{label}</span>
|
|
28
|
+
<select
|
|
29
|
+
class={['select', klass]}
|
|
30
|
+
{...field?.as(multiple !== true ? 'select' : 'select multiple')}
|
|
31
|
+
bind:value
|
|
32
|
+
{...props}
|
|
33
|
+
>
|
|
34
|
+
{#each options as option}
|
|
35
|
+
<option value={option.value} class={['', option.class]} disabled={option.disabled}>
|
|
36
|
+
{#if option.icon}
|
|
37
|
+
<option.icon size={18} opacity={0.8} />
|
|
38
|
+
{/if}
|
|
39
|
+
<span class="grow">{option.label}</span>
|
|
40
|
+
</option>
|
|
41
|
+
{/each}
|
|
42
|
+
</select>
|
|
43
|
+
</label>
|
|
44
|
+
<Issues {field} />
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<style>
|
|
48
|
+
option::checkmark {
|
|
49
|
+
order: 1;
|
|
50
|
+
margin-left: auto;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
select[aria-invalid='true'] {
|
|
54
|
+
--input-color: var(--color-error);
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RemoteFormField } from '@sveltejs/kit';
|
|
2
|
+
import { type Options } from '../index.ts';
|
|
3
|
+
import type { SelectProps } from './type.ts';
|
|
4
|
+
type $$ComponentProps = {
|
|
5
|
+
label: string;
|
|
6
|
+
options: Options;
|
|
7
|
+
field?: RemoteFormField<string | string[]>;
|
|
8
|
+
value?: string | string[];
|
|
9
|
+
} & SelectProps;
|
|
10
|
+
declare const InputSelectNative: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
11
|
+
type InputSelectNative = ReturnType<typeof InputSelectNative>;
|
|
12
|
+
export default InputSelectNative;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { RemoteFormField } from '@sveltejs/kit'
|
|
3
|
+
import Issues from './Issues.svelte'
|
|
4
|
+
import type { InputProps } from './type.ts'
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
label,
|
|
8
|
+
field,
|
|
9
|
+
value = $bindable(),
|
|
10
|
+
type = 'text',
|
|
11
|
+
class: klass,
|
|
12
|
+
...props
|
|
13
|
+
}: {
|
|
14
|
+
label: string
|
|
15
|
+
field?: RemoteFormField<string>
|
|
16
|
+
value?: string
|
|
17
|
+
type?:
|
|
18
|
+
| 'text'
|
|
19
|
+
| 'email'
|
|
20
|
+
| 'password'
|
|
21
|
+
| 'url'
|
|
22
|
+
| 'tel'
|
|
23
|
+
| 'search'
|
|
24
|
+
| 'date'
|
|
25
|
+
| 'datetime-local'
|
|
26
|
+
| 'time'
|
|
27
|
+
| 'month'
|
|
28
|
+
| 'week'
|
|
29
|
+
| 'color'
|
|
30
|
+
| 'select'
|
|
31
|
+
} & InputProps = $props()
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<label class="floating-label">
|
|
35
|
+
<span>{label}</span>
|
|
36
|
+
{#if field}
|
|
37
|
+
<input placeholder={label} class={['input', klass]} {...field.as(type)} {...props} />
|
|
38
|
+
{:else}
|
|
39
|
+
<input placeholder={label} class={['input', klass]} {type} bind:value {...props} />
|
|
40
|
+
{/if}
|
|
41
|
+
<Issues {field} />
|
|
42
|
+
</label>
|
|
43
|
+
|
|
44
|
+
<style>
|
|
45
|
+
input[aria-invalid='true'] {
|
|
46
|
+
--input-color: var(--color-error);
|
|
47
|
+
}
|
|
48
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RemoteFormField } from '@sveltejs/kit';
|
|
2
|
+
import type { InputProps } from './type.ts';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
label: string;
|
|
5
|
+
field?: RemoteFormField<string>;
|
|
6
|
+
value?: string;
|
|
7
|
+
type?: 'text' | 'email' | 'password' | 'url' | 'tel' | 'search' | 'date' | 'datetime-local' | 'time' | 'month' | 'week' | 'color' | 'select';
|
|
8
|
+
} & InputProps;
|
|
9
|
+
declare const InputString: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
10
|
+
type InputString = ReturnType<typeof InputString>;
|
|
11
|
+
export default InputString;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { RemoteFormField } from '@sveltejs/kit'
|
|
3
|
+
import { TextareaAutosize } from 'runed'
|
|
4
|
+
import Issues from './Issues.svelte'
|
|
5
|
+
import type { TextareaProps } from './type.ts'
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
label,
|
|
9
|
+
field,
|
|
10
|
+
value = $bindable(),
|
|
11
|
+
class: klass,
|
|
12
|
+
maxHeight = 200,
|
|
13
|
+
...props
|
|
14
|
+
}: {
|
|
15
|
+
label: string
|
|
16
|
+
field?: RemoteFormField<string>
|
|
17
|
+
value?: string
|
|
18
|
+
maxHeight?: number
|
|
19
|
+
} & TextareaProps = $props()
|
|
20
|
+
|
|
21
|
+
let textarea = $state<HTMLTextAreaElement>()
|
|
22
|
+
new TextareaAutosize({
|
|
23
|
+
element: () => textarea,
|
|
24
|
+
input: () => field?.value() || value || '',
|
|
25
|
+
// svelte-ignore state_referenced_locally
|
|
26
|
+
maxHeight
|
|
27
|
+
})
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<label class="floating-label">
|
|
31
|
+
<span>{label}</span>
|
|
32
|
+
<textarea
|
|
33
|
+
placeholder={label}
|
|
34
|
+
class={['textarea', klass]}
|
|
35
|
+
bind:this={textarea}
|
|
36
|
+
{...field?.as('text')}
|
|
37
|
+
bind:value
|
|
38
|
+
{...props}
|
|
39
|
+
></textarea>
|
|
40
|
+
<Issues {field} />
|
|
41
|
+
</label>
|
|
42
|
+
|
|
43
|
+
<style>
|
|
44
|
+
textarea[aria-invalid='true'] {
|
|
45
|
+
--input-color: var(--color-error);
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RemoteFormField } from '@sveltejs/kit';
|
|
2
|
+
import type { TextareaProps } from './type.ts';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
label: string;
|
|
5
|
+
field?: RemoteFormField<string>;
|
|
6
|
+
value?: string;
|
|
7
|
+
maxHeight?: number;
|
|
8
|
+
} & TextareaProps;
|
|
9
|
+
declare const InputTextarea: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
10
|
+
type InputTextarea = ReturnType<typeof InputTextarea>;
|
|
11
|
+
export default InputTextarea;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { RemoteFormField } from '@sveltejs/kit'
|
|
3
|
+
import { slide } from 'svelte/transition'
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
field
|
|
7
|
+
}: {
|
|
8
|
+
// biome-ignore lint/suspicious/noExplicitAny: Wathever then value type... we use just field.issues()
|
|
9
|
+
field: RemoteFormField<any> | undefined
|
|
10
|
+
} = $props()
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
{#if field?.issues()?.length}
|
|
14
|
+
<div class="my-1 flex flex-col text-xs text-error" transition:slide={{ duration: 200 }}>
|
|
15
|
+
{#each field.issues() as issue}
|
|
16
|
+
<span>
|
|
17
|
+
{issue.message}
|
|
18
|
+
</span>
|
|
19
|
+
{/each}
|
|
20
|
+
</div>
|
|
21
|
+
{/if}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RemoteFormField } from '@sveltejs/kit';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
field: RemoteFormField<any> | undefined;
|
|
4
|
+
};
|
|
5
|
+
declare const Issues: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
+
type Issues = ReturnType<typeof Issues>;
|
|
7
|
+
export default Issues;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as InputBoolean } from './InputBoolean.svelte';
|
|
2
|
+
export { default as InputNumber } from './InputNumber.svelte';
|
|
3
|
+
export { default as InputRadio } from './InputRadio.svelte';
|
|
4
|
+
export { default as InputRange } from './InputRange.svelte';
|
|
5
|
+
export { default as InputRelation } from './InputRelation.svelte';
|
|
6
|
+
export { default as InputSelect } from './InputSelect.svelte';
|
|
7
|
+
export { default as InputSelectNative } from './InputSelectNative.svelte';
|
|
8
|
+
export { default as InputString } from './InputString.svelte';
|
|
9
|
+
export { default as InputTextarea } from './InputTextarea.svelte';
|
|
10
|
+
export { default as Issues } from './Issues.svelte';
|
|
11
|
+
export type * from './type.ts';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as InputBoolean } from './InputBoolean.svelte';
|
|
2
|
+
export { default as InputNumber } from './InputNumber.svelte';
|
|
3
|
+
export { default as InputRadio } from './InputRadio.svelte';
|
|
4
|
+
export { default as InputRange } from './InputRange.svelte';
|
|
5
|
+
export { default as InputRelation } from './InputRelation.svelte';
|
|
6
|
+
export { default as InputSelect } from './InputSelect.svelte';
|
|
7
|
+
export { default as InputSelectNative } from './InputSelectNative.svelte';
|
|
8
|
+
export { default as InputString } from './InputString.svelte';
|
|
9
|
+
export { default as InputTextarea } from './InputTextarea.svelte';
|
|
10
|
+
export { default as Issues } from './Issues.svelte';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HTMLInputAttributes, HTMLOptionAttributes, HTMLSelectAttributes, HTMLTextareaAttributes } from 'svelte/elements';
|
|
2
|
+
export type InputProps = Omit<HTMLInputAttributes, 'name' | 'value' | 'aria-invalid' | 'type'>;
|
|
3
|
+
export type TextareaProps = Omit<HTMLTextareaAttributes, 'name' | 'value' | 'aria-invalid'>;
|
|
4
|
+
export type OptionProps = Omit<HTMLOptionAttributes, 'name' | 'value' | 'aria-invalid'>;
|
|
5
|
+
export type SelectProps = Omit<HTMLSelectAttributes, 'name' | 'value' | 'aria-invalid'>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { ClassValue } from 'svelte/elements'
|
|
4
|
+
import {
|
|
5
|
+
type Placement,
|
|
6
|
+
type PopoverOptions,
|
|
7
|
+
type PopoverType,
|
|
8
|
+
usePopover
|
|
9
|
+
} from './popover.svelte.ts'
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
children,
|
|
13
|
+
trigger,
|
|
14
|
+
class: klass = '',
|
|
15
|
+
style = '',
|
|
16
|
+
...popoverOptions
|
|
17
|
+
}: {
|
|
18
|
+
children: Snippet<[PopoverType]>
|
|
19
|
+
trigger: Snippet<[PopoverType]>
|
|
20
|
+
placement?: Placement
|
|
21
|
+
class?: ClassValue
|
|
22
|
+
style?: string
|
|
23
|
+
} & PopoverOptions = $props()
|
|
24
|
+
|
|
25
|
+
let popover = usePopover((() => popoverOptions)())
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
{@render trigger(popover)}
|
|
29
|
+
|
|
30
|
+
<div {...popover.content} {style} class={['rounded-box border bg-base-100 shadow-xl', klass]}>
|
|
31
|
+
{@render children(popover)}
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<style>
|
|
35
|
+
div[popover] {
|
|
36
|
+
border-color: color-mix(in oklab, var(--color-base-content) 20%, #0000);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
div[popover]:popover-open {
|
|
40
|
+
inset: 5px;
|
|
41
|
+
transition-property: opacity, scale;
|
|
42
|
+
transition-duration: 150ms;
|
|
43
|
+
opacity: 1;
|
|
44
|
+
scale: 1;
|
|
45
|
+
@starting-style {
|
|
46
|
+
opacity: 0;
|
|
47
|
+
scale: 0.95;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
</style>
|