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
package/src/ui/tabs/README.md
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
# tabs
|
|
2
|
-
|
|
3
|
-
`Tabs` renders a tab control with one active tab and matching panels. Use it when related views share the same page space and the owning component may either control the active tab or let the tabs context manage it.
|
|
4
|
-
|
|
5
|
-
## Component Usage
|
|
6
|
-
|
|
7
|
-
```tsx
|
|
8
|
-
import { Tabs, TabList, Tab, TabPanel } from 'remix/ui/tabs'
|
|
9
|
-
|
|
10
|
-
export function ProjectTabs() {
|
|
11
|
-
return (
|
|
12
|
-
<Tabs defaultActiveTab="overview">
|
|
13
|
-
<TabList aria-label="Project sections">
|
|
14
|
-
<Tab name="overview">Overview</Tab>
|
|
15
|
-
<Tab name="activity">Activity</Tab>
|
|
16
|
-
<Tab name="settings">Settings</Tab>
|
|
17
|
-
</TabList>
|
|
18
|
-
|
|
19
|
-
<TabPanel name="overview">Project summary.</TabPanel>
|
|
20
|
-
<TabPanel name="activity">Recent changes.</TabPanel>
|
|
21
|
-
<TabPanel name="settings">Project settings.</TabPanel>
|
|
22
|
-
</Tabs>
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Control the active tab when state should live in the owning component:
|
|
28
|
-
|
|
29
|
-
```tsx
|
|
30
|
-
import type { Handle } from 'remix/ui'
|
|
31
|
-
import { Tabs, TabList, Tab, TabPanel } from 'remix/ui/tabs'
|
|
32
|
-
|
|
33
|
-
export function ControlledTabs(handle: Handle) {
|
|
34
|
-
let activeTab = 'overview'
|
|
35
|
-
|
|
36
|
-
return () => (
|
|
37
|
-
<Tabs
|
|
38
|
-
activeTab={activeTab}
|
|
39
|
-
onActiveTabChange={(nextActiveTab) => {
|
|
40
|
-
activeTab = nextActiveTab
|
|
41
|
-
void handle.update()
|
|
42
|
-
}}
|
|
43
|
-
>
|
|
44
|
-
<TabList aria-label="Project sections">
|
|
45
|
-
<Tab name="overview">Overview</Tab>
|
|
46
|
-
<Tab name="activity">Activity</Tab>
|
|
47
|
-
</TabList>
|
|
48
|
-
|
|
49
|
-
<TabPanel name="overview">Project summary.</TabPanel>
|
|
50
|
-
<TabPanel name="activity">Recent changes.</TabPanel>
|
|
51
|
-
</Tabs>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Listen for bubbling `TabsChangeEvent` events with `onTabsChange` from `remix/ui/tabs/primitives`.
|
|
57
|
-
|
|
58
|
-
```tsx
|
|
59
|
-
import { onTabsChange } from 'remix/ui/tabs/primitives'
|
|
60
|
-
import { Tabs, TabList, Tab, TabPanel } from 'remix/ui/tabs'
|
|
61
|
-
|
|
62
|
-
export function TrackedTabs() {
|
|
63
|
-
return (
|
|
64
|
-
<div
|
|
65
|
-
mix={[
|
|
66
|
-
onTabsChange((event) => {
|
|
67
|
-
console.log(event.previousActiveTab, event.activeTab)
|
|
68
|
-
}),
|
|
69
|
-
]}
|
|
70
|
-
>
|
|
71
|
-
<Tabs defaultActiveTab="overview">
|
|
72
|
-
<TabList aria-label="Project sections">
|
|
73
|
-
<Tab name="overview">Overview</Tab>
|
|
74
|
-
<Tab name="activity">Activity</Tab>
|
|
75
|
-
</TabList>
|
|
76
|
-
<TabPanel name="overview">Project summary.</TabPanel>
|
|
77
|
-
<TabPanel name="activity">Recent changes.</TabPanel>
|
|
78
|
-
</Tabs>
|
|
79
|
-
</div>
|
|
80
|
-
)
|
|
81
|
-
}
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Primitive Usage
|
|
85
|
-
|
|
86
|
-
Use the lower-level primitives when app code owns the markup and styles:
|
|
87
|
-
|
|
88
|
-
```tsx
|
|
89
|
-
import * as tabs from 'remix/ui/tabs/primitives'
|
|
90
|
-
import { listStyle, panelStyle, rootStyle, tabStyle } from './tabs.styles'
|
|
91
|
-
|
|
92
|
-
export function PrimitiveTabs() {
|
|
93
|
-
return (
|
|
94
|
-
<tabs.Context defaultActiveTab="overview">
|
|
95
|
-
<div mix={[rootStyle, tabs.root()]}>
|
|
96
|
-
<div mix={[listStyle, tabs.list()]} aria-label="Project sections">
|
|
97
|
-
<button mix={[tabStyle, tabs.tab({ name: 'overview' })]} type="button">
|
|
98
|
-
Overview
|
|
99
|
-
</button>
|
|
100
|
-
<button mix={[tabStyle, tabs.tab({ name: 'activity' })]} type="button">
|
|
101
|
-
Activity
|
|
102
|
-
</button>
|
|
103
|
-
</div>
|
|
104
|
-
|
|
105
|
-
<div mix={[panelStyle, tabs.panel({ name: 'overview' })]}>Project summary.</div>
|
|
106
|
-
<div mix={[panelStyle, tabs.panel({ name: 'activity' })]}>Recent changes.</div>
|
|
107
|
-
</div>
|
|
108
|
-
</tabs.Context>
|
|
109
|
-
)
|
|
110
|
-
}
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
## `remix/ui/tabs`
|
|
114
|
-
|
|
115
|
-
- `Tabs`: root component. Supports controlled `activeTab`, uncontrolled `defaultActiveTab`, `onActiveTabChange`, `disabled`, and `size: 'md' | 'lg'`.
|
|
116
|
-
- `TabList`: tablist wrapper that lays out the tabs in a track and applies the tablist primitive.
|
|
117
|
-
- `Tab`: button for one tab `name`. The active tab uses the toggle slider treatment and button-sized text. Pass `disabled` to prevent activation.
|
|
118
|
-
- `TabPanel`: panel for one tab `name`.
|
|
119
|
-
- `rootStyle`, `listStyle`, `tabStyle`, and `panelStyle`: flat style mixins used by the component markup.
|
|
120
|
-
- `onTabsChange` and `TabsChangeEvent`: re-exported primitive event helpers.
|
|
121
|
-
- `TabsProps`, `TabListProps`, `TabProps`, `TabPanelProps`, and `TabsSize`: public TypeScript types for the composed APIs.
|
|
122
|
-
|
|
123
|
-
## `remix/ui/tabs/primitives`
|
|
124
|
-
|
|
125
|
-
- `Context`: lower-level provider for custom tabs composition.
|
|
126
|
-
- `root()`: wires the root element and bubbling change events.
|
|
127
|
-
- `list()`: wires the tablist role and disabled state.
|
|
128
|
-
- `tab({ name, disabled })`: wires a tab button with selected state, ids, keyboard activation, and pointer activation.
|
|
129
|
-
- `panel({ name })`: wires the matching tab panel id, hidden state, inert state, and label relationship.
|
|
130
|
-
- `onTabsChange(...)`: event mixin for the bubbling `TabsChangeEvent`.
|
|
131
|
-
- `TabsChangeEvent`: bubbling event with `activeTab` and `previousActiveTab`.
|
|
132
|
-
- `TabsContextProps`, `TabsContextValue`, `TabsRegisteredTab`, `TabsActivationDirection`, `TabsRootOptions`, `TabListOptions`, `TabOptions`, and `TabPanelOptions`: primitive prop and option types for custom composition.
|
|
133
|
-
|
|
134
|
-
## Behavior Notes
|
|
135
|
-
|
|
136
|
-
- If neither `activeTab` nor `defaultActiveTab` is provided, the first enabled tab becomes active.
|
|
137
|
-
- Arrow keys activate the next or previous enabled tab. `Home` and `End` activate the first and last enabled tabs.
|
|
138
|
-
- `Enter`, `Space`, and pointer clicks activate the focused tab.
|
|
139
|
-
- Root `disabled` disables every tab. Tab `disabled` only disables that tab.
|
|
140
|
-
- Tabs and panels are linked with generated ids through `aria-controls`, `aria-labelledby`, and `aria-selected`.
|
|
141
|
-
- Inactive panels receive `hidden`, `inert`, and `data-state="inactive"`.
|
package/src/ui/tabs.ts
DELETED
package/src/ui/toggle/README.md
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# toggle
|
|
2
|
-
|
|
3
|
-
`toggle` is a style mixin for checkbox inputs rendered as switches. Use native input props for normal form behavior, and compose it with `remix/ui/toggle/primitives` when you need the headless toggle state helpers or custom hosts.
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
```tsx
|
|
8
|
-
import toggle from 'remix/ui/toggle'
|
|
9
|
-
|
|
10
|
-
function NotificationSetting() {
|
|
11
|
-
return () => (
|
|
12
|
-
<label>
|
|
13
|
-
<input mix={toggle({ size: 'lg' })} defaultChecked />
|
|
14
|
-
Email notifications
|
|
15
|
-
</label>
|
|
16
|
-
)
|
|
17
|
-
}
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Primitive Usage
|
|
21
|
-
|
|
22
|
-
Use the lower-level primitive when app code needs normalized checked state, toggle change events, or a non-input host:
|
|
23
|
-
|
|
24
|
-
```tsx
|
|
25
|
-
import toggle from 'remix/ui/toggle'
|
|
26
|
-
import * as togglePrimitive from 'remix/ui/toggle/primitives'
|
|
27
|
-
|
|
28
|
-
function CustomToggle() {
|
|
29
|
-
return () => (
|
|
30
|
-
<button
|
|
31
|
-
aria-label="Notifications"
|
|
32
|
-
mix={[...toggle(), togglePrimitive.control({ defaultChecked: true })]}
|
|
33
|
-
/>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## `remix/ui/toggle`
|
|
39
|
-
|
|
40
|
-
- `toggle(options)`: styles a native checkbox input as a switch and supplies `type="checkbox"` plus `role="switch"` when the host is an `<input>` without an explicit non-checkbox `type`. Supports `size: 'md' | 'lg'` and defaults to `'md'`.
|
|
41
|
-
- `onToggleChange(handler)`: re-exported primitive event mixin.
|
|
42
|
-
- `ToggleChangeEvent`: re-exported primitive event class.
|
|
43
|
-
- `ToggleSize` and `ToggleOptions`: public TypeScript types for the style mixin.
|
|
44
|
-
|
|
45
|
-
## `remix/ui/toggle/primitives`
|
|
46
|
-
|
|
47
|
-
- `control(options)`: wires a boolean switch control with checked state, ARIA, keyboard, and native input behavior.
|
|
48
|
-
- `onToggleChange(handler)`: event mixin for bubbling toggle changes.
|
|
49
|
-
- `ToggleChangeEvent`: event class dispatched when a toggle changes.
|
|
50
|
-
- `ToggleControlOptions`: primitive options for controlled and uncontrolled state.
|
|
51
|
-
|
|
52
|
-
## Behavior Notes
|
|
53
|
-
|
|
54
|
-
- Checked styles apply through `:checked`, `[aria-checked="true"]`, or `[data-state="checked"]`.
|
|
55
|
-
- Native checkbox switches use the native `checked` attribute for state. Custom hosts use `role="switch"` and `aria-checked="true"` or `aria-checked="false"`.
|
|
56
|
-
- Every switch needs an accessible name, usually from visible label text, `aria-label`, or `aria-labelledby`.
|
package/src/ui/toggle.ts
DELETED
package/src/ui-hmr.ts
DELETED
package/src/ui.ts
DELETED