loseta 0.16.0 → 0.17.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 (94) hide show
  1. package/package.json +1 -1
  2. package/registry/components/badge.css +4 -7
  3. package/registry/components/breadcrumb.css +9 -1
  4. package/registry/components/calendar.css +39 -0
  5. package/registry/components/card.css +5 -0
  6. package/registry/components/input-otp.css +103 -10
  7. package/registry/components/kbd.css +8 -0
  8. package/registry/components/native-select.css +6 -0
  9. package/registry/components/select.css +3 -0
  10. package/registry/components/tooltip.css +295 -144
  11. package/registry/examples/badge.html +37 -0
  12. package/registry/examples/breadcrumb.html +86 -6
  13. package/registry/examples/calendar.html +687 -51
  14. package/registry/examples/card.html +190 -4
  15. package/registry/examples/input-otp.html +116 -11
  16. package/registry/examples/kbd.html +90 -2
  17. package/registry/examples/native-select.html +83 -2
  18. package/registry/examples/select.html +199 -6
  19. package/registry/examples/sidebar.html +10 -10
  20. package/registry/examples/tooltip.html +75 -70
  21. package/registry/primitives/menu.css +15 -3
  22. package/registry/registry.json +36 -9
  23. package/registry/styles/luma/badge.css +28 -0
  24. package/registry/styles/luma/breadcrumb.css +2 -1
  25. package/registry/styles/luma/calendar.css +62 -0
  26. package/registry/styles/luma/card.css +9 -27
  27. package/registry/styles/luma/input-otp.css +79 -36
  28. package/registry/styles/luma/native-select.css +9 -2
  29. package/registry/styles/luma/primitives/listbox.css +8 -0
  30. package/registry/styles/luma/select.css +7 -2
  31. package/registry/styles/luma/tooltip.css +29 -16
  32. package/registry/styles/lyra/badge.css +28 -0
  33. package/registry/styles/lyra/breadcrumb.css +2 -1
  34. package/registry/styles/lyra/calendar.css +62 -0
  35. package/registry/styles/lyra/card.css +9 -27
  36. package/registry/styles/lyra/input-otp.css +79 -36
  37. package/registry/styles/lyra/native-select.css +6 -1
  38. package/registry/styles/lyra/primitives/listbox.css +8 -0
  39. package/registry/styles/lyra/select.css +6 -1
  40. package/registry/styles/lyra/tooltip.css +29 -16
  41. package/registry/styles/maia/badge.css +29 -0
  42. package/registry/styles/maia/breadcrumb.css +2 -1
  43. package/registry/styles/maia/calendar.css +62 -0
  44. package/registry/styles/maia/card.css +9 -27
  45. package/registry/styles/maia/input-otp.css +79 -36
  46. package/registry/styles/maia/native-select.css +9 -2
  47. package/registry/styles/maia/primitives/listbox.css +8 -0
  48. package/registry/styles/maia/select.css +7 -2
  49. package/registry/styles/maia/tooltip.css +29 -16
  50. package/registry/styles/mira/badge.css +32 -0
  51. package/registry/styles/mira/breadcrumb.css +2 -1
  52. package/registry/styles/mira/calendar.css +62 -0
  53. package/registry/styles/mira/card.css +9 -27
  54. package/registry/styles/mira/input-otp.css +79 -36
  55. package/registry/styles/mira/native-select.css +7 -2
  56. package/registry/styles/mira/primitives/listbox.css +8 -0
  57. package/registry/styles/mira/select.css +7 -2
  58. package/registry/styles/mira/tooltip.css +29 -16
  59. package/registry/styles/nova/badge.css +28 -0
  60. package/registry/styles/nova/breadcrumb.css +2 -1
  61. package/registry/styles/nova/calendar.css +62 -0
  62. package/registry/styles/nova/card.css +9 -27
  63. package/registry/styles/nova/input-otp.css +79 -36
  64. package/registry/styles/nova/native-select.css +9 -2
  65. package/registry/styles/nova/primitives/listbox.css +8 -0
  66. package/registry/styles/nova/select.css +7 -2
  67. package/registry/styles/nova/tooltip.css +29 -16
  68. package/registry/styles/rhea/badge.css +28 -0
  69. package/registry/styles/rhea/breadcrumb.css +2 -1
  70. package/registry/styles/rhea/calendar.css +62 -0
  71. package/registry/styles/rhea/card.css +9 -27
  72. package/registry/styles/rhea/input-otp.css +79 -36
  73. package/registry/styles/rhea/native-select.css +9 -2
  74. package/registry/styles/rhea/primitives/listbox.css +8 -0
  75. package/registry/styles/rhea/select.css +7 -2
  76. package/registry/styles/rhea/tooltip.css +29 -16
  77. package/registry/styles/sera/badge.css +29 -1
  78. package/registry/styles/sera/breadcrumb.css +2 -1
  79. package/registry/styles/sera/calendar.css +66 -0
  80. package/registry/styles/sera/card.css +9 -27
  81. package/registry/styles/sera/input-otp.css +80 -37
  82. package/registry/styles/sera/native-select.css +9 -2
  83. package/registry/styles/sera/primitives/listbox.css +8 -0
  84. package/registry/styles/sera/select.css +7 -2
  85. package/registry/styles/sera/tooltip.css +29 -16
  86. package/registry/styles/vega/badge.css +28 -0
  87. package/registry/styles/vega/breadcrumb.css +2 -1
  88. package/registry/styles/vega/calendar.css +62 -0
  89. package/registry/styles/vega/card.css +9 -27
  90. package/registry/styles/vega/input-otp.css +79 -36
  91. package/registry/styles/vega/native-select.css +9 -2
  92. package/registry/styles/vega/primitives/listbox.css +8 -0
  93. package/registry/styles/vega/select.css +7 -2
  94. package/registry/styles/vega/tooltip.css +29 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loseta",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Native CSS component scaffolds with the shadcn feel.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -8,14 +8,11 @@
8
8
  justify-content: center;
9
9
  overflow: hidden;
10
10
  white-space: nowrap;
11
+ outline-style: none;
11
12
 
12
- &:focus-visible {
13
- border-color: var(--ring);
14
- box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
15
- }
16
-
17
- &[aria-invalid='true'] {
18
- border-color: var(--destructive);
13
+ @media (forced-colors: active) {
14
+ outline: 2px solid transparent;
15
+ outline-offset: 2px;
19
16
  }
20
17
 
21
18
  > svg {
@@ -27,7 +27,8 @@
27
27
  }
28
28
  }
29
29
 
30
- :is(a, button) {
30
+ > ol > li > :is(a, button),
31
+ > ol > li > :is(.dropdown-menu, .popover) > button {
31
32
  outline-style: none;
32
33
 
33
34
  @media (forced-colors: active) {
@@ -36,6 +37,13 @@
36
37
  }
37
38
  }
38
39
 
40
+ > ol > li > button,
41
+ > ol > li > :is(.dropdown-menu, .popover) > button {
42
+ display: inline-flex;
43
+ align-items: center;
44
+ gap: 0.25rem;
45
+ }
46
+
39
47
  [aria-current='page'] {
40
48
  cursor: default;
41
49
  }
@@ -22,6 +22,45 @@
22
22
  }
23
23
  }
24
24
 
25
+ > header > [data-slot='caption'] {
26
+ display: inline-flex;
27
+ align-items: center;
28
+ justify-content: center;
29
+ }
30
+
31
+ > header [data-slot='dropdown'] {
32
+ position: relative;
33
+ display: inline-flex;
34
+ align-items: center;
35
+ }
36
+
37
+ > header [data-slot='dropdown'] > select {
38
+ appearance: none;
39
+ border: 0;
40
+ background-color: transparent;
41
+ color: inherit;
42
+ font: inherit;
43
+ cursor: pointer;
44
+ outline-style: none;
45
+
46
+ @media (forced-colors: active) {
47
+ outline: 2px solid transparent;
48
+ outline-offset: 2px;
49
+ }
50
+ }
51
+
52
+ > header [data-slot='dropdown'] > svg {
53
+ position: absolute;
54
+ inset-block-start: 50%;
55
+ inset-inline-end: 0.375rem;
56
+ translate: 0 -50%;
57
+ pointer-events: none;
58
+ }
59
+
60
+ &:dir(rtl) > header > button > svg {
61
+ rotate: 180deg;
62
+ }
63
+
25
64
  table {
26
65
  width: 100%;
27
66
  table-layout: fixed;
@@ -4,6 +4,11 @@
4
4
  display: flex;
5
5
  flex-direction: column;
6
6
 
7
+ > img {
8
+ display: block;
9
+ inline-size: 100%;
10
+ }
11
+
7
12
  > header {
8
13
  container-type: inline-size;
9
14
  container-name: card-header;
@@ -1,26 +1,119 @@
1
1
  /* Input OTP */
2
2
  @layer loseta.components {
3
+ /* The root is a label: clicking any cell focuses the input. The cells define
4
+ the row width; the content-sized input sits in an overlay entry and its
5
+ trailing indicator tracks the next cell. */
3
6
  .input-otp {
4
- display: block;
5
- width: 100%;
6
- min-width: 0;
7
- outline-style: none;
8
- text-align: center;
7
+ --otp-cell-size: 2.5rem;
8
+ --otp-gap: 0.5rem;
9
+ /* Joined mode zeroes the effective gap without overriding the style. */
10
+ --_otp-gap: var(--otp-gap);
11
+
12
+ position: relative;
13
+ display: grid;
14
+ grid-auto-columns: var(--otp-cell-size);
15
+ grid-auto-flow: column;
16
+ gap: var(--_otp-gap);
17
+ max-width: max-content;
18
+ /* Clip the input's caret gutter, but let the active-slot ring paint out. */
19
+ clip-path: inset(-6px);
20
+ cursor: text;
21
+ /* Codes read left to right even inside an RTL field. */
22
+ direction: ltr;
9
23
  font-variant-numeric: tabular-nums;
10
24
 
11
25
  @media (forced-colors: active) {
12
- outline: 2px solid transparent;
13
- outline-offset: 2px;
26
+ &:has(> [data-slot='entry'] > input:focus-visible)
27
+ > [data-slot='entry']::after {
28
+ outline: 2px solid transparent;
29
+ outline-offset: 2px;
30
+ }
31
+
32
+ &:has(> [data-slot='entry'] > input:valid:focus-visible)
33
+ > [data-slot='cell'] {
34
+ outline: 2px solid transparent;
35
+ outline-offset: 2px;
36
+ }
14
37
  }
15
38
 
16
- &::placeholder {
17
- color: var(--muted-foreground);
39
+ > [data-slot='cell'] {
40
+ display: block;
41
+ inline-size: var(--otp-cell-size);
42
+ block-size: var(--otp-cell-size);
43
+ pointer-events: none;
18
44
  }
19
45
 
20
- &:disabled {
46
+ > [data-slot='entry'] {
47
+ position: absolute;
48
+ inset-block: 0;
49
+ inset-inline-start: 0;
50
+ z-index: 1;
51
+ display: flex;
52
+ align-items: center;
53
+ gap: var(--_otp-gap);
21
54
  pointer-events: none;
55
+
56
+ /* Sits over the next cell. The negative margin cancels the input's
57
+ start padding and the flex gap. */
58
+ &::after {
59
+ content: "";
60
+ flex: none;
61
+ inline-size: var(--otp-cell-size);
62
+ block-size: var(--otp-cell-size);
63
+ margin-inline-start: calc(
64
+ -1 * ((var(--otp-cell-size) - 1ch) / 2 + var(--_otp-gap))
65
+ );
66
+ visibility: hidden;
67
+ }
68
+
69
+ > input {
70
+ field-sizing: content;
71
+ width: auto;
72
+ height: 100%;
73
+ min-width: 0;
74
+ margin: 0;
75
+ padding: 0;
76
+ padding-inline-start: calc((var(--otp-cell-size) - 1ch) / 2);
77
+ border: 0;
78
+ outline: 0;
79
+ appearance: none;
80
+ background-color: transparent;
81
+ color: inherit;
82
+ font: inherit;
83
+ font-variant-numeric: tabular-nums;
84
+ letter-spacing: calc(var(--otp-cell-size) + var(--_otp-gap) - 1ch);
85
+ line-height: var(--otp-cell-size);
86
+ text-align: start;
87
+ pointer-events: auto;
88
+
89
+ &::placeholder {
90
+ color: var(--muted-foreground);
91
+ }
92
+ }
93
+ }
94
+
95
+ &:has(> [data-slot='entry'] > input:focus-visible)
96
+ > [data-slot='entry']::after {
97
+ visibility: visible;
98
+ }
99
+
100
+ /* A complete code has no next cell; the style files ring the cells. */
101
+ &:has(> [data-slot='entry'] > input:valid:focus-visible)
102
+ > [data-slot='entry']::after {
103
+ visibility: hidden;
104
+ }
105
+
106
+ &[data-spacing='joined'] {
107
+ --_otp-gap: 0rem;
108
+ }
109
+
110
+ &:has(> [data-slot='entry'] > input:disabled) {
22
111
  cursor: not-allowed;
23
112
  opacity: 50%;
113
+
114
+ > [data-slot='entry'] > input {
115
+ cursor: not-allowed;
116
+ }
24
117
  }
25
118
  }
26
119
  }
@@ -3,9 +3,17 @@
3
3
  .kbd {
4
4
  pointer-events: none;
5
5
  display: inline-flex;
6
+ flex-shrink: 0;
6
7
  align-items: center;
7
8
  justify-content: center;
9
+ white-space: nowrap;
8
10
  -webkit-user-select: none;
9
11
  user-select: none;
10
12
  }
13
+
14
+ .kbd-group {
15
+ display: inline-flex;
16
+ align-items: center;
17
+ gap: 0.25rem;
18
+ }
11
19
  }
@@ -7,7 +7,13 @@
7
7
  -webkit-user-select: none;
8
8
  user-select: none;
9
9
 
10
+ @media (forced-colors: active) {
11
+ outline: 2px solid transparent;
12
+ outline-offset: 2px;
13
+ }
14
+
10
15
  &:disabled {
16
+ pointer-events: none;
11
17
  cursor: not-allowed;
12
18
  opacity: 50%;
13
19
  }
@@ -4,6 +4,7 @@
4
4
  position: relative;
5
5
  display: flex;
6
6
  width: 100%;
7
+ min-width: 0;
7
8
  flex-direction: column;
8
9
 
9
10
  > button {
@@ -42,6 +43,8 @@
42
43
  > [data-popover] {
43
44
  width: 100%;
44
45
  min-width: 8rem;
46
+ max-height: 18rem;
47
+ overscroll-behavior: contain;
45
48
  }
46
49
  }
47
50
  }