@functionalcms/svelte-components 4.6.0 → 4.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,120 +1,120 @@
1
- <script lang="ts">
2
- import { cn } from '../../utils.js';
3
- import type { Snippet } from 'svelte';
4
-
5
- interface Props {
6
- children: Snippet;
7
- css: string;
8
- style: string;
9
- type?: 'submit' | 'reset' | 'button' | 'link';
10
- href: string;
11
- mode?: string;
12
- size?: string;
13
- isPrimary: boolean;
14
- isBordered?: boolean;
15
- isCapsule?: boolean;
16
- isGrouped?: boolean;
17
- isBlock?: boolean;
18
- isLink?: boolean;
19
- isBlank?: boolean;
20
- isDisabled?: boolean;
21
- role?: string;
22
- isCircle?: boolean;
23
- isRounded?: boolean;
24
- isSkinned?: boolean;
25
- ariaSelected?: boolean;
26
- ariaControls?: string;
27
- tabIndex?: number;
28
- ariaLabel: string;
29
- click?: () => void;
30
- keydown?: (e: KeyboardEvent) => void;
31
- }
32
-
33
- let {
34
- children,
35
- css = '',
36
- style = '',
37
- href = '',
38
- mode = undefined,
39
- size = undefined,
40
- type = 'button',
41
- isPrimary = false,
42
- isBordered = false,
43
- isCapsule = false,
44
- isGrouped = false,
45
- isBlock = false,
46
- isLink = false,
47
- isBlank = false,
48
- isDisabled = false,
49
- role = undefined,
50
- isCircle = false,
51
- isRounded = false,
52
- isSkinned = true,
53
- ariaSelected = undefined,
54
- ariaControls = undefined,
55
- tabIndex = 0,
56
- click = undefined,
57
- keydown = undefined,
58
- ariaLabel = '',
59
- ...restProps
60
- }: Partial<Props> = $props();
61
-
62
- let klasses = $derived(
63
- cn(
64
- isSkinned ? 'btn' : 'btn-base',
65
- mode ? `btn-${mode}` : '',
66
- size ? `btn-${size}` : '',
67
- isBordered ? 'btn-bordered' : '',
68
- isCapsule ? 'btn-capsule ' : '',
69
- isGrouped ? 'btn-grouped' : '',
70
- isBlock ? 'btn-block' : '',
71
- isCircle ? 'btn-circle' : '',
72
- isRounded ? 'btn-rounded' : '',
73
- isDisabled ? 'disabled' : '',
74
- isBlank ? 'btn-blank' : '',
75
- isLink ? 'btn-link' : '',
76
- css ? `${css}` : ''
77
- )
78
- );
79
-
80
- </script>
81
-
82
- {#if type == 'link'}
83
- <!-- svelte-ignore a11y_no_noninteractive_tabindex -->
84
- <a
85
- class={klasses}
86
- {href}
87
- {style}
88
- {role}
89
- aria-selected={ariaSelected}
90
- aria-controls={ariaControls}
91
- aria-label={ariaLabel}
92
- tabindex={tabIndex}
93
- onclick={click}
94
- onkeydown={keydown}
95
- {...restProps}
96
- >
97
- {@render children?.()}
98
- </a>
99
- {:else}
100
- <button
101
- {type}
102
- class={klasses}
103
- {style}
104
- {role}
105
- aria-selected={ariaSelected}
106
- aria-controls={ariaControls}
107
- aria-label={ariaLabel}
108
- tabindex={tabIndex}
109
- disabled={isDisabled}
110
- onclick={click}
111
- onkeydown={keydown}
112
- {...restProps}
113
- >
114
- {@render children?.()}
115
- </button>
116
- {/if}
117
-
1
+ <script lang="ts">
2
+ import { cn } from '../../utils.js';
3
+ import type { Snippet } from 'svelte';
4
+
5
+ interface Props {
6
+ children: Snippet;
7
+ css: string;
8
+ style: string;
9
+ type?: 'submit' | 'reset' | 'button' | 'link';
10
+ href: string;
11
+ mode?: string;
12
+ size?: string;
13
+ isPrimary: boolean;
14
+ isBordered?: boolean;
15
+ isCapsule?: boolean;
16
+ isGrouped?: boolean;
17
+ isBlock?: boolean;
18
+ isLink?: boolean;
19
+ isBlank?: boolean;
20
+ isDisabled?: boolean;
21
+ role?: string;
22
+ isCircle?: boolean;
23
+ isRounded?: boolean;
24
+ isSkinned?: boolean;
25
+ ariaSelected?: boolean;
26
+ ariaControls?: string;
27
+ tabIndex?: number;
28
+ ariaLabel: string;
29
+ click?: () => void;
30
+ keydown?: (e: KeyboardEvent) => void;
31
+ }
32
+
33
+ let {
34
+ children,
35
+ css = '',
36
+ style = '',
37
+ href = '',
38
+ mode = undefined,
39
+ size = undefined,
40
+ type = 'button',
41
+ isPrimary = false,
42
+ isBordered = false,
43
+ isCapsule = false,
44
+ isGrouped = false,
45
+ isBlock = false,
46
+ isLink = false,
47
+ isBlank = false,
48
+ isDisabled = false,
49
+ role = undefined,
50
+ isCircle = false,
51
+ isRounded = false,
52
+ isSkinned = true,
53
+ ariaSelected = undefined,
54
+ ariaControls = undefined,
55
+ tabIndex = 0,
56
+ click = undefined,
57
+ keydown = undefined,
58
+ ariaLabel = '',
59
+ ...restProps
60
+ }: Partial<Props> = $props();
61
+
62
+ let klasses = $derived(
63
+ cn(
64
+ isSkinned ? 'btn' : 'btn-base',
65
+ mode ? `btn-${mode}` : '',
66
+ size ? `btn-${size}` : '',
67
+ isBordered ? 'btn-bordered' : '',
68
+ isCapsule ? 'btn-capsule ' : '',
69
+ isGrouped ? 'btn-grouped' : '',
70
+ isBlock ? 'btn-block' : '',
71
+ isCircle ? 'btn-circle' : '',
72
+ isRounded ? 'btn-rounded' : '',
73
+ isDisabled ? 'disabled' : '',
74
+ isBlank ? 'btn-blank' : '',
75
+ isLink ? 'btn-link' : '',
76
+ css ? `${css}` : ''
77
+ )
78
+ );
79
+
80
+ </script>
81
+
82
+ {#if type == 'link'}
83
+ <!-- svelte-ignore a11y_no_noninteractive_tabindex -->
84
+ <a
85
+ class={klasses}
86
+ {href}
87
+ {style}
88
+ {role}
89
+ aria-selected={ariaSelected}
90
+ aria-controls={ariaControls}
91
+ aria-label={ariaLabel}
92
+ tabindex={tabIndex}
93
+ onclick={click}
94
+ onkeydown={keydown}
95
+ {...restProps}
96
+ >
97
+ {@render children?.()}
98
+ </a>
99
+ {:else}
100
+ <button
101
+ {type}
102
+ class={klasses}
103
+ {style}
104
+ {role}
105
+ aria-selected={ariaSelected}
106
+ aria-controls={ariaControls}
107
+ aria-label={ariaLabel}
108
+ tabindex={tabIndex}
109
+ disabled={isDisabled}
110
+ onclick={click}
111
+ onkeydown={keydown}
112
+ {...restProps}
113
+ >
114
+ {@render children?.()}
115
+ </button>
116
+ {/if}
117
+
118
118
  <style>.btn-base {
119
119
  display: inline-flex;
120
120
  align-items: center;
@@ -386,4 +386,4 @@ on the side padding. As such, these have a good bit less then regular buttons. *
386
386
 
387
387
  .btn-link:hover {
388
388
  cursor: pointer;
389
- }</style>
389
+ }</style>
@@ -2,23 +2,36 @@
2
2
  import { onMount, type Snippet } from 'svelte';
3
3
  import emblaCarouselSvelte from 'embla-carousel-svelte';
4
4
  import EmblaCarousel, { type EmblaOptionsType } from 'embla-carousel';
5
- import type { CarouselItem } from './Carousel.ts';
6
5
  import { cn } from '../../utils.js';
7
6
  import Button from '../form/Button.svelte';
8
7
 
9
8
  interface Props {
10
- child: Snippet<[CarouselItem]>;
11
- items: Array<CarouselItem>;
9
+ child: Snippet<[any]>;
10
+ items: Array<any>;
12
11
  next?: Snippet;
13
12
  prev?: Snippet;
14
13
  css?: { slide: string; container: string };
15
14
  perPage?: number;
16
15
  slideGaps: string;
16
+ disableDrag: boolean;
17
17
  }
18
18
 
19
- let { child, next, prev, items, perPage = 1, slideGaps = '20px;' }: Props = $props();
19
+ let {
20
+ child,
21
+ next,
22
+ prev,
23
+ items,
24
+ perPage = 1,
25
+ slideGaps = '20px;',
26
+ disableDrag = false
27
+ }: Props = $props();
20
28
 
21
- let options: EmblaOptionsType = { loop: false };
29
+ let options: EmblaOptionsType = {
30
+ loop: false
31
+ };
32
+ if(disableDrag) {
33
+ options.watchDrag = false;
34
+ }
22
35
  let slideStyle = $derived('flex: 0 0 ' + 100 / perPage + '%;');
23
36
  let containerCss = cn('flex', 'fw');
24
37
 
@@ -1,8 +1,7 @@
1
1
  import { type Snippet } from 'svelte';
2
- import type { CarouselItem } from './Carousel.ts';
3
2
  interface Props {
4
- child: Snippet<[CarouselItem]>;
5
- items: Array<CarouselItem>;
3
+ child: Snippet<[any]>;
4
+ items: Array<any>;
6
5
  next?: Snippet;
7
6
  prev?: Snippet;
8
7
  css?: {
@@ -11,6 +10,7 @@ interface Props {
11
10
  };
12
11
  perPage?: number;
13
12
  slideGaps: string;
13
+ disableDrag: boolean;
14
14
  }
15
15
  declare const Carousel: import("svelte").Component<Props, {}, "">;
16
16
  type Carousel = ReturnType<typeof Carousel>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionalcms/svelte-components",
3
- "version": "4.6.0",
3
+ "version": "4.6.2",
4
4
  "watch": {
5
5
  "build": {
6
6
  "patterns": [