remix 3.0.0-rc.4 → 3.0.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.
- package/INDEX.md +6 -21
- package/README.md +1 -1
- package/dist/component/dev/refresh.d.ts +2 -0
- package/dist/component/dev/refresh.d.ts.map +1 -0
- package/dist/{ui → component}/dev/refresh.js +1 -1
- package/dist/component/jsx-dev-runtime.d.ts +2 -0
- package/dist/component/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/{ui → component}/jsx-dev-runtime.js +1 -1
- package/dist/component/jsx-runtime.d.ts +2 -0
- package/dist/component/jsx-runtime.d.ts.map +1 -0
- package/dist/{ui → component}/jsx-runtime.js +1 -1
- package/dist/component/server.d.ts +2 -0
- package/dist/component/server.d.ts.map +1 -0
- package/dist/{ui → component}/server.js +1 -1
- package/dist/component/test.d.ts +2 -0
- package/dist/component/test.d.ts.map +1 -0
- package/dist/{ui → component}/test.js +1 -1
- package/dist/component-hmr/assets.d.ts +2 -0
- package/dist/component-hmr/assets.d.ts.map +1 -0
- package/dist/{ui-hmr.js → component-hmr/assets.js} +1 -1
- package/dist/component-hmr/node.d.ts +3 -0
- package/dist/component-hmr/node.d.ts.map +1 -0
- package/dist/{ui-hmr → component-hmr}/node.js +1 -1
- package/dist/component-hmr/runtime/browser.d.ts +2 -0
- package/dist/component-hmr/runtime/browser.d.ts.map +1 -0
- package/dist/{ui-hmr → component-hmr}/runtime/browser.js +1 -1
- package/dist/component-hmr/runtime/server.d.ts +2 -0
- package/dist/component-hmr/runtime/server.d.ts.map +1 -0
- package/dist/{ui-hmr → component-hmr}/runtime/server.js +1 -1
- package/dist/component-hmr.d.ts +2 -0
- package/dist/component-hmr.d.ts.map +1 -0
- package/dist/{ui-hmr/assets.js → component-hmr.js} +1 -1
- package/dist/component.d.ts +2 -0
- package/dist/component.d.ts.map +1 -0
- package/dist/{ui/anchor.js → component.js} +1 -1
- package/guides/01-start-here.md +20 -20
- package/guides/02-routing-and-controllers.md +1 -1
- package/guides/03-request-handling.md +1 -1
- package/guides/04-rendering-ui.md +41 -307
- package/guides/05-interactivity.md +42 -37
- package/guides/06-streaming-ui-with-frames.md +28 -70
- package/guides/07-animation.md +41 -35
- package/guides/08-data-and-validation.md +423 -27
- package/guides/09-forms-and-mutations.md +250 -25
- package/guides/13-testing.md +10 -10
- package/guides/14-cli-and-tooling.md +2 -2
- package/package.json +96 -180
- package/src/assets/README.md +12 -12
- package/src/cli/README.md +3 -3
- package/src/{ui → component}/README.md +31 -75
- package/src/{ui → component}/dev/refresh.ts +1 -1
- package/src/{ui → component}/jsx-dev-runtime.ts +1 -1
- package/src/{ui → component}/jsx-runtime.ts +1 -1
- package/src/{ui → component}/server/README.md +8 -8
- package/src/{ui → component}/server.ts +1 -1
- package/src/{ui → component}/test/README.md +6 -6
- package/src/{ui → component}/test.ts +1 -1
- package/src/{ui-hmr → component-hmr}/README.md +13 -13
- package/src/{ui-hmr → component-hmr}/assets.ts +1 -1
- package/src/{ui-hmr → component-hmr}/node.ts +1 -1
- package/src/{ui-hmr → component-hmr}/runtime/browser.ts +1 -1
- package/src/{ui-hmr → component-hmr}/runtime/server.ts +1 -1
- package/{dist/ui/accordion.js → src/component-hmr.ts} +1 -1
- package/{dist/ui/tabs.js → src/component.ts} +1 -1
- package/src/data-table/README.md +2 -1
- package/src/multiple-import-maps-polyfill/README.md +3 -3
- package/src/node-hmr/README.md +6 -6
- package/src/render-middleware/README.md +5 -5
- package/src/spa/README.md +4 -4
- package/src/test/README.md +4 -4
- package/dist/ui/accordion/primitives.d.ts +0 -2
- package/dist/ui/accordion/primitives.d.ts.map +0 -1
- package/dist/ui/accordion/primitives.js +0 -2
- package/dist/ui/accordion.d.ts +0 -2
- package/dist/ui/accordion.d.ts.map +0 -1
- package/dist/ui/anchor.d.ts +0 -2
- package/dist/ui/anchor.d.ts.map +0 -1
- package/dist/ui/animation.d.ts +0 -2
- package/dist/ui/animation.d.ts.map +0 -1
- package/dist/ui/animation.js +0 -2
- package/dist/ui/breadcrumbs.d.ts +0 -2
- package/dist/ui/breadcrumbs.d.ts.map +0 -1
- package/dist/ui/breadcrumbs.js +0 -2
- package/dist/ui/button.d.ts +0 -3
- package/dist/ui/button.d.ts.map +0 -1
- package/dist/ui/button.js +0 -3
- package/dist/ui/checkbox.d.ts +0 -3
- package/dist/ui/checkbox.d.ts.map +0 -1
- package/dist/ui/checkbox.js +0 -3
- package/dist/ui/combobox/primitives.d.ts +0 -2
- package/dist/ui/combobox/primitives.d.ts.map +0 -1
- package/dist/ui/combobox/primitives.js +0 -2
- package/dist/ui/combobox.d.ts +0 -2
- package/dist/ui/combobox.d.ts.map +0 -1
- package/dist/ui/combobox.js +0 -2
- package/dist/ui/dev/refresh.d.ts +0 -2
- package/dist/ui/dev/refresh.d.ts.map +0 -1
- package/dist/ui/input.d.ts +0 -3
- package/dist/ui/input.d.ts.map +0 -1
- package/dist/ui/input.js +0 -3
- package/dist/ui/jsx-dev-runtime.d.ts +0 -2
- package/dist/ui/jsx-dev-runtime.d.ts.map +0 -1
- package/dist/ui/jsx-runtime.d.ts +0 -2
- package/dist/ui/jsx-runtime.d.ts.map +0 -1
- package/dist/ui/listbox.d.ts +0 -2
- package/dist/ui/listbox.d.ts.map +0 -1
- package/dist/ui/listbox.js +0 -2
- package/dist/ui/menu/primitives.d.ts +0 -2
- package/dist/ui/menu/primitives.d.ts.map +0 -1
- package/dist/ui/menu/primitives.js +0 -2
- package/dist/ui/menu.d.ts +0 -2
- package/dist/ui/menu.d.ts.map +0 -1
- package/dist/ui/menu.js +0 -2
- package/dist/ui/popover.d.ts +0 -2
- package/dist/ui/popover.d.ts.map +0 -1
- package/dist/ui/popover.js +0 -2
- package/dist/ui/radio.d.ts +0 -3
- package/dist/ui/radio.d.ts.map +0 -1
- package/dist/ui/radio.js +0 -3
- package/dist/ui/select/primitives.d.ts +0 -2
- package/dist/ui/select/primitives.d.ts.map +0 -1
- package/dist/ui/select/primitives.js +0 -2
- package/dist/ui/select.d.ts +0 -2
- package/dist/ui/select.d.ts.map +0 -1
- package/dist/ui/select.js +0 -2
- package/dist/ui/server.d.ts +0 -2
- package/dist/ui/server.d.ts.map +0 -1
- package/dist/ui/tabs/primitives.d.ts +0 -2
- package/dist/ui/tabs/primitives.d.ts.map +0 -1
- package/dist/ui/tabs/primitives.js +0 -2
- package/dist/ui/tabs.d.ts +0 -2
- package/dist/ui/tabs.d.ts.map +0 -1
- package/dist/ui/test.d.ts +0 -2
- package/dist/ui/test.d.ts.map +0 -1
- package/dist/ui/toggle/primitives.d.ts +0 -2
- package/dist/ui/toggle/primitives.d.ts.map +0 -1
- package/dist/ui/toggle/primitives.js +0 -2
- package/dist/ui/toggle.d.ts +0 -3
- package/dist/ui/toggle.d.ts.map +0 -1
- package/dist/ui/toggle.js +0 -3
- package/dist/ui-hmr/assets.d.ts +0 -2
- package/dist/ui-hmr/assets.d.ts.map +0 -1
- package/dist/ui-hmr/node.d.ts +0 -3
- package/dist/ui-hmr/node.d.ts.map +0 -1
- package/dist/ui-hmr/runtime/browser.d.ts +0 -2
- package/dist/ui-hmr/runtime/browser.d.ts.map +0 -1
- package/dist/ui-hmr/runtime/server.d.ts +0 -2
- package/dist/ui-hmr/runtime/server.d.ts.map +0 -1
- package/dist/ui-hmr.d.ts +0 -2
- package/dist/ui-hmr.d.ts.map +0 -1
- package/dist/ui.d.ts +0 -2
- package/dist/ui.d.ts.map +0 -1
- package/dist/ui.js +0 -2
- package/src/ui/accordion/README.md +0 -202
- package/src/ui/accordion/primitives.ts +0 -2
- package/src/ui/accordion.ts +0 -2
- package/src/ui/anchor/README.md +0 -196
- package/src/ui/anchor.ts +0 -2
- package/src/ui/animation/README.md +0 -318
- package/src/ui/animation.ts +0 -2
- package/src/ui/breadcrumbs/README.md +0 -55
- package/src/ui/breadcrumbs.ts +0 -2
- package/src/ui/button/README.md +0 -44
- package/src/ui/button.ts +0 -3
- package/src/ui/checkbox/README.md +0 -59
- package/src/ui/checkbox.ts +0 -3
- package/src/ui/combobox/README.md +0 -194
- package/src/ui/combobox/primitives.ts +0 -2
- package/src/ui/combobox.ts +0 -2
- package/src/ui/input/README.md +0 -52
- package/src/ui/input.ts +0 -3
- package/src/ui/listbox/README.md +0 -83
- package/src/ui/listbox.ts +0 -2
- package/src/ui/menu/README.md +0 -161
- package/src/ui/menu/primitives.ts +0 -2
- package/src/ui/menu.ts +0 -2
- package/src/ui/popover/README.md +0 -103
- package/src/ui/popover.ts +0 -2
- package/src/ui/radio/README.md +0 -53
- package/src/ui/radio.ts +0 -3
- package/src/ui/select/README.md +0 -117
- package/src/ui/select/primitives.ts +0 -2
- package/src/ui/select.ts +0 -2
- package/src/ui/tabs/README.md +0 -141
- package/src/ui/tabs/primitives.ts +0 -2
- package/src/ui/tabs.ts +0 -2
- package/src/ui/toggle/README.md +0 -56
- package/src/ui/toggle/primitives.ts +0 -2
- package/src/ui/toggle.ts +0 -3
- package/src/ui-hmr.ts +0 -2
- package/src/ui.ts +0 -2
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../src/ui/select/primitives.ts"],"names":[],"mappings":"AACA,cAAc,iCAAiC,CAAA"}
|
package/dist/ui/select.d.ts
DELETED
package/dist/ui/select.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/ui/select.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAA"}
|
package/dist/ui/select.js
DELETED
package/dist/ui/server.d.ts
DELETED
package/dist/ui/server.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/ui/server.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../src/ui/tabs/primitives.ts"],"names":[],"mappings":"AACA,cAAc,+BAA+B,CAAA"}
|
package/dist/ui/tabs.d.ts
DELETED
package/dist/ui/tabs.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/ui/tabs.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAA"}
|
package/dist/ui/test.d.ts
DELETED
package/dist/ui/test.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/ui/test.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../src/ui/toggle/primitives.ts"],"names":[],"mappings":"AACA,cAAc,iCAAiC,CAAA"}
|
package/dist/ui/toggle.d.ts
DELETED
package/dist/ui/toggle.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../src/ui/toggle.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA"}
|
package/dist/ui/toggle.js
DELETED
package/dist/ui-hmr/assets.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/ui-hmr/assets.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAA"}
|
package/dist/ui-hmr/node.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/ui-hmr/node.ts"],"names":[],"mappings":"AACA,OAAO,wBAAwB,CAAA;AAC/B,OAAO,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../src/ui-hmr/runtime/browser.ts"],"names":[],"mappings":"AACA,cAAc,mCAAmC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/ui-hmr/runtime/server.ts"],"names":[],"mappings":"AACA,cAAc,kCAAkC,CAAA"}
|
package/dist/ui-hmr.d.ts
DELETED
package/dist/ui-hmr.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ui-hmr.d.ts","sourceRoot":"","sources":["../src/ui-hmr.ts"],"names":[],"mappings":"AACA,cAAc,mBAAmB,CAAA"}
|
package/dist/ui.d.ts
DELETED
package/dist/ui.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AACA,cAAc,eAAe,CAAA"}
|
package/dist/ui.js
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
# accordion
|
|
2
|
-
|
|
3
|
-
`Accordion` renders a disclosure set with one or more expandable items. Use it for grouped settings, FAQ sections, and dense panels where each item owns a trigger and content region.
|
|
4
|
-
|
|
5
|
-
## Component Usage
|
|
6
|
-
|
|
7
|
-
```tsx
|
|
8
|
-
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from 'remix/ui/accordion'
|
|
9
|
-
|
|
10
|
-
export function SettingsAccordion() {
|
|
11
|
-
return (
|
|
12
|
-
<Accordion defaultValue="account">
|
|
13
|
-
<AccordionItem value="account">
|
|
14
|
-
<AccordionTrigger>Account</AccordionTrigger>
|
|
15
|
-
<AccordionContent>Manage account preferences.</AccordionContent>
|
|
16
|
-
</AccordionItem>
|
|
17
|
-
|
|
18
|
-
<AccordionItem value="billing">
|
|
19
|
-
<AccordionTrigger>Billing</AccordionTrigger>
|
|
20
|
-
<AccordionContent>Review billing details.</AccordionContent>
|
|
21
|
-
</AccordionItem>
|
|
22
|
-
</Accordion>
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Use `type="multiple"` when more than one panel may stay open. `defaultValue` and `value` are arrays in multiple mode.
|
|
28
|
-
|
|
29
|
-
```tsx
|
|
30
|
-
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from 'remix/ui/accordion'
|
|
31
|
-
|
|
32
|
-
export function StatusAccordion() {
|
|
33
|
-
return (
|
|
34
|
-
<Accordion defaultValue={['api', 'alerts']} type="multiple">
|
|
35
|
-
<AccordionItem value="api">
|
|
36
|
-
<AccordionTrigger>API status checks</AccordionTrigger>
|
|
37
|
-
<AccordionContent>Review uptime checks and response time alerts.</AccordionContent>
|
|
38
|
-
</AccordionItem>
|
|
39
|
-
|
|
40
|
-
<AccordionItem disabled value="access">
|
|
41
|
-
<AccordionTrigger>Access control sync</AccordionTrigger>
|
|
42
|
-
<AccordionContent>This disabled item cannot be opened or focused.</AccordionContent>
|
|
43
|
-
</AccordionItem>
|
|
44
|
-
|
|
45
|
-
<AccordionItem value="alerts">
|
|
46
|
-
<AccordionTrigger>Alert routing</AccordionTrigger>
|
|
47
|
-
<AccordionContent>Confirm escalation rules and notification channels.</AccordionContent>
|
|
48
|
-
</AccordionItem>
|
|
49
|
-
</Accordion>
|
|
50
|
-
)
|
|
51
|
-
}
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Control the open value when state should live in the owning component. Single mode uses `string | null`; multiple mode uses `string[]`.
|
|
55
|
-
|
|
56
|
-
```tsx
|
|
57
|
-
import type { Handle } from 'remix/ui'
|
|
58
|
-
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from 'remix/ui/accordion'
|
|
59
|
-
|
|
60
|
-
export function ControlledAccordion(handle: Handle) {
|
|
61
|
-
let value: string | null = 'account'
|
|
62
|
-
|
|
63
|
-
return () => (
|
|
64
|
-
<Accordion
|
|
65
|
-
value={value}
|
|
66
|
-
onValueChange={(nextValue) => {
|
|
67
|
-
value = nextValue
|
|
68
|
-
void handle.update()
|
|
69
|
-
}}
|
|
70
|
-
>
|
|
71
|
-
<AccordionItem value="account">
|
|
72
|
-
<AccordionTrigger>Account</AccordionTrigger>
|
|
73
|
-
<AccordionContent>Manage account preferences.</AccordionContent>
|
|
74
|
-
</AccordionItem>
|
|
75
|
-
|
|
76
|
-
<AccordionItem value="billing">
|
|
77
|
-
<AccordionTrigger>Billing</AccordionTrigger>
|
|
78
|
-
<AccordionContent>Review billing details.</AccordionContent>
|
|
79
|
-
</AccordionItem>
|
|
80
|
-
</Accordion>
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Listen for bubbling `AccordionChangeEvent` events with `onAccordionChange` from `remix/ui/accordion/primitives`.
|
|
86
|
-
|
|
87
|
-
```tsx
|
|
88
|
-
import { onAccordionChange } from 'remix/ui/accordion/primitives'
|
|
89
|
-
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from 'remix/ui/accordion'
|
|
90
|
-
|
|
91
|
-
export function TrackedAccordion() {
|
|
92
|
-
return (
|
|
93
|
-
<div
|
|
94
|
-
mix={[
|
|
95
|
-
onAccordionChange((event) => {
|
|
96
|
-
console.log(event.accordionType, event.itemValue, event.value)
|
|
97
|
-
}),
|
|
98
|
-
]}
|
|
99
|
-
>
|
|
100
|
-
<Accordion>
|
|
101
|
-
<AccordionItem value="account">
|
|
102
|
-
<AccordionTrigger>Account</AccordionTrigger>
|
|
103
|
-
<AccordionContent>Manage account preferences.</AccordionContent>
|
|
104
|
-
</AccordionItem>
|
|
105
|
-
</Accordion>
|
|
106
|
-
</div>
|
|
107
|
-
)
|
|
108
|
-
}
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
Set `collapsible={false}` in single mode when the open item must stay open. The locked-open trigger receives `aria-disabled`.
|
|
112
|
-
|
|
113
|
-
```tsx
|
|
114
|
-
<Accordion collapsible={false} defaultValue="account">
|
|
115
|
-
<AccordionItem value="account">
|
|
116
|
-
<AccordionTrigger>Account</AccordionTrigger>
|
|
117
|
-
<AccordionContent>Manage account preferences.</AccordionContent>
|
|
118
|
-
</AccordionItem>
|
|
119
|
-
</Accordion>
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
Use `headingLevel` to choose the heading element rendered around each trigger. The default level is `3`.
|
|
123
|
-
|
|
124
|
-
```tsx
|
|
125
|
-
<Accordion defaultValue="shipping" headingLevel={2}>
|
|
126
|
-
<AccordionItem value="shipping">
|
|
127
|
-
<AccordionTrigger>Shipping</AccordionTrigger>
|
|
128
|
-
<AccordionContent>Review shipping preferences.</AccordionContent>
|
|
129
|
-
</AccordionItem>
|
|
130
|
-
</Accordion>
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Pass `indicator={null}` to remove the default chevron, or pass a custom node to replace it.
|
|
134
|
-
|
|
135
|
-
```tsx
|
|
136
|
-
<AccordionTrigger indicator={null}>No indicator</AccordionTrigger>
|
|
137
|
-
<AccordionTrigger indicator={<span aria-hidden>+</span>}>Custom indicator</AccordionTrigger>
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
## Primitive Usage
|
|
141
|
-
|
|
142
|
-
Use the lower-level primitives when app code owns the accordion markup and styles:
|
|
143
|
-
|
|
144
|
-
```tsx
|
|
145
|
-
import * as accordion from 'remix/ui/accordion/primitives'
|
|
146
|
-
import { contentStyle, headingStyle, itemStyle, rootStyle, triggerStyle } from './accordion.styles'
|
|
147
|
-
|
|
148
|
-
export function PrimitiveAccordion() {
|
|
149
|
-
return (
|
|
150
|
-
<accordion.Context defaultValue="shipping">
|
|
151
|
-
<div mix={[rootStyle, accordion.root()]}>
|
|
152
|
-
<accordion.ItemContext value="shipping">
|
|
153
|
-
<div mix={[itemStyle, accordion.item()]}>
|
|
154
|
-
<h3 mix={headingStyle}>
|
|
155
|
-
<button mix={[triggerStyle, accordion.trigger()]} type="button">
|
|
156
|
-
Shipping
|
|
157
|
-
</button>
|
|
158
|
-
</h3>
|
|
159
|
-
<div mix={[contentStyle, accordion.content()]}>
|
|
160
|
-
Delivery windows and carrier defaults.
|
|
161
|
-
</div>
|
|
162
|
-
</div>
|
|
163
|
-
</accordion.ItemContext>
|
|
164
|
-
</div>
|
|
165
|
-
</accordion.Context>
|
|
166
|
-
)
|
|
167
|
-
}
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
## `remix/ui/accordion`
|
|
171
|
-
|
|
172
|
-
- `Accordion`: root component. Defaults to single-item mode and supports controlled `value`, uncontrolled `defaultValue`, `onValueChange`, `disabled`, `headingLevel`, `collapsible`, and `type="multiple"`.
|
|
173
|
-
- `AccordionItem`: registers one accordion item by `value`. Pass `disabled` to prevent that item from opening or receiving keyboard focus.
|
|
174
|
-
- `AccordionTrigger`: heading-wrapped button for an item. It wires `aria-expanded`, `aria-controls`, keyboard navigation, and the default chevron indicator.
|
|
175
|
-
- `AccordionContent`: panel for an item. It wires the panel id, `aria-labelledby`, `aria-hidden`, inert state, and open/closed state attributes.
|
|
176
|
-
- `rootStyle`, `itemStyle`, `headingStyle`, `triggerStyle`, `indicatorStyle`, `panelStyle`, and `bodyStyle`: flat style mixins used by the component markup.
|
|
177
|
-
- `AccordionProps`, `AccordionSingleProps`, `AccordionMultipleProps`, `AccordionItemProps`, `AccordionTriggerProps`, and `AccordionContentProps`: public TypeScript props for the composed APIs.
|
|
178
|
-
|
|
179
|
-
## `remix/ui/accordion/primitives`
|
|
180
|
-
|
|
181
|
-
- `Context`: lower-level provider for custom accordion composition.
|
|
182
|
-
- `ItemContext`: lower-level provider for one item value.
|
|
183
|
-
- `root()`: wires the root element and bubbling change events.
|
|
184
|
-
- `item()`: wires one item wrapper.
|
|
185
|
-
- `trigger()`: wires the item trigger, keyboard navigation, and trigger ARIA attributes.
|
|
186
|
-
- `content()`: wires the item panel id, hidden state, inert state, and open/closed state attributes.
|
|
187
|
-
- `onAccordionChange(...)`: event mixin for the bubbling `AccordionChangeEvent`.
|
|
188
|
-
- `AccordionChangeEvent`: bubbling event with `value`, `itemValue`, and `accordionType`.
|
|
189
|
-
- `AccordionType`, `AccordionValue`, `AccordionSingleValue`, `AccordionMultipleValue`, and `AccordionHeadingLevel`: public TypeScript state and configuration types.
|
|
190
|
-
- `AccordionBaseContextProps`, `AccordionSingleContextProps`, `AccordionMultipleContextProps`, `AccordionContextProps`, `AccordionRootOptions`, `AccordionItemOptions`, `AccordionTriggerOptions`, and `AccordionContentOptions`: primitive prop and option types for custom composition.
|
|
191
|
-
|
|
192
|
-
## Behavior Notes
|
|
193
|
-
|
|
194
|
-
- Single mode stores one open value or `null`; multiple mode stores an array of open values.
|
|
195
|
-
- Single accordions are collapsible by default. Set `collapsible={false}` to keep the open item locked open.
|
|
196
|
-
- Root `disabled` disables every item. Item `disabled` only disables that item.
|
|
197
|
-
- Arrow keys move between enabled triggers. `Home` and `End` move to the first and last enabled triggers.
|
|
198
|
-
- Disabled items are skipped by keyboard navigation.
|
|
199
|
-
- Trigger and panel ids are generated and linked with `aria-controls`, `aria-labelledby`, and `aria-expanded`; closed panels receive `aria-hidden` and `inert`.
|
|
200
|
-
- `AccordionTrigger` renders inside an `h1`-`h6` element based on `headingLevel`.
|
|
201
|
-
- Each item and trigger receives `data-state="open"` or `data-state="closed"` for styling.
|
|
202
|
-
- `AccordionChangeEvent` bubbles from the root and includes `value`, `itemValue`, and `accordionType`.
|
package/src/ui/accordion.ts
DELETED
package/src/ui/anchor/README.md
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
# anchor
|
|
2
|
-
|
|
3
|
-
`anchor` positions a floating element against an anchor element or viewport coordinates and keeps it constrained to the viewport. Use it for custom floating surfaces that need placement, flipping, offsets, and optional relative alignment.
|
|
4
|
-
|
|
5
|
-
## Primitive Usage
|
|
6
|
-
|
|
7
|
-
```tsx
|
|
8
|
-
import { anchor } from 'remix/ui/anchor'
|
|
9
|
-
|
|
10
|
-
let trigger = document.querySelector<HTMLButtonElement>('[data-trigger]')
|
|
11
|
-
let panel = document.querySelector<HTMLElement>('[data-panel]')
|
|
12
|
-
|
|
13
|
-
if (trigger && panel) {
|
|
14
|
-
let cleanup = anchor(panel, trigger, {
|
|
15
|
-
placement: 'bottom-end',
|
|
16
|
-
offset: 8,
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
// Later, when the surface closes or unmounts:
|
|
20
|
-
cleanup()
|
|
21
|
-
}
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Use the returned cleanup function with the lifecycle that owns the floating element. For native popovers, position on open and clean up on close.
|
|
25
|
-
|
|
26
|
-
```tsx
|
|
27
|
-
import { anchor } from 'remix/ui/anchor'
|
|
28
|
-
|
|
29
|
-
let cleanupAnchor = () => {}
|
|
30
|
-
|
|
31
|
-
button.addEventListener('click', () => {
|
|
32
|
-
popover.showPopover()
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
popover.addEventListener('beforetoggle', (event) => {
|
|
36
|
-
let toggleEvent = event as ToggleEvent
|
|
37
|
-
|
|
38
|
-
if (toggleEvent.newState === 'open') {
|
|
39
|
-
cleanupAnchor()
|
|
40
|
-
cleanupAnchor = anchor(popover, button, {
|
|
41
|
-
placement: 'bottom-start',
|
|
42
|
-
offset: 4,
|
|
43
|
-
})
|
|
44
|
-
return
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
cleanupAnchor()
|
|
48
|
-
cleanupAnchor = () => {}
|
|
49
|
-
})
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Anchor to coordinates when the surface should open at a pointer location.
|
|
53
|
-
|
|
54
|
-
```tsx
|
|
55
|
-
let cleanup = anchor(popover, { x: event.clientX, y: event.clientY }, { placement: 'bottom-start' })
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Keep presentation app-owned when the anchored element is rendered by your component:
|
|
59
|
-
|
|
60
|
-
```tsx
|
|
61
|
-
import { anchor } from 'remix/ui/anchor'
|
|
62
|
-
import { on, ref } from 'remix/ui'
|
|
63
|
-
import type { Handle } from 'remix/ui'
|
|
64
|
-
import { panelStyle } from './floating.styles.ts'
|
|
65
|
-
|
|
66
|
-
export function AnchoredPanel(handle: Handle) {
|
|
67
|
-
let cleanup = () => {}
|
|
68
|
-
let trigger: HTMLElement | null = null
|
|
69
|
-
let panel: HTMLElement | null = null
|
|
70
|
-
|
|
71
|
-
handle.signal.addEventListener('abort', () => cleanup(), { once: true })
|
|
72
|
-
|
|
73
|
-
function position() {
|
|
74
|
-
cleanup()
|
|
75
|
-
if (trigger && panel) {
|
|
76
|
-
cleanup = anchor(panel, trigger, { placement: 'bottom-start', offset: 8 })
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return () => (
|
|
81
|
-
<>
|
|
82
|
-
<button mix={[ref((node) => (trigger = node)), on('click', position)]} type="button">
|
|
83
|
-
Open
|
|
84
|
-
</button>
|
|
85
|
-
<div data-panel mix={[panelStyle, ref((node) => (panel = node))]}>
|
|
86
|
-
Panel
|
|
87
|
-
</div>
|
|
88
|
-
</>
|
|
89
|
-
)
|
|
90
|
-
}
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## `remix/ui/anchor`
|
|
94
|
-
|
|
95
|
-
- `anchor(floatingElement, anchorTarget, options)`: positions `floatingElement` against an element or coordinate target, starts animation-frame polling for geometry changes, and returns a cleanup function.
|
|
96
|
-
- `AnchorOptions`: placement, inset, relative alignment, and offset options.
|
|
97
|
-
- `AnchorPoint`: viewport coordinate target with `x`, `y`, and optional `width`/`height`.
|
|
98
|
-
- `AnchorPlacement`: exported placement names for the main sides and top/bottom start/end alignment.
|
|
99
|
-
- `AnchorTarget`: an `HTMLElement` or `AnchorPoint`.
|
|
100
|
-
|
|
101
|
-
## Placements
|
|
102
|
-
|
|
103
|
-
Default placement is `bottom`. Use start/end variants to align an edge instead of centering the floating element on the anchor.
|
|
104
|
-
|
|
105
|
-
```tsx
|
|
106
|
-
anchor(panel, trigger, { placement: 'bottom' })
|
|
107
|
-
anchor(panel, trigger, { placement: 'bottom-start' })
|
|
108
|
-
anchor(panel, trigger, { placement: 'bottom-end' })
|
|
109
|
-
anchor(panel, trigger, { placement: 'top' })
|
|
110
|
-
anchor(panel, trigger, { placement: 'left' })
|
|
111
|
-
anchor(panel, trigger, { placement: 'right' })
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
The positioning logic can also handle left/right start/end placements through `AnchorOptions['placement']`.
|
|
115
|
-
|
|
116
|
-
```tsx
|
|
117
|
-
anchor(panel, trigger, { placement: 'right-start' })
|
|
118
|
-
anchor(panel, trigger, { placement: 'left-end' })
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
When the requested placement would overflow the viewport, `anchor` flips to the opposite side and writes the final placement to `data-anchor-placement`.
|
|
122
|
-
|
|
123
|
-
```tsx
|
|
124
|
-
let cleanup = anchor(panel, trigger, {
|
|
125
|
-
placement: 'bottom-start',
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
panel.dataset.anchorPlacement
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
## Offsets
|
|
132
|
-
|
|
133
|
-
Use `offset` for distance along the placement axis. Use `offsetX` and `offsetY` for independent adjustment after placement is resolved.
|
|
134
|
-
|
|
135
|
-
```tsx
|
|
136
|
-
anchor(panel, trigger, {
|
|
137
|
-
placement: 'bottom-start',
|
|
138
|
-
offset: 8,
|
|
139
|
-
offsetX: 4,
|
|
140
|
-
offsetY: -2,
|
|
141
|
-
})
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
Offsets may be numbers or functions that receive the floating element.
|
|
145
|
-
|
|
146
|
-
```tsx
|
|
147
|
-
anchor(panel, trigger, {
|
|
148
|
-
placement: 'bottom-start',
|
|
149
|
-
offset: (floating) => floating.offsetHeight / 10,
|
|
150
|
-
offsetX: (floating) => floating.offsetWidth / 20,
|
|
151
|
-
})
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
## Inset Positioning
|
|
155
|
-
|
|
156
|
-
Pass `inset: true` to align the floating element inside the anchor edge instead of outside it. This is useful for surfaces that should visually cover or line up with the trigger.
|
|
157
|
-
|
|
158
|
-
```tsx
|
|
159
|
-
anchor(panel, trigger, {
|
|
160
|
-
placement: 'bottom-start',
|
|
161
|
-
inset: true,
|
|
162
|
-
})
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
## Relative Alignment
|
|
166
|
-
|
|
167
|
-
Use `relativeTo` when a child inside the floating element should align to the anchor instead of the floating element's outer box. The value is a selector scoped to the floating element.
|
|
168
|
-
|
|
169
|
-
```tsx
|
|
170
|
-
anchor(listbox, trigger, {
|
|
171
|
-
placement: 'bottom-start',
|
|
172
|
-
relativeTo: '[role="option"][aria-selected="true"]',
|
|
173
|
-
})
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
Combine `relativeTo` with `inset` for selected-option popovers where the selected option should sit over the trigger.
|
|
177
|
-
|
|
178
|
-
```tsx
|
|
179
|
-
anchor(listbox, trigger, {
|
|
180
|
-
placement: 'left',
|
|
181
|
-
inset: true,
|
|
182
|
-
relativeTo: '[aria-selected="true"]',
|
|
183
|
-
})
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
## Behavior Notes
|
|
187
|
-
|
|
188
|
-
- Default placement is below the anchor.
|
|
189
|
-
- Supported placements include top, bottom, left, right, top/bottom start/end variants, and left/right start/end placements through `AnchorOptions['placement']`.
|
|
190
|
-
- The floating element flips when the requested placement would overflow the viewport and records the final placement in `data-anchor-placement`.
|
|
191
|
-
- Oversized floating elements are constrained with max dimensions and remain inside the viewport padding.
|
|
192
|
-
- Oversized inset surfaces with `relativeTo` preserve alignment by scrolling the nearest scrollable descendant when possible.
|
|
193
|
-
- `offset`, `offsetX`, and `offsetY` may be numbers or functions that receive the floating element.
|
|
194
|
-
- `relativeTo` lets a surface align to an inner element, which is useful for selected options inside popovers.
|
|
195
|
-
- `anchor` polls on animation frames for anchor target or floating geometry changes and repositions when either changes.
|
|
196
|
-
- The returned cleanup function cancels animation-frame polling and removes scroll and resize listeners. It leaves the last inline styles and `data-anchor-placement` attribute in place.
|
package/src/ui/anchor.ts
DELETED