@smilodon/react 1.9.3 → 1.10.1
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/COMPLETE-GUIDE.md +15 -14
- package/README.md +330 -91
- package/dist/index.cjs +682 -151
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +683 -152
- package/dist/index.js.map +1 -1
- package/dist/types/Select.d.ts +27 -17
- package/dist/types/Select.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
package/COMPLETE-GUIDE.md
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
# @smilodon/react - Complete Guide
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Select component guide for React applications**
|
|
4
4
|
|
|
5
5
|
This guide provides comprehensive documentation for using Smilodon Select in React applications, covering all features, styling options, and advanced use cases.
|
|
6
6
|
|
|
7
|
+
> Capability caveat: the public `virtualized` prop enables chunked rendering for large flat lists, not viewport-windowed virtualization. Older examples below that say “only visible rows” or imply bounded DOM are not current release guarantees. See [Known Limitations](../../docs/KNOWN-LIMITATIONS.md#viewport-virtualization-status).
|
|
8
|
+
>
|
|
9
|
+
> Accessibility status: selected keyboard and ARIA behaviors are implemented, but pinned cross-browser verification and manual assistive-technology assessment are pending. This guide is not a WCAG conformance statement. For the maintained public API, use the [API reference](../../docs/API-REFERENCE.md) and the adapter's exported TypeScript types.
|
|
10
|
+
|
|
7
11
|
---
|
|
8
12
|
|
|
9
13
|
## Table of Contents
|
|
@@ -139,7 +143,7 @@ interface SelectProps {
|
|
|
139
143
|
style?: React.CSSProperties;
|
|
140
144
|
|
|
141
145
|
// Advanced
|
|
142
|
-
|
|
146
|
+
virtualized?: boolean;
|
|
143
147
|
customRenderer?: (item: SelectItem, index: number) => React.ReactNode;
|
|
144
148
|
|
|
145
149
|
// Events
|
|
@@ -161,10 +165,10 @@ interface SelectProps {
|
|
|
161
165
|
| `disabled` | `boolean` | `false` | Disable the select |
|
|
162
166
|
| `placeholder` | `string` | `'Select...'` | Placeholder text |
|
|
163
167
|
| `maxHeight` | `number` | `300` | Max dropdown height (px) |
|
|
164
|
-
| `estimatedItemHeight` | `number` | `48` |
|
|
168
|
+
| `estimatedItemHeight` | `number` | `48` | Passed to core config for the guarded viewport-windowing test path; it does not affect public chunk rendering |
|
|
165
169
|
| `className` | `string` | `undefined` | CSS class name |
|
|
166
170
|
| `style` | `React.CSSProperties` | `undefined` | Inline styles (CSS variables) |
|
|
167
|
-
| `
|
|
171
|
+
| `virtualized` | `boolean` | `false` | Enable incremental chunk rendering for large flat lists; not viewport windowing |
|
|
168
172
|
| `customRenderer` | `function` | `undefined` | Custom option renderer |
|
|
169
173
|
| `onOpen` | `() => void` | `undefined` | Called when dropdown opens |
|
|
170
174
|
| `onClose` | `() => void` | `undefined` | Called when dropdown closes |
|
|
@@ -940,7 +944,6 @@ function CustomRendererSelect() {
|
|
|
940
944
|
onChange={(val) => setValue(val as string)}
|
|
941
945
|
customRenderer={customRenderer}
|
|
942
946
|
placeholder="Select a user"
|
|
943
|
-
estimatedItemHeight={60}
|
|
944
947
|
/>
|
|
945
948
|
);
|
|
946
949
|
}
|
|
@@ -973,8 +976,7 @@ function LargeDataset() {
|
|
|
973
976
|
items={items}
|
|
974
977
|
value={value}
|
|
975
978
|
onChange={(val) => setValue(val as string)}
|
|
976
|
-
|
|
977
|
-
estimatedItemHeight={48}
|
|
979
|
+
virtualized={true}
|
|
978
980
|
placeholder="Search 100k items..."
|
|
979
981
|
searchable
|
|
980
982
|
/>
|
|
@@ -1099,7 +1101,7 @@ function GenericSelect<T extends SelectItem>({
|
|
|
1099
1101
|
|
|
1100
1102
|
## Accessibility
|
|
1101
1103
|
|
|
1102
|
-
Smilodon
|
|
1104
|
+
Smilodon implements selected keyboard and ARIA behavior. Pinned cross-browser verification and manual assistive-technology assessment remain pending; this is not a WCAG conformance claim.
|
|
1103
1105
|
|
|
1104
1106
|
### Keyboard Navigation
|
|
1105
1107
|
|
|
@@ -1116,7 +1118,7 @@ The component automatically includes:
|
|
|
1116
1118
|
- `role="combobox"`
|
|
1117
1119
|
- `aria-expanded`
|
|
1118
1120
|
- `aria-haspopup`
|
|
1119
|
-
- `aria-label` / `aria-
|
|
1121
|
+
- `aria-label` / `aria-description` (literal host attributes are forwarded)
|
|
1120
1122
|
- `aria-activedescendant`
|
|
1121
1123
|
- `aria-multiselectable` (when `multiple={true}`)
|
|
1122
1124
|
|
|
@@ -1132,7 +1134,7 @@ function AccessibleSelect() {
|
|
|
1132
1134
|
value={value}
|
|
1133
1135
|
onChange={setValue}
|
|
1134
1136
|
placeholder="Select your country"
|
|
1135
|
-
|
|
1137
|
+
aria-label="Country"
|
|
1136
1138
|
/>
|
|
1137
1139
|
</div>
|
|
1138
1140
|
);
|
|
@@ -1325,10 +1327,10 @@ const [value, setValue] = useState<(string | number)[]>([]);
|
|
|
1325
1327
|
|
|
1326
1328
|
If you experience slow rendering with large datasets:
|
|
1327
1329
|
|
|
1328
|
-
1.
|
|
1330
|
+
1. Use `virtualized` only for incremental chunk rendering; it does not bound mounted DOM.
|
|
1329
1331
|
2. Use `useMemo` for items array
|
|
1330
1332
|
3. Use `useCallback` for event handlers
|
|
1331
|
-
4.
|
|
1333
|
+
4. Use host-controlled paging/search for datasets that should not all be loaded at once.
|
|
1332
1334
|
|
|
1333
1335
|
```tsx
|
|
1334
1336
|
const items = useMemo(() => generateLargeDataset(), []);
|
|
@@ -1338,8 +1340,7 @@ const handleChange = useCallback((val) => setValue(val), []);
|
|
|
1338
1340
|
items={items}
|
|
1339
1341
|
value={value}
|
|
1340
1342
|
onChange={handleChange}
|
|
1341
|
-
|
|
1342
|
-
estimatedItemHeight={48}
|
|
1343
|
+
virtualized={true}
|
|
1343
1344
|
/>
|
|
1344
1345
|
```
|
|
1345
1346
|
|