@konce-pt/react 0.12.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +122 -64
- package/dist/accordion/accordion.d.ts +14 -6
- package/dist/accordion/accordion.js +14 -7
- package/dist/accordion/llms.txt +22 -10
- package/dist/alert/alert.d.ts +2 -2
- package/dist/alert/alert.js +2 -2
- package/dist/alert/llms.txt +10 -10
- package/dist/app-shell/app-shell.d.ts +14 -14
- package/dist/app-shell/app-shell.js +11 -11
- package/dist/app-shell/llms.txt +13 -13
- package/dist/auth/auth-types.d.ts +6 -6
- package/dist/auth/auth.d.ts +2 -2
- package/dist/auth/auth.js +7 -7
- package/dist/auth/llms.txt +9 -9
- package/dist/autocomplete/autocomplete.d.ts +19 -6
- package/dist/autocomplete/autocomplete.js +23 -10
- package/dist/autocomplete/llms.txt +16 -5
- package/dist/avatar/avatar.d.ts +6 -6
- package/dist/avatar/avatar.js +5 -5
- package/dist/avatar/llms.txt +10 -10
- package/dist/avatar-group/avatar-group.d.ts +4 -4
- package/dist/avatar-group/avatar-group.js +3 -3
- package/dist/avatar-group/llms.txt +8 -8
- package/dist/backdrop/backdrop.d.ts +7 -7
- package/dist/backdrop/backdrop.js +16 -16
- package/dist/backdrop/llms.txt +27 -27
- package/dist/badge/badge.d.ts +3 -3
- package/dist/badge/badge.js +1 -1
- package/dist/badge/llms.txt +11 -11
- package/dist/bottom-sheet/bottom-sheet.d.ts +4 -4
- package/dist/bottom-sheet/bottom-sheet.js +2 -2
- package/dist/bottom-sheet/llms.txt +9 -9
- package/dist/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/breadcrumb/breadcrumb.js +3 -3
- package/dist/breadcrumb/llms.txt +3 -3
- package/dist/button/button.d.ts +3 -3
- package/dist/button/button.js +8 -8
- package/dist/button/llms.txt +27 -19
- package/dist/button-group/button-group.d.ts +9 -9
- package/dist/button-group/button-group.js +30 -8
- package/dist/button-group/llms.txt +20 -14
- package/dist/card/card.d.ts +8 -8
- package/dist/card/card.js +6 -6
- package/dist/card/llms.txt +20 -20
- package/dist/carousel/carousel.d.ts +6 -6
- package/dist/carousel/carousel.js +4 -4
- package/dist/carousel/llms.txt +10 -10
- package/dist/charts/chart-legend.d.ts +3 -3
- package/dist/charts/chart-legend.js +1 -1
- package/dist/charts/chart-tooltip.d.ts +3 -3
- package/dist/charts/chart-tooltip.js +1 -1
- package/dist/charts/chart.d.ts +1 -1
- package/dist/charts/chart.js +8 -8
- package/dist/charts/llms.txt +6 -6
- package/dist/charts-entry/public-api.js +2 -2
- package/dist/chat/chat.d.ts +17 -10
- package/dist/chat/chat.js +42 -18
- package/dist/chat/llms.txt +32 -17
- package/dist/chat-composer/chat-composer.d.ts +17 -7
- package/dist/chat-composer/chat-composer.js +21 -8
- package/dist/chat-composer/llms.txt +20 -11
- package/dist/chat-dock/chat-dock.d.ts +11 -4
- package/dist/chat-dock/chat-dock.js +9 -6
- package/dist/chat-dock/llms.txt +15 -14
- package/dist/chat-entry/public-api.js +1 -1
- package/dist/chat-message/chat-message.d.ts +12 -5
- package/dist/chat-message/chat-message.js +17 -7
- package/dist/chat-message/llms.txt +16 -15
- package/dist/chat-typing/chat-typing.d.ts +2 -2
- package/dist/chat-typing/chat-typing.js +3 -3
- package/dist/chat-typing/llms.txt +6 -6
- package/dist/checkbox/checkbox.d.ts +13 -6
- package/dist/checkbox/checkbox.js +26 -7
- package/dist/checkbox/llms.txt +24 -12
- package/dist/chip/chip.d.ts +4 -4
- package/dist/chip/chip.js +2 -2
- package/dist/chip/llms.txt +11 -11
- package/dist/chips-input/chips-input.d.ts +4 -4
- package/dist/chips-input/chips-input.js +35 -9
- package/dist/chips-input/llms.txt +15 -8
- package/dist/clock/clock.d.ts +4 -4
- package/dist/clock/clock.js +7 -7
- package/dist/clock/llms.txt +8 -8
- package/dist/color-picker/color-picker.d.ts +6 -6
- package/dist/color-picker/color-picker.js +3 -3
- package/dist/color-picker/llms.txt +5 -5
- package/dist/confirm/confirm-container.d.ts +3 -3
- package/dist/confirm/confirm-container.js +5 -5
- package/dist/confirm/confirm-store.d.ts +4 -4
- package/dist/confirm/confirm-store.js +7 -7
- package/dist/confirm/llms.txt +6 -6
- package/dist/context-menu/context-menu.d.ts +1 -1
- package/dist/context-menu/context-menu.js +5 -5
- package/dist/context-menu/llms.txt +7 -7
- package/dist/data-table/data-table-types.d.ts +5 -5
- package/dist/data-table/data-table.d.ts +29 -8
- package/dist/data-table/data-table.js +340 -95
- package/dist/data-table/export-csv.d.ts +3 -3
- package/dist/data-table/export-csv.js +4 -4
- package/dist/data-table/llms.txt +127 -94
- package/dist/data-view/data-view.d.ts +13 -5
- package/dist/data-view/data-view.js +67 -6
- package/dist/data-view/llms.txt +29 -10
- package/dist/date-range/date-range.d.ts +9 -9
- package/dist/date-range/date-range.js +24 -24
- package/dist/date-range/llms.txt +20 -20
- package/dist/datepicker/datepicker.d.ts +10 -10
- package/dist/datepicker/datepicker.js +29 -29
- package/dist/datepicker/llms.txt +24 -24
- package/dist/dialog/dialog.d.ts +12 -7
- package/dist/dialog/dialog.js +4 -4
- package/dist/dialog/llms.txt +14 -11
- package/dist/divider/divider.d.ts +1 -1
- package/dist/divider/llms.txt +4 -4
- package/dist/drawer/drawer.d.ts +5 -5
- package/dist/drawer/drawer.js +2 -2
- package/dist/drawer/llms.txt +11 -11
- package/dist/empty/empty.d.ts +2 -2
- package/dist/empty/empty.js +1 -1
- package/dist/empty/llms.txt +9 -9
- package/dist/fab/fab.d.ts +1 -1
- package/dist/fab/fab.js +1 -1
- package/dist/fab/llms.txt +10 -6
- package/dist/fieldset/fieldset.d.ts +18 -4
- package/dist/fieldset/fieldset.js +9 -6
- package/dist/fieldset/llms.txt +26 -9
- package/dist/file-upload/file-upload.d.ts +3 -3
- package/dist/file-upload/file-upload.js +7 -7
- package/dist/file-upload/llms.txt +7 -7
- package/dist/form-field/form-field-context.d.ts +4 -4
- package/dist/form-field/form-field.d.ts +12 -4
- package/dist/form-field/form-field.js +26 -6
- package/dist/form-field/llms.txt +25 -11
- package/dist/galleria/galleria.d.ts +3 -3
- package/dist/galleria/galleria.js +5 -5
- package/dist/galleria/llms.txt +7 -7
- package/dist/grid/col.d.ts +4 -4
- package/dist/grid/col.js +2 -2
- package/dist/grid/flex.d.ts +3 -3
- package/dist/grid/flex.js +1 -1
- package/dist/grid/grid.d.ts +7 -7
- package/dist/grid/grid.js +3 -3
- package/dist/grid/layout.d.ts +2 -2
- package/dist/grid/layout.js +2 -2
- package/dist/grid/llms.txt +15 -15
- package/dist/grid-entry/public-api.js +1 -1
- package/dist/i18n/i18n-context.d.ts +3 -3
- package/dist/i18n/i18n-context.js +7 -7
- package/dist/icon/icon-registry.d.ts +3 -3
- package/dist/icon/icon-registry.js +3 -3
- package/dist/icon/icon.d.ts +4 -4
- package/dist/icon/icon.js +6 -6
- package/dist/icon/llms.txt +13 -13
- package/dist/icon-button/icon-button.d.ts +2 -2
- package/dist/icon-button/icon-button.js +1 -1
- package/dist/icon-button/llms.txt +9 -5
- package/dist/icons-entry/public-api.d.ts +2 -2
- package/dist/icons-entry/public-api.js +3 -3
- package/dist/image/image.js +1 -1
- package/dist/image/llms.txt +13 -13
- package/dist/input/input.d.ts +18 -5
- package/dist/input/input.js +21 -6
- package/dist/input/llms.txt +25 -11
- package/dist/input-mask/input-mask.d.ts +1 -1
- package/dist/input-mask/input-mask.js +2 -2
- package/dist/input-mask/llms.txt +5 -5
- package/dist/input-number/input-number.d.ts +9 -9
- package/dist/input-number/input-number.js +11 -11
- package/dist/input-number/llms.txt +14 -14
- package/dist/input-otp/input-otp.d.ts +6 -6
- package/dist/input-otp/input-otp.js +10 -10
- package/dist/input-otp/llms.txt +9 -9
- package/dist/internal/calendar-focus.d.ts +1 -1
- package/dist/internal/calendar-focus.js +3 -3
- package/dist/internal/cn.d.ts +1 -1
- package/dist/internal/mask.d.ts +2 -2
- package/dist/internal/mask.js +4 -4
- package/dist/internal/option-key.d.ts +2 -2
- package/dist/internal/option-key.js +2 -2
- package/dist/internal/option-nav.d.ts +4 -4
- package/dist/internal/option-nav.js +5 -5
- package/dist/internal/overlay-container.js +1 -1
- package/dist/internal/overlay.d.ts +3 -3
- package/dist/internal/overlay.js +8 -8
- package/dist/internal/password-strength.d.ts +2 -2
- package/dist/internal/password-strength.js +6 -6
- package/dist/internal/roving.d.ts +2 -2
- package/dist/internal/roving.js +3 -3
- package/dist/internal/scroll-lock.d.ts +1 -1
- package/dist/internal/scroll-lock.js +2 -2
- package/dist/internal/slot-children.d.ts +3 -3
- package/dist/internal/slot-children.js +4 -4
- package/dist/internal/slot.d.ts +3 -3
- package/dist/internal/slot.js +2 -2
- package/dist/internal/step.d.ts +3 -3
- package/dist/internal/step.js +4 -4
- package/dist/internal/tween.d.ts +5 -5
- package/dist/internal/tween.js +5 -5
- package/dist/internal/types.d.ts +2 -2
- package/dist/internal/use-breakpoint.d.ts +2 -2
- package/dist/internal/use-breakpoint.js +4 -4
- package/dist/internal/use-controllable-state.d.ts +1 -1
- package/dist/internal/use-controllable-state.js +3 -3
- package/dist/internal/use-id.d.ts +2 -2
- package/dist/internal/use-id.js +2 -2
- package/dist/internal/use-modal-focus.d.ts +1 -1
- package/dist/internal/use-modal-focus.js +3 -3
- package/dist/knob/knob.d.ts +4 -4
- package/dist/knob/knob.js +14 -10
- package/dist/knob/llms.txt +17 -12
- package/dist/listbox/listbox.d.ts +6 -6
- package/dist/listbox/listbox.js +9 -9
- package/dist/listbox/llms.txt +10 -10
- package/dist/loader/llms.txt +56 -0
- package/dist/loader/loader.d.ts +49 -0
- package/dist/loader/loader.js +68 -0
- package/dist/map/llms.txt +25 -22
- package/dist/map/map-create-dialog.d.ts +4 -4
- package/dist/map/map-create-dialog.js +10 -10
- package/dist/map/map-hours-field.d.ts +4 -4
- package/dist/map/map-hours-field.js +7 -7
- package/dist/map/map-image-field.d.ts +2 -2
- package/dist/map/map-image-field.js +4 -4
- package/dist/map/map-legend.d.ts +4 -4
- package/dist/map/map-legend.js +2 -2
- package/dist/map/map-poi-card.d.ts +3 -3
- package/dist/map/map-poi-card.js +9 -9
- package/dist/map/map-search.d.ts +17 -6
- package/dist/map/map-search.js +21 -18
- package/dist/map/map.d.ts +21 -14
- package/dist/map/map.js +30 -29
- package/dist/map/ports.d.ts +9 -9
- package/dist/map/ports.js +6 -6
- package/dist/map-entry/public-api.js +2 -2
- package/dist/megamenu/llms.txt +9 -9
- package/dist/megamenu/megamenu.d.ts +6 -6
- package/dist/megamenu/megamenu.js +10 -10
- package/dist/mention/llms.txt +15 -15
- package/dist/mention/mention.d.ts +5 -5
- package/dist/mention/mention.js +2 -2
- package/dist/mention/mentions.d.ts +1 -1
- package/dist/mention/mentions.js +1 -1
- package/dist/menu/llms.txt +12 -12
- package/dist/menu/menu-item.d.ts +4 -4
- package/dist/menu/menu-keys.d.ts +2 -2
- package/dist/menu/menu-keys.js +5 -5
- package/dist/menu/menu.d.ts +2 -2
- package/dist/menu/menu.js +6 -6
- package/dist/menubar/llms.txt +10 -10
- package/dist/menubar/menubar.d.ts +5 -5
- package/dist/menubar/menubar.js +10 -10
- package/dist/meter-group/llms.txt +12 -12
- package/dist/meter-group/meter-group.d.ts +2 -2
- package/dist/meter-group/meter-group.js +1 -1
- package/dist/motion/motion-context.d.ts +22 -0
- package/dist/motion/motion-context.js +28 -0
- package/dist/order-list/llms.txt +22 -10
- package/dist/order-list/order-list.d.ts +12 -4
- package/dist/order-list/order-list.js +104 -21
- package/dist/paginator/llms.txt +8 -8
- package/dist/paginator/paginator.js +1 -1
- package/dist/panel/llms.txt +25 -13
- package/dist/panel/panel.d.ts +11 -3
- package/dist/panel/panel.js +7 -4
- package/dist/password/llms.txt +16 -8
- package/dist/password/password.d.ts +2 -2
- package/dist/password/password.js +24 -3
- package/dist/peek/llms.txt +10 -10
- package/dist/peek/peek.d.ts +6 -6
- package/dist/peek/peek.js +7 -7
- package/dist/pick-list/llms.txt +33 -13
- package/dist/pick-list/pick-list.d.ts +12 -4
- package/dist/pick-list/pick-list.js +111 -23
- package/dist/popover/llms.txt +11 -11
- package/dist/popover/popover.d.ts +4 -4
- package/dist/popover/popover.js +5 -5
- package/dist/progress/llms.txt +17 -17
- package/dist/progress/progress.d.ts +7 -7
- package/dist/progress/progress.js +6 -6
- package/dist/public-api.d.ts +15 -3
- package/dist/public-api.js +13 -7
- package/dist/radio-group/llms.txt +13 -6
- package/dist/radio-group/radio-group.d.ts +11 -4
- package/dist/radio-group/radio-group.js +15 -7
- package/dist/rating/llms.txt +20 -13
- package/dist/rating/rating-pointer.d.ts +16 -0
- package/dist/rating/rating-pointer.js +26 -0
- package/dist/rating/rating.d.ts +6 -6
- package/dist/rating/rating.js +76 -12
- package/dist/rich-text/lists.d.ts +2 -2
- package/dist/rich-text/lists.js +7 -7
- package/dist/rich-text/llms.txt +26 -17
- package/dist/rich-text/rich-text.d.ts +12 -7
- package/dist/rich-text/rich-text.js +78 -54
- package/dist/rich-text/sanitize.d.ts +3 -3
- package/dist/rich-text/sanitize.js +12 -12
- package/dist/rich-text/tables.d.ts +3 -3
- package/dist/rich-text/tables.js +3 -3
- package/dist/roadmap/llms.txt +15 -15
- package/dist/roadmap/roadmap.d.ts +6 -6
- package/dist/roadmap/roadmap.js +19 -19
- package/dist/roadmap-entry/public-api.js +2 -2
- package/dist/scroll-top/llms.txt +6 -6
- package/dist/scroll-top/scroll-top.d.ts +1 -1
- package/dist/scroll-top/scroll-top.js +1 -1
- package/dist/select/llms.txt +19 -12
- package/dist/select/select.d.ts +8 -8
- package/dist/select/select.js +47 -21
- package/dist/shared/types.d.ts +5 -5
- package/dist/shared/types.js +1 -1
- package/dist/sidenav/llms.txt +9 -9
- package/dist/sidenav/sidenav.d.ts +1 -1
- package/dist/sidenav/sidenav.js +1 -1
- package/dist/skeleton/llms.txt +3 -3
- package/dist/skeleton/skeleton.d.ts +1 -1
- package/dist/skeleton/skeleton.js +1 -1
- package/dist/slider/llms.txt +32 -13
- package/dist/slider/slider-drag.d.ts +26 -0
- package/dist/slider/slider-drag.js +79 -0
- package/dist/slider/slider.d.ts +6 -5
- package/dist/slider/slider.js +27 -8
- package/dist/speech/llms.txt +97 -0
- package/dist/speech/speech-button.d.ts +44 -0
- package/dist/speech/speech-button.js +86 -0
- package/dist/speech/speech-wave.d.ts +19 -0
- package/dist/speech/speech-wave.js +16 -0
- package/dist/speech/use-speech-recognition.d.ts +81 -0
- package/dist/speech/use-speech-recognition.js +179 -0
- package/dist/speed-dial/llms.txt +14 -8
- package/dist/speed-dial/speed-dial.d.ts +1 -1
- package/dist/speed-dial/speed-dial.js +1 -1
- package/dist/spinner/llms.txt +7 -7
- package/dist/spinner/spinner.d.ts +1 -1
- package/dist/spinner/spinner.js +1 -1
- package/dist/split-button/llms.txt +21 -15
- package/dist/split-button/split-button.d.ts +2 -2
- package/dist/split-button/split-button.js +4 -4
- package/dist/splitter/llms.txt +11 -11
- package/dist/splitter/splitter.d.ts +3 -3
- package/dist/splitter/splitter.js +5 -5
- package/dist/stepper/llms.txt +33 -14
- package/dist/stepper/stepper.d.ts +6 -6
- package/dist/stepper/stepper.js +53 -10
- package/dist/switch/llms.txt +12 -5
- package/dist/switch/switch.d.ts +10 -3
- package/dist/switch/switch.js +12 -5
- package/dist/switch-group/llms.txt +9 -9
- package/dist/switch-group/switch-group.d.ts +4 -4
- package/dist/switch-group/switch-group.js +4 -4
- package/dist/tabs/llms.txt +10 -10
- package/dist/tabs/tabs.d.ts +5 -5
- package/dist/tabs/tabs.js +8 -8
- package/dist/textarea/llms.txt +23 -12
- package/dist/textarea/textarea.d.ts +19 -6
- package/dist/textarea/textarea.js +21 -7
- package/dist/timeline/llms.txt +4 -4
- package/dist/timeline/timeline.d.ts +1 -1
- package/dist/timeline/timeline.js +1 -1
- package/dist/toast/llms.txt +47 -17
- package/dist/toast/toast-container.d.ts +9 -3
- package/dist/toast/toast-container.js +17 -9
- package/dist/toast/toast-store.d.ts +40 -4
- package/dist/toast/toast-store.js +36 -1
- package/dist/toolbar/llms.txt +7 -7
- package/dist/toolbar/toolbar.d.ts +3 -3
- package/dist/toolbar/toolbar.js +2 -2
- package/dist/tooltip/llms.txt +10 -10
- package/dist/tooltip/tooltip.d.ts +3 -3
- package/dist/tooltip/tooltip.js +18 -18
- package/dist/tree/llms.txt +25 -12
- package/dist/tree/tree-keys.d.ts +5 -5
- package/dist/tree/tree-keys.js +7 -7
- package/dist/tree/tree.d.ts +14 -7
- package/dist/tree/tree.js +53 -18
- package/dist/update/llms.txt +54 -0
- package/dist/update/update.d.ts +49 -0
- package/dist/update/update.js +82 -0
- package/package.json +15 -13
package/dist/avatar/avatar.js
CHANGED
|
@@ -4,12 +4,12 @@ import { useState } from 'react';
|
|
|
4
4
|
import { cn } from "../internal/cn.js";
|
|
5
5
|
import { KptIcon } from "../icon/icon.js";
|
|
6
6
|
/**
|
|
7
|
-
* Awatar
|
|
7
|
+
* Awatar - obraz, inicjały (z `name`) lub ikona.
|
|
8
8
|
*
|
|
9
|
-
* `name` trafia do natywnego `title` (podpowiedź spod kursora
|
|
9
|
+
* `name` trafia do natywnego `title` (podpowiedź spod kursora - inicjały same w sobie nie mówią,
|
|
10
10
|
* kto to jest). Bez `src` awatar dostaje dodatkowo `role="img"` i `aria-label`, a same inicjały
|
|
11
|
-
* są `aria-hidden`, żeby czytnik nie przeczytał
|
|
12
|
-
* niesie już `alt` obrazu
|
|
11
|
+
* są `aria-hidden`, żeby czytnik nie przeczytał "AK" litera po literze. Przy `src` etykietę
|
|
12
|
+
* niesie już `alt` obrazu - nie dublujemy jej.
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* <KptAvatar src="/u/anna.jpg" />
|
|
@@ -18,7 +18,7 @@ import { KptIcon } from "../icon/icon.js";
|
|
|
18
18
|
*/
|
|
19
19
|
export function KptAvatar({ src = null, name = '', icon = null, size = 'md', shape = 'circle', decorative = false, hostProps, className, ...rest }) {
|
|
20
20
|
const { className: hostClassName, ...hostRest } = hostProps ?? {};
|
|
21
|
-
// Zdjęcie, które się nie wczytało
|
|
21
|
+
// Zdjęcie, które się nie wczytało - awatar wraca wtedy do inicjałów (albo ikony). Pamiętamy,
|
|
22
22
|
// którego `src` dotyczy błąd, więc nowy adres próbuje się wczytać od nowa.
|
|
23
23
|
const [brokenSrc, setBrokenSrc] = useState(null);
|
|
24
24
|
const showImage = !!src && brokenSrc !== src;
|
package/dist/avatar/llms.txt
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
# KptAvatar (@konce-pt/react)
|
|
2
2
|
|
|
3
|
-
An avatar
|
|
3
|
+
An avatar - a photo, initials (from `name`) or an icon.
|
|
4
4
|
Import: `import { KptAvatar } from '@konce-pt/react';`
|
|
5
5
|
|
|
6
6
|
## DOM
|
|
7
7
|
<span class="kpt-avatar-host">
|
|
8
8
|
<span class="kpt-avatar" data-size="md" data-shape="circle" title="Anna Kowalska">
|
|
9
|
-
<img class="kpt-avatar__img" src="
|
|
9
|
+
<img class="kpt-avatar__img" src="..." alt="Anna Kowalska">
|
|
10
10
|
</span>
|
|
11
11
|
</span>
|
|
12
12
|
|
|
13
13
|
## Props
|
|
14
|
-
- `src`: string | null
|
|
15
|
-
- `name`: string
|
|
16
|
-
- `icon`: string | null
|
|
14
|
+
- `src`: string | null - a photo; it wins over initials and the icon
|
|
15
|
+
- `name`: string - the source of the initials, the `title` and the accessible label
|
|
16
|
+
- `icon`: string | null - a registry icon name, used when there is neither photo nor name
|
|
17
17
|
- `size`: 'sm' | 'md' | 'lg' | 'xl' (default 'md')
|
|
18
18
|
- `shape`: 'circle' | 'square' (default 'circle')
|
|
19
|
-
- `decorative`: boolean
|
|
20
|
-
- `hostProps`
|
|
19
|
+
- `decorative`: boolean - hides the avatar from screen readers (the name is written next to it)
|
|
20
|
+
- `hostProps` - props for the `.kpt-avatar-host` wrapper
|
|
21
21
|
- `className`, `ref` and every other `<span>` prop go to the inner `.kpt-avatar`
|
|
22
22
|
|
|
23
23
|
## Fallback order
|
|
24
|
-
`src`
|
|
24
|
+
`src` -> `name` (up to two initials, uppercased) -> `icon`. A photo that fails to load drops to the
|
|
25
25
|
next step by itself, and a new `src` is tried again. With none of them the avatar renders as an
|
|
26
26
|
empty shape, which is a valid placeholder.
|
|
27
27
|
|
|
28
28
|
## Positioning inside a parent
|
|
29
|
-
The host is the layout element, so classes that place the avatar in its parent go to `hostProps`
|
|
29
|
+
The host is the layout element, so classes that place the avatar in its parent go to `hostProps` -
|
|
30
30
|
the overlapping avatar on a card is `hostProps={{ className: 'kpt-card__avatar' }}`.
|
|
31
31
|
|
|
32
32
|
## Examples
|
|
@@ -42,5 +42,5 @@ the overlapping avatar on a card is `hostProps={{ className: 'kpt-card__avatar'
|
|
|
42
42
|
`name` goes into the native `title` (initials alone say nothing). With a photo the name is the
|
|
43
43
|
image's `alt`; without one the avatar is `role="img"` with `aria-label`, and the initials are
|
|
44
44
|
`aria-hidden`. A photo that fails to load falls back to the initials (or the icon); a new `src` is
|
|
45
|
-
tried again. `decorative` removes the avatar from the accessibility tree
|
|
45
|
+
tried again. `decorative` removes the avatar from the accessibility tree - use it when the name is
|
|
46
46
|
already written next to it.
|
|
@@ -8,15 +8,15 @@ export interface KptAvatarItem {
|
|
|
8
8
|
}
|
|
9
9
|
export interface KptAvatarGroupProps extends ComponentPropsWithRef<'div'>, KptI18nOverrides {
|
|
10
10
|
avatars?: readonly KptAvatarItem[];
|
|
11
|
-
/** Ile awatarów pokazać, zanim pojawi się
|
|
11
|
+
/** Ile awatarów pokazać, zanim pojawi się "+N". */
|
|
12
12
|
max?: number;
|
|
13
13
|
size?: KptAvatarSize;
|
|
14
|
-
/** Nazwa grupy dla czytników ekranu, np.
|
|
14
|
+
/** Nazwa grupy dla czytników ekranu, np. "Członkowie projektu"; bez niej grupa nie ma roli. */
|
|
15
15
|
label?: string;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* Grupa nakładających się awatarów z licznikiem
|
|
19
|
-
* dziedziczy jego `title` z imieniem
|
|
18
|
+
* Grupa nakładających się awatarów z licznikiem "+N". Buduje na `KptAvatar`, więc każdy element
|
|
19
|
+
* dziedziczy jego `title` z imieniem - inicjały same w sobie nie mówią, kto to jest.
|
|
20
20
|
*
|
|
21
21
|
* @example
|
|
22
22
|
* <KptAvatarGroup avatars={team} max={4} />
|
|
@@ -4,8 +4,8 @@ import { cn } from "../internal/cn.js";
|
|
|
4
4
|
import { useKptMessages } from "../i18n/i18n-context.js";
|
|
5
5
|
import { KptAvatar } from "../avatar/avatar.js";
|
|
6
6
|
/**
|
|
7
|
-
* Grupa nakładających się awatarów z licznikiem
|
|
8
|
-
* dziedziczy jego `title` z imieniem
|
|
7
|
+
* Grupa nakładających się awatarów z licznikiem "+N". Buduje na `KptAvatar`, więc każdy element
|
|
8
|
+
* dziedziczy jego `title` z imieniem - inicjały same w sobie nie mówią, kto to jest.
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* <KptAvatarGroup avatars={team} max={4} />
|
|
@@ -14,7 +14,7 @@ export function KptAvatarGroup({ avatars = [], max = 4, size = 'md', label = '',
|
|
|
14
14
|
const { t } = useKptMessages({ locale, dictionary });
|
|
15
15
|
const shown = avatars.slice(0, max);
|
|
16
16
|
const overflow = Math.max(0, avatars.length - max);
|
|
17
|
-
// Sam
|
|
17
|
+
// Sam "+2" nic czytnikowi nie mówi - licznik ma nazwę "i 2 więcej" i podpowiedź z imionami.
|
|
18
18
|
const hiddenNames = avatars
|
|
19
19
|
.slice(max)
|
|
20
20
|
.map((avatar) => avatar.name)
|
|
@@ -6,22 +6,22 @@ Import: `import { KptAvatarGroup } from '@konce-pt/react';`
|
|
|
6
6
|
## DOM
|
|
7
7
|
<div class="kpt-avatar-group-host">
|
|
8
8
|
<div class="kpt-avatar-group" data-size="lg" role="group" aria-label="Project members">
|
|
9
|
-
<span class="kpt-avatar-group__item"
|
|
9
|
+
<span class="kpt-avatar-group__item">...KptAvatar...</span>...
|
|
10
10
|
<span class="kpt-avatar-group__item kpt-avatar-group__more" role="img" data-size="lg"
|
|
11
11
|
aria-label="2 more" title="Marta, Tomasz"><span aria-hidden="true">+2</span></span>
|
|
12
12
|
</div>
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
15
|
## Props
|
|
16
|
-
- `avatars`: `KptAvatarItem[]`
|
|
17
|
-
- `max`: number (default 4)
|
|
16
|
+
- `avatars`: `KptAvatarItem[]` - `{ name?, src?, icon? }`
|
|
17
|
+
- `max`: number (default 4) - how many to show before "+N"
|
|
18
18
|
- `size`: `'sm' | 'md' | 'lg' | 'xl'`
|
|
19
|
-
- `label`: string
|
|
19
|
+
- `label`: string - the group's name; with it the row is `role="group"`
|
|
20
20
|
- `className`, `ref` and every other `<div>` prop go to the host
|
|
21
21
|
|
|
22
22
|
## One list, three fallbacks
|
|
23
|
-
Each entry falls back in order: `src` (a photo)
|
|
24
|
-
some people have a photo therefore needs no branching at the call site
|
|
23
|
+
Each entry falls back in order: `src` (a photo) -> `name` (initials) -> `icon`. A team where only
|
|
24
|
+
some people have a photo therefore needs no branching at the call site - which is exactly the
|
|
25
25
|
common case.
|
|
26
26
|
|
|
27
27
|
## The name survives the overlap
|
|
@@ -36,6 +36,6 @@ Every avatar keeps the `title` from `KptAvatar`, so hovering tells you who it is
|
|
|
36
36
|
The overlap ring uses `--kpt-color-surface`, the "+N" chip `--kpt-color-muted`.
|
|
37
37
|
|
|
38
38
|
## Accessibility
|
|
39
|
-
Every avatar keeps its own name. With `label` the row is `role="group"` with that name. The
|
|
40
|
-
counter is `role="img"` named from `avatarGroup.more` (`{count}`
|
|
39
|
+
Every avatar keeps its own name. With `label` the row is `role="group"` with that name. The "+N"
|
|
40
|
+
counter is `role="img"` named from `avatarGroup.more` (`{count}` - "2 more"), with the hidden names
|
|
41
41
|
in its `title`. The overlap uses `margin-inline-start`, so it mirrors in RTL.
|
|
@@ -8,22 +8,22 @@ export interface KptBackdropProps extends ComponentPropsWithRef<'div'> {
|
|
|
8
8
|
background?: string;
|
|
9
9
|
/** Tempo; 1 to spokojne tempo obu efektów, 0 zatrzymuje obraz. */
|
|
10
10
|
speed?: number;
|
|
11
|
-
/** Ziarno losowania
|
|
11
|
+
/** Ziarno losowania - ta sama wartość daje ten sam układ kwadratów i ten sam przebieg wstęgi. */
|
|
12
12
|
seed?: number;
|
|
13
13
|
/** Zatrzymuje animację, zostawiając ostatnią klatkę. */
|
|
14
14
|
paused?: boolean;
|
|
15
15
|
/**
|
|
16
16
|
* Przenosi barwy wpisane na sztywno na powierzchnię bieżącego motywu: czerń dobrana do białego
|
|
17
|
-
* tła staje się bielą, gdy tło jest ciemne. Rusza wyłącznie jasność
|
|
17
|
+
* tła staje się bielą, gdy tło jest ciemne. Rusza wyłącznie jasność - odcień i nasycenie
|
|
18
18
|
* zostają, więc barwa marki nie zmienia się w inną barwę.
|
|
19
19
|
*
|
|
20
20
|
* Dotyczy `color`, `colors` i `background`, ale tylko wtedy, gdy podano je literałem. Prop pusty
|
|
21
|
-
* bierze token, a zapis z `var()` sam po token sięga
|
|
21
|
+
* bierze token, a zapis z `var()` sam po token sięga - jedno i drugie już idzie za motywem
|
|
22
22
|
* i adaptacja odwróciłaby je drugi raz.
|
|
23
23
|
*/
|
|
24
24
|
adaptive?: boolean;
|
|
25
25
|
/**
|
|
26
|
-
* `signal-grid`: kolor kwadratów
|
|
26
|
+
* `signal-grid`: kolor kwadratów - dowolny zapis CSS, także sięgający po tokeny, np.
|
|
27
27
|
* `color-mix(in oklab, #5b8af2, var(--kpt-color-surface) 30%)`. Taki zapis przelicza się przy
|
|
28
28
|
* zmianie motywu; literał zostaje literałem. Puste bierze `--kpt-color-primary`.
|
|
29
29
|
*/
|
|
@@ -34,14 +34,14 @@ export interface KptBackdropProps extends ComponentPropsWithRef<'div'> {
|
|
|
34
34
|
cell?: number;
|
|
35
35
|
/** `signal-grid`: odstęp między kwadratami (px). */
|
|
36
36
|
gap?: number;
|
|
37
|
-
/** `signal-grid`: udział zapalonych komórek przy kotwicy, 0
|
|
37
|
+
/** `signal-grid`: udział zapalonych komórek przy kotwicy, 0-1. */
|
|
38
38
|
density?: number;
|
|
39
39
|
/** `signal-grid`: jak szybko siatka gaśnie ku przeciwnej krawędzi. */
|
|
40
40
|
falloff?: number;
|
|
41
41
|
/**
|
|
42
|
-
* `wave`: rampa barw, po której przesuwa się wstęga
|
|
42
|
+
* `wave`: rampa barw, po której przesuwa się wstęga - każdy przystanek dowolnym zapisem CSS.
|
|
43
43
|
* Zamknięta w pętlę, więc ostatnia barwa wraca do pierwszej. Pusta bierze `--kpt-color-primary`
|
|
44
|
-
* i dwie barwy wyprowadzone z niego obrotem odcienia
|
|
44
|
+
* i dwie barwy wyprowadzone z niego obrotem odcienia - paleta biblioteki jest neutralna, więc
|
|
45
45
|
* domyślna wstęga jest jednobarwna i przygaszona. Po kolory sięga się tu, nie do tokenów
|
|
46
46
|
* statusowych. Zapis może sięgać po tokeny i wtedy idzie za motywem. Przystanek, którego
|
|
47
47
|
* przeglądarka nie uznaje za kolor, wypada z rampy; gdy wypadną wszystkie, zostaje rampa
|
|
@@ -11,11 +11,11 @@ const EMPTY = [];
|
|
|
11
11
|
* obraz kosztowałyby transfer i nie poszłyby za motywem.
|
|
12
12
|
*
|
|
13
13
|
* Komponent jest opakowaniem: canvas leży pod spodem, a dzieci idą warstwę wyżej i zachowują się
|
|
14
|
-
* zwyczajnie. Rysowanie stoi, gdy nie ma czego oglądać
|
|
14
|
+
* zwyczajnie. Rysowanie stoi, gdy nie ma czego oglądać - sekcja poza ekranem, karta w tle,
|
|
15
15
|
* `paused`, `speed` równe zeru albo ograniczony ruch w systemie; wtedy zostaje jedna statyczna
|
|
16
16
|
* klatka zamiast pustki, bo efekt jest częścią kompozycji, nie ozdobą.
|
|
17
17
|
*
|
|
18
|
-
* Rysowanie i cała matematyka siedzą w `@konce-pt/backdrop`, wspólnym z portem Angulara
|
|
18
|
+
* Rysowanie i cała matematyka siedzą w `@konce-pt/backdrop`, wspólnym z portem Angulara -
|
|
19
19
|
* ten komponent to sam cykl życia.
|
|
20
20
|
*
|
|
21
21
|
* @example
|
|
@@ -25,7 +25,7 @@ const EMPTY = [];
|
|
|
25
25
|
* </KptBackdrop>
|
|
26
26
|
*/
|
|
27
27
|
const REDUCED_MOTION = '(prefers-reduced-motion: reduce)';
|
|
28
|
-
/** `prefers-reduced-motion` jako zewnętrzny magazyn
|
|
28
|
+
/** `prefers-reduced-motion` jako zewnętrzny magazyn - bez `setState` w efekcie i bez mignięcia ruchu. */
|
|
29
29
|
function subscribeReducedMotion(onChange) {
|
|
30
30
|
if (typeof matchMedia === 'undefined')
|
|
31
31
|
return () => undefined;
|
|
@@ -42,16 +42,16 @@ export function KptBackdrop({ effect = 'signal-grid', background = '', speed = 1
|
|
|
42
42
|
const context = useRef(null);
|
|
43
43
|
const renderer = useRef(null);
|
|
44
44
|
const size = useRef({ width: 0, height: 0 });
|
|
45
|
-
/** Zegar animacji w sekundach
|
|
45
|
+
/** Zegar animacji w sekundach - w refie, żeby przebudowa renderera nie cofała obrazu. */
|
|
46
46
|
const clock = useRef(0);
|
|
47
|
-
/** Kolor wiodący, z którym zbudowany jest bieżący renderer
|
|
47
|
+
/** Kolor wiodący, z którym zbudowany jest bieżący renderer - punkt odniesienia dla zmiany motywu. */
|
|
48
48
|
const lead = useRef('');
|
|
49
|
-
/** Ostatnio zgłoszony zestaw odrzuconych barw
|
|
49
|
+
/** Ostatnio zgłoszony zestaw odrzuconych barw - żeby nie powtarzać tego samego ostrzeżenia. */
|
|
50
50
|
const reported = useRef('');
|
|
51
|
-
/** Tło po adaptacji. Puste znaczy
|
|
51
|
+
/** Tło po adaptacji. Puste znaczy "nie ma czego podmieniać" i wtedy liczy się samo `background`. */
|
|
52
52
|
const [adapted, setAdapted] = useState('');
|
|
53
53
|
/**
|
|
54
|
-
* Ton i kolor treści dobrane do malowanego tła. Puste znaczy
|
|
54
|
+
* Ton i kolor treści dobrane do malowanego tła. Puste znaczy "sekcja nie ma własnego tła"
|
|
55
55
|
* i wtedy treść zostaje przy `--kpt-color-on-surface` ze stylu.
|
|
56
56
|
*/
|
|
57
57
|
const [ink, setInk] = useState({ tone: '', color: '' });
|
|
@@ -81,10 +81,10 @@ export function KptBackdrop({ effect = 'signal-grid', background = '', speed = 1
|
|
|
81
81
|
// Tablica barw przychodzi nowa przy każdym renderze rodzica, więc do zależności idzie jej treść.
|
|
82
82
|
const ramp = colors.join('|');
|
|
83
83
|
const list = useMemo(() => (ramp === '' ? EMPTY : ramp.split('|')), [ramp]);
|
|
84
|
-
// Każda zmiana wejść buduje renderer od nowa
|
|
84
|
+
// Każda zmiana wejść buduje renderer od nowa - zamiast doklejać ścieżki "co się zmieniło".
|
|
85
85
|
useEffect(() => {
|
|
86
86
|
// Kolory rozwiązuje się na canvasie, nie na hoście: sonda `var()` pisze inline style, a nasłuch
|
|
87
|
-
// motywu ogląda `style` hosta i jego przodków
|
|
87
|
+
// motywu ogląda `style` hosta i jego przodków - zapis na hoście zapętliłby przebudowy.
|
|
88
88
|
const scope = canvas.current;
|
|
89
89
|
if (!scope)
|
|
90
90
|
return undefined;
|
|
@@ -93,10 +93,10 @@ export function KptBackdrop({ effect = 'signal-grid', background = '', speed = 1
|
|
|
93
93
|
lead.current = resolved.color;
|
|
94
94
|
const painted = adaptive ? adaptBackdropValue(background, readBackdropSurface(scope)) : background;
|
|
95
95
|
setAdapted(adaptive ? painted : '');
|
|
96
|
-
// Ton liczymy z tła, które sekcja naprawdę pomaluje
|
|
96
|
+
// Ton liczymy z tła, które sekcja naprawdę pomaluje - czyli już po adaptacji.
|
|
97
97
|
setInk(readBackdropInk(scope, painted));
|
|
98
98
|
// Efekt chodzi przy każdej zmianie wejść, więc ciągnięcie suwaka nad wadliwą rampą zasypałoby
|
|
99
|
-
// konsolę tym samym zdaniem
|
|
99
|
+
// konsolę tym samym zdaniem - zgłaszamy dopiero zestaw inny niż poprzednio.
|
|
100
100
|
const rejected = resolved.invalid.join(', ');
|
|
101
101
|
if (rejected !== reported.current) {
|
|
102
102
|
reported.current = rejected;
|
|
@@ -126,7 +126,7 @@ export function KptBackdrop({ effect = 'signal-grid', background = '', speed = 1
|
|
|
126
126
|
renderer.current = null;
|
|
127
127
|
};
|
|
128
128
|
}, [effect, color, list, anchor, cell, gap, density, falloff, rotation, band, amplitude, seed, adaptive, background, theme, measure, paint]);
|
|
129
|
-
// Sam rozmiar nie zmienia ustawień, więc renderer zostaje
|
|
129
|
+
// Sam rozmiar nie zmienia ustawień, więc renderer zostaje - przelicza tylko geometrię.
|
|
130
130
|
useEffect(() => {
|
|
131
131
|
const element = canvas.current;
|
|
132
132
|
if (!element)
|
|
@@ -157,7 +157,7 @@ export function KptBackdrop({ effect = 'signal-grid', background = '', speed = 1
|
|
|
157
157
|
document.removeEventListener('visibilitychange', onTabSwitch);
|
|
158
158
|
};
|
|
159
159
|
}, []);
|
|
160
|
-
// Zmiana motywu przestawia tokeny, a kolory renderera są już wyliczone
|
|
160
|
+
// Zmiana motywu przestawia tokeny, a kolory renderera są już wyliczone - trzeba je odczytać
|
|
161
161
|
// na nowo. Nasłuch trafia też w zmiany niezwiązane z barwą, więc licznik podbija się dopiero
|
|
162
162
|
// wtedy, gdy odczyt naprawdę dał inny kolor.
|
|
163
163
|
useEffect(() => {
|
|
@@ -168,7 +168,7 @@ export function KptBackdrop({ effect = 'signal-grid', background = '', speed = 1
|
|
|
168
168
|
const scope = canvas.current;
|
|
169
169
|
if (!scope)
|
|
170
170
|
return;
|
|
171
|
-
// Ten sam rachunek co w efekcie budującym
|
|
171
|
+
// Ten sam rachunek co w efekcie budującym - inaczej strażnik porównywałby wartość sprzed
|
|
172
172
|
// adaptacji z zapamiętaną po adaptacji i podbijałby licznik bez przerwy.
|
|
173
173
|
const next = adaptive ? adaptBackdropValue(color, readBackdropSurface(scope)) : color;
|
|
174
174
|
if (readBackdropLead(scope, next) === lead.current)
|
|
@@ -184,7 +184,7 @@ export function KptBackdrop({ effect = 'signal-grid', background = '', speed = 1
|
|
|
184
184
|
const tick = (now) => {
|
|
185
185
|
const step = last === 0 ? 0 : Math.min(now - last, KPT_BACKDROP_MAX_STEP);
|
|
186
186
|
last = now;
|
|
187
|
-
// Prędkość wchodzi w zegar, nie w fazę
|
|
187
|
+
// Prędkość wchodzi w zegar, nie w fazę - suwak przyspiesza obraz zamiast go przeskakiwać. Pętla
|
|
188
188
|
// restartuje się przy zmianie `speed` (zależność efektu), a zegar żyje w refie, więc nic nie skacze.
|
|
189
189
|
clock.current += (step / 1000) * speed;
|
|
190
190
|
paint();
|
package/dist/backdrop/llms.txt
CHANGED
|
@@ -9,33 +9,33 @@ Import: `import { KptBackdrop } from '@konce-pt/react';`
|
|
|
9
9
|
## DOM
|
|
10
10
|
<div class="kpt-backdrop-host" data-effect="wave">
|
|
11
11
|
<canvas class="kpt-backdrop__canvas" aria-hidden="true"></canvas>
|
|
12
|
-
<div class="kpt-backdrop__content"
|
|
12
|
+
<div class="kpt-backdrop__content">...</div>
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
15
|
## Props (shared)
|
|
16
16
|
- `effect`: 'signal-grid' | 'wave' (default 'signal-grid')
|
|
17
|
-
- `background`: string
|
|
18
|
-
- `speed`: number (default 1)
|
|
19
|
-
- `seed`: number (default 0)
|
|
20
|
-
- `paused`: boolean
|
|
21
|
-
- `adaptive`: boolean
|
|
22
|
-
- `contentProps`
|
|
17
|
+
- `background`: string - the section background; empty takes `--kpt-color-surface`
|
|
18
|
+
- `speed`: number (default 1) - 1 is the calm pace of either effect, 0 freezes the picture
|
|
19
|
+
- `seed`: number (default 0) - the same value gives the same layout and the same sway
|
|
20
|
+
- `paused`: boolean - stops the animation, leaving the last frame
|
|
21
|
+
- `adaptive`: boolean - carries hardcoded colours onto the current theme's surface
|
|
22
|
+
- `contentProps` - props for the `.kpt-backdrop__content` layer
|
|
23
23
|
- `className`, `ref` and every other `<div>` prop go to `.kpt-backdrop-host`
|
|
24
24
|
|
|
25
25
|
## Props (signal-grid)
|
|
26
|
-
- `color`: string
|
|
26
|
+
- `color`: string - the square colour, any CSS notation, tokens included; empty takes
|
|
27
27
|
`--kpt-color-primary`
|
|
28
|
-
- `anchor`: 'left' | 'right' (default 'right')
|
|
29
|
-
- `cell`: number (default 5), `gap`: number (default 11)
|
|
30
|
-
- `density`: number (default 0.8)
|
|
31
|
-
- `falloff`: number (default 1.4)
|
|
28
|
+
- `anchor`: 'left' | 'right' (default 'right') - the edge the grid is densest at
|
|
29
|
+
- `cell`: number (default 5), `gap`: number (default 11) - the square and the space between, in px
|
|
30
|
+
- `density`: number (default 0.8) - the share of lit cells at the anchor, 0-1
|
|
31
|
+
- `falloff`: number (default 1.4) - how fast the grid fades towards the far edge
|
|
32
32
|
|
|
33
33
|
## Props (wave)
|
|
34
|
-
- `colors`: string[]
|
|
34
|
+
- `colors`: string[] - the colour ramp the current slides along, closed into a loop; every
|
|
35
35
|
stop takes any CSS notation, `color`'s rules exactly
|
|
36
|
-
- `rotation`: number (default 12)
|
|
37
|
-
- `band`: number (default 0.34)
|
|
38
|
-
- `amplitude`: number (default 0.16)
|
|
36
|
+
- `rotation`: number (default 12) - the angle the current crosses the frame at, in degrees
|
|
37
|
+
- `band`: number (default 0.34) - the band's width as a fraction of the frame's height
|
|
38
|
+
- `amplitude`: number (default 0.16) - how far the centre line sways
|
|
39
39
|
|
|
40
40
|
A prop that does not belong to the current effect is simply not read.
|
|
41
41
|
|
|
@@ -56,12 +56,12 @@ rotation. The library's palette is neutral, so that default current is single-hu
|
|
|
56
56
|
|
|
57
57
|
Every stop is put to the browser, so `oklch()`, `color-mix()`, `rgb()` and named colours are read
|
|
58
58
|
the same as hex; alpha is dropped. A stop the browser refuses falls out of the ramp, and if every
|
|
59
|
-
one of them falls out the default ramp takes over rather than the section going blank
|
|
59
|
+
one of them falls out the default ramp takes over rather than the section going blank - a dev
|
|
60
60
|
build says in the console which stops it dropped.
|
|
61
61
|
|
|
62
62
|
## The same picture in both ports
|
|
63
|
-
Everything that decides how it looks
|
|
64
|
-
and the colour ramp, plus the renderers themselves
|
|
63
|
+
Everything that decides how it looks - the grid layout, the density ramp, the twinkle, the current
|
|
64
|
+
and the colour ramp, plus the renderers themselves - lives in `@konce-pt/backdrop`, shared with
|
|
65
65
|
the Angular port. This component is the lifecycle: `rAF`, `ResizeObserver`, `IntersectionObserver`,
|
|
66
66
|
the reduced-motion query and the theme watch. The same props therefore give the
|
|
67
67
|
same frame in either port.
|
|
@@ -74,7 +74,7 @@ slider accelerates the picture instead of jumping it. A change of `colors` is tr
|
|
|
74
74
|
not by array identity, so a fresh array from a parent render does not rebuild the renderer.
|
|
75
75
|
|
|
76
76
|
## Accessibility
|
|
77
|
-
The canvas carries `aria-hidden="true"` and `pointer-events: none`
|
|
77
|
+
The canvas carries `aria-hidden="true"` and `pointer-events: none` - it is decoration with no
|
|
78
78
|
content and nothing to hit. Children keep their own roles and tab order.
|
|
79
79
|
|
|
80
80
|
## Tokens
|
|
@@ -86,24 +86,24 @@ A literal stays put by design, which is right for a brand colour and wrong for a
|
|
|
86
86
|
read in both themes. `adaptive` closes that gap: it carries `color`, `colors` and `background`
|
|
87
87
|
onto the surface of the current theme, keeping each one's distance from that surface. Black picked
|
|
88
88
|
for a white section comes out white on a near-black ground, and that white background comes out at
|
|
89
|
-
the surface's own lightness. Only lightness moves
|
|
89
|
+
the surface's own lightness. Only lightness moves - hue and chroma stay, so a brand colour keeps
|
|
90
90
|
being that colour and only changes how light it is.
|
|
91
91
|
|
|
92
92
|
It touches literals only. An empty input takes a token, and a value reaching through `var()`
|
|
93
93
|
reaches a token too; both already follow the theme, and adapting them would turn them back again.
|
|
94
|
-
Values written for the light theme are the assumption
|
|
94
|
+
Values written for the light theme are the assumption - the library keeps light in `:root` and
|
|
95
95
|
dark as the override.
|
|
96
96
|
|
|
97
97
|
## Content on a custom background
|
|
98
98
|
The host paints `--kpt-color-surface` and lets content inherit `--kpt-color-on-surface`, which is
|
|
99
|
-
right until the section gets a `background` of its own
|
|
99
|
+
right until the section gets a `background` of its own - then that token describes the page around
|
|
100
100
|
it, not the ground the content actually sits on. A dark section in a light theme would come out
|
|
101
101
|
black on black.
|
|
102
102
|
|
|
103
103
|
So a section with its own background works out its own ink: the host sets `color` to match what it
|
|
104
104
|
paints, and announces the result as `data-tone` (`light` for a light background, `dark` for a dark
|
|
105
|
-
one). Text follows by inheritance; anything needing more than a text colour
|
|
106
|
-
section, say
|
|
105
|
+
one). Text follows by inheritance; anything needing more than a text colour - buttons in the
|
|
106
|
+
section, say - can hang its own tokens off the attribute:
|
|
107
107
|
|
|
108
108
|
:where(div.kpt-backdrop-host[data-tone='light']) .hero { --kpt-button-filled-bg: #15181a; }
|
|
109
109
|
|
|
@@ -112,7 +112,7 @@ matches the adapted value, not the one written in the template. A section withou
|
|
|
112
112
|
background announces nothing and content stays on `--kpt-color-on-surface`.
|
|
113
113
|
|
|
114
114
|
## Theme
|
|
115
|
-
Canvas does not expand `var()`, so the colour is read once and baked into the renderer
|
|
115
|
+
Canvas does not expand `var()`, so the colour is read once and baked into the renderer - the
|
|
116
116
|
component therefore watches for anything that can restyle the tokens under it and reads them
|
|
117
117
|
again. `[data-theme="dark"]` is not tied to `:root`, so the watch covers `data-theme`, `class`
|
|
118
118
|
and `style` on every ancestor from the host up to `<html>`, plus the `prefers-color-scheme` query
|
|
@@ -122,7 +122,7 @@ when the colour actually came out different, so an unrelated class landing on `<
|
|
|
122
122
|
cheap read and nothing else.
|
|
123
123
|
|
|
124
124
|
Whether an explicit `color` or `colors` follows the theme is up to how it is written. A literal
|
|
125
|
-
stays put
|
|
125
|
+
stays put - `#5b8af2` is `#5b8af2` in either theme, which is what someone spelling out a brand
|
|
126
126
|
colour wants. An expression reaching for a token is resolved against the tree on every rebuild, so
|
|
127
127
|
it moves with the theme on its own:
|
|
128
128
|
|
package/dist/badge/badge.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type KptBadgeSize = 'sm' | 'md' | 'lg';
|
|
|
4
4
|
export interface KptBadgeProps extends ComponentPropsWithRef<'span'> {
|
|
5
5
|
value?: string | number | null;
|
|
6
6
|
variant?: KptBadgeVariant;
|
|
7
|
-
/** Rozmiar
|
|
7
|
+
/** Rozmiar - `sm` mieści się w wierszu tekstu, `md` to domyślny licznik. */
|
|
8
8
|
size?: KptBadgeSize;
|
|
9
9
|
/** Sama kropka statusu, bez liczby. */
|
|
10
10
|
dot?: boolean;
|
|
@@ -13,7 +13,7 @@ export interface KptBadgeProps extends ComponentPropsWithRef<'span'> {
|
|
|
13
13
|
/** Powyżej tej wartości licznik pokazuje `99+`. */
|
|
14
14
|
max?: number;
|
|
15
15
|
/**
|
|
16
|
-
* Znaczenie plakietki dla czytnika ekranu, np.
|
|
16
|
+
* Znaczenie plakietki dla czytnika ekranu, np. "3 nieprzeczytane". Sama liczba ("3") albo kropka
|
|
17
17
|
* nic nie mówią; z `label` widoczny tekst jest ukryty przed czytnikiem, a odczytywana jest etykieta.
|
|
18
18
|
*/
|
|
19
19
|
label?: string;
|
|
@@ -22,7 +22,7 @@ export interface KptBadgeProps extends ComponentPropsWithRef<'span'> {
|
|
|
22
22
|
children?: ReactNode;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* Znacznik (badge)
|
|
25
|
+
* Znacznik (badge) - licznik lub kropka statusu. Samodzielny albo nałożony na treść (`overlay`).
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
28
|
* <KptBadge value={3} variant="danger" />
|
package/dist/badge/badge.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "../internal/cn.js";
|
|
3
3
|
/**
|
|
4
|
-
* Znacznik (badge)
|
|
4
|
+
* Znacznik (badge) - licznik lub kropka statusu. Samodzielny albo nałożony na treść (`overlay`).
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
7
|
* <KptBadge value={3} variant="danger" />
|
package/dist/badge/llms.txt
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
# KptBadge (@konce-pt/react)
|
|
2
2
|
|
|
3
|
-
A badge
|
|
3
|
+
A badge - a counter or a status dot. Standalone, or laid over content (`overlay`).
|
|
4
4
|
Import: `import { KptBadge } from '@konce-pt/react';`
|
|
5
5
|
|
|
6
6
|
## DOM
|
|
7
7
|
<span class="kpt-badge-host">
|
|
8
|
-
|
|
8
|
+
...children...
|
|
9
9
|
<span class="kpt-badge kpt-badge--overlay" data-variant="danger" data-size="md">
|
|
10
10
|
<span aria-hidden="true">8</span><span class="kpt-badge__label">8 unread</span>
|
|
11
11
|
</span>
|
|
12
12
|
</span>
|
|
13
13
|
|
|
14
14
|
## Props
|
|
15
|
-
- `value`: string | number | null
|
|
15
|
+
- `value`: string | number | null - the counter content
|
|
16
16
|
- `variant`: 'neutral' | 'primary' | 'success' | 'danger' | 'warning' | 'info' (default 'primary')
|
|
17
|
-
- `size`: 'sm' | 'md' | 'lg' (default 'md')
|
|
18
|
-
- `dot`: boolean
|
|
19
|
-
- `overlay`: boolean
|
|
20
|
-
- `max`: number (default 99)
|
|
21
|
-
- `label`: string
|
|
22
|
-
- `hideZero`: boolean
|
|
17
|
+
- `size`: 'sm' | 'md' | 'lg' (default 'md') - `sm` fits inside a line of text
|
|
18
|
+
- `dot`: boolean - a bare status dot, no number
|
|
19
|
+
- `overlay`: boolean - laid over the `children`
|
|
20
|
+
- `max`: number (default 99) - above it the counter reads `99+`
|
|
21
|
+
- `label`: string - the meaning for screen readers ("3 unread", "online"); the visible text is then `aria-hidden`
|
|
22
|
+
- `hideZero`: boolean - hides the badge when `value` is `0` or `null` (not with `dot`)
|
|
23
23
|
- `className`, `ref` and every other `<span>` prop go to the host
|
|
24
24
|
|
|
25
25
|
## Overlay
|
|
@@ -34,10 +34,10 @@ it on the host rather than on the badge.
|
|
|
34
34
|
<span>Notifications <KptBadge value={4} size="sm" variant="success" /></span>
|
|
35
35
|
|
|
36
36
|
## Tokens
|
|
37
|
-
Background `--kpt-color-{primary,success,danger,warning,info}` with the text in the matching `*-contrast` token (`--kpt-color-on-primary` for `primary`)
|
|
37
|
+
Background `--kpt-color-{primary,success,danger,warning,info}` with the text in the matching `*-contrast` token (`--kpt-color-on-primary` for `primary`) - the same pairs as `kpt-button`; `neutral` is `--kpt-color-muted` / `--kpt-color-on-muted`; the overlay ring comes from `--kpt-color-surface`.
|
|
38
38
|
|
|
39
39
|
## Accessibility
|
|
40
|
-
On its own a badge is just a number, and a `dot` is nothing. `label` gives it a meaning
|
|
40
|
+
On its own a badge is just a number, and a `dot` is nothing. `label` gives it a meaning - a visually
|
|
41
41
|
hidden `.kpt-badge__label` that screen readers read instead of the visible text. Without `label`, put
|
|
42
42
|
the meaning into the name of the control the badge sits on. Count changes are not announced. The
|
|
43
43
|
`success`, `warning` and `info` variants draw the text in `--kpt-color-surface`; check the contrast
|
|
@@ -5,8 +5,8 @@ export interface KptBottomSheetProps extends ComponentPropsWithRef<'div'>, KptI1
|
|
|
5
5
|
onOpenChange: (open: boolean) => void;
|
|
6
6
|
header?: string;
|
|
7
7
|
/**
|
|
8
|
-
* Nazwa panelu bez `header`
|
|
9
|
-
* dialogowe
|
|
8
|
+
* Nazwa panelu bez `header` - okno dialogowe bez nazwy czytnik ogłasza jako samo "okno
|
|
9
|
+
* dialogowe" (WCAG 4.1.2). Z nagłówkiem nazwą jest nagłówek (`aria-labelledby`).
|
|
10
10
|
*/
|
|
11
11
|
ariaLabel?: string;
|
|
12
12
|
closeOnBackdrop?: boolean;
|
|
@@ -15,12 +15,12 @@ export interface KptBottomSheetProps extends ComponentPropsWithRef<'div'>, KptI1
|
|
|
15
15
|
/**
|
|
16
16
|
* Arkusz wysuwany z dołu ekranu.
|
|
17
17
|
*
|
|
18
|
-
* Arkusz zostaje w DOM także zamknięty
|
|
18
|
+
* Arkusz zostaje w DOM także zamknięty - chowa go `transform` i `visibility`, nigdy
|
|
19
19
|
* `display: none`, bo inaczej animacje wjazdu i zjazdu nie miałyby od czego wystartować.
|
|
20
20
|
* `visibility` wyjmuje go przy tym z kolejności Tab i z drzewa dostępności bez `inert`,
|
|
21
21
|
* i robi to już na pierwszej klatce.
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
|
-
* <KptBottomSheet open={open} onOpenChange={setOpen} header="Udostępnij"
|
|
24
|
+
* <KptBottomSheet open={open} onOpenChange={setOpen} header="Udostępnij">...</KptBottomSheet>
|
|
25
25
|
*/
|
|
26
26
|
export declare function KptBottomSheet({ open, onOpenChange, header, ariaLabel, closeOnBackdrop, locale, dictionary, className, children, ...rest }: Readonly<KptBottomSheetProps>): import("react").JSX.Element;
|
|
@@ -8,13 +8,13 @@ import { useKptMessages } from "../i18n/i18n-context.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* Arkusz wysuwany z dołu ekranu.
|
|
10
10
|
*
|
|
11
|
-
* Arkusz zostaje w DOM także zamknięty
|
|
11
|
+
* Arkusz zostaje w DOM także zamknięty - chowa go `transform` i `visibility`, nigdy
|
|
12
12
|
* `display: none`, bo inaczej animacje wjazdu i zjazdu nie miałyby od czego wystartować.
|
|
13
13
|
* `visibility` wyjmuje go przy tym z kolejności Tab i z drzewa dostępności bez `inert`,
|
|
14
14
|
* i robi to już na pierwszej klatce.
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
|
-
* <KptBottomSheet open={open} onOpenChange={setOpen} header="Udostępnij"
|
|
17
|
+
* <KptBottomSheet open={open} onOpenChange={setOpen} header="Udostępnij">...</KptBottomSheet>
|
|
18
18
|
*/
|
|
19
19
|
export function KptBottomSheet({ open, onOpenChange, header = '', ariaLabel = '', closeOnBackdrop = true, locale, dictionary, className, children, ...rest }) {
|
|
20
20
|
const { t } = useKptMessages({ locale, dictionary });
|
|
@@ -9,44 +9,44 @@ Import: `import { KptBottomSheet } from '@konce-pt/react';`
|
|
|
9
9
|
<div class="kpt-bottom-sheet__panel is-open" role="dialog" aria-modal="true" tabindex="-1">
|
|
10
10
|
<button class="kpt-bottom-sheet__handle"></button>
|
|
11
11
|
<div class="kpt-bottom-sheet__header">Share</div>
|
|
12
|
-
<div class="kpt-bottom-sheet__body"
|
|
12
|
+
<div class="kpt-bottom-sheet__body">...</div>
|
|
13
13
|
</div>
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
16
|
## Props
|
|
17
|
-
- `open`, `onOpenChange`
|
|
17
|
+
- `open`, `onOpenChange` - controlled, like `KptDialog`
|
|
18
18
|
- `header`: string
|
|
19
19
|
- `closeOnBackdrop`: boolean (default true)
|
|
20
|
-
- `children`
|
|
20
|
+
- `children` - the sheet's content
|
|
21
21
|
- `className`, `ref` and every other `<div>` prop go to the host
|
|
22
22
|
|
|
23
23
|
## The closed sheet stays in the DOM
|
|
24
|
-
It is hidden with `transform` and `visibility`, never `display: none`
|
|
24
|
+
It is hidden with `transform` and `visibility`, never `display: none` - the slide-in and slide-out
|
|
25
25
|
animations need something to run on. `visibility` also takes it out of the tab order and out of the
|
|
26
26
|
accessibility tree without `inert`, and does so on the very first frame, with no JavaScript.
|
|
27
27
|
`prefers-reduced-motion: reduce` drops the transitions.
|
|
28
28
|
|
|
29
29
|
## No portal
|
|
30
30
|
The panel and the backdrop are `position: fixed` and the host is `display: contents`, so the sheet
|
|
31
|
-
needs no portal
|
|
31
|
+
needs no portal - the same DOM as the Angular port. A transformed ancestor would break the fixed
|
|
32
32
|
positioning there too.
|
|
33
33
|
|
|
34
34
|
## Focus and keyboard
|
|
35
35
|
Opening moves focus into the panel (its first focusable element, else the panel
|
|
36
|
-
itself) and traps it there
|
|
36
|
+
itself) and traps it there - `Tab` / `Shift+Tab` wrap inside, as `aria-modal="true"` promises.
|
|
37
37
|
Closing returns focus to the element that had it before. `Escape` closes the panel. The panel
|
|
38
38
|
is named by its `header` through `aria-labelledby`. The shared helper is `internal/use-modal-focus.ts` (the Angular port has a twin on the CDK focus trap).
|
|
39
39
|
|
|
40
40
|
## Examples
|
|
41
41
|
<KptButton onClick={() => setOpen(true)}>Share</KptButton>
|
|
42
|
-
<KptBottomSheet open={open} onOpenChange={setOpen} header="Share"
|
|
42
|
+
<KptBottomSheet open={open} onOpenChange={setOpen} header="Share">...</KptBottomSheet>
|
|
43
43
|
|
|
44
44
|
## Tokens
|
|
45
45
|
The panel `--kpt-color-surface-raised`, the top radius `--kpt-radius-lg`, `--kpt-elevation-4`.
|
|
46
46
|
|
|
47
47
|
## Accessibility
|
|
48
48
|
`role="dialog"`, `aria-modal` and `aria-labelledby` pointing at the header; the handle is a real button
|
|
49
|
-
labelled from `common.close`. Focus handling
|
|
49
|
+
labelled from `common.close`. Focus handling - see "Focus and keyboard" above.
|
|
50
50
|
|
|
51
51
|
## Name and scrolling
|
|
52
|
-
Without `header` give the sheet `ariaLabel`
|
|
52
|
+
Without `header` give the sheet `ariaLabel` - a `role="dialog"` without a name is announced as a bare "dialog". An open sheet locks page scrolling underneath.
|