@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
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import { type ComponentPropsWithRef } from 'react';
|
|
2
2
|
import { type KptI18nOverrides } from '../i18n/i18n-context.tsx';
|
|
3
|
+
import { type KptToastPosition } from './toast-store.ts';
|
|
3
4
|
export interface KptToastContainerProps extends ComponentPropsWithRef<'div'>, KptI18nOverrides {
|
|
5
|
+
/** Położenie toastów, które nie podały własnego `position`. Domyślnie `bottom-end`. */
|
|
6
|
+
position?: KptToastPosition;
|
|
4
7
|
}
|
|
5
8
|
/**
|
|
6
9
|
* Kontener renderujący toasty z `kptToast`. Umieść raz w aplikacji, np. w komponencie głównym.
|
|
7
10
|
*
|
|
8
|
-
* Ogłaszanie idzie przez dwa stałe, niewidoczne regiony na żywo
|
|
9
|
-
* i natychmiastowy dla błędów
|
|
11
|
+
* Ogłaszanie idzie przez dwa stałe, niewidoczne regiony na żywo - uprzejmy dla zwykłych toastów
|
|
12
|
+
* i natychmiastowy dla błędów - a nie przez same toasty: region musi istnieć, zanim pojawi się
|
|
10
13
|
* w nim treść, a zagnieżdżone regiony część czytników ogłasza dwa razy. Gdy wskaźnik albo fokus
|
|
11
14
|
* jest na toastach, liczniki stoją, więc komunikat nie znika w trakcie czytania.
|
|
12
15
|
*
|
|
16
|
+
* Toasty rosną w rogu z `position` kontenera albo z własnego `position` - każdy róg to osobny stos,
|
|
17
|
+
* przy górnej krawędzi najnowszy jest na górze, przy dolnej na dole.
|
|
18
|
+
*
|
|
13
19
|
* @example
|
|
14
20
|
* <KptToastContainer />
|
|
15
21
|
* // gdziekolwiek: kptToast.success('Zapisano');
|
|
16
22
|
*/
|
|
17
|
-
export declare function KptToastContainer({ locale, dictionary, className, ...rest }: Readonly<KptToastContainerProps>): import("react").JSX.Element;
|
|
23
|
+
export declare function KptToastContainer({ position, locale, dictionary, className, ...rest }: Readonly<KptToastContainerProps>): import("react").JSX.Element;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { useEffect, useRef, useState } from 'react';
|
|
3
4
|
import { cn } from "../internal/cn.js";
|
|
4
5
|
import { useKptMessages } from "../i18n/i18n-context.js";
|
|
5
6
|
import { KptIcon } from "../icon/icon.js";
|
|
6
|
-
import { kptToast, useKptToasts } from "./toast-store.js";
|
|
7
|
+
import { kptToast, useKptToasts, useKptToastsPaused } from "./toast-store.js";
|
|
8
|
+
/** Kolejność grup w DOM - stała, żeby dodanie toastu w innym rogu nie przestawiało pozostałych. */
|
|
9
|
+
const POSITIONS = ['top-start', 'top-center', 'top-end', 'bottom-start', 'bottom-center', 'bottom-end'];
|
|
7
10
|
const ICONS = {
|
|
8
11
|
info: 'info',
|
|
9
12
|
success: 'circle-check',
|
|
@@ -13,21 +16,27 @@ const ICONS = {
|
|
|
13
16
|
/**
|
|
14
17
|
* Kontener renderujący toasty z `kptToast`. Umieść raz w aplikacji, np. w komponencie głównym.
|
|
15
18
|
*
|
|
16
|
-
* Ogłaszanie idzie przez dwa stałe, niewidoczne regiony na żywo
|
|
17
|
-
* i natychmiastowy dla błędów
|
|
19
|
+
* Ogłaszanie idzie przez dwa stałe, niewidoczne regiony na żywo - uprzejmy dla zwykłych toastów
|
|
20
|
+
* i natychmiastowy dla błędów - a nie przez same toasty: region musi istnieć, zanim pojawi się
|
|
18
21
|
* w nim treść, a zagnieżdżone regiony część czytników ogłasza dwa razy. Gdy wskaźnik albo fokus
|
|
19
22
|
* jest na toastach, liczniki stoją, więc komunikat nie znika w trakcie czytania.
|
|
20
23
|
*
|
|
24
|
+
* Toasty rosną w rogu z `position` kontenera albo z własnego `position` - każdy róg to osobny stos,
|
|
25
|
+
* przy górnej krawędzi najnowszy jest na górze, przy dolnej na dole.
|
|
26
|
+
*
|
|
21
27
|
* @example
|
|
22
28
|
* <KptToastContainer />
|
|
23
29
|
* // gdziekolwiek: kptToast.success('Zapisano');
|
|
24
30
|
*/
|
|
25
|
-
export function KptToastContainer({ locale, dictionary, className, ...rest }) {
|
|
31
|
+
export function KptToastContainer({ position = 'bottom-end', locale, dictionary, className, ...rest }) {
|
|
26
32
|
const { t } = useKptMessages({ locale, dictionary });
|
|
27
33
|
const toasts = useKptToasts();
|
|
34
|
+
const paused = useKptToastsPaused();
|
|
35
|
+
// Toasty pogrupowane po rogu; tylko niepuste grupy, każda w osobnym przypiętym stosie.
|
|
36
|
+
const groups = POSITIONS.map((at) => ({ position: at, toasts: toasts.filter((toast) => (toast.position ?? position) === at) })).filter((group) => group.toasts.length);
|
|
28
37
|
const [politeText, setPoliteText] = useState('');
|
|
29
38
|
const [alertText, setAlertText] = useState('');
|
|
30
|
-
// Ostatni ogłoszony toast
|
|
39
|
+
// Ostatni ogłoszony toast - zamknięcie nowszego nie może ponownie ogłosić starszego.
|
|
31
40
|
const lastAnnounced = useRef(0);
|
|
32
41
|
const holds = useRef(new Set());
|
|
33
42
|
const hold = (reason, on) => {
|
|
@@ -41,7 +50,7 @@ export function KptToastContainer({ locale, dictionary, className, ...rest }) {
|
|
|
41
50
|
kptToast.resume();
|
|
42
51
|
};
|
|
43
52
|
useEffect(() => {
|
|
44
|
-
// Pusty kontener nie dostanie już `mouseleave`, więc zdejmujemy wstrzymanie sami
|
|
53
|
+
// Pusty kontener nie dostanie już `mouseleave`, więc zdejmujemy wstrzymanie sami -
|
|
45
54
|
// inaczej kolejne toasty czekałyby w nieskończoność.
|
|
46
55
|
if (!toasts.length && holds.current.size) {
|
|
47
56
|
holds.current.clear();
|
|
@@ -55,7 +64,7 @@ export function KptToastContainer({ locale, dictionary, className, ...rest }) {
|
|
|
55
64
|
for (const toast of fresh) {
|
|
56
65
|
const text = toast.title ? `${toast.title}. ${toast.message}` : toast.message;
|
|
57
66
|
const set = toast.variant === 'danger' ? setAlertText : setPoliteText;
|
|
58
|
-
// Czyścimy region przed wpisaniem
|
|
67
|
+
// Czyścimy region przed wpisaniem - ten sam tekst drugi raz inaczej nie zostałby ogłoszony.
|
|
59
68
|
set('');
|
|
60
69
|
frames.push(requestAnimationFrame(() => set(text)));
|
|
61
70
|
}
|
|
@@ -67,8 +76,8 @@ export function KptToastContainer({ locale, dictionary, className, ...rest }) {
|
|
|
67
76
|
return;
|
|
68
77
|
hold('focus', false);
|
|
69
78
|
};
|
|
70
|
-
return (_jsxs("div", { className: cn('kpt-toast-container-host', className), ...rest, children: [_jsx("div", { className: "kpt-toast-container", role:
|
|
79
|
+
return (_jsxs("div", { className: cn('kpt-toast-container-host', className), ...rest, children: [groups.map((group) => (_jsx("div", { className: "kpt-toast-container", role: "region", "data-position": group.position, "data-paused": paused ? '' : undefined, "aria-label": t('toast.region'), onMouseEnter: () => hold('pointer', true), onMouseLeave: () => hold('pointer', false), onFocus: () => hold('focus', true), onBlur: onBlur, children: group.toasts.map((toast) => (_jsxs("div", { className: "kpt-toast", "data-variant": toast.variant, "data-appearance": toast.appearance, children: [_jsx(KptIcon, { className: "kpt-toast__icon", name: ICONS[toast.variant] }), _jsxs("div", { className: "kpt-toast__content", children: [toast.title ? _jsx("div", { className: "kpt-toast__title", children: toast.title }) : null, _jsx("div", { className: "kpt-toast__message", children: toast.message })] }), toast.action ? (_jsx("button", { className: "kpt-toast__action", type: "button", onClick: () => {
|
|
71
80
|
toast.action?.run();
|
|
72
81
|
kptToast.dismiss(toast.id);
|
|
73
|
-
}, children: toast.action.label })) : null, _jsx("button", { className: "kpt-toast__close", type: "button", onClick: () => kptToast.dismiss(toast.id), "aria-label": t('common.close'), children: _jsx(KptIcon, { name: "x" }) })] }, toast.id))) }), _jsx("span", { className: "kpt-toast-container__live", "aria-live": "polite", "aria-atomic": "true", children: politeText }), _jsx("span", { className: "kpt-toast-container__live", "aria-live": "assertive", "aria-atomic": "true", children: alertText })] }));
|
|
82
|
+
}, children: toast.action.label })) : null, toast.closable ? (_jsx("button", { className: "kpt-toast__close", type: "button", onClick: () => kptToast.dismiss(toast.id), "aria-label": t('common.close'), children: _jsx(KptIcon, { name: "x" }) })) : null, toast.progress && toast.duration > 0 ? (_jsx("span", { className: "kpt-toast__timer", "aria-hidden": "true", style: { '--_duration': `${toast.duration}ms` } })) : null] }, toast.id))) }, group.position))), _jsx("span", { className: "kpt-toast-container__live", "aria-live": "polite", "aria-atomic": "true", children: politeText }), _jsx("span", { className: "kpt-toast-container__live", "aria-live": "assertive", "aria-atomic": "true", children: alertText })] }));
|
|
74
83
|
}
|
|
@@ -1,19 +1,54 @@
|
|
|
1
1
|
import type { KptAlertVariant } from '../shared/types.ts';
|
|
2
|
-
/** Przycisk akcji w toaście, np.
|
|
2
|
+
/** Przycisk akcji w toaście, np. "Cofnij". Kliknięcie uruchamia `run` i zamyka toast. */
|
|
3
3
|
export interface KptToastAction {
|
|
4
4
|
label: string;
|
|
5
5
|
run: () => void;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Róg albo środek krawędzi okna, przy którym rosną toasty. `start`/`end` są logiczne - w układzie
|
|
9
|
+
* od prawej do lewej zamieniają się stronami same.
|
|
10
|
+
*/
|
|
11
|
+
export type KptToastPosition = 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end';
|
|
12
|
+
/** `outline` - jasna powierzchnia z akcentem na krawędzi; `filled` - całe tło w barwie wariantu. */
|
|
13
|
+
export type KptToastAppearance = 'outline' | 'filled';
|
|
7
14
|
export interface KptToast {
|
|
8
15
|
id: number;
|
|
9
16
|
message: string;
|
|
10
17
|
title?: string;
|
|
11
18
|
variant: KptAlertVariant;
|
|
12
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Czas życia w ms; 0 = bez auto-zamykania. Domyślnie 4000 ms, a dla toastu z `action` - 0:
|
|
21
|
+
* użytkownik klawiatury albo czytnika nie zdąży dojść do przycisku "Cofnij" w kontenerze na końcu
|
|
22
|
+
* strony, zanim toast zniknie (WCAG 2.2.1). Jawne `duration` zawsze wygrywa - poza jednym
|
|
23
|
+
* przypadkiem: toast bez X, bez akcji i bez czasu nie dałby się zamknąć, więc dostaje 5000 ms.
|
|
24
|
+
*/
|
|
13
25
|
duration: number;
|
|
14
26
|
action?: KptToastAction;
|
|
27
|
+
/** Położenie tego toastu; bez wartości - `position` kontenera. */
|
|
28
|
+
position?: KptToastPosition;
|
|
29
|
+
appearance: KptToastAppearance;
|
|
30
|
+
/** `false` chowa przycisk X. */
|
|
31
|
+
closable: boolean;
|
|
32
|
+
/** Pasek czasu na dole toastu - kurczy się do zamknięcia i staje razem z licznikiem. */
|
|
33
|
+
progress: boolean;
|
|
15
34
|
}
|
|
16
35
|
export type KptToastOptions = Partial<Omit<KptToast, 'id' | 'message'>>;
|
|
36
|
+
/** Wartości domyślne toastów całej aplikacji - `kptToast.configure(...)`. Opcje toastu wygrywają. */
|
|
37
|
+
export interface KptToastConfig {
|
|
38
|
+
/** Czas życia toastu bez akcji (ms). Domyślnie 4000. */
|
|
39
|
+
duration?: number;
|
|
40
|
+
appearance?: KptToastAppearance;
|
|
41
|
+
closable?: boolean;
|
|
42
|
+
progress?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/** Czas toastu, którego inaczej nie dałoby się zamknąć (bez X, bez akcji, bez czasu). */
|
|
45
|
+
export declare const KPT_TOAST_FALLBACK_DURATION = 5000;
|
|
46
|
+
/**
|
|
47
|
+
* Pełny toast z opcji i konfiguracji. Kolejność: opcja toastu > `kptToast.configure` > wartość
|
|
48
|
+
* biblioteki. Na końcu bezpiecznik: toast, którego nie da się zamknąć ani przyciskiem, ani akcją,
|
|
49
|
+
* dostaje czas, bo inaczej zostałby na ekranie na zawsze.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveKptToast(id: number, message: string, options: KptToastOptions, config: KptToastConfig | null): KptToast;
|
|
17
52
|
declare function show(message: string, options?: KptToastOptions): number;
|
|
18
53
|
declare function dismiss(id: number): void;
|
|
19
54
|
declare function clear(): void;
|
|
@@ -21,8 +56,11 @@ declare function clear(): void;
|
|
|
21
56
|
declare function pause(): void;
|
|
22
57
|
/** Wznawia liczniki od pozostałego czasu. */
|
|
23
58
|
declare function resume(): void;
|
|
59
|
+
/** Domyślny wygląd i zachowanie toastów w całej aplikacji; wołaj raz, przy starcie. */
|
|
60
|
+
declare function configure(next: KptToastConfig): void;
|
|
24
61
|
/** Powiadomienia (toasty). Renderuje je `<KptToastContainer />`, umieszczony raz w aplikacji. */
|
|
25
62
|
export declare const kptToast: {
|
|
63
|
+
configure: typeof configure;
|
|
26
64
|
show: typeof show;
|
|
27
65
|
info: (message: string, options?: KptToastOptions) => number;
|
|
28
66
|
success: (message: string, options?: KptToastOptions) => number;
|
|
@@ -35,4 +73,6 @@ export declare const kptToast: {
|
|
|
35
73
|
};
|
|
36
74
|
/** Bieżąca lista toastów. Używane przez kontener; przydaje się też do własnego renderowania. */
|
|
37
75
|
export declare function useKptToasts(): KptToast[];
|
|
76
|
+
/** Czy liczniki stoją (wskaźnik albo fokus na toastach, albo `kptToast.pause()`). */
|
|
77
|
+
export declare function useKptToastsPaused(): boolean;
|
|
38
78
|
export {};
|
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
import { useSyncExternalStore } from 'react';
|
|
2
|
+
/** Czas toastu, którego inaczej nie dałoby się zamknąć (bez X, bez akcji, bez czasu). */
|
|
3
|
+
export const KPT_TOAST_FALLBACK_DURATION = 5000;
|
|
4
|
+
/**
|
|
5
|
+
* Pełny toast z opcji i konfiguracji. Kolejność: opcja toastu > `kptToast.configure` > wartość
|
|
6
|
+
* biblioteki. Na końcu bezpiecznik: toast, którego nie da się zamknąć ani przyciskiem, ani akcją,
|
|
7
|
+
* dostaje czas, bo inaczej zostałby na ekranie na zawsze.
|
|
8
|
+
*/
|
|
9
|
+
export function resolveKptToast(id, message, options, config) {
|
|
10
|
+
const closable = options.closable ?? config?.closable ?? true;
|
|
11
|
+
let duration = options.duration ?? (options.action ? 0 : (config?.duration ?? 4000));
|
|
12
|
+
if (!closable && !options.action && duration <= 0)
|
|
13
|
+
duration = KPT_TOAST_FALLBACK_DURATION;
|
|
14
|
+
return {
|
|
15
|
+
variant: 'info',
|
|
16
|
+
...options,
|
|
17
|
+
id,
|
|
18
|
+
message,
|
|
19
|
+
duration,
|
|
20
|
+
closable,
|
|
21
|
+
appearance: options.appearance ?? config?.appearance ?? 'outline',
|
|
22
|
+
progress: options.progress ?? config?.progress ?? false,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
2
25
|
let toasts = [];
|
|
3
26
|
let seq = 0;
|
|
4
27
|
let paused = false;
|
|
28
|
+
let config = null;
|
|
5
29
|
const timers = new Map();
|
|
6
30
|
const listeners = new Set();
|
|
7
31
|
function emit() {
|
|
@@ -10,7 +34,7 @@ function emit() {
|
|
|
10
34
|
}
|
|
11
35
|
function show(message, options = {}) {
|
|
12
36
|
const id = ++seq;
|
|
13
|
-
const toast =
|
|
37
|
+
const toast = resolveKptToast(id, message, options, config);
|
|
14
38
|
toasts = [...toasts, toast];
|
|
15
39
|
emit();
|
|
16
40
|
if (toast.duration > 0) {
|
|
@@ -48,6 +72,7 @@ function pause() {
|
|
|
48
72
|
if (paused)
|
|
49
73
|
return;
|
|
50
74
|
paused = true;
|
|
75
|
+
emit();
|
|
51
76
|
const now = Date.now();
|
|
52
77
|
for (const timer of timers.values()) {
|
|
53
78
|
if (!timer.handle)
|
|
@@ -62,11 +87,17 @@ function resume() {
|
|
|
62
87
|
if (!paused)
|
|
63
88
|
return;
|
|
64
89
|
paused = false;
|
|
90
|
+
emit();
|
|
65
91
|
for (const id of timers.keys())
|
|
66
92
|
start(id);
|
|
67
93
|
}
|
|
94
|
+
/** Domyślny wygląd i zachowanie toastów w całej aplikacji; wołaj raz, przy starcie. */
|
|
95
|
+
function configure(next) {
|
|
96
|
+
config = { ...next };
|
|
97
|
+
}
|
|
68
98
|
/** Powiadomienia (toasty). Renderuje je `<KptToastContainer />`, umieszczony raz w aplikacji. */
|
|
69
99
|
export const kptToast = {
|
|
100
|
+
configure,
|
|
70
101
|
show,
|
|
71
102
|
info: (message, options) => show(message, { ...options, variant: 'info' }),
|
|
72
103
|
success: (message, options) => show(message, { ...options, variant: 'success' }),
|
|
@@ -88,3 +119,7 @@ function subscribe(listener) {
|
|
|
88
119
|
export function useKptToasts() {
|
|
89
120
|
return useSyncExternalStore(subscribe, () => toasts, () => EMPTY);
|
|
90
121
|
}
|
|
122
|
+
/** Czy liczniki stoją (wskaźnik albo fokus na toastach, albo `kptToast.pause()`). */
|
|
123
|
+
export function useKptToastsPaused() {
|
|
124
|
+
return useSyncExternalStore(subscribe, () => paused, () => false);
|
|
125
|
+
}
|
package/dist/toolbar/llms.txt
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# KptToolbar (@konce-pt/react)
|
|
2
2
|
|
|
3
|
-
The top bar
|
|
3
|
+
The top bar - a horizontal strip for application content (logo, actions).
|
|
4
4
|
Import: `import { KptToolbar, KptToolbarSpacer } from '@konce-pt/react';`
|
|
5
5
|
|
|
6
6
|
## DOM
|
|
7
7
|
<div class="kpt-toolbar kpt-toolbar--elevated">
|
|
8
|
-
|
|
8
|
+
...children...
|
|
9
9
|
<span kpttoolbarspacer=""></span>
|
|
10
|
-
|
|
10
|
+
...children...
|
|
11
11
|
</div>
|
|
12
12
|
|
|
13
13
|
## Props
|
|
14
|
-
- `elevated`: boolean
|
|
15
|
-
- `wrap`: boolean
|
|
14
|
+
- `elevated`: boolean - adds a shadow under the bar
|
|
15
|
+
- `wrap`: boolean - lets the content wrap onto further rows when it runs out of room
|
|
16
16
|
- `className`, `ref` and every other `<div>` prop go to the bar itself
|
|
17
17
|
|
|
18
18
|
`wrap` is opt-in because wrapping changes what `<KptToolbarSpacer>` does: in a single-row bar it
|
|
@@ -30,10 +30,10 @@ serves both ports).
|
|
|
30
30
|
<KptButton variant="text">Sign out</KptButton>
|
|
31
31
|
</KptToolbar>
|
|
32
32
|
|
|
33
|
-
<KptAppShell toolbar={<KptToolbar elevated
|
|
33
|
+
<KptAppShell toolbar={<KptToolbar elevated>...</KptToolbar>} sidenav={...}>...</KptAppShell>
|
|
34
34
|
|
|
35
35
|
## Responsiveness
|
|
36
|
-
Below the `sm` breakpoint the bar shrinks on its own
|
|
36
|
+
Below the `sm` breakpoint the bar shrinks on its own - a lower height
|
|
37
37
|
(`--kpt-toolbar-height-compact`), narrower inline padding and a smaller gap. No props involved.
|
|
38
38
|
|
|
39
39
|
## Tokens
|
|
@@ -4,13 +4,13 @@ export interface KptToolbarProps extends ComponentPropsWithRef<'div'> {
|
|
|
4
4
|
elevated?: boolean;
|
|
5
5
|
/**
|
|
6
6
|
* Pozwala zawartości paska zawinąć się do kolejnych wierszy, gdy zabraknie miejsca.
|
|
7
|
-
* Opcjonalne, bo zawijanie zmienia zachowanie `<KptToolbarSpacer>`
|
|
7
|
+
* Opcjonalne, bo zawijanie zmienia zachowanie `<KptToolbarSpacer>` - w jednowierszowym
|
|
8
8
|
* pasku rozpycha on treść, a w zawijanym potrafi zepchnąć resztę do nowego wiersza.
|
|
9
9
|
*/
|
|
10
10
|
wrap?: boolean;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Górny pasek (toolbar)
|
|
13
|
+
* Górny pasek (toolbar) - pozioma belka na treść aplikacji (logo, akcje).
|
|
14
14
|
* Poniżej breakpointa `sm` pasek sam zbiega się do niższej wysokości i węższych marginesów.
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
@@ -22,7 +22,7 @@ export interface KptToolbarProps extends ComponentPropsWithRef<'div'> {
|
|
|
22
22
|
*/
|
|
23
23
|
export declare function KptToolbar({ elevated, wrap, className, ...rest }: Readonly<KptToolbarProps>): import("react").JSX.Element;
|
|
24
24
|
/**
|
|
25
|
-
* Elastyczny odstęp rozpychający zawartość paska. Nosi atrybut `kpttoolbarspacer`
|
|
25
|
+
* Elastyczny odstęp rozpychający zawartość paska. Nosi atrybut `kpttoolbarspacer` -
|
|
26
26
|
* to po nim celuje wspólny SCSS (nazwy atrybutów w selektorach CSS są w HTML
|
|
27
27
|
* case-insensitive, więc jedna reguła obsługuje oba porty).
|
|
28
28
|
*/
|
package/dist/toolbar/toolbar.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
|
-
* Górny pasek (toolbar)
|
|
4
|
+
* Górny pasek (toolbar) - pozioma belka na treść aplikacji (logo, akcje).
|
|
5
5
|
* Poniżej breakpointa `sm` pasek sam zbiega się do niższej wysokości i węższych marginesów.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
@@ -15,7 +15,7 @@ export function KptToolbar({ elevated = false, wrap = false, className, ...rest
|
|
|
15
15
|
return (_jsx("div", { className: cn('kpt-toolbar', elevated && 'kpt-toolbar--elevated', className), "data-wrap": wrap ? '' : undefined, ...rest }));
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* Elastyczny odstęp rozpychający zawartość paska. Nosi atrybut `kpttoolbarspacer`
|
|
18
|
+
* Elastyczny odstęp rozpychający zawartość paska. Nosi atrybut `kpttoolbarspacer` -
|
|
19
19
|
* to po nim celuje wspólny SCSS (nazwy atrybutów w selektorach CSS są w HTML
|
|
20
20
|
* case-insensitive, więc jedna reguła obsługuje oba porty).
|
|
21
21
|
*/
|
package/dist/tooltip/llms.txt
CHANGED
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
# KptTooltip (@konce-pt/react)
|
|
2
2
|
|
|
3
|
-
A tooltip shown on hover and focus. Light
|
|
3
|
+
A tooltip shown on hover and focus. Light - the element is appended to `body` and positioned
|
|
4
4
|
against the child. Import: `import { KptTooltip } from '@konce-pt/react';`
|
|
5
5
|
|
|
6
6
|
## DOM
|
|
7
|
-
The component renders NO wrapper of its own
|
|
7
|
+
The component renders NO wrapper of its own - it clones the child and attaches the handlers and a
|
|
8
8
|
ref to it, so the tree stays exactly as it would be without the tooltip. This is the port of the
|
|
9
9
|
`[kptTooltip]` directive, which likewise added nothing to the DOM.
|
|
10
10
|
|
|
11
11
|
<!-- while visible, appended to body: -->
|
|
12
|
-
<div class="kpt-tooltip" role="tooltip" style="position: fixed;
|
|
12
|
+
<div class="kpt-tooltip" role="tooltip" style="position: fixed; ...">Save changes</div>
|
|
13
13
|
|
|
14
14
|
## Props
|
|
15
|
-
- `text`: string
|
|
15
|
+
- `text`: string - the bubble content; empty text disables the tooltip
|
|
16
16
|
- `position`: 'top' | 'bottom' | 'left' | 'right' (default 'top')
|
|
17
|
-
- `onlyWhenTruncated`: boolean
|
|
18
|
-
- `children`
|
|
17
|
+
- `onlyWhenTruncated`: boolean - show it only when the content does not fit
|
|
18
|
+
- `children` - exactly one element, the one that gets hover and focus
|
|
19
19
|
|
|
20
20
|
## onlyWhenTruncated
|
|
21
21
|
The check runs at hover time, not at render, so the result is always current after a width or zoom
|
|
22
22
|
change, with no observers. It measures the host AND its direct children, because
|
|
23
|
-
`text-overflow: ellipsis` usually sits on an inner element
|
|
23
|
+
`text-overflow: ellipsis` usually sits on an inner element - and such an element shrinks to the
|
|
24
24
|
available width instead of stretching its parent, so measuring the host alone would find nothing.
|
|
25
25
|
|
|
26
26
|
## Styling
|
|
27
|
-
The bubble
|
|
28
|
-
|
|
29
|
-
attach a stylesheet rule to reliably.
|
|
27
|
+
The bubble is created outside React's tree, so its look comes from `.kpt-tooltip` in `@konce-pt/styles`
|
|
28
|
+
(see "Styling and the top layer" below), the same rule the Angular directive uses.
|
|
30
29
|
|
|
31
30
|
## Examples
|
|
32
31
|
<KptTooltip text="Save changes" position="bottom"><KptButton>Save</KptButton></KptTooltip>
|
|
@@ -45,5 +44,8 @@ attach a stylesheet rule to reliably.
|
|
|
45
44
|
the tooltip) and with `onlyWhenTruncated`, where the text is already in the DOM; the visible
|
|
46
45
|
bubble is then `aria-hidden`.
|
|
47
46
|
- `Escape` closes the bubble, and the pointer can move onto it without it disappearing (a 120 ms
|
|
48
|
-
grace period)
|
|
49
|
-
- It does NOT replace an accessible name
|
|
47
|
+
grace period) - WCAG 1.4.13.
|
|
48
|
+
- It does NOT replace an accessible name - an icon-only button still needs its own label.
|
|
49
|
+
|
|
50
|
+
## Styling and the top layer
|
|
51
|
+
The bubble is styled by `.kpt-tooltip` from `@konce-pt/styles`, in the `kpt.components` layer - override it from your own CSS without `!important`; only `position: fixed` and the coordinates stay inline. Inside an open `<dialog>` or popover the bubble is attached to that element, because a modal dialog lives in the top layer and anything outside it is hidden behind it regardless of `z-index`. A hover shows the bubble after 300 ms (sliding across a toolbar does not light every icon); focus shows it at once. Changing the text while the bubble is visible updates it.
|
|
@@ -9,18 +9,19 @@ export interface KptTooltipProps {
|
|
|
9
9
|
* Dzięki temu podpowiedź nie powtarza tekstu, który i tak widać.
|
|
10
10
|
*/
|
|
11
11
|
onlyWhenTruncated?: boolean;
|
|
12
|
-
/** Dokładnie jeden element
|
|
12
|
+
/** Dokładnie jeden element - to on dostaje obsługę hovera i fokusu. */
|
|
13
13
|
children: ReactNode;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Dymek podpowiedzi pokazywany na hover i focus. Lekki
|
|
17
|
-
* i pozycjonowany
|
|
16
|
+
* Dymek podpowiedzi pokazywany na hover i focus. Lekki - element dodawany do `body` (albo do
|
|
17
|
+
* otwartego `<dialog>`/popovera dziecka, żeby był widoczny w warstwie szczytowej) i pozycjonowany
|
|
18
|
+
* względem dziecka. Wygląd daje klasa `.kpt-tooltip` z `@konce-pt/styles` w warstwie `kpt.components`.
|
|
18
19
|
*
|
|
19
20
|
* Port dyrektywy `[kptTooltip]`: nie renderuje własnego opakowania, tylko dokleja handlery
|
|
20
21
|
* i ref do przekazanego elementu, więc drzewo DOM zostaje takie samo jak bez tooltipa.
|
|
21
22
|
*
|
|
22
23
|
* Dostępność (jak w porcie Angulara): tekst trafia do czytników przez trwały, ukryty opis
|
|
23
|
-
* powiązany `aria-describedby` z elementem przyjmującym fokus
|
|
24
|
+
* powiązany `aria-describedby` z elementem przyjmującym fokus - pomijany, gdy powtarzałby
|
|
24
25
|
* jego nazwę albo przy `onlyWhenTruncated`. `Escape` zamyka dymek, a wskaźnik może na niego
|
|
25
26
|
* przejść bez zniknięcia (WCAG 1.4.13).
|
|
26
27
|
*
|