fulldev-ui 0.3.0-beta.3 → 0.3.3

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.
Files changed (91) hide show
  1. package/.astro/settings.json +1 -1
  2. package/package.json +10 -5
  3. package/src/components/_Block.astro +0 -5
  4. package/src/components/_Component.astro +10 -8
  5. package/src/components/_archive/Body.astro +2 -2
  6. package/src/components/_archive/Nav.astro +12 -0
  7. package/src/components/_todo/Form.astro +1 -1
  8. package/src/components/_todo/Prose.astro +7 -7
  9. package/src/components/base/Badge.astro +20 -16
  10. package/src/components/base/Button.astro +21 -34
  11. package/src/components/base/Icon.astro +7 -7
  12. package/src/components/base/Image.astro +116 -42
  13. package/src/components/base/Logo.astro +2 -3
  14. package/src/components/base/Rating.astro +30 -29
  15. package/src/components/base/checkbox/Checkbox.astro +52 -0
  16. package/src/components/base/checkbox/CheckboxElement.astro +31 -0
  17. package/src/components/base/input/Input.astro +79 -0
  18. package/src/components/base/input/InputElement.astro +60 -0
  19. package/src/components/base/radio/Radio.astro +66 -0
  20. package/src/components/base/radio/RadioElement.astro +34 -0
  21. package/src/components/base/select/Select.astro +90 -0
  22. package/src/components/base/select/SelectElement.astro +56 -0
  23. package/src/components/base/select/SelectOption.astro +32 -0
  24. package/src/components/base/switch/Switch.astro +55 -0
  25. package/src/components/base/{Switch.astro → switch/SwitchElement.astro} +15 -13
  26. package/src/components/base/table/Table.astro +55 -0
  27. package/src/components/base/table/TableBody.astro +39 -0
  28. package/src/components/base/table/TableCell.astro +30 -0
  29. package/src/components/base/table/TableFooter.astro +48 -0
  30. package/src/components/base/table/TableHead.astro +31 -0
  31. package/src/components/base/table/TableHeader.astro +44 -0
  32. package/src/components/base/table/TableRow.astro +46 -0
  33. package/src/components/base/textarea/Textarea.astro +79 -0
  34. package/src/components/base/textarea/TextareaElement.astro +61 -0
  35. package/src/components/segment/Card.astro +42 -19
  36. package/src/components/segment/Footer.astro +88 -0
  37. package/src/components/segment/Header.astro +48 -19
  38. package/src/components/segment/Section.astro +66 -32
  39. package/src/components/segment/_regels.md +32 -0
  40. package/src/components/structure/Bento.astro +38 -0
  41. package/src/components/structure/Box.astro +30 -0
  42. package/src/components/structure/Carousel.astro +55 -0
  43. package/src/components/structure/Column.astro +46 -0
  44. package/src/components/structure/Grid.astro +33 -0
  45. package/src/components/structure/Masonry.astro +42 -0
  46. package/src/components/structure/Row.astro +44 -0
  47. package/src/components/structure/Split.astro +54 -0
  48. package/src/components/structure/Spread.astro +45 -0
  49. package/src/components/structure/Wrap.astro +44 -0
  50. package/src/components/typography/Heading.astro +37 -28
  51. package/src/components/typography/Label.astro +4 -8
  52. package/src/components/typography/Link.astro +40 -12
  53. package/src/components/typography/List.astro +12 -13
  54. package/src/components/typography/ListItem.astro +11 -10
  55. package/src/components/typography/Paragraph.astro +4 -9
  56. package/src/components/typography/Tagline.astro +11 -10
  57. package/src/components/typography/Text.astro +5 -9
  58. package/src/content/config.ts +1 -1
  59. package/src/css/color.scss +289 -0
  60. package/src/css/size.scss +293 -0
  61. package/src/css/space.scss +94 -0
  62. package/src/css/styles.css +1 -2
  63. package/src/index.ts +30 -12
  64. package/src/integration/tailwind.ts +34 -0
  65. package/src/integration/unocss.ts +38 -0
  66. package/src/schemas/schemas.ts +45 -0
  67. package/src/components/_archive/Row.astro +0 -26
  68. package/src/components/_todo/Footer.astro +0 -66
  69. package/src/components/_todo/todo.md +0 -10
  70. package/src/components/base/Checkbox.astro +0 -41
  71. package/src/components/base/Input.astro +0 -59
  72. package/src/components/base/Radio.astro +0 -39
  73. package/src/components/base/Select.astro +0 -69
  74. package/src/components/base/SelectOption.astro +0 -27
  75. package/src/components/base/Textarea.astro +0 -34
  76. package/src/components/base/todo.md +0 -7
  77. package/src/components/segment/Box.astro +0 -41
  78. package/src/components/segment/Deck.astro +0 -40
  79. package/src/components/segment/Group.astro +0 -29
  80. package/src/components/typography/todo.md +0 -3
  81. package/src/css/color.css +0 -88
  82. package/src/css/props/align.scss +0 -20
  83. package/src/css/props/frame.scss +0 -153
  84. package/src/css/props/mask +0 -1
  85. package/src/css/props/position.scss +0 -33
  86. package/src/css/props/ratio +0 -1
  87. package/src/css/props/structure.scss +0 -228
  88. package/src/css/props/variant.scss +0 -130
  89. package/src/css/radix.css +0 -281
  90. package/src/css/size.css +0 -334
  91. /package/src/schemas/{collection.ts → collection-old-schemas.ts} +0 -0
@@ -1,48 +1,49 @@
1
1
  ---
2
- import type { ComponentProps, HTMLTag, Polymorphic } from 'astro/types'
2
+ import type { HTMLTag, Polymorphic } from 'astro/types'
3
3
  import Component from '../_Component.astro'
4
4
  import Icon from './Icon.astro'
5
5
 
6
- type Props<As extends HTMLTag = 'div'> = Polymorphic<{ as: As }> &
7
- ComponentProps<typeof Component> & {
8
- value?: number | string
9
- }
6
+ type Props<As extends HTMLTag = 'div'> = Polymorphic<{ as: As }> & {
7
+ color?: 'base' | 'brand'
8
+ value?: number
9
+ size?: string
10
+ compact?: boolean
11
+ }
12
+
13
+ const { size, compact, value = 5, ...rest } = Astro.props
10
14
 
11
- const { value = Astro.props.html, ...rest } = Astro.props
15
+ const getIcon = (count: number) => {
16
+ const difference = value - count
17
+ if (difference >= -0.25) return 'star-filled'
18
+ if (difference >= -0.75) return 'star-half-filled'
19
+ return 'star'
20
+ }
12
21
  ---
13
22
 
14
23
  <Component
15
24
  class:list={['rating']}
16
25
  {...rest}
17
26
  >
18
- {value && [1, 2, 3, 4, 5].map(() => <Icon name="star-filled" />)}
27
+ {
28
+ [1, 2, 3, 4, 5].map((_, i) => (
29
+ <>
30
+ <Icon
31
+ size={size}
32
+ compact={compact}
33
+ name={getIcon(i + 1)}
34
+ class:list={'rating-icon-solid'}
35
+ />
36
+ </>
37
+ ))
38
+ }
19
39
  </Component>
20
40
 
21
41
  <style is:global lang="scss">
22
42
  @import '../../css/utils.scss';
23
43
 
24
44
  @include component('rating') {
25
- display: flex;
26
- gap: 0.75rem;
27
- padding-left: 5px;
28
-
29
- &.center {
30
- padding-left: 0 !important;
31
- }
32
-
33
- i {
34
- --un-icon: url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M0 0h24v24H0z'/%3E%3Cpath fill='currentColor' d='m8.243 7.34l-6.38.925l-.113.023a1 1 0 0 0-.44 1.684l4.622 4.499l-1.09 6.355l-.013.11a1 1 0 0 0 1.464.944l5.706-3l5.693 3l.1.046a1 1 0 0 0 1.352-1.1l-1.091-6.355l4.624-4.5l.078-.085a1 1 0 0 0-.633-1.62l-6.38-.926l-2.852-5.78a1 1 0 0 0-1.794 0z'/%3E%3C/g%3E%3C/svg%3E");
35
- -webkit-mask: var(--un-icon) no-repeat;
36
- mask: var(--un-icon) no-repeat;
37
- -webkit-mask-size: 100% 100%;
38
- mask-size: 100% 100%;
39
- margin-left: -0.4em;
40
- background-color: currentColor;
41
- width: 1em;
42
- width: 1.25em;
43
- height: 1em;
44
- height: 1.25em;
45
- color: var(--foreground);
46
- }
45
+ display: inline-flex;
46
+ position: relative;
47
+ gap: var(--space-2);
47
48
  }
48
49
  </style>
@@ -0,0 +1,52 @@
1
+ ---
2
+ import type { ComponentProps, Polymorphic } from 'astro/types'
3
+ import '../../../css/utils.scss'
4
+ import Component from '../../_Component.astro'
5
+ import Label from '../../typography/Label.astro'
6
+ import CheckboxElement from './CheckboxElement.astro'
7
+
8
+ type Props<As extends 'div'> = Polymorphic<{ as: As }> & {
9
+ label?: string
10
+ } & Pick<
11
+ ComponentProps<typeof CheckboxElement>,
12
+ 'name' | 'disabled' | 'required' | 'checked'
13
+ > & {
14
+ color?: 'base' | 'brand'
15
+ contrast?: boolean
16
+ }
17
+
18
+ const {
19
+ as = 'div',
20
+ label,
21
+ contrast,
22
+ icon,
23
+ name,
24
+ variant,
25
+ placeholder,
26
+ type,
27
+ value,
28
+ disabled,
29
+ checked,
30
+ required,
31
+ ...rest
32
+ } = Astro.props
33
+ ---
34
+
35
+ <Component
36
+ structure="row"
37
+ class:list={['checkbox']}
38
+ {as}
39
+ {...rest}
40
+ >
41
+ <CheckboxElement
42
+ {name}
43
+ {disabled}
44
+ {required}
45
+ {checked}
46
+ />
47
+ <Label
48
+ for={name}
49
+ text={label}
50
+ {contrast}
51
+ />
52
+ </Component>
@@ -0,0 +1,31 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types'
3
+ import Component from '../../_Component.astro'
4
+
5
+ type Props = Omit<HTMLAttributes<'input'>, 'type'> & {
6
+ color?: 'base' | 'brand'
7
+ }
8
+
9
+ const { name, ...rest } = Astro.props
10
+ ---
11
+
12
+ <Component
13
+ class:list={['checkbox-element']}
14
+ as="input"
15
+ type="checkbox"
16
+ id={name}
17
+ if={name}
18
+ {name}
19
+ {...rest}
20
+ />
21
+
22
+ <style is:global lang="scss">
23
+ @import '../../../css/utils.scss';
24
+
25
+ @include component('checkbox-element') {
26
+ display: block;
27
+ width: var(--text-1);
28
+ height: var(--text-1);
29
+ accent-color: var(--color-9);
30
+ }
31
+ </style>
@@ -0,0 +1,79 @@
1
+ ---
2
+ import type { ComponentProps, Polymorphic } from 'astro/types'
3
+ import Component from '../../_Component.astro'
4
+ import Label from '../../typography/Label.astro'
5
+ import Icon from '../Icon.astro'
6
+ import InputElement from './InputElement.astro'
7
+
8
+ type Props<As extends 'div'> = Polymorphic<{ as: As }> &
9
+ Pick<
10
+ ComponentProps<typeof InputElement>,
11
+ | 'variant'
12
+ | 'placeholder'
13
+ | 'type'
14
+ | 'name'
15
+ | 'value'
16
+ | 'disabled'
17
+ | 'required'
18
+ > & {
19
+ color?: 'base' | 'brand'
20
+ label?: string
21
+ icon?: string
22
+ }
23
+
24
+ const {
25
+ as = 'div',
26
+ variant = 'outline',
27
+ label,
28
+ icon,
29
+ // input attributes
30
+ name,
31
+ placeholder,
32
+ type,
33
+ value,
34
+ disabled,
35
+ required,
36
+ ...rest
37
+ } = Astro.props
38
+ ---
39
+
40
+ <Component
41
+ class:list={['input']}
42
+ {as}
43
+ {...rest}
44
+ >
45
+ <Label
46
+ for={name}
47
+ text={label}
48
+ />
49
+ <InputElement
50
+ id={name}
51
+ {name}
52
+ {variant}
53
+ {placeholder}
54
+ {type}
55
+ {value}
56
+ {disabled}
57
+ {required}
58
+ />
59
+ <Icon name={icon} />
60
+ </Component>
61
+
62
+ <style is:global lang="scss">
63
+ @import '../../../css/utils.scss';
64
+
65
+ @include component('input') {
66
+ display: flex;
67
+ position: relative;
68
+ flex-direction: column;
69
+ gap: var(--space-1);
70
+ width: 100%;
71
+
72
+ .icon {
73
+ position: absolute;
74
+ top: 50%;
75
+ right: var(--space-3);
76
+ transform: translateY(-50%);
77
+ }
78
+ }
79
+ </style>
@@ -0,0 +1,60 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types'
3
+ import Component from '../../_Component.astro'
4
+
5
+ type Props = HTMLAttributes<'input'> & {
6
+ variant?: 'outline'
7
+ }
8
+
9
+ const { variant = 'outline', type = 'text', ...rest } = Astro.props
10
+ ---
11
+
12
+ <Component
13
+ as="input"
14
+ class="input-element"
15
+ if={true}
16
+ {variant}
17
+ {...rest}
18
+ />
19
+
20
+ <style is:global lang="scss">
21
+ @import '../../../css/utils.scss';
22
+
23
+ @include component('input-element') {
24
+ display: flex;
25
+ position: relative;
26
+ align-items: center;
27
+ outline: none;
28
+ border: 1px solid var(--border);
29
+ border-radius: var(--radius-1);
30
+ background-color: var(--background);
31
+ padding: var(--space-3);
32
+ width: 100%;
33
+ min-width: var(--space-3);
34
+ height: calc(var(--text-1) + 2 * var(--space-4));
35
+ color: var(--text);
36
+ font-weight: var(--font-weight);
37
+ font-size: var(--text-1);
38
+ line-height: 1.25;
39
+ font-family: var(--font-family);
40
+
41
+ &::placeholder {
42
+ color: var(--text);
43
+ }
44
+
45
+ &:hover {
46
+ outline: none;
47
+ }
48
+
49
+ &:focus {
50
+ outline: none;
51
+ box-shadow: inset 0 0 0 2px var(--border);
52
+ }
53
+
54
+ &:disabled {
55
+ opacity: 50%;
56
+ cursor: not-allowed;
57
+ pointer-events: none;
58
+ }
59
+ }
60
+ </style>
@@ -0,0 +1,66 @@
1
+ ---
2
+ import type { Polymorphic } from 'astro/types'
3
+ import '../../../css/utils.scss'
4
+ import Component from '../../_Component.astro'
5
+ import Row from '../../structure/Row.astro'
6
+ import Label from '../../typography/Label.astro'
7
+ import RadioElement from './RadioElement.astro'
8
+
9
+ type Props<As extends 'div'> = Polymorphic<{ as: As }> & {
10
+ options?: string
11
+ } & {
12
+ color?: 'base' | 'brand'
13
+ contrast?: boolean
14
+ }
15
+
16
+ const {
17
+ as = 'div',
18
+ options,
19
+ label,
20
+ contrast,
21
+ icon,
22
+ value,
23
+ disabled,
24
+ required,
25
+ name,
26
+ ...rest
27
+ } = Astro.props
28
+ ---
29
+
30
+ <Component
31
+ class:list={['radio']}
32
+ {as}
33
+ {...rest}
34
+ >
35
+ <Label
36
+ for={name}
37
+ {...typeof label === 'string' ? { text: label } : label}
38
+ />
39
+ {
40
+ options?.map((option: any) => (
41
+ <Row>
42
+ <RadioElement
43
+ value={option}
44
+ id={option}
45
+ />
46
+ <Label
47
+ for={option}
48
+ text={option}
49
+ {contrast}
50
+ />
51
+ </Row>
52
+ ))
53
+ }
54
+ </Component>
55
+
56
+ <style is:global lang="scss">
57
+ @import '../../../css/utils.scss';
58
+
59
+ @include component('radio') {
60
+ display: flex;
61
+ position: relative;
62
+ flex-direction: column;
63
+ gap: var(--space-3);
64
+ width: 100%;
65
+ }
66
+ </style>
@@ -0,0 +1,34 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types'
3
+ import Component from '../../_Component.astro'
4
+
5
+ type Props = HTMLAttributes<'input'> & {
6
+ value?: string
7
+ label?: string
8
+ options?: string[]
9
+ }
10
+
11
+ const { label, value, name, options, ...rest } = Astro.props
12
+ ---
13
+
14
+ <Component
15
+ class:list={['radio-element']}
16
+ if={true}
17
+ as="input"
18
+ type="radio"
19
+ name={name}
20
+ {...rest}
21
+ >
22
+ <slot />
23
+ </Component>
24
+
25
+ <style is:global lang="scss">
26
+ @import '../../../css/utils.scss';
27
+
28
+ @include component('radio-element') {
29
+ display: block;
30
+ width: var(--text-1);
31
+ height: var(--text-1);
32
+ accent-color: var(--color-9);
33
+ }
34
+ </style>
@@ -0,0 +1,90 @@
1
+ ---
2
+ import type {
3
+ ComponentProps,
4
+ HTMLAttributes,
5
+ HTMLTag,
6
+ Polymorphic,
7
+ } from 'astro/types'
8
+ import Component from '../../_Component.astro'
9
+ import Label from '../../typography/Label.astro'
10
+ import Icon from '../Icon.astro'
11
+ import { default as SelectElement } from './SelectElement.astro'
12
+ import SelectOption from './SelectOption.astro'
13
+
14
+ type Props<As extends HTMLTag = 'div'> = Polymorphic<{ as: As }> &
15
+ Pick<ComponentProps<typeof SelectElement>, 'name' | 'required' | 'disabled'> &
16
+ HTMLAttributes<'select'> & {
17
+ color?: 'base' | 'brand'
18
+ label?: string
19
+ placeholder?: string
20
+ options?: string[]
21
+ value?: string
22
+ }
23
+
24
+ const {
25
+ as = 'div',
26
+ label,
27
+ placeholder,
28
+ options,
29
+ value,
30
+ // select attributes
31
+ name,
32
+ required,
33
+ disabled,
34
+ ...rest
35
+ } = Astro.props
36
+ ---
37
+
38
+ <Component
39
+ class:list={['select']}
40
+ {as}
41
+ {...rest}
42
+ >
43
+ <Label
44
+ for={name}
45
+ {...typeof label === 'string' ? { text: label } : label}
46
+ />
47
+ <SelectElement
48
+ id={name}
49
+ {name}
50
+ {required}
51
+ {disabled}
52
+ >
53
+ <SelectOption
54
+ text={placeholder}
55
+ disabled
56
+ selected
57
+ />
58
+ {
59
+ options?.map((option: any) => (
60
+ <SelectOption
61
+ selected={value === option}
62
+ text={option}
63
+ value={option}
64
+ />
65
+ ))
66
+ }
67
+ <slot />
68
+ </SelectElement>
69
+ <Icon name="chevron-down" />
70
+ </Component>
71
+
72
+ <style is:global lang="scss">
73
+ @import '../../../css/utils.scss';
74
+
75
+ @include component('select') {
76
+ display: flex;
77
+ position: relative;
78
+ flex-direction: column;
79
+ gap: var(--space-1);
80
+ width: 100%;
81
+
82
+ .icon {
83
+ position: absolute;
84
+ right: var(--space-4);
85
+ bottom: var(--space-4);
86
+ width: var(--text-1);
87
+ height: var(--text-1);
88
+ }
89
+ }
90
+ </style>
@@ -0,0 +1,56 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types'
3
+ import Component from '../../_Component.astro'
4
+
5
+ type Props = HTMLAttributes<'select'>
6
+
7
+ const { ...rest } = Astro.props
8
+ ---
9
+
10
+ <Component
11
+ class:list={['select-element']}
12
+ as="select"
13
+ {...rest}
14
+ >
15
+ <slot />
16
+ </Component>
17
+
18
+ <style is:global lang="scss">
19
+ @import '../../../css/utils.scss';
20
+
21
+ @include component('select-element') {
22
+ display: flex;
23
+ position: relative;
24
+ align-items: center;
25
+ appearance: none;
26
+ appearance: none;
27
+ outline: none;
28
+ border: 1px solid var(--border);
29
+ border-radius: var(--radius-1);
30
+ background-color: var(--background);
31
+ padding: var(--space-3);
32
+ width: 100%;
33
+ min-width: var(--space-3);
34
+ height: calc(var(--text-1) + 2 * var(--space-4));
35
+ color: var(--text);
36
+ font-weight: var(--font-weight);
37
+ font-size: var(--text-1);
38
+ line-height: 1.25;
39
+ font-family: var(--font-family);
40
+
41
+ &:hover {
42
+ outline: none;
43
+ }
44
+
45
+ &:focus {
46
+ outline: none;
47
+ box-shadow: inset 0 0 0 2px var(--border);
48
+ }
49
+
50
+ &:disabled {
51
+ opacity: 50%;
52
+ cursor: not-allowed;
53
+ pointer-events: none;
54
+ }
55
+ }
56
+ </style>
@@ -0,0 +1,32 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types'
3
+ import Component from '../../_Component.astro'
4
+
5
+ type Props = HTMLAttributes<'option'> & {
6
+ text?: string
7
+ }
8
+
9
+ const { value, text, ...rest } = Astro.props
10
+ ---
11
+
12
+ <Component
13
+ class:list={['select-option']}
14
+ as="option"
15
+ value={value ?? text}
16
+ text={text ?? value}
17
+ {...rest}
18
+ >
19
+ <slot />
20
+ </Component>
21
+
22
+ <style is:global lang="scss">
23
+ @import '../../../css/utils.scss';
24
+
25
+ @include component('select-option') {
26
+ color: var(--text);
27
+ font-weight: var(--font-weight);
28
+ font-size: var(--text-1);
29
+ line-height: 1;
30
+ font-family: var(--font-family);
31
+ }
32
+ </style>
@@ -0,0 +1,55 @@
1
+ ---
2
+ import type { ComponentProps, Polymorphic } from 'astro/types'
3
+ import Component from '../../_Component.astro'
4
+ import Label from '../../typography/Label.astro'
5
+ import SwitchElement from './SwitchElement.astro'
6
+
7
+ type Props<As extends 'div'> = Polymorphic<{ as: As }> &
8
+ Pick<ComponentProps<typeof SwitchElement>, 'name' | 'checked'> & {
9
+ color?: 'base' | 'brand'
10
+ true?: string
11
+ false?: string
12
+ }
13
+
14
+ const {
15
+ as = 'div',
16
+ name,
17
+ checked,
18
+ trueLabel,
19
+ falseLabel,
20
+ ...rest
21
+ } = Astro.props
22
+ ---
23
+
24
+ <Component
25
+ structure="row"
26
+ class:list={['switch']}
27
+ {as}
28
+ {...rest}
29
+ >
30
+ <Label
31
+ for={name}
32
+ text={falseLabel}
33
+ />
34
+ <SwitchElement
35
+ id={name}
36
+ {name}
37
+ {checked}
38
+ />
39
+ <Label
40
+ for={name}
41
+ text={trueLabel}
42
+ />
43
+ </Component>
44
+
45
+ <style is:global lang="scss">
46
+ @import '../../../css/utils.scss';
47
+
48
+ @include component('switch') {
49
+ position: relative;
50
+ align-items: center;
51
+ gap: var(--space-1);
52
+
53
+ width: 100%;
54
+ }
55
+ </style>
@@ -1,22 +1,24 @@
1
1
  ---
2
- import type { ComponentProps, HTMLTag, Polymorphic } from 'astro/types'
3
- import Component from '../_Component.astro'
2
+ import type { HTMLAttributes } from 'astro/types'
3
+ import Component from '../../_Component.astro'
4
4
 
5
- type Props<As extends HTMLTag = 'span'> = Polymorphic<{ as: As }> &
6
- ComponentProps<typeof Component> & {
7
- name?: string
8
- }
5
+ type Props = HTMLAttributes<'input'> & {
6
+ name?: string
7
+ color?: 'base' | 'brand'
8
+ }
9
9
 
10
- const { as = 'input', name, ...rest } = Astro.props
10
+ const { name, checked, ...rest } = Astro.props
11
11
  ---
12
12
 
13
13
  <Component
14
14
  as="label"
15
- class:list="switch"
15
+ for={name}
16
+ class:list="switch-element"
16
17
  if={true}
17
18
  {...rest}
18
19
  >
19
20
  <input
21
+ {checked}
20
22
  name={name}
21
23
  type="checkbox"
22
24
  class="checkbox"
@@ -25,9 +27,9 @@ const { as = 'input', name, ...rest } = Astro.props
25
27
  </Component>
26
28
 
27
29
  <style is:global lang="scss">
28
- @import '../../css/utils.scss';
30
+ @import '../../../css/utils.scss';
29
31
 
30
- @include component('switch') {
32
+ @include component('switch-element') {
31
33
  display: block;
32
34
  position: relative;
33
35
  transition: var(--transition);
@@ -39,9 +41,9 @@ const { as = 'input', name, ...rest } = Astro.props
39
41
  padding: var(--space-1);
40
42
  width: fit-content;
41
43
  min-width: calc(
42
- (var(--text-label) + 2 * var(--element-1) * 2) + 2 * var(--space-1)
44
+ (var(--text-1) + 2 * var(--space-2) * 2) + 2 * var(--space-1)
43
45
  );
44
- height: calc(var(--text-label) + 2 * var(--element-1));
46
+ height: calc(var(--text-1) + 2 * var(--space-2));
45
47
 
46
48
  .checkbox {
47
49
  position: absolute;
@@ -61,7 +63,7 @@ const { as = 'input', name, ...rest } = Astro.props
61
63
 
62
64
  .checkbox:checked ~ .checkmark {
63
65
  transform: translateX(100%);
64
- background-color: var(--solid);
66
+ background-color: var(--color-12);
65
67
  }
66
68
 
67
69
  &:hover {