@realmorg/ui 2.0.0-alpha.2 → 2.0.0-alpha.4

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 (65) hide show
  1. package/README.md +6 -6
  2. package/components/accordion.html +40 -1
  3. package/components/alert-dialog.html +40 -0
  4. package/components/alert.html +14 -0
  5. package/components/aspect-ratio.html +6 -0
  6. package/components/attachment.html +14 -0
  7. package/components/avatar.html +22 -0
  8. package/components/badge.html +6 -0
  9. package/components/breadcrumb.html +30 -0
  10. package/components/bubble.html +10 -0
  11. package/components/button-group.html +14 -0
  12. package/components/button.html +41 -22
  13. package/components/calendar.html +6 -0
  14. package/components/card.html +30 -0
  15. package/components/carousel.html +22 -0
  16. package/components/chart.html +6 -0
  17. package/components/checkbox.html +6 -0
  18. package/components/code-block.html +6 -0
  19. package/components/collapsible.html +14 -0
  20. package/components/combobox.html +26 -0
  21. package/components/command.html +12 -0
  22. package/components/context-menu.html +14 -0
  23. package/components/dialog.html +49 -3
  24. package/components/direction.html +6 -0
  25. package/components/drawer.html +46 -3
  26. package/components/dropdown-menu.html +75 -1
  27. package/components/empty.html +26 -0
  28. package/components/field.html +26 -0
  29. package/components/hover-card.html +41 -1
  30. package/components/input-group.html +16 -0
  31. package/components/input-otp.html +12 -0
  32. package/components/input.html +12 -0
  33. package/components/item.html +38 -0
  34. package/components/kbd.html +10 -0
  35. package/components/label.html +6 -0
  36. package/components/marker.html +6 -0
  37. package/components/menubar.html +36 -1
  38. package/components/message-scroller.html +6 -0
  39. package/components/message.html +18 -0
  40. package/components/navigation-menu.html +29 -0
  41. package/components/pagination.html +6 -0
  42. package/components/popover.html +53 -1
  43. package/components/progress.html +6 -0
  44. package/components/radio-group.html +6 -0
  45. package/components/resizable.html +14 -0
  46. package/components/scroll-area.html +6 -0
  47. package/components/select.html +12 -0
  48. package/components/separator.html +6 -0
  49. package/components/sheet.html +30 -0
  50. package/components/sidebar.html +52 -2
  51. package/components/skeleton.html +6 -0
  52. package/components/slider.html +28 -1
  53. package/components/spinner.html +6 -0
  54. package/components/switch.html +6 -0
  55. package/components/table.html +6 -0
  56. package/components/tabs.html +18 -0
  57. package/components/textarea.html +12 -0
  58. package/components/toaster.html +6 -0
  59. package/components/toggle-group.html +6 -0
  60. package/components/toggle.html +6 -0
  61. package/components/tooltip.html +43 -1
  62. package/dist/theme.css +13 -0
  63. package/dist/ui.html +1171 -37
  64. package/package.json +4 -3
  65. package/theme.css +13 -0
@@ -20,6 +20,12 @@
20
20
  </script>
21
21
 
22
22
  <style>
23
+ /* A double tap must not zoom the page. Set inside the shadow root, because a page-level
24
+ touch-action does not reach shadow content in iOS Safari. */
25
+ :host,
26
+ * {
27
+ touch-action: manipulation;
28
+ }
23
29
  :host {
24
30
  display: block;
25
31
  width: 100%;
@@ -38,6 +38,12 @@
38
38
  </script>
39
39
 
40
40
  <style>
41
+ /* A double tap must not zoom the page. Set inside the shadow root, because a page-level
42
+ touch-action does not reach shadow content in iOS Safari. */
43
+ :host,
44
+ * {
45
+ touch-action: manipulation;
46
+ }
41
47
  :host {
42
48
  display: flex;
43
49
  flex-direction: column;
@@ -55,6 +61,10 @@
55
61
 
56
62
  <custom-element name="ui-tabs-list">
57
63
  <style>
64
+ :host,
65
+ * {
66
+ touch-action: manipulation;
67
+ }
58
68
  :host {
59
69
  display: block;
60
70
  width: fit-content;
@@ -91,6 +101,10 @@
91
101
  </script>
92
102
 
93
103
  <style>
104
+ :host,
105
+ * {
106
+ touch-action: manipulation;
107
+ }
94
108
  :host {
95
109
  display: flex;
96
110
  flex: 1;
@@ -150,6 +164,10 @@
150
164
 
151
165
  <custom-element name="ui-tabs-content" role="tabpanel">
152
166
  <style>
167
+ :host,
168
+ * {
169
+ touch-action: manipulation;
170
+ }
153
171
  :host {
154
172
  display: block;
155
173
  flex: 1;
@@ -15,6 +15,12 @@
15
15
  </script>
16
16
 
17
17
  <style>
18
+ /* A double tap must not zoom the page. Set inside the shadow root, because a page-level
19
+ touch-action does not reach shadow content in iOS Safari. */
20
+ :host,
21
+ * {
22
+ touch-action: manipulation;
23
+ }
18
24
  :host {
19
25
  display: block;
20
26
  }
@@ -35,6 +41,12 @@
35
41
  field-sizing: content;
36
42
  resize: vertical;
37
43
  }
44
+ /* iOS Safari zooms in on a focused field whose text is under 16px. */
45
+ @media (pointer: coarse) {
46
+ textarea {
47
+ font-size: var(--text-base);
48
+ }
49
+ }
38
50
  textarea::placeholder {
39
51
  color: var(--muted-foreground);
40
52
  }
@@ -43,6 +43,12 @@
43
43
  </script>
44
44
 
45
45
  <style>
46
+ /* A double tap must not zoom the page. Set inside the shadow root, because a page-level
47
+ touch-action does not reach shadow content in iOS Safari. */
48
+ :host,
49
+ * {
50
+ touch-action: manipulation;
51
+ }
46
52
  ol {
47
53
  position: fixed;
48
54
  inset: auto calc(var(--spacing) * 4) calc(var(--spacing) * 4) auto;
@@ -37,6 +37,12 @@
37
37
  </script>
38
38
 
39
39
  <style>
40
+ /* A double tap must not zoom the page. Set inside the shadow root, because a page-level
41
+ touch-action does not reach shadow content in iOS Safari. */
42
+ :host,
43
+ * {
44
+ touch-action: manipulation;
45
+ }
40
46
  :host {
41
47
  display: inline-flex;
42
48
  align-items: center;
@@ -16,6 +16,12 @@
16
16
  </script>
17
17
 
18
18
  <style>
19
+ /* A double tap must not zoom the page. Set inside the shadow root, because a page-level
20
+ touch-action does not reach shadow content in iOS Safari. */
21
+ :host,
22
+ * {
23
+ touch-action: manipulation;
24
+ }
19
25
  :host {
20
26
  display: inline-flex;
21
27
  }
@@ -38,6 +38,12 @@
38
38
  </script>
39
39
 
40
40
  <style>
41
+ /* A double tap must not zoom the page. Set inside the shadow root, because a page-level
42
+ touch-action does not reach shadow content in iOS Safari. */
43
+ :host,
44
+ * {
45
+ touch-action: manipulation;
46
+ }
41
47
  :host {
42
48
  display: contents;
43
49
  }
@@ -48,6 +54,10 @@
48
54
 
49
55
  <custom-element name="ui-tooltip-trigger">
50
56
  <style>
57
+ :host,
58
+ * {
59
+ touch-action: manipulation;
60
+ }
51
61
  :host {
52
62
  display: inline-block;
53
63
  vertical-align: middle;
@@ -59,14 +69,32 @@
59
69
 
60
70
  <custom-element name="ui-tooltip-content" role="tooltip">
61
71
  <script>
62
- defineProps({
72
+ const props = defineProps({
63
73
  placement: prop.enum(["top", "bottom", "left", "right"]).default("top"),
64
74
  });
65
75
 
76
+ const BLOCK_SIDES = new Set(["top", "bottom"]);
77
+
78
+ // Once open, it keeps the side it opened on. Re-deciding while the page scrolls makes it jump,
79
+ // because iOS Safari's toolbar changes the viewport height mid-scroll.
80
+ // Firefox holds a box that does not fit against the screen edge, so touching it counts too.
81
+ function opened(event) {
82
+ internals.states.delete("flipped");
83
+ if (event.newState !== "open" || !BLOCK_SIDES.has(props.placement)) return;
84
+ const box = host.getBoundingClientRect();
85
+ if (box.bottom >= innerHeight || box.top <= 0) internals.states.add("flipped");
86
+ }
87
+
66
88
  attrs.popover ??= "manual";
89
+
90
+ listen("toggle", opened);
67
91
  </script>
68
92
 
69
93
  <style>
94
+ :host,
95
+ * {
96
+ touch-action: manipulation;
97
+ }
70
98
  :host {
71
99
  margin: 0 0 calc(var(--spacing) * 1);
72
100
  padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 3);
@@ -76,6 +104,9 @@
76
104
  color: var(--background);
77
105
  font-size: var(--text-xs);
78
106
  inset: auto;
107
+ height: fit-content;
108
+ max-height: calc(100svh - calc(var(--spacing) * 8));
109
+ overflow-y: auto;
79
110
  position-area: top;
80
111
  position-try-fallbacks: flip-block;
81
112
  }
@@ -83,6 +114,17 @@
83
114
  position-area: bottom;
84
115
  margin: calc(var(--spacing) * 1) 0 0;
85
116
  }
117
+ :host(:popover-open) {
118
+ position-try-fallbacks: none;
119
+ }
120
+ :host(:state(flipped)) {
121
+ position-area: bottom;
122
+ margin: calc(var(--spacing) * 1) 0 0;
123
+ }
124
+ :host(:state(flipped):state(attr-placement-is-bottom)) {
125
+ position-area: top;
126
+ margin: 0 0 calc(var(--spacing) * 1);
127
+ }
86
128
  :host(:state(attr-placement-is-left)) {
87
129
  position-area: left;
88
130
  margin: 0 calc(var(--spacing) * 1) 0 0;
package/dist/theme.css CHANGED
@@ -138,6 +138,19 @@
138
138
  }
139
139
  }
140
140
 
141
+ /* Taps respond at once and a double tap does not zoom. Pinch zoom still works. */
142
+ html {
143
+ touch-action: manipulation;
144
+ }
145
+
146
+ /* iOS Safari only sends clicks for taps on clickable elements, so tapping outside an open popover
147
+ or menu would not close it. Touch screens show no cursor, so this changes nothing visible. */
148
+ @media (pointer: coarse) {
149
+ html {
150
+ cursor: pointer;
151
+ }
152
+ }
153
+
141
154
  body {
142
155
  background: var(--background);
143
156
  color: var(--foreground);