@konce-pt/react 0.12.0 → 0.14.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 +122 -64
- package/dist/accordion/accordion.d.ts +14 -6
- package/dist/accordion/accordion.js +14 -7
- package/dist/accordion/llms.txt +22 -10
- package/dist/alert/alert.d.ts +2 -2
- package/dist/alert/alert.js +2 -2
- package/dist/alert/llms.txt +10 -10
- package/dist/app-shell/app-shell.d.ts +14 -14
- package/dist/app-shell/app-shell.js +11 -11
- package/dist/app-shell/llms.txt +13 -13
- package/dist/auth/auth-types.d.ts +6 -6
- package/dist/auth/auth.d.ts +2 -2
- package/dist/auth/auth.js +7 -7
- package/dist/auth/llms.txt +9 -9
- package/dist/autocomplete/autocomplete.d.ts +19 -6
- package/dist/autocomplete/autocomplete.js +23 -10
- package/dist/autocomplete/llms.txt +16 -5
- package/dist/avatar/avatar.d.ts +6 -6
- package/dist/avatar/avatar.js +5 -5
- package/dist/avatar/llms.txt +10 -10
- package/dist/avatar-group/avatar-group.d.ts +4 -4
- package/dist/avatar-group/avatar-group.js +3 -3
- package/dist/avatar-group/llms.txt +8 -8
- package/dist/backdrop/backdrop.d.ts +7 -7
- package/dist/backdrop/backdrop.js +16 -16
- package/dist/backdrop/llms.txt +27 -27
- package/dist/badge/badge.d.ts +3 -3
- package/dist/badge/badge.js +1 -1
- package/dist/badge/llms.txt +11 -11
- package/dist/bottom-sheet/bottom-sheet.d.ts +4 -4
- package/dist/bottom-sheet/bottom-sheet.js +2 -2
- package/dist/bottom-sheet/llms.txt +9 -9
- package/dist/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/breadcrumb/breadcrumb.js +3 -3
- package/dist/breadcrumb/llms.txt +3 -3
- package/dist/button/button.d.ts +3 -3
- package/dist/button/button.js +8 -8
- package/dist/button/llms.txt +27 -19
- package/dist/button-group/button-group.d.ts +9 -9
- package/dist/button-group/button-group.js +30 -8
- package/dist/button-group/llms.txt +20 -14
- package/dist/card/card.d.ts +8 -8
- package/dist/card/card.js +6 -6
- package/dist/card/llms.txt +20 -20
- package/dist/carousel/carousel.d.ts +6 -6
- package/dist/carousel/carousel.js +4 -4
- package/dist/carousel/llms.txt +10 -10
- package/dist/charts/chart-legend.d.ts +3 -3
- package/dist/charts/chart-legend.js +1 -1
- package/dist/charts/chart-tooltip.d.ts +3 -3
- package/dist/charts/chart-tooltip.js +1 -1
- package/dist/charts/chart.d.ts +1 -1
- package/dist/charts/chart.js +8 -8
- package/dist/charts/llms.txt +6 -6
- package/dist/charts-entry/public-api.js +2 -2
- package/dist/chat/chat.d.ts +17 -10
- package/dist/chat/chat.js +42 -18
- package/dist/chat/llms.txt +32 -17
- package/dist/chat-composer/chat-composer.d.ts +17 -7
- package/dist/chat-composer/chat-composer.js +21 -8
- package/dist/chat-composer/llms.txt +20 -11
- package/dist/chat-dock/chat-dock.d.ts +11 -4
- package/dist/chat-dock/chat-dock.js +9 -6
- package/dist/chat-dock/llms.txt +15 -14
- package/dist/chat-entry/public-api.js +1 -1
- package/dist/chat-message/chat-message.d.ts +12 -5
- package/dist/chat-message/chat-message.js +17 -7
- package/dist/chat-message/llms.txt +16 -15
- package/dist/chat-typing/chat-typing.d.ts +2 -2
- package/dist/chat-typing/chat-typing.js +3 -3
- package/dist/chat-typing/llms.txt +6 -6
- package/dist/checkbox/checkbox.d.ts +13 -6
- package/dist/checkbox/checkbox.js +26 -7
- package/dist/checkbox/llms.txt +24 -12
- package/dist/chip/chip.d.ts +4 -4
- package/dist/chip/chip.js +2 -2
- package/dist/chip/llms.txt +11 -11
- package/dist/chips-input/chips-input.d.ts +4 -4
- package/dist/chips-input/chips-input.js +35 -9
- package/dist/chips-input/llms.txt +15 -8
- package/dist/clock/clock.d.ts +4 -4
- package/dist/clock/clock.js +7 -7
- package/dist/clock/llms.txt +8 -8
- package/dist/color-picker/color-picker.d.ts +6 -6
- package/dist/color-picker/color-picker.js +3 -3
- package/dist/color-picker/llms.txt +5 -5
- package/dist/confirm/confirm-container.d.ts +3 -3
- package/dist/confirm/confirm-container.js +5 -5
- package/dist/confirm/confirm-store.d.ts +4 -4
- package/dist/confirm/confirm-store.js +7 -7
- package/dist/confirm/llms.txt +6 -6
- package/dist/context-menu/context-menu.d.ts +1 -1
- package/dist/context-menu/context-menu.js +5 -5
- package/dist/context-menu/llms.txt +7 -7
- package/dist/data-table/data-table-types.d.ts +5 -5
- package/dist/data-table/data-table.d.ts +29 -8
- package/dist/data-table/data-table.js +340 -95
- package/dist/data-table/export-csv.d.ts +3 -3
- package/dist/data-table/export-csv.js +4 -4
- package/dist/data-table/llms.txt +127 -94
- package/dist/data-view/data-view.d.ts +13 -5
- package/dist/data-view/data-view.js +67 -6
- package/dist/data-view/llms.txt +29 -10
- package/dist/date-range/date-range.d.ts +9 -9
- package/dist/date-range/date-range.js +24 -24
- package/dist/date-range/llms.txt +20 -20
- package/dist/datepicker/datepicker.d.ts +10 -10
- package/dist/datepicker/datepicker.js +29 -29
- package/dist/datepicker/llms.txt +24 -24
- package/dist/dialog/dialog.d.ts +4 -4
- package/dist/dialog/dialog.js +4 -4
- package/dist/dialog/llms.txt +11 -11
- package/dist/divider/divider.d.ts +1 -1
- package/dist/divider/llms.txt +4 -4
- package/dist/drawer/drawer.d.ts +5 -5
- package/dist/drawer/drawer.js +2 -2
- package/dist/drawer/llms.txt +11 -11
- package/dist/empty/empty.d.ts +2 -2
- package/dist/empty/empty.js +1 -1
- package/dist/empty/llms.txt +9 -9
- package/dist/fab/fab.d.ts +1 -1
- package/dist/fab/fab.js +1 -1
- package/dist/fab/llms.txt +10 -6
- package/dist/fieldset/fieldset.d.ts +18 -4
- package/dist/fieldset/fieldset.js +9 -6
- package/dist/fieldset/llms.txt +26 -9
- package/dist/file-upload/file-upload.d.ts +3 -3
- package/dist/file-upload/file-upload.js +7 -7
- package/dist/file-upload/llms.txt +7 -7
- package/dist/form-field/form-field-context.d.ts +4 -4
- package/dist/form-field/form-field.d.ts +12 -4
- package/dist/form-field/form-field.js +26 -6
- package/dist/form-field/llms.txt +25 -11
- package/dist/galleria/galleria.d.ts +3 -3
- package/dist/galleria/galleria.js +5 -5
- package/dist/galleria/llms.txt +7 -7
- package/dist/grid/col.d.ts +4 -4
- package/dist/grid/col.js +2 -2
- package/dist/grid/flex.d.ts +3 -3
- package/dist/grid/flex.js +1 -1
- package/dist/grid/grid.d.ts +7 -7
- package/dist/grid/grid.js +3 -3
- package/dist/grid/layout.d.ts +2 -2
- package/dist/grid/layout.js +2 -2
- package/dist/grid/llms.txt +15 -15
- package/dist/grid-entry/public-api.js +1 -1
- package/dist/i18n/i18n-context.d.ts +3 -3
- package/dist/i18n/i18n-context.js +7 -7
- package/dist/icon/icon-registry.d.ts +3 -3
- package/dist/icon/icon-registry.js +3 -3
- package/dist/icon/icon.d.ts +4 -4
- package/dist/icon/icon.js +6 -6
- package/dist/icon/llms.txt +13 -13
- package/dist/icon-button/icon-button.d.ts +2 -2
- package/dist/icon-button/icon-button.js +1 -1
- package/dist/icon-button/llms.txt +9 -5
- package/dist/icons-entry/public-api.d.ts +2 -2
- package/dist/icons-entry/public-api.js +3 -3
- package/dist/image/image.js +1 -1
- package/dist/image/llms.txt +13 -13
- package/dist/input/input.d.ts +18 -5
- package/dist/input/input.js +21 -6
- package/dist/input/llms.txt +25 -11
- package/dist/input-mask/input-mask.d.ts +1 -1
- package/dist/input-mask/input-mask.js +2 -2
- package/dist/input-mask/llms.txt +5 -5
- package/dist/input-number/input-number.d.ts +9 -9
- package/dist/input-number/input-number.js +11 -11
- package/dist/input-number/llms.txt +14 -14
- package/dist/input-otp/input-otp.d.ts +6 -6
- package/dist/input-otp/input-otp.js +10 -10
- package/dist/input-otp/llms.txt +9 -9
- package/dist/internal/calendar-focus.d.ts +1 -1
- package/dist/internal/calendar-focus.js +3 -3
- package/dist/internal/cn.d.ts +1 -1
- package/dist/internal/mask.d.ts +2 -2
- package/dist/internal/mask.js +4 -4
- package/dist/internal/option-key.d.ts +2 -2
- package/dist/internal/option-key.js +2 -2
- package/dist/internal/option-nav.d.ts +4 -4
- package/dist/internal/option-nav.js +5 -5
- package/dist/internal/overlay-container.js +1 -1
- package/dist/internal/overlay.d.ts +3 -3
- package/dist/internal/overlay.js +8 -8
- package/dist/internal/password-strength.d.ts +2 -2
- package/dist/internal/password-strength.js +6 -6
- package/dist/internal/roving.d.ts +2 -2
- package/dist/internal/roving.js +3 -3
- package/dist/internal/scroll-lock.d.ts +1 -1
- package/dist/internal/scroll-lock.js +2 -2
- package/dist/internal/slot-children.d.ts +3 -3
- package/dist/internal/slot-children.js +4 -4
- package/dist/internal/slot.d.ts +3 -3
- package/dist/internal/slot.js +2 -2
- package/dist/internal/step.d.ts +3 -3
- package/dist/internal/step.js +4 -4
- package/dist/internal/tween.d.ts +5 -5
- package/dist/internal/tween.js +5 -5
- package/dist/internal/types.d.ts +2 -2
- package/dist/internal/use-breakpoint.d.ts +2 -2
- package/dist/internal/use-breakpoint.js +4 -4
- package/dist/internal/use-controllable-state.d.ts +1 -1
- package/dist/internal/use-controllable-state.js +3 -3
- package/dist/internal/use-id.d.ts +2 -2
- package/dist/internal/use-id.js +2 -2
- package/dist/internal/use-modal-focus.d.ts +1 -1
- package/dist/internal/use-modal-focus.js +3 -3
- package/dist/knob/knob.d.ts +4 -4
- package/dist/knob/knob.js +14 -10
- package/dist/knob/llms.txt +17 -12
- package/dist/listbox/listbox.d.ts +6 -6
- package/dist/listbox/listbox.js +9 -9
- package/dist/listbox/llms.txt +10 -10
- package/dist/loader/llms.txt +56 -0
- package/dist/loader/loader.d.ts +49 -0
- package/dist/loader/loader.js +68 -0
- package/dist/map/llms.txt +25 -22
- package/dist/map/map-create-dialog.d.ts +4 -4
- package/dist/map/map-create-dialog.js +10 -10
- package/dist/map/map-hours-field.d.ts +4 -4
- package/dist/map/map-hours-field.js +7 -7
- package/dist/map/map-image-field.d.ts +2 -2
- package/dist/map/map-image-field.js +4 -4
- package/dist/map/map-legend.d.ts +4 -4
- package/dist/map/map-legend.js +2 -2
- package/dist/map/map-poi-card.d.ts +3 -3
- package/dist/map/map-poi-card.js +9 -9
- package/dist/map/map-search.d.ts +17 -6
- package/dist/map/map-search.js +21 -18
- package/dist/map/map.d.ts +21 -14
- package/dist/map/map.js +30 -29
- package/dist/map/ports.d.ts +9 -9
- package/dist/map/ports.js +6 -6
- package/dist/map-entry/public-api.js +2 -2
- package/dist/megamenu/llms.txt +9 -9
- package/dist/megamenu/megamenu.d.ts +6 -6
- package/dist/megamenu/megamenu.js +10 -10
- package/dist/mention/llms.txt +15 -15
- package/dist/mention/mention.d.ts +5 -5
- package/dist/mention/mention.js +2 -2
- package/dist/mention/mentions.d.ts +1 -1
- package/dist/mention/mentions.js +1 -1
- package/dist/menu/llms.txt +12 -12
- package/dist/menu/menu-item.d.ts +4 -4
- package/dist/menu/menu-keys.d.ts +2 -2
- package/dist/menu/menu-keys.js +5 -5
- package/dist/menu/menu.d.ts +2 -2
- package/dist/menu/menu.js +6 -6
- package/dist/menubar/llms.txt +10 -10
- package/dist/menubar/menubar.d.ts +5 -5
- package/dist/menubar/menubar.js +10 -10
- package/dist/meter-group/llms.txt +12 -12
- package/dist/meter-group/meter-group.d.ts +2 -2
- package/dist/meter-group/meter-group.js +1 -1
- package/dist/motion/motion-context.d.ts +22 -0
- package/dist/motion/motion-context.js +28 -0
- package/dist/order-list/llms.txt +22 -10
- package/dist/order-list/order-list.d.ts +12 -4
- package/dist/order-list/order-list.js +104 -21
- package/dist/paginator/llms.txt +8 -8
- package/dist/paginator/paginator.js +1 -1
- package/dist/panel/llms.txt +25 -13
- package/dist/panel/panel.d.ts +11 -3
- package/dist/panel/panel.js +7 -4
- package/dist/password/llms.txt +16 -8
- package/dist/password/password.d.ts +2 -2
- package/dist/password/password.js +24 -3
- package/dist/peek/llms.txt +10 -10
- package/dist/peek/peek.d.ts +6 -6
- package/dist/peek/peek.js +7 -7
- package/dist/pick-list/llms.txt +33 -13
- package/dist/pick-list/pick-list.d.ts +12 -4
- package/dist/pick-list/pick-list.js +111 -23
- package/dist/popover/llms.txt +11 -11
- package/dist/popover/popover.d.ts +4 -4
- package/dist/popover/popover.js +5 -5
- package/dist/progress/llms.txt +17 -17
- package/dist/progress/progress.d.ts +7 -7
- package/dist/progress/progress.js +6 -6
- package/dist/public-api.d.ts +15 -3
- package/dist/public-api.js +13 -7
- package/dist/radio-group/llms.txt +13 -6
- package/dist/radio-group/radio-group.d.ts +11 -4
- package/dist/radio-group/radio-group.js +15 -7
- package/dist/rating/llms.txt +20 -13
- package/dist/rating/rating-pointer.d.ts +16 -0
- package/dist/rating/rating-pointer.js +26 -0
- package/dist/rating/rating.d.ts +6 -6
- package/dist/rating/rating.js +76 -12
- package/dist/rich-text/lists.d.ts +2 -2
- package/dist/rich-text/lists.js +7 -7
- package/dist/rich-text/llms.txt +26 -17
- package/dist/rich-text/rich-text.d.ts +12 -7
- package/dist/rich-text/rich-text.js +78 -54
- package/dist/rich-text/sanitize.d.ts +3 -3
- package/dist/rich-text/sanitize.js +12 -12
- package/dist/rich-text/tables.d.ts +3 -3
- package/dist/rich-text/tables.js +3 -3
- package/dist/roadmap/llms.txt +15 -15
- package/dist/roadmap/roadmap.d.ts +6 -6
- package/dist/roadmap/roadmap.js +19 -19
- package/dist/roadmap-entry/public-api.js +2 -2
- package/dist/scroll-top/llms.txt +6 -6
- package/dist/scroll-top/scroll-top.d.ts +1 -1
- package/dist/scroll-top/scroll-top.js +1 -1
- package/dist/select/llms.txt +19 -12
- package/dist/select/select.d.ts +8 -8
- package/dist/select/select.js +47 -21
- package/dist/shared/types.d.ts +5 -5
- package/dist/shared/types.js +1 -1
- package/dist/sidenav/llms.txt +9 -9
- package/dist/sidenav/sidenav.d.ts +1 -1
- package/dist/sidenav/sidenav.js +1 -1
- package/dist/skeleton/llms.txt +3 -3
- package/dist/skeleton/skeleton.d.ts +1 -1
- package/dist/skeleton/skeleton.js +1 -1
- package/dist/slider/llms.txt +32 -13
- package/dist/slider/slider-drag.d.ts +26 -0
- package/dist/slider/slider-drag.js +79 -0
- package/dist/slider/slider.d.ts +6 -5
- package/dist/slider/slider.js +27 -8
- package/dist/speech/llms.txt +97 -0
- package/dist/speech/speech-button.d.ts +44 -0
- package/dist/speech/speech-button.js +86 -0
- package/dist/speech/speech-wave.d.ts +19 -0
- package/dist/speech/speech-wave.js +16 -0
- package/dist/speech/use-speech-recognition.d.ts +81 -0
- package/dist/speech/use-speech-recognition.js +179 -0
- package/dist/speed-dial/llms.txt +14 -8
- package/dist/speed-dial/speed-dial.d.ts +1 -1
- package/dist/speed-dial/speed-dial.js +1 -1
- package/dist/spinner/llms.txt +7 -7
- package/dist/spinner/spinner.d.ts +1 -1
- package/dist/spinner/spinner.js +1 -1
- package/dist/split-button/llms.txt +21 -15
- package/dist/split-button/split-button.d.ts +2 -2
- package/dist/split-button/split-button.js +4 -4
- package/dist/splitter/llms.txt +11 -11
- package/dist/splitter/splitter.d.ts +3 -3
- package/dist/splitter/splitter.js +5 -5
- package/dist/stepper/llms.txt +33 -14
- package/dist/stepper/stepper.d.ts +6 -6
- package/dist/stepper/stepper.js +53 -10
- package/dist/switch/llms.txt +12 -5
- package/dist/switch/switch.d.ts +10 -3
- package/dist/switch/switch.js +12 -5
- package/dist/switch-group/llms.txt +9 -9
- package/dist/switch-group/switch-group.d.ts +4 -4
- package/dist/switch-group/switch-group.js +4 -4
- package/dist/tabs/llms.txt +10 -10
- package/dist/tabs/tabs.d.ts +5 -5
- package/dist/tabs/tabs.js +8 -8
- package/dist/textarea/llms.txt +23 -12
- package/dist/textarea/textarea.d.ts +19 -6
- package/dist/textarea/textarea.js +21 -7
- package/dist/timeline/llms.txt +4 -4
- package/dist/timeline/timeline.d.ts +1 -1
- package/dist/timeline/timeline.js +1 -1
- package/dist/toast/llms.txt +47 -17
- package/dist/toast/toast-container.d.ts +9 -3
- package/dist/toast/toast-container.js +17 -9
- package/dist/toast/toast-store.d.ts +40 -4
- package/dist/toast/toast-store.js +36 -1
- package/dist/toolbar/llms.txt +7 -7
- package/dist/toolbar/toolbar.d.ts +3 -3
- package/dist/toolbar/toolbar.js +2 -2
- package/dist/tooltip/llms.txt +10 -10
- package/dist/tooltip/tooltip.d.ts +3 -3
- package/dist/tooltip/tooltip.js +18 -18
- package/dist/tree/llms.txt +25 -12
- package/dist/tree/tree-keys.d.ts +5 -5
- package/dist/tree/tree-keys.js +7 -7
- package/dist/tree/tree.d.ts +14 -7
- package/dist/tree/tree.js +53 -18
- package/dist/update/llms.txt +54 -0
- package/dist/update/update.d.ts +49 -0
- package/dist/update/update.js +82 -0
- package/package.json +15 -13
package/dist/speed-dial/llms.txt
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
# KptSpeedDial (@konce-pt/react)
|
|
2
2
|
|
|
3
|
-
A speed dial
|
|
3
|
+
A speed dial - a FAB that fans out a set of actions. Built on `KptFab`.
|
|
4
4
|
Import: `import { KptSpeedDial } from '@konce-pt/react';`
|
|
5
5
|
|
|
6
6
|
## DOM
|
|
7
7
|
<div class="kpt-speed-dial-host">
|
|
8
8
|
<div class="kpt-speed-dial is-open" data-direction="up">
|
|
9
9
|
<div class="kpt-speed-dial__actions">
|
|
10
|
-
<button class="kpt-speed-dial__action" aria-label="Upload file"
|
|
10
|
+
<button class="kpt-speed-dial__action" aria-label="Upload file">...</button>...
|
|
11
11
|
</div>
|
|
12
|
-
<span class="kpt-fab-host"><button class="kpt-fab"
|
|
12
|
+
<span class="kpt-fab-host"><button class="kpt-fab">...</button></span>
|
|
13
13
|
</div>
|
|
14
14
|
<div class="kpt-speed-dial__backdrop"></div>
|
|
15
15
|
</div>
|
|
16
16
|
|
|
17
17
|
## Props
|
|
18
|
-
- `items`: `KptMenuItem<T>[]`
|
|
18
|
+
- `items`: `KptMenuItem<T>[]` - the actions (`label`, `icon`, `disabled`)
|
|
19
19
|
- `direction`: `'up'` (default) | `'down'` | `'left'` | `'right'`
|
|
20
|
-
- `icon`: string (default `'plus'`)
|
|
21
|
-
- `ariaLabel`: string
|
|
22
|
-
- `onSelect(item)`
|
|
20
|
+
- `icon`: string (default `'plus'`) - the SCSS rotates it 45° when open
|
|
21
|
+
- `ariaLabel`: string - the closed-state label; without it `speedDial.actions`
|
|
22
|
+
- `onSelect(item)` - fired on pick; a disabled item fires nothing
|
|
23
23
|
- `className`, `ref` and every other `<div>` prop go to the host
|
|
24
24
|
|
|
25
25
|
## The label follows the state
|
|
@@ -37,6 +37,12 @@ present would swallow clicks meant for the page underneath.
|
|
|
37
37
|
## i18n
|
|
38
38
|
`speedDial.actions` and `common.close`; `locale` and `dictionary` override them per instance.
|
|
39
39
|
|
|
40
|
+
## Motion
|
|
41
|
+
The actions fan out from the button in a cascade - the nearest first, on a spring, from the side of the
|
|
42
|
+
button - and fold back in reverse order; the trigger icon turns on a spring. The container hides
|
|
43
|
+
(`visibility`) only after the last action, so the closing cascade is not cut off. Pressed, it squeezes slightly and springs back on release (shared mixin `styles/_press.scss`). Pure CSS; durations follow `--kpt-motion-scale`, so `enabled: false` turns it off, and it drops out
|
|
44
|
+
under "reduce motion".
|
|
45
|
+
|
|
40
46
|
## Tokens
|
|
41
47
|
The main button comes from `KptFab`; the actions use `--kpt-color-surface-raised` and
|
|
42
48
|
`--kpt-elevation-2`.
|
|
@@ -44,7 +50,7 @@ The main button comes from `KptFab`; the actions use `--kpt-color-surface-raised
|
|
|
44
50
|
## Accessibility
|
|
45
51
|
- The main button carries `aria-expanded` and `aria-controls` pointing at the actions container.
|
|
46
52
|
- Closed actions are `visibility: hidden` (switched after the fade-out), so they are out of the Tab
|
|
47
|
-
order and the accessibility tree
|
|
53
|
+
order and the accessibility tree - not just transparent.
|
|
48
54
|
- `Escape` anywhere in the dial closes it and returns focus to the main button.
|
|
49
55
|
- Every action is a `<button>` labelled with its own `label`, so the fan works from the keyboard even
|
|
50
56
|
when the actions show icons only.
|
|
@@ -12,7 +12,7 @@ export interface KptSpeedDialProps<T> extends Omit<ComponentPropsWithRef<'div'>,
|
|
|
12
12
|
onSelect?: (item: KptMenuItem<T>) => void;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* Speed dial
|
|
15
|
+
* Speed dial - FAB rozwijający zestaw akcji wachlarzem. Buduje na `KptFab`.
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
18
|
* <KptSpeedDial items={actions} direction="up" onSelect={onAction} />
|
|
@@ -7,7 +7,7 @@ import { useKptMessages } from "../i18n/i18n-context.js";
|
|
|
7
7
|
import { KptFab } from "../fab/fab.js";
|
|
8
8
|
import { KptIcon } from "../icon/icon.js";
|
|
9
9
|
/**
|
|
10
|
-
* Speed dial
|
|
10
|
+
* Speed dial - FAB rozwijający zestaw akcji wachlarzem. Buduje na `KptFab`.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* <KptSpeedDial items={actions} direction="up" onSelect={onAction} />
|
package/dist/spinner/llms.txt
CHANGED
|
@@ -9,13 +9,13 @@ A loading indicator. Import: `import { KptSpinner } from '@konce-pt/react';`
|
|
|
9
9
|
</span>
|
|
10
10
|
|
|
11
11
|
## Props
|
|
12
|
-
- `size`: string (default '1.5rem')
|
|
13
|
-
- `label`: string
|
|
14
|
-
- `locale`, `dictionary`
|
|
12
|
+
- `size`: string (default '1.5rem') - a CSS length, applied to width and height
|
|
13
|
+
- `label`: string - the accessibility label; omitted falls back to `spinner.label`
|
|
14
|
+
- `locale`, `dictionary` - i18n overrides for this component only
|
|
15
15
|
- `className`, `ref` and every other `<span>` prop go to the host
|
|
16
16
|
|
|
17
17
|
## The colour is inherited
|
|
18
|
-
The host sets `color: var(--kpt-color-primary)`, and the ring is drawn in `currentColor`
|
|
18
|
+
The host sets `color: var(--kpt-color-primary)`, and the ring is drawn in `currentColor` - so the
|
|
19
19
|
spinner is primary by default, and anything that sets `color` on the host changes it. Pass
|
|
20
20
|
`style={{ color: 'inherit' }}` (or a class) to take the colour of the text around it, e.g. inside a
|
|
21
21
|
filled chip. There is no colour prop, on purpose.
|
|
@@ -23,15 +23,15 @@ filled chip. There is no colour prop, on purpose.
|
|
|
23
23
|
## Examples
|
|
24
24
|
<KptSpinner />
|
|
25
25
|
<KptSpinner size="2rem" label="Loading data" />
|
|
26
|
-
<KptButton disabled><KptSpinner size="1em" /> Saving
|
|
26
|
+
<KptButton disabled><KptSpinner size="1em" /> Saving...</KptButton>
|
|
27
27
|
|
|
28
28
|
## Tokens
|
|
29
|
-
None of its own
|
|
29
|
+
None of its own - the colour is `--kpt-color-primary` on the host (drawn in `currentColor`), the
|
|
30
30
|
size comes from the prop, the ring width is 8% of the size (at least 2px), the speed from
|
|
31
31
|
`--kpt-motion-duration-*`.
|
|
32
32
|
|
|
33
33
|
## Accessibility
|
|
34
34
|
The ring is `aria-hidden`; next to it sits a visually hidden `.kpt-spinner__label` with
|
|
35
|
-
`role="status"`. Its text
|
|
35
|
+
`role="status"`. Its text - `label`, or `spinner.label` - is written a frame after the spinner
|
|
36
36
|
appears, because a status region that is born already filled in is skipped by most screen readers.
|
|
37
37
|
Under `prefers-reduced-motion` the rotation slows down instead of stopping.
|
|
@@ -10,7 +10,7 @@ export interface KptSpinnerProps extends Omit<ComponentPropsWithRef<'span'>, 'ch
|
|
|
10
10
|
*
|
|
11
11
|
* Pierścień jest dekoracją (`aria-hidden`); dla czytnika jest osobny, wizualnie ukryty region
|
|
12
12
|
* `role="status"` z etykietą. Tekst trafia do regionu klatkę po pojawieniu się spinnera: region,
|
|
13
|
-
* który powstaje od razu z treścią, większość czytników przemilcza
|
|
13
|
+
* który powstaje od razu z treścią, większość czytników przemilcza - ogłaszają dopiero zmianę.
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
16
|
* <KptSpinner />
|
package/dist/spinner/spinner.js
CHANGED
|
@@ -8,7 +8,7 @@ import { useKptMessages } from "../i18n/i18n-context.js";
|
|
|
8
8
|
*
|
|
9
9
|
* Pierścień jest dekoracją (`aria-hidden`); dla czytnika jest osobny, wizualnie ukryty region
|
|
10
10
|
* `role="status"` z etykietą. Tekst trafia do regionu klatkę po pojawieniu się spinnera: region,
|
|
11
|
-
* który powstaje od razu z treścią, większość czytników przemilcza
|
|
11
|
+
* który powstaje od razu z treścią, większość czytników przemilcza - ogłaszają dopiero zmianę.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* <KptSpinner />
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
# KptSplitButton (@konce-pt/react)
|
|
2
2
|
|
|
3
|
-
A split button
|
|
3
|
+
A split button - a primary action plus a dropdown of further actions.
|
|
4
4
|
Import: `import { KptSplitButton } from '@konce-pt/react';`
|
|
5
5
|
|
|
6
6
|
## DOM
|
|
7
7
|
<span class="kpt-split-button-host">
|
|
8
8
|
<div class="kpt-split-button" data-variant="filled">
|
|
9
9
|
<button class="kpt-split-button__main" type="button">Save</button>
|
|
10
|
-
<button class="kpt-split-button__toggle" type="button" aria-label="More actions"
|
|
10
|
+
<button class="kpt-split-button__toggle" type="button" aria-label="More actions">...chevron...</button>
|
|
11
11
|
</div>
|
|
12
12
|
</span>
|
|
13
13
|
<!-- while open, in a portal: -->
|
|
14
|
-
<div class="kpt-split-button__panel" role="menu"
|
|
14
|
+
<div class="kpt-split-button__panel" role="menu">...rows...</div>
|
|
15
15
|
|
|
16
16
|
## Props
|
|
17
|
-
- `variant`: `KptSplitButtonVariant` = 'filled' | 'tonal' | 'outline' | 'text' (default 'filled')
|
|
17
|
+
- `variant`: `KptSplitButtonVariant` = 'filled' | 'tonal' | 'outline' | 'text' (default 'filled') -
|
|
18
18
|
the subset of `KptButtonVariant` that has a style; `outline` and `text` use the `--kpt-button-outline-*`
|
|
19
19
|
and `--kpt-button-text-*` tokens, so they match `kpt-button` in the same row
|
|
20
|
-
- `items`: `KptMenuItem<T>[]`
|
|
21
|
-
- `disabled`: boolean
|
|
22
|
-
- `onPrimaryClick()`
|
|
23
|
-
- `onSelect(item)`
|
|
24
|
-
- `open` / `defaultOpen` / `onOpenChange`
|
|
25
|
-
- `children`
|
|
26
|
-
- `locale`, `dictionary`
|
|
20
|
+
- `items`: `KptMenuItem<T>[]` - the same shape as `KptMenu`
|
|
21
|
+
- `disabled`: boolean - disables both buttons
|
|
22
|
+
- `onPrimaryClick()` - the main action
|
|
23
|
+
- `onSelect(item)` - a pick from the menu
|
|
24
|
+
- `open` / `defaultOpen` / `onOpenChange` - the panel state
|
|
25
|
+
- `children` - the content of the main action
|
|
26
|
+
- `locale`, `dictionary` - i18n overrides for this component only
|
|
27
27
|
|
|
28
28
|
## The panel aligns to the right
|
|
29
29
|
The toggle sits on the right-hand side of the control, so the panel is anchored by its RIGHT edge
|
|
30
30
|
(`align="end"` on the overlay). Anchored to the left it would hang off the control instead of under
|
|
31
|
-
it
|
|
31
|
+
it - the same reasoning the Angular port encodes in its CDK position list.
|
|
32
32
|
|
|
33
33
|
## Shared rows
|
|
34
|
-
The panel renders the same rows as `KptMenu`
|
|
34
|
+
The panel renders the same rows as `KptMenu` - icons, descriptions, badges, separators, headers and
|
|
35
35
|
the `danger` modifier all behave identically, only the BEM block differs.
|
|
36
36
|
|
|
37
37
|
## i18n
|
|
@@ -39,9 +39,9 @@ The toggle's label comes from `splitButton.more` in the dictionary.
|
|
|
39
39
|
|
|
40
40
|
## Keyboard
|
|
41
41
|
The toggle is a menu button: `aria-haspopup="menu"`, a live `aria-expanded`, `aria-controls` while
|
|
42
|
-
open.
|
|
42
|
+
open. `ArrowDown` / `ArrowUp` on it open the menu on the first / last item; inside, `ArrowDown` / `ArrowUp` wrap, `Home` / `End`
|
|
43
43
|
jump, `Escape` / `Tab` close, and closing or picking returns focus to the toggle. Same rules as the
|
|
44
|
-
menu
|
|
44
|
+
menu - see the `KptMenu` docs.
|
|
45
45
|
|
|
46
46
|
## Examples
|
|
47
47
|
<KptSplitButton items={items} onPrimaryClick={save} onSelect={onItem}>Save</KptSplitButton>
|
|
@@ -53,6 +53,12 @@ menu — see the `KptMenu` docs.
|
|
|
53
53
|
{ label: 'Discard', value: 'discard', danger: true },
|
|
54
54
|
];
|
|
55
55
|
|
|
56
|
+
## Motion
|
|
57
|
+
Pressing either part squeezes the whole pill (one part alone would come apart from the other inside
|
|
58
|
+
the clipped container); the arrow turns over when the menu opens and the menu slides out from under the
|
|
59
|
+
button. Pure CSS; durations follow `--kpt-motion-scale`, so `enabled: false` turns it off, and it drops out
|
|
60
|
+
under "reduce motion".
|
|
61
|
+
|
|
56
62
|
## Tokens
|
|
57
63
|
The `--kpt-button-*` tokens of the chosen variant, plus `--kpt-color-surface-raised` and
|
|
58
64
|
`--kpt-elevation-3` for the panel.
|
|
@@ -2,7 +2,7 @@ import { type ComponentPropsWithRef, type ReactNode } from 'react';
|
|
|
2
2
|
import { type KptI18nOverrides } from '../i18n/i18n-context.tsx';
|
|
3
3
|
import type { KptMenuItem } from '../menu/menu-item.ts';
|
|
4
4
|
import type { KptButtonVariant } from '../button/button.tsx';
|
|
5
|
-
/** Warianty, które mają styl
|
|
5
|
+
/** Warianty, które mają styl - podzbiór `KptButtonVariant`. */
|
|
6
6
|
export type KptSplitButtonVariant = Extract<KptButtonVariant, 'filled' | 'tonal' | 'outline' | 'text'>;
|
|
7
7
|
export interface KptSplitButtonProps<T> extends Omit<ComponentPropsWithRef<'span'>, 'onSelect'>, KptI18nOverrides {
|
|
8
8
|
variant?: KptSplitButtonVariant;
|
|
@@ -19,7 +19,7 @@ export interface KptSplitButtonProps<T> extends Omit<ComponentPropsWithRef<'span
|
|
|
19
19
|
children?: ReactNode;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* Przycisk dzielony
|
|
22
|
+
* Przycisk dzielony - akcja główna plus rozwijane menu dodatkowych akcji.
|
|
23
23
|
*
|
|
24
24
|
* Panel wyrównuje się do PRAWEJ krawędzi przycisku, nie do lewej: rozwijacz siedzi po prawej
|
|
25
25
|
* stronie kontrolki, więc menu otwierające się w lewo nie wychodzi poza nią.
|
|
@@ -10,7 +10,7 @@ import { KptIcon } from "../icon/icon.js";
|
|
|
10
10
|
import { MenuRows } from "../menu/menu-rows.js";
|
|
11
11
|
import { focusMenuEdge, handleMenuKeydown } from "../menu/menu-keys.js";
|
|
12
12
|
/**
|
|
13
|
-
* Przycisk dzielony
|
|
13
|
+
* Przycisk dzielony - akcja główna plus rozwijane menu dodatkowych akcji.
|
|
14
14
|
*
|
|
15
15
|
* Panel wyrównuje się do PRAWEJ krawędzi przycisku, nie do lewej: rozwijacz siedzi po prawej
|
|
16
16
|
* stronie kontrolki, więc menu otwierające się w lewo nie wychodzi poza nią.
|
|
@@ -21,14 +21,14 @@ import { focusMenuEdge, handleMenuKeydown } from "../menu/menu-keys.js";
|
|
|
21
21
|
export function KptSplitButton({ variant = 'filled', items = [], disabled = false, onPrimaryClick, onSelect, open, defaultOpen = false, onOpenChange, locale, dictionary, className, children, ...rest }) {
|
|
22
22
|
const { t } = useKptMessages({ locale, dictionary });
|
|
23
23
|
const toggleRef = useRef(null);
|
|
24
|
-
/** Kotwica panelu
|
|
24
|
+
/** Kotwica panelu - w stanie, bo czyta ją render; ref zostaje dla przywracania fokusu. */
|
|
25
25
|
const [toggleEl, setToggleEl] = useState(null);
|
|
26
26
|
const setToggle = useCallback((element) => {
|
|
27
27
|
toggleRef.current = element;
|
|
28
28
|
setToggleEl(element);
|
|
29
29
|
}, []);
|
|
30
30
|
const panelRef = useRef(null);
|
|
31
|
-
/** Którą pozycję skupić po otwarciu
|
|
31
|
+
/** Którą pozycję skupić po otwarciu - strzałka w górę na przycisku otwiera "od końca". */
|
|
32
32
|
const focusEdge = useRef('first');
|
|
33
33
|
const panelId = useKptId(undefined, 'kpt-split-button-menu');
|
|
34
34
|
const [isOpen, setOpen] = useControllableState({
|
|
@@ -48,7 +48,7 @@ export function KptSplitButton({ variant = 'filled', items = [], disabled = fals
|
|
|
48
48
|
});
|
|
49
49
|
return () => cancelAnimationFrame(frame);
|
|
50
50
|
}, [isOpen]);
|
|
51
|
-
/** Fokus wraca na strzałkę
|
|
51
|
+
/** Fokus wraca na strzałkę - inaczej po zniknięciu panelu spadłby na `<body>`. */
|
|
52
52
|
const closeAndRestoreFocus = () => {
|
|
53
53
|
close();
|
|
54
54
|
toggleRef.current?.focus();
|
package/dist/splitter/llms.txt
CHANGED
|
@@ -6,22 +6,22 @@ Import: `import { KptSplitter } from '@konce-pt/react';`
|
|
|
6
6
|
## DOM
|
|
7
7
|
<div class="kpt-splitter-host">
|
|
8
8
|
<div class="kpt-splitter" data-orientation="horizontal">
|
|
9
|
-
<div class="kpt-splitter__pane" id="kpt-splitter-start-r1" style="flex-basis:40%"
|
|
9
|
+
<div class="kpt-splitter__pane" id="kpt-splitter-start-r1" style="flex-basis:40%">...</div>
|
|
10
10
|
<div class="kpt-splitter__gutter" role="separator" tabindex="0" aria-orientation="vertical"
|
|
11
11
|
aria-valuenow="40" aria-valuemin="10" aria-valuemax="90"
|
|
12
12
|
aria-controls="kpt-splitter-start-r1" aria-label="Resize panes"></div>
|
|
13
|
-
<div class="kpt-splitter__pane" style="flex-basis:60%"
|
|
13
|
+
<div class="kpt-splitter__pane" style="flex-basis:60%">...</div>
|
|
14
14
|
</div>
|
|
15
15
|
</div>
|
|
16
16
|
|
|
17
17
|
## Props
|
|
18
18
|
- `orientation`: `'horizontal'` (default) | `'vertical'`
|
|
19
|
-
- `startSize` / `defaultStartSize` / `onStartSizeChange`
|
|
20
|
-
- `minSize`: number (percent, default 10)
|
|
21
|
-
- `ariaLabel`: string
|
|
22
|
-
- `ariaLabel`: string
|
|
23
|
-
- `ariaLabel`: string
|
|
24
|
-
- `ariaLabel`: string
|
|
19
|
+
- `startSize` / `defaultStartSize` / `onStartSizeChange` - the first pane's size in percent
|
|
20
|
+
- `minSize`: number (percent, default 10) - neither pane goes below it
|
|
21
|
+
- `ariaLabel`: string - the handle's name; empty = `splitter.resize` from the dictionary
|
|
22
|
+
- `ariaLabel`: string - the handle's name; empty = `splitter.resize` from the dictionary
|
|
23
|
+
- `ariaLabel`: string - the handle's name; empty = `splitter.resize` from the dictionary
|
|
24
|
+
- `ariaLabel`: string - the handle's name; empty = `splitter.resize` from the dictionary
|
|
25
25
|
- `className`, `ref` and every other `<div>` prop go to the host
|
|
26
26
|
|
|
27
27
|
## Panes
|
|
@@ -39,16 +39,16 @@ pointer outruns a 6px strip, and a handle-bound listener would drop the drag aft
|
|
|
39
39
|
<KptSplitter.End>Right</KptSplitter.End>
|
|
40
40
|
</KptSplitter>
|
|
41
41
|
|
|
42
|
-
<KptSplitter orientation="vertical" defaultStartSize={30} minSize={20}
|
|
42
|
+
<KptSplitter orientation="vertical" defaultStartSize={30} minSize={20}>...</KptSplitter>
|
|
43
43
|
|
|
44
44
|
## Tokens
|
|
45
|
-
The handle `--kpt-color-border`
|
|
45
|
+
The handle `--kpt-color-border` -> `--kpt-color-primary` on hover and focus; the frame
|
|
46
46
|
`--kpt-color-border` with `--kpt-radius-md`.
|
|
47
47
|
|
|
48
48
|
## Accessibility
|
|
49
49
|
The handle is a focusable `role="separator"` (the WAI-ARIA window splitter): `aria-valuenow`,
|
|
50
50
|
`aria-valuemin`/`aria-valuemax` (from `minSize`), `aria-controls` pointing at the first pane, and a
|
|
51
51
|
name from `ariaLabel` or `splitter.resize` in the dictionary. Arrow keys resize by 2%, `Home`/`End`
|
|
52
|
-
jump to the minimum/maximum. `aria-orientation` describes the handle's line, not the layout
|
|
52
|
+
jump to the minimum/maximum. `aria-orientation` describes the handle's line, not the layout -
|
|
53
53
|
side-by-side panes have a vertical handle. The host takes `height: 100%`, so a height set on the
|
|
54
54
|
parent reaches the panes.
|
|
@@ -15,7 +15,7 @@ export declare namespace KptSplitterEnd {
|
|
|
15
15
|
}
|
|
16
16
|
export interface KptSplitterProps extends Omit<ComponentPropsWithRef<'div'>, 'onChange'>, KptI18nOverrides {
|
|
17
17
|
orientation?: KptSplitterOrientation;
|
|
18
|
-
/** Rozmiar pierwszego panelu w procentach (0
|
|
18
|
+
/** Rozmiar pierwszego panelu w procentach (0-100). */
|
|
19
19
|
startSize?: number;
|
|
20
20
|
defaultStartSize?: number;
|
|
21
21
|
onStartSizeChange?: (size: number) => void;
|
|
@@ -29,9 +29,9 @@ export interface KptSplitterProps extends Omit<ComponentPropsWithRef<'div'>, 'on
|
|
|
29
29
|
* Dwa panele z przeciąganym uchwytem. `horizontal` stawia je obok siebie, `vertical` jeden pod
|
|
30
30
|
* drugim.
|
|
31
31
|
*
|
|
32
|
-
* Uchwyt to `role="separator"` z wartością (wzorzec WAI-ARIA
|
|
32
|
+
* Uchwyt to `role="separator"` z wartością (wzorzec WAI-ARIA "window splitter"): strzałki
|
|
33
33
|
* przesuwają go o 2%, `Home`/`End` dosuwają do minimum i maksimum. `aria-orientation` opisuje
|
|
34
|
-
* linię uchwytu, nie układ
|
|
34
|
+
* linię uchwytu, nie układ - przy panelach obok siebie linia jest pionowa.
|
|
35
35
|
*
|
|
36
36
|
* @example
|
|
37
37
|
* <KptSplitter startSize={size} onStartSizeChange={setSize}>
|
|
@@ -21,9 +21,9 @@ KptSplitterEnd.kptSplitterSlot = 'end';
|
|
|
21
21
|
* Dwa panele z przeciąganym uchwytem. `horizontal` stawia je obok siebie, `vertical` jeden pod
|
|
22
22
|
* drugim.
|
|
23
23
|
*
|
|
24
|
-
* Uchwyt to `role="separator"` z wartością (wzorzec WAI-ARIA
|
|
24
|
+
* Uchwyt to `role="separator"` z wartością (wzorzec WAI-ARIA "window splitter"): strzałki
|
|
25
25
|
* przesuwają go o 2%, `Home`/`End` dosuwają do minimum i maksimum. `aria-orientation` opisuje
|
|
26
|
-
* linię uchwytu, nie układ
|
|
26
|
+
* linię uchwytu, nie układ - przy panelach obok siebie linia jest pionowa.
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
29
29
|
* <KptSplitter startSize={size} onStartSizeChange={setSize}>
|
|
@@ -62,7 +62,7 @@ export function KptSplitter({ orientation = 'horizontal', startSize, defaultStar
|
|
|
62
62
|
return;
|
|
63
63
|
// Nasłuch na oknie, nie na uchwycie: przy szybkim ruchu kursor wyprzedza wąski pasek
|
|
64
64
|
// i bez tego przeciąganie urywałoby się po kilku pikselach.
|
|
65
|
-
// W RTL panel
|
|
65
|
+
// W RTL panel "start" stoi po prawej (flex idzie za kierunkiem pisma), więc mierzymy od prawej.
|
|
66
66
|
const rtl = getComputedStyle(container).direction === 'rtl';
|
|
67
67
|
const move = (e) => {
|
|
68
68
|
const rect = container.getBoundingClientRect();
|
|
@@ -70,7 +70,7 @@ export function KptSplitter({ orientation = 'horizontal', startSize, defaultStar
|
|
|
70
70
|
? ((rtl ? rect.right - e.clientX : e.clientX - rect.left) / rect.width) * 100
|
|
71
71
|
: ((e.clientY - rect.top) / rect.height) * 100));
|
|
72
72
|
};
|
|
73
|
-
// `pointercancel`: dotyk przerwany przez system nie wysyła `pointerup`
|
|
73
|
+
// `pointercancel`: dotyk przerwany przez system nie wysyła `pointerup` - bez sprzątania
|
|
74
74
|
// `pointermove` dalej przesuwałby uchwyt.
|
|
75
75
|
const up = () => {
|
|
76
76
|
window.removeEventListener('pointermove', move);
|
|
@@ -95,7 +95,7 @@ export function KptSplitter({ orientation = 'horizontal', startSize, defaultStar
|
|
|
95
95
|
if (!dir)
|
|
96
96
|
return;
|
|
97
97
|
event.preventDefault();
|
|
98
|
-
// W RTL
|
|
98
|
+
// W RTL <- przesuwa uchwyt w lewo, czyli powiększa prawy panel "start" - odwrotnie niż w LTR.
|
|
99
99
|
const horizontal = event.key === 'ArrowLeft' || event.key === 'ArrowRight';
|
|
100
100
|
const rtl = horizontal && getComputedStyle(event.currentTarget).direction === 'rtl';
|
|
101
101
|
setSize(clamp(size + (rtl ? -dir : dir)));
|
package/dist/stepper/llms.txt
CHANGED
|
@@ -1,38 +1,42 @@
|
|
|
1
1
|
# KptStepper + KptStep (@konce-pt/react)
|
|
2
2
|
|
|
3
|
-
A step wizard
|
|
3
|
+
A step wizard - a header of numbered steps plus the active step's content.
|
|
4
4
|
Import: `import { KptStepper, useKptStepper } from '@konce-pt/react';`
|
|
5
5
|
|
|
6
6
|
## DOM
|
|
7
7
|
<div class="kpt-stepper-host" style="--kpt-anim-duration:500ms; --kpt-anim-dir:1">
|
|
8
8
|
<ol class="kpt-stepper__header">
|
|
9
9
|
<li class="kpt-stepper__step is-done">
|
|
10
|
-
<button class="kpt-stepper__marker" aria-label="Step 1: Account, completed"
|
|
10
|
+
<button class="kpt-stepper__marker" aria-label="Step 1: Account, completed">
|
|
11
|
+
<span class="kpt-stepper__num">1</span><span class="kpt-icon-host kpt-stepper__check"><!-- check --></span>
|
|
12
|
+
</button>
|
|
11
13
|
<span class="kpt-stepper__label" aria-hidden="true">Account</span>
|
|
12
|
-
<span class="kpt-stepper__connector"></span>
|
|
14
|
+
<span class="kpt-stepper__connector" style="--kpt-stepper-line-delay:60ms; --kpt-stepper-line-dur:420ms"></span>
|
|
13
15
|
</li>
|
|
14
|
-
|
|
16
|
+
...
|
|
15
17
|
</ol>
|
|
16
|
-
<
|
|
18
|
+
<span class="kpt-stepper__comet" aria-hidden="true"></span>
|
|
19
|
+
<div class="kpt-stepper__body"><div class="kpt-stepper__panel">...</div></div>
|
|
17
20
|
</div>
|
|
18
21
|
|
|
19
22
|
## KptStepper props
|
|
20
23
|
- `activeIndex` / `defaultActiveIndex` / `onActiveIndexChange`
|
|
21
|
-
- `animated`: boolean (default true), `animationDuration`: ms (default 500)
|
|
24
|
+
- `animated`: boolean (default true), `animationDuration`: ms (default 500) - the pace of the whole motion:
|
|
25
|
+
the content enter, and the line (a segment takes 0.84x, a multi-step jump fits in 1.8x)
|
|
22
26
|
- `className`, `ref` and every other `<div>` prop go to the host
|
|
23
27
|
|
|
24
28
|
## KptStepper.Step props
|
|
25
|
-
- `label`: string (required); `children`
|
|
29
|
+
- `label`: string (required); `children` - the step's content
|
|
26
30
|
|
|
27
31
|
## useKptStepper()
|
|
28
|
-
`{ activeIndex, count, next, prev, goTo }`
|
|
32
|
+
`{ activeIndex, count, next, prev, goTo }` - the replacement for Angular's `#s` + `s.next()`.
|
|
29
33
|
It reads a context the stepper provides around the panel, so it works only in a component
|
|
30
34
|
rendered inside a step (a hook cannot be called in the parent's body) and throws elsewhere.
|
|
31
35
|
`count` lets a step hide "Next" on the last one.
|
|
32
36
|
|
|
33
37
|
## The step is a config carrier
|
|
34
38
|
`KptStep` renders `null`; `KptStepper` reads its props and decides what to show, so only the
|
|
35
|
-
active step's content is ever mounted
|
|
39
|
+
active step's content is ever mounted - the same laziness as the `kpt-step` template in Angular.
|
|
36
40
|
|
|
37
41
|
## The panel is keyed by index
|
|
38
42
|
`key={active}` forces a remount on every change, otherwise the enter animation would have nothing
|
|
@@ -42,7 +46,7 @@ an earlier step animates from the other side.
|
|
|
42
46
|
## Examples
|
|
43
47
|
<KptStepper>
|
|
44
48
|
<KptStepper.Step label="Account"><StepNav /></KptStepper.Step>
|
|
45
|
-
<KptStepper.Step label="Profile"
|
|
49
|
+
<KptStepper.Step label="Profile">...</KptStepper.Step>
|
|
46
50
|
</KptStepper>
|
|
47
51
|
|
|
48
52
|
function StepNav() {
|
|
@@ -55,17 +59,32 @@ an earlier step animates from the other side.
|
|
|
55
59
|
);
|
|
56
60
|
}
|
|
57
61
|
|
|
62
|
+
## Motion
|
|
63
|
+
Switching steps reads as colour flowing: the state changes at once (classes, `aria-current`,
|
|
64
|
+
the marker names), but the connector fills from grey to `--kpt-color-primary` with a glowing comet
|
|
65
|
+
running along it, and a marker turns "done" (fills from the centre, the check pops in) only when the
|
|
66
|
+
colour reaches it; the new active step sends out a ring and keeps a soft glow. A jump over several
|
|
67
|
+
steps runs the segments one after another within ~0.9 s; going back retracts them from the end.
|
|
68
|
+
The content of the new step slides in from the side of the move and sharpens out of a blur, the old
|
|
69
|
+
one leaves as a ghost the other way, and the body height changes smoothly.
|
|
70
|
+
|
|
71
|
+
The timings come from `stepperSchedule` in `@konce-pt/motion` (CSS variables
|
|
72
|
+
`--kpt-stepper-mark-delay`, `--kpt-stepper-line-delay`, `--kpt-stepper-line-dur` on the steps), the comet
|
|
73
|
+
and the ring from `playStepperLight`, the ghost from `preparePanelSwap`. Follows `animated` and `enter`
|
|
74
|
+
from `KptMotionProvider` (`none` - everything switches at once, `fade` - no comet and ring); `enabled: false` and the
|
|
75
|
+
system "reduce motion" setting always win.
|
|
76
|
+
|
|
58
77
|
## Tokens
|
|
59
78
|
The active and completed step: `--kpt-color-primary` (marker, connector); the rest
|
|
60
79
|
`--kpt-color-border-strong` and `--kpt-color-on-surface-muted`.
|
|
61
80
|
|
|
62
81
|
## Accessibility
|
|
63
82
|
The header is an `<ol>` of real buttons, so every step is reachable with the keyboard and the list
|
|
64
|
-
announces how many there are. Each marker is named from the dictionary
|
|
65
|
-
(
|
|
83
|
+
announces how many there are. Each marker is named from the dictionary - `stepper.step`
|
|
84
|
+
("Step 2: Delivery") or `stepper.stepDone` ("..., completed") - because the visible marker is only a
|
|
66
85
|
number or a check; the visible label is `aria-hidden` so it is not read twice. The active marker
|
|
67
|
-
carries `aria-current="step"`. After `next()` focus stays where it was
|
|
86
|
+
carries `aria-current="step"`. After `next()` focus stays where it was - move it into the new step
|
|
68
87
|
yourself when the step is long.
|
|
69
88
|
|
|
70
89
|
## Inactive content is destroyed
|
|
71
|
-
Switching renders the new panel from scratch (that is what the enter animation starts from), so local state inside the previous one
|
|
90
|
+
Switching renders the new panel from scratch (that is what the enter animation starts from), so local state inside the previous one - an unsent file upload, expanded sections, scroll position - is lost. Keep such state in your own model, outside the panel.
|
|
@@ -2,14 +2,14 @@ import { type ComponentPropsWithRef, type ReactNode } from 'react';
|
|
|
2
2
|
import { type KptI18nOverrides } from '../i18n/i18n-context.tsx';
|
|
3
3
|
export interface KptStepperContextValue {
|
|
4
4
|
activeIndex: number;
|
|
5
|
-
/** Liczba kroków
|
|
5
|
+
/** Liczba kroków - pozwala treści kroku ukryć "Dalej" na ostatnim. */
|
|
6
6
|
count: number;
|
|
7
7
|
next: () => void;
|
|
8
8
|
prev: () => void;
|
|
9
9
|
goTo: (index: number) => void;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* Sterowanie kreatorem z wnętrza kroku
|
|
12
|
+
* Sterowanie kreatorem z wnętrza kroku - odpowiednik `#s` + `s.next()` z portu Angulara.
|
|
13
13
|
* Poza `<KptStepper>` rzuca błąd, bo bez kreatora nie ma czym sterować.
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
@@ -21,7 +21,7 @@ export interface KptStepProps {
|
|
|
21
21
|
children?: ReactNode;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* Pojedynczy krok. Umieszczaj w `<KptStepper>`. Treść renderuje się leniwie
|
|
24
|
+
* Pojedynczy krok. Umieszczaj w `<KptStepper>`. Treść renderuje się leniwie - dopiero gdy krok
|
|
25
25
|
* jest aktywny, tak samo jak szablon `kpt-step` w porcie Angulara.
|
|
26
26
|
*/
|
|
27
27
|
export declare function KptStep(_props: Readonly<KptStepProps>): ReactNode;
|
|
@@ -37,13 +37,13 @@ export interface KptStepperProps extends Omit<ComponentPropsWithRef<'div'>, 'onC
|
|
|
37
37
|
children?: ReactNode;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
* Kreator kroków
|
|
40
|
+
* Kreator kroków - nagłówek z numerowanymi krokami i treść aktywnego kroku.
|
|
41
41
|
* Treścią sterują `next()`/`prev()`/`goTo()` z hooka `useKptStepper()`.
|
|
42
42
|
*
|
|
43
43
|
* @example
|
|
44
44
|
* <KptStepper>
|
|
45
|
-
* <KptStepper.Step label="Konto"
|
|
46
|
-
* <KptStepper.Step label="Profil"
|
|
45
|
+
* <KptStepper.Step label="Konto">...</KptStepper.Step>
|
|
46
|
+
* <KptStepper.Step label="Profil">...</KptStepper.Step>
|
|
47
47
|
* </KptStepper>
|
|
48
48
|
*/
|
|
49
49
|
export declare function KptStepper({ activeIndex, defaultActiveIndex, onActiveIndexChange, animated, animationDuration, locale, dictionary, className, style, children, ...rest }: Readonly<KptStepperProps>): import("react").JSX.Element;
|