@celar-ui/svelte 0.0.4 → 0.0.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.
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { Avatar, type AvatarRootProps } from 'bits-ui';
2
+ import { Avatar as BitAvatar, type AvatarRootProps } from 'bits-ui';
3
3
  import type { Snippet } from 'svelte';
4
4
 
5
5
  export type AvatarProps = AvatarRootProps & {
@@ -12,14 +12,14 @@
12
12
  let { size = '64px', src, alt, fallback, ...rest }: AvatarProps = $props();
13
13
  </script>
14
14
 
15
- <Avatar.Root {...rest} style="--size: {size}">
16
- <Avatar.Image {src} {alt} />
17
- <Avatar.Fallback>
15
+ <BitAvatar.Root {...rest} style="--size: {size}">
16
+ <BitAvatar.Image {src} {alt} />
17
+ <BitAvatar.Fallback>
18
18
  {#if fallback}
19
19
  {@render fallback()}
20
20
  {/if}
21
- </Avatar.Fallback>
22
- </Avatar.Root>
21
+ </BitAvatar.Fallback>
22
+ </BitAvatar.Root>
23
23
 
24
24
  <style>:global([data-avatar-root]) {
25
25
  display: block;
@@ -1,4 +1,4 @@
1
- import { Avatar, type AvatarRootProps } from 'bits-ui';
1
+ import { type AvatarRootProps } from 'bits-ui';
2
2
  import type { Snippet } from 'svelte';
3
3
  export type AvatarProps = AvatarRootProps & {
4
4
  src: string;
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { Checkbox, type CheckboxRootProps, type WithoutChildren } from 'bits-ui';
2
+ import { Checkbox as BitCheckbox, type CheckboxRootProps, type WithoutChildren } from 'bits-ui';
3
3
  import IconTick from '~icons/hugeicons/tick-01';
4
4
  import IconMinus from '~icons/hugeicons/minus-sign';
5
5
  import type { Snippet } from 'svelte';
@@ -13,7 +13,7 @@
13
13
 
14
14
  <label data-checkbox>
15
15
  <div data-checkbox-icon>
16
- <Checkbox.Root {...rest}>
16
+ <BitCheckbox.Root {...rest}>
17
17
  {#snippet children({ checked, indeterminate })}
18
18
  {#if checked}
19
19
  <IconTick font-size="20px" />
@@ -22,7 +22,7 @@
22
22
  <IconMinus />
23
23
  {/if}
24
24
  {/snippet}
25
- </Checkbox.Root>
25
+ </BitCheckbox.Root>
26
26
  </div>
27
27
 
28
28
  {@render children?.()}
@@ -1,4 +1,4 @@
1
- import { Checkbox, type CheckboxRootProps, type WithoutChildren } from 'bits-ui';
1
+ import { type CheckboxRootProps, type WithoutChildren } from 'bits-ui';
2
2
  import type { Snippet } from 'svelte';
3
3
  type CheckboxProps = WithoutChildren<CheckboxRootProps> & {
4
4
  children?: Snippet;
@@ -1,5 +1,9 @@
1
1
  <script lang="ts">
2
- import { RadioGroup, type RadioGroupRootProps, type WithoutChildren } from 'bits-ui';
2
+ import {
3
+ RadioGroup as BitRadioGroup,
4
+ type RadioGroupRootProps,
5
+ type WithoutChildren
6
+ } from 'bits-ui';
3
7
  import type { Snippet } from 'svelte';
4
8
 
5
9
  export type RadioGroupProps = WithoutChildren<RadioGroupRootProps> & {
@@ -8,9 +12,9 @@
8
12
  let { value = $bindable(''), children, ...rest }: RadioGroupProps = $props();
9
13
  </script>
10
14
 
11
- <RadioGroup.Root {...rest} bind:value>
15
+ <BitRadioGroup.Root {...rest} bind:value>
12
16
  {@render children?.()}
13
- </RadioGroup.Root>
17
+ </BitRadioGroup.Root>
14
18
 
15
19
  <style>:global([data-radio-group-root]) {
16
20
  position: relative;
@@ -1,4 +1,4 @@
1
- import { RadioGroup, type RadioGroupRootProps, type WithoutChildren } from 'bits-ui';
1
+ import { type RadioGroupRootProps, type WithoutChildren } from 'bits-ui';
2
2
  import type { Snippet } from 'svelte';
3
3
  export type RadioGroupProps = WithoutChildren<RadioGroupRootProps> & {
4
4
  children?: Snippet;
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { Switch, type SwitchRootProps, type WithoutChildren } from 'bits-ui';
2
+ import { Switch as BitSwitch, type SwitchRootProps, type WithoutChildren } from 'bits-ui';
3
3
  import type { Snippet } from 'svelte';
4
4
 
5
5
  export type SwitchProps = WithoutChildren<SwitchRootProps> & {
@@ -10,9 +10,9 @@
10
10
  </script>
11
11
 
12
12
  <label data-switch>
13
- <Switch.Root {...rest} bind:checked>
14
- <Switch.Thumb />
15
- </Switch.Root>
13
+ <BitSwitch.Root {...rest} bind:checked>
14
+ <BitSwitch.Thumb />
15
+ </BitSwitch.Root>
16
16
 
17
17
  {@render children?.()}
18
18
  </label>
@@ -1,4 +1,4 @@
1
- import { Switch, type SwitchRootProps, type WithoutChildren } from 'bits-ui';
1
+ import { type SwitchRootProps, type WithoutChildren } from 'bits-ui';
2
2
  import type { Snippet } from 'svelte';
3
3
  export type SwitchProps = WithoutChildren<SwitchRootProps> & {
4
4
  children?: Snippet;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celar-ui/svelte",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
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
+ } ;