loseta 0.16.0 → 0.18.0

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 (138) hide show
  1. package/README.md +33 -8
  2. package/dist/commands/add.d.ts +8 -0
  3. package/dist/commands/add.js +60 -15
  4. package/dist/commands/add.js.map +1 -1
  5. package/dist/commands/init.js +2 -1
  6. package/dist/commands/init.js.map +1 -1
  7. package/dist/config.d.ts +7 -0
  8. package/dist/config.js +13 -0
  9. package/dist/config.js.map +1 -1
  10. package/dist/imports.d.ts +4 -0
  11. package/dist/imports.js +30 -2
  12. package/dist/imports.js.map +1 -1
  13. package/dist/install.d.ts +23 -3
  14. package/dist/install.js +84 -5
  15. package/dist/install.js.map +1 -1
  16. package/dist/style-switch.js +2 -1
  17. package/dist/style-switch.js.map +1 -1
  18. package/dist/types.d.ts +11 -0
  19. package/dist/ui.js +4 -1
  20. package/dist/ui.js.map +1 -1
  21. package/package.json +4 -3
  22. package/registry/behaviors/code-block.js +106 -0
  23. package/registry/behaviors/combobox.js +237 -0
  24. package/registry/behaviors/command.js +105 -0
  25. package/registry/behaviors/core.js +302 -0
  26. package/registry/behaviors/dialog.js +97 -0
  27. package/registry/behaviors/listbox.js +135 -0
  28. package/registry/behaviors/menu.js +586 -0
  29. package/registry/behaviors/popover.js +127 -0
  30. package/registry/behaviors/select.js +196 -0
  31. package/registry/behaviors/tabs.js +95 -0
  32. package/registry/behaviors/toast.js +137 -0
  33. package/registry/components/badge.css +4 -7
  34. package/registry/components/breadcrumb.css +9 -1
  35. package/registry/components/calendar.css +39 -0
  36. package/registry/components/card.css +5 -0
  37. package/registry/components/code-block.css +19 -0
  38. package/registry/components/input-otp.css +103 -10
  39. package/registry/components/kbd.css +8 -0
  40. package/registry/components/native-select.css +6 -0
  41. package/registry/components/select.css +3 -0
  42. package/registry/components/tooltip.css +295 -144
  43. package/registry/examples/alert-dialog.html +21 -21
  44. package/registry/examples/badge.html +37 -0
  45. package/registry/examples/breadcrumb.html +86 -6
  46. package/registry/examples/button-group.html +3 -3
  47. package/registry/examples/calendar.html +687 -51
  48. package/registry/examples/card.html +190 -4
  49. package/registry/examples/code-block.html +10 -4
  50. package/registry/examples/combobox.html +2 -0
  51. package/registry/examples/command.html +17 -17
  52. package/registry/examples/context-menu.html +18 -18
  53. package/registry/examples/dialog.html +15 -15
  54. package/registry/examples/drawer.html +22 -22
  55. package/registry/examples/input-otp.html +116 -11
  56. package/registry/examples/kbd.html +90 -2
  57. package/registry/examples/native-select.html +83 -2
  58. package/registry/examples/select.html +206 -6
  59. package/registry/examples/sheet.html +23 -23
  60. package/registry/examples/sidebar.html +11 -11
  61. package/registry/examples/toast.html +11 -0
  62. package/registry/examples/tooltip.html +75 -70
  63. package/registry/primitives/dialog-shell.css +5 -0
  64. package/registry/primitives/menu.css +15 -3
  65. package/registry/registry.json +231 -9
  66. package/registry/schema.json +17 -0
  67. package/registry/styles/luma/badge.css +28 -0
  68. package/registry/styles/luma/breadcrumb.css +2 -1
  69. package/registry/styles/luma/calendar.css +62 -0
  70. package/registry/styles/luma/card.css +9 -27
  71. package/registry/styles/luma/input-otp.css +79 -36
  72. package/registry/styles/luma/native-select.css +9 -2
  73. package/registry/styles/luma/primitives/listbox.css +8 -0
  74. package/registry/styles/luma/select.css +7 -2
  75. package/registry/styles/luma/tooltip.css +29 -16
  76. package/registry/styles/lyra/badge.css +28 -0
  77. package/registry/styles/lyra/breadcrumb.css +2 -1
  78. package/registry/styles/lyra/calendar.css +62 -0
  79. package/registry/styles/lyra/card.css +9 -27
  80. package/registry/styles/lyra/input-otp.css +79 -36
  81. package/registry/styles/lyra/native-select.css +6 -1
  82. package/registry/styles/lyra/primitives/listbox.css +8 -0
  83. package/registry/styles/lyra/select.css +6 -1
  84. package/registry/styles/lyra/tooltip.css +29 -16
  85. package/registry/styles/maia/badge.css +29 -0
  86. package/registry/styles/maia/breadcrumb.css +2 -1
  87. package/registry/styles/maia/calendar.css +62 -0
  88. package/registry/styles/maia/card.css +9 -27
  89. package/registry/styles/maia/input-otp.css +79 -36
  90. package/registry/styles/maia/native-select.css +9 -2
  91. package/registry/styles/maia/primitives/listbox.css +8 -0
  92. package/registry/styles/maia/select.css +7 -2
  93. package/registry/styles/maia/tooltip.css +29 -16
  94. package/registry/styles/mira/badge.css +32 -0
  95. package/registry/styles/mira/breadcrumb.css +2 -1
  96. package/registry/styles/mira/calendar.css +62 -0
  97. package/registry/styles/mira/card.css +9 -27
  98. package/registry/styles/mira/input-otp.css +79 -36
  99. package/registry/styles/mira/native-select.css +7 -2
  100. package/registry/styles/mira/primitives/listbox.css +8 -0
  101. package/registry/styles/mira/select.css +7 -2
  102. package/registry/styles/mira/tooltip.css +29 -16
  103. package/registry/styles/nova/badge.css +28 -0
  104. package/registry/styles/nova/breadcrumb.css +2 -1
  105. package/registry/styles/nova/calendar.css +62 -0
  106. package/registry/styles/nova/card.css +9 -27
  107. package/registry/styles/nova/input-otp.css +79 -36
  108. package/registry/styles/nova/native-select.css +9 -2
  109. package/registry/styles/nova/primitives/listbox.css +8 -0
  110. package/registry/styles/nova/select.css +7 -2
  111. package/registry/styles/nova/tooltip.css +29 -16
  112. package/registry/styles/rhea/badge.css +28 -0
  113. package/registry/styles/rhea/breadcrumb.css +2 -1
  114. package/registry/styles/rhea/calendar.css +62 -0
  115. package/registry/styles/rhea/card.css +9 -27
  116. package/registry/styles/rhea/input-otp.css +79 -36
  117. package/registry/styles/rhea/native-select.css +9 -2
  118. package/registry/styles/rhea/primitives/listbox.css +8 -0
  119. package/registry/styles/rhea/select.css +7 -2
  120. package/registry/styles/rhea/tooltip.css +29 -16
  121. package/registry/styles/sera/badge.css +29 -1
  122. package/registry/styles/sera/breadcrumb.css +2 -1
  123. package/registry/styles/sera/calendar.css +66 -0
  124. package/registry/styles/sera/card.css +9 -27
  125. package/registry/styles/sera/input-otp.css +80 -37
  126. package/registry/styles/sera/native-select.css +9 -2
  127. package/registry/styles/sera/primitives/listbox.css +8 -0
  128. package/registry/styles/sera/select.css +7 -2
  129. package/registry/styles/sera/tooltip.css +29 -16
  130. package/registry/styles/vega/badge.css +28 -0
  131. package/registry/styles/vega/breadcrumb.css +2 -1
  132. package/registry/styles/vega/calendar.css +62 -0
  133. package/registry/styles/vega/card.css +9 -27
  134. package/registry/styles/vega/input-otp.css +79 -36
  135. package/registry/styles/vega/native-select.css +9 -2
  136. package/registry/styles/vega/primitives/listbox.css +8 -0
  137. package/registry/styles/vega/select.css +7 -2
  138. package/registry/styles/vega/tooltip.css +29 -16
@@ -1,6 +1,8 @@
1
1
  /* Card */
2
2
  @layer loseta.style {
3
3
  .card {
4
+ --card-spacing: 1rem;
5
+
4
6
  overflow: hidden;
5
7
  border-radius: var(--radius-xl);
6
8
  background-color: var(--card);
@@ -19,15 +21,11 @@
19
21
  border-bottom-left-radius: var(--radius-xl);
20
22
  }
21
23
 
22
- &:not([data-size]),
23
- &[data-size='default'] {
24
- gap: 1rem;
25
- padding-block: 1rem;
26
- }
24
+ gap: var(--card-spacing);
25
+ padding-block: var(--card-spacing);
27
26
 
28
27
  &[data-size='sm'] {
29
- gap: 0.75rem;
30
- padding-block: 0.75rem;
28
+ --card-spacing: 0.75rem;
31
29
  }
32
30
 
33
31
  &:is(:not([data-size]), [data-size]):has(> footer) {
@@ -42,21 +40,13 @@
42
40
  gap: 0.25rem;
43
41
  border-top-left-radius: var(--radius-xl);
44
42
  border-top-right-radius: var(--radius-xl);
45
- padding-inline: 1rem;
43
+ padding-inline: var(--card-spacing);
46
44
 
47
45
  &[data-separator='bottom'] {
48
46
  border-bottom-style: solid;
49
47
  border-bottom-width: 1px;
50
48
  border-bottom-color: var(--border);
51
- padding-bottom: 1rem;
52
- }
53
- }
54
-
55
- &[data-size='sm'] > header {
56
- padding-inline: 0.75rem;
57
-
58
- &[data-separator='bottom'] {
59
- padding-bottom: 0.75rem;
49
+ padding-bottom: var(--card-spacing);
60
50
  }
61
51
  }
62
52
 
@@ -78,11 +68,7 @@
78
68
  }
79
69
 
80
70
  > section {
81
- padding-inline: 1rem;
82
- }
83
-
84
- &[data-size='sm'] > section {
85
- padding-inline: 0.75rem;
71
+ padding-inline: var(--card-spacing);
86
72
  }
87
73
 
88
74
  > footer {
@@ -92,11 +78,7 @@
92
78
  border-top-width: 1px;
93
79
  border-top-color: var(--border);
94
80
  background-color: color-mix(in oklab, var(--muted) 50%, transparent);
95
- padding: 1rem;
96
- }
97
-
98
- &[data-size='sm'] > footer {
99
- padding: 0.75rem;
81
+ padding: var(--card-spacing);
100
82
  }
101
83
  }
102
84
  }
@@ -1,59 +1,102 @@
1
1
  /* Input OTP */
2
2
  @layer loseta.style {
3
3
  .input-otp {
4
- height: 2.5rem;
5
- border-style: solid;
6
- border-width: 1px;
7
- border-color: var(--input);
4
+ --otp-cell-size: 2.5rem;
5
+ --otp-gap: 0.5rem;
6
+
8
7
  border-radius: var(--radius-lg);
9
- background-color: light-dark(
10
- transparent,
11
- color-mix(in oklab, var(--input) 30%, transparent)
12
- );
13
- padding-inline: 0.5rem;
8
+ font-family:
9
+ var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace);
14
10
  font-size: var(--text-lg);
15
- line-height: var(--text-lg--line-height);
16
- letter-spacing: 0.5em;
17
- text-indent: 0.5em;
18
- transition-property: color, background-color, border-color, box-shadow;
19
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
20
- transition-duration: 150ms;
21
11
 
22
- &::selection {
23
- background-color: var(--primary);
24
- color: var(--primary-foreground);
12
+ > [data-slot='cell'] {
13
+ border-style: solid;
14
+ border-width: 1px;
15
+ border-color: var(--input);
16
+ border-radius: var(--radius-lg);
17
+ background-color: light-dark(
18
+ transparent,
19
+ color-mix(in oklab, var(--input) 30%, transparent)
20
+ );
21
+ transition-property: border-color;
22
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
23
+ transition-duration: 150ms;
25
24
  }
26
25
 
27
- &:focus-visible {
26
+ > [data-slot='entry']::after {
27
+ border-style: solid;
28
+ border-width: 1px;
28
29
  border-color: var(--ring);
30
+ border-radius: var(--radius-lg);
29
31
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
32
+ transition-property: border-color, box-shadow;
33
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
34
+ transition-duration: 150ms;
30
35
  }
31
36
 
32
- &[aria-invalid='true'] {
33
- border-color: light-dark(
34
- var(--destructive),
35
- color-mix(in oklab, var(--destructive) 50%, transparent)
36
- );
37
- box-shadow: 0 0 0 3px light-dark(
38
- color-mix(in oklab, var(--destructive) 20%, transparent),
39
- color-mix(in oklab, var(--destructive) 40%, transparent)
40
- );
37
+ > [data-slot='entry'] > input::selection {
38
+ background-color: color-mix(in oklab, var(--primary) 35%, transparent);
39
+ }
40
+
41
+ /* A complete code has no next cell, so the focus ring covers the row. */
42
+ &:has(> [data-slot='entry'] > input:valid:focus-visible) {
43
+ > [data-slot='cell'] {
44
+ border-color: var(--ring);
45
+ }
46
+ }
47
+
48
+ &:has(> [data-slot='entry'] > input[aria-invalid='true']) {
49
+ > [data-slot='cell'],
50
+ > [data-slot='entry']::after {
51
+ border-color: light-dark(
52
+ var(--destructive),
53
+ color-mix(in oklab, var(--destructive) 50%, transparent)
54
+ );
55
+ box-shadow: 0 0 0 3px light-dark(
56
+ color-mix(in oklab, var(--destructive) 20%, transparent),
57
+ color-mix(in oklab, var(--destructive) 40%, transparent)
58
+ );
59
+ }
60
+ }
61
+
62
+ &:has(> [data-slot='entry'] > input[aria-invalid='true']:valid:focus-visible) {
63
+ > [data-slot='cell'] {
64
+ box-shadow: 0 0 0 3px light-dark(
65
+ color-mix(in oklab, var(--destructive) 20%, transparent),
66
+ color-mix(in oklab, var(--destructive) 40%, transparent)
67
+ );
68
+ }
41
69
  }
42
70
 
43
71
  &[data-size='sm'] {
44
- height: 2rem;
72
+ --otp-cell-size: 2rem;
73
+ --otp-gap: 0.375rem;
74
+
45
75
  font-size: var(--text-base);
46
- line-height: var(--text-base--line-height);
47
- letter-spacing: 0.35em;
48
- text-indent: 0.35em;
49
76
  }
50
77
 
51
78
  &[data-size='lg'] {
52
- height: 3rem;
79
+ --otp-cell-size: 3rem;
80
+ --otp-gap: 0.625rem;
81
+
53
82
  font-size: var(--text-xl);
54
- line-height: var(--text-xl--line-height);
55
- letter-spacing: 0.6em;
56
- text-indent: 0.6em;
83
+ }
84
+
85
+ &[data-spacing='joined'] {
86
+ > [data-slot='cell']:not(:first-child) {
87
+ border-start-start-radius: 0;
88
+ border-end-start-radius: 0;
89
+ border-inline-start-width: 0;
90
+ }
91
+
92
+ > [data-slot='cell']:not(:has(+ [data-slot='entry'])) {
93
+ border-start-end-radius: 0;
94
+ border-end-end-radius: 0;
95
+ }
96
+
97
+ > [data-slot='entry']::after {
98
+ border-radius: 0;
99
+ }
57
100
  }
58
101
  }
59
102
  }
@@ -14,8 +14,8 @@
14
14
  padding-block: 0.25rem;
15
15
  padding-inline-start: 0.625rem;
16
16
  padding-inline-end: 2rem;
17
- font-size: var(--text-sm);
18
- line-height: var(--text-sm--line-height);
17
+ font-size: var(--text-base);
18
+ line-height: 1.5;
19
19
  transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke;
20
20
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
21
21
  transition-duration: 150ms;
@@ -61,12 +61,19 @@
61
61
  height: 1.75rem;
62
62
  border-radius: min(var(--radius-md), 10px);
63
63
  padding-block: 0.125rem;
64
+ font-size: var(--text-sm);
65
+ line-height: var(--text-sm--line-height);
64
66
  }
65
67
 
66
68
  background-image: var(--chevron-down-icon);
67
69
  background-size: 1rem;
68
70
  background-position: center right 0.625rem;
69
71
  background-repeat: no-repeat;
72
+
73
+ @media (width >= 48rem) {
74
+ font-size: var(--text-sm);
75
+ line-height: var(--text-sm--line-height);
76
+ }
70
77
  }
71
78
 
72
79
  .native-select:dir(rtl) {
@@ -43,6 +43,14 @@
43
43
  }
44
44
  }
45
45
 
46
+ & [role='separator'] {
47
+ flex-shrink: 0;
48
+ block-size: 1px;
49
+ margin-block: 0.25rem;
50
+ margin-inline: -0.25rem;
51
+ background-color: var(--border);
52
+ }
53
+
46
54
  & [data-slot='indicator'] {
47
55
  position: absolute;
48
56
  inset-inline-end: 0.5rem;
@@ -12,8 +12,8 @@
12
12
  color-mix(in oklab, var(--input) 30%, transparent)
13
13
  );
14
14
  padding-inline: 0.5rem;
15
- font-size: var(--text-sm);
16
- line-height: var(--text-sm--line-height);
15
+ font-size: var(--text-base);
16
+ line-height: 1.5;
17
17
  font-weight: 400;
18
18
  text-align: start;
19
19
  transition-property: color, background-color, border-color, box-shadow;
@@ -48,6 +48,11 @@
48
48
  height: 1rem;
49
49
  color: var(--muted-foreground);
50
50
  }
51
+
52
+ @media (width >= 48rem) {
53
+ font-size: var(--text-sm);
54
+ line-height: var(--text-sm--line-height);
55
+ }
51
56
  }
52
57
 
53
58
  &[data-size='sm'] > button {
@@ -1,22 +1,35 @@
1
1
  /* Tooltip */
2
2
  @layer loseta.style {
3
- .tooltip[data-tooltip] {
4
- &::before {
5
- display: inline-flex;
6
- align-items: center;
7
- gap: 0.375rem;
8
- border-radius: var(--radius-md);
9
- background-color: var(--foreground);
10
- padding-inline: 0.75rem;
11
- padding-block: 0.375rem;
12
- font-size: var(--text-xs);
13
- line-height: var(--text-xs--line-height);
14
- color: var(--background);
15
- }
3
+ .tooltip {
4
+ --tooltip-radius: var(--radius-md);
5
+ }
6
+
7
+ .tooltip[data-tooltip]::before,
8
+ .tooltip > [data-slot='content'] {
9
+ display: inline-flex;
10
+ align-items: center;
11
+ gap: 0.375rem;
12
+ border-radius: var(--tooltip-radius);
13
+ background-color: var(--foreground);
14
+ padding-inline: 0.75rem;
15
+ padding-block: 0.375rem;
16
+ font-size: var(--text-xs);
17
+ line-height: var(--text-xs--line-height);
18
+ color: var(--background);
19
+ }
20
+
21
+ .tooltip::after {
22
+ background-color: var(--foreground);
23
+ }
24
+
25
+ .tooltip > [data-slot='content'] .kbd {
26
+ background-color: color-mix(in oklab, var(--background) 20%, transparent);
27
+ color: var(--background);
28
+ }
16
29
 
17
- &[data-arrow]::after {
18
- border-radius: 2px;
19
- background-color: var(--foreground);
30
+ @media (forced-colors: active) {
31
+ .tooltip::after {
32
+ background-color: CanvasText;
20
33
  }
21
34
  }
22
35
  }
@@ -21,6 +21,14 @@
21
21
  height: var(--icon-size, 0.75rem);
22
22
  }
23
23
 
24
+ &:has(*:is([data-icon='inline-end'])) {
25
+ padding-inline-end: 0.375rem;
26
+ }
27
+
28
+ &:has(*:is([data-icon='inline-start'])) {
29
+ padding-inline-start: 0.375rem;
30
+ }
31
+
24
32
  &:not([data-variant]),
25
33
  &[data-variant='primary'] {
26
34
  background-color: var(--primary);
@@ -80,5 +88,25 @@
80
88
  text-decoration-line: underline;
81
89
  }
82
90
  }
91
+
92
+ &:focus-visible {
93
+ border-color: var(--ring);
94
+ box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
95
+ }
96
+
97
+ &[aria-invalid='true'] {
98
+ border-color: var(--destructive);
99
+ box-shadow: 0 0 0 3px light-dark(
100
+ color-mix(in oklab, var(--destructive) 20%, transparent),
101
+ color-mix(in oklab, var(--destructive) 40%, transparent)
102
+ );
103
+ }
104
+
105
+ &[data-variant='destructive']:focus-visible {
106
+ box-shadow: 0 0 0 3px light-dark(
107
+ color-mix(in oklab, var(--destructive) 20%, transparent),
108
+ color-mix(in oklab, var(--destructive) 40%, transparent)
109
+ );
110
+ }
83
111
  }
84
112
  }
@@ -12,7 +12,8 @@
12
12
  gap: 0.25rem;
13
13
  }
14
14
 
15
- :is(a, button) {
15
+ > ol > li > :is(a, button),
16
+ > ol > li > :is(.dropdown-menu, .popover) > button {
16
17
  border-radius: var(--radius-md);
17
18
  transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke;
18
19
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
@@ -29,6 +29,40 @@
29
29
  }
30
30
  }
31
31
 
32
+ > header > [data-slot='caption'] {
33
+ gap: 0.25rem;
34
+ font-size: var(--text-sm);
35
+ line-height: var(--text-sm--line-height);
36
+ font-weight: 500;
37
+ }
38
+
39
+ > header [data-slot='dropdown'] > select {
40
+ height: 1.75rem;
41
+ padding-inline: 0.375rem 1.25rem;
42
+ border-radius: var(--radius-2xl);
43
+ color: var(--foreground);
44
+ font-size: var(--text-sm);
45
+ line-height: var(--text-sm--line-height);
46
+ font-weight: 500;
47
+ transition-property: color, background-color, box-shadow;
48
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
49
+ transition-duration: 150ms;
50
+
51
+ &:hover {
52
+ background-color: var(--muted);
53
+ }
54
+
55
+ &:focus-visible {
56
+ box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
57
+ }
58
+ }
59
+
60
+ > header [data-slot='dropdown'] > svg {
61
+ width: 0.75rem;
62
+ height: 0.75rem;
63
+ color: var(--muted-foreground);
64
+ }
65
+
32
66
  [data-slot='title'] {
33
67
  font-size: var(--text-sm);
34
68
  line-height: var(--text-sm--line-height);
@@ -71,6 +105,34 @@
71
105
  color: var(--primary-foreground);
72
106
  }
73
107
 
108
+ table[aria-multiselectable='true'] td[aria-selected='true'] {
109
+ border-radius: var(--radius-2xl);
110
+ background-color: var(--muted);
111
+ color: var(--foreground);
112
+ }
113
+
114
+ table[aria-multiselectable='true']
115
+ td[aria-selected='true']
116
+ + td[aria-selected='true'] {
117
+ border-start-start-radius: 0;
118
+ border-end-start-radius: 0;
119
+ }
120
+
121
+ table[aria-multiselectable='true']
122
+ td[aria-selected='true']:has(+ td[aria-selected='true']) {
123
+ border-start-end-radius: 0;
124
+ border-end-end-radius: 0;
125
+ }
126
+
127
+ table[aria-multiselectable='true'] td[aria-selected='true'] > button {
128
+ background-color: transparent;
129
+ color: inherit;
130
+
131
+ &:hover {
132
+ background-color: color-mix(in oklab, var(--foreground) 6%, transparent);
133
+ }
134
+ }
135
+
74
136
  td > button[aria-current='date'] {
75
137
  box-shadow: inset 0 0 0 1px var(--ring);
76
138
  }
@@ -1,6 +1,8 @@
1
1
  /* Card */
2
2
  @layer loseta.style {
3
3
  .card {
4
+ --card-spacing: 1.25rem;
5
+
4
6
  overflow: hidden;
5
7
  border-radius: min(var(--radius-4xl), 24px);
6
8
  background-color: var(--card);
@@ -21,15 +23,11 @@
21
23
  border-bottom-left-radius: min(var(--radius-4xl), 24px);
22
24
  }
23
25
 
24
- &:not([data-size]),
25
- &[data-size='default'] {
26
- gap: 1.25rem;
27
- padding-block: 1.25rem;
28
- }
26
+ gap: var(--card-spacing);
27
+ padding-block: var(--card-spacing);
29
28
 
30
29
  &[data-size='sm'] {
31
- gap: 1rem;
32
- padding-block: 1rem;
30
+ --card-spacing: 1rem;
33
31
  }
34
32
 
35
33
  &:is(:not([data-size]), [data-size]):has(> footer) {
@@ -44,21 +42,13 @@
44
42
  gap: 0.25rem;
45
43
  border-top-left-radius: min(var(--radius-4xl), 24px);
46
44
  border-top-right-radius: min(var(--radius-4xl), 24px);
47
- padding-inline: 1.25rem;
45
+ padding-inline: var(--card-spacing);
48
46
 
49
47
  &[data-separator='bottom'] {
50
48
  border-bottom-style: solid;
51
49
  border-bottom-width: 1px;
52
50
  border-bottom-color: var(--border);
53
- padding-bottom: 1.25rem;
54
- }
55
- }
56
-
57
- &[data-size='sm'] > header {
58
- padding-inline: 1rem;
59
-
60
- &[data-separator='bottom'] {
61
- padding-bottom: 1rem;
51
+ padding-bottom: var(--card-spacing);
62
52
  }
63
53
  }
64
54
 
@@ -80,21 +70,13 @@
80
70
  }
81
71
 
82
72
  > section {
83
- padding-inline: 1.25rem;
84
- }
85
-
86
- &[data-size='sm'] > section {
87
- padding-inline: 1rem;
73
+ padding-inline: var(--card-spacing);
88
74
  }
89
75
 
90
76
  > footer {
91
77
  border-bottom-right-radius: min(var(--radius-4xl), 24px);
92
78
  border-bottom-left-radius: min(var(--radius-4xl), 24px);
93
- padding: 1.25rem;
94
- }
95
-
96
- &[data-size='sm'] > footer {
97
- padding: 1rem;
79
+ padding: var(--card-spacing);
98
80
  }
99
81
  }
100
82
  }
@@ -1,59 +1,102 @@
1
1
  /* Input OTP */
2
2
  @layer loseta.style {
3
3
  .input-otp {
4
- height: 2.5rem;
5
- border-style: solid;
6
- border-width: 1px;
7
- border-color: var(--input);
4
+ --otp-cell-size: 2.5rem;
5
+ --otp-gap: 0.5rem;
6
+
8
7
  border-radius: var(--radius-2xl);
9
- background-color: light-dark(
10
- transparent,
11
- color-mix(in oklab, var(--input) 30%, transparent)
12
- );
13
- padding-inline: 0.5rem;
8
+ font-family:
9
+ var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace);
14
10
  font-size: var(--text-lg);
15
- line-height: var(--text-lg--line-height);
16
- letter-spacing: 0.5em;
17
- text-indent: 0.5em;
18
- transition-property: color, background-color, border-color, box-shadow;
19
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
20
- transition-duration: 150ms;
21
11
 
22
- &::selection {
23
- background-color: var(--primary);
24
- color: var(--primary-foreground);
12
+ > [data-slot='cell'] {
13
+ border-style: solid;
14
+ border-width: 1px;
15
+ border-color: var(--input);
16
+ border-radius: var(--radius-2xl);
17
+ background-color: light-dark(
18
+ transparent,
19
+ color-mix(in oklab, var(--input) 30%, transparent)
20
+ );
21
+ transition-property: border-color;
22
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
23
+ transition-duration: 150ms;
25
24
  }
26
25
 
27
- &:focus-visible {
26
+ > [data-slot='entry']::after {
27
+ border-style: solid;
28
+ border-width: 1px;
28
29
  border-color: var(--ring);
30
+ border-radius: var(--radius-2xl);
29
31
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
32
+ transition-property: border-color, box-shadow;
33
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
34
+ transition-duration: 150ms;
30
35
  }
31
36
 
32
- &[aria-invalid='true'] {
33
- border-color: light-dark(
34
- var(--destructive),
35
- color-mix(in oklab, var(--destructive) 50%, transparent)
36
- );
37
- box-shadow: 0 0 0 3px light-dark(
38
- color-mix(in oklab, var(--destructive) 20%, transparent),
39
- color-mix(in oklab, var(--destructive) 40%, transparent)
40
- );
37
+ > [data-slot='entry'] > input::selection {
38
+ background-color: color-mix(in oklab, var(--primary) 35%, transparent);
39
+ }
40
+
41
+ /* A complete code has no next cell, so the focus ring covers the row. */
42
+ &:has(> [data-slot='entry'] > input:valid:focus-visible) {
43
+ > [data-slot='cell'] {
44
+ border-color: var(--ring);
45
+ }
46
+ }
47
+
48
+ &:has(> [data-slot='entry'] > input[aria-invalid='true']) {
49
+ > [data-slot='cell'],
50
+ > [data-slot='entry']::after {
51
+ border-color: light-dark(
52
+ var(--destructive),
53
+ color-mix(in oklab, var(--destructive) 50%, transparent)
54
+ );
55
+ box-shadow: 0 0 0 3px light-dark(
56
+ color-mix(in oklab, var(--destructive) 20%, transparent),
57
+ color-mix(in oklab, var(--destructive) 40%, transparent)
58
+ );
59
+ }
60
+ }
61
+
62
+ &:has(> [data-slot='entry'] > input[aria-invalid='true']:valid:focus-visible) {
63
+ > [data-slot='cell'] {
64
+ box-shadow: 0 0 0 3px light-dark(
65
+ color-mix(in oklab, var(--destructive) 20%, transparent),
66
+ color-mix(in oklab, var(--destructive) 40%, transparent)
67
+ );
68
+ }
41
69
  }
42
70
 
43
71
  &[data-size='sm'] {
44
- height: 2rem;
72
+ --otp-cell-size: 2rem;
73
+ --otp-gap: 0.375rem;
74
+
45
75
  font-size: var(--text-base);
46
- line-height: var(--text-base--line-height);
47
- letter-spacing: 0.35em;
48
- text-indent: 0.35em;
49
76
  }
50
77
 
51
78
  &[data-size='lg'] {
52
- height: 3rem;
79
+ --otp-cell-size: 3rem;
80
+ --otp-gap: 0.625rem;
81
+
53
82
  font-size: var(--text-xl);
54
- line-height: var(--text-xl--line-height);
55
- letter-spacing: 0.6em;
56
- text-indent: 0.6em;
83
+ }
84
+
85
+ &[data-spacing='joined'] {
86
+ > [data-slot='cell']:not(:first-child) {
87
+ border-start-start-radius: 0;
88
+ border-end-start-radius: 0;
89
+ border-inline-start-width: 0;
90
+ }
91
+
92
+ > [data-slot='cell']:not(:has(+ [data-slot='entry'])) {
93
+ border-start-end-radius: 0;
94
+ border-end-end-radius: 0;
95
+ }
96
+
97
+ > [data-slot='entry']::after {
98
+ border-radius: 0;
99
+ }
57
100
  }
58
101
  }
59
102
  }