loseta 0.6.0 → 0.7.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loseta",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Native CSS component scaffolds with the shadcn feel.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -0,0 +1,57 @@
1
+ /* Collapsible */
2
+ @layer loseta.components {
3
+ .collapsible {
4
+ > summary {
5
+ display: flex;
6
+ width: 100%;
7
+ cursor: pointer;
8
+ list-style-type: none;
9
+ align-items: center;
10
+ justify-content: space-between;
11
+ outline-style: none;
12
+ -webkit-user-select: none;
13
+ user-select: none;
14
+
15
+ @media (forced-colors: active) {
16
+ outline: 2px solid transparent;
17
+ outline-offset: 2px;
18
+ }
19
+
20
+ &::-webkit-details-marker {
21
+ display: none;
22
+ }
23
+
24
+ > svg:last-child {
25
+ pointer-events: none;
26
+ flex-shrink: 0;
27
+ transition-property: rotate;
28
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
29
+ transition-duration: 150ms;
30
+ }
31
+ }
32
+
33
+ &[open] > summary > svg:last-child {
34
+ rotate: 180deg;
35
+ }
36
+
37
+ &[inert] > summary {
38
+ pointer-events: none;
39
+ opacity: 50%;
40
+ }
41
+
42
+ > :not(summary) {
43
+ overflow: hidden;
44
+ }
45
+
46
+ &::details-content {
47
+ block-size: 0;
48
+ display: block;
49
+ overflow: hidden;
50
+ }
51
+
52
+ &[open]::details-content {
53
+ block-size: auto;
54
+ block-size: calc-size(auto, size);
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,45 @@
1
+ /* Input Group */
2
+ @layer loseta.components {
3
+ .input-group {
4
+ display: flex;
5
+ width: 100%;
6
+ min-width: 0;
7
+ align-items: center;
8
+
9
+ &:has(> [data-align='block-start'], > [data-align='block-end']) {
10
+ flex-direction: column;
11
+ align-items: stretch;
12
+ }
13
+
14
+ > :is(input, textarea) {
15
+ flex: 1 1 auto;
16
+ width: auto;
17
+ min-width: 0;
18
+ height: auto;
19
+ }
20
+
21
+ > [data-slot='addon'] {
22
+ display: flex;
23
+ flex-shrink: 0;
24
+ align-items: center;
25
+ justify-content: center;
26
+ gap: 0.25rem;
27
+
28
+ &[data-align='inline-start'],
29
+ &[data-align='block-start'] {
30
+ order: -1;
31
+ }
32
+
33
+ &[data-align='inline-end'],
34
+ &[data-align='block-end'] {
35
+ order: 1;
36
+ }
37
+
38
+ &[data-align='block-start'],
39
+ &[data-align='block-end'] {
40
+ width: 100%;
41
+ justify-content: flex-start;
42
+ }
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,20 @@
1
+ /* Input OTP */
2
+ @layer loseta.components {
3
+ .input-otp {
4
+ display: block;
5
+ width: 100%;
6
+ outline-style: none;
7
+ text-align: center;
8
+ font-variant-numeric: tabular-nums;
9
+
10
+ &::placeholder {
11
+ color: var(--muted-foreground);
12
+ }
13
+
14
+ &:disabled {
15
+ pointer-events: none;
16
+ cursor: not-allowed;
17
+ opacity: 50%;
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,16 @@
1
+ /* Scroll Area */
2
+ @layer loseta.components {
3
+ .scroll-area {
4
+ overflow: auto;
5
+
6
+ &[data-orientation='horizontal'] {
7
+ overflow-x: auto;
8
+ overflow-y: hidden;
9
+ }
10
+
11
+ &[data-orientation='vertical'] {
12
+ overflow-y: auto;
13
+ overflow-x: hidden;
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,13 @@
1
+ /* Slider */
2
+ @layer loseta.components {
3
+ .slider {
4
+ display: block;
5
+ width: 100%;
6
+ cursor: pointer;
7
+
8
+ &:disabled {
9
+ cursor: not-allowed;
10
+ opacity: 50%;
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,22 @@
1
+ <!-- Default -->
2
+ <details class="collapsible">
3
+ <summary>
4
+ Show details
5
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>
6
+ </summary>
7
+ <div>
8
+ <p>This content is revealed with the native details element.</p>
9
+ </div>
10
+ </details>
11
+
12
+ <!-- Open -->
13
+ <details class="collapsible" open>
14
+ <summary>
15
+ Shipping information
16
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>
17
+ </summary>
18
+ <div>
19
+ <p>Orders placed before 14:00 ship the same day.</p>
20
+ <p>Tracking details arrive by email.</p>
21
+ </div>
22
+ </details>
@@ -0,0 +1,14 @@
1
+ <!-- Inline addons -->
2
+ <div class="input-group" role="group" aria-label="Email">
3
+ <span data-slot="addon" data-align="inline-start" aria-hidden="true">@</span>
4
+ <input class="input" type="email" placeholder="you@example.com" aria-label="Email">
5
+ <span data-slot="addon" data-align="inline-end">
6
+ <button type="button" class="btn" data-variant="ghost" data-size="icon-xs" aria-label="Copy email"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg></button>
7
+ </span>
8
+ </div>
9
+
10
+ <!-- Block addon -->
11
+ <div class="input-group" role="group" aria-label="Message">
12
+ <span data-slot="addon" data-align="block-start">Message</span>
13
+ <textarea class="textarea" placeholder="Type your message here." aria-label="Message"></textarea>
14
+ </div>
@@ -0,0 +1,5 @@
1
+ <!-- Default -->
2
+ <input class="input-otp" type="text" inputmode="numeric" autocomplete="one-time-code" maxlength="6" pattern="[0-9]*" aria-label="One-time code" placeholder="000000">
3
+
4
+ <!-- Large -->
5
+ <input class="input-otp" data-size="lg" type="text" inputmode="numeric" autocomplete="one-time-code" maxlength="6" pattern="[0-9]*" aria-label="One-time code" placeholder="000000">
@@ -0,0 +1,25 @@
1
+ <!-- Vertical -->
2
+ <div class="scroll-area" role="region" aria-label="Scrollable content" tabindex="0" style="max-height: 10rem; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0.75rem">
3
+ <p>loseta copies readable CSS files into your project.</p>
4
+ <p>The registry validates layers, dependencies and generated examples.</p>
5
+ <p>Eight styles share one markup contract.</p>
6
+ <p>The docs site renders the same files consumers install.</p>
7
+ <p>Scrollbars use the reserved scrollbar tokens.</p>
8
+ <p>This region is focusable so keyboard users can scroll it.</p>
9
+ <p>No JavaScript is involved in the scrollbar styling.</p>
10
+ </div>
11
+
12
+ <!-- Horizontal, small -->
13
+ <div class="scroll-area" data-size="sm" data-orientation="horizontal" role="region" aria-label="Scrollable row" tabindex="0" style="border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0.75rem">
14
+ <div style="display: flex; gap: 0.5rem; width: max-content">
15
+ <span class="badge">Accordion</span>
16
+ <span class="badge">Avatar</span>
17
+ <span class="badge">Breadcrumb</span>
18
+ <span class="badge">Context menu</span>
19
+ <span class="badge">Drawer</span>
20
+ <span class="badge">Hover card</span>
21
+ <span class="badge">Menubar</span>
22
+ <span class="badge">Navigation menu</span>
23
+ <span class="badge">Sheet</span>
24
+ </div>
25
+ </div>
@@ -0,0 +1,9 @@
1
+ <!-- Default -->
2
+ <input class="slider" type="range" min="0" max="100" value="60" aria-label="Volume">
3
+
4
+ <!-- Sizes and disabled -->
5
+ <div style="display: grid; gap: 0.75rem">
6
+ <input class="slider" data-size="sm" type="range" min="0" max="100" value="30" aria-label="Small volume">
7
+ <input class="slider" data-size="lg" type="range" min="0" max="100" value="70" aria-label="Large volume">
8
+ <input class="slider" type="range" min="0" max="100" value="50" aria-label="Disabled volume" disabled>
9
+ </div>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "./schema.json",
3
3
  "name": "loseta",
4
- "version": "0.6.0",
4
+ "version": "0.7.0",
5
5
  "styles": [
6
6
  {
7
7
  "name": "nova",
@@ -2658,6 +2658,160 @@
2658
2658
  "examples": [
2659
2659
  "examples/sheet.html"
2660
2660
  ]
2661
+ },
2662
+ {
2663
+ "name": "collapsible",
2664
+ "type": "component",
2665
+ "status": "experimental",
2666
+ "title": "Collapsible",
2667
+ "description": "A native disclosure that reveals or hides content.",
2668
+ "docs": "/docs/components/collapsible",
2669
+ "root": [
2670
+ ".collapsible"
2671
+ ],
2672
+ "registryDependencies": [],
2673
+ "optionalDependencies": [],
2674
+ "files": [
2675
+ {
2676
+ "path": "components/collapsible.css",
2677
+ "target": "components/collapsible.css",
2678
+ "role": "base",
2679
+ "layer": "loseta.components"
2680
+ },
2681
+ {
2682
+ "path": "styles/nova/collapsible.css",
2683
+ "target": "styles/nova/collapsible.css",
2684
+ "role": "style",
2685
+ "layer": "loseta.style"
2686
+ }
2687
+ ],
2688
+ "examples": [
2689
+ "examples/collapsible.html"
2690
+ ]
2691
+ },
2692
+ {
2693
+ "name": "input-group",
2694
+ "type": "component",
2695
+ "status": "experimental",
2696
+ "title": "Input Group",
2697
+ "description": "Composes inputs, textareas and addons into one control surface.",
2698
+ "docs": "/docs/components/input-group",
2699
+ "root": [
2700
+ ".input-group"
2701
+ ],
2702
+ "registryDependencies": [],
2703
+ "optionalDependencies": [
2704
+ "input",
2705
+ "textarea",
2706
+ "button"
2707
+ ],
2708
+ "files": [
2709
+ {
2710
+ "path": "components/input-group.css",
2711
+ "target": "components/input-group.css",
2712
+ "role": "base",
2713
+ "layer": "loseta.components"
2714
+ },
2715
+ {
2716
+ "path": "styles/nova/input-group.css",
2717
+ "target": "styles/nova/input-group.css",
2718
+ "role": "style",
2719
+ "layer": "loseta.style"
2720
+ }
2721
+ ],
2722
+ "examples": [
2723
+ "examples/input-group.html"
2724
+ ]
2725
+ },
2726
+ {
2727
+ "name": "input-otp",
2728
+ "type": "component",
2729
+ "status": "experimental",
2730
+ "title": "Input OTP",
2731
+ "description": "A single native input for one-time codes.",
2732
+ "docs": "/docs/components/input-otp",
2733
+ "root": [
2734
+ ".input-otp"
2735
+ ],
2736
+ "registryDependencies": [],
2737
+ "optionalDependencies": [],
2738
+ "files": [
2739
+ {
2740
+ "path": "components/input-otp.css",
2741
+ "target": "components/input-otp.css",
2742
+ "role": "base",
2743
+ "layer": "loseta.components"
2744
+ },
2745
+ {
2746
+ "path": "styles/nova/input-otp.css",
2747
+ "target": "styles/nova/input-otp.css",
2748
+ "role": "style",
2749
+ "layer": "loseta.style"
2750
+ }
2751
+ ],
2752
+ "examples": [
2753
+ "examples/input-otp.html"
2754
+ ]
2755
+ },
2756
+ {
2757
+ "name": "scroll-area",
2758
+ "type": "component",
2759
+ "status": "experimental",
2760
+ "title": "Scroll Area",
2761
+ "description": "A scroll container with native styled scrollbars.",
2762
+ "docs": "/docs/components/scroll-area",
2763
+ "root": [
2764
+ ".scroll-area"
2765
+ ],
2766
+ "registryDependencies": [],
2767
+ "optionalDependencies": [],
2768
+ "files": [
2769
+ {
2770
+ "path": "components/scroll-area.css",
2771
+ "target": "components/scroll-area.css",
2772
+ "role": "base",
2773
+ "layer": "loseta.components"
2774
+ },
2775
+ {
2776
+ "path": "styles/nova/scroll-area.css",
2777
+ "target": "styles/nova/scroll-area.css",
2778
+ "role": "style",
2779
+ "layer": "loseta.style"
2780
+ }
2781
+ ],
2782
+ "examples": [
2783
+ "examples/scroll-area.html"
2784
+ ]
2785
+ },
2786
+ {
2787
+ "name": "slider",
2788
+ "type": "component",
2789
+ "status": "experimental",
2790
+ "title": "Slider",
2791
+ "description": "A native range input for selecting a value from a range.",
2792
+ "docs": "/docs/components/slider",
2793
+ "root": [
2794
+ ".slider"
2795
+ ],
2796
+ "registryDependencies": [],
2797
+ "optionalDependencies": [],
2798
+ "files": [
2799
+ {
2800
+ "path": "components/slider.css",
2801
+ "target": "components/slider.css",
2802
+ "role": "base",
2803
+ "layer": "loseta.components"
2804
+ },
2805
+ {
2806
+ "path": "styles/nova/slider.css",
2807
+ "target": "styles/nova/slider.css",
2808
+ "role": "style",
2809
+ "layer": "loseta.style"
2810
+ }
2811
+ ],
2812
+ "examples": [
2813
+ "examples/slider.html"
2814
+ ]
2661
2815
  }
2662
2816
  ]
2663
2817
  }
@@ -0,0 +1,50 @@
1
+ /* Collapsible */
2
+ @layer loseta.style {
3
+ .collapsible {
4
+ > summary {
5
+ gap: 0.5rem;
6
+ border-style: solid;
7
+ border-width: 1px;
8
+ border-color: transparent;
9
+ border-radius: var(--radius-md);
10
+ padding-block: 0.25rem;
11
+ text-align: start;
12
+ font-size: var(--text-sm);
13
+ line-height: var(--text-sm--line-height);
14
+ font-weight: 500;
15
+ transition-property: border-color, box-shadow;
16
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
17
+ transition-duration: 150ms;
18
+
19
+ &:focus-visible {
20
+ border-color: var(--ring);
21
+ box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
22
+ }
23
+
24
+ > svg:last-child {
25
+ margin-inline-start: auto;
26
+ width: 1rem;
27
+ height: 1rem;
28
+ color: var(--muted-foreground);
29
+ }
30
+ }
31
+
32
+ > :not(summary) {
33
+ padding-block-start: 0.5rem;
34
+ font-size: var(--text-sm);
35
+ line-height: var(--text-sm--line-height);
36
+ }
37
+
38
+ &::details-content {
39
+ opacity: 0%;
40
+ transition-property: block-size, opacity;
41
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
42
+ transition-duration: 150ms;
43
+ transition-behavior: allow-discrete;
44
+ }
45
+
46
+ &[open]::details-content {
47
+ opacity: 100%;
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,86 @@
1
+ /* Input Group */
2
+ @layer loseta.style {
3
+ .input-group {
4
+ min-height: 2rem;
5
+ gap: 0.25rem;
6
+ border-style: solid;
7
+ border-width: 1px;
8
+ border-color: var(--input);
9
+ border-radius: var(--radius-lg);
10
+ background-color: light-dark(
11
+ transparent,
12
+ color-mix(in oklab, var(--input) 30%, transparent)
13
+ );
14
+ padding: 0.25rem 0.375rem;
15
+ transition-property: border-color, box-shadow;
16
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
17
+ transition-duration: 150ms;
18
+
19
+ &:focus-within {
20
+ border-color: var(--ring);
21
+ box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
22
+ }
23
+
24
+ &:has([aria-invalid='true']) {
25
+ border-color: light-dark(
26
+ var(--destructive),
27
+ color-mix(in oklab, var(--destructive) 50%, transparent)
28
+ );
29
+ box-shadow: 0 0 0 3px light-dark(
30
+ color-mix(in oklab, var(--destructive) 20%, transparent),
31
+ color-mix(in oklab, var(--destructive) 40%, transparent)
32
+ );
33
+ }
34
+
35
+ &:has(> textarea) {
36
+ align-items: stretch;
37
+ padding-block: 0.5rem;
38
+ }
39
+
40
+ > :is(input, textarea) {
41
+ border-width: 0;
42
+ border-radius: 0;
43
+ background-color: transparent;
44
+ padding: 0;
45
+ font-size: var(--text-base);
46
+ line-height: 1.5;
47
+ box-shadow: none;
48
+
49
+ &:focus-visible {
50
+ border-color: transparent;
51
+ box-shadow: none;
52
+ }
53
+
54
+ &[aria-invalid='true'] {
55
+ border-color: transparent;
56
+ box-shadow: none;
57
+ }
58
+
59
+ @media (width >= 48rem) {
60
+ font-size: var(--text-sm);
61
+ line-height: var(--text-sm--line-height);
62
+ }
63
+ }
64
+
65
+ > [data-slot='addon'] {
66
+ color: var(--muted-foreground);
67
+ font-size: var(--text-sm);
68
+ line-height: var(--text-sm--line-height);
69
+ -webkit-user-select: none;
70
+ user-select: none;
71
+
72
+ > svg {
73
+ width: 1rem;
74
+ height: 1rem;
75
+ }
76
+
77
+ &[data-align='block-start'] {
78
+ padding-block-end: 0.125rem;
79
+ }
80
+
81
+ &[data-align='block-end'] {
82
+ padding-block-start: 0.125rem;
83
+ }
84
+ }
85
+ }
86
+ }
@@ -0,0 +1,51 @@
1
+ /* Input OTP */
2
+ @layer loseta.style {
3
+ .input-otp {
4
+ height: 2.5rem;
5
+ border-style: solid;
6
+ border-width: 1px;
7
+ border-color: var(--input);
8
+ 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;
14
+ font-size: var(--text-lg);
15
+ line-height: var(--text-lg--line-height);
16
+ letter-spacing: 0.5em;
17
+ transition-property: color, background-color, border-color, box-shadow;
18
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
19
+ transition-duration: 150ms;
20
+
21
+ &:focus-visible {
22
+ border-color: var(--ring);
23
+ box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
24
+ }
25
+
26
+ &[aria-invalid='true'] {
27
+ border-color: light-dark(
28
+ var(--destructive),
29
+ color-mix(in oklab, var(--destructive) 50%, transparent)
30
+ );
31
+ box-shadow: 0 0 0 3px light-dark(
32
+ color-mix(in oklab, var(--destructive) 20%, transparent),
33
+ color-mix(in oklab, var(--destructive) 40%, transparent)
34
+ );
35
+ }
36
+
37
+ &[data-size='sm'] {
38
+ height: 2rem;
39
+ font-size: var(--text-base);
40
+ line-height: var(--text-base--line-height);
41
+ letter-spacing: 0.35em;
42
+ }
43
+
44
+ &[data-size='lg'] {
45
+ height: 3rem;
46
+ font-size: var(--text-xl);
47
+ line-height: var(--text-xl--line-height);
48
+ letter-spacing: 0.6em;
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,30 @@
1
+ /* Scroll Area */
2
+ @layer loseta.style {
3
+ .scroll-area {
4
+ scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
5
+ scrollbar-width: auto;
6
+
7
+ &::-webkit-scrollbar {
8
+ width: var(--scrollbar-width);
9
+ height: var(--scrollbar-width);
10
+ }
11
+
12
+ &::-webkit-scrollbar-track {
13
+ background-color: var(--scrollbar-track);
14
+ }
15
+
16
+ &::-webkit-scrollbar-thumb {
17
+ border-radius: var(--scrollbar-radius);
18
+ background-color: var(--scrollbar-thumb);
19
+ }
20
+
21
+ &[data-size='sm'] {
22
+ scrollbar-width: thin;
23
+
24
+ &::-webkit-scrollbar {
25
+ width: var(--scrollbar-sm-width);
26
+ height: var(--scrollbar-sm-width);
27
+ }
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,15 @@
1
+ /* Slider */
2
+ @layer loseta.style {
3
+ .slider {
4
+ accent-color: var(--primary);
5
+ block-size: 1.25rem;
6
+
7
+ &[data-size='sm'] {
8
+ block-size: 1rem;
9
+ }
10
+
11
+ &[data-size='lg'] {
12
+ block-size: 1.5rem;
13
+ }
14
+ }
15
+ }