@abuzareal/contour-ui 0.4.0 → 0.5.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 (136) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/CONTRACTS.md +7 -1
  3. package/NEXTJS.md +3 -1
  4. package/OVERLAYS.md +52 -0
  5. package/PUBLIC-API.md +179 -162
  6. package/README.md +40 -26
  7. package/RELEASING.md +1 -1
  8. package/SIZE.md +45 -0
  9. package/STYLING.md +68 -0
  10. package/dist/actions.css +7 -0
  11. package/dist/components/hero/Sculpture.js +2 -1
  12. package/dist/components/three/ObjectStudy.js +2 -1
  13. package/dist/components/ui/Alert.d.ts +2 -1
  14. package/dist/components/ui/Alert.js +3 -3
  15. package/dist/components/ui/Avatar.d.ts +3 -1
  16. package/dist/components/ui/Avatar.js +3 -3
  17. package/dist/components/ui/Badge.js +2 -2
  18. package/dist/components/ui/BrandMark.js +2 -1
  19. package/dist/components/ui/Breadcrumbs.d.ts +2 -1
  20. package/dist/components/ui/Breadcrumbs.js +3 -2
  21. package/dist/components/ui/Button.d.ts +2 -0
  22. package/dist/components/ui/Button.js +3 -2
  23. package/dist/components/ui/Card.js +2 -2
  24. package/dist/components/ui/Checkbox.js +3 -3
  25. package/dist/components/ui/CountUp.d.ts +2 -1
  26. package/dist/components/ui/CountUp.js +6 -3
  27. package/dist/components/ui/DataTable.d.ts +1 -0
  28. package/dist/components/ui/DataTable.js +12 -8
  29. package/dist/components/ui/DepthButton.js +2 -2
  30. package/dist/components/ui/Dialog.d.ts +5 -1
  31. package/dist/components/ui/Dialog.js +49 -18
  32. package/dist/components/ui/Disclosure.js +2 -1
  33. package/dist/components/ui/Divider.js +3 -2
  34. package/dist/components/ui/DropdownMenu.d.ts +11 -4
  35. package/dist/components/ui/DropdownMenu.js +109 -66
  36. package/dist/components/ui/EmptyState.js +2 -1
  37. package/dist/components/ui/Field.js +2 -2
  38. package/dist/components/ui/FlipCard.js +2 -2
  39. package/dist/components/ui/FloatingPortal.d.ts +10 -0
  40. package/dist/components/ui/FloatingPortal.js +51 -0
  41. package/dist/components/ui/IconButton.js +2 -2
  42. package/dist/components/ui/Kbd.js +2 -1
  43. package/dist/components/ui/Magnetic.js +2 -1
  44. package/dist/components/ui/Marquee.js +3 -2
  45. package/dist/components/ui/OverlayTrigger.d.ts +11 -0
  46. package/dist/components/ui/OverlayTrigger.js +5 -0
  47. package/dist/components/ui/Pagination.d.ts +5 -1
  48. package/dist/components/ui/Pagination.js +3 -2
  49. package/dist/components/ui/Popover.d.ts +18 -8
  50. package/dist/components/ui/Popover.js +58 -17
  51. package/dist/components/ui/ProgressBar.js +2 -2
  52. package/dist/components/ui/RadioGroup.js +5 -5
  53. package/dist/components/ui/Reveal.d.ts +0 -1
  54. package/dist/components/ui/Reveal.js +4 -3
  55. package/dist/components/ui/RevealHeading.js +2 -1
  56. package/dist/components/ui/ScrollProgress.js +2 -1
  57. package/dist/components/ui/SectionLabel.js +2 -1
  58. package/dist/components/ui/SegmentedControl.js +6 -3
  59. package/dist/components/ui/SelectField.js +3 -2
  60. package/dist/components/ui/Skeleton.js +2 -2
  61. package/dist/components/ui/Slider.js +3 -3
  62. package/dist/components/ui/Spinner.js +2 -2
  63. package/dist/components/ui/Stat.js +2 -1
  64. package/dist/components/ui/Stepper.js +3 -3
  65. package/dist/components/ui/Switch.d.ts +2 -0
  66. package/dist/components/ui/Switch.js +6 -7
  67. package/dist/components/ui/Tabs.js +7 -5
  68. package/dist/components/ui/Tag.d.ts +2 -1
  69. package/dist/components/ui/Tag.js +4 -3
  70. package/dist/components/ui/TextArea.js +2 -1
  71. package/dist/components/ui/TextField.js +3 -2
  72. package/dist/components/ui/ThemeScope.d.ts +13 -0
  73. package/dist/components/ui/ThemeScope.js +10 -0
  74. package/dist/components/ui/ThemeToggle.d.ts +3 -0
  75. package/dist/components/ui/ThemeToggle.js +4 -3
  76. package/dist/components/ui/TiltCard.js +3 -2
  77. package/dist/components/ui/Timeline.js +2 -2
  78. package/dist/components/ui/ToastProvider.d.ts +5 -2
  79. package/dist/components/ui/ToastProvider.js +5 -5
  80. package/dist/components/ui/Tooltip.d.ts +4 -4
  81. package/dist/components/ui/Tooltip.js +70 -10
  82. package/dist/data-display.css +5 -0
  83. package/dist/effects.css +6 -0
  84. package/dist/feedback.css +5 -0
  85. package/dist/fonts-latin.css +10 -4
  86. package/dist/fonts.css +8 -0
  87. package/dist/forms.css +5 -0
  88. package/dist/hooks/useDismiss.d.ts +12 -3
  89. package/dist/hooks/useDismiss.js +5 -21
  90. package/dist/hooks/useFloatingPanel.d.ts +14 -0
  91. package/dist/hooks/useFloatingPanel.js +157 -0
  92. package/dist/hooks/useLayerDismiss.d.ts +4 -0
  93. package/dist/hooks/useLayerDismiss.js +48 -0
  94. package/dist/hooks/useMobileMenu.d.ts +0 -1
  95. package/dist/hooks/useMobileMenu.js +11 -16
  96. package/dist/hooks/usePanelFocus.d.ts +10 -0
  97. package/dist/hooks/usePanelFocus.js +60 -0
  98. package/dist/hooks/useTheme.d.ts +1 -0
  99. package/dist/hooks/useTheme.js +18 -5
  100. package/dist/index.d.ts +5 -0
  101. package/dist/index.js +1 -0
  102. package/dist/kit/forms.css +11 -2
  103. package/dist/kit/navigation.css +4 -0
  104. package/dist/kit/overlays.css +8 -4
  105. package/dist/lib/classNames.d.ts +2 -0
  106. package/dist/lib/classNames.js +16 -1
  107. package/dist/lib/componentClasses.d.ts +1 -0
  108. package/dist/lib/componentClasses.js +2 -0
  109. package/dist/lib/keyboard.d.ts +1 -1
  110. package/dist/lib/keyboard.js +5 -2
  111. package/dist/lib/layers.d.ts +18 -0
  112. package/dist/lib/layers.js +128 -0
  113. package/dist/lib/themeScope.d.ts +5 -0
  114. package/dist/lib/themeScope.js +3 -0
  115. package/dist/minimal-reset.css +6 -0
  116. package/dist/navigation.css +5 -0
  117. package/dist/overlays.css +5 -0
  118. package/dist/scoped/base.css +183 -0
  119. package/dist/scoped/kit/actions.css +209 -0
  120. package/dist/scoped/kit/data-display.css +492 -0
  121. package/dist/scoped/kit/effects.css +140 -0
  122. package/dist/scoped/kit/feedback.css +309 -0
  123. package/dist/scoped/kit/forms.css +370 -0
  124. package/dist/scoped/kit/navigation.css +266 -0
  125. package/dist/scoped/kit/overlays.css +299 -0
  126. package/dist/scoped/marquee.css +58 -0
  127. package/dist/scoped/spinner.css +20 -0
  128. package/dist/scoped/theme-toggle.css +38 -0
  129. package/dist/scoped/tokens.css +119 -0
  130. package/dist/scoped/ui.css +127 -0
  131. package/dist/scoped/utilities.css +17 -0
  132. package/dist/scoped-tokens.css +1 -0
  133. package/dist/scoped.css +12 -0
  134. package/dist/theme-toggle.css +2 -2
  135. package/dist/tokens.json +710 -0
  136. package/package.json +26 -5
@@ -0,0 +1,140 @@
1
+ /* Kit — effects: count-up, 3D tilt and flip cards, scroll progress, and 3D stage canvases. */
2
+
3
+ .contour-count-up {
4
+ font-variant-numeric: tabular-nums;
5
+ }
6
+
7
+ .contour-tilt-stage,
8
+ .contour-flip-stage {
9
+ perspective: 1000px;
10
+ }
11
+
12
+ .contour-tilt-card {
13
+ position: relative;
14
+ overflow: hidden;
15
+ transform: rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
16
+ transform-style: preserve-3d;
17
+ transition: transform 500ms var(--contour-ease);
18
+ }
19
+
20
+ .contour-tilt-card:hover {
21
+ transition-duration: 120ms;
22
+ }
23
+
24
+ .contour-tilt-glare {
25
+ position: absolute;
26
+ inset: 0;
27
+ pointer-events: none;
28
+ background: radial-gradient(
29
+ circle at var(--glare-x, 50%) var(--glare-y, 50%),
30
+ #ffffff52,
31
+ transparent 55%
32
+ );
33
+ opacity: 0;
34
+ transition: opacity var(--contour-duration-base);
35
+ }
36
+
37
+ .contour-tilt-card:hover .contour-tilt-glare {
38
+ opacity: 1;
39
+ }
40
+
41
+ .contour-flip-stage {
42
+ display: grid;
43
+ justify-items: start;
44
+ gap: 16px;
45
+ }
46
+
47
+ .contour-flip-card {
48
+ position: relative;
49
+ width: 100%;
50
+ aspect-ratio: 1.6;
51
+ transform-style: preserve-3d;
52
+ transition: transform 900ms var(--contour-ease);
53
+ }
54
+
55
+ .contour-flip-card.contour-is-flipped {
56
+ transform: rotateY(180deg);
57
+ }
58
+
59
+ .contour-flip-face {
60
+ position: absolute;
61
+ inset: 0;
62
+ backface-visibility: hidden;
63
+ }
64
+
65
+ .contour-flip-back {
66
+ transform: rotateY(180deg);
67
+ }
68
+
69
+ .contour-flip-toggle {
70
+ display: inline-flex;
71
+ align-items: center;
72
+ gap: 8px;
73
+ padding-block: 6px;
74
+ border-bottom: 1px solid currentColor;
75
+ text-transform: uppercase;
76
+ }
77
+
78
+ .contour-scroll-progress {
79
+ position: fixed;
80
+ top: 0;
81
+ left: 0;
82
+ right: 0;
83
+ z-index: 60;
84
+ height: 2px;
85
+ background: var(--contour-acid);
86
+ transform: scaleX(var(--scroll-progress, 0));
87
+ transform-origin: left;
88
+ }
89
+
90
+ .contour-stage-canvas {
91
+ position: relative;
92
+ width: 100%;
93
+ height: 100%;
94
+ }
95
+
96
+ .contour-stage-canvas canvas {
97
+ width: 100%;
98
+ height: 100%;
99
+ transition: opacity 600ms ease;
100
+ }
101
+
102
+ .contour-stage-canvas:not([data-state="ready"]) canvas {
103
+ opacity: 0;
104
+ }
105
+
106
+ /* Depth button: the face sits on an ink base and travels down when pressed. */
107
+ .contour-depth-button {
108
+ display: inline-block;
109
+ padding: 0 0 8px;
110
+ border-radius: var(--contour-radius-pill);
111
+ background: var(--contour-depth-base);
112
+ }
113
+
114
+ .contour-depth-button-face {
115
+ display: inline-flex;
116
+ align-items: center;
117
+ gap: 10px;
118
+ height: 52px;
119
+ padding-inline: 28px;
120
+ border: 1px solid var(--contour-ink);
121
+ border-radius: var(--contour-radius-pill);
122
+ background: var(--contour-acid);
123
+ color: var(--contour-ink);
124
+ font-size: 14px;
125
+ font-weight: 500;
126
+ transform: translateY(-2px);
127
+ transition: transform 140ms var(--contour-ease);
128
+ }
129
+
130
+ .contour-depth-button:hover .contour-depth-button-face {
131
+ transform: translateY(-5px);
132
+ }
133
+
134
+ .contour-depth-button:active .contour-depth-button-face {
135
+ transform: translateY(6px);
136
+ }
137
+
138
+ .contour-depth-button:focus-visible {
139
+ outline-offset: 4px;
140
+ }
@@ -0,0 +1,309 @@
1
+ /* Kit — feedback: alerts, toasts, progress, spinner, and skeletons. */
2
+
3
+ .contour-alert {
4
+ --contour-alert-accent: var(--contour-fg);
5
+ --contour-alert-bg: var(--contour-surface);
6
+ display: flex;
7
+ align-items: flex-start;
8
+ gap: 14px;
9
+ padding: 18px 20px;
10
+ border-inline-start: 3px solid var(--contour-alert-accent);
11
+ background: var(--contour-alert-bg);
12
+ }
13
+
14
+ .contour-alert-accent {
15
+ --contour-alert-accent: var(--contour-olive);
16
+ --contour-alert-bg: color-mix(in srgb, var(--contour-acid) 22%, var(--contour-surface));
17
+ }
18
+
19
+ .contour-alert-success {
20
+ --contour-alert-accent: var(--contour-success);
21
+ --contour-alert-bg: var(--contour-success-soft);
22
+ }
23
+
24
+ .contour-alert-info {
25
+ --contour-alert-accent: var(--contour-info);
26
+ --contour-alert-bg: var(--contour-info-soft);
27
+ }
28
+
29
+ .contour-alert-warning {
30
+ --contour-alert-accent: var(--contour-warning);
31
+ --contour-alert-bg: var(--contour-warning-soft);
32
+ }
33
+
34
+ .contour-alert-danger {
35
+ --contour-alert-accent: var(--contour-danger);
36
+ --contour-alert-bg: var(--contour-danger-soft);
37
+ }
38
+
39
+ .contour-alert-icon {
40
+ display: inline-flex;
41
+ margin-top: 1px;
42
+ color: var(--contour-alert-accent);
43
+ }
44
+
45
+ .contour-alert-content {
46
+ display: grid;
47
+ flex: 1;
48
+ gap: 4px;
49
+ min-width: 0;
50
+ }
51
+
52
+ .contour-alert-title {
53
+ font-size: 14px;
54
+ font-weight: 600;
55
+ }
56
+
57
+ .contour-alert-body {
58
+ font-size: 14px;
59
+ line-height: 1.6;
60
+ color: color-mix(in srgb, var(--contour-fg) 80%, transparent);
61
+ }
62
+
63
+ .contour-alert-action {
64
+ flex-shrink: 0;
65
+ align-self: center;
66
+ }
67
+
68
+ .contour-alert-dismiss {
69
+ display: grid;
70
+ place-items: center;
71
+ flex-shrink: 0;
72
+ width: 28px;
73
+ height: 28px;
74
+ margin: -4px -6px 0 0;
75
+ border-radius: 50%;
76
+ color: var(--contour-muted);
77
+ transition:
78
+ background var(--contour-duration-fast),
79
+ color var(--contour-duration-fast);
80
+ }
81
+
82
+ .contour-alert-dismiss:hover {
83
+ background: var(--contour-acid);
84
+ color: var(--contour-ink);
85
+ }
86
+
87
+ /* Banner: one-line announcement strip on the inverted surface. */
88
+ .contour-alert-banner {
89
+ --contour-alert-accent: var(--contour-inverse-accent);
90
+ --contour-alert-bg: var(--contour-invert-bg);
91
+ align-items: center;
92
+ border-inline-start: 0;
93
+ color: var(--contour-invert-fg);
94
+ }
95
+
96
+ .contour-alert-banner .contour-alert-content {
97
+ display: flex;
98
+ flex-wrap: wrap;
99
+ align-items: baseline;
100
+ gap: 4px 12px;
101
+ }
102
+
103
+ .contour-alert-banner .contour-alert-body,
104
+ .contour-alert-banner .contour-alert-dismiss {
105
+ color: color-mix(in srgb, var(--contour-invert-fg) 72%, transparent);
106
+ }
107
+
108
+ .contour-toast-viewport {
109
+ position: fixed;
110
+ right: 24px;
111
+ bottom: 24px;
112
+ z-index: 80;
113
+ display: grid;
114
+ gap: 10px;
115
+ width: min(380px, calc(100vw - 32px));
116
+ }
117
+
118
+ .contour-toast {
119
+ display: flex;
120
+ align-items: flex-start;
121
+ gap: 14px;
122
+ padding: 16px 16px 16px 0;
123
+ overflow: hidden;
124
+ background: var(--contour-ink);
125
+ color: var(--contour-paper);
126
+ box-shadow: var(--contour-shadow-floating);
127
+ animation: contour-toast-in var(--contour-duration-slow) var(--contour-ease) both;
128
+ border: 1px solid var(--contour-floating-outline);
129
+ }
130
+
131
+ .contour-toast-bar {
132
+ align-self: stretch;
133
+ width: 3px;
134
+ margin-block: -16px;
135
+ background: var(--contour-acid);
136
+ }
137
+
138
+ .contour-toast-success .contour-toast-bar {
139
+ background: #b5d33f;
140
+ }
141
+
142
+ .contour-toast-info .contour-toast-bar {
143
+ background: #8fc0d6;
144
+ }
145
+
146
+ .contour-toast-warning .contour-toast-bar {
147
+ background: #f0c063;
148
+ }
149
+
150
+ .contour-toast-danger .contour-toast-bar {
151
+ background: #ff8a70;
152
+ }
153
+
154
+ .contour-toast-content {
155
+ display: grid;
156
+ flex: 1;
157
+ gap: 4px;
158
+ }
159
+
160
+ .contour-toast-content strong {
161
+ font-size: 14px;
162
+ font-weight: 600;
163
+ }
164
+
165
+ .contour-toast-content p {
166
+ font-size: 13px;
167
+ line-height: 1.55;
168
+ color: #c0c5b8;
169
+ }
170
+
171
+ .contour-toast-close {
172
+ display: grid;
173
+ place-items: center;
174
+ width: 28px;
175
+ height: 28px;
176
+ margin-top: -4px;
177
+ border-radius: 50%;
178
+ color: #c0c5b8;
179
+ }
180
+
181
+ .contour-toast-close:hover {
182
+ background: var(--contour-acid);
183
+ color: var(--contour-ink);
184
+ }
185
+
186
+ @keyframes contour-toast-in {
187
+ from {
188
+ opacity: 0;
189
+ transform: translateY(16px) scale(0.98);
190
+ }
191
+ }
192
+
193
+ .contour-progress {
194
+ display: grid;
195
+ gap: 10px;
196
+ }
197
+
198
+ .contour-progress-header {
199
+ display: flex;
200
+ justify-content: space-between;
201
+ color: var(--contour-muted);
202
+ text-transform: uppercase;
203
+ }
204
+
205
+ .contour-progress-track {
206
+ position: relative;
207
+ height: 2px;
208
+ overflow: hidden;
209
+ background: var(--contour-line);
210
+ }
211
+
212
+ .contour-progress-fill {
213
+ position: absolute;
214
+ inset: 0 auto 0 0;
215
+ width: var(--contour-progress, var(--progress));
216
+ background: var(--contour-fg);
217
+ transition: width var(--contour-duration-slow) var(--contour-ease);
218
+ }
219
+
220
+ .contour-progress-accent .contour-progress-fill {
221
+ background: var(--contour-olive);
222
+ }
223
+
224
+ .contour-progress-success .contour-progress-fill {
225
+ background: var(--contour-success);
226
+ }
227
+
228
+ .contour-progress-danger .contour-progress-fill {
229
+ background: var(--contour-danger);
230
+ }
231
+
232
+ .contour-progress-indeterminate .contour-progress-fill {
233
+ width: 35%;
234
+ animation: contour-progress-sweep 1.3s var(--contour-ease) infinite;
235
+ }
236
+
237
+ @keyframes contour-progress-sweep {
238
+ from {
239
+ transform: translateX(-100%);
240
+ }
241
+ to {
242
+ transform: translateX(300%);
243
+ }
244
+ }
245
+
246
+ .contour-spinner {
247
+ display: inline-grid;
248
+ place-items: center;
249
+ color: var(--contour-olive);
250
+ }
251
+
252
+ .contour-spinner svg {
253
+ animation: contour-spin 1.1s linear infinite;
254
+ }
255
+
256
+ .contour-button .contour-spinner {
257
+ color: inherit;
258
+ }
259
+
260
+ @keyframes contour-spin {
261
+ to {
262
+ transform: rotate(360deg);
263
+ }
264
+ }
265
+
266
+ .contour-skeleton {
267
+ display: block;
268
+ background: linear-gradient(
269
+ 100deg,
270
+ transparent 30%,
271
+ color-mix(in srgb, var(--contour-bg) 70%, transparent) 50%,
272
+ transparent 70%
273
+ )
274
+ var(--contour-surface-sunken);
275
+ background-size: 220% 100%;
276
+ animation: contour-shimmer 1.6s linear infinite;
277
+ }
278
+
279
+ .contour-skeleton-line {
280
+ width: 100%;
281
+ height: 12px;
282
+ }
283
+
284
+ .contour-skeleton-block {
285
+ width: 100%;
286
+ height: 120px;
287
+ }
288
+
289
+ .contour-skeleton-circle {
290
+ width: 44px;
291
+ height: 44px;
292
+ border-radius: 50%;
293
+ }
294
+
295
+ @keyframes contour-shimmer {
296
+ from {
297
+ background-position: 120% 0;
298
+ }
299
+ to {
300
+ background-position: -120% 0;
301
+ }
302
+ }
303
+
304
+ @media (max-width: 767px) {
305
+ .contour-toast-viewport {
306
+ right: 16px;
307
+ bottom: 16px;
308
+ }
309
+ }