@celar-ui/svelte 0.0.3 → 0.0.5

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,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { fade, fly } from 'svelte/transition';
3
- import { Dialog, type DialogRootProps } from 'bits-ui';
3
+ import { Dialog as BitDialog, type DialogRootProps } from 'bits-ui';
4
4
  import type { Snippet } from 'svelte';
5
5
  import IconButton from '../buttons/IconButton.svelte';
6
6
 
@@ -30,33 +30,33 @@
30
30
  let duration = 200;
31
31
  </script>
32
32
 
33
- <Dialog.Root {...rest} bind:open>
34
- <Dialog.Trigger>
33
+ <BitDialog.Root {...rest} bind:open>
34
+ <BitDialog.Trigger>
35
35
  {#snippet child({ props })}
36
36
  {@render trigger?.({ props })}
37
37
  {/snippet}
38
- </Dialog.Trigger>
39
- <Dialog.Portal>
40
- <Dialog.Overlay forceMount>
38
+ </BitDialog.Trigger>
39
+ <BitDialog.Portal>
40
+ <BitDialog.Overlay forceMount>
41
41
  {#snippet child({ props, open })}
42
42
  {#if open}
43
43
  <div {...props} transition:fade={{ duration }}></div>
44
44
  {/if}
45
45
  {/snippet}
46
- </Dialog.Overlay>
47
- <Dialog.Content forceMount data-xs={xs} data-sm={sm} data-md={md} data-fluid={fluid}>
46
+ </BitDialog.Overlay>
47
+ <BitDialog.Content forceMount data-xs={xs} data-sm={sm} data-md={md} data-fluid={fluid}>
48
48
  {#snippet child({ props, open })}
49
49
  {#if open}
50
50
  <div {...props} transition:fly={{ duration, y: 50 }}>
51
51
  <div data-dialog-header>
52
- <Dialog.Title children={title} />
53
- <Dialog.Close>
52
+ <BitDialog.Title children={title} />
53
+ <BitDialog.Close>
54
54
  {#snippet child({ props })}
55
55
  <IconButton {...props}>
56
56
  {@render close?.()}
57
57
  </IconButton>
58
58
  {/snippet}
59
- </Dialog.Close>
59
+ </BitDialog.Close>
60
60
  </div>
61
61
 
62
62
  <div data-dialog-body>
@@ -65,9 +65,9 @@
65
65
  </div>
66
66
  {/if}
67
67
  {/snippet}
68
- </Dialog.Content>
69
- </Dialog.Portal>
70
- </Dialog.Root>
68
+ </BitDialog.Content>
69
+ </BitDialog.Portal>
70
+ </BitDialog.Root>
71
71
 
72
72
  <style>:global([data-dialog-overlay]) {
73
73
  position: fixed;
@@ -1,4 +1,4 @@
1
- import { Dialog, type DialogRootProps } from 'bits-ui';
1
+ import { type DialogRootProps } from 'bits-ui';
2
2
  import type { Snippet } from 'svelte';
3
3
  type DialogProps = DialogRootProps & {
4
4
  trigger?: Snippet<[{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celar-ui/svelte",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "cuikho210",
@@ -21,6 +21,7 @@
21
21
  },
22
22
  "files": [
23
23
  "dist",
24
+ "src/styles",
24
25
  "!dist/**/*.test.*",
25
26
  "!dist/**/*.spec.*"
26
27
  ],
@@ -34,7 +35,8 @@
34
35
  ".": {
35
36
  "types": "./dist/index.d.ts",
36
37
  "svelte": "./dist/index.js"
37
- }
38
+ },
39
+ "./styles": "./src/styles/*.scss"
38
40
  },
39
41
  "peerDependencies": {
40
42
  "svelte": "^5.0.0"
@@ -0,0 +1,45 @@
1
+ @use './utils.scss';
2
+ @use './config.scss';
3
+
4
+ $colors-theme: (
5
+ color-primary--text: #570000,
6
+ color-primary--darker: #962c0f,
7
+ color-primary--dark: #ff907f,
8
+ color-primary: #ffc5b3,
9
+ color-primary--light: #ffe5dc,
10
+ color-primary--lighter: #fff6f3,
11
+
12
+ color-alt--text: #481523,
13
+ color-alt--darker: #8f1538,
14
+ color-alt--dark: #c48591,
15
+ color-alt: #f1afbb,
16
+ color-alt--light: #ffe3ec,
17
+ color-alt--lighter: #fff3f7,
18
+
19
+ color-text: #000000,
20
+ color-text-info: #1a3baa,
21
+ color-text-success: #438d75,
22
+ color-text-warning: #c18500,
23
+ color-text-danger: #98000b,
24
+
25
+ color-bg: #ffffff,
26
+ color-bg-info: #faf8ff,
27
+ color-bg-success: #e8fef5,
28
+ color-bg-warning: #fff8ec,
29
+ color-bg-danger: #fff4ef
30
+ ) !default;
31
+
32
+ $colors-misc: (
33
+ color-shadow--soft: rgba(0, 0, 0, 0.05),
34
+ color-shadow--md: rgba(0, 0, 0, 0.075),
35
+ color-shadow: rgba(0, 0, 0, 0.1),
36
+ color-shadow--strong: rgba(0, 0, 0, 0.16),
37
+ color-border: rgba(var(--color-text--rgb), 0.07),
38
+ color-border--strong: rgba(var(--color-text--rgb), 0.1),
39
+ color-wrapper: rgba(var(--color-text--rgb), 0.024)
40
+ ) !default;
41
+
42
+ :root {
43
+ @include utils.generate_colors(config.$prefix, $colors-theme);
44
+ @include utils.add_prefix(config.$prefix, $colors-misc);
45
+ }
@@ -0,0 +1 @@
1
+ $prefix: '';
@@ -0,0 +1,15 @@
1
+ @use './utils.scss';
2
+ @use './config.scss';
3
+
4
+ $misc: (
5
+ radius: 16px,
6
+ radius--half: 8px,
7
+ blur-length--x2: 8px,
8
+ blur-length: 4px,
9
+ transition-dur: 150ms,
10
+ transition-dur--long: 300ms
11
+ ) !default;
12
+
13
+ :root {
14
+ @include utils.add_prefix(config.$prefix, $misc);
15
+ }
@@ -0,0 +1,23 @@
1
+ @use './utils.scss';
2
+ @use './config.scss';
3
+
4
+ $spacing: (
5
+ gap--x3: 3rem,
6
+ gap--x2: 2rem,
7
+ gap: 1rem,
8
+ gap--md: 0.7rem,
9
+ gap--half: 0.5rem,
10
+ gap--sm: 0.3rem,
11
+ gap--xs: 0.1rem
12
+ ) !default;
13
+
14
+ $breaking: (
15
+ break--xs: 540px,
16
+ break--sm: 960px,
17
+ break--md: 1320px
18
+ ) !default;
19
+
20
+ :root {
21
+ @include utils.add_prefix(config.$prefix, $spacing);
22
+ @include utils.add_prefix(config.$prefix, $breaking);
23
+ }
@@ -0,0 +1,27 @@
1
+ @use 'sass:string';
2
+ @use 'sass:color';
3
+
4
+ @function convertHexToRGB($hex) {
5
+ @return color.channel($hex, 'red', $space: rgb), color.channel($hex, 'green', $space: rgb),
6
+ color.channel($hex, 'blue', $space: rgb);
7
+ }
8
+
9
+ @mixin generate_colors($prefix, $colors) {
10
+ // Colors, RGB Colors
11
+ @each $color, $value in $colors {
12
+ @if string.slice(#{$value}, 1, 1) == '#' {
13
+ --#{$prefix}#{$color}: #{$value};
14
+ --#{$prefix}#{$color}--rgb: #{convertHexToRGB($value)};
15
+ } @else {
16
+ --#{$prefix}#{$color}: var(--#{$value});
17
+ --#{$prefix}#{$color}--rgb: var(--#{$value}--rgb);
18
+ }
19
+ }
20
+ }
21
+
22
+ @mixin add_prefix($prefix, $vars) {
23
+ // Colors, RGB Colors
24
+ @each $var, $value in $vars {
25
+ --#{$prefix}#{$var}: #{$value};
26
+ }
27
+ } ;