@sjsf/skeleton-theme 2.0.0-next.0 → 2.0.0-next.10

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.
Files changed (62) hide show
  1. package/README.md +3 -3
  2. package/dist/components/button.svelte +25 -10
  3. package/dist/components/button.svelte.d.ts +1 -0
  4. package/dist/components/description.svelte +7 -2
  5. package/dist/components/description.svelte.d.ts +1 -0
  6. package/dist/components/errors-list.svelte +10 -4
  7. package/dist/components/errors-list.svelte.d.ts +2 -3
  8. package/dist/components/exports.d.ts +1 -0
  9. package/dist/components/exports.js +1 -0
  10. package/dist/components/form.svelte +3 -3
  11. package/dist/components/form.svelte.d.ts +1 -0
  12. package/dist/components/help.svelte +7 -2
  13. package/dist/components/help.svelte.d.ts +1 -0
  14. package/dist/components/label.svelte +15 -0
  15. package/dist/components/label.svelte.d.ts +6 -0
  16. package/dist/components/layout.svelte +4 -7
  17. package/dist/components/layout.svelte.d.ts +1 -0
  18. package/dist/components/submit-button.svelte +4 -3
  19. package/dist/components/submit-button.svelte.d.ts +1 -0
  20. package/dist/components/title.svelte +11 -12
  21. package/dist/components/title.svelte.d.ts +1 -2
  22. package/dist/definitions.d.ts +6 -71
  23. package/dist/definitions.js +0 -1
  24. package/dist/extra-widgets/checkboxes-include.d.ts +6 -0
  25. package/dist/extra-widgets/checkboxes-include.js +4 -0
  26. package/dist/{widgets → extra-widgets}/checkboxes.svelte +2 -2
  27. package/dist/{widgets → extra-widgets}/checkboxes.svelte.d.ts +1 -0
  28. package/dist/extra-widgets/date-picker-include.d.ts +5 -0
  29. package/dist/extra-widgets/date-picker-include.js +2 -2
  30. package/dist/extra-widgets/date-picker.svelte +5 -3
  31. package/dist/extra-widgets/file-include.d.ts +6 -0
  32. package/dist/extra-widgets/file-include.js +4 -0
  33. package/dist/{widgets → extra-widgets}/file.svelte +6 -8
  34. package/dist/{widgets → extra-widgets}/file.svelte.d.ts +1 -0
  35. package/dist/extra-widgets/multi-select-include.d.ts +5 -0
  36. package/dist/extra-widgets/multi-select-include.js +2 -2
  37. package/dist/extra-widgets/multi-select.svelte +6 -5
  38. package/dist/extra-widgets/radio-include.d.ts +6 -1
  39. package/dist/extra-widgets/radio-include.js +4 -4
  40. package/dist/extra-widgets/radio.svelte +1 -1
  41. package/dist/extra-widgets/range-include.d.ts +5 -0
  42. package/dist/extra-widgets/range-include.js +2 -2
  43. package/dist/extra-widgets/range.svelte +5 -3
  44. package/dist/extra-widgets/textarea-include.d.ts +6 -1
  45. package/dist/extra-widgets/textarea-include.js +4 -4
  46. package/dist/extra-widgets/textarea.svelte +2 -5
  47. package/dist/index.d.ts +1 -107
  48. package/dist/index.js +0 -4
  49. package/dist/specs.d.ts +10 -0
  50. package/dist/specs.js +16 -0
  51. package/dist/styles.css +1 -1
  52. package/dist/widgets/checkbox.svelte +7 -5
  53. package/dist/widgets/checkbox.svelte.d.ts +1 -0
  54. package/dist/widgets/exports.d.ts +0 -2
  55. package/dist/widgets/exports.js +0 -2
  56. package/dist/widgets/number.svelte +2 -2
  57. package/dist/widgets/number.svelte.d.ts +1 -0
  58. package/dist/widgets/select.svelte +2 -3
  59. package/dist/widgets/select.svelte.d.ts +1 -0
  60. package/dist/widgets/text.svelte +3 -2
  61. package/dist/widgets/text.svelte.d.ts +1 -0
  62. package/package.json +26 -20
package/README.md CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  The [skeleton](https://github.com/skeletonlabs/skeleton) v3 (tailwind v3) based theme for [svelte-jsonschema-form](https://github.com/x0k/svelte-jsonschema-form).
4
4
 
5
- - [Documentation](https://x0k.github.io/svelte-jsonschema-form/themes/skeleton/)
6
- - [Playground](https://x0k.github.io/svelte-jsonschema-form/playground/)
5
+ - [Documentation](https://x0k.github.io/svelte-jsonschema-form/v2/themes/skeleton/)
6
+ - [Playground](https://x0k.github.io/svelte-jsonschema-form/playground2/)
7
7
 
8
8
  ## Installation
9
9
 
10
10
  ```shell
11
- npm install @sjsf/form @sjsf/skeleton-theme
11
+ npm install @sjsf/form@next @sjsf/skeleton-theme@next
12
12
  ```
13
13
 
14
14
  ## Usage
@@ -1,19 +1,34 @@
1
1
  <script lang="ts">
2
- import { defineDisabled, getFormContext, type ComponentProps } from '@sjsf/form';
2
+ import type { HTMLButtonAttributes } from 'svelte/elements';
3
+ import {
4
+ composeProps,
5
+ disabledProp,
6
+ getFormContext,
7
+ uiOptionNestedProps,
8
+ uiOptionProps,
9
+ type ComponentProps
10
+ } from '@sjsf/form';
11
+ import '@sjsf/basic-theme/components/button.svelte';
3
12
 
4
13
  const { children, onclick, config, disabled, type }: ComponentProps['button'] = $props();
5
14
 
6
15
  const ctx = getFormContext();
7
-
8
- const attributes = $derived(
9
- defineDisabled(ctx, {
10
- disabled,
11
- ...config.uiOptions?.button,
12
- ...config.uiOptions?.buttons?.[type]
13
- })
14
- );
15
16
  </script>
16
17
 
17
- <button class="btn preset-filled" type="button" {onclick} {...attributes}>
18
+ <button
19
+ class="btn preset-filled"
20
+ {...composeProps(
21
+ ctx,
22
+ config,
23
+ {
24
+ type: 'button',
25
+ disabled,
26
+ onclick
27
+ } satisfies HTMLButtonAttributes,
28
+ uiOptionProps('button'),
29
+ uiOptionNestedProps('buttons', (b) => b[type]),
30
+ disabledProp
31
+ )}
32
+ >
18
33
  {@render children()}
19
34
  </button>
@@ -1,3 +1,4 @@
1
+ import '@sjsf/basic-theme/components/button.svelte';
1
2
  declare const Button: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
2
3
  type: import("@sjsf/form/fields/components").ButtonType;
3
4
  disabled: boolean;
@@ -1,7 +1,12 @@
1
1
  <script lang="ts">
2
- import type { ComponentProps } from '@sjsf/form';
2
+ import { descriptionAttributes, getFormContext, type ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/components/description.svelte';
3
4
 
4
5
  const { description, config }: ComponentProps['description'] = $props();
6
+
7
+ const ctx = getFormContext();
5
8
  </script>
6
9
 
7
- <div class="opacity-60" {...config.uiOptions?.descriptionAttributes}>{description}</div>
10
+ <div class="opacity-60" {...descriptionAttributes(ctx, config, 'descriptionAttributes', {})}>
11
+ {description}
12
+ </div>
@@ -1,3 +1,4 @@
1
+ import '@sjsf/basic-theme/components/description.svelte';
1
2
  declare const Description: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
2
3
  type: import("@sjsf/form/templates/components").ParentTemplateType;
3
4
  description: string;
@@ -1,11 +1,17 @@
1
1
  <script lang="ts">
2
- import type { ComponentProps } from '@sjsf/form';
2
+ import { errorsListAttributes, getFormContext, type ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/components/errors-list.svelte';
3
4
 
4
- const { errors, forId, config }: ComponentProps['errorsList'] = $props();
5
+ const { errors, config }: ComponentProps['errorsList'] = $props();
6
+
7
+ const ctx = getFormContext();
5
8
  </script>
6
9
 
7
- <ui class="text-error-500" data-errors-for={forId} {...config.uiOptions?.errorsList}>
10
+ <ul
11
+ class="text-error-500 list-disc list-inside"
12
+ {...errorsListAttributes(ctx, config, 'errorsList', {})}
13
+ >
8
14
  {#each errors as err}
9
15
  <li>{err.message}</li>
10
16
  {/each}
11
- </ui>
17
+ </ul>
@@ -1,5 +1,4 @@
1
- declare const ErrorsList: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
2
- forId: string;
3
- }, {}, "">;
1
+ import '@sjsf/basic-theme/components/errors-list.svelte';
2
+ declare const ErrorsList: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps, {}, "">;
4
3
  type ErrorsList = ReturnType<typeof ErrorsList>;
5
4
  export default ErrorsList;
@@ -3,6 +3,7 @@ export { default as submitButton } from './submit-button.svelte';
3
3
  export { default as button } from './button.svelte';
4
4
  export { default as layout } from './layout.svelte';
5
5
  export { default as title } from './title.svelte';
6
+ export { default as label } from "./label.svelte";
6
7
  export { default as description } from './description.svelte';
7
8
  export { default as help } from './help.svelte';
8
9
  export { default as errorsList } from './errors-list.svelte';
@@ -3,6 +3,7 @@ export { default as submitButton } from './submit-button.svelte';
3
3
  export { default as button } from './button.svelte';
4
4
  export { default as layout } from './layout.svelte';
5
5
  export { default as title } from './title.svelte';
6
+ export { default as label } from "./label.svelte";
6
7
  export { default as description } from './description.svelte';
7
8
  export { default as help } from './help.svelte';
8
9
  export { default as errorsList } from './errors-list.svelte';
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
- import { enhance, getFormContext, type ComponentProps } from '@sjsf/form';
2
+ import { enhance, formAttributes, getFormContext, type ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/components/form.svelte';
3
4
 
4
5
  let { config, children, ref = $bindable(), attributes }: ComponentProps['form'] = $props();
5
6
 
@@ -10,8 +11,7 @@
10
11
  bind:this={ref}
11
12
  use:enhance={ctx}
12
13
  class="flex flex-col gap-4"
13
- {...config.uiOptions?.form}
14
- {...attributes}
14
+ {...formAttributes(ctx, config, 'form', attributes, {})}
15
15
  >
16
16
  {@render children?.()}
17
17
  </form>
@@ -1,3 +1,4 @@
1
+ import '@sjsf/basic-theme/components/form.svelte';
1
2
  declare const Form: import("svelte").Component<{
2
3
  config: import("@sjsf/form").Config;
3
4
  ref?: HTMLFormElement | undefined;
@@ -1,7 +1,12 @@
1
1
  <script lang="ts">
2
- import type { ComponentProps } from '@sjsf/form';
2
+ import { getFormContext, helpAttributes, type ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/components/help.svelte';
3
4
 
4
5
  const { help, config }: ComponentProps['help'] = $props();
6
+
7
+ const ctx = getFormContext();
5
8
  </script>
6
9
 
7
- <div class="opacity-60" {...config.uiOptions?.helpAttributes}>{help}</div>
10
+ <div class="opacity-60" {...helpAttributes(ctx, config, 'helpAttributes', {})}>
11
+ {help}
12
+ </div>
@@ -1,3 +1,4 @@
1
+ import '@sjsf/basic-theme/components/help.svelte';
1
2
  declare const Help: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
2
3
  help: string;
3
4
  }, {}, "">;
@@ -0,0 +1,15 @@
1
+ <script lang="ts">
2
+ import { getFormContext, labelAttributes, type ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/components/label.svelte';
4
+
5
+ const { title, config }: ComponentProps['label'] = $props();
6
+
7
+ const ctx = getFormContext();
8
+ </script>
9
+
10
+ <label class="label-text" {...labelAttributes(ctx, config, 'labelAttributes', { })}>
11
+ {title}
12
+ {#if config.required}
13
+ <span>*</span>
14
+ {/if}
15
+ </label>
@@ -0,0 +1,6 @@
1
+ import '@sjsf/basic-theme/components/label.svelte';
2
+ declare const Label: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
3
+ title: string;
4
+ }, {}, "">;
5
+ type Label = ReturnType<typeof Label>;
6
+ export default Label;
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
- import type { ComponentProps } from '@sjsf/form';
2
+ import { getFormContext, layoutAttributes, type ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/components/layout.svelte';
3
4
 
4
5
  const { type, children, config }: ComponentProps['layout'] = $props();
5
6
 
@@ -22,10 +23,7 @@
22
23
  type === 'object-properties'
23
24
  );
24
25
 
25
- const attributes = $derived({
26
- ...config.uiOptions?.layout,
27
- ...config.uiOptions?.layouts?.[type]
28
- });
26
+ const ctx = getFormContext();
29
27
  </script>
30
28
 
31
29
  <div
@@ -35,8 +33,7 @@
35
33
  class:items-start={isItemOrControls}
36
34
  class:grow={isGrowable}
37
35
  class:flex-col={isColumn || isField}
38
- data-layout={type}
39
- {...attributes}
36
+ {...layoutAttributes(ctx, config, 'layout', 'layouts', type, {})}
40
37
  >
41
38
  {@render children()}
42
39
  </div>
@@ -1,3 +1,4 @@
1
+ import '@sjsf/basic-theme/components/layout.svelte';
1
2
  declare const Layout: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
2
3
  type: import("@sjsf/form/fields/components").LayoutType;
3
4
  children: import("svelte").Snippet;
@@ -1,13 +1,14 @@
1
1
  <script lang="ts">
2
- import { defineDisabled, getFormContext, type ComponentProps } from '@sjsf/form';
2
+ import { buttonAttributes, getFormContext, type ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/components/submit-button.svelte';
3
4
 
4
5
  const { children, config }: ComponentProps['submitButton'] = $props();
5
6
 
6
7
  const ctx = getFormContext();
7
8
 
8
- const attributes = $derived(defineDisabled(ctx, config.uiOptions?.submitButton ?? {}));
9
+ const attributes = $derived(buttonAttributes(ctx, config, 'submitButton', 'submit', {}));
9
10
  </script>
10
11
 
11
- <button class="btn preset-filled preset-filled-primary-500 w-full" type="submit" {...attributes}>
12
+ <button class="btn preset-filled preset-filled-primary-500 w-full" {...attributes}>
12
13
  {@render children()}
13
14
  </button>
@@ -1,3 +1,4 @@
1
+ import '@sjsf/basic-theme/components/submit-button.svelte';
1
2
  declare const SubmitButton: import("svelte").Component<{
2
3
  config: import("@sjsf/form").Config;
3
4
  children: import("svelte").Snippet;
@@ -1,16 +1,15 @@
1
1
  <script lang="ts">
2
- import type { ComponentProps } from '@sjsf/form';
2
+ import { getFormContext, titleAttributes, type ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/components/title.svelte';
3
4
 
4
- const { title, type, forId, required, config }: ComponentProps['title'] = $props();
5
+ const { title, type, config }: ComponentProps['title'] = $props();
6
+
7
+ const ctx = getFormContext();
5
8
  </script>
6
9
 
7
- {#if type === 'field'}
8
- <label class="label-text" for={forId} {...config.uiOptions?.labelAttributes}>
9
- {title}
10
- {#if required}
11
- <span>*</span>
12
- {/if}
13
- </label>
14
- {:else}
15
- <div class="font-bold text-2xl" {...config.uiOptions?.titleAttributes}>{title}</div>
16
- {/if}
10
+ <div
11
+ class={type === 'field' ? 'label-text' : 'font-bold text-xl'}
12
+ {...titleAttributes(ctx, config, 'titleAttributes', {})}
13
+ >
14
+ {title}
15
+ </div>
@@ -1,8 +1,7 @@
1
+ import '@sjsf/basic-theme/components/title.svelte';
1
2
  declare const Title: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
2
3
  type: import("@sjsf/form/templates/components").ParentTemplateType;
3
4
  title: string;
4
- forId: string;
5
- required: boolean;
6
5
  }, {}, "">;
7
6
  type Title = ReturnType<typeof Title>;
8
7
  export default Title;
@@ -1,72 +1,7 @@
1
- import type { ExtendableComponentDefinitionsWithoutFields } from '@sjsf/form/fields/resolver';
1
+ import type { ComponentDefinitions } from '@sjsf/form';
2
2
  import * as templates from '@sjsf/form/templates/exports';
3
- export declare const definitions: {
4
- textWidget: import("svelte").Component<import("@sjsf/form/fields/widgets").WidgetCommonProps<string>, {}, "value">;
5
- numberWidget: import("svelte").Component<import("@sjsf/form/fields/widgets").WidgetCommonProps<number>, {}, "value">;
6
- selectWidget: import("svelte").Component<import("@sjsf/form/fields/widgets").WidgetCommonProps<import("@sjsf/form").SchemaValue> & import("@sjsf/form/fields/widgets").Options, {}, "value">;
7
- checkboxWidget: import("svelte").Component<import("@sjsf/form/fields/widgets").WidgetCommonProps<boolean>, {}, "value">;
8
- checkboxesWidget: import("svelte").Component<import("@sjsf/form/fields/widgets").WidgetCommonProps<import("@sjsf/form/core").SchemaArrayValue> & import("@sjsf/form/fields/widgets").Options, {}, "value">;
9
- fileWidget: import("svelte").Component<import("@sjsf/form/fields/widgets").WidgetCommonProps<FileList> & {
10
- multiple: boolean;
11
- loading: boolean;
12
- processing: boolean;
13
- }, {}, "value">;
14
- form: import("svelte").Component<{
15
- config: import("@sjsf/form").Config;
16
- ref?: HTMLFormElement | undefined;
17
- children: import("svelte").Snippet;
18
- attributes?: import("svelte/elements").HTMLFormAttributes | undefined;
19
- }, {}, "ref">;
20
- submitButton: import("svelte").Component<{
21
- config: import("@sjsf/form").Config;
22
- children: import("svelte").Snippet;
23
- }, {}, "">;
24
- button: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
25
- type: import("@sjsf/form/fields/components").ButtonType;
26
- disabled: boolean;
27
- children: import("svelte").Snippet;
28
- onclick: () => void;
29
- }, {}, "">;
30
- layout: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
31
- type: import("@sjsf/form/fields/components").LayoutType;
32
- children: import("svelte").Snippet;
33
- }, {}, "">;
34
- title: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
35
- type: templates.ParentTemplateType;
36
- title: string;
37
- forId: string;
38
- required: boolean;
39
- }, {}, "">;
40
- description: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
41
- type: templates.ParentTemplateType;
42
- description: string;
43
- }, {}, "">;
44
- help: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
45
- help: string;
46
- }, {}, "">;
47
- errorsList: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
48
- forId: string;
49
- }, {}, "">;
50
- fieldTemplate: import("svelte").Component<import("@sjsf/form/fields/templates").TemplateCommonProps<import("@sjsf/form").SchemaValue> & {
51
- showTitle: boolean;
52
- }, {}, "">;
53
- objectTemplate: import("svelte").Component<import("@sjsf/form/fields/templates").TemplateCommonProps<import("@sjsf/form/core").SchemaObjectValue> & {
54
- addButton?: import("svelte").Snippet;
55
- }, {}, "">;
56
- objectPropertyTemplate: import("svelte").Component<import("@sjsf/form/fields/templates").TemplateCommonProps<import("@sjsf/form").SchemaValue> & {
57
- property: string;
58
- keyInput?: import("svelte").Snippet;
59
- removeButton?: import("svelte").Snippet;
60
- }, {}, "">;
61
- arrayTemplate: import("svelte").Component<import("@sjsf/form/fields/templates").TemplateCommonProps<import("@sjsf/form/core").SchemaArrayValue> & {
62
- addButton?: import("svelte").Snippet;
63
- }, {}, "">;
64
- arrayItemTemplate: import("svelte").Component<import("@sjsf/form/fields/templates").TemplateCommonProps<import("@sjsf/form").SchemaValue> & {
65
- index: number;
66
- buttons?: import("svelte").Snippet;
67
- }, {}, "">;
68
- multiFieldTemplate: import("svelte").Component<import("@sjsf/form/fields/templates").TemplateCommonProps<import("@sjsf/form").SchemaValue> & {
69
- optionSelector: import("svelte").Snippet;
70
- }, {}, "">;
71
- };
72
- export declare const extendable: ExtendableComponentDefinitionsWithoutFields;
3
+ import * as components from './components/exports';
4
+ import * as widgets from './widgets/exports';
5
+ export interface ExtraWidgets {
6
+ }
7
+ export declare const definitions: typeof templates & typeof components & typeof widgets & Pick<ComponentDefinitions, keyof ExtraWidgets>;
@@ -6,4 +6,3 @@ export const definitions = {
6
6
  ...components,
7
7
  ...widgets
8
8
  };
9
- export const extendable = definitions;
@@ -0,0 +1,6 @@
1
+ import './checkboxes.svelte';
2
+ declare module '../definitions.js' {
3
+ interface ExtraWidgets {
4
+ checkboxesWidget: {};
5
+ }
6
+ }
@@ -0,0 +1,4 @@
1
+ import { definitions } from '../definitions.js';
2
+ import Checkboxes from './checkboxes.svelte';
3
+ import './checkboxes.svelte';
4
+ definitions.checkboxesWidget = Checkboxes;
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { getFormContext, inputAttributes, type ComponentProps } from '@sjsf/form';
3
3
  import { multipleOptions, indexMapper } from '@sjsf/form/options.svelte';
4
+ import '@sjsf/basic-theme/extra-widgets/checkboxes.svelte';
4
5
 
5
6
  let {
6
7
  handlers,
@@ -18,14 +19,13 @@
18
19
  const ctx = getFormContext();
19
20
 
20
21
  const attributes = $derived(
21
- inputAttributes(ctx, config, handlers, config.uiOptions?.checkboxes)
22
+ inputAttributes(ctx, config, 'checkboxes', handlers, { type: 'checkbox' })
22
23
  );
23
24
  </script>
24
25
 
25
26
  {#each options as option, index (option.id)}
26
27
  <label class="flex items-center space-x-2 cursor-pointer">
27
28
  <input
28
- type="checkbox"
29
29
  class="checkbox"
30
30
  bind:group={mapped.value}
31
31
  value={index}
@@ -1,3 +1,4 @@
1
+ import '@sjsf/basic-theme/extra-widgets/checkboxes.svelte';
1
2
  declare const Checkboxes: import("svelte").Component<import("@sjsf/form/fields/widgets").WidgetCommonProps<import("@sjsf/form/core").SchemaArrayValue> & import("@sjsf/form/fields/widgets").Options, {}, "value">;
2
3
  type Checkboxes = ReturnType<typeof Checkboxes>;
3
4
  export default Checkboxes;
@@ -1 +1,6 @@
1
1
  import './date-picker.svelte';
2
+ declare module '../definitions.js' {
3
+ interface ExtraWidgets {
4
+ datePickerWidget: {};
5
+ }
6
+ }
@@ -1,4 +1,4 @@
1
- import { extendable } from '../definitions';
1
+ import { definitions } from '../definitions';
2
2
  import DatePicker from './date-picker.svelte';
3
3
  import './date-picker.svelte';
4
- extendable.datePickerWidget = DatePicker;
4
+ definitions.datePickerWidget = DatePicker;
@@ -5,8 +5,10 @@
5
5
  let { value = $bindable(), config, handlers }: ComponentProps['datePickerWidget'] = $props();
6
6
 
7
7
  const ctx = getFormContext();
8
-
9
- const attributes = $derived(inputAttributes(ctx, config, handlers, config.uiOptions?.datePicker));
10
8
  </script>
11
9
 
12
- <input type="date" bind:value class="input" {...attributes} />
10
+ <input
11
+ bind:value
12
+ class="input"
13
+ {...inputAttributes(ctx, config, 'datePicker', handlers, { type: 'date' })}
14
+ />
@@ -0,0 +1,6 @@
1
+ import './file.svelte';
2
+ declare module '../definitions.js' {
3
+ interface ExtraWidgets {
4
+ fileWidget: {};
5
+ }
6
+ }
@@ -0,0 +1,4 @@
1
+ import { definitions } from '../definitions.js';
2
+ import File from './file.svelte';
3
+ import './file.svelte';
4
+ definitions.fileWidget = File;
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { getFormContext, inputAttributes, type ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/extra-widgets/file.svelte';
3
4
 
4
5
  let {
5
6
  config,
@@ -11,18 +12,15 @@
11
12
  }: ComponentProps['fileWidget'] = $props();
12
13
 
13
14
  const ctx = getFormContext();
14
-
15
- const attributes = $derived(
16
- inputAttributes(ctx, config, handlers, config.uiOptions?.file)
17
- );
18
15
  </script>
19
16
 
20
17
  <input
21
18
  type="file"
22
19
  bind:files={value}
23
- {multiple}
24
20
  class="input"
25
- data-loading={loading}
26
- data-processing={processing}
27
- {...attributes}
21
+ {...inputAttributes(ctx, config, 'file', handlers, {
22
+ multiple,
23
+ 'data-loading': loading,
24
+ 'data-processing': processing
25
+ })}
28
26
  />
@@ -1,3 +1,4 @@
1
+ import '@sjsf/basic-theme/extra-widgets/file.svelte';
1
2
  declare const File: import("svelte").Component<import("@sjsf/form/fields/widgets").WidgetCommonProps<FileList> & {
2
3
  multiple: boolean;
3
4
  loading: boolean;
@@ -1 +1,6 @@
1
1
  import './multi-select.svelte';
2
+ declare module '../definitions.js' {
3
+ interface ExtraWidgets {
4
+ multiSelectWidget: {};
5
+ }
6
+ }
@@ -1,4 +1,4 @@
1
- import { extendable } from '../definitions.js';
1
+ import { definitions } from '../definitions.js';
2
2
  import MultiSelect from './multi-select.svelte';
3
3
  import './multi-select.svelte';
4
- extendable.multiSelectWidget = MultiSelect;
4
+ definitions.multiSelectWidget = MultiSelect;
@@ -12,10 +12,6 @@
12
12
 
13
13
  const ctx = getFormContext();
14
14
 
15
- const attributes = $derived(
16
- selectAttributes(ctx, config, handlers, config.uiOptions?.multiSelect)
17
- );
18
-
19
15
  const mapped = $derived(
20
16
  multipleOptions({
21
17
  mapper: () => indexMapper(options),
@@ -25,7 +21,12 @@
25
21
  );
26
22
  </script>
27
23
 
28
- <select multiple bind:value={mapped.value} class="select" {...attributes}>
24
+ <select
25
+ multiple
26
+ bind:value={mapped.value}
27
+ class="select"
28
+ {...selectAttributes(ctx, config, 'select', handlers, {})}
29
+ >
29
30
  {#each options as option, index (option.id)}
30
31
  <option value={index} disabled={option.disabled}>
31
32
  {option.label}
@@ -1 +1,6 @@
1
- import "./radio.svelte";
1
+ import './radio.svelte';
2
+ declare module '../definitions.js' {
3
+ interface ExtraWidgets {
4
+ radioWidget: {};
5
+ }
6
+ }
@@ -1,4 +1,4 @@
1
- import { extendable } from "../definitions.js";
2
- import Radio from "./radio.svelte";
3
- import "./radio.svelte";
4
- extendable.radioWidget = Radio;
1
+ import { definitions } from '../definitions.js';
2
+ import Radio from './radio.svelte';
3
+ import './radio.svelte';
4
+ definitions.radioWidget = Radio;
@@ -13,7 +13,7 @@
13
13
 
14
14
  const ctx = getFormContext();
15
15
 
16
- const attributes = $derived(inputAttributes(ctx, config, handlers, config.uiOptions?.radio));
16
+ const attributes = $derived(inputAttributes(ctx, config, 'radio', handlers, {}));
17
17
  </script>
18
18
 
19
19
  {#each options as option, index (option.id)}
@@ -1 +1,6 @@
1
1
  import './range.svelte';
2
+ declare module '../definitions.js' {
3
+ interface ExtraWidgets {
4
+ rangeWidget: {};
5
+ }
6
+ }
@@ -1,4 +1,4 @@
1
- import { extendable } from '../definitions';
1
+ import { definitions } from '../definitions';
2
2
  import Range from './range.svelte';
3
3
  import './range.svelte';
4
- extendable.rangeWidget = Range;
4
+ definitions.rangeWidget = Range;
@@ -5,8 +5,10 @@
5
5
  let { value = $bindable(), config, handlers }: ComponentProps['rangeWidget'] = $props();
6
6
 
7
7
  const ctx = getFormContext();
8
-
9
- const attributes = $derived(inputAttributes(ctx, config, handlers, config.uiOptions?.range));
10
8
  </script>
11
9
 
12
- <input type="range" bind:value class="range grow w-0" {...attributes} />
10
+ <input
11
+ bind:value={() => value ?? 0, (v) => (value = v)}
12
+ class="range grow w-0"
13
+ {...inputAttributes(ctx, config, 'range', handlers, { type: 'range' })}
14
+ />