@celar-ui/svelte 0.0.8 → 0.0.9

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,6 @@
1
1
  <script lang="ts">
2
+ import './styles/base_button.scss';
3
+
2
4
  import { Button, type ButtonRootProps } from 'bits-ui';
3
5
 
4
6
  export type BaseButtonProps = ButtonRootProps & {
@@ -13,36 +15,3 @@
13
15
  {@render children()}
14
16
  {/if}
15
17
  </Button.Root>
16
-
17
- <style>:global([data-button-root]) {
18
- display: inline-block;
19
- position: relative;
20
- box-sizing: border-box;
21
- padding: 0;
22
- margin: 0;
23
- transition-duration: var(--transition-dur);
24
- transition-property: opacity;
25
- cursor: pointer;
26
- border: none;
27
- width: -moz-fit-content;
28
- width: fit-content;
29
- height: -moz-fit-content;
30
- height: fit-content;
31
- color: inherit;
32
- font-size: inherit;
33
- font-family: inherit;
34
- -webkit-user-select: none;
35
- -moz-user-select: none;
36
- user-select: none;
37
- text-decoration: none;
38
- -webkit-tap-highlight-color: transparent;
39
- }
40
- :global([data-button-root]):not(:disabled):active {
41
- top: 1px;
42
- }
43
- :global([data-button-root]):not([data-active=true]):disabled {
44
- opacity: 0.5;
45
- }
46
- :global([data-button-root]):disabled {
47
- cursor: default;
48
- }</style>
@@ -1,3 +1,4 @@
1
+ import './styles/base_button.scss';
1
2
  import { type ButtonRootProps } from 'bits-ui';
2
3
  export type BaseButtonProps = ButtonRootProps & {
3
4
  loading?: boolean;
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import './styles/elevated_button.scss';
2
3
  import TextBaseButton from './TextBaseButton.svelte';
3
4
  import type { TextBaseButtonProps } from './TextBaseButton.svelte';
4
5
 
@@ -7,21 +8,4 @@
7
8
 
8
9
  <TextBaseButton {...props} data-button-elevated />
9
10
 
10
- <style>:global([data-button-elevated]) {
11
- transition-duration: var(--transition-dur);
12
- transition-property: background-color, box-shadow, opacity;
13
- box-shadow: 0 2px 2px var(--color-shadow);
14
- background-color: var(--color-primary--lighter);
15
- }
16
- :global([data-button-elevated]):not(:disabled, [data-active=true]):hover {
17
- box-shadow: 0 2px 4px var(--color-shadow--strong);
18
- background-color: var(--color-primary--light);
19
- }
20
- :global([data-button-elevated]):not(:disabled):active {
21
- box-shadow: 0 2px 2px var(--color-shadow--strong);
22
- }
23
11
 
24
- :global([data-button-elevated][data-active="true"]) {
25
- box-shadow: 0 2px 2px var(--color-shadow--strong);
26
- background-color: var(--color-alt);
27
- }</style>
@@ -1,3 +1,4 @@
1
+ import './styles/elevated_button.scss';
1
2
  import type { TextBaseButtonProps } from './TextBaseButton.svelte';
2
3
  declare const ElevatedButton: import("svelte").Component<TextBaseButtonProps, {}, "">;
3
4
  type ElevatedButton = ReturnType<typeof ElevatedButton>;
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import './styles/filled_button.scss';
2
3
  import TextBaseButton from './TextBaseButton.svelte';
3
4
  import type { TextBaseButtonProps } from './TextBaseButton.svelte';
4
5
 
@@ -7,21 +8,3 @@
7
8
 
8
9
  <TextBaseButton {...props} data-button-filled />
9
10
 
10
- <style>:global([data-button-filled]) {
11
- transition-duration: var(--transition-dur);
12
- transition-property: background-color, box-shadow, opacity;
13
- background-color: var(--color-primary);
14
- }
15
- :global([data-button-filled]):not(:disabled, [data-active=true]):hover {
16
- background-color: var(--color-primary--dark);
17
- box-shadow: 0 2px 4px var(--color-shadow--strong);
18
- }
19
- :global([data-button-filled]):not(:disabled):active {
20
- box-shadow: 0 2px 2px var(--color-shadow--strong);
21
- }
22
-
23
- :global([data-button-elevated][data-active="true"]) {
24
- box-shadow: 0 2px 2px var(--color-shadow--strong);
25
- background-color: var(--vuuui-color-alt--darker);
26
- color: var(--vuuui-color-bg);
27
- }</style>
@@ -1,3 +1,4 @@
1
+ import './styles/filled_button.scss';
1
2
  import type { TextBaseButtonProps } from './TextBaseButton.svelte';
2
3
  declare const FilledButton: import("svelte").Component<TextBaseButtonProps, {}, "">;
3
4
  type FilledButton = ReturnType<typeof FilledButton>;
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import './styles/icon_button.scss';
2
3
  import DotSpinner from '../misc/DotSpinner.svelte';
3
4
  import BaseButton from './BaseButton.svelte';
4
5
  import type { BaseButtonProps } from './BaseButton.svelte';
@@ -22,35 +23,3 @@
22
23
 
23
24
  <BaseButton {...rest} children={baseChildren} data-button-icon />
24
25
 
25
- <style>:global([data-button-icon]) {
26
- flex-grow: 0;
27
- flex-shrink: 0;
28
- transition-duration: var(--transition-dur);
29
- transition-property: background-color, opacity, color;
30
- border-radius: 50%;
31
- background-color: transparent;
32
- padding: var(--gap--half);
33
- aspect-ratio: 1/1;
34
- line-height: 1;
35
- }
36
- :global([data-button-icon]) .button-spinner {
37
- display: flex;
38
- position: absolute;
39
- top: 0;
40
- left: 0;
41
- justify-content: center;
42
- align-items: center;
43
- width: 100%;
44
- height: 100%;
45
- }
46
- :global([data-button-icon]) .button-body {
47
- line-height: 0;
48
- }
49
- :global([data-button-icon]):not(:disabled, [data-active=true]):hover {
50
- background-color: var(--color-primary--light);
51
- }
52
-
53
- :global([data-button-icon][data-active="true"]) {
54
- background-color: var(--color-alt);
55
- color: var(--color-primary--text);
56
- }</style>
@@ -1,3 +1,4 @@
1
+ import './styles/icon_button.scss';
1
2
  import type { BaseButtonProps } from './BaseButton.svelte';
2
3
  declare const IconButton: import("svelte").Component<BaseButtonProps, {}, "">;
3
4
  type IconButton = ReturnType<typeof IconButton>;
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import './styles/outlined_button.scss';
2
3
  import TextBaseButton from './TextBaseButton.svelte';
3
4
  import type { TextBaseButtonProps } from './TextBaseButton.svelte';
4
5
 
@@ -7,18 +8,4 @@
7
8
 
8
9
  <TextBaseButton {...props} data-button-outlined />
9
10
 
10
- <style>:global([data-button-outlined]) {
11
- transition-duration: var(--transition-dur);
12
- transition-property: background-color, border-color;
13
- background-color: transparent;
14
- border: 1px solid var(--color-primary--light);
15
- }
16
- :global([data-button-outlined]):not(:disabled, [data-active=true]):hover {
17
- background-color: var(--color-primary--light);
18
- border-color: var(--color-primary);
19
- }
20
11
 
21
- :global([data-button-text][data-active="true"]) {
22
- background-color: var(--color-alt);
23
- border-color: var(--color-primary);
24
- }</style>
@@ -1,3 +1,4 @@
1
+ import './styles/outlined_button.scss';
1
2
  import type { TextBaseButtonProps } from './TextBaseButton.svelte';
2
3
  declare const OutlinedButton: import("svelte").Component<TextBaseButtonProps, {}, "">;
3
4
  type OutlinedButton = ReturnType<typeof OutlinedButton>;
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import './styles/text_button.scss';
2
3
  import TextBaseButton from './TextBaseButton.svelte';
3
4
  import type { TextBaseButtonProps } from './TextBaseButton.svelte';
4
5
 
@@ -7,15 +8,4 @@
7
8
 
8
9
  <TextBaseButton {...props} data-button-text />
9
10
 
10
- <style>:global([data-button-text]) {
11
- transition-duration: var(--transition-dur);
12
- transition-property: background-color;
13
- background-color: transparent;
14
- }
15
- :global([data-button-text]):not(:disabled, [data-active=true]):hover {
16
- background-color: var(--color-primary--light);
17
- }
18
11
 
19
- :global([data-button-text][data-active="true"]) {
20
- background-color: var(--color-alt);
21
- }</style>
@@ -1,3 +1,4 @@
1
+ import './styles/text_button.scss';
1
2
  import type { TextBaseButtonProps } from './TextBaseButton.svelte';
2
3
  declare const TextButton: import("svelte").Component<TextBaseButtonProps, {}, "">;
3
4
  type TextButton = ReturnType<typeof TextButton>;
@@ -0,0 +1,20 @@
1
+ [data-button-elevated] {
2
+ transition-duration: var(--transition-dur);
3
+ transition-property: background-color, box-shadow, opacity;
4
+ box-shadow: 0 2px 2px var(--color-shadow);
5
+ background-color: var(--color-primary--lighter);
6
+
7
+ &:not(:disabled, [data-active='true']):hover {
8
+ box-shadow: 0 2px 4px var(--color-shadow--strong);
9
+ background-color: var(--color-primary--light);
10
+ }
11
+
12
+ &:not(:disabled):active {
13
+ box-shadow: 0 2px 2px var(--color-shadow--strong);
14
+ }
15
+ }
16
+
17
+ [data-button-elevated][data-active='true'] {
18
+ box-shadow: 0 2px 2px var(--color-shadow--strong);
19
+ background-color: var(--color-alt);
20
+ }
@@ -0,0 +1,20 @@
1
+ [data-button-filled] {
2
+ transition-duration: var(--transition-dur);
3
+ transition-property: background-color, box-shadow, opacity;
4
+ background-color: var(--color-primary);
5
+
6
+ &:not(:disabled, [data-active='true']):hover {
7
+ background-color: var(--color-primary--dark);
8
+ box-shadow: 0 2px 4px var(--color-shadow--strong);
9
+ }
10
+
11
+ &:not(:disabled):active {
12
+ box-shadow: 0 2px 2px var(--color-shadow--strong);
13
+ }
14
+ }
15
+
16
+ [data-button-elevated][data-active='true'] {
17
+ box-shadow: 0 2px 2px var(--color-shadow--strong);
18
+ background-color: var(--vuuui-color-alt--darker);
19
+ color: var(--vuuui-color-bg);
20
+ }
@@ -0,0 +1,35 @@
1
+ [data-button-icon] {
2
+ flex-grow: 0;
3
+ flex-shrink: 0;
4
+ transition-duration: var(--transition-dur);
5
+ transition-property: background-color, opacity, color;
6
+ border-radius: 50%;
7
+ background-color: transparent;
8
+ padding: var(--gap--half);
9
+ aspect-ratio: 1/1;
10
+ line-height: 1;
11
+
12
+ .button-spinner {
13
+ display: flex;
14
+ position: absolute;
15
+ top: 0;
16
+ left: 0;
17
+ justify-content: center;
18
+ align-items: center;
19
+ width: 100%;
20
+ height: 100%;
21
+ }
22
+
23
+ .button-body {
24
+ line-height: 0;
25
+ }
26
+
27
+ &:not(:disabled, [data-active='true']):hover {
28
+ background-color: var(--color-primary--light);
29
+ }
30
+ }
31
+
32
+ [data-button-icon][data-active='true'] {
33
+ background-color: var(--color-alt);
34
+ color: var(--color-primary--text);
35
+ }
@@ -0,0 +1,16 @@
1
+ [data-button-outlined] {
2
+ transition-duration: var(--transition-dur);
3
+ transition-property: background-color, border-color;
4
+ background-color: transparent;
5
+ border: 1px solid var(--color-primary--light);
6
+
7
+ &:not(:disabled, [data-active='true']):hover {
8
+ background-color: var(--color-primary--light);
9
+ border-color: var(--color-primary);
10
+ }
11
+ }
12
+
13
+ [data-button-text][data-active='true'] {
14
+ background-color: var(--color-alt);
15
+ border-color: var(--color-primary);
16
+ }
@@ -0,0 +1,13 @@
1
+ [data-button-text] {
2
+ transition-duration: var(--transition-dur);
3
+ transition-property: background-color;
4
+ background-color: transparent;
5
+
6
+ &:not(:disabled, [data-active='true']):hover {
7
+ background-color: var(--color-primary--light);
8
+ }
9
+ }
10
+
11
+ [data-button-text][data-active='true'] {
12
+ background-color: var(--color-alt);
13
+ }
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import './styles/avatar.scss';
2
3
  import { Avatar as BitAvatar, type AvatarRootProps } from 'bits-ui';
3
4
  import type { Snippet } from 'svelte';
4
5
 
@@ -21,18 +22,4 @@
21
22
  </BitAvatar.Fallback>
22
23
  </BitAvatar.Root>
23
24
 
24
- <style>:global([data-avatar-root]) {
25
- display: block;
26
- position: relative;
27
- background-color: var(--vuuui-color-bg-info);
28
- aspect-ratio: 1;
29
- width: var(--size);
30
- }
31
25
 
32
- :global([data-avatar-image], [data-avatar-fallback]) {
33
- -o-object-fit: cover;
34
- object-fit: cover;
35
- border-radius: 50%;
36
- width: 100%;
37
- height: 100%;
38
- }</style>
@@ -1,3 +1,4 @@
1
+ import './styles/avatar.scss';
1
2
  import { type AvatarRootProps } from 'bits-ui';
2
3
  import type { Snippet } from 'svelte';
3
4
  export type AvatarProps = AvatarRootProps & {
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import './styles/card.scss';
2
3
  import Container from './Container.svelte';
3
4
  import type { ContainerProps } from './Container.svelte';
4
5
 
@@ -6,8 +7,3 @@
6
7
  </script>
7
8
 
8
9
  <Container {...props} data-card />
9
-
10
- <style>:global([data-card]) {
11
- box-shadow: 0 var(--gap--sm) var(--gap) var(--color-shadow--md);
12
- background-color: var(--color-bg);
13
- }</style>
@@ -1,3 +1,4 @@
1
+ import './styles/card.scss';
1
2
  import type { ContainerProps } from './Container.svelte';
2
3
  declare const Card: import("svelte").Component<ContainerProps, {}, "">;
3
4
  type Card = ReturnType<typeof Card>;
@@ -0,0 +1,15 @@
1
+ [data-avatar-root] {
2
+ display: block;
3
+ position: relative;
4
+ background-color: var(--vuuui-color-bg-info);
5
+ aspect-ratio: 1;
6
+ width: var(--size);
7
+ }
8
+
9
+ [data-avatar-image],
10
+ [data-avatar-fallback] {
11
+ object-fit: cover;
12
+ border-radius: 50%;
13
+ width: 100%;
14
+ height: 100%;
15
+ }
@@ -0,0 +1,4 @@
1
+ [data-card] {
2
+ box-shadow: 0 var(--gap--sm) var(--gap) var(--color-shadow--md);
3
+ background-color: var(--color-bg);
4
+ }
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import './styles/radio_group.scss';
2
3
  import {
3
4
  RadioGroup as BitRadioGroup,
4
5
  type RadioGroupRootProps as BitRadioGroupRootProps,
@@ -16,6 +17,3 @@
16
17
  {@render children?.()}
17
18
  </BitRadioGroup.Root>
18
19
 
19
- <style>:global([data-radio-group-root]) {
20
- position: relative;
21
- }</style>
@@ -1,3 +1,4 @@
1
+ import './styles/radio_group.scss';
1
2
  import { type RadioGroupRootProps as BitRadioGroupRootProps, type WithoutChildrenOrChild } from 'bits-ui';
2
3
  import type { Snippet } from 'svelte';
3
4
  export type RadioGroupProps = WithoutChildrenOrChild<BitRadioGroupRootProps> & {
@@ -0,0 +1,3 @@
1
+ [data-radio-group-root] {
2
+ position: relative;
3
+ }
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import './styles/dialog.scss';
2
3
  import { fade, fly } from 'svelte/transition';
3
4
  import { Dialog as BitDialog, type DialogRootProps } from 'bits-ui';
4
5
  import type { Snippet } from 'svelte';
@@ -69,65 +70,4 @@
69
70
  </BitDialog.Portal>
70
71
  </BitDialog.Root>
71
72
 
72
- <style>:global([data-dialog-overlay]) {
73
- position: fixed;
74
- top: 0;
75
- left: 0;
76
- width: 100%;
77
- height: 100%;
78
- -webkit-backdrop-filter: blur(var(--blur-length));
79
- backdrop-filter: blur(var(--blur-length));
80
- background-color: var(--color-border--strong);
81
- z-index: 100;
82
- }
83
73
 
84
- :global([data-dialog-content]) {
85
- box-sizing: border-box;
86
- position: fixed;
87
- top: calc(50dvh - var(--gap));
88
- left: calc(50lvw - var(--gap));
89
- transform: translate(-50%, -50%);
90
- max-width: calc(100% - var(--gap--x2));
91
- max-height: calc(100dvh - var(--gap--x2));
92
- margin: var(--gap);
93
- background-color: var(--color-bg);
94
- box-shadow: 0 4px 1rem var(--color-shadow);
95
- border-radius: var(--radius);
96
- overflow: hidden;
97
- z-index: 100;
98
- }
99
- :global([data-dialog-content])[data-xs=true] {
100
- max-width: min(100% - var(--gap--x2), var(--break--xs));
101
- }
102
- :global([data-dialog-content])[data-sm=true] {
103
- max-width: min(100% - var(--gap--x2), var(--break--sm));
104
- }
105
- :global([data-dialog-content])[data-md=true] {
106
- max-width: min(100% - var(--gap--x2), var(--break--md));
107
- }
108
- :global([data-dialog-content])[data-fluid=true] {
109
- width: 100%;
110
- }
111
-
112
- :global([data-dialog-header]) {
113
- height: 48px;
114
- display: flex;
115
- justify-content: space-between;
116
- align-items: center;
117
- padding-left: var(--gap);
118
- padding-right: var(--gap--sm);
119
- overflow: hidden;
120
- }
121
-
122
- :global([data-dialog-title]) {
123
- overflow: hidden;
124
- text-overflow: ellipsis;
125
- white-space: nowrap;
126
- }
127
-
128
- :global([data-dialog-body]) {
129
- box-sizing: border-box;
130
- max-height: calc(100dvh - var(--gap--x2) - 48px);
131
- overflow-y: auto;
132
- padding: var(--gap);
133
- }</style>
@@ -1,3 +1,4 @@
1
+ import './styles/dialog.scss';
1
2
  import { type DialogRootProps } from 'bits-ui';
2
3
  import type { Snippet } from 'svelte';
3
4
  type DialogProps = DialogRootProps & {
@@ -0,0 +1,69 @@
1
+ $gap: var(--gap);
2
+ $gap--x2: var(--gap--x2);
3
+ $d-max-w: calc(100% - $gap--x2);
4
+ $d-max-h: calc(100dvh - $gap--x2);
5
+ $header-h: 48px;
6
+ $body-max-h: calc($d-max-h - $header-h);
7
+
8
+ [data-dialog-overlay] {
9
+ position: fixed;
10
+ top: 0;
11
+ left: 0;
12
+ width: 100%;
13
+ height: 100%;
14
+ backdrop-filter: blur(var(--blur-length));
15
+ background-color: var(--color-border--strong);
16
+ z-index: 100;
17
+ }
18
+
19
+ [data-dialog-content] {
20
+ box-sizing: border-box;
21
+ position: fixed;
22
+ top: calc(50dvh - $gap);
23
+ left: calc(50lvw - $gap);
24
+ transform: translate(-50%, -50%);
25
+ max-width: $d-max-w;
26
+ max-height: $d-max-h;
27
+ margin: $gap;
28
+ background-color: var(--color-bg);
29
+ box-shadow: 0 4px 1rem var(--color-shadow);
30
+ border-radius: var(--radius);
31
+ overflow: hidden;
32
+ z-index: 100;
33
+
34
+ &[data-xs='true'] {
35
+ max-width: min($d-max-w, var(--break--xs));
36
+ }
37
+ &[data-sm='true'] {
38
+ max-width: min($d-max-w, var(--break--sm));
39
+ }
40
+ &[data-md='true'] {
41
+ max-width: min($d-max-w, var(--break--md));
42
+ }
43
+ &[data-fluid='true'] {
44
+ width: 100%;
45
+ }
46
+ }
47
+
48
+ [data-dialog-header] {
49
+ height: $header-h;
50
+ display: flex;
51
+ justify-content: space-between;
52
+ align-items: center;
53
+ padding-left: var(--gap);
54
+ padding-right: var(--gap--sm);
55
+ overflow: hidden;
56
+ }
57
+
58
+ [data-dialog-title] {
59
+ overflow: hidden;
60
+ text-overflow: ellipsis;
61
+ white-space: nowrap;
62
+ }
63
+
64
+ [data-dialog-body] {
65
+ box-sizing: border-box;
66
+ max-height: $body-max-h;
67
+ overflow-y: auto;
68
+ padding: var(--gap);
69
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celar-ui/svelte",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "cuikho210",