@abuzareal/contour-ui 0.4.0 → 0.6.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 (186) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/COMBOBOX.md +87 -0
  3. package/CONTRACTS.md +23 -17
  4. package/DOCS.md +80 -0
  5. package/FOUNDATION.md +35 -0
  6. package/GETTING-STARTED.md +63 -0
  7. package/NEXTJS.md +5 -1
  8. package/OVERLAYS.md +52 -0
  9. package/PUBLIC-API.md +189 -162
  10. package/README.md +44 -28
  11. package/RECIPES.md +43 -0
  12. package/RELEASING.md +2 -2
  13. package/SIZE.md +51 -0
  14. package/STYLING.md +68 -0
  15. package/dist/actions.css +7 -0
  16. package/dist/components/hero/Sculpture.js +2 -1
  17. package/dist/components/three/ObjectStudy.js +2 -1
  18. package/dist/components/ui/Alert.d.ts +2 -1
  19. package/dist/components/ui/Alert.js +3 -3
  20. package/dist/components/ui/Avatar.d.ts +3 -1
  21. package/dist/components/ui/Avatar.js +3 -3
  22. package/dist/components/ui/Badge.js +2 -2
  23. package/dist/components/ui/BrandMark.js +2 -1
  24. package/dist/components/ui/Breadcrumbs.d.ts +2 -1
  25. package/dist/components/ui/Breadcrumbs.js +3 -2
  26. package/dist/components/ui/Button.d.ts +2 -0
  27. package/dist/components/ui/Button.js +3 -2
  28. package/dist/components/ui/Card.js +2 -2
  29. package/dist/components/ui/Checkbox.js +3 -3
  30. package/dist/components/ui/Combobox.d.ts +325 -0
  31. package/dist/components/ui/Combobox.js +120 -0
  32. package/dist/components/ui/Combobox.types.d.ts +46 -0
  33. package/dist/components/ui/Combobox.types.js +1 -0
  34. package/dist/components/ui/CountUp.d.ts +2 -1
  35. package/dist/components/ui/CountUp.js +6 -3
  36. package/dist/components/ui/DataTable.d.ts +1 -0
  37. package/dist/components/ui/DataTable.js +15 -10
  38. package/dist/components/ui/DepthButton.js +2 -2
  39. package/dist/components/ui/Dialog.d.ts +5 -1
  40. package/dist/components/ui/Dialog.js +49 -18
  41. package/dist/components/ui/Disclosure.js +2 -1
  42. package/dist/components/ui/Divider.js +3 -2
  43. package/dist/components/ui/DropdownMenu.d.ts +11 -4
  44. package/dist/components/ui/DropdownMenu.js +109 -66
  45. package/dist/components/ui/EmptyState.js +2 -1
  46. package/dist/components/ui/Field.js +2 -2
  47. package/dist/components/ui/FlipCard.js +2 -2
  48. package/dist/components/ui/FloatingPortal.d.ts +10 -0
  49. package/dist/components/ui/FloatingPortal.js +13 -0
  50. package/dist/components/ui/FloatingScope.d.ts +9 -0
  51. package/dist/components/ui/FloatingScope.js +43 -0
  52. package/dist/components/ui/IconButton.js +2 -2
  53. package/dist/components/ui/Kbd.js +2 -1
  54. package/dist/components/ui/Magnetic.js +2 -1
  55. package/dist/components/ui/Marquee.js +3 -2
  56. package/dist/components/ui/OverlayTrigger.d.ts +11 -0
  57. package/dist/components/ui/OverlayTrigger.js +5 -0
  58. package/dist/components/ui/Pagination.d.ts +5 -1
  59. package/dist/components/ui/Pagination.js +3 -2
  60. package/dist/components/ui/Popover.d.ts +18 -8
  61. package/dist/components/ui/Popover.js +58 -17
  62. package/dist/components/ui/ProgressBar.js +2 -2
  63. package/dist/components/ui/RadioGroup.js +5 -5
  64. package/dist/components/ui/Reveal.d.ts +0 -1
  65. package/dist/components/ui/Reveal.js +4 -3
  66. package/dist/components/ui/RevealHeading.js +2 -1
  67. package/dist/components/ui/ScrollProgress.js +2 -1
  68. package/dist/components/ui/SectionLabel.js +2 -1
  69. package/dist/components/ui/SegmentedControl.js +6 -3
  70. package/dist/components/ui/SelectField.js +3 -2
  71. package/dist/components/ui/Skeleton.js +2 -2
  72. package/dist/components/ui/Slider.js +3 -3
  73. package/dist/components/ui/Spinner.js +2 -2
  74. package/dist/components/ui/Stat.js +2 -1
  75. package/dist/components/ui/Stepper.js +3 -3
  76. package/dist/components/ui/Switch.d.ts +2 -0
  77. package/dist/components/ui/Switch.js +6 -7
  78. package/dist/components/ui/Table.d.ts +20 -0
  79. package/dist/components/ui/Table.js +9 -0
  80. package/dist/components/ui/Tabs.js +7 -5
  81. package/dist/components/ui/Tag.d.ts +2 -1
  82. package/dist/components/ui/Tag.js +4 -3
  83. package/dist/components/ui/TextArea.js +2 -1
  84. package/dist/components/ui/TextField.js +3 -2
  85. package/dist/components/ui/ThemeScope.d.ts +13 -0
  86. package/dist/components/ui/ThemeScope.js +10 -0
  87. package/dist/components/ui/ThemeToggle.d.ts +3 -0
  88. package/dist/components/ui/ThemeToggle.js +4 -3
  89. package/dist/components/ui/TiltCard.js +3 -2
  90. package/dist/components/ui/Timeline.js +2 -2
  91. package/dist/components/ui/ToastProvider.d.ts +5 -2
  92. package/dist/components/ui/ToastProvider.js +5 -5
  93. package/dist/components/ui/Tooltip.d.ts +4 -4
  94. package/dist/components/ui/Tooltip.js +70 -10
  95. package/dist/data-display.css +5 -0
  96. package/dist/effects.css +6 -0
  97. package/dist/feedback.css +5 -0
  98. package/dist/fonts-latin.css +10 -4
  99. package/dist/fonts.css +8 -0
  100. package/dist/forms.css +5 -0
  101. package/dist/hooks/useComboboxAnchor.d.ts +17 -0
  102. package/dist/hooks/useComboboxAnchor.js +61 -0
  103. package/dist/hooks/useDismiss.d.ts +12 -3
  104. package/dist/hooks/useDismiss.js +5 -21
  105. package/dist/hooks/useFloatingPanel.d.ts +14 -0
  106. package/dist/hooks/useFloatingPanel.js +157 -0
  107. package/dist/hooks/useLayerDismiss.d.ts +4 -0
  108. package/dist/hooks/useLayerDismiss.js +48 -0
  109. package/dist/hooks/useMobileMenu.d.ts +0 -1
  110. package/dist/hooks/useMobileMenu.js +11 -16
  111. package/dist/hooks/usePanelFocus.d.ts +10 -0
  112. package/dist/hooks/usePanelFocus.js +60 -0
  113. package/dist/hooks/useTheme.d.ts +1 -0
  114. package/dist/hooks/useTheme.js +18 -5
  115. package/dist/index.d.ts +7 -0
  116. package/dist/index.js +3 -0
  117. package/dist/kit/data-display.css +6 -0
  118. package/dist/kit/forms.css +45 -2
  119. package/dist/kit/navigation.css +4 -0
  120. package/dist/kit/overlays.css +8 -4
  121. package/dist/lib/classNames.d.ts +2 -0
  122. package/dist/lib/classNames.js +16 -1
  123. package/dist/lib/componentClasses.d.ts +1 -0
  124. package/dist/lib/componentClasses.js +2 -0
  125. package/dist/lib/keyboard.d.ts +1 -1
  126. package/dist/lib/keyboard.js +5 -2
  127. package/dist/lib/layers.d.ts +18 -0
  128. package/dist/lib/layers.js +128 -0
  129. package/dist/lib/themeScope.d.ts +5 -0
  130. package/dist/lib/themeScope.js +3 -0
  131. package/dist/minimal-reset.css +6 -0
  132. package/dist/navigation.css +5 -0
  133. package/dist/overlays.css +5 -0
  134. package/dist/scoped/base.css +183 -0
  135. package/dist/scoped/kit/actions.css +209 -0
  136. package/dist/scoped/kit/data-display.css +498 -0
  137. package/dist/scoped/kit/effects.css +140 -0
  138. package/dist/scoped/kit/feedback.css +309 -0
  139. package/dist/scoped/kit/forms.css +404 -0
  140. package/dist/scoped/kit/navigation.css +266 -0
  141. package/dist/scoped/kit/overlays.css +299 -0
  142. package/dist/scoped/marquee.css +58 -0
  143. package/dist/scoped/spinner.css +20 -0
  144. package/dist/scoped/theme-toggle.css +38 -0
  145. package/dist/scoped/tokens.css +119 -0
  146. package/dist/scoped/ui.css +127 -0
  147. package/dist/scoped/utilities.css +17 -0
  148. package/dist/scoped-tokens.css +1 -0
  149. package/dist/scoped.css +12 -0
  150. package/dist/theme-toggle.css +2 -2
  151. package/dist/tokens.json +710 -0
  152. package/examples/optional/LazyScene.tsx +78 -0
  153. package/examples/optional/OptionalSmoothScroll.tsx +25 -0
  154. package/examples/optional/SmoothScrollOwner.tsx +7 -0
  155. package/examples/optional/optional.css +25 -0
  156. package/examples/recipes/AsyncProjectPicker.tsx +82 -0
  157. package/examples/recipes/DeleteProjectConfirmation.tsx +97 -0
  158. package/examples/recipes/InputCompositions.tsx +49 -0
  159. package/examples/recipes/RemoteRecordsTable.tsx +256 -0
  160. package/examples/recipes/useRemoteResource.ts +81 -0
  161. package/examples/reproduction/README.md +9 -0
  162. package/examples/reproduction/index.html +14 -0
  163. package/examples/reproduction/package.json +27 -0
  164. package/examples/reproduction/src/main.tsx +33 -0
  165. package/examples/reproduction/src/style.css +19 -0
  166. package/examples/reproduction/tsconfig.json +18 -0
  167. package/examples/reproduction/vite.config.ts +19 -0
  168. package/examples/starters/next/README.md +18 -0
  169. package/examples/starters/next/app/Demo.tsx +65 -0
  170. package/examples/starters/next/app/layout.tsx +25 -0
  171. package/examples/starters/next/app/next-page/page.tsx +9 -0
  172. package/examples/starters/next/app/page.tsx +11 -0
  173. package/examples/starters/next/app/style.css +19 -0
  174. package/examples/starters/next/next-env.d.ts +2 -0
  175. package/examples/starters/next/next.config.mjs +1 -0
  176. package/examples/starters/next/package.json +27 -0
  177. package/examples/starters/next/proxy.ts +16 -0
  178. package/examples/starters/next/tsconfig.json +30 -0
  179. package/examples/starters/vite/README.md +16 -0
  180. package/examples/starters/vite/index.html +14 -0
  181. package/examples/starters/vite/package.json +27 -0
  182. package/examples/starters/vite/src/main.tsx +81 -0
  183. package/examples/starters/vite/src/style.css +19 -0
  184. package/examples/starters/vite/tsconfig.json +18 -0
  185. package/examples/starters/vite/vite.config.ts +19 -0
  186. package/package.json +41 -5
@@ -0,0 +1,183 @@
1
+ /* Owned component defaults; no page shell, global theme mutation or foreign element reset. */
2
+ :where(.contour-root, [class*="contour-"]) {
3
+ box-sizing: border-box;
4
+ }
5
+ .contour-root {
6
+ color: var(--contour-fg);
7
+ background: var(--contour-bg);
8
+ font-family: var(--contour-font-sans);
9
+ line-height: 1.5;
10
+ }
11
+ button:where([class*="contour-"]) {
12
+ font: inherit;
13
+ font-family: var(--contour-font-sans);
14
+ color: inherit;
15
+ margin: 0;
16
+ padding: 0;
17
+ background: transparent;
18
+ border: 0 solid;
19
+ text-transform: none;
20
+ cursor: pointer;
21
+ }
22
+ button:where([class*="contour-"]):disabled {
23
+ cursor: default;
24
+ }
25
+ :where([class*="contour-"])[hidden] {
26
+ display: none;
27
+ }
28
+ :where([class*="contour-"]):focus-visible {
29
+ outline: 2px solid currentColor;
30
+ outline-offset: 4px;
31
+ }
32
+ .contour-root :where(h1, h2, h3, p, dl, dd, figure, ul, ol) {
33
+ margin: 0;
34
+ }
35
+ .contour-root :where(ul, ol) {
36
+ padding: 0;
37
+ list-style: none;
38
+ }
39
+ .contour-root :where(img, svg, canvas) {
40
+ display: block;
41
+ vertical-align: middle;
42
+ }
43
+ .contour-root :where(svg) {
44
+ flex-shrink: 0;
45
+ }
46
+ .contour-root :where(a) {
47
+ color: inherit;
48
+ }
49
+ .contour-menu-list,
50
+ .contour-popover-panel,
51
+ .contour-dialog {
52
+ color: var(--contour-fg);
53
+ font-family: var(--contour-font-sans);
54
+ }
55
+ .contour-tooltip {
56
+ background: var(--contour-invert-bg);
57
+ color: var(--contour-invert-fg);
58
+ }
59
+ .contour-field-control :where(input, select, textarea),
60
+ .contour-choice-input {
61
+ font-family: var(--contour-font-sans);
62
+ }
63
+ .contour-button,
64
+ .contour-menu-trigger,
65
+ .contour-field,
66
+ .contour-tabs,
67
+ .contour-data-table {
68
+ max-inline-size: 100%;
69
+ }
70
+ .contour-button,
71
+ .contour-menu-trigger {
72
+ overflow-wrap: anywhere;
73
+ }
74
+ .contour-dialog-header h2 {
75
+ margin: 0;
76
+ font-family: var(--contour-font-display);
77
+ font-weight: 500;
78
+ }
79
+ @media (prefers-reduced-motion: reduce) {
80
+ :where([class*="contour-"]) {
81
+ animation: none !important;
82
+ transition: none !important;
83
+ scroll-behavior: auto !important;
84
+ }
85
+ :where(.contour-reveal, .contour-type-run) {
86
+ opacity: 1;
87
+ transform: none;
88
+ }
89
+ }
90
+ [data-motion="off"] :where([class*="contour-"]) {
91
+ animation: none !important;
92
+ transition: none !important;
93
+ }
94
+ @media (forced-colors: active) {
95
+ :where(
96
+ .contour-button,
97
+ .contour-menu-trigger,
98
+ .contour-card,
99
+ .contour-dialog,
100
+ .contour-popover-panel,
101
+ .contour-menu-list,
102
+ .contour-field-control,
103
+ .contour-switch,
104
+ .contour-segmented-option
105
+ ) {
106
+ border: 1px solid ButtonText !important;
107
+ }
108
+ :where(
109
+ .contour-button,
110
+ .contour-menu-item,
111
+ .contour-tabs-tab,
112
+ .contour-segmented-option
113
+ ):focus-visible {
114
+ outline: 2px solid Highlight !important;
115
+ outline-offset: 3px;
116
+ }
117
+ :where(
118
+ .contour-tabs-tab[aria-selected="true"],
119
+ .contour-segmented-option[aria-checked="true"],
120
+ .contour-switch-track[aria-checked="true"]
121
+ ) {
122
+ outline: 2px solid Highlight !important;
123
+ }
124
+ .contour-field-error,
125
+ .contour-choice-error {
126
+ color: CanvasText !important;
127
+ }
128
+ .contour-tooltip {
129
+ border: 1px solid CanvasText;
130
+ }
131
+ }
132
+
133
+ .contour-data-table :where(button) {
134
+ font: inherit;
135
+ color: inherit;
136
+ background: transparent;
137
+ border: 0;
138
+ cursor: pointer;
139
+ }
140
+
141
+ @media (forced-colors: active) {
142
+ .contour-choice-input:checked + .contour-choice-box,
143
+ .contour-choice-input:indeterminate + .contour-choice-box {
144
+ outline: 2px solid Highlight;
145
+ outline-offset: 1px;
146
+ }
147
+ .contour-choice-radio
148
+ .contour-choice-input:checked
149
+ + .contour-choice-box::after {
150
+ content: "";
151
+ inline-size: 8px;
152
+ block-size: 8px;
153
+ background: CanvasText;
154
+ forced-color-adjust: none;
155
+ border-radius: 50%;
156
+ }
157
+ .contour-switch-thumb {
158
+ background: ButtonText !important;
159
+ forced-color-adjust: none;
160
+ }
161
+ .contour-switch-track {
162
+ border: 1px solid ButtonText !important;
163
+ }
164
+ .contour-field-control:has([aria-invalid="true"]) {
165
+ border-block-end: 2px dashed CanvasText !important;
166
+ }
167
+ .contour-slider input[type="range"] {
168
+ appearance: auto !important;
169
+ }
170
+ }
171
+
172
+ .contour-tabs {
173
+ background: transparent;
174
+ }
175
+ .contour-menu,
176
+ .contour-popover {
177
+ color: var(--contour-fg);
178
+ }
179
+ .contour-menu-trigger > span {
180
+ display: inline-flex;
181
+ align-items: center;
182
+ gap: 10px;
183
+ }
@@ -0,0 +1,209 @@
1
+ /* Kit — actions: buttons, icon buttons, segmented control, and the magnetic wrapper. */
2
+
3
+ .contour-button {
4
+ --contour-button-bg: var(--contour-invert-bg);
5
+ --contour-button-fg: var(--contour-invert-fg);
6
+ --contour-button-border: transparent;
7
+ display: inline-flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+ gap: 10px;
11
+ height: 44px;
12
+ padding-inline: 22px;
13
+ border: 1px solid var(--contour-button-border);
14
+ border-radius: var(--contour-radius-pill);
15
+ background: var(--contour-button-bg);
16
+ color: var(--contour-button-fg);
17
+ font-size: 13px;
18
+ font-weight: 500;
19
+ white-space: nowrap;
20
+ transition:
21
+ background var(--contour-duration-fast),
22
+ color var(--contour-duration-fast),
23
+ border-color var(--contour-duration-fast),
24
+ transform var(--contour-duration-base) var(--contour-ease);
25
+ }
26
+
27
+ .contour-button:hover:not(:disabled) {
28
+ --contour-button-bg: var(--contour-acid);
29
+ --contour-button-fg: var(--contour-ink);
30
+ --contour-button-border: var(--contour-acid);
31
+ }
32
+
33
+ .contour-button:active:not(:disabled) {
34
+ transform: scale(0.97);
35
+ }
36
+
37
+ .contour-button:disabled {
38
+ opacity: 0.45;
39
+ }
40
+
41
+ /* Link inside running text: a hairline that thickens into an acid underline on hover. */
42
+ .contour-inline-link {
43
+ text-decoration: underline;
44
+ text-decoration-thickness: 1px;
45
+ text-underline-offset: 0.22em;
46
+ text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
47
+ transition:
48
+ text-decoration-color var(--contour-duration-fast),
49
+ text-decoration-thickness var(--contour-duration-fast);
50
+ }
51
+
52
+ .contour-inline-link:hover {
53
+ text-decoration-color: var(--contour-olive);
54
+ text-decoration-thickness: 3px;
55
+ }
56
+
57
+ .contour-button[aria-busy="true"] {
58
+ opacity: 0.8;
59
+ }
60
+
61
+ .contour-button-icon {
62
+ display: inline-flex;
63
+ transition: transform var(--contour-duration-base) var(--contour-ease);
64
+ }
65
+
66
+ .contour-button:hover:not(:disabled) .contour-button-icon {
67
+ transform: translateX(3px);
68
+ }
69
+
70
+ .contour-button-accent {
71
+ --contour-button-bg: var(--contour-acid);
72
+ --contour-button-fg: var(--contour-ink);
73
+ }
74
+
75
+ .contour-button-accent:hover:not(:disabled) {
76
+ --contour-button-bg: var(--contour-invert-bg);
77
+ --contour-button-fg: var(--contour-invert-fg);
78
+ --contour-button-border: var(--contour-invert-bg);
79
+ }
80
+
81
+ .contour-button-secondary {
82
+ --contour-button-bg: transparent;
83
+ --contour-button-fg: var(--contour-fg);
84
+ --contour-button-border: color-mix(in srgb, currentColor 32%, transparent);
85
+ }
86
+
87
+ .contour-button-ghost {
88
+ --contour-button-bg: transparent;
89
+ --contour-button-fg: var(--contour-fg);
90
+ }
91
+
92
+ .contour-button-danger {
93
+ --contour-button-bg: var(--contour-danger);
94
+ --contour-button-fg: var(--contour-bg);
95
+ }
96
+
97
+ .contour-button-danger:hover:not(:disabled) {
98
+ --contour-button-bg: var(--contour-fg);
99
+ --contour-button-fg: var(--contour-bg);
100
+ --contour-button-border: var(--contour-fg);
101
+ }
102
+
103
+ .contour-button-sm {
104
+ height: 34px;
105
+ padding-inline: 16px;
106
+ font-size: 12px;
107
+ }
108
+
109
+ .contour-button-lg {
110
+ height: 54px;
111
+ padding-inline: 28px;
112
+ font-size: 14px;
113
+ }
114
+
115
+ .contour-icon-button {
116
+ display: grid;
117
+ place-items: center;
118
+ flex-shrink: 0;
119
+ width: 42px;
120
+ height: 42px;
121
+ border: 1px solid color-mix(in srgb, currentColor 32%, transparent);
122
+ border-radius: 50%;
123
+ transition:
124
+ background var(--contour-duration-fast),
125
+ color var(--contour-duration-fast),
126
+ border-color var(--contour-duration-fast),
127
+ transform var(--contour-duration-base) var(--contour-ease);
128
+ }
129
+
130
+ .contour-icon-button:hover:not(:disabled) {
131
+ background: var(--contour-acid);
132
+ border-color: var(--contour-acid);
133
+ color: var(--contour-ink);
134
+ }
135
+
136
+ .contour-icon-button:disabled {
137
+ opacity: 0.45;
138
+ }
139
+
140
+ .contour-icon-button-spin:hover:not(:disabled) {
141
+ transform: rotate(45deg);
142
+ }
143
+
144
+ .contour-icon-button-solid {
145
+ background: var(--contour-invert-bg);
146
+ border-color: var(--contour-invert-bg);
147
+ color: var(--contour-invert-fg);
148
+ }
149
+
150
+ .contour-icon-button-accent {
151
+ background: var(--contour-acid);
152
+ border-color: var(--contour-acid);
153
+ color: var(--contour-ink);
154
+ }
155
+
156
+ .contour-icon-button-accent:hover:not(:disabled) {
157
+ background: var(--contour-invert-bg);
158
+ border-color: var(--contour-invert-bg);
159
+ color: var(--contour-invert-fg);
160
+ }
161
+
162
+ .contour-icon-button-sm {
163
+ width: 32px;
164
+ height: 32px;
165
+ }
166
+
167
+ .contour-icon-button-lg {
168
+ width: 56px;
169
+ height: 56px;
170
+ }
171
+
172
+ .contour-segmented {
173
+ display: inline-flex;
174
+ flex-wrap: wrap;
175
+ gap: 4px;
176
+ padding: 4px;
177
+ border: 1px solid var(--contour-line);
178
+ border-radius: var(--contour-radius-pill);
179
+ }
180
+
181
+ .contour-segmented-option {
182
+ height: 32px;
183
+ padding-inline: 16px;
184
+ border-radius: var(--contour-radius-pill);
185
+ font-size: 12px;
186
+ color: var(--contour-muted);
187
+ transition:
188
+ background var(--contour-duration-fast),
189
+ color var(--contour-duration-fast);
190
+ }
191
+
192
+ .contour-segmented-option:hover {
193
+ color: var(--contour-fg);
194
+ }
195
+
196
+ .contour-segmented-option[aria-checked="true"] {
197
+ background: var(--contour-invert-bg);
198
+ color: var(--contour-invert-fg);
199
+ }
200
+
201
+ .contour-segmented-option:focus-visible {
202
+ outline-offset: 2px;
203
+ }
204
+
205
+ .contour-magnetic {
206
+ display: inline-block;
207
+ transform: translate(var(--magnet, 0, 0));
208
+ transition: transform 450ms var(--contour-ease);
209
+ }