@konce-pt/react 0.11.2 → 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 +128 -64
- package/dist/accordion/accordion.d.ts +14 -6
- package/dist/accordion/accordion.js +25 -17
- package/dist/accordion/llms.txt +22 -10
- package/dist/alert/alert.d.ts +2 -2
- package/dist/alert/alert.js +3 -2
- package/dist/alert/llms.txt +10 -9
- package/dist/app-shell/app-shell.d.ts +14 -14
- package/dist/app-shell/app-shell.js +22 -15
- package/dist/app-shell/llms.txt +16 -15
- package/dist/auth/auth-types.d.ts +6 -6
- package/dist/auth/auth.d.ts +2 -2
- package/dist/auth/auth.js +24 -15
- package/dist/auth/llms.txt +12 -11
- package/dist/autocomplete/autocomplete.d.ts +19 -6
- package/dist/autocomplete/autocomplete.js +32 -11
- package/dist/autocomplete/llms.txt +19 -5
- package/dist/avatar/avatar.d.ts +6 -6
- package/dist/avatar/avatar.js +6 -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 +4 -3
- package/dist/avatar-group/llms.txt +8 -8
- package/dist/backdrop/backdrop.d.ts +7 -26
- package/dist/backdrop/backdrop.js +32 -27
- 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 +8 -3
- package/dist/bottom-sheet/bottom-sheet.js +5 -4
- package/dist/bottom-sheet/llms.txt +11 -8
- package/dist/breadcrumb/breadcrumb.d.ts +8 -2
- package/dist/breadcrumb/breadcrumb.js +11 -3
- package/dist/breadcrumb/llms.txt +10 -2
- package/dist/button/button.d.ts +3 -3
- package/dist/button/button.js +10 -9
- package/dist/button/llms.txt +27 -19
- package/dist/button-group/button-group.d.ts +18 -5
- package/dist/button-group/button-group.js +54 -6
- package/dist/button-group/llms.txt +27 -18
- package/dist/card/card.d.ts +8 -8
- package/dist/card/card.js +10 -9
- package/dist/card/llms.txt +20 -20
- package/dist/carousel/carousel.d.ts +6 -6
- package/dist/carousel/carousel.js +8 -5
- package/dist/carousel/llms.txt +10 -10
- package/dist/charts/chart-legend.d.ts +3 -3
- package/dist/charts/chart-legend.js +2 -1
- package/dist/charts/chart-tooltip.d.ts +3 -3
- package/dist/charts/chart-tooltip.js +1 -1
- package/dist/charts/chart.d.ts +4 -3
- package/dist/charts/chart.js +18 -10
- package/dist/charts/llms.txt +10 -7
- package/dist/charts-entry/public-api.js +2 -2
- package/dist/chat/chat.d.ts +17 -10
- package/dist/chat/chat.js +77 -23
- package/dist/chat/llms.txt +39 -15
- package/dist/chat-composer/chat-composer.d.ts +20 -7
- package/dist/chat-composer/chat-composer.js +29 -7
- 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 +10 -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 +19 -8
- 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 +4 -3
- package/dist/chat-typing/llms.txt +6 -6
- package/dist/checkbox/checkbox.d.ts +13 -6
- package/dist/checkbox/checkbox.js +31 -5
- package/dist/checkbox/llms.txt +26 -11
- package/dist/chip/chip.d.ts +4 -4
- package/dist/chip/chip.js +3 -2
- package/dist/chip/llms.txt +11 -11
- package/dist/chips-input/chips-input.d.ts +6 -4
- package/dist/chips-input/chips-input.js +47 -12
- package/dist/chips-input/llms.txt +18 -8
- package/dist/clock/clock.d.ts +11 -6
- package/dist/clock/clock.js +38 -8
- package/dist/clock/llms.txt +12 -8
- package/dist/color-picker/color-picker.d.ts +9 -5
- package/dist/color-picker/color-picker.js +37 -18
- package/dist/color-picker/llms.txt +8 -5
- package/dist/confirm/confirm-container.d.ts +3 -3
- package/dist/confirm/confirm-container.js +6 -5
- package/dist/confirm/confirm-store.d.ts +4 -4
- package/dist/confirm/confirm-store.js +11 -5
- package/dist/confirm/llms.txt +8 -7
- package/dist/context-menu/context-menu.d.ts +1 -1
- package/dist/context-menu/context-menu.js +37 -14
- package/dist/context-menu/llms.txt +10 -7
- package/dist/data-table/data-table-types.d.ts +5 -5
- package/dist/data-table/data-table.d.ts +37 -5
- package/dist/data-table/data-table.js +426 -119
- package/dist/data-table/export-csv.d.ts +3 -3
- package/dist/data-table/export-csv.js +8 -10
- package/dist/data-table/llms.txt +127 -79
- package/dist/data-view/data-view.d.ts +13 -5
- package/dist/data-view/data-view.js +68 -6
- package/dist/data-view/llms.txt +29 -10
- package/dist/date-range/date-range.d.ts +20 -8
- package/dist/date-range/date-range.js +86 -63
- package/dist/date-range/llms.txt +32 -18
- package/dist/datepicker/datepicker.d.ts +22 -8
- package/dist/datepicker/datepicker.js +103 -71
- package/dist/datepicker/llms.txt +36 -22
- package/dist/dialog/dialog.d.ts +4 -4
- package/dist/dialog/dialog.js +32 -11
- package/dist/dialog/llms.txt +13 -10
- package/dist/divider/divider.d.ts +7 -1
- package/dist/divider/divider.js +3 -2
- package/dist/divider/llms.txt +4 -3
- package/dist/drawer/drawer.d.ts +9 -4
- package/dist/drawer/drawer.js +5 -4
- package/dist/drawer/llms.txt +13 -10
- 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 +12 -6
- package/dist/fieldset/llms.txt +26 -9
- package/dist/file-upload/file-upload.d.ts +8 -2
- package/dist/file-upload/file-upload.js +22 -11
- package/dist/file-upload/llms.txt +12 -9
- 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 +27 -6
- package/dist/form-field/llms.txt +25 -11
- package/dist/galleria/galleria.d.ts +3 -3
- package/dist/galleria/galleria.js +9 -6
- 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 +6 -6
- package/dist/i18n/i18n-context.js +27 -5
- 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 +10 -7
- 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 +5 -5
- package/dist/image/llms.txt +13 -13
- package/dist/input/input.d.ts +18 -5
- package/dist/input/input.js +22 -6
- package/dist/input/llms.txt +25 -11
- package/dist/input-mask/input-mask.d.ts +7 -2
- package/dist/input-mask/input-mask.js +17 -43
- package/dist/input-mask/llms.txt +8 -5
- package/dist/input-number/input-number.d.ts +11 -9
- package/dist/input-number/input-number.js +25 -21
- package/dist/input-number/llms.txt +17 -14
- package/dist/input-otp/input-otp.d.ts +18 -5
- package/dist/input-otp/input-otp.js +48 -24
- package/dist/input-otp/llms.txt +18 -7
- 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 +14 -0
- package/dist/internal/mask.js +62 -0
- package/dist/internal/number-group.d.ts +22 -0
- package/dist/internal/number-group.js +53 -0
- package/dist/internal/option-key.d.ts +6 -0
- package/dist/internal/option-key.js +8 -0
- 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 +40 -10
- package/dist/internal/password-strength.d.ts +6 -0
- package/dist/internal/password-strength.js +74 -0
- package/dist/internal/roving.d.ts +2 -2
- package/dist/internal/roving.js +3 -3
- package/dist/internal/scroll-lock.d.ts +6 -0
- package/dist/internal/scroll-lock.js +35 -0
- package/dist/internal/slot-children.d.ts +13 -0
- package/dist/internal/slot-children.js +31 -0
- package/dist/internal/slot.d.ts +3 -3
- package/dist/internal/slot.js +2 -2
- package/dist/internal/step.d.ts +12 -0
- package/dist/internal/step.js +31 -0
- package/dist/internal/tween.d.ts +5 -5
- package/dist/internal/tween.js +7 -8
- 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 +5 -0
- package/dist/internal/use-controllable-state.js +25 -4
- 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 +2 -1
- package/dist/internal/use-modal-focus.js +14 -3
- package/dist/knob/knob.d.ts +7 -4
- package/dist/knob/knob.js +27 -22
- package/dist/knob/llms.txt +18 -11
- package/dist/listbox/listbox.d.ts +8 -6
- package/dist/listbox/listbox.js +37 -17
- package/dist/listbox/llms.txt +12 -9
- 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 +30 -23
- package/dist/map/map-create-dialog.d.ts +4 -4
- package/dist/map/map-create-dialog.js +36 -28
- package/dist/map/map-hours-field.d.ts +4 -4
- package/dist/map/map-hours-field.js +8 -7
- package/dist/map/map-image-field.d.ts +2 -2
- package/dist/map/map-image-field.js +6 -5
- package/dist/map/map-legend.d.ts +4 -4
- package/dist/map/map-legend.js +3 -2
- package/dist/map/map-poi-card.d.ts +3 -3
- package/dist/map/map-poi-card.js +10 -9
- package/dist/map/map-search.d.ts +17 -6
- package/dist/map/map-search.js +70 -43
- package/dist/map/map.d.ts +25 -13
- package/dist/map/map.js +86 -57
- 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 +18 -7
- package/dist/megamenu/megamenu.d.ts +12 -6
- package/dist/megamenu/megamenu.js +23 -14
- 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-rows.js +1 -0
- package/dist/menu/menu.d.ts +2 -2
- package/dist/menu/menu.js +15 -8
- package/dist/menubar/llms.txt +19 -8
- package/dist/menubar/menubar.d.ts +11 -5
- package/dist/menubar/menubar.js +23 -11
- 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 +2 -1
- package/dist/motion/motion-context.d.ts +22 -0
- package/dist/motion/motion-context.js +28 -0
- package/dist/order-list/llms.txt +24 -9
- package/dist/order-list/order-list.d.ts +12 -4
- package/dist/order-list/order-list.js +123 -25
- package/dist/paginator/llms.txt +8 -8
- package/dist/paginator/paginator.js +7 -4
- package/dist/panel/llms.txt +25 -13
- package/dist/panel/panel.d.ts +11 -3
- package/dist/panel/panel.js +12 -7
- package/dist/password/llms.txt +19 -7
- package/dist/password/password.d.ts +2 -2
- package/dist/password/password.js +27 -16
- package/dist/peek/llms.txt +11 -11
- package/dist/peek/peek.d.ts +6 -6
- package/dist/peek/peek.js +41 -19
- package/dist/pick-list/llms.txt +35 -12
- package/dist/pick-list/pick-list.d.ts +12 -4
- package/dist/pick-list/pick-list.js +128 -24
- package/dist/popover/llms.txt +13 -10
- package/dist/popover/popover.d.ts +6 -4
- package/dist/popover/popover.js +14 -7
- package/dist/progress/llms.txt +17 -17
- package/dist/progress/progress.d.ts +7 -7
- package/dist/progress/progress.js +7 -6
- package/dist/public-api.d.ts +16 -4
- package/dist/public-api.js +13 -7
- package/dist/radio-group/llms.txt +16 -6
- package/dist/radio-group/radio-group.d.ts +12 -3
- package/dist/radio-group/radio-group.js +23 -4
- 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 +77 -12
- package/dist/rich-text/lists.d.ts +2 -2
- package/dist/rich-text/lists.js +7 -7
- package/dist/rich-text/llms.txt +35 -12
- package/dist/rich-text/rich-text.d.ts +13 -14
- package/dist/rich-text/rich-text.js +311 -142
- package/dist/rich-text/sanitize.d.ts +11 -2
- package/dist/rich-text/sanitize.js +80 -32
- package/dist/rich-text/tables.d.ts +3 -3
- package/dist/rich-text/tables.js +3 -3
- package/dist/roadmap/llms.txt +23 -17
- package/dist/roadmap/roadmap.d.ts +6 -6
- package/dist/roadmap/roadmap.js +102 -25
- 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 +2 -1
- package/dist/select/llms.txt +22 -12
- package/dist/select/select.d.ts +10 -8
- package/dist/select/select.js +87 -47
- package/dist/shared/types.d.ts +22 -1
- package/dist/shared/types.js +9 -1
- package/dist/sidenav/llms.txt +9 -9
- package/dist/sidenav/sidenav.d.ts +2 -3
- package/dist/sidenav/sidenav.js +5 -4
- 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 +34 -12
- package/dist/slider/slider-drag.d.ts +26 -0
- package/dist/slider/slider-drag.js +79 -0
- package/dist/slider/slider.d.ts +8 -5
- package/dist/slider/slider.js +38 -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 +3 -2
- package/dist/spinner/llms.txt +7 -7
- package/dist/spinner/spinner.d.ts +1 -1
- package/dist/spinner/spinner.js +2 -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 +13 -6
- package/dist/splitter/llms.txt +11 -11
- package/dist/splitter/splitter.d.ts +3 -3
- package/dist/splitter/splitter.js +25 -10
- package/dist/stepper/llms.txt +35 -13
- package/dist/stepper/stepper.d.ts +6 -6
- package/dist/stepper/stepper.js +60 -13
- package/dist/switch/llms.txt +15 -5
- package/dist/switch/switch.d.ts +10 -3
- package/dist/switch/switch.js +18 -4
- package/dist/switch-group/llms.txt +11 -8
- package/dist/switch-group/switch-group.d.ts +6 -4
- package/dist/switch-group/switch-group.js +9 -7
- package/dist/tabs/llms.txt +12 -9
- package/dist/tabs/tabs.d.ts +5 -5
- package/dist/tabs/tabs.js +36 -20
- package/dist/textarea/llms.txt +23 -12
- package/dist/textarea/textarea.d.ts +19 -6
- package/dist/textarea/textarea.js +22 -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 +50 -17
- package/dist/toast/toast-container.d.ts +9 -3
- package/dist/toast/toast-container.js +18 -9
- package/dist/toast/toast-store.d.ts +42 -2
- 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 +14 -12
- package/dist/tooltip/tooltip.d.ts +5 -4
- package/dist/tooltip/tooltip.js +100 -41
- package/dist/tree/llms.txt +25 -11
- package/dist/tree/tree-keys.d.ts +5 -5
- package/dist/tree/tree-keys.js +7 -7
- package/dist/tree/tree.d.ts +17 -5
- package/dist/tree/tree.js +62 -20
- 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 +18 -15
package/dist/backdrop/llms.txt
CHANGED
|
@@ -9,33 +9,33 @@ Import: `import { KptBackdrop } from '@konce-pt/react';`
|
|
|
9
9
|
## DOM
|
|
10
10
|
<div class="kpt-backdrop-host" data-effect="wave">
|
|
11
11
|
<canvas class="kpt-backdrop__canvas" aria-hidden="true"></canvas>
|
|
12
|
-
<div class="kpt-backdrop__content"
|
|
12
|
+
<div class="kpt-backdrop__content">...</div>
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
15
|
## Props (shared)
|
|
16
16
|
- `effect`: 'signal-grid' | 'wave' (default 'signal-grid')
|
|
17
|
-
- `background`: string
|
|
18
|
-
- `speed`: number (default 1)
|
|
19
|
-
- `seed`: number (default 0)
|
|
20
|
-
- `paused`: boolean
|
|
21
|
-
- `adaptive`: boolean
|
|
22
|
-
- `contentProps`
|
|
17
|
+
- `background`: string - the section background; empty takes `--kpt-color-surface`
|
|
18
|
+
- `speed`: number (default 1) - 1 is the calm pace of either effect, 0 freezes the picture
|
|
19
|
+
- `seed`: number (default 0) - the same value gives the same layout and the same sway
|
|
20
|
+
- `paused`: boolean - stops the animation, leaving the last frame
|
|
21
|
+
- `adaptive`: boolean - carries hardcoded colours onto the current theme's surface
|
|
22
|
+
- `contentProps` - props for the `.kpt-backdrop__content` layer
|
|
23
23
|
- `className`, `ref` and every other `<div>` prop go to `.kpt-backdrop-host`
|
|
24
24
|
|
|
25
25
|
## Props (signal-grid)
|
|
26
|
-
- `color`: string
|
|
26
|
+
- `color`: string - the square colour, any CSS notation, tokens included; empty takes
|
|
27
27
|
`--kpt-color-primary`
|
|
28
|
-
- `anchor`: 'left' | 'right' (default 'right')
|
|
29
|
-
- `cell`: number (default 5), `gap`: number (default 11)
|
|
30
|
-
- `density`: number (default 0.8)
|
|
31
|
-
- `falloff`: number (default 1.4)
|
|
28
|
+
- `anchor`: 'left' | 'right' (default 'right') - the edge the grid is densest at
|
|
29
|
+
- `cell`: number (default 5), `gap`: number (default 11) - the square and the space between, in px
|
|
30
|
+
- `density`: number (default 0.8) - the share of lit cells at the anchor, 0-1
|
|
31
|
+
- `falloff`: number (default 1.4) - how fast the grid fades towards the far edge
|
|
32
32
|
|
|
33
33
|
## Props (wave)
|
|
34
|
-
- `colors`: string[]
|
|
34
|
+
- `colors`: string[] - the colour ramp the current slides along, closed into a loop; every
|
|
35
35
|
stop takes any CSS notation, `color`'s rules exactly
|
|
36
|
-
- `rotation`: number (default 12)
|
|
37
|
-
- `band`: number (default 0.34)
|
|
38
|
-
- `amplitude`: number (default 0.16)
|
|
36
|
+
- `rotation`: number (default 12) - the angle the current crosses the frame at, in degrees
|
|
37
|
+
- `band`: number (default 0.34) - the band's width as a fraction of the frame's height
|
|
38
|
+
- `amplitude`: number (default 0.16) - how far the centre line sways
|
|
39
39
|
|
|
40
40
|
A prop that does not belong to the current effect is simply not read.
|
|
41
41
|
|
|
@@ -56,12 +56,12 @@ rotation. The library's palette is neutral, so that default current is single-hu
|
|
|
56
56
|
|
|
57
57
|
Every stop is put to the browser, so `oklch()`, `color-mix()`, `rgb()` and named colours are read
|
|
58
58
|
the same as hex; alpha is dropped. A stop the browser refuses falls out of the ramp, and if every
|
|
59
|
-
one of them falls out the default ramp takes over rather than the section going blank
|
|
59
|
+
one of them falls out the default ramp takes over rather than the section going blank - a dev
|
|
60
60
|
build says in the console which stops it dropped.
|
|
61
61
|
|
|
62
62
|
## The same picture in both ports
|
|
63
|
-
Everything that decides how it looks
|
|
64
|
-
and the colour ramp, plus the renderers themselves
|
|
63
|
+
Everything that decides how it looks - the grid layout, the density ramp, the twinkle, the current
|
|
64
|
+
and the colour ramp, plus the renderers themselves - lives in `@konce-pt/backdrop`, shared with
|
|
65
65
|
the Angular port. This component is the lifecycle: `rAF`, `ResizeObserver`, `IntersectionObserver`,
|
|
66
66
|
the reduced-motion query and the theme watch. The same props therefore give the
|
|
67
67
|
same frame in either port.
|
|
@@ -74,7 +74,7 @@ slider accelerates the picture instead of jumping it. A change of `colors` is tr
|
|
|
74
74
|
not by array identity, so a fresh array from a parent render does not rebuild the renderer.
|
|
75
75
|
|
|
76
76
|
## Accessibility
|
|
77
|
-
The canvas carries `aria-hidden="true"` and `pointer-events: none`
|
|
77
|
+
The canvas carries `aria-hidden="true"` and `pointer-events: none` - it is decoration with no
|
|
78
78
|
content and nothing to hit. Children keep their own roles and tab order.
|
|
79
79
|
|
|
80
80
|
## Tokens
|
|
@@ -86,24 +86,24 @@ A literal stays put by design, which is right for a brand colour and wrong for a
|
|
|
86
86
|
read in both themes. `adaptive` closes that gap: it carries `color`, `colors` and `background`
|
|
87
87
|
onto the surface of the current theme, keeping each one's distance from that surface. Black picked
|
|
88
88
|
for a white section comes out white on a near-black ground, and that white background comes out at
|
|
89
|
-
the surface's own lightness. Only lightness moves
|
|
89
|
+
the surface's own lightness. Only lightness moves - hue and chroma stay, so a brand colour keeps
|
|
90
90
|
being that colour and only changes how light it is.
|
|
91
91
|
|
|
92
92
|
It touches literals only. An empty input takes a token, and a value reaching through `var()`
|
|
93
93
|
reaches a token too; both already follow the theme, and adapting them would turn them back again.
|
|
94
|
-
Values written for the light theme are the assumption
|
|
94
|
+
Values written for the light theme are the assumption - the library keeps light in `:root` and
|
|
95
95
|
dark as the override.
|
|
96
96
|
|
|
97
97
|
## Content on a custom background
|
|
98
98
|
The host paints `--kpt-color-surface` and lets content inherit `--kpt-color-on-surface`, which is
|
|
99
|
-
right until the section gets a `background` of its own
|
|
99
|
+
right until the section gets a `background` of its own - then that token describes the page around
|
|
100
100
|
it, not the ground the content actually sits on. A dark section in a light theme would come out
|
|
101
101
|
black on black.
|
|
102
102
|
|
|
103
103
|
So a section with its own background works out its own ink: the host sets `color` to match what it
|
|
104
104
|
paints, and announces the result as `data-tone` (`light` for a light background, `dark` for a dark
|
|
105
|
-
one). Text follows by inheritance; anything needing more than a text colour
|
|
106
|
-
section, say
|
|
105
|
+
one). Text follows by inheritance; anything needing more than a text colour - buttons in the
|
|
106
|
+
section, say - can hang its own tokens off the attribute:
|
|
107
107
|
|
|
108
108
|
:where(div.kpt-backdrop-host[data-tone='light']) .hero { --kpt-button-filled-bg: #15181a; }
|
|
109
109
|
|
|
@@ -112,7 +112,7 @@ matches the adapted value, not the one written in the template. A section withou
|
|
|
112
112
|
background announces nothing and content stays on `--kpt-color-on-surface`.
|
|
113
113
|
|
|
114
114
|
## Theme
|
|
115
|
-
Canvas does not expand `var()`, so the colour is read once and baked into the renderer
|
|
115
|
+
Canvas does not expand `var()`, so the colour is read once and baked into the renderer - the
|
|
116
116
|
component therefore watches for anything that can restyle the tokens under it and reads them
|
|
117
117
|
again. `[data-theme="dark"]` is not tied to `:root`, so the watch covers `data-theme`, `class`
|
|
118
118
|
and `style` on every ancestor from the host up to `<html>`, plus the `prefers-color-scheme` query
|
|
@@ -122,7 +122,7 @@ when the colour actually came out different, so an unrelated class landing on `<
|
|
|
122
122
|
cheap read and nothing else.
|
|
123
123
|
|
|
124
124
|
Whether an explicit `color` or `colors` follows the theme is up to how it is written. A literal
|
|
125
|
-
stays put
|
|
125
|
+
stays put - `#5b8af2` is `#5b8af2` in either theme, which is what someone spelling out a brand
|
|
126
126
|
colour wants. An expression reaching for a token is resolved against the tree on every rebuild, so
|
|
127
127
|
it moves with the theme on its own:
|
|
128
128
|
|
package/dist/badge/badge.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type KptBadgeSize = 'sm' | 'md' | 'lg';
|
|
|
4
4
|
export interface KptBadgeProps extends ComponentPropsWithRef<'span'> {
|
|
5
5
|
value?: string | number | null;
|
|
6
6
|
variant?: KptBadgeVariant;
|
|
7
|
-
/** Rozmiar
|
|
7
|
+
/** Rozmiar - `sm` mieści się w wierszu tekstu, `md` to domyślny licznik. */
|
|
8
8
|
size?: KptBadgeSize;
|
|
9
9
|
/** Sama kropka statusu, bez liczby. */
|
|
10
10
|
dot?: boolean;
|
|
@@ -13,7 +13,7 @@ export interface KptBadgeProps extends ComponentPropsWithRef<'span'> {
|
|
|
13
13
|
/** Powyżej tej wartości licznik pokazuje `99+`. */
|
|
14
14
|
max?: number;
|
|
15
15
|
/**
|
|
16
|
-
* Znaczenie plakietki dla czytnika ekranu, np.
|
|
16
|
+
* Znaczenie plakietki dla czytnika ekranu, np. "3 nieprzeczytane". Sama liczba ("3") albo kropka
|
|
17
17
|
* nic nie mówią; z `label` widoczny tekst jest ukryty przed czytnikiem, a odczytywana jest etykieta.
|
|
18
18
|
*/
|
|
19
19
|
label?: string;
|
|
@@ -22,7 +22,7 @@ export interface KptBadgeProps extends ComponentPropsWithRef<'span'> {
|
|
|
22
22
|
children?: ReactNode;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* Znacznik (badge)
|
|
25
|
+
* Znacznik (badge) - licznik lub kropka statusu. Samodzielny albo nałożony na treść (`overlay`).
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
28
|
* <KptBadge value={3} variant="danger" />
|
package/dist/badge/badge.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "../internal/cn.js";
|
|
3
3
|
/**
|
|
4
|
-
* Znacznik (badge)
|
|
4
|
+
* Znacznik (badge) - licznik lub kropka statusu. Samodzielny albo nałożony na treść (`overlay`).
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
7
|
* <KptBadge value={3} variant="danger" />
|
package/dist/badge/llms.txt
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
# KptBadge (@konce-pt/react)
|
|
2
2
|
|
|
3
|
-
A badge
|
|
3
|
+
A badge - a counter or a status dot. Standalone, or laid over content (`overlay`).
|
|
4
4
|
Import: `import { KptBadge } from '@konce-pt/react';`
|
|
5
5
|
|
|
6
6
|
## DOM
|
|
7
7
|
<span class="kpt-badge-host">
|
|
8
|
-
|
|
8
|
+
...children...
|
|
9
9
|
<span class="kpt-badge kpt-badge--overlay" data-variant="danger" data-size="md">
|
|
10
10
|
<span aria-hidden="true">8</span><span class="kpt-badge__label">8 unread</span>
|
|
11
11
|
</span>
|
|
12
12
|
</span>
|
|
13
13
|
|
|
14
14
|
## Props
|
|
15
|
-
- `value`: string | number | null
|
|
15
|
+
- `value`: string | number | null - the counter content
|
|
16
16
|
- `variant`: 'neutral' | 'primary' | 'success' | 'danger' | 'warning' | 'info' (default 'primary')
|
|
17
|
-
- `size`: 'sm' | 'md' | 'lg' (default 'md')
|
|
18
|
-
- `dot`: boolean
|
|
19
|
-
- `overlay`: boolean
|
|
20
|
-
- `max`: number (default 99)
|
|
21
|
-
- `label`: string
|
|
22
|
-
- `hideZero`: boolean
|
|
17
|
+
- `size`: 'sm' | 'md' | 'lg' (default 'md') - `sm` fits inside a line of text
|
|
18
|
+
- `dot`: boolean - a bare status dot, no number
|
|
19
|
+
- `overlay`: boolean - laid over the `children`
|
|
20
|
+
- `max`: number (default 99) - above it the counter reads `99+`
|
|
21
|
+
- `label`: string - the meaning for screen readers ("3 unread", "online"); the visible text is then `aria-hidden`
|
|
22
|
+
- `hideZero`: boolean - hides the badge when `value` is `0` or `null` (not with `dot`)
|
|
23
23
|
- `className`, `ref` and every other `<span>` prop go to the host
|
|
24
24
|
|
|
25
25
|
## Overlay
|
|
@@ -34,10 +34,10 @@ it on the host rather than on the badge.
|
|
|
34
34
|
<span>Notifications <KptBadge value={4} size="sm" variant="success" /></span>
|
|
35
35
|
|
|
36
36
|
## Tokens
|
|
37
|
-
Background `--kpt-color-{primary,success,danger,warning,info}` with the text in the matching `*-contrast` token (`--kpt-color-on-primary` for `primary`)
|
|
37
|
+
Background `--kpt-color-{primary,success,danger,warning,info}` with the text in the matching `*-contrast` token (`--kpt-color-on-primary` for `primary`) - the same pairs as `kpt-button`; `neutral` is `--kpt-color-muted` / `--kpt-color-on-muted`; the overlay ring comes from `--kpt-color-surface`.
|
|
38
38
|
|
|
39
39
|
## Accessibility
|
|
40
|
-
On its own a badge is just a number, and a `dot` is nothing. `label` gives it a meaning
|
|
40
|
+
On its own a badge is just a number, and a `dot` is nothing. `label` gives it a meaning - a visually
|
|
41
41
|
hidden `.kpt-badge__label` that screen readers read instead of the visible text. Without `label`, put
|
|
42
42
|
the meaning into the name of the control the badge sits on. Count changes are not announced. The
|
|
43
43
|
`success`, `warning` and `info` variants draw the text in `--kpt-color-surface`; check the contrast
|
|
@@ -4,18 +4,23 @@ export interface KptBottomSheetProps extends ComponentPropsWithRef<'div'>, KptI1
|
|
|
4
4
|
open: boolean;
|
|
5
5
|
onOpenChange: (open: boolean) => void;
|
|
6
6
|
header?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Nazwa panelu bez `header` - okno dialogowe bez nazwy czytnik ogłasza jako samo "okno
|
|
9
|
+
* dialogowe" (WCAG 4.1.2). Z nagłówkiem nazwą jest nagłówek (`aria-labelledby`).
|
|
10
|
+
*/
|
|
11
|
+
ariaLabel?: string;
|
|
7
12
|
closeOnBackdrop?: boolean;
|
|
8
13
|
children?: ReactNode;
|
|
9
14
|
}
|
|
10
15
|
/**
|
|
11
16
|
* Arkusz wysuwany z dołu ekranu.
|
|
12
17
|
*
|
|
13
|
-
* Arkusz zostaje w DOM także zamknięty
|
|
18
|
+
* Arkusz zostaje w DOM także zamknięty - chowa go `transform` i `visibility`, nigdy
|
|
14
19
|
* `display: none`, bo inaczej animacje wjazdu i zjazdu nie miałyby od czego wystartować.
|
|
15
20
|
* `visibility` wyjmuje go przy tym z kolejności Tab i z drzewa dostępności bez `inert`,
|
|
16
21
|
* i robi to już na pierwszej klatce.
|
|
17
22
|
*
|
|
18
23
|
* @example
|
|
19
|
-
* <KptBottomSheet open={open} onOpenChange={setOpen} header="Udostępnij"
|
|
24
|
+
* <KptBottomSheet open={open} onOpenChange={setOpen} header="Udostępnij">...</KptBottomSheet>
|
|
20
25
|
*/
|
|
21
|
-
export declare function KptBottomSheet({ open, onOpenChange, header, closeOnBackdrop, locale, dictionary, className, children, ...rest }: Readonly<KptBottomSheetProps>): import("react").JSX.Element;
|
|
26
|
+
export declare function KptBottomSheet({ open, onOpenChange, header, ariaLabel, closeOnBackdrop, locale, dictionary, className, children, ...rest }: Readonly<KptBottomSheetProps>): import("react").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { useRef } from 'react';
|
|
3
4
|
import { cn } from "../internal/cn.js";
|
|
@@ -7,21 +8,21 @@ import { useKptMessages } from "../i18n/i18n-context.js";
|
|
|
7
8
|
/**
|
|
8
9
|
* Arkusz wysuwany z dołu ekranu.
|
|
9
10
|
*
|
|
10
|
-
* Arkusz zostaje w DOM także zamknięty
|
|
11
|
+
* Arkusz zostaje w DOM także zamknięty - chowa go `transform` i `visibility`, nigdy
|
|
11
12
|
* `display: none`, bo inaczej animacje wjazdu i zjazdu nie miałyby od czego wystartować.
|
|
12
13
|
* `visibility` wyjmuje go przy tym z kolejności Tab i z drzewa dostępności bez `inert`,
|
|
13
14
|
* i robi to już na pierwszej klatce.
|
|
14
15
|
*
|
|
15
16
|
* @example
|
|
16
|
-
* <KptBottomSheet open={open} onOpenChange={setOpen} header="Udostępnij"
|
|
17
|
+
* <KptBottomSheet open={open} onOpenChange={setOpen} header="Udostępnij">...</KptBottomSheet>
|
|
17
18
|
*/
|
|
18
|
-
export function KptBottomSheet({ open, onOpenChange, header = '', closeOnBackdrop = true, locale, dictionary, className, children, ...rest }) {
|
|
19
|
+
export function KptBottomSheet({ open, onOpenChange, header = '', ariaLabel = '', closeOnBackdrop = true, locale, dictionary, className, children, ...rest }) {
|
|
19
20
|
const { t } = useKptMessages({ locale, dictionary });
|
|
20
21
|
const close = () => onOpenChange(false);
|
|
21
22
|
const panelRef = useRef(null);
|
|
22
23
|
const titleId = useKptId(undefined, 'kpt-bottom-sheet-title');
|
|
23
24
|
useModalFocus(open, panelRef);
|
|
24
|
-
return (_jsxs("div", { className: cn('kpt-bottom-sheet-host', className), ...rest, children: [_jsx("div", { className: cn('kpt-bottom-sheet__backdrop', open && 'is-open'), onClick: () => closeOnBackdrop && close() }), _jsxs("div", { ref: panelRef, className: cn('kpt-bottom-sheet__panel', open && 'is-open'), role: "dialog", "aria-modal": "true", "aria-labelledby": header ? titleId : undefined, tabIndex: -1, onKeyDown: (event) => {
|
|
25
|
+
return (_jsxs("div", { className: cn('kpt-bottom-sheet-host', className), ...rest, children: [_jsx("div", { className: cn('kpt-bottom-sheet__backdrop', open && 'is-open'), onClick: () => closeOnBackdrop && close() }), _jsxs("div", { ref: panelRef, className: cn('kpt-bottom-sheet__panel', open && 'is-open'), role: "dialog", "aria-modal": "true", "aria-labelledby": header ? titleId : undefined, "aria-label": header ? undefined : ariaLabel || undefined, tabIndex: -1, onKeyDown: (event) => {
|
|
25
26
|
if (event.key === 'Escape')
|
|
26
27
|
close();
|
|
27
28
|
}, children: [_jsx("button", { type: "button", className: "kpt-bottom-sheet__handle", onClick: close, "aria-label": t('common.close') }), header ? (_jsx("div", { className: "kpt-bottom-sheet__header", id: titleId, children: header })) : null, _jsx("div", { className: "kpt-bottom-sheet__body", children: children })] })] }));
|
|
@@ -9,41 +9,44 @@ Import: `import { KptBottomSheet } from '@konce-pt/react';`
|
|
|
9
9
|
<div class="kpt-bottom-sheet__panel is-open" role="dialog" aria-modal="true" tabindex="-1">
|
|
10
10
|
<button class="kpt-bottom-sheet__handle"></button>
|
|
11
11
|
<div class="kpt-bottom-sheet__header">Share</div>
|
|
12
|
-
<div class="kpt-bottom-sheet__body"
|
|
12
|
+
<div class="kpt-bottom-sheet__body">...</div>
|
|
13
13
|
</div>
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
16
|
## Props
|
|
17
|
-
- `open`, `onOpenChange`
|
|
17
|
+
- `open`, `onOpenChange` - controlled, like `KptDialog`
|
|
18
18
|
- `header`: string
|
|
19
19
|
- `closeOnBackdrop`: boolean (default true)
|
|
20
|
-
- `children`
|
|
20
|
+
- `children` - the sheet's content
|
|
21
21
|
- `className`, `ref` and every other `<div>` prop go to the host
|
|
22
22
|
|
|
23
23
|
## The closed sheet stays in the DOM
|
|
24
|
-
It is hidden with `transform` and `visibility`, never `display: none`
|
|
24
|
+
It is hidden with `transform` and `visibility`, never `display: none` - the slide-in and slide-out
|
|
25
25
|
animations need something to run on. `visibility` also takes it out of the tab order and out of the
|
|
26
26
|
accessibility tree without `inert`, and does so on the very first frame, with no JavaScript.
|
|
27
27
|
`prefers-reduced-motion: reduce` drops the transitions.
|
|
28
28
|
|
|
29
29
|
## No portal
|
|
30
30
|
The panel and the backdrop are `position: fixed` and the host is `display: contents`, so the sheet
|
|
31
|
-
needs no portal
|
|
31
|
+
needs no portal - the same DOM as the Angular port. A transformed ancestor would break the fixed
|
|
32
32
|
positioning there too.
|
|
33
33
|
|
|
34
34
|
## Focus and keyboard
|
|
35
35
|
Opening moves focus into the panel (its first focusable element, else the panel
|
|
36
|
-
itself) and traps it there
|
|
36
|
+
itself) and traps it there - `Tab` / `Shift+Tab` wrap inside, as `aria-modal="true"` promises.
|
|
37
37
|
Closing returns focus to the element that had it before. `Escape` closes the panel. The panel
|
|
38
38
|
is named by its `header` through `aria-labelledby`. The shared helper is `internal/use-modal-focus.ts` (the Angular port has a twin on the CDK focus trap).
|
|
39
39
|
|
|
40
40
|
## Examples
|
|
41
41
|
<KptButton onClick={() => setOpen(true)}>Share</KptButton>
|
|
42
|
-
<KptBottomSheet open={open} onOpenChange={setOpen} header="Share"
|
|
42
|
+
<KptBottomSheet open={open} onOpenChange={setOpen} header="Share">...</KptBottomSheet>
|
|
43
43
|
|
|
44
44
|
## Tokens
|
|
45
45
|
The panel `--kpt-color-surface-raised`, the top radius `--kpt-radius-lg`, `--kpt-elevation-4`.
|
|
46
46
|
|
|
47
47
|
## Accessibility
|
|
48
48
|
`role="dialog"`, `aria-modal` and `aria-labelledby` pointing at the header; the handle is a real button
|
|
49
|
-
labelled from `common.close`. Focus handling
|
|
49
|
+
labelled from `common.close`. Focus handling - see "Focus and keyboard" above.
|
|
50
|
+
|
|
51
|
+
## Name and scrolling
|
|
52
|
+
Without `header` give the sheet `ariaLabel` - a `role="dialog"` without a name is announced as a bare "dialog". An open sheet locks page scrolling underneath.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef } from 'react';
|
|
2
|
+
import { type KptNavigateEvent } from '../shared/types.ts';
|
|
2
3
|
import { type KptI18nOverrides } from '../i18n/i18n-context.tsx';
|
|
3
4
|
export interface KptBreadcrumbItem {
|
|
4
5
|
label: string;
|
|
@@ -6,14 +7,19 @@ export interface KptBreadcrumbItem {
|
|
|
6
7
|
}
|
|
7
8
|
export interface KptBreadcrumbProps extends Omit<ComponentPropsWithRef<'div'>, 'children'>, KptI18nOverrides {
|
|
8
9
|
items?: readonly KptBreadcrumbItem[];
|
|
10
|
+
/**
|
|
11
|
+
* Zwykły klik w odnośnik. Aplikacja z routerem woła `event.preventDefault()` i nawiguje sama -
|
|
12
|
+
* bez tego `<a href>` przeładowuje stronę.
|
|
13
|
+
*/
|
|
14
|
+
onNavigate?: (event: KptNavigateEvent<KptBreadcrumbItem>) => void;
|
|
9
15
|
}
|
|
10
16
|
/**
|
|
11
17
|
* Ścieżka nawigacji (breadcrumbs).
|
|
12
18
|
*
|
|
13
|
-
* Ostatnia pozycja nigdy nie jest odnośnikiem, nawet gdy ma `url`
|
|
19
|
+
* Ostatnia pozycja nigdy nie jest odnośnikiem, nawet gdy ma `url` - to bieżąca strona, a link
|
|
14
20
|
* prowadzący w to samo miejsce, w którym już jesteś, tylko myli.
|
|
15
21
|
*
|
|
16
22
|
* @example
|
|
17
23
|
* <KptBreadcrumb items={[{ label: 'Start', url: '/' }, { label: 'Ustawienia' }]} />
|
|
18
24
|
*/
|
|
19
|
-
export declare function KptBreadcrumb({ items, locale, dictionary, className, ...rest }: Readonly<KptBreadcrumbProps>): import("react").JSX.Element;
|
|
25
|
+
export declare function KptBreadcrumb({ items, onNavigate, locale, dictionary, className, ...rest }: Readonly<KptBreadcrumbProps>): import("react").JSX.Element;
|
|
@@ -1,20 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { kptIsPlainClick } from "../shared/types.js";
|
|
2
4
|
import { cn } from "../internal/cn.js";
|
|
3
5
|
import { useKptMessages } from "../i18n/i18n-context.js";
|
|
4
6
|
import { KptIcon } from "../icon/icon.js";
|
|
5
7
|
/**
|
|
6
8
|
* Ścieżka nawigacji (breadcrumbs).
|
|
7
9
|
*
|
|
8
|
-
* Ostatnia pozycja nigdy nie jest odnośnikiem, nawet gdy ma `url`
|
|
10
|
+
* Ostatnia pozycja nigdy nie jest odnośnikiem, nawet gdy ma `url` - to bieżąca strona, a link
|
|
9
11
|
* prowadzący w to samo miejsce, w którym już jesteś, tylko myli.
|
|
10
12
|
*
|
|
11
13
|
* @example
|
|
12
14
|
* <KptBreadcrumb items={[{ label: 'Start', url: '/' }, { label: 'Ustawienia' }]} />
|
|
13
15
|
*/
|
|
14
|
-
export function KptBreadcrumb({ items = [], locale, dictionary, className, ...rest }) {
|
|
16
|
+
export function KptBreadcrumb({ items = [], onNavigate, locale, dictionary, className, ...rest }) {
|
|
15
17
|
const { t } = useKptMessages({ locale, dictionary });
|
|
18
|
+
/** Zwykły klik w odnośnik -> `onNavigate` (Ctrl/Cmd/Shift, środkowy przycisk i `_blank` zostają natywne). */
|
|
19
|
+
const linkClick = (event, item) => {
|
|
20
|
+
if (item.url && onNavigate && kptIsPlainClick(event, event.currentTarget.target)) {
|
|
21
|
+
onNavigate({ item, url: item.url, event: event.nativeEvent });
|
|
22
|
+
}
|
|
23
|
+
};
|
|
16
24
|
return (_jsx("div", { className: cn('kpt-breadcrumb-host', className), ...rest, children: _jsx("nav", { className: "kpt-breadcrumb", "aria-label": t('breadcrumb.label'), children: _jsx("ol", { className: "kpt-breadcrumb__list", children: items.map((item, index) => {
|
|
17
25
|
const last = index === items.length - 1;
|
|
18
|
-
return (_jsxs("li", { className: "kpt-breadcrumb__item", children: [item.url && !last ? (_jsx("a", { className: "kpt-breadcrumb__link", href: item.url, children: item.label })) : (_jsx("span", { className: "kpt-breadcrumb__current", "aria-current": last ? 'page' : undefined, children: item.label })), last ? null : _jsx(KptIcon, { name: "chevron-right", className: "kpt-breadcrumb__sep" })] }, index));
|
|
26
|
+
return (_jsxs("li", { className: "kpt-breadcrumb__item", children: [item.url && !last ? (_jsx("a", { className: "kpt-breadcrumb__link", href: item.url, onClick: (event) => linkClick(event, item), children: item.label })) : (_jsx("span", { className: "kpt-breadcrumb__current", "aria-current": last ? 'page' : undefined, children: item.label })), last ? null : _jsx(KptIcon, { name: "chevron-right", className: "kpt-breadcrumb__sep" })] }, `${index}-${item.url ?? item.label}`));
|
|
19
27
|
}) }) }) }));
|
|
20
28
|
}
|
package/dist/breadcrumb/llms.txt
CHANGED
|
@@ -8,7 +8,7 @@ A breadcrumb trail. Import: `import { KptBreadcrumb } from '@konce-pt/react';`
|
|
|
8
8
|
<ol class="kpt-breadcrumb__list">
|
|
9
9
|
<li class="kpt-breadcrumb__item">
|
|
10
10
|
<a class="kpt-breadcrumb__link" href="/">Home</a>
|
|
11
|
-
<span class="kpt-icon-host kpt-breadcrumb__sep"
|
|
11
|
+
<span class="kpt-icon-host kpt-breadcrumb__sep">...</span>
|
|
12
12
|
</li>
|
|
13
13
|
<li class="kpt-breadcrumb__item">
|
|
14
14
|
<span class="kpt-breadcrumb__current" aria-current="page">Showcase</span>
|
|
@@ -19,7 +19,7 @@ A breadcrumb trail. Import: `import { KptBreadcrumb } from '@konce-pt/react';`
|
|
|
19
19
|
|
|
20
20
|
## Props
|
|
21
21
|
- `items`: `{ label, url? }[]`
|
|
22
|
-
- `locale`, `dictionary`
|
|
22
|
+
- `locale`, `dictionary` - i18n overrides for this component only
|
|
23
23
|
- `className`, `ref` and every other `<div>` prop go to the host
|
|
24
24
|
|
|
25
25
|
## The last item is never a link
|
|
@@ -40,3 +40,11 @@ The nav label comes from `breadcrumb.label` in the dictionary.
|
|
|
40
40
|
A `<nav>` landmark labelled from `breadcrumb.label`, holding an ordered list (`<ol>`/`<li>`), so a
|
|
41
41
|
screen reader announces how many levels the trail has. The current page carries
|
|
42
42
|
`aria-current="page"`; separators are icons hidden from assistive technology.
|
|
43
|
+
|
|
44
|
+
## Router
|
|
45
|
+
Links are plain `<a href>`, so without a router a click reloads the page. `onNavigate` fires on a plain
|
|
46
|
+
click (left button, no Ctrl/Cmd/Shift, no `target="_blank"`) with `{ item, url, event }`: call
|
|
47
|
+
`event.preventDefault()` and navigate with your router. Modified clicks stay native (a new tab, a new
|
|
48
|
+
window). The library depends on no router.
|
|
49
|
+
|
|
50
|
+
<KptBreadcrumb items={items} onNavigate={({ event, url }) => { event.preventDefault(); navigate(url); }} />
|
package/dist/button/button.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface KptButtonProps extends Omit<ComponentPropsWithRef<'button'>, 'h
|
|
|
13
13
|
fullWidth?: boolean;
|
|
14
14
|
/** Nazwa ikony wiodącej z rejestru (`KptIconRegistry`). */
|
|
15
15
|
icon?: string;
|
|
16
|
-
/** Nazwa ikony zamykającej
|
|
16
|
+
/** Nazwa ikony zamykającej - zwykle znacznik kierunku, nie akcja. */
|
|
17
17
|
iconEnd?: string;
|
|
18
18
|
/** Klasa dokładana do ikony wiodącej; obok stałego haka `.kpt-button__icon`. */
|
|
19
19
|
iconClassName?: string;
|
|
@@ -27,10 +27,10 @@ export interface KptButtonProps extends Omit<ComponentPropsWithRef<'button'>, 'h
|
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Przycisk Koncept UI. Renderuje natywny `<button>` (semantyka + submit formularza)
|
|
30
|
-
* albo `<a>`, gdy podasz `href`
|
|
30
|
+
* albo `<a>`, gdy podasz `href` - w hoście `.kpt-button-host`, czyli dwa poziomy DOM,
|
|
31
31
|
* dokładnie jak w porcie Angulara, bo host niesie własne style.
|
|
32
32
|
*
|
|
33
|
-
* Ikonę można podać nazwą (`icon`/`iconEnd`) albo wstawić w `children`
|
|
33
|
+
* Ikonę można podać nazwą (`icon`/`iconEnd`) albo wstawić w `children` - oba sposoby
|
|
34
34
|
* dostają ten sam odstęp i tę samą skalę. Przy `loading` spinner zajmuje miejsce ikony wiodącej.
|
|
35
35
|
*
|
|
36
36
|
* @example
|
package/dist/button/button.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { isValidElement } from 'react';
|
|
3
4
|
import { cn } from "../internal/cn.js";
|
|
@@ -5,10 +6,10 @@ import { renderAsChild } from "../internal/slot.js";
|
|
|
5
6
|
import { KptIcon } from "../icon/icon.js";
|
|
6
7
|
/**
|
|
7
8
|
* Przycisk Koncept UI. Renderuje natywny `<button>` (semantyka + submit formularza)
|
|
8
|
-
* albo `<a>`, gdy podasz `href`
|
|
9
|
+
* albo `<a>`, gdy podasz `href` - w hoście `.kpt-button-host`, czyli dwa poziomy DOM,
|
|
9
10
|
* dokładnie jak w porcie Angulara, bo host niesie własne style.
|
|
10
11
|
*
|
|
11
|
-
* Ikonę można podać nazwą (`icon`/`iconEnd`) albo wstawić w `children`
|
|
12
|
+
* Ikonę można podać nazwą (`icon`/`iconEnd`) albo wstawić w `children` - oba sposoby
|
|
12
13
|
* dostają ten sam odstęp i tę samą skalę. Przy `loading` spinner zajmuje miejsce ikony wiodącej.
|
|
13
14
|
*
|
|
14
15
|
* @example
|
|
@@ -21,14 +22,14 @@ import { KptIcon } from "../icon/icon.js";
|
|
|
21
22
|
export function KptButton({ variant = 'filled', size = 'md', type = 'button', loading = false, fullWidth = false, disabled = false, asChild = false, icon, iconEnd, iconClassName, iconEndClassName, href, target, rel, hostProps, className, children, ...rest }) {
|
|
22
23
|
const { className: hostClassName, ...hostRest } = hostProps ?? {};
|
|
23
24
|
const isDisabled = disabled || loading;
|
|
24
|
-
// Zawartość jest identyczna we wszystkich trybach
|
|
25
|
+
// Zawartość jest identyczna we wszystkich trybach - w `asChild` podmieniamy tylko element
|
|
25
26
|
// zewnętrzny, nie strukturę środka, żeby SCSS (`__spinner`, `__content`) dalej działał.
|
|
26
27
|
const content = (_jsxs(_Fragment, { children: [loading ? (_jsx("span", { className: "kpt-button__spinner", "aria-hidden": "true" })) : icon ? (_jsx(KptIcon, { className: cn('kpt-button__icon', iconClassName), name: icon })) : null, _jsx("span", { className: "kpt-button__content", children: asChildContent(asChild, children) }), iconEnd ? (_jsx(KptIcon, { className: cn('kpt-button__icon', 'kpt-button__icon--end', iconEndClassName), name: iconEnd })) : null] }));
|
|
27
28
|
const buttonProps = {
|
|
28
29
|
className: cn('kpt-button', loading && 'kpt-button--loading', className),
|
|
29
30
|
'data-variant': variant,
|
|
30
31
|
'data-size': size,
|
|
31
|
-
// React serializuje atrybuty aria-* z booleana na "true"/"false"
|
|
32
|
+
// React serializuje atrybuty aria-* z booleana na "true"/"false" - wynikowy DOM
|
|
32
33
|
// ma `aria-busy="true"`, tak jak port Angulara.
|
|
33
34
|
'aria-busy': loading || undefined,
|
|
34
35
|
...rest,
|
|
@@ -36,7 +37,7 @@ export function KptButton({ variant = 'filled', size = 'md', type = 'button', lo
|
|
|
36
37
|
return (_jsx("span", { className: cn('kpt-button-host', fullWidth && 'kpt-button-host--full', hostClassName), ...hostRest, children: renderInner({ asChild, children, buttonProps, content, href, target, rel, type, isDisabled }) }));
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
39
|
-
* Element wewnętrzny. `asChild` ma pierwszeństwo przed `href`
|
|
40
|
+
* Element wewnętrzny. `asChild` ma pierwszeństwo przed `href` - kto podstawia własny
|
|
40
41
|
* element, ten decyduje o znaczniku.
|
|
41
42
|
*/
|
|
42
43
|
function renderInner(args) {
|
|
@@ -46,17 +47,17 @@ function renderInner(args) {
|
|
|
46
47
|
}
|
|
47
48
|
if (href !== undefined) {
|
|
48
49
|
return (_jsx("a", {
|
|
49
|
-
// Wyłączony odnośnik traci `href`, a nie tylko dostaje atrybut
|
|
50
|
+
// Wyłączony odnośnik traci `href`, a nie tylko dostaje atrybut - inaczej dałoby się go
|
|
50
51
|
// kliknąć i wejść na niego z klawiatury.
|
|
51
52
|
href: isDisabled ? undefined : href, target: target,
|
|
52
|
-
// `target="_blank"` bez `rel` to wektor na `window.opener`
|
|
53
|
-
rel: rel ?? (target === '_blank' ? 'noopener noreferrer' : undefined), "aria-disabled": isDisabled || undefined, tabIndex: isDisabled ? -1 : undefined, ...buttonProps, children: content }));
|
|
53
|
+
// `target="_blank"` bez `rel` to wektor na `window.opener` - dokładamy domyślne.
|
|
54
|
+
rel: rel ?? (target === '_blank' ? 'noopener noreferrer' : undefined), "aria-disabled": isDisabled || undefined, tabIndex: isDisabled ? -1 : undefined, ...(buttonProps), children: content }));
|
|
54
55
|
}
|
|
55
56
|
return (_jsx("button", { type: type, disabled: isDisabled, ...buttonProps, children: content }));
|
|
56
57
|
}
|
|
57
58
|
/**
|
|
58
59
|
* Stan wyłączenia dla podstawionego elementu. Natywny `<button>` dostaje `disabled`
|
|
59
|
-
* (SCSS stylizuje `:disabled`); każdy inny element
|
|
60
|
+
* (SCSS stylizuje `:disabled`); każdy inny element - `aria-disabled`, bo `disabled`
|
|
60
61
|
* nie ma tam znaczenia.
|
|
61
62
|
*/
|
|
62
63
|
function disabledProps(child, isDisabled) {
|
package/dist/button/llms.txt
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# KptButton (@konce-pt/react)
|
|
2
2
|
|
|
3
|
-
The Koncept UI button. It renders a native `<button>` (semantics + form submit)
|
|
4
|
-
you pass `href`
|
|
3
|
+
The Koncept UI button. It renders a native `<button>` (semantics + form submit) - or an `<a>` when
|
|
4
|
+
you pass `href` - inside a `.kpt-button-host` wrapper: two DOM levels, exactly like the Angular port,
|
|
5
5
|
because the host carries its own styles. Import: `import { KptButton } from '@konce-pt/react';`
|
|
6
6
|
|
|
7
7
|
## DOM
|
|
8
8
|
<span class="kpt-button-host">
|
|
9
9
|
<button class="kpt-button" type="button" data-variant="filled" data-size="md">
|
|
10
|
-
<span class="kpt-button__icon kpt-icon-host"
|
|
11
|
-
<span class="kpt-button__content"
|
|
12
|
-
<span class="kpt-button__icon kpt-button__icon--end kpt-icon-host"
|
|
10
|
+
<span class="kpt-button__icon kpt-icon-host">...</span>
|
|
11
|
+
<span class="kpt-button__content">...</span>
|
|
12
|
+
<span class="kpt-button__icon kpt-button__icon--end kpt-icon-host">...</span>
|
|
13
13
|
</button>
|
|
14
14
|
</span>
|
|
15
15
|
|
|
@@ -18,39 +18,39 @@ because the host carries its own styles. Import: `import { KptButton } from '@ko
|
|
|
18
18
|
- `size`: 'xs' | 'sm' | 'md' | 'lg' | 'xl' (default 'md')
|
|
19
19
|
- `type`: 'button' | 'submit' | 'reset' (default 'button')
|
|
20
20
|
- `disabled`: boolean
|
|
21
|
-
- `loading`: boolean
|
|
22
|
-
- `fullWidth`: boolean
|
|
23
|
-
- `icon` / `iconEnd`: string
|
|
24
|
-
- `iconClassName` / `iconEndClassName`: string
|
|
25
|
-
- `href`, `target`, `rel`: string
|
|
26
|
-
- `asChild`: boolean
|
|
21
|
+
- `loading`: boolean - a spinner + blocked interaction, sets `aria-busy`
|
|
22
|
+
- `fullWidth`: boolean - the full width of the container
|
|
23
|
+
- `icon` / `iconEnd`: string - a name from the icon registry
|
|
24
|
+
- `iconClassName` / `iconEndClassName`: string - an extra class on that icon
|
|
25
|
+
- `href`, `target`, `rel`: string - render an `<a>` instead of a `<button>`
|
|
26
|
+
- `asChild`: boolean - render the single child instead of `<button>`, keeping every class
|
|
27
27
|
- `hostProps`: props for the `.kpt-button-host` wrapper
|
|
28
28
|
- `className`, `ref` and every other `<button>` prop go to the INNER element
|
|
29
29
|
|
|
30
30
|
## Events
|
|
31
|
-
No events of its own
|
|
31
|
+
No events of its own - bind `onClick` and it lands on the native `<button>`.
|
|
32
32
|
|
|
33
33
|
## Icons
|
|
34
34
|
Two ways in, one result. `icon` and `iconEnd` take a name from the icon registry and the component
|
|
35
35
|
renders it; anything put in `children` is laid out the same way. Both get the gap from
|
|
36
|
-
`--kpt-button-gap` and a size that follows `size` (0.875rem at `xs` up to 1.5rem at `xl`)
|
|
36
|
+
`--kpt-button-gap` and a size that follows `size` (0.875rem at `xs` up to 1.5rem at `xl`) - the
|
|
37
37
|
content box is a flex container, so an icon sits on the centre line rather than on the text baseline.
|
|
38
38
|
|
|
39
39
|
`loading` replaces the leading icon with the spinner instead of standing next to it, and the
|
|
40
40
|
spinner takes that icon's size, so the label does not jump when loading starts. The trailing icon
|
|
41
|
-
stays put
|
|
41
|
+
stays put - it usually marks direction rather than the action.
|
|
42
42
|
|
|
43
43
|
`iconClassName` / `iconEndClassName` add a class next to the permanent `.kpt-button__icon` hook, for
|
|
44
44
|
the cases where one instance needs a different colour or a rotation.
|
|
45
45
|
|
|
46
46
|
## Link and the `link` variant
|
|
47
|
-
Two different things. `variant="link"` only changes the looks
|
|
47
|
+
Two different things. `variant="link"` only changes the looks - underline, transparent background,
|
|
48
48
|
no side padding, so it sits inside a sentence. `href` changes the element: the component renders
|
|
49
49
|
`<a class="kpt-button">` instead of `<button>`, and the two combine freely (a filled button can be
|
|
50
50
|
a link, a `link` variant can be a plain button). `asChild` wins over `href`: whoever substitutes
|
|
51
51
|
their own element decides the tag.
|
|
52
52
|
|
|
53
|
-
A disabled link loses its `href` rather than just gaining an attribute
|
|
53
|
+
A disabled link loses its `href` rather than just gaining an attribute - otherwise it would stay
|
|
54
54
|
clickable and reachable with the keyboard; it also gets `aria-disabled="true"` and `tabindex="-1"`.
|
|
55
55
|
`target="_blank"` without an explicit `rel` gets `rel="noopener noreferrer"`.
|
|
56
56
|
|
|
@@ -68,9 +68,17 @@ clickable and reachable with the keyboard; it also gets `aria-disabled="true"` a
|
|
|
68
68
|
## asChild
|
|
69
69
|
The wrapper is still rendered; only the inner element is swapped. The content stays wrapped in
|
|
70
70
|
`.kpt-button__content`, so the spinner and the layout keep working. A disabled substituted
|
|
71
|
-
element gets `disabled` when it is a native `<button>`, and `aria-disabled` otherwise
|
|
71
|
+
element gets `disabled` when it is a native `<button>`, and `aria-disabled` otherwise - an
|
|
72
72
|
element with no `:disabled` state therefore does not get the dimmed look.
|
|
73
73
|
|
|
74
|
+
## Motion
|
|
75
|
+
Pressed, it squeezes slightly and springs back on release (shared mixin `styles/_press.scss`). Entering `loading` pops the spinner in where the leading icon was
|
|
76
|
+
and dims the label. `link` does not squeeze (text in a sentence would jitter): its colour and
|
|
77
|
+
underline change smoothly and it dims while pressed. `elevated` lifts on hover and is pressed down
|
|
78
|
+
(the shadow shrinks smoothly). A pressed button uses its own variant's hover colour - only `filled` has
|
|
79
|
+
a separate pressed colour. Pure CSS; durations follow `--kpt-motion-scale`, so `enabled: false` turns it off, and it drops out
|
|
80
|
+
under "reduce motion".
|
|
81
|
+
|
|
74
82
|
## Tokens (styling)
|
|
75
83
|
`--kpt-button-radius`, `--kpt-button-font-weight`, `--kpt-button-gap`, and one group per variant:
|
|
76
84
|
`--kpt-button-filled-{bg,fg,bg-hover,bg-active}`, `--kpt-button-elevated-{bg,fg,bg-hover}`,
|
|
@@ -80,13 +88,13 @@ element with no `:disabled` state therefore does not get the dimmed look.
|
|
|
80
88
|
The elevated variant also reaches for `--kpt-shadow-sm` and `--kpt-shadow-md`.
|
|
81
89
|
|
|
82
90
|
## The state layer (hover / active)
|
|
83
|
-
Hover and active feedback is carried by an `::after` pseudo-element (`opacity` 0
|
|
91
|
+
Hover and active feedback is carried by an `::after` pseudo-element (`opacity` 0 -> 1), not by
|
|
84
92
|
animating the button's own `background-color`. The CSS is shared with the Angular port, where
|
|
85
93
|
the pattern was introduced to stop the variant flicker on first paint; here it simply comes
|
|
86
94
|
along with the stylesheet.
|
|
87
95
|
|
|
88
96
|
## Accessibility
|
|
89
|
-
- A native `<button>`
|
|
97
|
+
- A native `<button>` - full keyboard and screen reader support.
|
|
90
98
|
- `loading` sets `aria-busy="true"` and disables the button.
|
|
91
99
|
- An `<a>` matches no `:disabled`, so the disabled look keys off `[aria-disabled='true']` as well.
|
|
92
100
|
- The focus ring comes from `@konce-pt/styles` (`--kpt-color-focus-ring`).
|