@realmorg/ui 0.0.0-stage → 2.0.0-alpha.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 (66) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +44 -2
  3. package/components/accordion.html +139 -0
  4. package/components/alert-dialog.html +236 -0
  5. package/components/alert.html +83 -0
  6. package/components/aspect-ratio.html +29 -0
  7. package/components/attachment.html +98 -0
  8. package/components/avatar.html +149 -0
  9. package/components/badge.html +62 -0
  10. package/components/breadcrumb.html +159 -0
  11. package/components/bubble.html +77 -0
  12. package/components/button-group.html +98 -0
  13. package/components/button.html +194 -0
  14. package/components/calendar.html +176 -0
  15. package/components/card.html +143 -0
  16. package/components/carousel.html +208 -0
  17. package/components/chart.html +168 -0
  18. package/components/checkbox.html +99 -0
  19. package/components/code-block.html +64 -0
  20. package/components/collapsible.html +90 -0
  21. package/components/combobox.html +237 -0
  22. package/components/command.html +201 -0
  23. package/components/context-menu.html +81 -0
  24. package/components/dialog.html +327 -0
  25. package/components/direction.html +23 -0
  26. package/components/drawer.html +267 -0
  27. package/components/dropdown-menu.html +421 -0
  28. package/components/empty.html +132 -0
  29. package/components/field.html +143 -0
  30. package/components/hover-card.html +111 -0
  31. package/components/input-group.html +91 -0
  32. package/components/input-otp.html +151 -0
  33. package/components/input.html +94 -0
  34. package/components/item.html +208 -0
  35. package/components/kbd.html +45 -0
  36. package/components/label.html +46 -0
  37. package/components/marker.html +41 -0
  38. package/components/menubar.html +137 -0
  39. package/components/message-scroller.html +68 -0
  40. package/components/message.html +95 -0
  41. package/components/navigation-menu.html +233 -0
  42. package/components/pagination.html +160 -0
  43. package/components/popover.html +164 -0
  44. package/components/progress.html +45 -0
  45. package/components/radio-group.html +120 -0
  46. package/components/resizable.html +170 -0
  47. package/components/scroll-area.html +56 -0
  48. package/components/select.html +103 -0
  49. package/components/separator.html +31 -0
  50. package/components/sheet.html +173 -0
  51. package/components/sidebar.html +393 -0
  52. package/components/skeleton.html +36 -0
  53. package/components/slider.html +108 -0
  54. package/components/spinner.html +53 -0
  55. package/components/switch.html +95 -0
  56. package/components/table.html +81 -0
  57. package/components/tabs.html +182 -0
  58. package/components/textarea.html +80 -0
  59. package/components/toaster.html +134 -0
  60. package/components/toggle-group.html +71 -0
  61. package/components/toggle.html +87 -0
  62. package/components/tooltip.html +114 -0
  63. package/dist/theme.css +158 -0
  64. package/dist/ui.html +7923 -0
  65. package/package.json +40 -3
  66. package/theme.css +158 -0
@@ -0,0 +1,149 @@
1
+ <custom-element name="ui-avatar">
2
+ <script>
3
+ defineProps({
4
+ size: prop.enum(["sm", "default", "lg"]).default("default"),
5
+ shape: prop.enum(["circle", "square"]).default("circle"),
6
+ });
7
+
8
+ const image = useState({ failed: false, loaded: false });
9
+
10
+ function loaded() {
11
+ image.loaded = true;
12
+ image.failed = false;
13
+ }
14
+
15
+ function failed() {
16
+ image.failed = true;
17
+ }
18
+ </script>
19
+
20
+ <style>
21
+ /* A double tap must not zoom the page. Set inside the shadow root, because a page-level
22
+ touch-action does not reach shadow content in iOS Safari. */
23
+ :host,
24
+ * {
25
+ touch-action: manipulation;
26
+ }
27
+ :host {
28
+ position: relative;
29
+ display: inline-flex;
30
+ flex-shrink: 0;
31
+ width: calc(var(--spacing) * 8);
32
+ height: calc(var(--spacing) * 8);
33
+ overflow: hidden;
34
+ border-radius: var(--radius-full);
35
+ font-size: var(--text-sm);
36
+ vertical-align: middle;
37
+ }
38
+ :host(:state(attr-size-is-sm)) {
39
+ width: calc(var(--spacing) * 6);
40
+ height: calc(var(--spacing) * 6);
41
+ font-size: var(--text-xs);
42
+ }
43
+ :host(:state(attr-size-is-lg)) {
44
+ width: calc(var(--spacing) * 10);
45
+ height: calc(var(--spacing) * 10);
46
+ }
47
+ :host(:state(attr-shape-is-square)) {
48
+ border-radius: var(--radius-md);
49
+ }
50
+ </style>
51
+
52
+ <slot></slot>
53
+ </custom-element>
54
+
55
+ <custom-element name="ui-avatar-image">
56
+ <script>
57
+ defineProps({
58
+ src: prop.string(),
59
+ alt: prop.string().default(""),
60
+ });
61
+ </script>
62
+
63
+ <style>
64
+ :host,
65
+ * {
66
+ touch-action: manipulation;
67
+ }
68
+ :host {
69
+ display: contents;
70
+ }
71
+ img {
72
+ width: 100%;
73
+ height: 100%;
74
+ object-fit: cover;
75
+ }
76
+ </style>
77
+
78
+ <is-hidden when="#image.failed">
79
+ <img part="image" _src="@src" _alt="@alt" _hidden="!#image.loaded" onload="loaded()" onerror="failed()">
80
+ </is-hidden>
81
+ </custom-element>
82
+
83
+ <custom-element name="ui-avatar-fallback">
84
+ <style>
85
+ :host,
86
+ * {
87
+ touch-action: manipulation;
88
+ }
89
+ :host {
90
+ display: contents;
91
+ }
92
+ span {
93
+ display: flex;
94
+ width: 100%;
95
+ height: 100%;
96
+ align-items: center;
97
+ justify-content: center;
98
+ background: var(--muted);
99
+ }
100
+ </style>
101
+
102
+ <is-hidden when="#image.loaded">
103
+ <span part="fallback"><slot></slot></span>
104
+ </is-hidden>
105
+ </custom-element>
106
+
107
+ <custom-element name="ui-avatar-group" role="group">
108
+ <style>
109
+ :host,
110
+ * {
111
+ touch-action: manipulation;
112
+ }
113
+ :host {
114
+ display: flex;
115
+ align-items: center;
116
+ }
117
+ ::slotted(*) {
118
+ box-shadow: 0 0 0 calc(var(--spacing) * 0.5) var(--background);
119
+ }
120
+ ::slotted(:not(:first-child)) {
121
+ margin-inline-start: calc(var(--spacing) * -2);
122
+ }
123
+ </style>
124
+
125
+ <slot></slot>
126
+ </custom-element>
127
+
128
+ <custom-element name="ui-avatar-group-count">
129
+ <style>
130
+ :host,
131
+ * {
132
+ touch-action: manipulation;
133
+ }
134
+ :host {
135
+ display: inline-flex;
136
+ flex-shrink: 0;
137
+ align-items: center;
138
+ justify-content: center;
139
+ width: calc(var(--spacing) * 8);
140
+ height: calc(var(--spacing) * 8);
141
+ border-radius: var(--radius-full);
142
+ background: var(--muted);
143
+ color: var(--muted-foreground);
144
+ font-size: var(--text-sm);
145
+ }
146
+ </style>
147
+
148
+ <slot></slot>
149
+ </custom-element>
@@ -0,0 +1,62 @@
1
+ <custom-element name="ui-badge">
2
+ <script>
3
+ defineProps({
4
+ variant: prop.enum(["default", "secondary", "destructive", "outline"]).default("default"),
5
+ shape: prop.enum(["default", "pill", "round"]).default("default"),
6
+ });
7
+ </script>
8
+
9
+ <style>
10
+ /* A double tap must not zoom the page. Set inside the shadow root, because a page-level
11
+ touch-action does not reach shadow content in iOS Safari. */
12
+ :host,
13
+ * {
14
+ touch-action: manipulation;
15
+ }
16
+ :host {
17
+ display: inline-flex;
18
+ align-items: center;
19
+ justify-content: center;
20
+ gap: calc(var(--spacing) * 1);
21
+ width: fit-content;
22
+ padding: calc(var(--spacing) * 0.5) calc(var(--spacing) * 2);
23
+ border: 1px solid transparent;
24
+ border-radius: var(--radius-md);
25
+ font-size: var(--text-xs);
26
+ font-weight: var(--font-weight-medium);
27
+ white-space: nowrap;
28
+ background: var(--primary);
29
+ color: var(--primary-foreground);
30
+ }
31
+ :host(:state(attr-variant-is-secondary)) {
32
+ background: var(--secondary);
33
+ color: var(--secondary-foreground);
34
+ }
35
+ :host(:state(attr-variant-is-destructive)) {
36
+ background: var(--destructive);
37
+ color: var(--destructive-foreground);
38
+ }
39
+ :host(:state(attr-variant-is-outline)) {
40
+ background: transparent;
41
+ border-color: var(--border);
42
+ color: var(--foreground);
43
+ }
44
+ :host(:state(attr-shape-is-pill)) {
45
+ border-radius: var(--radius-full);
46
+ }
47
+ :host(:state(attr-shape-is-round)) {
48
+ box-sizing: border-box;
49
+ min-width: calc(var(--spacing) * 5);
50
+ height: calc(var(--spacing) * 5);
51
+ padding: 0 calc(var(--spacing) * 1);
52
+ border-radius: var(--radius-full);
53
+ font-variant-numeric: tabular-nums;
54
+ }
55
+ ::slotted(svg) {
56
+ width: calc(var(--spacing) * 3);
57
+ height: calc(var(--spacing) * 3);
58
+ }
59
+ </style>
60
+
61
+ <slot></slot>
62
+ </custom-element>
@@ -0,0 +1,159 @@
1
+ <custom-element name="ui-breadcrumb">
2
+ <script>
3
+ defineProps({ label: prop.string().default("Breadcrumb") });
4
+ </script>
5
+
6
+ <style>
7
+ /* A double tap must not zoom the page. Set inside the shadow root, because a page-level
8
+ touch-action does not reach shadow content in iOS Safari. */
9
+ :host,
10
+ * {
11
+ touch-action: manipulation;
12
+ }
13
+ :host {
14
+ display: block;
15
+ }
16
+ </style>
17
+
18
+ <nav _aria-label="@label"><slot></slot></nav>
19
+ </custom-element>
20
+
21
+ <custom-element name="ui-breadcrumb-list">
22
+ <style>
23
+ :host,
24
+ * {
25
+ touch-action: manipulation;
26
+ }
27
+ :host {
28
+ display: block;
29
+ }
30
+ ol {
31
+ display: flex;
32
+ flex-wrap: wrap;
33
+ align-items: center;
34
+ gap: calc(var(--spacing) * 1.5);
35
+ margin: 0;
36
+ padding: 0;
37
+ list-style: none;
38
+ font-size: var(--text-sm);
39
+ color: var(--muted-foreground);
40
+ overflow-wrap: anywhere;
41
+ }
42
+ </style>
43
+
44
+ <ol part="list"><slot></slot></ol>
45
+ </custom-element>
46
+
47
+ <custom-element name="ui-breadcrumb-item" role="listitem">
48
+ <style>
49
+ :host,
50
+ * {
51
+ touch-action: manipulation;
52
+ }
53
+ :host {
54
+ display: inline-flex;
55
+ align-items: center;
56
+ gap: calc(var(--spacing) * 1.5);
57
+ }
58
+ </style>
59
+
60
+ <slot></slot>
61
+ </custom-element>
62
+
63
+ <custom-element name="ui-breadcrumb-link">
64
+ <script>
65
+ defineProps({ href: prop.string() });
66
+ </script>
67
+
68
+ <style>
69
+ :host,
70
+ * {
71
+ touch-action: manipulation;
72
+ }
73
+ a {
74
+ color: inherit;
75
+ text-decoration: none;
76
+ border-radius: var(--radius-xs);
77
+ outline: none;
78
+ transition: color var(--default-transition-duration);
79
+ }
80
+ a:hover {
81
+ color: var(--foreground);
82
+ }
83
+ a:focus-visible {
84
+ box-shadow: var(--focus-ring);
85
+ }
86
+ </style>
87
+
88
+ <a part="link" _href="@href"><slot></slot></a>
89
+ </custom-element>
90
+
91
+ <custom-element name="ui-breadcrumb-page">
92
+ <style>
93
+ :host,
94
+ * {
95
+ touch-action: manipulation;
96
+ }
97
+ span {
98
+ font-weight: var(--font-weight-normal);
99
+ color: var(--foreground);
100
+ }
101
+ </style>
102
+
103
+ <span part="page" role="link" aria-disabled="true" aria-current="page"><slot></slot></span>
104
+ </custom-element>
105
+
106
+ <custom-element name="ui-breadcrumb-separator" role="presentation">
107
+ <script>
108
+ internals.ariaHidden = "true";
109
+ </script>
110
+
111
+ <style>
112
+ :host,
113
+ * {
114
+ touch-action: manipulation;
115
+ }
116
+ :host {
117
+ display: inline-flex;
118
+ align-items: center;
119
+ }
120
+ ::slotted(svg),
121
+ svg {
122
+ width: calc(var(--spacing) * 3.5);
123
+ height: calc(var(--spacing) * 3.5);
124
+ }
125
+ </style>
126
+
127
+ <slot><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6" /></svg></slot>
128
+ </custom-element>
129
+
130
+ <custom-element name="ui-breadcrumb-ellipsis">
131
+ <style>
132
+ :host,
133
+ * {
134
+ touch-action: manipulation;
135
+ }
136
+ :host {
137
+ display: inline-flex;
138
+ align-items: center;
139
+ justify-content: center;
140
+ width: calc(var(--spacing) * 9);
141
+ height: calc(var(--spacing) * 9);
142
+ }
143
+ svg {
144
+ width: calc(var(--spacing) * 4);
145
+ height: calc(var(--spacing) * 4);
146
+ }
147
+ span {
148
+ position: absolute;
149
+ width: 1px;
150
+ height: 1px;
151
+ overflow: hidden;
152
+ clip-path: inset(50%);
153
+ white-space: nowrap;
154
+ }
155
+ </style>
156
+
157
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="currentColor"><circle cx="5" cy="12" r="1.5" /><circle cx="12" cy="12" r="1.5" /><circle cx="19" cy="12" r="1.5" /></svg>
158
+ <span part="label"><slot>More</slot></span>
159
+ </custom-element>
@@ -0,0 +1,77 @@
1
+ <custom-element name="ui-bubble">
2
+ <script>
3
+ defineProps({
4
+ variant: prop.enum(["default", "secondary", "muted", "outline", "ghost"]).default("default"),
5
+ align: prop.enum(["start", "end"]).default("start"),
6
+ });
7
+ </script>
8
+
9
+ <style>
10
+ /* A double tap must not zoom the page. Set inside the shadow root, because a page-level
11
+ touch-action does not reach shadow content in iOS Safari. */
12
+ :host,
13
+ * {
14
+ touch-action: manipulation;
15
+ }
16
+ :host {
17
+ display: flex;
18
+ flex-direction: column;
19
+ gap: calc(var(--spacing) * 1);
20
+ width: fit-content;
21
+ max-width: 80%;
22
+ min-width: 0;
23
+ }
24
+ :host(:state(attr-align-is-end)) {
25
+ align-self: flex-end;
26
+ }
27
+ .content {
28
+ padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3);
29
+ border: 1px solid transparent;
30
+ border-radius: var(--radius-2xl);
31
+ font-size: var(--text-sm);
32
+ overflow-wrap: anywhere;
33
+ background: var(--primary);
34
+ color: var(--primary-foreground);
35
+ }
36
+ :host(:state(attr-variant-is-secondary)) .content {
37
+ background: var(--secondary);
38
+ color: var(--secondary-foreground);
39
+ }
40
+ :host(:state(attr-variant-is-muted)) .content {
41
+ background: var(--muted);
42
+ color: var(--foreground);
43
+ }
44
+ :host(:state(attr-variant-is-outline)) .content {
45
+ border-color: var(--border);
46
+ background: var(--background);
47
+ color: var(--foreground);
48
+ }
49
+ :host(:state(attr-variant-is-ghost)) {
50
+ max-width: 100%;
51
+ }
52
+ :host(:state(attr-variant-is-ghost)) .content {
53
+ padding: 0;
54
+ background: transparent;
55
+ color: var(--foreground);
56
+ }
57
+ </style>
58
+
59
+ <div class="content" part="content"><slot></slot></div>
60
+ <slot name="reactions"></slot>
61
+ </custom-element>
62
+
63
+ <custom-element name="ui-bubble-reactions" slot="reactions">
64
+ <style>
65
+ :host,
66
+ * {
67
+ touch-action: manipulation;
68
+ }
69
+ :host {
70
+ display: flex;
71
+ flex-wrap: wrap;
72
+ gap: calc(var(--spacing) * 1);
73
+ }
74
+ </style>
75
+
76
+ <slot></slot>
77
+ </custom-element>
@@ -0,0 +1,98 @@
1
+ <custom-element name="ui-button-group" role="group">
2
+ <script>
3
+ defineProps({ orientation: prop.enum(["horizontal", "vertical"]).default("horizontal") });
4
+ </script>
5
+
6
+ <style>
7
+ /* A double tap must not zoom the page. Set inside the shadow root, because a page-level
8
+ touch-action does not reach shadow content in iOS Safari. */
9
+ :host,
10
+ * {
11
+ touch-action: manipulation;
12
+ }
13
+ :host {
14
+ display: inline-flex;
15
+ align-items: stretch;
16
+ width: fit-content;
17
+ }
18
+ :host(:state(attr-orientation-is-vertical)) {
19
+ flex-direction: column;
20
+ }
21
+ :host(:not(:state(attr-orientation-is-vertical))) ::slotted(:not(:first-child)) {
22
+ --ui-radius-start: 0;
23
+ margin-inline-start: -1px;
24
+ }
25
+ :host(:not(:state(attr-orientation-is-vertical))) ::slotted(:not(:last-child)) {
26
+ --ui-radius-end: 0;
27
+ }
28
+ :host(:state(attr-orientation-is-vertical)) ::slotted(:not(:first-child)) {
29
+ --ui-radius-block-start: 0;
30
+ margin-block-start: -1px;
31
+ }
32
+ :host(:state(attr-orientation-is-vertical)) ::slotted(:not(:last-child)) {
33
+ --ui-radius-block-end: 0;
34
+ }
35
+ </style>
36
+
37
+ <slot></slot>
38
+ </custom-element>
39
+
40
+ <custom-element name="ui-button-group-text">
41
+ <style>
42
+ :host,
43
+ * {
44
+ touch-action: manipulation;
45
+ }
46
+ :host {
47
+ display: flex;
48
+ align-items: center;
49
+ gap: calc(var(--spacing) * 2);
50
+ padding: 0 calc(var(--spacing) * 4);
51
+ border: 1px solid var(--border);
52
+ border-start-start-radius: var(--ui-radius-block-start, var(--ui-radius-start, var(--radius-md)));
53
+ border-end-start-radius: var(--ui-radius-block-end, var(--ui-radius-start, var(--radius-md)));
54
+ border-start-end-radius: var(--ui-radius-block-start, var(--ui-radius-end, var(--radius-md)));
55
+ border-end-end-radius: var(--ui-radius-block-end, var(--ui-radius-end, var(--radius-md)));
56
+ background: var(--muted);
57
+ font-size: var(--text-sm);
58
+ font-weight: var(--font-weight-medium);
59
+ white-space: nowrap;
60
+ box-shadow: var(--shadow-xs);
61
+ }
62
+ ::slotted(svg) {
63
+ width: calc(var(--spacing) * 4);
64
+ height: calc(var(--spacing) * 4);
65
+ flex-shrink: 0;
66
+ }
67
+ </style>
68
+
69
+ <slot></slot>
70
+ </custom-element>
71
+
72
+ <custom-element name="ui-button-group-separator" role="separator">
73
+ <script>
74
+ const props = defineProps({ orientation: prop.enum(["vertical", "horizontal"]).default("vertical") });
75
+
76
+ observe(() => {
77
+ internals.ariaOrientation = props.orientation;
78
+ });
79
+ </script>
80
+
81
+ <style>
82
+ :host,
83
+ * {
84
+ touch-action: manipulation;
85
+ }
86
+ :host {
87
+ position: relative;
88
+ z-index: 1;
89
+ align-self: stretch;
90
+ inline-size: 1px;
91
+ background: var(--input);
92
+ }
93
+ :host(:state(attr-orientation-is-horizontal)) {
94
+ inline-size: auto;
95
+ block-size: 1px;
96
+ }
97
+ </style>
98
+ </custom-element>