@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/dialog/llms.txt
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
# KptDialog (@konce-pt/react)
|
|
2
2
|
|
|
3
|
-
A modal window on a native `<dialog>`
|
|
3
|
+
A modal window on a native `<dialog>` - the focus trap, Escape and the backdrop come from the
|
|
4
4
|
platform, not from our code. Import: `import { KptDialog } from '@konce-pt/react';`
|
|
5
5
|
|
|
6
6
|
## DOM
|
|
7
7
|
<dialog class="kpt-dialog">
|
|
8
8
|
<div class="kpt-dialog__header">
|
|
9
9
|
<h2 class="kpt-dialog__title">Delete record?</h2>
|
|
10
|
-
<button class="kpt-dialog__close" type="button" aria-label="Close"
|
|
10
|
+
<button class="kpt-dialog__close" type="button" aria-label="Close">...</button>
|
|
11
11
|
</div>
|
|
12
|
-
<div class="kpt-dialog__body"
|
|
13
|
-
<div kptdialogfooter=""
|
|
12
|
+
<div class="kpt-dialog__body">...children...</div>
|
|
13
|
+
<div kptdialogfooter="">...footer...</div>
|
|
14
14
|
</dialog>
|
|
15
15
|
|
|
16
16
|
## Props
|
|
17
|
-
- `open`: boolean, `onOpenChange(open)`
|
|
17
|
+
- `open`: boolean, `onOpenChange(open)` - the dialog is always controlled; the browser can close it
|
|
18
18
|
on its own (Escape, the `close` event), and the state has to follow
|
|
19
|
-
- `header`: string
|
|
20
|
-
- `dismissible`: boolean (default true)
|
|
19
|
+
- `header`: string - the title; with no header there is no header row and no x button
|
|
20
|
+
- `dismissible`: boolean (default true) - allows Escape and shows x
|
|
21
21
|
- `className`, `ref` and every other `<dialog>` prop go to the dialog
|
|
22
22
|
|
|
23
23
|
## Sub-components
|
|
24
|
-
- `KptDialog.Footer`
|
|
24
|
+
- `KptDialog.Footer` - lifted below the body; carries the `kptdialogfooter` attribute the shared
|
|
25
25
|
SCSS targets.
|
|
26
26
|
|
|
27
27
|
## An overlay inside a modal
|
|
28
|
-
`showModal()` lifts the dialog into the browser's TOP LAYER, which sits above the whole document
|
|
28
|
+
`showModal()` lifts the dialog into the browser's TOP LAYER, which sits above the whole document -
|
|
29
29
|
no `z-index` beats it. A `KptSelect` or `KptMenu` panel portalled to `document.body` would open
|
|
30
30
|
INVISIBLE, hidden behind the modal backdrop. While it is open, `KptDialog` therefore makes itself
|
|
31
31
|
the overlay container (through `KptOverlayContainerContext`), so those panels portal INSIDE the
|
|
@@ -47,7 +47,10 @@ dialog; the mechanism differs, the result does not.
|
|
|
47
47
|
|
|
48
48
|
## Accessibility
|
|
49
49
|
A native `<dialog>` opened with `showModal()`: focus moves inside and is trapped, the rest of the
|
|
50
|
-
page becomes inert, and Escape closes it
|
|
50
|
+
page becomes inert, and Escape closes it - all from the browser. With `dismissible={false}` the
|
|
51
51
|
`cancel` event is prevented, so Escape stops working; give the user another way out.
|
|
52
52
|
With `header` the dialog is named by its title (`aria-labelledby`); without one pass `aria-label`.
|
|
53
53
|
`role="alertdialog"` and `aria-describedby` go straight through as `<dialog>` props.
|
|
54
|
+
|
|
55
|
+
## Scrolling and non-dismissible windows
|
|
56
|
+
An open window locks page scrolling underneath (a shared counter with drawers and bottom sheets, so nested windows do not release each other). With `dismissible` off the window gets `closedby="none"`, and if a browser still closes it on a gesture (Chromium lets the second Escape in a row through `cancel`), it is reopened - only code can close it.
|
|
@@ -4,6 +4,11 @@ export interface KptDividerProps extends Omit<ComponentPropsWithRef<'div'>, 'chi
|
|
|
4
4
|
orientation?: KptDividerOrientation;
|
|
5
5
|
/** Wcięcie (odstęp od krawędzi kontenera). */
|
|
6
6
|
inset?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Linia czysto ozdobna (np. między kartami, które i tak są osobnymi regionami) - bez
|
|
9
|
+
* `role="separator"`, ukryta przed czytnikiem. Domyślnie separator jest ogłaszany.
|
|
10
|
+
*/
|
|
11
|
+
decorative?: boolean;
|
|
7
12
|
}
|
|
8
13
|
/**
|
|
9
14
|
* Separator (linia pozioma lub pionowa). Kolor z `--kpt-color-border`.
|
|
@@ -12,5 +17,6 @@ export interface KptDividerProps extends Omit<ComponentPropsWithRef<'div'>, 'chi
|
|
|
12
17
|
* <KptDivider />
|
|
13
18
|
* <KptDivider orientation="vertical" />
|
|
14
19
|
* <KptDivider inset />
|
|
20
|
+
* <KptDivider decorative />
|
|
15
21
|
*/
|
|
16
|
-
export declare function KptDivider({ orientation, inset, className, ...rest }: Readonly<KptDividerProps>): import("react").JSX.Element;
|
|
22
|
+
export declare function KptDivider({ orientation, inset, decorative, className, ...rest }: Readonly<KptDividerProps>): import("react").JSX.Element;
|
package/dist/divider/divider.js
CHANGED
|
@@ -7,7 +7,8 @@ import { cn } from "../internal/cn.js";
|
|
|
7
7
|
* <KptDivider />
|
|
8
8
|
* <KptDivider orientation="vertical" />
|
|
9
9
|
* <KptDivider inset />
|
|
10
|
+
* <KptDivider decorative />
|
|
10
11
|
*/
|
|
11
|
-
export function KptDivider({ orientation = 'horizontal', inset = false, className, ...rest }) {
|
|
12
|
-
return (_jsx("div", { className: cn('kpt-divider', inset && 'kpt-divider--inset', className), role:
|
|
12
|
+
export function KptDivider({ orientation = 'horizontal', inset = false, decorative = false, className, ...rest }) {
|
|
13
|
+
return (_jsx("div", { className: cn('kpt-divider', inset && 'kpt-divider--inset', className), role: decorative ? 'none' : 'separator', "aria-orientation": decorative ? undefined : orientation, "aria-hidden": decorative || undefined, "data-orientation": orientation, ...rest }));
|
|
13
14
|
}
|
package/dist/divider/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# KptDivider (@konce-pt/react)
|
|
2
2
|
|
|
3
|
-
A separator
|
|
3
|
+
A separator - a horizontal or vertical line. Colour from `--kpt-color-border`.
|
|
4
4
|
Import: `import { KptDivider } from '@konce-pt/react';`
|
|
5
5
|
|
|
6
6
|
## DOM
|
|
@@ -8,12 +8,13 @@ Import: `import { KptDivider } from '@konce-pt/react';`
|
|
|
8
8
|
|
|
9
9
|
## Props
|
|
10
10
|
- `orientation`: 'horizontal' | 'vertical' (default 'horizontal')
|
|
11
|
-
- `inset`: boolean
|
|
11
|
+
- `inset`: boolean - an indent from the container edges
|
|
12
|
+
- `decorative`: boolean - a purely ornamental line: no `role="separator"`, hidden from screen readers
|
|
12
13
|
- `className`, `ref` and every other `<div>` prop go to the divider
|
|
13
14
|
|
|
14
15
|
## Vertical needs a flex parent
|
|
15
16
|
The vertical variant stretches to the height of its container, so it only makes sense inside a
|
|
16
|
-
flex row
|
|
17
|
+
flex row - on its own it has nothing to measure against and collapses to nothing.
|
|
17
18
|
|
|
18
19
|
## Examples
|
|
19
20
|
<KptDivider />
|
package/dist/drawer/drawer.d.ts
CHANGED
|
@@ -6,7 +6,12 @@ export interface KptDrawerProps extends Omit<ComponentPropsWithRef<'div'>, 'onCh
|
|
|
6
6
|
onOpenChange: (open: boolean) => void;
|
|
7
7
|
position?: KptDrawerPosition;
|
|
8
8
|
header?: string;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Nazwa panelu bez `header` - okno dialogowe bez nazwy czytnik ogłasza jako samo "okno
|
|
11
|
+
* dialogowe" (WCAG 4.1.2). Z nagłówkiem nazwą jest nagłówek (`aria-labelledby`).
|
|
12
|
+
*/
|
|
13
|
+
ariaLabel?: string;
|
|
14
|
+
/** Pokazuje przycisk x i pozwala zamknąć klawiszem Escape. */
|
|
10
15
|
dismissible?: boolean;
|
|
11
16
|
closeOnBackdrop?: boolean;
|
|
12
17
|
children?: ReactNode;
|
|
@@ -14,12 +19,12 @@ export interface KptDrawerProps extends Omit<ComponentPropsWithRef<'div'>, 'onCh
|
|
|
14
19
|
/**
|
|
15
20
|
* Panel wysuwany (drawer / off-canvas), niezależny od app-shell.
|
|
16
21
|
*
|
|
17
|
-
* Panel i backdrop są zawsze w DOM, a o widoczności decyduje klasa `is-open`
|
|
22
|
+
* Panel i backdrop są zawsze w DOM, a o widoczności decyduje klasa `is-open` - dzięki temu
|
|
18
23
|
* wysunięcie i schowanie da się animować, tak samo jak w porcie Angulara.
|
|
19
24
|
*
|
|
20
25
|
* @example
|
|
21
26
|
* <KptDrawer open={open} onOpenChange={setOpen} position="right" header="Filtry">
|
|
22
|
-
* Treść panelu
|
|
27
|
+
* Treść panelu...
|
|
23
28
|
* </KptDrawer>
|
|
24
29
|
*/
|
|
25
|
-
export declare function KptDrawer({ open, onOpenChange, position, header, dismissible, closeOnBackdrop, locale, dictionary, className, children, ...rest }: Readonly<KptDrawerProps>): import("react").JSX.Element;
|
|
30
|
+
export declare function KptDrawer({ open, onOpenChange, position, header, ariaLabel, dismissible, closeOnBackdrop, locale, dictionary, className, children, ...rest }: Readonly<KptDrawerProps>): import("react").JSX.Element;
|
package/dist/drawer/drawer.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { useCallback, useRef } from 'react';
|
|
3
4
|
import { cn } from "../internal/cn.js";
|
|
@@ -8,15 +9,15 @@ import { KptIcon } from "../icon/icon.js";
|
|
|
8
9
|
/**
|
|
9
10
|
* Panel wysuwany (drawer / off-canvas), niezależny od app-shell.
|
|
10
11
|
*
|
|
11
|
-
* Panel i backdrop są zawsze w DOM, a o widoczności decyduje klasa `is-open`
|
|
12
|
+
* Panel i backdrop są zawsze w DOM, a o widoczności decyduje klasa `is-open` - dzięki temu
|
|
12
13
|
* wysunięcie i schowanie da się animować, tak samo jak w porcie Angulara.
|
|
13
14
|
*
|
|
14
15
|
* @example
|
|
15
16
|
* <KptDrawer open={open} onOpenChange={setOpen} position="right" header="Filtry">
|
|
16
|
-
* Treść panelu
|
|
17
|
+
* Treść panelu...
|
|
17
18
|
* </KptDrawer>
|
|
18
19
|
*/
|
|
19
|
-
export function KptDrawer({ open, onOpenChange, position = 'left', header = '', dismissible = true, closeOnBackdrop = true, locale, dictionary, className, children, ...rest }) {
|
|
20
|
+
export function KptDrawer({ open, onOpenChange, position = 'left', header = '', ariaLabel = '', dismissible = true, closeOnBackdrop = true, locale, dictionary, className, children, ...rest }) {
|
|
20
21
|
const { t } = useKptMessages({ locale, dictionary });
|
|
21
22
|
const close = useCallback(() => onOpenChange(false), [onOpenChange]);
|
|
22
23
|
const panelRef = useRef(null);
|
|
@@ -26,5 +27,5 @@ export function KptDrawer({ open, onOpenChange, position = 'left', header = '',
|
|
|
26
27
|
if (event.key === 'Escape' && dismissible)
|
|
27
28
|
close();
|
|
28
29
|
};
|
|
29
|
-
return (_jsxs("div", { className: cn('kpt-drawer-host', className), ...rest, children: [_jsx("div", { className: cn('kpt-drawer__backdrop', open && 'is-open'), onClick: () => closeOnBackdrop && close() }), _jsxs("aside", { ref: panelRef, className: cn('kpt-drawer__panel', open && 'is-open'), "data-position": position, role: "dialog", "aria-modal": "true", "aria-labelledby": header ? titleId : undefined, tabIndex: -1, onKeyDown: onKeyDown, children: [header || dismissible ? (_jsxs("div", { className: "kpt-drawer__header", children: [_jsx("span", { className: "kpt-drawer__title", id: titleId, children: header }), dismissible ? (_jsx("button", { type: "button", className: "kpt-drawer__close", onClick: close, "aria-label": t('common.close'), children: _jsx(KptIcon, { name: "x" }) })) : null] })) : null, _jsx("div", { className: "kpt-drawer__body", children: children })] })] }));
|
|
30
|
+
return (_jsxs("div", { className: cn('kpt-drawer-host', className), ...rest, children: [_jsx("div", { className: cn('kpt-drawer__backdrop', open && 'is-open'), onClick: () => closeOnBackdrop && close() }), _jsxs("aside", { ref: panelRef, className: cn('kpt-drawer__panel', open && 'is-open'), "data-position": position, role: "dialog", "aria-modal": "true", "aria-labelledby": header ? titleId : undefined, "aria-label": header ? undefined : ariaLabel || undefined, tabIndex: -1, onKeyDown: onKeyDown, children: [header || dismissible ? (_jsxs("div", { className: "kpt-drawer__header", children: [_jsx("span", { className: "kpt-drawer__title", id: titleId, children: header }), dismissible ? (_jsx("button", { type: "button", className: "kpt-drawer__close", onClick: close, "aria-label": t('common.close'), children: _jsx(KptIcon, { name: "x" }) })) : null] })) : null, _jsx("div", { className: "kpt-drawer__body", children: children })] })] }));
|
|
30
31
|
}
|
package/dist/drawer/llms.txt
CHANGED
|
@@ -9,38 +9,38 @@ Import: `import { KptDrawer } from '@konce-pt/react';`
|
|
|
9
9
|
<aside class="kpt-drawer__panel is-open" data-position="right" role="dialog" aria-modal="true" tabindex="-1">
|
|
10
10
|
<div class="kpt-drawer__header">
|
|
11
11
|
<span class="kpt-drawer__title">Filters</span>
|
|
12
|
-
<button class="kpt-drawer__close" type="button" aria-label="Close"
|
|
12
|
+
<button class="kpt-drawer__close" type="button" aria-label="Close">...</button>
|
|
13
13
|
</div>
|
|
14
|
-
<div class="kpt-drawer__body"
|
|
14
|
+
<div class="kpt-drawer__body">...children...</div>
|
|
15
15
|
</aside>
|
|
16
16
|
</div>
|
|
17
17
|
|
|
18
18
|
## Props
|
|
19
|
-
- `open`: boolean, `onOpenChange(open)`
|
|
19
|
+
- `open`: boolean, `onOpenChange(open)` - controlled
|
|
20
20
|
- `position`: 'left' | 'right' | 'top' | 'bottom' (default 'left')
|
|
21
21
|
- `header`: string
|
|
22
|
-
- `dismissible`: boolean (default true)
|
|
22
|
+
- `dismissible`: boolean (default true) - shows x and lets Escape close it
|
|
23
23
|
- `closeOnBackdrop`: boolean (default true)
|
|
24
24
|
- `className`, `ref` and every other `<div>` prop go to the host
|
|
25
25
|
|
|
26
26
|
## Always in the DOM
|
|
27
27
|
The panel and the backdrop are always rendered; only the `is-open` class decides what is visible.
|
|
28
|
-
That is what makes the slide animatable
|
|
28
|
+
That is what makes the slide animatable - mounting the panel on open would give the transition
|
|
29
29
|
nothing to animate from.
|
|
30
30
|
|
|
31
31
|
## Not a native modal
|
|
32
32
|
Unlike `KptDialog` this is a plain `<aside role="dialog" aria-modal="true">`, not a native
|
|
33
|
-
`<dialog>`
|
|
33
|
+
`<dialog>` - the focus handling below is done by the component, not by the browser.
|
|
34
34
|
|
|
35
35
|
## Focus and keyboard
|
|
36
36
|
Opening moves focus into the panel (its first focusable element, else the panel
|
|
37
|
-
itself) and traps it there
|
|
38
|
-
Closing returns focus to the element that had it before. `Escape` closes the panel
|
|
37
|
+
itself) and traps it there - `Tab` / `Shift+Tab` wrap inside, as `aria-modal="true"` promises.
|
|
38
|
+
Closing returns focus to the element that had it before. `Escape` closes the panel - only when `dismissible`, like the `x` button. The panel
|
|
39
39
|
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).
|
|
40
40
|
|
|
41
41
|
## Examples
|
|
42
42
|
<KptDrawer open={open} onOpenChange={setOpen} position="right" header="Filters">
|
|
43
|
-
Panel content
|
|
43
|
+
Panel content...
|
|
44
44
|
</KptDrawer>
|
|
45
45
|
|
|
46
46
|
## Tokens
|
|
@@ -49,4 +49,7 @@ is named by its `header` through `aria-labelledby`. The shared helper is `intern
|
|
|
49
49
|
|
|
50
50
|
## Accessibility
|
|
51
51
|
`role="dialog"`, `aria-modal="true"` and `aria-labelledby` pointing at the title; the close button gets
|
|
52
|
-
its label from `common.close`. Focus handling
|
|
52
|
+
its label from `common.close`. Focus handling - see "Focus and keyboard" above.
|
|
53
|
+
|
|
54
|
+
## Name and scrolling
|
|
55
|
+
Without `header` give the panel `ariaLabel` - a `role="dialog"` without a name is announced as a bare "dialog". An open drawer locks page scrolling underneath.
|
package/dist/empty/empty.d.ts
CHANGED
|
@@ -6,14 +6,14 @@ export interface KptEmptyProps extends Omit<ComponentPropsWithRef<'div'>, 'title
|
|
|
6
6
|
description?: string;
|
|
7
7
|
/**
|
|
8
8
|
* Robi z tytułu nagłówek strony (`role="heading"` z `aria-level`), żeby pusty stan pojawił się
|
|
9
|
-
* w strukturze dokumentu
|
|
9
|
+
* w strukturze dokumentu - np. gdy zastępuje całą sekcję. Bez tego tytuł to sam tekst.
|
|
10
10
|
*/
|
|
11
11
|
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
12
12
|
/** Akcje pod opisem. */
|
|
13
13
|
children?: ReactNode;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Stan pusty (empty state)
|
|
16
|
+
* Stan pusty (empty state) - ikona, tytuł, opis i opcjonalne akcje.
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* <KptEmpty icon="search" title="Brak wyników" description="Zmień kryteria wyszukiwania.">
|
package/dist/empty/empty.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { cn } from "../internal/cn.js";
|
|
3
3
|
import { KptIcon } from "../icon/icon.js";
|
|
4
4
|
/**
|
|
5
|
-
* Stan pusty (empty state)
|
|
5
|
+
* Stan pusty (empty state) - ikona, tytuł, opis i opcjonalne akcje.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* <KptEmpty icon="search" title="Brak wyników" description="Zmień kryteria wyszukiwania.">
|
package/dist/empty/llms.txt
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
# KptEmpty (@konce-pt/react)
|
|
2
2
|
|
|
3
|
-
An empty state
|
|
3
|
+
An empty state - an icon, a title, a description and optional actions.
|
|
4
4
|
Import: `import { KptEmpty } from '@konce-pt/react';`
|
|
5
5
|
|
|
6
6
|
## DOM
|
|
7
7
|
<div class="kpt-empty-host">
|
|
8
8
|
<div class="kpt-empty">
|
|
9
|
-
<div class="kpt-empty__icon"
|
|
9
|
+
<div class="kpt-empty__icon">...icon...</div>
|
|
10
10
|
<p class="kpt-empty__title">No results</p>
|
|
11
11
|
<p class="kpt-empty__desc">Adjust your search criteria.</p>
|
|
12
|
-
<div class="kpt-empty__actions"
|
|
12
|
+
<div class="kpt-empty__actions">...children...</div>
|
|
13
13
|
</div>
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
16
|
## Props
|
|
17
|
-
- `icon`: string | null (default 'info-circle')
|
|
18
|
-
- `title`: string, `description`: string
|
|
19
|
-
- `headingLevel`: 1
|
|
20
|
-
- `children`
|
|
17
|
+
- `icon`: string | null (default 'info-circle') - a registry icon name; `null` hides it
|
|
18
|
+
- `title`: string, `description`: string - each row disappears when its text is empty
|
|
19
|
+
- `headingLevel`: 1-6 | null (default null) - makes the title a heading (`role="heading"` + `aria-level`)
|
|
20
|
+
- `children` - the actions under the description
|
|
21
21
|
- `className`, `ref` and every other `<div>` prop go to the host
|
|
22
22
|
|
|
23
23
|
## Examples
|
|
@@ -31,6 +31,6 @@ Import: `import { KptEmpty } from '@konce-pt/react';`
|
|
|
31
31
|
`--kpt-color-on-surface-muted` (the description), `--kpt-space-*`.
|
|
32
32
|
|
|
33
33
|
## Accessibility
|
|
34
|
-
The icon is decorative. The title is a styled paragraph unless `headingLevel` makes it a heading
|
|
34
|
+
The icon is decorative. The title is a styled paragraph unless `headingLevel` makes it a heading -
|
|
35
35
|
use that when the empty state stands in for a whole section. Replacing results with an empty state
|
|
36
|
-
is not announced; report
|
|
36
|
+
is not announced; report "0 results" in a live region of your own.
|
package/dist/fab/fab.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface KptFabProps extends ComponentPropsWithRef<'button'> {
|
|
|
9
9
|
hostProps?: KptHostProps<'span'>;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* Floating Action Button
|
|
12
|
+
* Floating Action Button - okrągły, wyniesiony przycisk akcji. `extended` robi z niego pigułkę
|
|
13
13
|
* z tekstem.
|
|
14
14
|
*
|
|
15
15
|
* W wariancie okrągłym `aria-label` jest niezbędny, bo przycisk nie ma tekstu; w `extended`
|
package/dist/fab/fab.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "../internal/cn.js";
|
|
3
3
|
/**
|
|
4
|
-
* Floating Action Button
|
|
4
|
+
* Floating Action Button - okrągły, wyniesiony przycisk akcji. `extended` robi z niego pigułkę
|
|
5
5
|
* z tekstem.
|
|
6
6
|
*
|
|
7
7
|
* W wariancie okrągłym `aria-label` jest niezbędny, bo przycisk nie ma tekstu; w `extended`
|
package/dist/fab/llms.txt
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
# KptFab (@konce-pt/react)
|
|
2
2
|
|
|
3
|
-
A floating action button
|
|
3
|
+
A floating action button - round and raised. `extended` turns it into a pill with text.
|
|
4
4
|
Import: `import { KptFab } from '@konce-pt/react';`
|
|
5
5
|
|
|
6
6
|
## DOM
|
|
7
7
|
<span class="kpt-fab-host">
|
|
8
|
-
<button class="kpt-fab" type="button" data-variant="filled" data-size="md" aria-label="Add"
|
|
8
|
+
<button class="kpt-fab" type="button" data-variant="filled" data-size="md" aria-label="Add">...icon...</button>
|
|
9
9
|
</span>
|
|
10
10
|
|
|
11
11
|
## Props
|
|
12
12
|
- `variant`: 'filled' | 'tonal' (default 'filled')
|
|
13
13
|
- `size`: 'md' | 'mini' (default 'md')
|
|
14
|
-
- `extended`: boolean
|
|
15
|
-
- `hostProps`
|
|
14
|
+
- `extended`: boolean - a pill with text next to the icon
|
|
15
|
+
- `hostProps` - props for the `.kpt-fab-host` wrapper
|
|
16
16
|
- `className`, `ref` and every other `<button>` prop go to the inner `<button>`
|
|
17
17
|
|
|
18
18
|
## The label depends on the variant
|
|
19
|
-
In the round variant `aria-label` is essential
|
|
19
|
+
In the round variant `aria-label` is essential - the button has no text. In `extended` the content
|
|
20
20
|
already is the label, so `aria-label` is dropped there rather than passed through: two names on one
|
|
21
21
|
control make a screen reader announce the wrong one.
|
|
22
22
|
|
|
23
23
|
## Placement is yours
|
|
24
|
-
The component does not position itself. It is a button, not a layout
|
|
24
|
+
The component does not position itself. It is a button, not a layout - put it in a container that
|
|
25
25
|
pins it wherever the design wants (usually `position: fixed` in a corner).
|
|
26
26
|
|
|
27
27
|
## Examples
|
|
@@ -29,6 +29,10 @@ pins it wherever the design wants (usually `position: fixed` in a corner).
|
|
|
29
29
|
<KptFab extended><KptIcon name="plus" /> New</KptFab>
|
|
30
30
|
<KptFab variant="tonal" size="mini" aria-label="Edit"><KptIcon name="copy" /></KptFab>
|
|
31
31
|
|
|
32
|
+
## Motion
|
|
33
|
+
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
|
|
34
|
+
under "reduce motion".
|
|
35
|
+
|
|
32
36
|
## Tokens
|
|
33
37
|
`--kpt-color-primary` / `--kpt-color-on-primary` (filled), `--kpt-color-muted` /
|
|
34
38
|
`--kpt-color-on-muted` (tonal), `--kpt-elevation-3` (`--kpt-elevation-4` on hover); shape
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
import { type KptCollapseMotion } from '@konce-pt/motion';
|
|
3
|
+
export type KptFieldsetVariant = 'outlined' | 'filled';
|
|
2
4
|
export interface KptFieldsetProps extends ComponentPropsWithRef<'div'> {
|
|
3
5
|
legend?: string;
|
|
6
|
+
/**
|
|
7
|
+
* `outlined` (domyślny) - sama ramka na tle rodzica; `filled` - grupa na kolorze powierzchni,
|
|
8
|
+
* np. sekcje w szarym panelu. Legenda w obu bierze tło grupy, więc nie dzieli się na dwa kolory.
|
|
9
|
+
*/
|
|
10
|
+
variant?: KptFieldsetVariant;
|
|
4
11
|
/** Legenda staje się przyciskiem zwijającym zawartość. */
|
|
5
12
|
toggleable?: boolean;
|
|
6
13
|
collapsed?: boolean;
|
|
@@ -8,15 +15,22 @@ export interface KptFieldsetProps extends ComponentPropsWithRef<'div'> {
|
|
|
8
15
|
onCollapsedChange?: (collapsed: boolean) => void;
|
|
9
16
|
animated?: boolean;
|
|
10
17
|
animationDuration?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Ruch zwijania: `spring` - wysokość na sprężynie, treść wjeżdża i wyostrza się, przy zwijaniu
|
|
20
|
+
* najpierw gaśnie; `fade` - treść się przenika; `none` - bez ruchu. Bez wartości bierze `collapse`
|
|
21
|
+
* z `KptMotionProvider` (domyślnie `spring`); `animated={false}`, `enabled={false}` i systemowe
|
|
22
|
+
* "ogranicz ruch" wyłączają go zawsze.
|
|
23
|
+
*/
|
|
24
|
+
collapseMotion?: KptCollapseMotion;
|
|
11
25
|
children?: ReactNode;
|
|
12
26
|
}
|
|
13
27
|
/**
|
|
14
28
|
* Grupa pól z legendą (`<fieldset>` + `<legend>`), opcjonalnie zwijana.
|
|
15
29
|
*
|
|
16
|
-
* Zwijanie idzie przez `grid-template-rows: 0fr
|
|
17
|
-
* treści
|
|
30
|
+
* Zwijanie idzie przez `grid-template-rows: 0fr -> 1fr`, więc animuje się do naturalnej wysokości
|
|
31
|
+
* treści - bez mierzenia czegokolwiek w JS.
|
|
18
32
|
*
|
|
19
33
|
* @example
|
|
20
|
-
* <KptFieldset legend="Dane osobowe" toggleable
|
|
34
|
+
* <KptFieldset legend="Dane osobowe" toggleable>...</KptFieldset>
|
|
21
35
|
*/
|
|
22
|
-
export declare function KptFieldset({ legend, toggleable, collapsed, defaultCollapsed, onCollapsedChange, animated, animationDuration, className, style, children, ...rest }: Readonly<KptFieldsetProps>): import("react").JSX.Element;
|
|
36
|
+
export declare function KptFieldset({ legend, variant, toggleable, collapsed, defaultCollapsed, onCollapsedChange, animated, animationDuration, collapseMotion, className, style, children, ...rest }: Readonly<KptFieldsetProps>): import("react").JSX.Element;
|
|
@@ -1,24 +1,30 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { cn } from "../internal/cn.js";
|
|
3
4
|
import { useControllableState } from "../internal/use-controllable-state.js";
|
|
5
|
+
import { useKptId } from "../internal/use-id.js";
|
|
4
6
|
import { KptIcon } from "../icon/icon.js";
|
|
7
|
+
import { resolveCollapseMotion } from '@konce-pt/motion';
|
|
8
|
+
import { useKptMotion } from "../motion/motion-context.js";
|
|
5
9
|
/**
|
|
6
10
|
* Grupa pól z legendą (`<fieldset>` + `<legend>`), opcjonalnie zwijana.
|
|
7
11
|
*
|
|
8
|
-
* Zwijanie idzie przez `grid-template-rows: 0fr
|
|
9
|
-
* treści
|
|
12
|
+
* Zwijanie idzie przez `grid-template-rows: 0fr -> 1fr`, więc animuje się do naturalnej wysokości
|
|
13
|
+
* treści - bez mierzenia czegokolwiek w JS.
|
|
10
14
|
*
|
|
11
15
|
* @example
|
|
12
|
-
* <KptFieldset legend="Dane osobowe" toggleable
|
|
16
|
+
* <KptFieldset legend="Dane osobowe" toggleable>...</KptFieldset>
|
|
13
17
|
*/
|
|
14
|
-
export function KptFieldset({ legend = '', toggleable = false, collapsed, defaultCollapsed = false, onCollapsedChange, animated = true, animationDuration = 500, className, style, children, ...rest }) {
|
|
18
|
+
export function KptFieldset({ legend = '', variant = 'outlined', toggleable = false, collapsed, defaultCollapsed = false, onCollapsedChange, animated = true, animationDuration = 500, collapseMotion, className, style, children, ...rest }) {
|
|
19
|
+
const bodyId = useKptId(undefined, 'kpt-fieldset-body');
|
|
20
|
+
const motion = resolveCollapseMotion(collapseMotion, useKptMotion(), animated);
|
|
15
21
|
const [isCollapsed, setCollapsed] = useControllableState({
|
|
16
22
|
value: collapsed,
|
|
17
23
|
defaultValue: defaultCollapsed,
|
|
18
24
|
onChange: onCollapsedChange,
|
|
19
25
|
});
|
|
20
|
-
return (_jsx("div", { className: cn('kpt-fieldset-host', className), style: {
|
|
26
|
+
return (_jsx("div", { className: cn('kpt-fieldset-host', className), "data-variant": variant, style: {
|
|
21
27
|
['--kpt-anim-duration']: `${animated ? animationDuration : 0}ms`,
|
|
22
28
|
...style,
|
|
23
|
-
}, ...rest, children: _jsxs("fieldset", { className: "kpt-fieldset", children: [_jsx("legend", { className: "kpt-fieldset__legend", children: toggleable ? (_jsxs("button", { type: "button", className: "kpt-fieldset__toggle", "aria-expanded": !isCollapsed, onClick: () => setCollapsed(!isCollapsed), children: [_jsx(KptIcon, { name:
|
|
29
|
+
}, ...rest, children: _jsxs("fieldset", { className: "kpt-fieldset", "data-motion": motion, children: [_jsx("legend", { className: "kpt-fieldset__legend", children: toggleable ? (_jsxs("button", { type: "button", className: "kpt-fieldset__toggle", "aria-expanded": !isCollapsed, "aria-controls": bodyId, onClick: () => setCollapsed(!isCollapsed), children: [_jsx(KptIcon, { name: "chevron-down", className: cn('kpt-fieldset__chevron', !isCollapsed && 'is-open') }), _jsx("span", { children: legend })] })) : (_jsx("span", { children: legend })) }), _jsx("div", { id: bodyId, className: cn('kpt-fieldset__collapse', !isCollapsed && 'is-open'), inert: isCollapsed, children: _jsx("div", { className: "kpt-fieldset__collapse-inner", children: _jsx("div", { className: "kpt-fieldset__body", children: children }) }) })] }) }));
|
|
24
30
|
}
|
package/dist/fieldset/llms.txt
CHANGED
|
@@ -4,27 +4,31 @@ A group of fields with a legend, optionally collapsible.
|
|
|
4
4
|
Import: `import { KptFieldset } from '@konce-pt/react';`
|
|
5
5
|
|
|
6
6
|
## DOM
|
|
7
|
-
<div class="kpt-fieldset-host" style="--kpt-anim-duration:500ms">
|
|
7
|
+
<div class="kpt-fieldset-host" data-variant="outlined" style="--kpt-anim-duration:500ms">
|
|
8
8
|
<fieldset class="kpt-fieldset">
|
|
9
9
|
<legend class="kpt-fieldset__legend">
|
|
10
|
-
<button class="kpt-fieldset__toggle" aria-expanded="true"
|
|
10
|
+
<button class="kpt-fieldset__toggle" aria-expanded="true">...<span>Personal data</span></button>
|
|
11
11
|
</legend>
|
|
12
12
|
<div class="kpt-fieldset__collapse is-open">
|
|
13
|
-
<div class="kpt-fieldset__collapse-inner"><div class="kpt-fieldset__body"
|
|
13
|
+
<div class="kpt-fieldset__collapse-inner"><div class="kpt-fieldset__body">...</div></div>
|
|
14
14
|
</div>
|
|
15
15
|
</fieldset>
|
|
16
16
|
</div>
|
|
17
17
|
|
|
18
18
|
## Props
|
|
19
19
|
- `legend`: string
|
|
20
|
-
- `
|
|
20
|
+
- `variant`: `'outlined'` (default, a frame on the parent's background) | `'filled'` (the group on
|
|
21
|
+
`--kpt-color-surface`, e.g. sections inside a grey panel); the legend takes the group's background
|
|
22
|
+
with rounded ends in both, so it never splits into two colours
|
|
23
|
+
- `toggleable`: boolean - turns the legend into a collapse button
|
|
21
24
|
- `collapsed` / `defaultCollapsed` / `onCollapsedChange`
|
|
22
25
|
- `animated`: boolean (default true), `animationDuration`: ms (default 500)
|
|
26
|
+
- `collapseMotion`: `'spring' | 'fade' | 'none'` (default from `KptMotionProvider`, else `spring`) - see "Collapse motion"
|
|
23
27
|
- `className`, `ref` and every other `<div>` prop go to the host
|
|
24
28
|
|
|
25
29
|
## Collapsing without measuring
|
|
26
|
-
The transition runs on `grid-template-rows: 0fr
|
|
27
|
-
height with no JS measurement and no height cached at mount
|
|
30
|
+
The transition runs on `grid-template-rows: 0fr -> 1fr`, so it animates to the content's natural
|
|
31
|
+
height with no JS measurement and no height cached at mount - content that grows later still
|
|
28
32
|
collapses correctly.
|
|
29
33
|
|
|
30
34
|
## The real fieldset stays
|
|
@@ -32,11 +36,24 @@ The markup is a native `<fieldset>` + `<legend>`, so the grouping is real for as
|
|
|
32
36
|
the collapse only wraps the body, never the legend.
|
|
33
37
|
|
|
34
38
|
## Examples
|
|
35
|
-
<KptFieldset legend="Personal data" toggleable
|
|
36
|
-
<KptFieldset legend="
|
|
39
|
+
<KptFieldset legend="Personal data" toggleable>...</KptFieldset>
|
|
40
|
+
<KptFieldset legend="Scrolling" variant="filled">...</KptFieldset>
|
|
41
|
+
<KptFieldset legend="Advanced" toggleable collapsed={closed} onCollapsedChange={setClosed}>...</KptFieldset>
|
|
42
|
+
|
|
43
|
+
## Collapse motion
|
|
44
|
+
- `spring` - the height opens on a soft spring, the content slides in from above and sharpens out
|
|
45
|
+
of a blur; when collapsing, the content fades first and only then the section closes. The chevron
|
|
46
|
+
turns on a spring.
|
|
47
|
+
- `fade` - the height on the standard curve, the content cross-fades.
|
|
48
|
+
- `none` - the state changes without motion.
|
|
49
|
+
|
|
50
|
+
With no value it takes `collapse` from `KptMotionProvider` (default `spring`). `animated={false}`, `enabled: false`
|
|
51
|
+
in the config and the system "reduce motion" setting always turn it off. `animationDuration` sets
|
|
52
|
+
the time of every kind. Pure CSS: the kind sits in `data-motion` on the component root.
|
|
37
53
|
|
|
38
54
|
## Tokens
|
|
39
|
-
Border `--kpt-color-border`, radius `--kpt-radius-md`, padding `--kpt-space-4
|
|
55
|
+
Border `--kpt-color-border`, radius `--kpt-radius-md`, padding `--kpt-space-4`; `filled` background
|
|
56
|
+
`--kpt-color-surface`, legend corners `--kpt-radius-full`.
|
|
40
57
|
|
|
41
58
|
## Accessibility
|
|
42
59
|
The toggle carries `aria-expanded`; the collapsed body gets `inert` and `aria-hidden`, so it is
|
|
@@ -8,6 +8,12 @@ export interface KptFileUploadProps extends Omit<ComponentPropsWithRef<'div'>, '
|
|
|
8
8
|
accept?: string;
|
|
9
9
|
multiple?: boolean;
|
|
10
10
|
disabled?: boolean;
|
|
11
|
+
/** Tylko do odczytu - listę plików widać, nie da się jej zmienić. */
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
/** Id strefy; bez niego generowane, w `KptFormField` - z wrappera. */
|
|
14
|
+
id?: string;
|
|
15
|
+
/** Nazwa dostępna, gdy strefy nie opisuje etykieta (`KptFormField`). */
|
|
16
|
+
ariaLabel?: string | null;
|
|
11
17
|
invalid?: boolean;
|
|
12
18
|
touched?: boolean;
|
|
13
19
|
onTouch?: () => void;
|
|
@@ -17,11 +23,11 @@ export interface KptFileUploadProps extends Omit<ComponentPropsWithRef<'div'>, '
|
|
|
17
23
|
* Wartością jest tablica `File`.
|
|
18
24
|
*
|
|
19
25
|
* Strefa to `role="button"` z jednym przystankiem Tab: `Enter` i spacja otwierają okno wyboru,
|
|
20
|
-
* tak jak kliknięcie
|
|
26
|
+
* tak jak kliknięcie - natywne pole pliku jest ukryte, więc bez tego klawiatura nie miałaby
|
|
21
27
|
* jak wybrać pliku. `disabled` wyjmuje strefę z kolejności Tab. Stan błędu: `invalid`
|
|
22
28
|
* i `touched` (pominięty `touched` = błąd widać od razu, jak w `KptInput`).
|
|
23
29
|
*
|
|
24
30
|
* @example
|
|
25
31
|
* <KptFileUpload value={files} onValueChange={setFiles} accept="image/*" multiple />
|
|
26
32
|
*/
|
|
27
|
-
export declare function KptFileUpload({ value, defaultValue, onValueChange, accept, multiple, disabled, invalid, touched, onTouch, locale, dictionary, className, ...rest }: Readonly<KptFileUploadProps>): import("react").JSX.Element;
|
|
33
|
+
export declare function KptFileUpload({ value, defaultValue, onValueChange, accept, multiple, disabled, readOnly, id, ariaLabel, invalid, touched, onTouch, locale, dictionary, className, ...rest }: Readonly<KptFileUploadProps>): import("react").JSX.Element;
|