@wso2/oxygen-ui 0.22.0 → 0.23.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/.ai/AGENTS.md +2 -0
- package/.claude/skills/oxygen-form/SKILL.md +7 -4
- package/.claude/skills/oxygen-select/SKILL.md +139 -0
- package/.claude/skills/oxygen-textfield/SKILL.md +91 -0
- package/README.md +2 -0
- package/bin/cli.js +4 -0
- package/dist/components/AppBreadcrumbs/AppBreadcrumbs.d.ts +3 -2
- package/dist/components/Select/Select.d.ts +23 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1356 -925
- package/dist/index.js.map +4 -4
- package/dist/styles/Themes/ChoreoLabsTheme.d.ts +49 -0
- package/package.json +2 -2
package/.ai/AGENTS.md
CHANGED
|
@@ -23,6 +23,8 @@ function App() {
|
|
|
23
23
|
3. **Icons from `@wso2/oxygen-ui-icons-react`** - Separate package for icons
|
|
24
24
|
4. **MUI X uses namespaces** - `DataGrid.DataGrid`, `DatePickers.DatePicker`, `TreeView.TreeView`
|
|
25
25
|
5. **Use theme tokens** - Use `sx` prop with theme values, not hardcoded colors/spacing
|
|
26
|
+
6. **Fixed labels on inputs** - Give every labelled `TextField` and `Select` `labelPlacement="top"`; never use MUI's floating label (`InputLabel` inside `FormControl`) in new code
|
|
27
|
+
7. **Select placeholders come from the developer** - Give every `Select` and `TextField select` a `placeholder`; ask the developer for the text instead of inventing it. Native selects (`native` or `SelectProps={{ native: true }}`) ignore `placeholder`, so put that same text in the empty option instead: `<option value="">Select a role</option>`
|
|
26
28
|
|
|
27
29
|
## Import Patterns
|
|
28
30
|
|
|
@@ -12,7 +12,8 @@ description: Generate forms with Form.* components and validation. Use when crea
|
|
|
12
12
|
3. Use `Form.Stack` for field layout
|
|
13
13
|
4. Give every field a fixed label on top with `labelPlacement="top"` (see Field Labels)
|
|
14
14
|
5. Mark each required field with `required`; leave optional fields unmarked
|
|
15
|
-
6.
|
|
15
|
+
6. Give every select a `placeholder`; ask the developer for the text (see Select and Autocomplete)
|
|
16
|
+
7. Add validation with `error` and `helperText` props. Plain `Select` has no `helperText`, so use `TextField select` for any select that shows validation messages
|
|
16
17
|
|
|
17
18
|
## Critical Rules
|
|
18
19
|
|
|
@@ -59,10 +60,10 @@ Forms use a fixed label above the input, not MUI's floating label. `labelPlaceme
|
|
|
59
60
|
|
|
60
61
|
### Select and Autocomplete
|
|
61
62
|
|
|
62
|
-
The same rules apply. Use `TextField` with `select
|
|
63
|
+
The same rules apply. Use `TextField` with `select` (it supports `helperText` for validation messages), or `Select` with `labelPlacement="top"` (see the `oxygen-select` skill). Every select needs a `placeholder`; ask the developer for the text before writing the form, listing each select with a suggestion such as "Select a role", and never invent it. Native selects ignore `placeholder`, so use that text as the empty option's label instead. A select in error keeps its label colour; the error shows on the border and in `helperText`. For Autocomplete, pass `labelPlacement="top"` and `required` to the `TextField` in `renderInput`:
|
|
63
64
|
|
|
64
65
|
```tsx
|
|
65
|
-
<TextField select labelPlacement="top" label="Role" required value={role} onChange={...}>
|
|
66
|
+
<TextField select labelPlacement="top" label="Role" placeholder="Select a role" required value={role} onChange={...}>
|
|
66
67
|
<MenuItem value="developer">Developer</MenuItem>
|
|
67
68
|
</TextField>
|
|
68
69
|
|
|
@@ -178,7 +179,9 @@ function SectionedForm() {
|
|
|
178
179
|
<Form.Stack spacing={2}>
|
|
179
180
|
{/* Optional fields: no marker */}
|
|
180
181
|
<TextField fullWidth labelPlacement="top" label="Company name" />
|
|
181
|
-
|
|
182
|
+
{/* Placeholder text comes from the developer */}
|
|
183
|
+
<TextField fullWidth select labelPlacement="top" label="Role" placeholder="Select a role" defaultValue="">
|
|
184
|
+
{/* Optional select: an empty option lets users clear it */}
|
|
182
185
|
<MenuItem value="">None</MenuItem>
|
|
183
186
|
<MenuItem value="developer">Developer</MenuItem>
|
|
184
187
|
<MenuItem value="designer">Designer</MenuItem>
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oxygen-select
|
|
3
|
+
description: Use the Oxygen UI Select with a fixed label above the field instead of MUI's floating label, and a placeholder the developer provides. Use when adding or editing any Select, dropdown, or picker built on Select, or when converting FormControl + InputLabel + Select code to fixed labels.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Fixed-Label Select
|
|
7
|
+
|
|
8
|
+
Oxygen UI selects use a fixed label that sits above the field and never moves. Do not use MUI's floating label, which starts inside the field and shrinks into the border on focus. The floating variant still works, but only for existing screens; never write new code with it.
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
Fixed label (use) Floating label (don't use)
|
|
12
|
+
Environment ┌─ Environment ───────┐
|
|
13
|
+
┌─────────────────────┐ │ Production ▾ │
|
|
14
|
+
│ Production ▾ │ └─────────────────────┘
|
|
15
|
+
└─────────────────────┘
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Instructions
|
|
19
|
+
|
|
20
|
+
1. Import `Select` from `@wso2/oxygen-ui`, never from `@mui/material`. `labelPlacement` is an Oxygen UI prop, and the MUI `Select` ignores it.
|
|
21
|
+
2. Add `labelPlacement="top"` and `label` to every `Select`. Do not wrap it in `FormControl` or add an `InputLabel`; the component draws its own.
|
|
22
|
+
3. Give every `Select` a `placeholder`. Get the text from the developer; never make it up (see Placeholder text).
|
|
23
|
+
4. Mark required selects with `required`; the theme draws the `*`.
|
|
24
|
+
5. When the select needs helper text or validation messages, use `TextField select labelPlacement="top"` instead (see the `oxygen-textfield` skill). It has the same fixed label, supports `helperText`, and takes the same `placeholder`.
|
|
25
|
+
6. For forms (validation, sections, wizards), also follow the `oxygen-form` skill.
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { Select, MenuItem } from '@wso2/oxygen-ui';
|
|
31
|
+
|
|
32
|
+
<Select
|
|
33
|
+
labelPlacement="top"
|
|
34
|
+
label="Environment"
|
|
35
|
+
placeholder="Select an environment"
|
|
36
|
+
required
|
|
37
|
+
value={env}
|
|
38
|
+
onChange={(e) => setEnv(e.target.value)}
|
|
39
|
+
>
|
|
40
|
+
<MenuItem value="dev">Development</MenuItem>
|
|
41
|
+
<MenuItem value="prod">Production</MenuItem>
|
|
42
|
+
</Select>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
With helper text:
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { TextField, MenuItem } from '@wso2/oxygen-ui';
|
|
49
|
+
|
|
50
|
+
<TextField
|
|
51
|
+
select
|
|
52
|
+
labelPlacement="top"
|
|
53
|
+
label="Environment"
|
|
54
|
+
placeholder="Select an environment"
|
|
55
|
+
helperText="Where the component is deployed."
|
|
56
|
+
value={env}
|
|
57
|
+
onChange={(e) => setEnv(e.target.value)}
|
|
58
|
+
>
|
|
59
|
+
<MenuItem value="dev">Development</MenuItem>
|
|
60
|
+
<MenuItem value="prod">Production</MenuItem>
|
|
61
|
+
</TextField>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Placeholder text
|
|
65
|
+
|
|
66
|
+
Every select shows a placeholder while nothing is selected. The developer owns this text, so ask for it.
|
|
67
|
+
|
|
68
|
+
1. Before writing the code, check whether the developer has given placeholder text for each select.
|
|
69
|
+
2. If any is missing, ask the developer once, listing every select that needs one by its label. Offer a suggestion for each so they can accept or change it, for example:
|
|
70
|
+
|
|
71
|
+
```text
|
|
72
|
+
Placeholder text needed for these selects. Reply with your text, or "ok" to use the suggestions:
|
|
73
|
+
- Environment: "Select an environment"
|
|
74
|
+
- Region: "Select a region"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
3. Use the developer's text exactly as given. Do not write code with placeholder text the developer has not provided or accepted.
|
|
78
|
+
4. If you can't ask (for example, in a non-interactive run), use the suggestions and list them in your summary so the developer can review them.
|
|
79
|
+
|
|
80
|
+
Suggestions follow these rules:
|
|
81
|
+
|
|
82
|
+
- Start with "Select" and name the thing chosen, in sentence case: "Select a region", not "Select Region" or "Choose…"
|
|
83
|
+
- No trailing punctuation or ellipsis
|
|
84
|
+
- Don't repeat "(Optional)" or "*" from the label
|
|
85
|
+
- Never use the placeholder in place of a label
|
|
86
|
+
|
|
87
|
+
## How it behaves
|
|
88
|
+
|
|
89
|
+
- The label renders as a `FormLabel` above the select and keeps its colour on focus and in the error state; the error shows on the field's border and in helper text. Focus shows only on the field: in the Choreo Labs theme, a text-colour border with a Cobalt ring, the same as fixed-label text fields.
|
|
90
|
+
- The label names the combobox through `labelId` (or `htmlFor` with `native`), so screen readers announce it. Do not add your own `aria-label` when a label is set.
|
|
91
|
+
- `sx`, `className`, `style`, `fullWidth` and `ref` apply to the outer wrapper that holds the label and the select. `size`, `variant`, `required`, `error` and `disabled` apply to both.
|
|
92
|
+
- `placeholder` shows text in the field while nothing is selected (an empty value: `''`, `null`, `undefined` or `[]`), in the secondary text colour so it meets contrast requirements. It works with a custom `renderValue`. Native selects ignore it, so give them an empty option with the developer's placeholder text instead: `<option value="">Select a role</option>`.
|
|
93
|
+
- Without a `label`, the prop has no effect and the select renders as a plain MUI `Select`.
|
|
94
|
+
|
|
95
|
+
## Selects with no visible label
|
|
96
|
+
|
|
97
|
+
Some selects have no visible label, such as a sort or page-size picker in a toolbar. Omit `label`, give the select an accessible name, and still ask the developer for a placeholder if the select can be empty:
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
<Select placeholder="Sort by" value={sort} onChange={(e) => setSort(e.target.value)} inputProps={{ 'aria-label': 'Sort by' }}>
|
|
101
|
+
<MenuItem value="name">Name</MenuItem>
|
|
102
|
+
<MenuItem value="date">Date</MenuItem>
|
|
103
|
+
</Select>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Never use a floating label to save vertical space.
|
|
107
|
+
|
|
108
|
+
## Converting floating labels
|
|
109
|
+
|
|
110
|
+
When you edit code that uses floating labels:
|
|
111
|
+
|
|
112
|
+
| Floating-label code | Fixed-label replacement |
|
|
113
|
+
| --- | --- |
|
|
114
|
+
| `import { Select } from '@mui/material'` | `import { Select } from '@wso2/oxygen-ui'` |
|
|
115
|
+
| `<FormControl><InputLabel id="x">Role</InputLabel><Select labelId="x" label="Role">…</Select></FormControl>` | `<Select labelPlacement="top" label="Role">…</Select>` |
|
|
116
|
+
| The same, plus a `FormHelperText` | `<TextField select labelPlacement="top" label="Role" helperText="…">…</TextField>` |
|
|
117
|
+
| `<FormControl sx={{ minWidth: 200 }}>` around the select | Move `sx` onto the `Select` |
|
|
118
|
+
| `<FormControl error required>` around the select | Move `error` and `required` onto the `Select` |
|
|
119
|
+
| A `Typography` or `FormLabel` placed above a label-less `Select` | Remove it; pass the text as `label` with `labelPlacement="top"` |
|
|
120
|
+
| `label="Role *"` | `label="Role" required` |
|
|
121
|
+
| `<MenuItem value="" disabled>Select a role</MenuItem>` used as a placeholder | Remove it; pass `placeholder="Select a role"` |
|
|
122
|
+
| `displayEmpty` with a `renderValue` that returns placeholder text | Remove both; pass `placeholder` (keep a `renderValue` that formats real values) |
|
|
123
|
+
| A select with no placeholder | Ask the developer for the text, then add `placeholder` |
|
|
124
|
+
|
|
125
|
+
## Do and don't
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
✓ <Select labelPlacement="top" label="Role" placeholder="Select a role" required value={role} onChange={…}>…</Select>
|
|
129
|
+
✓ <TextField select labelPlacement="top" label="Role" placeholder="Select a role" helperText="…">…</TextField>
|
|
130
|
+
✗ <Select labelPlacement="top" label="Role" value={role}>…</Select> no placeholder; ask the developer for one
|
|
131
|
+
✗ <MenuItem value="" disabled>Select a role</MenuItem> fake placeholder option
|
|
132
|
+
✗ <FormControl><InputLabel>Role</InputLabel><Select label="Role"> floating label
|
|
133
|
+
✗ import { Select } from '@mui/material' labelPlacement is ignored
|
|
134
|
+
✗ <FormControl><Select labelPlacement="top" label="Role" /></FormControl> extra wrapper; the Select has its own
|
|
135
|
+
✗ <Typography>Role</Typography><Select /> label not linked to the select
|
|
136
|
+
✗ <Select labelPlacement="top" label="Role *" /> hand-written asterisk
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Write labels in sentence case, for example "Deployment region", not "Deployment Region".
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oxygen-textfield
|
|
3
|
+
description: Use the Oxygen UI TextField with a fixed label above the field instead of MUI's floating label. Use when adding or editing any TextField, select, or Autocomplete input, or when converting floating-label fields to fixed labels.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Fixed-Label TextField
|
|
7
|
+
|
|
8
|
+
Oxygen UI text inputs use a fixed label that sits above the field and never moves. Do not use MUI's floating label, which starts inside the field and shrinks into the border on focus.
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
Fixed label (use) Floating label (don't use)
|
|
12
|
+
Display name ┌─ Display name ──────┐
|
|
13
|
+
┌─────────────────────┐ │ my-app │
|
|
14
|
+
│ my-app │ └─────────────────────┘
|
|
15
|
+
└─────────────────────┘
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Instructions
|
|
19
|
+
|
|
20
|
+
1. Import `TextField` from `@wso2/oxygen-ui`, never from `@mui/material`. `labelPlacement` is an Oxygen UI prop, and the MUI `TextField` ignores it.
|
|
21
|
+
2. Add `labelPlacement="top"` to every `TextField` that has a `label`.
|
|
22
|
+
3. Apply the same rule to selects (`TextField select`) and to the `TextField` in an Autocomplete's `renderInput`. Every `TextField select` also needs a `placeholder` whose text the developer provides; follow the `oxygen-select` skill for selects. Native selects (`SelectProps={{ native: true }}`) ignore `placeholder`, so use that text as the empty `<option value="">` instead.
|
|
23
|
+
4. Mark required fields with `required`; the theme draws the `*`.
|
|
24
|
+
5. For forms (validation, sections, wizards), also follow the `oxygen-form` skill.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import { TextField, MenuItem, Autocomplete } from '@wso2/oxygen-ui';
|
|
30
|
+
|
|
31
|
+
<TextField labelPlacement="top" label="Display name" required />
|
|
32
|
+
|
|
33
|
+
<TextField select labelPlacement="top" label="Environment" placeholder="Select an environment" value={env} onChange={(e) => setEnv(e.target.value)}>
|
|
34
|
+
<MenuItem value="dev">Development</MenuItem>
|
|
35
|
+
<MenuItem value="prod">Production</MenuItem>
|
|
36
|
+
</TextField>
|
|
37
|
+
|
|
38
|
+
<Autocomplete
|
|
39
|
+
options={regions}
|
|
40
|
+
renderInput={(params) => <TextField {...params} labelPlacement="top" label="Region" />}
|
|
41
|
+
/>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## How it behaves
|
|
45
|
+
|
|
46
|
+
- The label renders as a `FormLabel` above the input and keeps its colour on focus. Focus shows only on the field's border.
|
|
47
|
+
- The label is linked to the input with `htmlFor`, and for selects through `labelId`, so screen readers announce it. Do not add your own `aria-label` when a label is set.
|
|
48
|
+
- `sx`, `className`, `style`, `fullWidth`, `margin` and `ref` apply to the outer wrapper that holds the label and the field.
|
|
49
|
+
- When `error` is set, an empty helper line is reserved so the layout doesn't shift when a message appears.
|
|
50
|
+
- Without a `label`, the prop has no effect and the field renders as a plain MUI `TextField`.
|
|
51
|
+
|
|
52
|
+
## Fields with no visible label
|
|
53
|
+
|
|
54
|
+
Some fields have no visible label, such as a search box in a toolbar or a table filter. Omit `label`, describe the field with a `placeholder`, and give it an accessible name:
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
<TextField
|
|
58
|
+
placeholder="Search projects"
|
|
59
|
+
slotProps={{ htmlInput: { 'aria-label': 'Search projects' } }}
|
|
60
|
+
/>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Never use a floating label to save vertical space.
|
|
64
|
+
|
|
65
|
+
## Converting floating labels
|
|
66
|
+
|
|
67
|
+
When you edit code that uses floating labels:
|
|
68
|
+
|
|
69
|
+
| Floating-label code | Fixed-label replacement |
|
|
70
|
+
| --- | --- |
|
|
71
|
+
| `import { TextField } from '@mui/material'` | `import { TextField } from '@wso2/oxygen-ui'` |
|
|
72
|
+
| `<TextField label="Name" />` | `<TextField labelPlacement="top" label="Name" />` |
|
|
73
|
+
| `InputLabelProps={{ shrink: true }}` or `slotProps={{ inputLabel: { shrink: true } }}` | Remove it; add `labelPlacement="top"` |
|
|
74
|
+
| `<FormControl><InputLabel>Role</InputLabel><Select label="Role">` | `<Select labelPlacement="top" label="Role" placeholder="Select a role">` or `<TextField select labelPlacement="top" label="Role" placeholder="Select a role">`, with placeholder text from the developer (see `oxygen-select`) |
|
|
75
|
+
| A `Typography` or `FormLabel` placed above a label-less `TextField` | Remove it; pass the text as `label` with `labelPlacement="top"` |
|
|
76
|
+
| `label="Email *"` | `label="Email" required` |
|
|
77
|
+
|
|
78
|
+
## Do and don't
|
|
79
|
+
|
|
80
|
+
```text
|
|
81
|
+
✓ <TextField labelPlacement="top" label="Email" required />
|
|
82
|
+
✓ <TextField select labelPlacement="top" label="Role" placeholder="Select a role">…</TextField>
|
|
83
|
+
✗ <TextField label="Email" /> floating label
|
|
84
|
+
✗ import { TextField } from '@mui/material' labelPlacement is ignored
|
|
85
|
+
✗ <TextField label="Email" slotProps={{ inputLabel: { shrink: true } }} />
|
|
86
|
+
✗ <InputLabel>Role</InputLabel><Select label="Role"> floating select label
|
|
87
|
+
✗ <Typography>Email</Typography><TextField /> label not linked to the input
|
|
88
|
+
✗ <TextField labelPlacement="top" label="Email *" /> hand-written asterisk
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Write labels in sentence case, for example "Display name", not "Display Name".
|
package/README.md
CHANGED
|
@@ -466,6 +466,8 @@ Creates:
|
|
|
466
466
|
- `/oxygen-component` - Generate Oxygen UI components
|
|
467
467
|
- `/oxygen-layout` - Generate app layouts
|
|
468
468
|
- `/oxygen-form` - Generate forms with validation
|
|
469
|
+
- `/oxygen-textfield` - Use fixed-label text fields instead of floating labels
|
|
470
|
+
- `/oxygen-select` - Use fixed-label selects instead of floating labels
|
|
469
471
|
- `/oxygen-migrate` - Migrate MUI code
|
|
470
472
|
- Updates root `CLAUDE.md` with reference
|
|
471
473
|
|
package/bin/cli.js
CHANGED
|
@@ -414,6 +414,8 @@ function initClaude(includeInternal = false) {
|
|
|
414
414
|
console.log(' - /oxygen-component Generate Oxygen UI components');
|
|
415
415
|
console.log(' - /oxygen-layout Generate app layouts');
|
|
416
416
|
console.log(' - /oxygen-form Generate forms with validation');
|
|
417
|
+
console.log(' - /oxygen-textfield Use fixed-label text fields');
|
|
418
|
+
console.log(' - /oxygen-select Use fixed-label selects');
|
|
417
419
|
console.log(' - /oxygen-migrate Migrate MUI code to Oxygen UI');
|
|
418
420
|
if (includeInternal) {
|
|
419
421
|
console.log(' - /oxygen-sync Sync AI docs with source (internal)');
|
|
@@ -548,6 +550,8 @@ Available Skills (Claude mode only):
|
|
|
548
550
|
/oxygen-component Generate Oxygen UI React components
|
|
549
551
|
/oxygen-layout Generate app layouts with AppShell
|
|
550
552
|
/oxygen-form Generate forms with validation
|
|
553
|
+
/oxygen-textfield Use fixed-label text fields
|
|
554
|
+
/oxygen-select Use fixed-label selects
|
|
551
555
|
/oxygen-migrate Migrate existing MUI code
|
|
552
556
|
`);
|
|
553
557
|
}
|
|
@@ -42,7 +42,8 @@ export interface AppBreadcrumbsProps extends React.HTMLAttributes<HTMLDivElement
|
|
|
42
42
|
*/
|
|
43
43
|
maxItems?: number;
|
|
44
44
|
/**
|
|
45
|
-
* Separator between items. Defaults to a chevron
|
|
45
|
+
* Separator between items. Defaults to a chevron, unless the theme sets
|
|
46
|
+
* `components.MuiAppBreadcrumbs.defaultProps.separator`.
|
|
46
47
|
*/
|
|
47
48
|
separator?: ReactNode;
|
|
48
49
|
/**
|
|
@@ -50,7 +51,7 @@ export interface AppBreadcrumbsProps extends React.HTMLAttributes<HTMLDivElement
|
|
|
50
51
|
*/
|
|
51
52
|
sx?: SxProps<Theme>;
|
|
52
53
|
}
|
|
53
|
-
declare function AppBreadcrumbs(
|
|
54
|
+
declare function AppBreadcrumbs(inProps: AppBreadcrumbsProps): JSX.Element;
|
|
54
55
|
declare namespace AppBreadcrumbs {
|
|
55
56
|
var displayName: string;
|
|
56
57
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type SelectProps as MuiSelectProps } from '@mui/material/Select';
|
|
3
|
+
/** `top` draws a static label above the select instead of MUI's floating label. */
|
|
4
|
+
export type SelectLabelPlacement = 'top';
|
|
5
|
+
export type SelectProps<Value = unknown> = MuiSelectProps<Value> & {
|
|
6
|
+
/** Leave unset for MUI's floating label; `top` draws a static label above the select. */
|
|
7
|
+
labelPlacement?: SelectLabelPlacement;
|
|
8
|
+
/** Shown in the field while nothing is selected. Ignored by `native` selects. */
|
|
9
|
+
placeholder?: React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
/** Select props that show `placeholder` while the value is empty; shared with `TextField select`. */
|
|
12
|
+
export declare function selectPlaceholderProps<Value>(placeholder: React.ReactNode, renderValue: ((value: Value) => React.ReactNode) | undefined, children: React.ReactNode): {
|
|
13
|
+
displayEmpty: boolean;
|
|
14
|
+
renderValue: (selected: Value) => string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
15
|
+
};
|
|
16
|
+
type SelectComponent = (<Value = unknown>(props: SelectProps<Value> & {
|
|
17
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
18
|
+
}) => React.JSX.Element) & {
|
|
19
|
+
muiName: string;
|
|
20
|
+
};
|
|
21
|
+
/** MUI's Select; with `labelPlacement="top"`, `ref` and layout props go to an outer FormControl. */
|
|
22
|
+
declare const Select: SelectComponent;
|
|
23
|
+
export default Select;
|
|
@@ -38,6 +38,8 @@ export { default as RelativeTime } from './RelativeTime';
|
|
|
38
38
|
export type { RelativeTimeProps } from './RelativeTime';
|
|
39
39
|
export { default as TextField } from './TextField';
|
|
40
40
|
export type { TextFieldProps, TextFieldLabelPlacement } from './TextField';
|
|
41
|
+
export { default as Select } from './Select';
|
|
42
|
+
export type { SelectProps, SelectLabelPlacement } from './Select';
|
|
41
43
|
export { default as StatCard } from './StatCard';
|
|
42
44
|
export type { StatCardProps } from './StatCard';
|
|
43
45
|
export { default as TrialBadge, getTrialBadgeStatus } from './TrialBadge';
|
package/dist/index.d.ts
CHANGED
|
@@ -25,8 +25,8 @@ export { default as Layout } from "./layouts";
|
|
|
25
25
|
export * from "./animations";
|
|
26
26
|
export * from "./hooks";
|
|
27
27
|
export * from "./utils";
|
|
28
|
-
export { TextField } from './components';
|
|
29
|
-
export type { TextFieldProps, TextFieldLabelPlacement } from './components';
|
|
28
|
+
export { TextField, Select } from './components';
|
|
29
|
+
export type { TextFieldProps, TextFieldLabelPlacement, SelectProps, SelectLabelPlacement } from './components';
|
|
30
30
|
export * from '@mui/material';
|
|
31
31
|
export * as colors from '@mui/material/colors';
|
|
32
32
|
export * as DataGrid from '@mui/x-data-grid';
|