ui-ingredients 0.15.1 → 0.16.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.
package/README.md
CHANGED
@@ -38,11 +38,11 @@ npm install ui-ingredients
|
|
38
38
|
</Dialog.Root>
|
39
39
|
```
|
40
40
|
|
41
|
-
##
|
41
|
+
## Inspiration
|
42
42
|
|
43
43
|
- [zag](https://zagjs.com/) - The fantastic library that powers UI ingredients
|
44
44
|
- [ark](https://ark-ui.com/) - The outstanding headless component library that greatly inspired this one
|
45
45
|
|
46
46
|
## Documentation
|
47
47
|
|
48
|
-
Browse
|
48
|
+
Browse the [documentation](https://ui-ingredients.vercel.app/) for more information on how to use UI Ingredients
|
@@ -1,37 +1,40 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import type {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
> {}
|
10
|
-
</script>
|
11
|
-
|
12
|
-
<script lang="ts">
|
13
|
-
import {mergeProps} from '../merge-props.js';
|
14
|
-
import {getClipboardContext} from './clipboard-context.svelte.js';
|
15
|
-
|
16
|
-
let {
|
17
|
-
ref = $bindable(null),
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
{
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
|
4
|
+
interface IndicatorState {
|
5
|
+
copied: boolean;
|
6
|
+
}
|
7
|
+
|
8
|
+
export interface ClipboardIndicatorProps
|
9
|
+
extends HtmlIngredientProps<'span', HTMLSpanElement, IndicatorState> {}
|
10
|
+
</script>
|
11
|
+
|
12
|
+
<script lang="ts">
|
13
|
+
import {mergeProps} from '../merge-props.js';
|
14
|
+
import {getClipboardContext} from './clipboard-context.svelte.js';
|
15
|
+
|
16
|
+
let {
|
17
|
+
ref = $bindable(null),
|
18
|
+
asChild,
|
19
|
+
children,
|
20
|
+
...props
|
21
|
+
}: ClipboardIndicatorProps = $props();
|
22
|
+
|
23
|
+
let clipboard = getClipboardContext();
|
24
|
+
|
25
|
+
let state = $derived({
|
26
|
+
copied: clipboard.copied,
|
27
|
+
});
|
28
|
+
|
29
|
+
let mergedProps = $derived(
|
30
|
+
mergeProps(clipboard.getIndicatorProps(state), props),
|
31
|
+
);
|
32
|
+
</script>
|
33
|
+
|
34
|
+
{#if asChild}
|
35
|
+
{@render asChild(mergedProps, state)}
|
36
|
+
{:else}
|
37
|
+
<span bind:this={ref} {...mergedProps}>
|
38
|
+
{@render children?.(state)}
|
39
|
+
</span>
|
40
|
+
{/if}
|
@@ -1,6 +1,8 @@
|
|
1
|
-
import type {
|
2
|
-
|
3
|
-
|
1
|
+
import type { HtmlIngredientProps } from '../types.js';
|
2
|
+
interface IndicatorState {
|
3
|
+
copied: boolean;
|
4
|
+
}
|
5
|
+
export interface ClipboardIndicatorProps extends HtmlIngredientProps<'span', HTMLSpanElement, IndicatorState> {
|
4
6
|
}
|
5
7
|
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> {
|
6
8
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
@@ -44,13 +44,22 @@ export function createDrawer(props) {
|
|
44
44
|
return mergeProps(o.getTriggerProps(), parts.trigger.attrs);
|
45
45
|
},
|
46
46
|
getBodyProps() {
|
47
|
-
return {
|
47
|
+
return {
|
48
|
+
...parts.body.attrs,
|
49
|
+
'data-state': o.open ? 'open' : 'closed',
|
50
|
+
};
|
48
51
|
},
|
49
52
|
getFooterProps() {
|
50
|
-
return {
|
53
|
+
return {
|
54
|
+
...parts.footer.attrs,
|
55
|
+
'data-state': o.open ? 'open' : 'closed',
|
56
|
+
};
|
51
57
|
},
|
52
58
|
getHeaderProps() {
|
53
|
-
return {
|
59
|
+
return {
|
60
|
+
...parts.header.attrs,
|
61
|
+
'data-state': o.open ? 'open' : 'closed',
|
62
|
+
};
|
54
63
|
},
|
55
64
|
};
|
56
65
|
});
|
package/package.json
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
"name": "ui-ingredients",
|
3
3
|
"type": "module",
|
4
4
|
"license": "MIT",
|
5
|
-
"version": "0.
|
6
|
-
"packageManager": "pnpm@9.
|
5
|
+
"version": "0.16.1",
|
6
|
+
"packageManager": "pnpm@9.14.2",
|
7
7
|
"svelte": "./dist/index.js",
|
8
8
|
"types": "./dist/index.d.ts",
|
9
9
|
"exports": {
|
@@ -356,30 +356,30 @@
|
|
356
356
|
},
|
357
357
|
"devDependencies": {
|
358
358
|
"@faker-js/faker": "^9.2.0",
|
359
|
-
"@sveltejs/adapter-vercel": "^5.4.
|
360
|
-
"@sveltejs/kit": "^2.8.
|
359
|
+
"@sveltejs/adapter-vercel": "^5.4.8",
|
360
|
+
"@sveltejs/kit": "^2.8.2",
|
361
361
|
"@sveltejs/package": "^2.3.7",
|
362
|
-
"@sveltejs/vite-plugin-svelte": "^4.0.
|
362
|
+
"@sveltejs/vite-plugin-svelte": "^4.0.1",
|
363
363
|
"@testing-library/jest-dom": "^6.6.3",
|
364
|
-
"@testing-library/svelte": "^5.2.
|
364
|
+
"@testing-library/svelte": "^5.2.6",
|
365
365
|
"@testing-library/user-event": "^14.5.2",
|
366
366
|
"@types/jsdom": "^21.1.7",
|
367
367
|
"@untitled-theme/icons-svelte": "^0.12.0",
|
368
368
|
"autoprefixer": "^10.4.20",
|
369
369
|
"globals": "^15.12.0",
|
370
370
|
"jsdom": "^25.0.1",
|
371
|
-
"postcss": "^8.4.
|
371
|
+
"postcss": "^8.4.49",
|
372
372
|
"publint": "^0.2.12",
|
373
373
|
"release-it": "^17.10.0",
|
374
374
|
"resize-observer-polyfill": "^1.5.1",
|
375
|
-
"svelte": "^5.
|
376
|
-
"svelte-check": "^4.0
|
375
|
+
"svelte": "^5.2.7",
|
376
|
+
"svelte-check": "^4.1.0",
|
377
377
|
"tailwind-merge": "^2.5.4",
|
378
|
-
"tailwind-variants": "^0.
|
379
|
-
"tailwindcss": "^3.4.
|
380
|
-
"typescript": "^5.
|
381
|
-
"vite": "^5.4.
|
382
|
-
"vitest": "^2.1.
|
378
|
+
"tailwind-variants": "^0.3.0",
|
379
|
+
"tailwindcss": "^3.4.15",
|
380
|
+
"typescript": "^5.7.2",
|
381
|
+
"vite": "^5.4.11",
|
382
|
+
"vitest": "^2.1.5",
|
383
383
|
"vitest-axe": "^1.0.0-pre.3",
|
384
384
|
"vitest-canvas-mock": "^0.3.3"
|
385
385
|
},
|