@celar-ui/svelte 1.0.1 → 1.2.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.
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import './styles/container.scss';
2
3
  import type { HTMLAttributes } from 'svelte/elements';
3
4
 
4
5
  export interface ContainerProps extends HTMLAttributes<HTMLElement> {
@@ -16,22 +17,3 @@
16
17
  {@render children()}
17
18
  {/if}
18
19
  </section>
19
-
20
- <style>[data-container] {
21
- position: relative;
22
- margin: 0 auto;
23
- border-radius: var(--radius);
24
- padding: var(--gap);
25
- }
26
- [data-container][data-xs=true] {
27
- max-width: var(--break--xs);
28
- }
29
- [data-container][data-sm=true] {
30
- max-width: var(--break--sm);
31
- }
32
- [data-container][data-md=true] {
33
- max-width: var(--break--md);
34
- }
35
- [data-container][data-fluid=true] {
36
- width: 100%;
37
- }</style>
@@ -1,3 +1,4 @@
1
+ import './styles/container.scss';
1
2
  import type { HTMLAttributes } from 'svelte/elements';
2
3
  export interface ContainerProps extends HTMLAttributes<HTMLElement> {
3
4
  xs?: boolean;
@@ -0,0 +1,12 @@
1
+ <script lang="ts">
2
+ import './styles/surface-container.scss';
3
+ import Container, { type ContainerProps } from './Container.svelte';
4
+
5
+ export interface SurfaceContainerProps extends ContainerProps {
6
+ elevated?: 0 | 1 | 2 | 3 | 4;
7
+ }
8
+
9
+ let { elevated = 0, ...rest }: SurfaceContainerProps = $props();
10
+ </script>
11
+
12
+ <Container {...rest} data-surface-container data-elevated={elevated} />
@@ -0,0 +1,8 @@
1
+ import './styles/surface-container.scss';
2
+ import { type ContainerProps } from './Container.svelte';
3
+ export interface SurfaceContainerProps extends ContainerProps {
4
+ elevated?: 0 | 1 | 2 | 3 | 4;
5
+ }
6
+ declare const SurfaceContainer: import("svelte").Component<SurfaceContainerProps, {}, "">;
7
+ type SurfaceContainer = ReturnType<typeof SurfaceContainer>;
8
+ export default SurfaceContainer;
@@ -1,4 +1,5 @@
1
1
  [data-card] {
2
2
  box-shadow: 0 var(--gap--xs) var(--gap--sm) var(--color-shadow--soft);
3
3
  background-color: var(--color-surface);
4
+ border-radius: var(--gap);
4
5
  }
@@ -0,0 +1,22 @@
1
+ [data-container] {
2
+ position: relative;
3
+ margin: 0 auto;
4
+ padding: var(--gap);
5
+ box-sizing: border-box;
6
+
7
+ &[data-xs='true'] {
8
+ max-width: var(--break--xs);
9
+ }
10
+
11
+ &[data-sm='true'] {
12
+ max-width: var(--break--sm);
13
+ }
14
+
15
+ &[data-md='true'] {
16
+ max-width: var(--break--md);
17
+ }
18
+
19
+ &[data-fluid='true'] {
20
+ width: 100%;
21
+ }
22
+ }
@@ -0,0 +1,21 @@
1
+ [data-surface-container] {
2
+ --color-background: var(--color-surface);
3
+
4
+ border-radius: var(--gap--x2);
5
+
6
+ // Default: Elevated 0
7
+ background-color: var(--color-background);
8
+
9
+ &[data-elevated='1'] {
10
+ --color-background: var(--color-surfaceContainerLow);
11
+ }
12
+ &[data-elevated='2'] {
13
+ --color-background: var(--color-surfaceContainer);
14
+ }
15
+ &[data-elevated='3'] {
16
+ --color-background: var(--color-surfaceContainerHigh);
17
+ }
18
+ &[data-elevated='4'] {
19
+ --color-background: var(--color-surfaceContainerHighest);
20
+ }
21
+ }
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export { default as FilledButton } from './buttons/FilledButton.svelte';
5
5
  export { default as OutlinedButton } from './buttons/OutlinedButton.svelte';
6
6
  export { default as IconButton } from './buttons/IconButton.svelte';
7
7
  export { default as Container } from './containment/Container.svelte';
8
+ export { default as SurfaceContainer } from './containment/SurfaceContainer.svelte';
8
9
  export { default as Spacer } from './containment/Spacer.svelte';
9
10
  export { default as Card } from './containment/Card.svelte';
10
11
  export { default as Breadcrumb } from './containment/Breadcrumb.svelte';
@@ -14,6 +15,7 @@ export { default as MinimalDialog } from './overlay/MinimalDialog.svelte';
14
15
  export { default as CommandDialog } from './overlay/CommandDialog.svelte';
15
16
  export { default as CommandGroupItems } from './overlay/CommandGroupItems.svelte';
16
17
  export { default as CommandItem } from './overlay/CommandItem.svelte';
18
+ export { default as MinimalSurfaceDialog } from './overlay/MinimalSurfaceDialog.svelte';
17
19
  export { default as Gap } from './misc/Gap.svelte';
18
20
  export { default as DuckSpinner } from './misc/DuckSpinner.svelte';
19
21
  export { default as DotSpinner } from './misc/DotSpinner.svelte';
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ export { default as FilledButton } from './buttons/FilledButton.svelte';
6
6
  export { default as OutlinedButton } from './buttons/OutlinedButton.svelte';
7
7
  export { default as IconButton } from './buttons/IconButton.svelte';
8
8
  export { default as Container } from './containment/Container.svelte';
9
+ export { default as SurfaceContainer } from './containment/SurfaceContainer.svelte';
9
10
  export { default as Spacer } from './containment/Spacer.svelte';
10
11
  export { default as Card } from './containment/Card.svelte';
11
12
  export { default as Breadcrumb } from './containment/Breadcrumb.svelte';
@@ -15,6 +16,7 @@ export { default as MinimalDialog } from './overlay/MinimalDialog.svelte';
15
16
  export { default as CommandDialog } from './overlay/CommandDialog.svelte';
16
17
  export { default as CommandGroupItems } from './overlay/CommandGroupItems.svelte';
17
18
  export { default as CommandItem } from './overlay/CommandItem.svelte';
19
+ export { default as MinimalSurfaceDialog } from './overlay/MinimalSurfaceDialog.svelte';
18
20
  export { default as Gap } from './misc/Gap.svelte';
19
21
  export { default as DuckSpinner } from './misc/DuckSpinner.svelte';
20
22
  export { default as DotSpinner } from './misc/DotSpinner.svelte';
@@ -1,11 +1,12 @@
1
1
  <script lang="ts">
2
2
  import './styles/dialog.scss';
3
3
  import { fade, fly } from 'svelte/transition';
4
- import { Dialog as BitDialog, type DialogRootProps } from 'bits-ui';
4
+ import { Dialog as BitDialog, type DialogContentProps } from 'bits-ui';
5
5
  import type { Snippet } from 'svelte';
6
6
  import IconButton from '../buttons/IconButton.svelte';
7
7
 
8
- type DialogProps = DialogRootProps & {
8
+ export type DialogProps = Omit<DialogContentProps, 'title'> & {
9
+ open?: boolean;
9
10
  trigger?: Snippet<[{ props: Record<string, unknown> }]>;
10
11
  title?: Snippet;
11
12
  close?: Snippet;
@@ -31,7 +32,7 @@
31
32
  }: DialogProps = $props();
32
33
  </script>
33
34
 
34
- <BitDialog.Root {...rest} bind:open>
35
+ <BitDialog.Root bind:open>
35
36
  <BitDialog.Trigger>
36
37
  {#snippet child({ props })}
37
38
  {@render trigger?.({ props })}
@@ -46,6 +47,7 @@
46
47
  {/snippet}
47
48
  </BitDialog.Overlay>
48
49
  <BitDialog.Content
50
+ {...rest}
49
51
  forceMount
50
52
  data-xs={xs}
51
53
  data-sm={sm}
@@ -1,7 +1,8 @@
1
1
  import './styles/dialog.scss';
2
- import { type DialogRootProps } from 'bits-ui';
2
+ import { type DialogContentProps } from 'bits-ui';
3
3
  import type { Snippet } from 'svelte';
4
- type DialogProps = DialogRootProps & {
4
+ export type DialogProps = Omit<DialogContentProps, 'title'> & {
5
+ open?: boolean;
5
6
  trigger?: Snippet<[{
6
7
  props: Record<string, unknown>;
7
8
  }]>;
@@ -0,0 +1,47 @@
1
+ <script lang="ts">
2
+ import './styles/dialog.scss';
3
+ import '../containment/styles/surface-container.scss';
4
+ import './styles/surface-dialog.scss';
5
+
6
+ import MinimalDialog, { type MinimalDialogProps } from './MinimalDialog.svelte';
7
+ import type { Snippet } from 'svelte';
8
+
9
+ type MinimalSurfaceDialogProps = MinimalDialogProps & {
10
+ header?: Snippet;
11
+ footer?: Snippet;
12
+ elevated?: 0 | 1 | 2 | 3 | 4;
13
+ };
14
+
15
+ let {
16
+ open = $bindable(),
17
+ elevated,
18
+ children,
19
+ header,
20
+ footer,
21
+ ...rest
22
+ }: MinimalSurfaceDialogProps = $props();
23
+ </script>
24
+
25
+ <MinimalDialog
26
+ {...rest}
27
+ bind:open
28
+ data-surface-container
29
+ data-minimal-surface-dialog
30
+ data-elevated={elevated}
31
+ >
32
+ {#if header}
33
+ <div data-surface-dialog-header>
34
+ {@render header()}
35
+ </div>
36
+ {/if}
37
+
38
+ <div data-surface-dialog-body>
39
+ {@render children?.()}
40
+ </div>
41
+
42
+ {#if footer}
43
+ <div data-surface-dialog-footer>
44
+ {@render footer()}
45
+ </div>
46
+ {/if}
47
+ </MinimalDialog>
@@ -0,0 +1,13 @@
1
+ import './styles/dialog.scss';
2
+ import '../containment/styles/surface-container.scss';
3
+ import './styles/surface-dialog.scss';
4
+ import { type MinimalDialogProps } from './MinimalDialog.svelte';
5
+ import type { Snippet } from 'svelte';
6
+ type MinimalSurfaceDialogProps = MinimalDialogProps & {
7
+ header?: Snippet;
8
+ footer?: Snippet;
9
+ elevated?: 0 | 1 | 2 | 3 | 4;
10
+ };
11
+ declare const MinimalSurfaceDialog: import("svelte").Component<MinimalSurfaceDialogProps, {}, "open">;
12
+ type MinimalSurfaceDialog = ReturnType<typeof MinimalSurfaceDialog>;
13
+ export default MinimalSurfaceDialog;
@@ -0,0 +1,17 @@
1
+ [data-minimal-surface-dialog] {
2
+ border-radius: var(--gap--x2);
3
+
4
+ [data-dialog-body] {
5
+ [data-surface-dialog-body] {
6
+ border-radius: var(--gap--x2);
7
+ background-color: var(--color-surfaceContainerLowest);
8
+ padding: var(--gap);
9
+ }
10
+ [data-surface-dialog-header] {
11
+ margin-block-end: var(--gap);
12
+ }
13
+ [data-surface-dialog-footer] {
14
+ margin-block-start: var(--gap);
15
+ }
16
+ }
17
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celar-ui/svelte",
3
- "version": "1.0.1",
3
+ "version": "1.2.1",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "cuikho210",