ui-ingredients 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/segment-group/create-segment-group.svelte.js +26 -1
- package/dist/segment-group/segment-group-indicator.svelte +1 -2
- package/dist/segment-group/segment-group-item-control.svelte +1 -6
- package/dist/segment-group/segment-group-item-text.svelte +1 -6
- package/dist/segment-group/segment-group-item.svelte +1 -6
- package/dist/segment-group/segment-group-label.svelte +1 -4
- package/dist/segment-group/segment-group-root.svelte +1 -2
- package/package.json +1 -1
@@ -1,8 +1,10 @@
|
|
1
1
|
import { createUniqueId } from '../create-unique-id.js';
|
2
2
|
import { getEnvironmentContext } from '../environment-provider/enviroment-provider-context.svelte.js';
|
3
3
|
import { getLocaleContext } from '../locale-provider/local-provider-context.svelte.js';
|
4
|
+
import { mergeProps } from '../merge-props.js';
|
4
5
|
import * as segmentGroup from '@zag-js/radio-group';
|
5
6
|
import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
|
7
|
+
import { parts } from './segment-group-anatomy.js';
|
6
8
|
export function createSegmentGroup(props) {
|
7
9
|
const locale = getLocaleContext();
|
8
10
|
const environment = getEnvironmentContext();
|
@@ -14,5 +16,28 @@ export function createSegmentGroup(props) {
|
|
14
16
|
...props,
|
15
17
|
}));
|
16
18
|
const [state, send] = useMachine(segmentGroup.machine(context));
|
17
|
-
return reflect(() =>
|
19
|
+
return reflect(() => {
|
20
|
+
const o = segmentGroup.connect(state, send, normalizeProps);
|
21
|
+
return {
|
22
|
+
...o,
|
23
|
+
getIndicatorProps() {
|
24
|
+
return mergeProps(o.getIndicatorProps(), parts.indicator.attrs);
|
25
|
+
},
|
26
|
+
getItemControlProps(props) {
|
27
|
+
return mergeProps(o.getItemControlProps(props), parts.itemControl.attrs);
|
28
|
+
},
|
29
|
+
getItemProps(props) {
|
30
|
+
return mergeProps(o.getItemProps(props), parts.item.attrs);
|
31
|
+
},
|
32
|
+
getItemTextProps(props) {
|
33
|
+
return mergeProps(o.getItemTextProps(props), parts.itemText.attrs);
|
34
|
+
},
|
35
|
+
getLabelProps() {
|
36
|
+
return mergeProps(o.getLabelProps(), parts.label.attrs);
|
37
|
+
},
|
38
|
+
getRootProps() {
|
39
|
+
return mergeProps(o.getRootProps(), parts.root.attrs);
|
40
|
+
},
|
41
|
+
};
|
42
|
+
});
|
18
43
|
}
|
@@ -7,7 +7,6 @@
|
|
7
7
|
|
8
8
|
<script lang="ts">
|
9
9
|
import {mergeProps} from '../merge-props.js';
|
10
|
-
import {parts} from './segment-group-anatomy.js';
|
11
10
|
import {getSegmentGroupContext} from './segment-group-context.svelte.js';
|
12
11
|
|
13
12
|
let {
|
@@ -20,7 +19,7 @@
|
|
20
19
|
let segmentGroup = getSegmentGroupContext();
|
21
20
|
|
22
21
|
let mergedProps = $derived(
|
23
|
-
mergeProps(segmentGroup.getIndicatorProps(),
|
22
|
+
mergeProps(segmentGroup.getIndicatorProps(), props),
|
24
23
|
);
|
25
24
|
</script>
|
26
25
|
|
@@ -7,7 +7,6 @@
|
|
7
7
|
|
8
8
|
<script lang="ts">
|
9
9
|
import {mergeProps} from '../merge-props.js';
|
10
|
-
import {parts} from './segment-group-anatomy.js';
|
11
10
|
import {
|
12
11
|
getSegmentGroupContext,
|
13
12
|
getSegmentGroupItemPropsContext,
|
@@ -24,11 +23,7 @@
|
|
24
23
|
let itemProps = getSegmentGroupItemPropsContext();
|
25
24
|
|
26
25
|
let mergedProps = $derived(
|
27
|
-
mergeProps(
|
28
|
-
segmentGroup.getItemControlProps(itemProps),
|
29
|
-
parts.itemControl.attrs,
|
30
|
-
props,
|
31
|
-
),
|
26
|
+
mergeProps(segmentGroup.getItemControlProps(itemProps), props),
|
32
27
|
);
|
33
28
|
</script>
|
34
29
|
|
@@ -7,7 +7,6 @@
|
|
7
7
|
|
8
8
|
<script lang="ts">
|
9
9
|
import {mergeProps} from '../merge-props.js';
|
10
|
-
import {parts} from './segment-group-anatomy.js';
|
11
10
|
import {
|
12
11
|
getSegmentGroupContext,
|
13
12
|
getSegmentGroupItemPropsContext,
|
@@ -24,11 +23,7 @@
|
|
24
23
|
let itemProps = getSegmentGroupItemPropsContext();
|
25
24
|
|
26
25
|
let mergedProps = $derived(
|
27
|
-
mergeProps(
|
28
|
-
segmentGroup.getItemTextProps(itemProps),
|
29
|
-
parts.itemText.attrs,
|
30
|
-
props,
|
31
|
-
),
|
26
|
+
mergeProps(segmentGroup.getItemTextProps(itemProps), props),
|
32
27
|
);
|
33
28
|
</script>
|
34
29
|
|
@@ -12,7 +12,6 @@
|
|
12
12
|
<script lang="ts">
|
13
13
|
import {mergeProps} from '../merge-props.js';
|
14
14
|
import {createSplitProps} from '@zag-js/utils';
|
15
|
-
import {parts} from './segment-group-anatomy.js';
|
16
15
|
import {
|
17
16
|
getSegmentGroupContext,
|
18
17
|
setSegmentGroupItemPropsContext,
|
@@ -33,11 +32,7 @@
|
|
33
32
|
|
34
33
|
let itemState = $derived(segmentGroup.getItemState(itemProps));
|
35
34
|
let mergedProps = $derived(
|
36
|
-
mergeProps(
|
37
|
-
segmentGroup.getItemProps(itemProps),
|
38
|
-
parts.item.attrs,
|
39
|
-
localProps,
|
40
|
-
),
|
35
|
+
mergeProps(segmentGroup.getItemProps(itemProps), localProps),
|
41
36
|
);
|
42
37
|
|
43
38
|
setSegmentGroupItemPropsContext(() => itemProps);
|
@@ -7,7 +7,6 @@
|
|
7
7
|
|
8
8
|
<script lang="ts">
|
9
9
|
import {mergeProps} from '../merge-props.js';
|
10
|
-
import {parts} from './segment-group-anatomy.js';
|
11
10
|
import {getSegmentGroupContext} from './segment-group-context.svelte.js';
|
12
11
|
|
13
12
|
let {
|
@@ -19,9 +18,7 @@
|
|
19
18
|
|
20
19
|
let segmentGroup = getSegmentGroupContext();
|
21
20
|
|
22
|
-
let mergedProps = $derived(
|
23
|
-
mergeProps(segmentGroup.getLabelProps(), parts.label.attrs, props),
|
24
|
-
);
|
21
|
+
let mergedProps = $derived(mergeProps(segmentGroup.getLabelProps(), props));
|
25
22
|
</script>
|
26
23
|
|
27
24
|
{#if asChild}
|
@@ -17,7 +17,6 @@
|
|
17
17
|
import {reflect} from '@zag-js/svelte';
|
18
18
|
import {createSplitProps} from '@zag-js/utils';
|
19
19
|
import {createSegmentGroup} from './create-segment-group.svelte.js';
|
20
|
-
import {parts} from './segment-group-anatomy.js';
|
21
20
|
import {setSegmentGroupContext} from './segment-group-context.svelte.js';
|
22
21
|
|
23
22
|
let {
|
@@ -44,7 +43,7 @@
|
|
44
43
|
let segmentGroup = createSegmentGroup(reflect(() => createSegmentGroupProps));
|
45
44
|
|
46
45
|
let mergedProps = $derived(
|
47
|
-
mergeProps(segmentGroup.getRootProps(),
|
46
|
+
mergeProps(segmentGroup.getRootProps(), localProps),
|
48
47
|
);
|
49
48
|
|
50
49
|
setSegmentGroupContext(segmentGroup);
|