loseta 0.7.0 → 0.9.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.
@@ -0,0 +1,44 @@
1
+ <!-- Dialog -->
2
+ <button type="button" class="btn" data-variant="outline">
3
+ Open command
4
+ </button>
5
+
6
+ <dialog class="dialog" id="demo-command" aria-labelledby="command-title" aria-describedby="command-description">
7
+ <div>
8
+ <header>
9
+ <h2 data-slot="title" id="command-title">Command palette</h2>
10
+ <p data-slot="description" id="command-description">Search for a command to run.</p>
11
+ </header>
12
+ <section>
13
+ <div class="command">
14
+ <div class="input-group" role="group" aria-label="Search commands">
15
+ <span data-slot="addon" data-align="inline-start" aria-hidden="true"><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"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg></span>
16
+ <input class="input" type="text" placeholder="Type a command..." aria-label="Search commands" autofocus>
17
+ </div>
18
+ <div role="listbox" aria-label="Commands">
19
+ <div role="group" aria-labelledby="command-group-navigation">
20
+ <div data-slot="label" id="command-group-navigation">Navigation</div>
21
+ <div role="option">
22
+ <span data-slot="text">Go home</span>
23
+ <span data-slot="shortcut">⌘H</span>
24
+ </div>
25
+ <div role="option">
26
+ <span data-slot="text">Open settings</span>
27
+ <span data-slot="shortcut">⌘,</span>
28
+ </div>
29
+ </div>
30
+ <div role="group" aria-labelledby="command-group-actions">
31
+ <div data-slot="label" id="command-group-actions">Actions</div>
32
+ <div role="option">
33
+ <span data-slot="text">Copy link</span>
34
+ </div>
35
+ <div role="option">
36
+ <span data-slot="text">Download</span>
37
+ </div>
38
+ </div>
39
+ <div data-slot="empty" hidden>No commands found.</div>
40
+ </div>
41
+ </div>
42
+ </section>
43
+ </div>
44
+ </dialog>
@@ -0,0 +1,23 @@
1
+ <!-- Horizontal -->
2
+ <div class="resizable" data-orientation="horizontal" style="height: 12rem">
3
+ <div class="resizable-panel">
4
+ <p><strong>Panel one</strong></p>
5
+ <p>Drag the handle or use the arrow keys in your application.</p>
6
+ </div>
7
+ <div data-slot="handle" role="separator" aria-orientation="vertical" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100" tabindex="0"></div>
8
+ <div class="resizable-panel" style="--panel-size: 2">
9
+ <p><strong>Panel two</strong></p>
10
+ <p>Set --panel-size to change the initial flex ratio.</p>
11
+ </div>
12
+ </div>
13
+
14
+ <!-- Vertical -->
15
+ <div class="resizable" data-orientation="vertical" style="height: 14rem">
16
+ <div class="resizable-panel">
17
+ <p><strong>Top panel</strong></p>
18
+ </div>
19
+ <div data-slot="handle" role="separator" aria-orientation="horizontal" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100" tabindex="0"></div>
20
+ <div class="resizable-panel">
21
+ <p><strong>Bottom panel</strong></p>
22
+ </div>
23
+ </div>
@@ -0,0 +1,50 @@
1
+ <!-- Default -->
2
+ <div class="select">
3
+ <button type="button" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="select-fruit-panel" aria-label="Fruit">
4
+ <span data-slot="value" data-placeholder>Select a fruit</span>
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
+ </button>
7
+ <div data-popover data-side="bottom" aria-hidden="true" id="select-fruit-panel">
8
+ <div role="listbox" aria-label="Fruit">
9
+ <div role="option" aria-selected="false">
10
+ <span data-slot="text">Apple</span>
11
+ <span data-slot="indicator" aria-hidden="true">✓</span>
12
+ </div>
13
+ <div role="option" aria-selected="false">
14
+ <span data-slot="text">Banana</span>
15
+ <span data-slot="indicator" aria-hidden="true">✓</span>
16
+ </div>
17
+ <div role="option" aria-selected="false">
18
+ <span data-slot="text">Orange</span>
19
+ <span data-slot="indicator" aria-hidden="true">✓</span>
20
+ </div>
21
+ <div role="option" aria-disabled="true">
22
+ <span data-slot="text">Pineapple</span>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </div>
27
+
28
+ <!-- Small, selected -->
29
+ <div class="select" data-size="sm">
30
+ <button type="button" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="select-fruit-small-panel" aria-label="Fruit">
31
+ <span data-slot="value">Apple</span>
32
+ <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>
33
+ </button>
34
+ <div data-popover data-side="bottom" aria-hidden="true" id="select-fruit-small-panel">
35
+ <div role="listbox" aria-label="Fruit">
36
+ <div role="option" aria-selected="true">
37
+ <span data-slot="text">Apple</span>
38
+ <span data-slot="indicator" aria-hidden="true">✓</span>
39
+ </div>
40
+ <div role="option" aria-selected="false">
41
+ <span data-slot="text">Banana</span>
42
+ <span data-slot="indicator" aria-hidden="true">✓</span>
43
+ </div>
44
+ <div role="option" aria-selected="false">
45
+ <span data-slot="text">Orange</span>
46
+ <span data-slot="indicator" aria-hidden="true">✓</span>
47
+ </div>
48
+ </div>
49
+ </div>
50
+ </div>
@@ -0,0 +1,31 @@
1
+ <!-- Default -->
2
+ <aside class="sidebar" aria-label="Sidebar" style="height: 22rem">
3
+ <header>
4
+ <span data-slot="brand">loseta</span>
5
+ </header>
6
+ <section>
7
+ <nav aria-label="Documentation">
8
+ <ul>
9
+ <li><a href="#" aria-current="page">Overview</a></li>
10
+ <li><a href="#">Installation</a></li>
11
+ <li>
12
+ <details class="collapsible" open>
13
+ <summary>
14
+ Components
15
+ <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>
16
+ </summary>
17
+ <ul>
18
+ <li><a href="#">Button</a></li>
19
+ <li><a href="#">Card</a></li>
20
+ <li><a href="#">Field</a></li>
21
+ </ul>
22
+ </details>
23
+ </li>
24
+ <li><a href="#">Styles</a></li>
25
+ </ul>
26
+ </nav>
27
+ </section>
28
+ <footer>
29
+ <span>v0.9.0</span>
30
+ </footer>
31
+ </aside>
@@ -0,0 +1,17 @@
1
+ <!-- Default -->
2
+ <div style="display: flex; flex-direction: column; gap: 0.5rem; max-width: 22rem">
3
+ <div class="toast" role="status">
4
+ <section>
5
+ <p data-slot="title">Saved</p>
6
+ <p data-slot="description">Your changes have been saved.</p>
7
+ </section>
8
+ <button type="button" class="btn" data-variant="ghost" data-size="icon-xs" data-slot="close" aria-label="Dismiss">×</button>
9
+ </div>
10
+ <div class="toast" data-variant="destructive" role="alert">
11
+ <section>
12
+ <p data-slot="title">Upload failed</p>
13
+ <p data-slot="description">The file is larger than 10 MB.</p>
14
+ </section>
15
+ <button type="button" class="btn" data-variant="ghost" data-size="icon-xs" data-slot="close" aria-label="Dismiss">×</button>
16
+ </div>
17
+ </div>
@@ -0,0 +1,82 @@
1
+ /* Listbox primitive */
2
+ @layer loseta.components {
3
+ [role='listbox'] {
4
+ display: flex;
5
+ flex-direction: column;
6
+ outline-style: none;
7
+
8
+ @media (forced-colors: active) {
9
+ outline: 2px solid transparent;
10
+ outline-offset: 2px;
11
+ }
12
+ }
13
+
14
+ [role='listbox'] [role='group'] {
15
+ display: flex;
16
+ flex-direction: column;
17
+
18
+ &[hidden] {
19
+ display: none;
20
+ }
21
+ }
22
+
23
+ [role='listbox'] [role='option'] {
24
+ position: relative;
25
+ display: flex;
26
+ width: 100%;
27
+ cursor: default;
28
+ align-items: center;
29
+ gap: 0.25rem;
30
+ white-space: normal;
31
+ outline-style: none;
32
+ -webkit-user-select: none;
33
+ user-select: none;
34
+
35
+ @media (forced-colors: active) {
36
+ outline: 2px solid transparent;
37
+ outline-offset: 2px;
38
+ }
39
+
40
+ &:disabled {
41
+ pointer-events: none;
42
+ opacity: 50%;
43
+ }
44
+
45
+ &[aria-disabled='true'] {
46
+ pointer-events: none;
47
+ opacity: 50%;
48
+ }
49
+
50
+ &[hidden] {
51
+ display: none;
52
+ }
53
+
54
+ & svg {
55
+ pointer-events: none;
56
+ flex-shrink: 0;
57
+ }
58
+ }
59
+
60
+ [role='listbox'] [role='option'] [data-slot='indicator'] {
61
+ pointer-events: none;
62
+ visibility: hidden;
63
+ }
64
+
65
+ [role='listbox'] [role='option'][aria-selected='true'] [data-slot='indicator'] {
66
+ visibility: visible;
67
+ }
68
+
69
+ [role='listbox'] [data-slot='label'] {
70
+ display: flex;
71
+ }
72
+
73
+ [role='listbox'] [data-slot='empty'] {
74
+ display: flex;
75
+ align-items: center;
76
+ justify-content: center;
77
+
78
+ &[hidden] {
79
+ display: none;
80
+ }
81
+ }
82
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "./schema.json",
3
3
  "name": "loseta",
4
- "version": "0.7.0",
4
+ "version": "0.9.0",
5
5
  "styles": [
6
6
  {
7
7
  "name": "nova",
@@ -244,6 +244,30 @@
244
244
  }
245
245
  ]
246
246
  },
247
+ {
248
+ "name": "listbox",
249
+ "type": "primitive",
250
+ "status": "experimental",
251
+ "title": "Listbox primitive",
252
+ "description": "Shared listbox option, group, empty and indicator rules used by select, combobox and command.",
253
+ "root": [
254
+ "[role='listbox']"
255
+ ],
256
+ "files": [
257
+ {
258
+ "path": "primitives/listbox.css",
259
+ "target": "primitives/listbox.css",
260
+ "role": "base",
261
+ "layer": "loseta.components"
262
+ },
263
+ {
264
+ "path": "styles/nova/primitives/listbox.css",
265
+ "target": "styles/nova/primitives/listbox.css",
266
+ "role": "style",
267
+ "layer": "loseta.style"
268
+ }
269
+ ]
270
+ },
247
271
  {
248
272
  "name": "popover-primitive",
249
273
  "type": "primitive",
@@ -2812,6 +2836,302 @@
2812
2836
  "examples": [
2813
2837
  "examples/slider.html"
2814
2838
  ]
2839
+ },
2840
+ {
2841
+ "name": "select",
2842
+ "type": "component",
2843
+ "status": "experimental",
2844
+ "title": "Select",
2845
+ "description": "A custom single-select listbox with a button trigger.",
2846
+ "docs": "/docs/components/select",
2847
+ "root": [
2848
+ ".select"
2849
+ ],
2850
+ "registryDependencies": [
2851
+ "listbox",
2852
+ "popover-primitive"
2853
+ ],
2854
+ "optionalDependencies": [],
2855
+ "files": [
2856
+ {
2857
+ "path": "components/select.css",
2858
+ "target": "components/select.css",
2859
+ "role": "base",
2860
+ "layer": "loseta.components"
2861
+ },
2862
+ {
2863
+ "path": "styles/nova/select.css",
2864
+ "target": "styles/nova/select.css",
2865
+ "role": "style",
2866
+ "layer": "loseta.style"
2867
+ }
2868
+ ],
2869
+ "examples": [
2870
+ "examples/select.html"
2871
+ ]
2872
+ },
2873
+ {
2874
+ "name": "combobox",
2875
+ "type": "component",
2876
+ "status": "experimental",
2877
+ "title": "Combobox",
2878
+ "description": "A text input combined with a listbox of options.",
2879
+ "docs": "/docs/components/combobox",
2880
+ "root": [
2881
+ ".combobox"
2882
+ ],
2883
+ "registryDependencies": [
2884
+ "listbox",
2885
+ "popover-primitive"
2886
+ ],
2887
+ "optionalDependencies": [
2888
+ "button"
2889
+ ],
2890
+ "files": [
2891
+ {
2892
+ "path": "components/combobox.css",
2893
+ "target": "components/combobox.css",
2894
+ "role": "base",
2895
+ "layer": "loseta.components"
2896
+ },
2897
+ {
2898
+ "path": "styles/nova/combobox.css",
2899
+ "target": "styles/nova/combobox.css",
2900
+ "role": "style",
2901
+ "layer": "loseta.style"
2902
+ }
2903
+ ],
2904
+ "examples": [
2905
+ "examples/combobox.html"
2906
+ ]
2907
+ },
2908
+ {
2909
+ "name": "command",
2910
+ "type": "component",
2911
+ "status": "experimental",
2912
+ "title": "Command",
2913
+ "description": "A searchable command list for palettes and dialogs.",
2914
+ "docs": "/docs/components/command",
2915
+ "root": [
2916
+ ".command"
2917
+ ],
2918
+ "registryDependencies": [
2919
+ "listbox",
2920
+ "input-group"
2921
+ ],
2922
+ "optionalDependencies": [
2923
+ "dialog-shell",
2924
+ "popover-primitive",
2925
+ "card"
2926
+ ],
2927
+ "files": [
2928
+ {
2929
+ "path": "components/command.css",
2930
+ "target": "components/command.css",
2931
+ "role": "base",
2932
+ "layer": "loseta.components"
2933
+ },
2934
+ {
2935
+ "path": "styles/nova/command.css",
2936
+ "target": "styles/nova/command.css",
2937
+ "role": "style",
2938
+ "layer": "loseta.style"
2939
+ }
2940
+ ],
2941
+ "examples": [
2942
+ "examples/command.html"
2943
+ ]
2944
+ },
2945
+ {
2946
+ "name": "calendar",
2947
+ "type": "component",
2948
+ "status": "experimental",
2949
+ "title": "Calendar",
2950
+ "description": "A native month grid for date selection.",
2951
+ "docs": "/docs/components/calendar",
2952
+ "root": [
2953
+ ".calendar"
2954
+ ],
2955
+ "registryDependencies": [],
2956
+ "optionalDependencies": [],
2957
+ "files": [
2958
+ {
2959
+ "path": "components/calendar.css",
2960
+ "target": "components/calendar.css",
2961
+ "role": "base",
2962
+ "layer": "loseta.components"
2963
+ },
2964
+ {
2965
+ "path": "styles/nova/calendar.css",
2966
+ "target": "styles/nova/calendar.css",
2967
+ "role": "style",
2968
+ "layer": "loseta.style"
2969
+ }
2970
+ ],
2971
+ "examples": [
2972
+ "examples/calendar.html"
2973
+ ]
2974
+ },
2975
+ {
2976
+ "name": "carousel",
2977
+ "type": "component",
2978
+ "status": "experimental",
2979
+ "title": "Carousel",
2980
+ "description": "A scroll-snap carousel with controls and indicators.",
2981
+ "docs": "/docs/components/carousel",
2982
+ "root": [
2983
+ ".carousel"
2984
+ ],
2985
+ "registryDependencies": [],
2986
+ "optionalDependencies": [
2987
+ "card"
2988
+ ],
2989
+ "files": [
2990
+ {
2991
+ "path": "components/carousel.css",
2992
+ "target": "components/carousel.css",
2993
+ "role": "base",
2994
+ "layer": "loseta.components"
2995
+ },
2996
+ {
2997
+ "path": "styles/nova/carousel.css",
2998
+ "target": "styles/nova/carousel.css",
2999
+ "role": "style",
3000
+ "layer": "loseta.style"
3001
+ }
3002
+ ],
3003
+ "examples": [
3004
+ "examples/carousel.html"
3005
+ ]
3006
+ },
3007
+ {
3008
+ "name": "chart",
3009
+ "type": "component",
3010
+ "status": "experimental",
3011
+ "title": "Chart",
3012
+ "description": "Chart chrome for legends and tooltips with series color tokens.",
3013
+ "docs": "/docs/components/chart",
3014
+ "root": [
3015
+ ".chart"
3016
+ ],
3017
+ "registryDependencies": [],
3018
+ "optionalDependencies": [
3019
+ "card"
3020
+ ],
3021
+ "files": [
3022
+ {
3023
+ "path": "components/chart.css",
3024
+ "target": "components/chart.css",
3025
+ "role": "base",
3026
+ "layer": "loseta.components"
3027
+ },
3028
+ {
3029
+ "path": "styles/nova/chart.css",
3030
+ "target": "styles/nova/chart.css",
3031
+ "role": "style",
3032
+ "layer": "loseta.style"
3033
+ }
3034
+ ],
3035
+ "examples": [
3036
+ "examples/chart.html"
3037
+ ]
3038
+ },
3039
+ {
3040
+ "name": "resizable",
3041
+ "type": "component",
3042
+ "status": "experimental",
3043
+ "title": "Resizable",
3044
+ "description": "A flex layout with draggable separator handles.",
3045
+ "docs": "/docs/components/resizable",
3046
+ "root": [
3047
+ ".resizable"
3048
+ ],
3049
+ "registryDependencies": [],
3050
+ "optionalDependencies": [],
3051
+ "files": [
3052
+ {
3053
+ "path": "components/resizable.css",
3054
+ "target": "components/resizable.css",
3055
+ "role": "base",
3056
+ "layer": "loseta.components"
3057
+ },
3058
+ {
3059
+ "path": "styles/nova/resizable.css",
3060
+ "target": "styles/nova/resizable.css",
3061
+ "role": "style",
3062
+ "layer": "loseta.style"
3063
+ }
3064
+ ],
3065
+ "examples": [
3066
+ "examples/resizable.html"
3067
+ ]
3068
+ },
3069
+ {
3070
+ "name": "sidebar",
3071
+ "type": "component",
3072
+ "status": "experimental",
3073
+ "title": "Sidebar",
3074
+ "description": "A composed sidebar shell for navigation and footer content.",
3075
+ "docs": "/docs/components/sidebar",
3076
+ "root": [
3077
+ ".sidebar"
3078
+ ],
3079
+ "registryDependencies": [
3080
+ "collapsible"
3081
+ ],
3082
+ "optionalDependencies": [
3083
+ "sheet"
3084
+ ],
3085
+ "files": [
3086
+ {
3087
+ "path": "components/sidebar.css",
3088
+ "target": "components/sidebar.css",
3089
+ "role": "base",
3090
+ "layer": "loseta.components"
3091
+ },
3092
+ {
3093
+ "path": "styles/nova/sidebar.css",
3094
+ "target": "styles/nova/sidebar.css",
3095
+ "role": "style",
3096
+ "layer": "loseta.style"
3097
+ }
3098
+ ],
3099
+ "examples": [
3100
+ "examples/sidebar.html"
3101
+ ]
3102
+ },
3103
+ {
3104
+ "name": "toast",
3105
+ "type": "component",
3106
+ "status": "experimental",
3107
+ "title": "Toast",
3108
+ "description": "A fixed stack of transient notifications.",
3109
+ "docs": "/docs/components/toast",
3110
+ "root": [
3111
+ ".toaster",
3112
+ ".toast"
3113
+ ],
3114
+ "registryDependencies": [],
3115
+ "optionalDependencies": [
3116
+ "button"
3117
+ ],
3118
+ "files": [
3119
+ {
3120
+ "path": "components/toast.css",
3121
+ "target": "components/toast.css",
3122
+ "role": "base",
3123
+ "layer": "loseta.components"
3124
+ },
3125
+ {
3126
+ "path": "styles/nova/toast.css",
3127
+ "target": "styles/nova/toast.css",
3128
+ "role": "style",
3129
+ "layer": "loseta.style"
3130
+ }
3131
+ ],
3132
+ "examples": [
3133
+ "examples/toast.html"
3134
+ ]
2815
3135
  }
2816
3136
  ]
2817
3137
  }
@@ -0,0 +1,78 @@
1
+ /* Calendar */
2
+ @layer loseta.style {
3
+ .calendar {
4
+ width: 18rem;
5
+ gap: 0.5rem;
6
+
7
+ > header {
8
+ gap: 0.5rem;
9
+ }
10
+
11
+ > header > button {
12
+ width: 1.75rem;
13
+ height: 1.75rem;
14
+ border-radius: var(--radius-md);
15
+ color: var(--muted-foreground);
16
+
17
+ &:hover {
18
+ background-color: var(--muted);
19
+ color: var(--foreground);
20
+ }
21
+
22
+ &:focus-visible {
23
+ box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
24
+ }
25
+
26
+ > svg {
27
+ width: 1rem;
28
+ height: 1rem;
29
+ }
30
+ }
31
+
32
+ [data-slot='title'] {
33
+ font-size: var(--text-sm);
34
+ line-height: var(--text-sm--line-height);
35
+ font-weight: 500;
36
+ }
37
+
38
+ th {
39
+ padding-block: 0.25rem;
40
+ font-size: var(--text-xs);
41
+ line-height: var(--text-xs--line-height);
42
+ color: var(--muted-foreground);
43
+ }
44
+
45
+ td > button {
46
+ width: 2rem;
47
+ height: 2rem;
48
+ border-radius: var(--radius-md);
49
+ font-size: var(--text-sm);
50
+ line-height: var(--text-sm--line-height);
51
+ transition-property: color, background-color, box-shadow;
52
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
53
+ transition-duration: 150ms;
54
+
55
+ &:hover {
56
+ background-color: var(--muted);
57
+ }
58
+
59
+ &:focus-visible {
60
+ box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
61
+ }
62
+
63
+ &[aria-disabled='true'] {
64
+ opacity: 50%;
65
+ color: var(--muted-foreground);
66
+ }
67
+ }
68
+
69
+ td[aria-selected='true'] > button {
70
+ background-color: var(--primary);
71
+ color: var(--primary-foreground);
72
+ }
73
+
74
+ td > button[aria-current='date'] {
75
+ box-shadow: inset 0 0 0 1px var(--ring);
76
+ }
77
+ }
78
+ }