@casinogate/ui 1.3.4 → 1.3.6
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/assets/css/root.css +3 -0
- package/dist/components/data-table/index.d.ts +1 -0
- package/dist/components/data-table/index.js +1 -0
- package/dist/components/segment/components/segment.item.svelte +9 -4
- package/dist/components/segment/exports.d.ts +1 -0
- package/dist/components/segment/exports.js +1 -0
- package/dist/components/segment/index.d.ts +2 -1
- package/dist/components/segment/index.js +1 -0
- package/dist/components/segment/segment.stories.svelte +16 -2
- package/dist/components/segment/segment.stories.svelte.d.ts +1 -0
- package/dist/components/segment/segment.svelte +23 -0
- package/dist/components/segment/segment.svelte.d.ts +4 -0
- package/dist/components/segment/styles.d.ts +36 -0
- package/dist/components/segment/styles.js +12 -0
- package/dist/components/segment/types.d.ts +15 -2
- package/package.json +1 -1
package/dist/assets/css/root.css
CHANGED
|
@@ -3,3 +3,4 @@ export * from './exports.js';
|
|
|
3
3
|
export { createTable } from './models/index.js';
|
|
4
4
|
export type { ColumnDef, DataTableBodyProps, DataTableCellProps, DataTableHeaderProps, DataTableHeadProps, DataTableProps, DataTableResizeHandlerProps, DataTableRootProps, DataTableRowProps, DataTableSortButtonProps, DataTableTableProps, RowData, } from './types.js';
|
|
5
5
|
export { rowModels, usePaginationState, useResizeState, useRowSelectionState } from './utils/index.js';
|
|
6
|
+
export { renderComponent, renderSnippet } from './utils/render-helper.js';
|
|
@@ -2,3 +2,4 @@ export * as DataTablePrimitive from './exports-primitive.js';
|
|
|
2
2
|
export * from './exports.js';
|
|
3
3
|
export { createTable } from './models/index.js';
|
|
4
4
|
export { rowModels, usePaginationState, useResizeState, useRowSelectionState } from './utils/index.js';
|
|
5
|
+
export { renderComponent, renderSnippet } from './utils/render-helper.js';
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
ref = $bindable(null),
|
|
13
13
|
id = useId(uid),
|
|
14
14
|
children,
|
|
15
|
+
child,
|
|
15
16
|
class: className,
|
|
16
17
|
...props
|
|
17
18
|
}: SegmentItemProps = $props();
|
|
@@ -27,9 +28,13 @@
|
|
|
27
28
|
|
|
28
29
|
const styles = SegmentStylesContext.get();
|
|
29
30
|
|
|
30
|
-
const mergedProps = $derived(mergeProps(props, itemState.props));
|
|
31
|
+
const mergedProps = $derived(mergeProps(props, itemState.props, { class: cn(styles.current.item(), className) }));
|
|
31
32
|
</script>
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
{@render
|
|
35
|
-
|
|
34
|
+
{#if child}
|
|
35
|
+
{@render child({ props: mergedProps })}
|
|
36
|
+
{:else}
|
|
37
|
+
<button {...mergedProps}>
|
|
38
|
+
{@render children?.()}
|
|
39
|
+
</button>
|
|
40
|
+
{/if}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Segment } from './segment.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Segment } from './segment.svelte';
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
import type { Parameters } from '@storybook/sveltekit';
|
|
4
4
|
|
|
5
5
|
import type { ComponentProps } from 'svelte';
|
|
6
|
-
import { SegmentPrimitive } from './index.js';
|
|
6
|
+
import { Segment, SegmentPrimitive } from './index.js';
|
|
7
7
|
|
|
8
8
|
const parameters: Parameters = {
|
|
9
9
|
controls: {
|
|
10
|
-
include: ['value', 'disabled', 'size', 'variant', 'rounded'],
|
|
10
|
+
include: ['value', 'disabled', 'size', 'variant', 'rounded', 'spacingX'],
|
|
11
11
|
},
|
|
12
12
|
};
|
|
13
13
|
|
|
@@ -41,3 +41,17 @@
|
|
|
41
41
|
{/snippet}
|
|
42
42
|
|
|
43
43
|
<Story name="Basic" {args} {parameters} {template} />
|
|
44
|
+
|
|
45
|
+
<Story name="Preset" {args} {parameters}>
|
|
46
|
+
{#snippet template(args: Args)}
|
|
47
|
+
<Segment
|
|
48
|
+
{...args}
|
|
49
|
+
items={[
|
|
50
|
+
{ key: '1', label: 'Segment 1', value: '1' },
|
|
51
|
+
{ key: '2', label: 'Segment 2', value: '2' },
|
|
52
|
+
{ key: '3', label: 'Segment 3', value: '3' },
|
|
53
|
+
{ key: '4', label: 'Segment 4', value: '4' },
|
|
54
|
+
]}
|
|
55
|
+
/>
|
|
56
|
+
{/snippet}
|
|
57
|
+
</Story>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Segment } from './index.js';
|
|
1
2
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
3
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
4
|
$$bindings?: Bindings;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Item from './components/segment.item.svelte';
|
|
3
|
+
import Root from './components/segment.root.svelte';
|
|
4
|
+
import type { SegmentProps } from './types.js';
|
|
5
|
+
|
|
6
|
+
let { items, item: itemSnippet, value = $bindable(''), ref = $bindable(null), ...restProps }: SegmentProps = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<Root bind:value bind:ref {...restProps}>
|
|
10
|
+
{#each items as item (item.key)}
|
|
11
|
+
{#if itemSnippet}
|
|
12
|
+
<Item value={item.value}>
|
|
13
|
+
{#snippet child({ props })}
|
|
14
|
+
{@render itemSnippet?.({ item, props })}
|
|
15
|
+
{/snippet}
|
|
16
|
+
</Item>
|
|
17
|
+
{:else}
|
|
18
|
+
<Item value={item.value}>
|
|
19
|
+
{item.label}
|
|
20
|
+
</Item>
|
|
21
|
+
{/if}
|
|
22
|
+
{/each}
|
|
23
|
+
</Root>
|
|
@@ -30,6 +30,18 @@ export declare const segmentVariants: import("tailwind-variants").TVReturnType<{
|
|
|
30
30
|
item: string[];
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
+
spacingX: {
|
|
34
|
+
sm: {
|
|
35
|
+
item: string[];
|
|
36
|
+
};
|
|
37
|
+
md: {
|
|
38
|
+
item: string[];
|
|
39
|
+
};
|
|
40
|
+
lg: {
|
|
41
|
+
item: string[];
|
|
42
|
+
};
|
|
43
|
+
clear: {};
|
|
44
|
+
};
|
|
33
45
|
}, {
|
|
34
46
|
root: string[];
|
|
35
47
|
item: string[];
|
|
@@ -63,6 +75,18 @@ export declare const segmentVariants: import("tailwind-variants").TVReturnType<{
|
|
|
63
75
|
item: string[];
|
|
64
76
|
};
|
|
65
77
|
};
|
|
78
|
+
spacingX: {
|
|
79
|
+
sm: {
|
|
80
|
+
item: string[];
|
|
81
|
+
};
|
|
82
|
+
md: {
|
|
83
|
+
item: string[];
|
|
84
|
+
};
|
|
85
|
+
lg: {
|
|
86
|
+
item: string[];
|
|
87
|
+
};
|
|
88
|
+
clear: {};
|
|
89
|
+
};
|
|
66
90
|
}, {
|
|
67
91
|
root: string[];
|
|
68
92
|
item: string[];
|
|
@@ -96,6 +120,18 @@ export declare const segmentVariants: import("tailwind-variants").TVReturnType<{
|
|
|
96
120
|
item: string[];
|
|
97
121
|
};
|
|
98
122
|
};
|
|
123
|
+
spacingX: {
|
|
124
|
+
sm: {
|
|
125
|
+
item: string[];
|
|
126
|
+
};
|
|
127
|
+
md: {
|
|
128
|
+
item: string[];
|
|
129
|
+
};
|
|
130
|
+
lg: {
|
|
131
|
+
item: string[];
|
|
132
|
+
};
|
|
133
|
+
clear: {};
|
|
134
|
+
};
|
|
99
135
|
}, {
|
|
100
136
|
root: string[];
|
|
101
137
|
item: string[];
|
|
@@ -53,6 +53,18 @@ export const segmentVariants = tv({
|
|
|
53
53
|
item: ['cgui:h-11'],
|
|
54
54
|
},
|
|
55
55
|
},
|
|
56
|
+
spacingX: {
|
|
57
|
+
sm: {
|
|
58
|
+
item: ['cgui:px-2'],
|
|
59
|
+
},
|
|
60
|
+
md: {
|
|
61
|
+
item: ['cgui:px-4'],
|
|
62
|
+
},
|
|
63
|
+
lg: {
|
|
64
|
+
item: ['cgui:px-6'],
|
|
65
|
+
},
|
|
66
|
+
clear: {},
|
|
67
|
+
},
|
|
56
68
|
},
|
|
57
69
|
});
|
|
58
70
|
export const SegmentStylesContext = new Context(keyWithPrefix('segment-styles'));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PrimitiveButtonAttributes, PrimitiveDivAttributes } from '../../internal/types/html-attributes.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { WithChild, WithChildren, WithElementRef, Without } from 'svelte-toolbelt';
|
|
3
4
|
import type { SegmentVariantsProps } from './styles.js';
|
|
4
5
|
type SegmentRootPropsWithouitHTML = WithElementRef<WithChildren<{
|
|
5
6
|
value?: string;
|
|
@@ -7,8 +8,20 @@ type SegmentRootPropsWithouitHTML = WithElementRef<WithChildren<{
|
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
} & SegmentVariantsProps>>;
|
|
9
10
|
export type SegmentRootProps = SegmentRootPropsWithouitHTML & Without<PrimitiveDivAttributes, SegmentRootPropsWithouitHTML>;
|
|
10
|
-
type SegmentItemPropsWithoutHTML = WithElementRef<
|
|
11
|
+
type SegmentItemPropsWithoutHTML = WithElementRef<WithChild<{
|
|
11
12
|
value: string;
|
|
12
13
|
}>>;
|
|
13
14
|
export type SegmentItemProps = SegmentItemPropsWithoutHTML & Without<PrimitiveButtonAttributes, SegmentItemPropsWithoutHTML>;
|
|
15
|
+
export type SegmentItemValue = {
|
|
16
|
+
key: string | number;
|
|
17
|
+
label: string;
|
|
18
|
+
value: string;
|
|
19
|
+
};
|
|
20
|
+
export type SegmentProps = SegmentRootProps & {
|
|
21
|
+
items: SegmentItemValue[];
|
|
22
|
+
item?: Snippet<[{
|
|
23
|
+
item: SegmentItemValue;
|
|
24
|
+
props: Record<string, unknown>;
|
|
25
|
+
}]>;
|
|
26
|
+
};
|
|
14
27
|
export {};
|