@ahrowe/ui 0.10.0 → 0.12.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/dist/esm/common/accordion/accordion.module.mjs.map +1 -1
- package/dist/esm/common/accordion/accordion.plain.module.mjs.map +1 -1
- package/dist/esm/common/accordion/accordion.primary.module.mjs.map +1 -1
- package/dist/esm/common/actionIcon/actionIcon.module.mjs.map +1 -1
- package/dist/esm/common/animatedText/animatedText.mjs +1 -1
- package/dist/esm/common/animatedText/animatedText.mjs.map +1 -1
- package/dist/esm/common/animatedText/animatedText.types.mjs.map +1 -1
- package/dist/esm/common/button/button.module.mjs.map +1 -1
- package/dist/esm/common/card/card.module.mjs.map +1 -1
- package/dist/esm/common/checkbox/checkbox.module.mjs.map +1 -1
- package/dist/esm/common/chip/chip.module.mjs.map +1 -1
- package/dist/esm/common/colorPicker/colorPicker.mjs +1 -1
- package/dist/esm/common/colorPicker/colorPicker.mjs.map +1 -1
- package/dist/esm/common/colorPicker/colorPicker.module.mjs +1 -1
- package/dist/esm/common/colorPicker/colorPicker.module.mjs.map +1 -1
- package/dist/esm/common/datePicker/components/datePickerMonth/datePickerMonth.module.mjs.map +1 -1
- package/dist/esm/common/datePicker/datePicker.module.mjs.map +1 -1
- package/dist/esm/common/dropZone/dropZone.module.mjs.map +1 -1
- package/dist/esm/common/dropdown/dropdown.module.mjs.map +1 -1
- package/dist/esm/common/fab/fab.module.mjs.map +1 -1
- package/dist/esm/common/floatingMenu/floatingMenu.mjs +1 -1
- package/dist/esm/common/floatingMenu/floatingMenu.mjs.map +1 -1
- package/dist/esm/common/floatingMenu/floatingMenu.module.mjs.map +1 -1
- package/dist/esm/common/hooks/useSwipeDismiss.mjs +2 -0
- package/dist/esm/common/hooks/useSwipeDismiss.mjs.map +1 -0
- package/dist/esm/common/iconPicker/iconPicker.module.mjs.map +1 -1
- package/dist/esm/common/input/input.module.mjs.map +1 -1
- package/dist/esm/common/inputDropdown/inputDropdown.module.mjs.map +1 -1
- package/dist/esm/common/klipyPicker/klipyPicker.module.mjs.map +1 -1
- package/dist/esm/common/modal/modal.module.mjs.map +1 -1
- package/dist/esm/common/numberInput/numberInput.module.mjs.map +1 -1
- package/dist/esm/common/optionPicker/optionPicker.module.mjs.map +1 -1
- package/dist/esm/common/radioGroup/radioGroup.module.mjs.map +1 -1
- package/dist/esm/common/roomDrawer/roomDrawer.module.mjs.map +1 -1
- package/dist/esm/common/roomViewer/roomViewer.module.mjs.map +1 -1
- package/dist/esm/common/slider/slider.mjs +2 -0
- package/dist/esm/common/slider/slider.mjs.map +1 -0
- package/dist/esm/common/slider/slider.module.mjs +2 -0
- package/dist/esm/common/slider/slider.module.mjs.map +1 -0
- package/dist/esm/common/stepper/stepper.mjs +1 -1
- package/dist/esm/common/stepper/stepper.mjs.map +1 -1
- package/dist/esm/common/stepper/stepper.module.mjs +1 -1
- package/dist/esm/common/stepper/stepper.module.mjs.map +1 -1
- package/dist/esm/common/stepper/stepper.types.mjs.map +1 -1
- package/dist/esm/common/switch/switch.module.mjs.map +1 -1
- package/dist/esm/common/tabHeader/tabHeader.module.mjs.map +1 -1
- package/dist/esm/common/timeInput/components/clockDial/clockDial.module.mjs.map +1 -1
- package/dist/esm/common/timeInput/timeInput.module.mjs.map +1 -1
- package/dist/esm/common/toast/toast.mjs +1 -1
- package/dist/esm/common/toast/toast.mjs.map +1 -1
- package/dist/esm/common/toast/toast.module.mjs.map +1 -1
- package/dist/esm/common/virtualList/virtualList.module.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/package/common/animatedText/animatedText.d.ts +1 -1
- package/dist/types/package/common/animatedText/animatedText.types.d.ts +6 -0
- package/dist/types/package/common/hooks/useSwipeDismiss.d.ts +33 -0
- package/dist/types/package/common/slider/index.d.ts +2 -0
- package/dist/types/package/common/slider/slider.d.ts +3 -0
- package/dist/types/package/common/slider/slider.types.d.ts +43 -0
- package/dist/types/package/common/stepper/stepper.types.d.ts +5 -5
- package/dist/types/package/common/themeProvider/theme.types.d.ts +10 -0
- package/dist/types/package/index.d.ts +2 -0
- package/docs/AnimatedText.md +5 -0
- package/docs/CLAUDE.md +1 -0
- package/docs/ColorPicker.md +2 -0
- package/docs/FloatingMenu.md +2 -0
- package/docs/Slider.md +93 -0
- package/docs/Stepper.md +6 -6
- package/docs/Toast.md +2 -0
- package/package.json +1 -1
package/docs/FloatingMenu.md
CHANGED
|
@@ -49,3 +49,5 @@ import { FloatingMenu, Align } from '@ahrowe/ui';
|
|
|
49
49
|
| `dontCloseOnChildClick` | `boolean` | Prevent close when clicking inside content |
|
|
50
50
|
|
|
51
51
|
**Slots:** `root` `trigger` `menu` `menuContainer`
|
|
52
|
+
|
|
53
|
+
**Nested overlays in `content`:** a click anywhere inside `content` never closes the menu on its own — including inside a nested overlay that renders through its own portal (e.g. a `Dropdown` or another `FloatingMenu` used inside `content`), even though that overlay's DOM lives outside `content`'s own subtree. Closing on a selection is opt-in: have the handler that reacts to the selection call `onOpenChange(false)` (or your own state setter) explicitly, the way a calendar's day-selection handler would, while a nested month/year `Dropdown` inside the same menu is left alone.
|
package/docs/Slider.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Slider
|
|
2
|
+
|
|
3
|
+
**When to use:** Let the user pick a number from a continuous or stepped range by dragging a thumb: volume, brightness, price ranges, zoom, quality presets. For free numeric entry use `NumberInput`; for a few discrete options use `OptionPicker` or `RadioGroup`.
|
|
4
|
+
|
|
5
|
+
**Import:** `import { Slider } from '@ahrowe/ui'`
|
|
6
|
+
**Types:** `import type { SliderProps, SliderMark } from '@ahrowe/ui'`
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { useState } from 'react';
|
|
10
|
+
import { Slider } from '@ahrowe/ui';
|
|
11
|
+
|
|
12
|
+
// Controlled
|
|
13
|
+
const [value, setValue] = useState(40);
|
|
14
|
+
<Slider value={value} onChange={setValue} aria-label="Value" />
|
|
15
|
+
|
|
16
|
+
// Uncontrolled
|
|
17
|
+
<Slider defaultValue={40} onChangeEnd={(v) => save(v)} />
|
|
18
|
+
|
|
19
|
+
// Value bubble above the thumb
|
|
20
|
+
<Slider value={volume} onChange={setVolume} showValue />
|
|
21
|
+
|
|
22
|
+
// Custom range, step, and formatting
|
|
23
|
+
<Slider
|
|
24
|
+
value={price}
|
|
25
|
+
onChange={setPrice}
|
|
26
|
+
min={0}
|
|
27
|
+
max={1000}
|
|
28
|
+
step={50}
|
|
29
|
+
showValue
|
|
30
|
+
formatValue={(v) => `€${v}`}
|
|
31
|
+
/>
|
|
32
|
+
|
|
33
|
+
// Tick marks (labelled and unlabelled)
|
|
34
|
+
<Slider
|
|
35
|
+
value={quality}
|
|
36
|
+
onChange={setQuality}
|
|
37
|
+
min={0}
|
|
38
|
+
max={4}
|
|
39
|
+
step={1}
|
|
40
|
+
marks={[
|
|
41
|
+
{ value: 0, label: 'Low' },
|
|
42
|
+
{ value: 2, label: 'Medium' },
|
|
43
|
+
{ value: 4, label: 'High' },
|
|
44
|
+
]}
|
|
45
|
+
/>
|
|
46
|
+
|
|
47
|
+
// Larger thumb, themed colours (one-off)
|
|
48
|
+
<Slider
|
|
49
|
+
value={value}
|
|
50
|
+
onChange={setValue}
|
|
51
|
+
size="26px"
|
|
52
|
+
style={{
|
|
53
|
+
'--slider-range-color': 'var(--success-color)',
|
|
54
|
+
'--slider-thumb-color': 'var(--success-color)',
|
|
55
|
+
} as React.CSSProperties}
|
|
56
|
+
/>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Interaction:** drag the thumb or click anywhere on the track to jump there. With keyboard focus: `←`/`↓` and `→`/`↑` move by `step`, `Page Up`/`Page Down` by ten steps, `Home`/`End` jump to `min`/`max`. Values always snap to `step`.
|
|
60
|
+
|
|
61
|
+
**`onChange` vs `onChangeEnd`:** `onChange` fires on every change (each drag move and each key press); `onChangeEnd` fires once the value is committed, on pointer release or on each keyboard step. Use `onChangeEnd` to defer expensive work (a network save, a heavy re-render) until the user settles.
|
|
62
|
+
|
|
63
|
+
**Key props:**
|
|
64
|
+
|
|
65
|
+
| Prop | Type | Description |
|
|
66
|
+
|------|------|-------------|
|
|
67
|
+
| `value` | `number` | Controlled value (omit for uncontrolled) |
|
|
68
|
+
| `defaultValue` | `number` | Initial value when uncontrolled (default `min`) |
|
|
69
|
+
| `onChange` | `(value: number) => void` | Fires on every change |
|
|
70
|
+
| `onChangeEnd` | `(value: number) => void` | Fires once the value is committed |
|
|
71
|
+
| `min` | `number` | Minimum (default `0`) |
|
|
72
|
+
| `max` | `number` | Maximum (default `100`) |
|
|
73
|
+
| `step` | `number` | Snap increment (default `1`) |
|
|
74
|
+
| `disabled` | `boolean` | Disable interaction |
|
|
75
|
+
| `marks` | `SliderMark[]` | Tick marks, `{ value, label? }` |
|
|
76
|
+
| `showValue` | `boolean` | Show the current value in a bubble above the thumb |
|
|
77
|
+
| `formatValue` | `(value: number) => ReactNode` | Format the bubble text and `aria-valuetext` |
|
|
78
|
+
| `size` | `string` | Thumb diameter, any CSS length (default `'18px'`) |
|
|
79
|
+
| `aria-label` | `string` | Accessible label |
|
|
80
|
+
|
|
81
|
+
**Accessibility:** renders `role="slider"` with `aria-valuemin` / `aria-valuemax` / `aria-valuenow` (and `aria-valuetext` when `formatValue` returns a string/number). Give it an `aria-label` (or wire up your own visible label). Respects `prefers-reduced-motion` (no thumb/fill transition).
|
|
82
|
+
|
|
83
|
+
**Theming:** override these CSS variables theme-wide via `ThemeProvider` or per instance via `style`; each falls back to a built-in default:
|
|
84
|
+
|
|
85
|
+
| Variable | Falls back to |
|
|
86
|
+
|----------|---------------|
|
|
87
|
+
| `--slider-track-color` | `var(--background-accent-light)` |
|
|
88
|
+
| `--slider-range-color` | `var(--primary-color)` |
|
|
89
|
+
| `--slider-thumb-color` | `var(--primary-color)` |
|
|
90
|
+
| `--slider-thumb-size` | `18px` (also settable per instance via `size`) |
|
|
91
|
+
| `--slider-track-height` | `6px` |
|
|
92
|
+
|
|
93
|
+
**Slots:** `root` `track` `range` `thumb` `mark` `markLabel` `value`
|
package/docs/Stepper.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Stepper
|
|
2
2
|
|
|
3
|
-
**When to use:** Step progress indicator
|
|
3
|
+
**When to use:** Step progress indicator for multi-step forms, onboarding flows, and checkout wizards. Shows completed, current, and upcoming steps, and (vertically) can expand a collapsible body under the active step.
|
|
4
4
|
|
|
5
5
|
**Import:** `import { Stepper } from '@ahrowe/ui'`
|
|
6
6
|
**Types:** `import type { StepperStep, StepperProps } from '@ahrowe/ui'`
|
|
@@ -36,7 +36,7 @@ const steps = [
|
|
|
36
36
|
onStepClicked={(stepIndex) => setCurrentStep(stepIndex)}
|
|
37
37
|
/>
|
|
38
38
|
|
|
39
|
-
// Rich steps
|
|
39
|
+
// Rich steps: icon, description, error, optional
|
|
40
40
|
<Stepper
|
|
41
41
|
currentStep={2}
|
|
42
42
|
steps={[
|
|
@@ -46,7 +46,7 @@ const steps = [
|
|
|
46
46
|
]}
|
|
47
47
|
/>
|
|
48
48
|
|
|
49
|
-
// Vertical wizard with collapsible bodies
|
|
49
|
+
// Vertical wizard with collapsible bodies (only the active step's body is open)
|
|
50
50
|
<Stepper
|
|
51
51
|
alignment={StepperAlignment.Vertical}
|
|
52
52
|
collapse={StepperCollapse.ActiveOnly}
|
|
@@ -80,7 +80,7 @@ const steps = [
|
|
|
80
80
|
| `currentStep` | `number` | Zero-based active step index |
|
|
81
81
|
| `alignment` | `StepperAlignment \| 'horizontal' \| 'vertical'` | Layout direction (default `Horizontal`) |
|
|
82
82
|
| `styleType` | `StepperStyleType` | Marker/connector preset (default `Default`) |
|
|
83
|
-
| `collapse` | `StepperCollapse` | Which `content` bodies are expanded
|
|
83
|
+
| `collapse` | `StepperCollapse` | Which `content` bodies are expanded. Vertical only (default `None`) |
|
|
84
84
|
| `labelPlacement` | `StepperLabelPlacement` | Label position; default `Bottom` (horizontal) / `Right` (vertical). An out-of-orientation value falls back to that default |
|
|
85
85
|
| `onStepClicked` | `(stepIndex: number) => void` | Navigate on step click. Linear: only completed steps are clickable; with `nonLinear`, any enabled step except the current one |
|
|
86
86
|
| `nonLinear` | `boolean` | Allow clicking any step, not just completed ones |
|
|
@@ -88,7 +88,7 @@ const steps = [
|
|
|
88
88
|
|
|
89
89
|
**Collapse (vertical `content`):** `None` keeps every body open; `ActiveOnly` opens just the current step's body (classic vertical wizard); `Completed` collapses completed bodies while keeping the current and upcoming ones open. Bodies animate their height and respect `prefers-reduced-motion`. Horizontal steppers don't render inline `content` and ignore `collapse`.
|
|
90
90
|
|
|
91
|
-
**Theming:** these are theme variables (typed on `ThemeVariables`)
|
|
91
|
+
**Theming:** these are theme variables (typed on `ThemeVariables`). Set them theme-wide via `ThemeProvider`'s `variables`, or per instance via `style`, without fighting specificity. Each falls back to a built-in default when unset:
|
|
92
92
|
|
|
93
93
|
| Variable | Falls back to |
|
|
94
94
|
|----------|---------------|
|
|
@@ -105,7 +105,7 @@ const steps = [
|
|
|
105
105
|
| `--stepper-text-on-marker` | `var(--text-on-primary)` |
|
|
106
106
|
|
|
107
107
|
```tsx
|
|
108
|
-
// Theme-wide, via ThemeProvider
|
|
108
|
+
// Theme-wide, via ThemeProvider: circular pink markers, thicker connectors
|
|
109
109
|
const theme: Theme = {
|
|
110
110
|
id: 'brand',
|
|
111
111
|
variables: {
|
package/docs/Toast.md
CHANGED
|
@@ -65,6 +65,8 @@ showToast('Done', {
|
|
|
65
65
|
| `allowStacking` | `boolean` | `true` | Allow multiple toasts simultaneously |
|
|
66
66
|
| `pauseOnHover` | `boolean` | `true` | Pause the auto-dismiss timer while the toast is hovered or focused |
|
|
67
67
|
|
|
68
|
+
**Swipe to dismiss:** on touch devices, every toast can be dragged away to dismiss it, on top of the close button and auto-dismiss timer. A fast flick dismisses even without dragging far; dragging pauses the auto-dismiss timer for the duration of the gesture (regardless of `pauseOnHover`) and a vertical drag is left alone so it doesn't fight the page's own scrolling. It's gated to coarse (touch) pointers only — on mouse/trackpad devices the close button and auto-dismiss already cover it, and a drag there is more likely to be a text selection than an intentional dismiss.
|
|
69
|
+
|
|
68
70
|
**ToastPosition:** `'top-left'` `'top-center'` `'top-right'` `'bottom-left'` `'bottom-center'` `'bottom-right'`
|
|
69
71
|
|
|
70
72
|
**ToastType:** `'default'` `'info'` `'success'` `'error'` `'warn'`
|