@smworks-cz/ui-kit 1.6.0 → 1.7.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/README.md CHANGED
@@ -90,25 +90,70 @@ function MyApp() {
90
90
  }
91
91
  ```
92
92
 
93
+ ### Overlays: layering, Escape and z-index
94
+
95
+ All overlays (Modal, Drawer, Sheet, ConfirmDialog, Spotlight, CommandMenu, Popover, DropdownMenu, Tooltip and the
96
+ dropdowns of Select / Combobox / DatePicker / ColorPicker / PhoneInput) share one overlay stack:
97
+
98
+ - Escape closes only the topmost overlay (a Select open inside a Modal closes first, the Modal stays).
99
+ - A parent's outside-click ignores clicks into portals of nested overlays (Select inside Popover or Sheet works).
100
+ - A nested overlay gets `parent z-index + 1`; a new modal-like overlay is always placed above everything open.
101
+ - Modal, Drawer and Sheet trap focus (hidden elements are skipped) and return focus to the trigger on close.
102
+ - Animations are skipped when the user prefers reduced motion.
103
+
104
+ Z-index scale (CSS variables, overridable on `:root`):
105
+
106
+ | Variable | Default | Used by |
107
+ |----------|---------|---------|
108
+ | `--sm-ui-z-overlay` | `99998` | Modal, Drawer, Sheet, Spotlight, CommandMenu, ConfirmDialog |
109
+ | `--sm-ui-z-popover` | `99999` | Popover, DropdownMenu, Tooltip, dropdowns of form controls |
110
+ | `--sm-ui-z-toast` | `100050` | Toasts, always above kit overlays |
111
+
112
+ Nested overlays may rise a few units above the base (one per open layer). Put custom app layers that must sit above
113
+ the kit (lightbox, tour, feedback overlay) at `calc(var(--sm-ui-z-popover, 99999) + 20)` or higher, and register them
114
+ with `useOverlay()` so Escape and outside-click respect them. `useOverlayState()` tells you whether any kit overlay is open.
115
+
116
+ ```tsx
117
+ import { useOverlayState, useOverlay, OverlayContext, Z_INDEX, tokens } from '@smworks-cz/ui-kit';
118
+
119
+ const { open } = useOverlayState(); // disable global shortcuts while a modal / dropdown is open
120
+ ```
121
+
122
+ ### Design tokens
123
+
124
+ Colors, glass values, radii, fonts, the field label typography and the z-index scale are exported so apps do not
125
+ have to copy them from the bundle:
126
+
127
+ ```tsx
128
+ import { tokens, Z_INDEX, getZIndexBase, FieldLabel } from '@smworks-cz/ui-kit';
129
+
130
+ tokens.colors.primary // '#FC4F00'
131
+ tokens.theme.dark.panelBg // 'rgba(24,24,24,0.65)'
132
+ tokens.glass.panelBlur // 'blur(32px) saturate(1.4)'
133
+ ```
134
+
93
135
  ## Components
94
136
 
95
137
  ### Forms
96
- Button, Input, Select, DatePicker, Checkbox, Radio, Switch, Textarea, Slider, FileUpload, SegmentedControl
138
+ Button, IconButton, Input, NumberInput, Select, Combobox, DatePicker, Checkbox, Radio, Switch, Textarea, Slider, FileUpload, SegmentedControl, ColorPicker, Rating, OTPInput, PhoneInput, ImageCropper, FormField, FieldLabel
97
139
 
98
140
  ### Data display
99
- Table, Card, Accordion, Tabs, Tooltip, Popover, Skeleton, EmptyState, Stat, Avatar, Tag, Badge
141
+ Table, DataGrid, MobileDataCard, Card, Accordion, Tabs, Tooltip, Popover, Skeleton, EmptyState, Stat, Avatar, AvatarStack, Tag, Badge, Calendar, Timeline, DataList, Tree, StatusBadge
142
+
143
+ ### Charts
144
+ LineChart, AreaChart, BarChart, PieChart, DonutChart, Sparkline
100
145
 
101
146
  ### Navigation & layout
102
- Modal, Drawer, Breadcrumb, Pagination, Stepper, DropdownMenu, Link, Spotlight
147
+ Modal, Drawer, Sheet, Breadcrumb, Pagination, Stepper, FormWizard, DropdownMenu, Link, Spotlight, CommandMenu, AppSidebar, SidebarItem, Navbar
103
148
 
104
149
  ### Feedback
105
- Toast, Alert, Progress, ProgressCircle, Spinner
150
+ Toast, Alert, Banner, Notification, Progress, ProgressCircle, Spinner, ConfirmDialog, CopyButton
106
151
 
107
152
  ### Utility
108
- Divider, Stack, Container, DragList
153
+ Divider, Stack, Container, DragList, SortableList, Splitter
109
154
 
110
155
  ### Hooks
111
- `useTheme`, `useToast`
156
+ `useTheme`, `useToast`, `useConfirm`, `useOverlayState`, `useOverlay`, `useReducedMotion`, `useFocusTrap`
112
157
 
113
158
  ## Fonts
114
159
 
@@ -128,6 +173,21 @@ All components use inline design tokens with automatic dark/light mode support:
128
173
  - **Icons:** [@phosphor-icons/react](https://phosphoricons.com/)
129
174
  - **Fonts:** Zalando Sans (body), Zalando Sans Expanded (headings)
130
175
 
176
+ Native inputs get their placeholder color from the theme through one injected rule scoped to the `sm-ui-input`
177
+ class; no global `input::placeholder` override is needed in the app.
178
+
179
+ ## Testing
180
+
181
+ `useTheme()` and every component render in plain Node / jsdom without a `matchMedia` polyfill. The theme is resolved
182
+ synchronously on first render, so there is no light-mode flash when `data-theme="dark"` is set before mount.
183
+
184
+ `scripts/smoke-preview.mjs` drives the running preview app (`yarn preview`) with Playwright and checks the overlay
185
+ stack (nested Select / Popover / ConfirmDialog in Modal and Drawer, Escape order, focus trap, placeholder color,
186
+ Spotlight Enter). Run it with `yarn test:preview` once Playwright's Chromium and its system libraries are installed
187
+ (`npx playwright install --with-deps chromium`). Without root access, download the missing libraries
188
+ (`apt-get download libnspr4 libnss3 libasound2`, extract with `dpkg-deb -x`) and point `LD_LIBRARY_PATH` at them;
189
+ `PLAYWRIGHT_CHROMIUM` and `PREVIEW_URL` override the browser binary and the preview address.
190
+
131
191
  ## TypeScript
132
192
 
133
193
  Full TypeScript support out of the box. Type definitions are included in the package.