@sjsf/skeleton-theme 1.9.2 → 2.0.0-next.1

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 (94) hide show
  1. package/README.md +5 -4
  2. package/dist/components/button.svelte +20 -0
  3. package/dist/components/button.svelte.d.ts +9 -0
  4. package/dist/components/description.svelte +8 -0
  5. package/dist/components/description.svelte.d.ts +7 -0
  6. package/dist/components/errors-list.svelte +7 -6
  7. package/dist/components/errors-list.svelte.d.ts +5 -2
  8. package/dist/components/exports.d.ts +8 -0
  9. package/dist/components/exports.js +8 -0
  10. package/dist/components/form.svelte +18 -0
  11. package/dist/components/form.svelte.d.ts +9 -0
  12. package/dist/components/help.svelte +8 -0
  13. package/dist/components/help.svelte.d.ts +6 -0
  14. package/dist/components/{layout-component.svelte → layout.svelte} +16 -11
  15. package/dist/components/layout.svelte.d.ts +7 -0
  16. package/dist/components/submit-button.svelte +14 -0
  17. package/dist/components/submit-button.svelte.d.ts +7 -0
  18. package/dist/components/title.svelte +17 -0
  19. package/dist/components/title.svelte.d.ts +9 -0
  20. package/dist/definitions.d.ts +7 -0
  21. package/dist/definitions.js +8 -0
  22. package/dist/extra-widgets/checkboxes-include.d.ts +6 -0
  23. package/dist/extra-widgets/checkboxes-include.js +4 -0
  24. package/dist/extra-widgets/checkboxes.svelte +37 -0
  25. package/dist/extra-widgets/checkboxes.svelte.d.ts +4 -0
  26. package/dist/extra-widgets/date-picker-include.d.ts +6 -0
  27. package/dist/extra-widgets/date-picker-include.js +4 -0
  28. package/dist/extra-widgets/date-picker.svelte +12 -0
  29. package/dist/extra-widgets/date-picker.svelte.d.ts +4 -0
  30. package/dist/extra-widgets/file-include.d.ts +6 -0
  31. package/dist/extra-widgets/file-include.js +4 -0
  32. package/dist/extra-widgets/file.svelte +27 -0
  33. package/dist/extra-widgets/file.svelte.d.ts +8 -0
  34. package/dist/extra-widgets/multi-select-include.d.ts +6 -0
  35. package/dist/extra-widgets/multi-select-include.js +4 -0
  36. package/dist/extra-widgets/multi-select.svelte +34 -0
  37. package/dist/extra-widgets/multi-select.svelte.d.ts +4 -0
  38. package/dist/extra-widgets/radio-include.d.ts +6 -0
  39. package/dist/extra-widgets/radio-include.js +4 -0
  40. package/dist/{widgets/radio-widget.svelte → extra-widgets/radio.svelte} +9 -3
  41. package/dist/extra-widgets/radio.svelte.d.ts +4 -0
  42. package/dist/extra-widgets/range-include.d.ts +6 -0
  43. package/dist/extra-widgets/range-include.js +4 -0
  44. package/dist/extra-widgets/range.svelte +12 -0
  45. package/dist/extra-widgets/range.svelte.d.ts +4 -0
  46. package/dist/extra-widgets/textarea-include.d.ts +6 -0
  47. package/dist/extra-widgets/textarea-include.js +4 -0
  48. package/dist/extra-widgets/textarea.svelte +14 -0
  49. package/dist/extra-widgets/textarea.svelte.d.ts +4 -0
  50. package/dist/index.d.ts +1 -4
  51. package/dist/index.js +4 -6
  52. package/dist/preset.d.ts +5 -1
  53. package/dist/styles.css +1 -1
  54. package/dist/widgets/checkbox.svelte +15 -0
  55. package/dist/widgets/checkbox.svelte.d.ts +4 -0
  56. package/dist/widgets/exports.d.ts +4 -0
  57. package/dist/widgets/exports.js +4 -0
  58. package/dist/widgets/number.svelte +18 -0
  59. package/dist/widgets/number.svelte.d.ts +4 -0
  60. package/dist/widgets/select.svelte +30 -0
  61. package/dist/widgets/select.svelte.d.ts +4 -0
  62. package/dist/widgets/text.svelte +13 -0
  63. package/dist/widgets/text.svelte.d.ts +4 -0
  64. package/package.json +38 -24
  65. package/dist/components/button-component.svelte +0 -19
  66. package/dist/components/button-component.svelte.d.ts +0 -3
  67. package/dist/components/description-component.svelte +0 -7
  68. package/dist/components/description-component.svelte.d.ts +0 -3
  69. package/dist/components/form-component.svelte +0 -9
  70. package/dist/components/form-component.svelte.d.ts +0 -3
  71. package/dist/components/help-component.svelte +0 -7
  72. package/dist/components/help-component.svelte.d.ts +0 -3
  73. package/dist/components/index.d.ts +0 -5
  74. package/dist/components/index.js +0 -17
  75. package/dist/components/layout-component.svelte.d.ts +0 -3
  76. package/dist/components/title-component.svelte +0 -16
  77. package/dist/components/title-component.svelte.d.ts +0 -3
  78. package/dist/widgets/checkbox-widget.svelte +0 -15
  79. package/dist/widgets/checkbox-widget.svelte.d.ts +0 -2
  80. package/dist/widgets/checkboxes-widget.svelte +0 -26
  81. package/dist/widgets/checkboxes-widget.svelte.d.ts +0 -2
  82. package/dist/widgets/file-widget.svelte +0 -21
  83. package/dist/widgets/file-widget.svelte.d.ts +0 -2
  84. package/dist/widgets/index.d.ts +0 -5
  85. package/dist/widgets/index.js +0 -20
  86. package/dist/widgets/number-widget.svelte +0 -14
  87. package/dist/widgets/number-widget.svelte.d.ts +0 -2
  88. package/dist/widgets/radio-widget.svelte.d.ts +0 -2
  89. package/dist/widgets/select-widget.svelte +0 -40
  90. package/dist/widgets/select-widget.svelte.d.ts +0 -2
  91. package/dist/widgets/text-widget.svelte +0 -12
  92. package/dist/widgets/text-widget.svelte.d.ts +0 -2
  93. package/dist/widgets/textarea-widget.svelte +0 -7
  94. package/dist/widgets/textarea-widget.svelte.d.ts +0 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @sjsf/skeleton-theme
2
2
 
3
- The [skeleton](https://github.com/skeletonlabs/skeleton) based theme for [svelte-jsonschema-form](https://github.com/x0k/svelte-jsonschema-form).
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
5
  - [Documentation](https://x0k.github.io/svelte-jsonschema-form/themes/skeleton/)
6
6
  - [Playground](https://x0k.github.io/svelte-jsonschema-form/playground/)
@@ -66,11 +66,12 @@ Bundled themes:
66
66
 
67
67
  ```svelte
68
68
  <script lang="ts">
69
- import { createForm3 } from '@sjsf/form';
69
+ import { createForm } from '@sjsf/form';
70
70
  import { theme } from '@sjsf/skeleton-theme';
71
71
 
72
- const form = createForm3({
73
- ...theme,
72
+ const form = createForm({
73
+ theme,
74
+ ...
74
75
  })
75
76
  </script>
76
77
  ```
@@ -0,0 +1,20 @@
1
+ <script lang="ts">
2
+ import { defineDisabled, getFormContext, type ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/components/button.svelte';
4
+
5
+ const { children, onclick, config, disabled, type }: ComponentProps['button'] = $props();
6
+
7
+ const ctx = getFormContext();
8
+
9
+ const attributes = $derived(
10
+ defineDisabled(ctx, {
11
+ disabled,
12
+ ...config.uiOptions?.button,
13
+ ...config.uiOptions?.buttons?.[type]
14
+ })
15
+ );
16
+ </script>
17
+
18
+ <button class="btn preset-filled" type="button" {onclick} {...attributes}>
19
+ {@render children()}
20
+ </button>
@@ -0,0 +1,9 @@
1
+ import '@sjsf/basic-theme/components/button.svelte';
2
+ declare const Button: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
3
+ type: import("@sjsf/form/fields/components").ButtonType;
4
+ disabled: boolean;
5
+ children: import("svelte").Snippet;
6
+ onclick: () => void;
7
+ }, {}, "">;
8
+ type Button = ReturnType<typeof Button>;
9
+ export default Button;
@@ -0,0 +1,8 @@
1
+ <script lang="ts">
2
+ import type { ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/components/description.svelte';
4
+
5
+ const { description, config }: ComponentProps['description'] = $props();
6
+ </script>
7
+
8
+ <div class="opacity-60" {...config.uiOptions?.descriptionAttributes}>{description}</div>
@@ -0,0 +1,7 @@
1
+ import '@sjsf/basic-theme/components/description.svelte';
2
+ declare const Description: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
3
+ type: import("@sjsf/form/templates/components").ParentTemplateType;
4
+ description: string;
5
+ }, {}, "">;
6
+ type Description = ReturnType<typeof Description>;
7
+ export default Description;
@@ -1,11 +1,12 @@
1
1
  <script lang="ts">
2
- import type { ComponentProps } from "@sjsf/form";
2
+ import type { ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/components/errors-list.svelte';
3
4
 
4
- const { errors, forId }: ComponentProps<"errorsList"> = $props();
5
+ const { errors, forId, config }: ComponentProps['errorsList'] = $props();
5
6
  </script>
6
7
 
7
- <ui class="text-error-500" data-errors-for={forId}>
8
- {#each errors as err}
9
- <li>{err.message}</li>
10
- {/each}
8
+ <ui class="text-error-500" data-errors-for={forId} {...config.uiOptions?.errorsList}>
9
+ {#each errors as err}
10
+ <li>{err.message}</li>
11
+ {/each}
11
12
  </ui>
@@ -1,3 +1,6 @@
1
- import type { ComponentProps } from "@sjsf/form";
2
- declare const ErrorsList: import("svelte").Component<ComponentProps<"errorsList">, {}, "">;
1
+ import '@sjsf/basic-theme/components/errors-list.svelte';
2
+ declare const ErrorsList: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
3
+ forId: string;
4
+ }, {}, "">;
5
+ type ErrorsList = ReturnType<typeof ErrorsList>;
3
6
  export default ErrorsList;
@@ -0,0 +1,8 @@
1
+ export { default as form } from './form.svelte';
2
+ export { default as submitButton } from './submit-button.svelte';
3
+ export { default as button } from './button.svelte';
4
+ export { default as layout } from './layout.svelte';
5
+ export { default as title } from './title.svelte';
6
+ export { default as description } from './description.svelte';
7
+ export { default as help } from './help.svelte';
8
+ export { default as errorsList } from './errors-list.svelte';
@@ -0,0 +1,8 @@
1
+ export { default as form } from './form.svelte';
2
+ export { default as submitButton } from './submit-button.svelte';
3
+ export { default as button } from './button.svelte';
4
+ export { default as layout } from './layout.svelte';
5
+ export { default as title } from './title.svelte';
6
+ export { default as description } from './description.svelte';
7
+ export { default as help } from './help.svelte';
8
+ export { default as errorsList } from './errors-list.svelte';
@@ -0,0 +1,18 @@
1
+ <script lang="ts">
2
+ import { enhance, getFormContext, type ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/components/form.svelte';
4
+
5
+ let { config, children, ref = $bindable(), attributes }: ComponentProps['form'] = $props();
6
+
7
+ const ctx = getFormContext();
8
+ </script>
9
+
10
+ <form
11
+ bind:this={ref}
12
+ use:enhance={ctx}
13
+ class="flex flex-col gap-4"
14
+ {...config.uiOptions?.form}
15
+ {...attributes}
16
+ >
17
+ {@render children?.()}
18
+ </form>
@@ -0,0 +1,9 @@
1
+ import '@sjsf/basic-theme/components/form.svelte';
2
+ declare const Form: import("svelte").Component<{
3
+ config: import("@sjsf/form").Config;
4
+ ref?: HTMLFormElement | undefined;
5
+ children: import("svelte").Snippet;
6
+ attributes?: import("svelte/elements").HTMLFormAttributes | undefined;
7
+ }, {}, "ref">;
8
+ type Form = ReturnType<typeof Form>;
9
+ export default Form;
@@ -0,0 +1,8 @@
1
+ <script lang="ts">
2
+ import type { ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/components/help.svelte';
4
+
5
+ const { help, config }: ComponentProps['help'] = $props();
6
+ </script>
7
+
8
+ <div class="opacity-60" {...config.uiOptions?.helpAttributes}>{help}</div>
@@ -0,0 +1,6 @@
1
+ import '@sjsf/basic-theme/components/help.svelte';
2
+ declare const Help: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
3
+ help: string;
4
+ }, {}, "">;
5
+ type Help = ReturnType<typeof Help>;
6
+ export default Help;
@@ -1,12 +1,15 @@
1
1
  <script lang="ts">
2
2
  import type { ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/components/layout.svelte';
3
4
 
4
- const { type, children, attributes }: ComponentProps<'layout'> = $props();
5
+ const { type, children, config }: ComponentProps['layout'] = $props();
5
6
 
6
- const isItem = $derived(
7
- type === 'array-item' || type === 'object-property' || type === 'field-content'
7
+ const isItemOrControls = $derived(
8
+ type === 'array-item' ||
9
+ type === 'object-property' ||
10
+ type === 'field-content' ||
11
+ type === 'array-item-controls'
8
12
  );
9
- const isControls = $derived(type === 'array-item-controls');
10
13
  const isGrowable = $derived(
11
14
  type === 'array-item-content' ||
12
15
  type === 'object-property-key-input' ||
@@ -17,18 +20,20 @@
17
20
  type === 'array-field' ||
18
21
  type === 'object-field' ||
19
22
  type === 'array-items' ||
20
- type === 'object-properties' ||
21
- type === 'root-field'
23
+ type === 'object-properties'
22
24
  );
25
+
26
+ const attributes = $derived({
27
+ ...config.uiOptions?.layout,
28
+ ...config.uiOptions?.layouts?.[type]
29
+ });
23
30
  </script>
24
31
 
25
32
  <div
26
- class:flex={isItem || isControls || isField || isColumn}
27
- class:gap-2={isItem || isField}
33
+ class:flex={isItemOrControls || isField || isColumn}
34
+ class:gap-2={isItemOrControls || isField}
28
35
  class:gap-4={isColumn}
29
- class:items-start={isItem || isControls}
30
- class:btn-group={isControls}
31
- class:preset-outlined-surface-200-800={isControls}
36
+ class:items-start={isItemOrControls}
32
37
  class:grow={isGrowable}
33
38
  class:flex-col={isColumn || isField}
34
39
  data-layout={type}
@@ -0,0 +1,7 @@
1
+ import '@sjsf/basic-theme/components/layout.svelte';
2
+ declare const Layout: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
3
+ type: import("@sjsf/form/fields/components").LayoutType;
4
+ children: import("svelte").Snippet;
5
+ }, {}, "">;
6
+ type Layout = ReturnType<typeof Layout>;
7
+ export default Layout;
@@ -0,0 +1,14 @@
1
+ <script lang="ts">
2
+ import { defineDisabled, getFormContext, type ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/components/submit-button.svelte';
4
+
5
+ const { children, config }: ComponentProps['submitButton'] = $props();
6
+
7
+ const ctx = getFormContext();
8
+
9
+ const attributes = $derived(defineDisabled(ctx, config.uiOptions?.submitButton ?? {}));
10
+ </script>
11
+
12
+ <button class="btn preset-filled preset-filled-primary-500 w-full" type="submit" {...attributes}>
13
+ {@render children()}
14
+ </button>
@@ -0,0 +1,7 @@
1
+ import '@sjsf/basic-theme/components/submit-button.svelte';
2
+ declare const SubmitButton: import("svelte").Component<{
3
+ config: import("@sjsf/form").Config;
4
+ children: import("svelte").Snippet;
5
+ }, {}, "">;
6
+ type SubmitButton = ReturnType<typeof SubmitButton>;
7
+ export default SubmitButton;
@@ -0,0 +1,17 @@
1
+ <script lang="ts">
2
+ import type { ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/components/title.svelte';
4
+
5
+ const { title, type, forId, required, config }: ComponentProps['title'] = $props();
6
+ </script>
7
+
8
+ {#if type === 'field'}
9
+ <label class="label-text" for={forId} {...config.uiOptions?.labelAttributes}>
10
+ {title}
11
+ {#if required}
12
+ <span>*</span>
13
+ {/if}
14
+ </label>
15
+ {:else}
16
+ <div class="font-bold text-2xl" {...config.uiOptions?.titleAttributes}>{title}</div>
17
+ {/if}
@@ -0,0 +1,9 @@
1
+ import '@sjsf/basic-theme/components/title.svelte';
2
+ declare const Title: import("svelte").Component<import("@sjsf/form/fields/components").ComponentCommonProps & {
3
+ type: import("@sjsf/form/templates/components").ParentTemplateType;
4
+ title: string;
5
+ forId: string;
6
+ required: boolean;
7
+ }, {}, "">;
8
+ type Title = ReturnType<typeof Title>;
9
+ export default Title;
@@ -0,0 +1,7 @@
1
+ import type { ComponentDefinitions } from '@sjsf/form';
2
+ import * as templates from '@sjsf/form/templates/exports';
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>;
@@ -0,0 +1,8 @@
1
+ import * as templates from '@sjsf/form/templates/exports';
2
+ import * as components from './components/exports';
3
+ import * as widgets from './widgets/exports';
4
+ export const definitions = {
5
+ ...templates,
6
+ ...components,
7
+ ...widgets
8
+ };
@@ -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;
@@ -0,0 +1,37 @@
1
+ <script lang="ts">
2
+ import { getFormContext, inputAttributes, type ComponentProps } from '@sjsf/form';
3
+ import { multipleOptions, indexMapper } from '@sjsf/form/options.svelte';
4
+ import '@sjsf/basic-theme/extra-widgets/checkboxes.svelte';
5
+
6
+ let {
7
+ handlers,
8
+ value = $bindable(),
9
+ options,
10
+ config
11
+ }: ComponentProps['checkboxesWidget'] = $props();
12
+
13
+ const mapped = multipleOptions({
14
+ mapper: () => indexMapper(options),
15
+ value: () => value,
16
+ update: (v) => (value = v)
17
+ });
18
+
19
+ const ctx = getFormContext();
20
+
21
+ const attributes = $derived(inputAttributes(ctx, config, handlers, config.uiOptions?.checkboxes));
22
+ </script>
23
+
24
+ {#each options as option, index (option.id)}
25
+ <label class="flex items-center space-x-2 cursor-pointer">
26
+ <input
27
+ type="checkbox"
28
+ class="checkbox"
29
+ bind:group={mapped.value}
30
+ value={index}
31
+ {...attributes}
32
+ id={option.id}
33
+ disabled={option.disabled || attributes.disabled}
34
+ />
35
+ <p>{option.label}</p>
36
+ </label>
37
+ {/each}
@@ -0,0 +1,4 @@
1
+ import '@sjsf/basic-theme/extra-widgets/checkboxes.svelte';
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">;
3
+ type Checkboxes = ReturnType<typeof Checkboxes>;
4
+ export default Checkboxes;
@@ -0,0 +1,6 @@
1
+ import './date-picker.svelte';
2
+ declare module '../definitions.js' {
3
+ interface ExtraWidgets {
4
+ datePickerWidget: {};
5
+ }
6
+ }
@@ -0,0 +1,4 @@
1
+ import { definitions } from '../definitions';
2
+ import DatePicker from './date-picker.svelte';
3
+ import './date-picker.svelte';
4
+ definitions.datePickerWidget = DatePicker;
@@ -0,0 +1,12 @@
1
+ <script lang="ts">
2
+ import { getFormContext, inputAttributes, type ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/extra-widgets/date-picker.svelte';
4
+
5
+ let { value = $bindable(), config, handlers }: ComponentProps['datePickerWidget'] = $props();
6
+
7
+ const ctx = getFormContext();
8
+
9
+ const attributes = $derived(inputAttributes(ctx, config, handlers, config.uiOptions?.datePicker));
10
+ </script>
11
+
12
+ <input type="date" bind:value class="input" {...attributes} />
@@ -0,0 +1,4 @@
1
+ import '@sjsf/basic-theme/extra-widgets/date-picker.svelte';
2
+ declare const DatePicker: import("svelte").Component<import("@sjsf/form/fields/widgets").WidgetCommonProps<string>, {}, "value">;
3
+ type DatePicker = ReturnType<typeof DatePicker>;
4
+ export default DatePicker;
@@ -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;
@@ -0,0 +1,27 @@
1
+ <script lang="ts">
2
+ import { getFormContext, inputAttributes, type ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/extra-widgets/file.svelte';
4
+
5
+ let {
6
+ config,
7
+ handlers,
8
+ multiple,
9
+ loading,
10
+ processing,
11
+ value = $bindable()
12
+ }: ComponentProps['fileWidget'] = $props();
13
+
14
+ const ctx = getFormContext();
15
+
16
+ const attributes = $derived(inputAttributes(ctx, config, handlers, config.uiOptions?.file));
17
+ </script>
18
+
19
+ <input
20
+ type="file"
21
+ bind:files={value}
22
+ {multiple}
23
+ class="input"
24
+ data-loading={loading}
25
+ data-processing={processing}
26
+ {...attributes}
27
+ />
@@ -0,0 +1,8 @@
1
+ import '@sjsf/basic-theme/extra-widgets/file.svelte';
2
+ declare const File: import("svelte").Component<import("@sjsf/form/fields/widgets").WidgetCommonProps<FileList> & {
3
+ multiple: boolean;
4
+ loading: boolean;
5
+ processing: boolean;
6
+ }, {}, "value">;
7
+ type File = ReturnType<typeof File>;
8
+ export default File;
@@ -0,0 +1,6 @@
1
+ import './multi-select.svelte';
2
+ declare module '../definitions.js' {
3
+ interface ExtraWidgets {
4
+ multiSelectWidget: {};
5
+ }
6
+ }
@@ -0,0 +1,4 @@
1
+ import { definitions } from '../definitions.js';
2
+ import MultiSelect from './multi-select.svelte';
3
+ import './multi-select.svelte';
4
+ definitions.multiSelectWidget = MultiSelect;
@@ -0,0 +1,34 @@
1
+ <script lang="ts">
2
+ import { getFormContext, selectAttributes, type ComponentProps } from '@sjsf/form';
3
+ import { indexMapper, multipleOptions } from '@sjsf/form/options.svelte';
4
+ import '@sjsf/basic-theme/extra-widgets/multi-select.svelte';
5
+
6
+ let {
7
+ value = $bindable(),
8
+ options,
9
+ config,
10
+ handlers
11
+ }: ComponentProps['multiSelectWidget'] = $props();
12
+
13
+ const ctx = getFormContext();
14
+
15
+ const attributes = $derived(
16
+ selectAttributes(ctx, config, handlers, config.uiOptions?.multiSelect)
17
+ );
18
+
19
+ const mapped = $derived(
20
+ multipleOptions({
21
+ mapper: () => indexMapper(options),
22
+ value: () => value,
23
+ update: (v) => (value = v)
24
+ })
25
+ );
26
+ </script>
27
+
28
+ <select multiple bind:value={mapped.value} class="select" {...attributes}>
29
+ {#each options as option, index (option.id)}
30
+ <option value={index} disabled={option.disabled}>
31
+ {option.label}
32
+ </option>
33
+ {/each}
34
+ </select>
@@ -0,0 +1,4 @@
1
+ import '@sjsf/basic-theme/extra-widgets/multi-select.svelte';
2
+ declare const MultiSelect: import("svelte").Component<import("@sjsf/form/fields/widgets").WidgetCommonProps<import("@sjsf/form/core").SchemaArrayValue> & import("@sjsf/form/fields/widgets").Options, {}, "value">;
3
+ type MultiSelect = ReturnType<typeof MultiSelect>;
4
+ export default MultiSelect;
@@ -0,0 +1,6 @@
1
+ import './radio.svelte';
2
+ declare module '../definitions.js' {
3
+ interface ExtraWidgets {
4
+ radioWidget: {};
5
+ }
6
+ }
@@ -0,0 +1,4 @@
1
+ import { definitions } from '../definitions.js';
2
+ import Radio from './radio.svelte';
3
+ import './radio.svelte';
4
+ definitions.radioWidget = Radio;
@@ -1,23 +1,29 @@
1
1
  <script lang="ts">
2
- import { type WidgetProps, indexMapper, singleOption } from '@sjsf/form';
2
+ import { getFormContext, inputAttributes, type ComponentProps } from '@sjsf/form';
3
+ import { indexMapper, singleOption } from '@sjsf/form/options.svelte';
4
+ import '@sjsf/basic-theme/extra-widgets/radio.svelte';
3
5
 
4
- let { attributes, value = $bindable(), options }: WidgetProps<'radio'> = $props();
6
+ let { config, handlers, value = $bindable(), options }: ComponentProps['radioWidget'] = $props();
5
7
 
6
8
  const mapped = singleOption({
7
9
  mapper: () => indexMapper(options),
8
10
  value: () => value,
9
11
  update: (v) => (value = v)
10
12
  });
13
+
14
+ const ctx = getFormContext();
15
+
16
+ const attributes = $derived(inputAttributes(ctx, config, handlers, config.uiOptions?.radio));
11
17
  </script>
12
18
 
13
19
  {#each options as option, index (option.id)}
14
20
  <label class="flex items-center space-x-2 cursor-pointer">
15
21
  <input
16
- type="radio"
17
22
  class="radio"
18
23
  bind:group={mapped.value}
19
24
  value={index}
20
25
  {...attributes}
26
+ type="radio"
21
27
  id={option.id}
22
28
  disabled={option.disabled || attributes.disabled}
23
29
  />
@@ -0,0 +1,4 @@
1
+ import '@sjsf/basic-theme/extra-widgets/radio.svelte';
2
+ declare const Radio: import("svelte").Component<import("@sjsf/form/fields/widgets").WidgetCommonProps<import("@sjsf/form").SchemaValue> & import("@sjsf/form/fields/widgets").Options, {}, "value">;
3
+ type Radio = ReturnType<typeof Radio>;
4
+ export default Radio;
@@ -0,0 +1,6 @@
1
+ import './range.svelte';
2
+ declare module '../definitions.js' {
3
+ interface ExtraWidgets {
4
+ rangeWidget: {};
5
+ }
6
+ }
@@ -0,0 +1,4 @@
1
+ import { definitions } from '../definitions';
2
+ import Range from './range.svelte';
3
+ import './range.svelte';
4
+ definitions.rangeWidget = Range;
@@ -0,0 +1,12 @@
1
+ <script lang="ts">
2
+ import { getFormContext, inputAttributes, type ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/extra-widgets/range.svelte';
4
+
5
+ let { value = $bindable(), config, handlers }: ComponentProps['rangeWidget'] = $props();
6
+
7
+ const ctx = getFormContext();
8
+
9
+ const attributes = $derived(inputAttributes(ctx, config, handlers, config.uiOptions?.range));
10
+ </script>
11
+
12
+ <input type="range" bind:value class="range grow w-0" {...attributes} />
@@ -0,0 +1,4 @@
1
+ import '@sjsf/basic-theme/extra-widgets/range.svelte';
2
+ declare const Range: import("svelte").Component<import("@sjsf/form/fields/widgets").WidgetCommonProps<number>, {}, "value">;
3
+ type Range = ReturnType<typeof Range>;
4
+ export default Range;
@@ -0,0 +1,6 @@
1
+ import './textarea.svelte';
2
+ declare module '../definitions.js' {
3
+ interface ExtraWidgets {
4
+ textareaWidget: {};
5
+ }
6
+ }
@@ -0,0 +1,4 @@
1
+ import { definitions } from '../definitions.js';
2
+ import Textarea from './textarea.svelte';
3
+ import './textarea.svelte';
4
+ definitions.textareaWidget = Textarea;
@@ -0,0 +1,14 @@
1
+ <script lang="ts">
2
+ import { getFormContext, textareaAttributes, type ComponentProps } from '@sjsf/form';
3
+ import '@sjsf/basic-theme/extra-widgets/textarea.svelte';
4
+
5
+ let { value = $bindable(), config, handlers }: ComponentProps['textareaWidget'] = $props();
6
+
7
+ const ctx = getFormContext();
8
+
9
+ const attributes = $derived(
10
+ textareaAttributes(ctx, config, handlers, config.uiOptions?.textarea)
11
+ );
12
+ </script>
13
+
14
+ <textarea bind:value class="textarea" {...attributes}></textarea>
@@ -0,0 +1,4 @@
1
+ import '@sjsf/basic-theme/extra-widgets/textarea.svelte';
2
+ declare const Textarea: import("svelte").Component<import("@sjsf/form/fields/widgets").WidgetCommonProps<string>, {}, "value">;
3
+ type Textarea = ReturnType<typeof Textarea>;
4
+ export default Textarea;
package/dist/index.d.ts CHANGED
@@ -1,4 +1 @@
1
- export declare const theme: {
2
- components: import("@sjsf/form").Components;
3
- widgets: import("@sjsf/form").Widgets;
4
- };
1
+ export declare const theme: import("@sjsf/form/lib/resolver").Resolver<import("@sjsf/form/lib/resolver").Chain<Record<"stringField" | "numberField" | "integerField" | "booleanField" | "objectField" | "arrayField" | "tupleField" | "nullField" | "oneOfField" | "anyOfField" | "arrayItemField" | "objectPropertyField", any>, Record<"form" | "button" | "submitButton" | "fieldTemplate" | "objectTemplate" | "objectPropertyTemplate" | "arrayTemplate" | "arrayItemTemplate" | "multiFieldTemplate" | "layout" | "textWidget" | "numberWidget" | "selectWidget" | "checkboxWidget" | "title" | "description" | "help" | "errorsList" | keyof import("./definitions").ExtraWidgets, any>>, import("@sjsf/form/lib/resolver").Chain<typeof import("@sjsf/form/fields/exports") & Pick<import("@sjsf/form").ComponentDefinitions, never>, typeof import("@sjsf/form/templates/exports") & typeof import("./components/exports.js") & typeof import("./widgets/exports.js") & Pick<import("@sjsf/form").ComponentDefinitions, keyof import("./definitions").ExtraWidgets>>>;