@konce-pt/react 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +122 -64
- package/dist/accordion/accordion.d.ts +14 -6
- package/dist/accordion/accordion.js +14 -7
- package/dist/accordion/llms.txt +22 -10
- package/dist/alert/alert.d.ts +2 -2
- package/dist/alert/alert.js +2 -2
- package/dist/alert/llms.txt +10 -10
- package/dist/app-shell/app-shell.d.ts +14 -14
- package/dist/app-shell/app-shell.js +11 -11
- package/dist/app-shell/llms.txt +13 -13
- package/dist/auth/auth-types.d.ts +6 -6
- package/dist/auth/auth.d.ts +2 -2
- package/dist/auth/auth.js +7 -7
- package/dist/auth/llms.txt +9 -9
- package/dist/autocomplete/autocomplete.d.ts +19 -6
- package/dist/autocomplete/autocomplete.js +23 -10
- package/dist/autocomplete/llms.txt +16 -5
- package/dist/avatar/avatar.d.ts +6 -6
- package/dist/avatar/avatar.js +5 -5
- package/dist/avatar/llms.txt +10 -10
- package/dist/avatar-group/avatar-group.d.ts +4 -4
- package/dist/avatar-group/avatar-group.js +3 -3
- package/dist/avatar-group/llms.txt +8 -8
- package/dist/backdrop/backdrop.d.ts +7 -7
- package/dist/backdrop/backdrop.js +16 -16
- package/dist/backdrop/llms.txt +27 -27
- package/dist/badge/badge.d.ts +3 -3
- package/dist/badge/badge.js +1 -1
- package/dist/badge/llms.txt +11 -11
- package/dist/bottom-sheet/bottom-sheet.d.ts +4 -4
- package/dist/bottom-sheet/bottom-sheet.js +2 -2
- package/dist/bottom-sheet/llms.txt +9 -9
- package/dist/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/breadcrumb/breadcrumb.js +3 -3
- package/dist/breadcrumb/llms.txt +3 -3
- package/dist/button/button.d.ts +3 -3
- package/dist/button/button.js +8 -8
- package/dist/button/llms.txt +27 -19
- package/dist/button-group/button-group.d.ts +9 -9
- package/dist/button-group/button-group.js +30 -8
- package/dist/button-group/llms.txt +20 -14
- package/dist/card/card.d.ts +8 -8
- package/dist/card/card.js +6 -6
- package/dist/card/llms.txt +20 -20
- package/dist/carousel/carousel.d.ts +6 -6
- package/dist/carousel/carousel.js +4 -4
- package/dist/carousel/llms.txt +10 -10
- package/dist/charts/chart-legend.d.ts +3 -3
- package/dist/charts/chart-legend.js +1 -1
- package/dist/charts/chart-tooltip.d.ts +3 -3
- package/dist/charts/chart-tooltip.js +1 -1
- package/dist/charts/chart.d.ts +1 -1
- package/dist/charts/chart.js +8 -8
- package/dist/charts/llms.txt +6 -6
- package/dist/charts-entry/public-api.js +2 -2
- package/dist/chat/chat.d.ts +17 -10
- package/dist/chat/chat.js +42 -18
- package/dist/chat/llms.txt +32 -17
- package/dist/chat-composer/chat-composer.d.ts +17 -7
- package/dist/chat-composer/chat-composer.js +21 -8
- package/dist/chat-composer/llms.txt +20 -11
- package/dist/chat-dock/chat-dock.d.ts +11 -4
- package/dist/chat-dock/chat-dock.js +9 -6
- package/dist/chat-dock/llms.txt +15 -14
- package/dist/chat-entry/public-api.js +1 -1
- package/dist/chat-message/chat-message.d.ts +12 -5
- package/dist/chat-message/chat-message.js +17 -7
- package/dist/chat-message/llms.txt +16 -15
- package/dist/chat-typing/chat-typing.d.ts +2 -2
- package/dist/chat-typing/chat-typing.js +3 -3
- package/dist/chat-typing/llms.txt +6 -6
- package/dist/checkbox/checkbox.d.ts +13 -6
- package/dist/checkbox/checkbox.js +26 -7
- package/dist/checkbox/llms.txt +24 -12
- package/dist/chip/chip.d.ts +4 -4
- package/dist/chip/chip.js +2 -2
- package/dist/chip/llms.txt +11 -11
- package/dist/chips-input/chips-input.d.ts +4 -4
- package/dist/chips-input/chips-input.js +35 -9
- package/dist/chips-input/llms.txt +15 -8
- package/dist/clock/clock.d.ts +4 -4
- package/dist/clock/clock.js +7 -7
- package/dist/clock/llms.txt +8 -8
- package/dist/color-picker/color-picker.d.ts +6 -6
- package/dist/color-picker/color-picker.js +3 -3
- package/dist/color-picker/llms.txt +5 -5
- package/dist/confirm/confirm-container.d.ts +3 -3
- package/dist/confirm/confirm-container.js +5 -5
- package/dist/confirm/confirm-store.d.ts +4 -4
- package/dist/confirm/confirm-store.js +7 -7
- package/dist/confirm/llms.txt +6 -6
- package/dist/context-menu/context-menu.d.ts +1 -1
- package/dist/context-menu/context-menu.js +5 -5
- package/dist/context-menu/llms.txt +7 -7
- package/dist/data-table/data-table-types.d.ts +5 -5
- package/dist/data-table/data-table.d.ts +29 -8
- package/dist/data-table/data-table.js +340 -95
- package/dist/data-table/export-csv.d.ts +3 -3
- package/dist/data-table/export-csv.js +4 -4
- package/dist/data-table/llms.txt +127 -94
- package/dist/data-view/data-view.d.ts +13 -5
- package/dist/data-view/data-view.js +67 -6
- package/dist/data-view/llms.txt +29 -10
- package/dist/date-range/date-range.d.ts +9 -9
- package/dist/date-range/date-range.js +24 -24
- package/dist/date-range/llms.txt +20 -20
- package/dist/datepicker/datepicker.d.ts +10 -10
- package/dist/datepicker/datepicker.js +29 -29
- package/dist/datepicker/llms.txt +24 -24
- package/dist/dialog/dialog.d.ts +4 -4
- package/dist/dialog/dialog.js +4 -4
- package/dist/dialog/llms.txt +11 -11
- package/dist/divider/divider.d.ts +1 -1
- package/dist/divider/llms.txt +4 -4
- package/dist/drawer/drawer.d.ts +5 -5
- package/dist/drawer/drawer.js +2 -2
- package/dist/drawer/llms.txt +11 -11
- package/dist/empty/empty.d.ts +2 -2
- package/dist/empty/empty.js +1 -1
- package/dist/empty/llms.txt +9 -9
- package/dist/fab/fab.d.ts +1 -1
- package/dist/fab/fab.js +1 -1
- package/dist/fab/llms.txt +10 -6
- package/dist/fieldset/fieldset.d.ts +18 -4
- package/dist/fieldset/fieldset.js +9 -6
- package/dist/fieldset/llms.txt +26 -9
- package/dist/file-upload/file-upload.d.ts +3 -3
- package/dist/file-upload/file-upload.js +7 -7
- package/dist/file-upload/llms.txt +7 -7
- package/dist/form-field/form-field-context.d.ts +4 -4
- package/dist/form-field/form-field.d.ts +12 -4
- package/dist/form-field/form-field.js +26 -6
- package/dist/form-field/llms.txt +25 -11
- package/dist/galleria/galleria.d.ts +3 -3
- package/dist/galleria/galleria.js +5 -5
- package/dist/galleria/llms.txt +7 -7
- package/dist/grid/col.d.ts +4 -4
- package/dist/grid/col.js +2 -2
- package/dist/grid/flex.d.ts +3 -3
- package/dist/grid/flex.js +1 -1
- package/dist/grid/grid.d.ts +7 -7
- package/dist/grid/grid.js +3 -3
- package/dist/grid/layout.d.ts +2 -2
- package/dist/grid/layout.js +2 -2
- package/dist/grid/llms.txt +15 -15
- package/dist/grid-entry/public-api.js +1 -1
- package/dist/i18n/i18n-context.d.ts +3 -3
- package/dist/i18n/i18n-context.js +7 -7
- package/dist/icon/icon-registry.d.ts +3 -3
- package/dist/icon/icon-registry.js +3 -3
- package/dist/icon/icon.d.ts +4 -4
- package/dist/icon/icon.js +6 -6
- package/dist/icon/llms.txt +13 -13
- package/dist/icon-button/icon-button.d.ts +2 -2
- package/dist/icon-button/icon-button.js +1 -1
- package/dist/icon-button/llms.txt +9 -5
- package/dist/icons-entry/public-api.d.ts +2 -2
- package/dist/icons-entry/public-api.js +3 -3
- package/dist/image/image.js +1 -1
- package/dist/image/llms.txt +13 -13
- package/dist/input/input.d.ts +18 -5
- package/dist/input/input.js +21 -6
- package/dist/input/llms.txt +25 -11
- package/dist/input-mask/input-mask.d.ts +1 -1
- package/dist/input-mask/input-mask.js +2 -2
- package/dist/input-mask/llms.txt +5 -5
- package/dist/input-number/input-number.d.ts +9 -9
- package/dist/input-number/input-number.js +11 -11
- package/dist/input-number/llms.txt +14 -14
- package/dist/input-otp/input-otp.d.ts +6 -6
- package/dist/input-otp/input-otp.js +10 -10
- package/dist/input-otp/llms.txt +9 -9
- package/dist/internal/calendar-focus.d.ts +1 -1
- package/dist/internal/calendar-focus.js +3 -3
- package/dist/internal/cn.d.ts +1 -1
- package/dist/internal/mask.d.ts +2 -2
- package/dist/internal/mask.js +4 -4
- package/dist/internal/option-key.d.ts +2 -2
- package/dist/internal/option-key.js +2 -2
- package/dist/internal/option-nav.d.ts +4 -4
- package/dist/internal/option-nav.js +5 -5
- package/dist/internal/overlay-container.js +1 -1
- package/dist/internal/overlay.d.ts +3 -3
- package/dist/internal/overlay.js +8 -8
- package/dist/internal/password-strength.d.ts +2 -2
- package/dist/internal/password-strength.js +6 -6
- package/dist/internal/roving.d.ts +2 -2
- package/dist/internal/roving.js +3 -3
- package/dist/internal/scroll-lock.d.ts +1 -1
- package/dist/internal/scroll-lock.js +2 -2
- package/dist/internal/slot-children.d.ts +3 -3
- package/dist/internal/slot-children.js +4 -4
- package/dist/internal/slot.d.ts +3 -3
- package/dist/internal/slot.js +2 -2
- package/dist/internal/step.d.ts +3 -3
- package/dist/internal/step.js +4 -4
- package/dist/internal/tween.d.ts +5 -5
- package/dist/internal/tween.js +5 -5
- package/dist/internal/types.d.ts +2 -2
- package/dist/internal/use-breakpoint.d.ts +2 -2
- package/dist/internal/use-breakpoint.js +4 -4
- package/dist/internal/use-controllable-state.d.ts +1 -1
- package/dist/internal/use-controllable-state.js +3 -3
- package/dist/internal/use-id.d.ts +2 -2
- package/dist/internal/use-id.js +2 -2
- package/dist/internal/use-modal-focus.d.ts +1 -1
- package/dist/internal/use-modal-focus.js +3 -3
- package/dist/knob/knob.d.ts +4 -4
- package/dist/knob/knob.js +14 -10
- package/dist/knob/llms.txt +17 -12
- package/dist/listbox/listbox.d.ts +6 -6
- package/dist/listbox/listbox.js +9 -9
- package/dist/listbox/llms.txt +10 -10
- package/dist/loader/llms.txt +56 -0
- package/dist/loader/loader.d.ts +49 -0
- package/dist/loader/loader.js +68 -0
- package/dist/map/llms.txt +25 -22
- package/dist/map/map-create-dialog.d.ts +4 -4
- package/dist/map/map-create-dialog.js +10 -10
- package/dist/map/map-hours-field.d.ts +4 -4
- package/dist/map/map-hours-field.js +7 -7
- package/dist/map/map-image-field.d.ts +2 -2
- package/dist/map/map-image-field.js +4 -4
- package/dist/map/map-legend.d.ts +4 -4
- package/dist/map/map-legend.js +2 -2
- package/dist/map/map-poi-card.d.ts +3 -3
- package/dist/map/map-poi-card.js +9 -9
- package/dist/map/map-search.d.ts +17 -6
- package/dist/map/map-search.js +21 -18
- package/dist/map/map.d.ts +21 -14
- package/dist/map/map.js +30 -29
- package/dist/map/ports.d.ts +9 -9
- package/dist/map/ports.js +6 -6
- package/dist/map-entry/public-api.js +2 -2
- package/dist/megamenu/llms.txt +9 -9
- package/dist/megamenu/megamenu.d.ts +6 -6
- package/dist/megamenu/megamenu.js +10 -10
- package/dist/mention/llms.txt +15 -15
- package/dist/mention/mention.d.ts +5 -5
- package/dist/mention/mention.js +2 -2
- package/dist/mention/mentions.d.ts +1 -1
- package/dist/mention/mentions.js +1 -1
- package/dist/menu/llms.txt +12 -12
- package/dist/menu/menu-item.d.ts +4 -4
- package/dist/menu/menu-keys.d.ts +2 -2
- package/dist/menu/menu-keys.js +5 -5
- package/dist/menu/menu.d.ts +2 -2
- package/dist/menu/menu.js +6 -6
- package/dist/menubar/llms.txt +10 -10
- package/dist/menubar/menubar.d.ts +5 -5
- package/dist/menubar/menubar.js +10 -10
- package/dist/meter-group/llms.txt +12 -12
- package/dist/meter-group/meter-group.d.ts +2 -2
- package/dist/meter-group/meter-group.js +1 -1
- package/dist/motion/motion-context.d.ts +22 -0
- package/dist/motion/motion-context.js +28 -0
- package/dist/order-list/llms.txt +22 -10
- package/dist/order-list/order-list.d.ts +12 -4
- package/dist/order-list/order-list.js +104 -21
- package/dist/paginator/llms.txt +8 -8
- package/dist/paginator/paginator.js +1 -1
- package/dist/panel/llms.txt +25 -13
- package/dist/panel/panel.d.ts +11 -3
- package/dist/panel/panel.js +7 -4
- package/dist/password/llms.txt +16 -8
- package/dist/password/password.d.ts +2 -2
- package/dist/password/password.js +24 -3
- package/dist/peek/llms.txt +10 -10
- package/dist/peek/peek.d.ts +6 -6
- package/dist/peek/peek.js +7 -7
- package/dist/pick-list/llms.txt +33 -13
- package/dist/pick-list/pick-list.d.ts +12 -4
- package/dist/pick-list/pick-list.js +111 -23
- package/dist/popover/llms.txt +11 -11
- package/dist/popover/popover.d.ts +4 -4
- package/dist/popover/popover.js +5 -5
- package/dist/progress/llms.txt +17 -17
- package/dist/progress/progress.d.ts +7 -7
- package/dist/progress/progress.js +6 -6
- package/dist/public-api.d.ts +15 -3
- package/dist/public-api.js +13 -7
- package/dist/radio-group/llms.txt +13 -6
- package/dist/radio-group/radio-group.d.ts +11 -4
- package/dist/radio-group/radio-group.js +15 -7
- package/dist/rating/llms.txt +20 -13
- package/dist/rating/rating-pointer.d.ts +16 -0
- package/dist/rating/rating-pointer.js +26 -0
- package/dist/rating/rating.d.ts +6 -6
- package/dist/rating/rating.js +76 -12
- package/dist/rich-text/lists.d.ts +2 -2
- package/dist/rich-text/lists.js +7 -7
- package/dist/rich-text/llms.txt +26 -17
- package/dist/rich-text/rich-text.d.ts +12 -7
- package/dist/rich-text/rich-text.js +78 -54
- package/dist/rich-text/sanitize.d.ts +3 -3
- package/dist/rich-text/sanitize.js +12 -12
- package/dist/rich-text/tables.d.ts +3 -3
- package/dist/rich-text/tables.js +3 -3
- package/dist/roadmap/llms.txt +15 -15
- package/dist/roadmap/roadmap.d.ts +6 -6
- package/dist/roadmap/roadmap.js +19 -19
- package/dist/roadmap-entry/public-api.js +2 -2
- package/dist/scroll-top/llms.txt +6 -6
- package/dist/scroll-top/scroll-top.d.ts +1 -1
- package/dist/scroll-top/scroll-top.js +1 -1
- package/dist/select/llms.txt +19 -12
- package/dist/select/select.d.ts +8 -8
- package/dist/select/select.js +47 -21
- package/dist/shared/types.d.ts +5 -5
- package/dist/shared/types.js +1 -1
- package/dist/sidenav/llms.txt +9 -9
- package/dist/sidenav/sidenav.d.ts +1 -1
- package/dist/sidenav/sidenav.js +1 -1
- package/dist/skeleton/llms.txt +3 -3
- package/dist/skeleton/skeleton.d.ts +1 -1
- package/dist/skeleton/skeleton.js +1 -1
- package/dist/slider/llms.txt +32 -13
- package/dist/slider/slider-drag.d.ts +26 -0
- package/dist/slider/slider-drag.js +79 -0
- package/dist/slider/slider.d.ts +6 -5
- package/dist/slider/slider.js +27 -8
- package/dist/speech/llms.txt +97 -0
- package/dist/speech/speech-button.d.ts +44 -0
- package/dist/speech/speech-button.js +86 -0
- package/dist/speech/speech-wave.d.ts +19 -0
- package/dist/speech/speech-wave.js +16 -0
- package/dist/speech/use-speech-recognition.d.ts +81 -0
- package/dist/speech/use-speech-recognition.js +179 -0
- package/dist/speed-dial/llms.txt +14 -8
- package/dist/speed-dial/speed-dial.d.ts +1 -1
- package/dist/speed-dial/speed-dial.js +1 -1
- package/dist/spinner/llms.txt +7 -7
- package/dist/spinner/spinner.d.ts +1 -1
- package/dist/spinner/spinner.js +1 -1
- package/dist/split-button/llms.txt +21 -15
- package/dist/split-button/split-button.d.ts +2 -2
- package/dist/split-button/split-button.js +4 -4
- package/dist/splitter/llms.txt +11 -11
- package/dist/splitter/splitter.d.ts +3 -3
- package/dist/splitter/splitter.js +5 -5
- package/dist/stepper/llms.txt +33 -14
- package/dist/stepper/stepper.d.ts +6 -6
- package/dist/stepper/stepper.js +53 -10
- package/dist/switch/llms.txt +12 -5
- package/dist/switch/switch.d.ts +10 -3
- package/dist/switch/switch.js +12 -5
- package/dist/switch-group/llms.txt +9 -9
- package/dist/switch-group/switch-group.d.ts +4 -4
- package/dist/switch-group/switch-group.js +4 -4
- package/dist/tabs/llms.txt +10 -10
- package/dist/tabs/tabs.d.ts +5 -5
- package/dist/tabs/tabs.js +8 -8
- package/dist/textarea/llms.txt +23 -12
- package/dist/textarea/textarea.d.ts +19 -6
- package/dist/textarea/textarea.js +21 -7
- package/dist/timeline/llms.txt +4 -4
- package/dist/timeline/timeline.d.ts +1 -1
- package/dist/timeline/timeline.js +1 -1
- package/dist/toast/llms.txt +47 -17
- package/dist/toast/toast-container.d.ts +9 -3
- package/dist/toast/toast-container.js +17 -9
- package/dist/toast/toast-store.d.ts +40 -4
- package/dist/toast/toast-store.js +36 -1
- package/dist/toolbar/llms.txt +7 -7
- package/dist/toolbar/toolbar.d.ts +3 -3
- package/dist/toolbar/toolbar.js +2 -2
- package/dist/tooltip/llms.txt +10 -10
- package/dist/tooltip/tooltip.d.ts +3 -3
- package/dist/tooltip/tooltip.js +18 -18
- package/dist/tree/llms.txt +25 -12
- package/dist/tree/tree-keys.d.ts +5 -5
- package/dist/tree/tree-keys.js +7 -7
- package/dist/tree/tree.d.ts +14 -7
- package/dist/tree/tree.js +53 -18
- package/dist/update/llms.txt +54 -0
- package/dist/update/update.d.ts +49 -0
- package/dist/update/update.js +82 -0
- package/package.json +15 -13
|
@@ -5,17 +5,17 @@ import type { KptMapGeocoderPort } from './ports.ts';
|
|
|
5
5
|
export interface KptMapCreateDialogProps extends Omit<ComponentPropsWithRef<'div'>, 'children' | 'onSubmit'>, KptI18nOverrides {
|
|
6
6
|
category: KptMapCategory;
|
|
7
7
|
at: KptLatLng;
|
|
8
|
-
/** Geokoder tego formularza
|
|
8
|
+
/** Geokoder tego formularza - źródło podpowiedzi adresowych dla pól z `autofill`. */
|
|
9
9
|
geocoder?: KptMapGeocoderPort | null;
|
|
10
10
|
onSave: (value: Record<string, unknown>) => void;
|
|
11
11
|
onCancel: () => void;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* Treść dialogu
|
|
14
|
+
* Treść dialogu "dodaj lokalizację" budowana ze schemy kategorii (`category.fields`).
|
|
15
15
|
*
|
|
16
16
|
* Port Angulara stoi tu na Signal Forms; w Reakcie formularza-frameworka nie ma, więc model to
|
|
17
17
|
* zwykły stan, a reguły walidacji są mapą funkcji obok niego. Kontrakt zostaje ten sam:
|
|
18
|
-
* walidacja deklarowana raz przy schemie, a bramka
|
|
19
|
-
*
|
|
18
|
+
* walidacja deklarowana raz przy schemie, a bramka "nie strasz czerwienią" siedzi w prezentacji
|
|
19
|
+
* - błąd pokazuje się po dotknięciu pola albo po próbie zapisu.
|
|
20
20
|
*/
|
|
21
21
|
export declare function KptMapCreateDialog({ category, at, geocoder, onSave, onCancel, locale: localeOverride, dictionary, className, ...rest }: Readonly<KptMapCreateDialogProps>): import("react").JSX.Element;
|
|
@@ -16,7 +16,7 @@ import { KptMapHoursField } from "./map-hours-field.js";
|
|
|
16
16
|
import { KptMapImageField } from "./map-image-field.js";
|
|
17
17
|
/** Typy pól, które przyjmą fragment adresu. Data czy liczba nie mają z nim nic wspólnego. */
|
|
18
18
|
const TEXTUAL = new Set(['text', 'textarea']);
|
|
19
|
-
/** Pusta wartość właściwa dla typu pola
|
|
19
|
+
/** Pusta wartość właściwa dla typu pola - formularz startuje bez `undefined`. */
|
|
20
20
|
function initialValue(def) {
|
|
21
21
|
if (def.initial !== undefined)
|
|
22
22
|
return def.initial;
|
|
@@ -41,17 +41,17 @@ function initialModel(fields) {
|
|
|
41
41
|
out[def.key] = initialValue(def);
|
|
42
42
|
return out;
|
|
43
43
|
}
|
|
44
|
-
/** Wartość pola tekstowego z modelu `unknown`
|
|
44
|
+
/** Wartość pola tekstowego z modelu `unknown` - liczba zostaje liczbą zapisaną tekstem, reszta pustym napisem. */
|
|
45
45
|
function asText(value) {
|
|
46
46
|
return typeof value === 'string' || typeof value === 'number' ? String(value) : '';
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
* Treść dialogu
|
|
49
|
+
* Treść dialogu "dodaj lokalizację" budowana ze schemy kategorii (`category.fields`).
|
|
50
50
|
*
|
|
51
51
|
* Port Angulara stoi tu na Signal Forms; w Reakcie formularza-frameworka nie ma, więc model to
|
|
52
52
|
* zwykły stan, a reguły walidacji są mapą funkcji obok niego. Kontrakt zostaje ten sam:
|
|
53
|
-
* walidacja deklarowana raz przy schemie, a bramka
|
|
54
|
-
*
|
|
53
|
+
* walidacja deklarowana raz przy schemie, a bramka "nie strasz czerwienią" siedzi w prezentacji
|
|
54
|
+
* - błąd pokazuje się po dotknięciu pola albo po próbie zapisu.
|
|
55
55
|
*/
|
|
56
56
|
export function KptMapCreateDialog({ category, at, geocoder = null, onSave, onCancel, locale: localeOverride, dictionary, className, ...rest }) {
|
|
57
57
|
const { t, locale } = useKptMessages({ locale: localeOverride, dictionary });
|
|
@@ -62,7 +62,7 @@ export function KptMapCreateDialog({ category, at, geocoder = null, onSave, onCa
|
|
|
62
62
|
const [submitted, setSubmitted] = useState(false);
|
|
63
63
|
/** Ostatnio ustalony adres; `address` bywa czytelniejszy niż suma pól. */
|
|
64
64
|
const [address, setAddress] = useState(null);
|
|
65
|
-
// Inna kategoria to inny formularz
|
|
65
|
+
// Inna kategoria to inny formularz - model wraca do wartości początkowych. Liczone w renderze
|
|
66
66
|
// (wzorzec poprzedniej wartości): efekt pokazałby jedną klatkę pól starej kategorii.
|
|
67
67
|
const [modelFields, setModelFields] = useState(fields);
|
|
68
68
|
if (modelFields !== fields) {
|
|
@@ -74,15 +74,15 @@ export function KptMapCreateDialog({ category, at, geocoder = null, onSave, onCa
|
|
|
74
74
|
/** Czy kategoria ma pola do podpowiedzenia i jest czym je podpowiedzieć. */
|
|
75
75
|
const autofillFields = useMemo(() => fields.filter((def) => def.autofill && TEXTUAL.has(def.type)), [fields]);
|
|
76
76
|
const hasAutofill = !!geocoder && autofillFields.length > 0;
|
|
77
|
-
/** Tożsamość bieżącego zapytania do geokodera
|
|
77
|
+
/** Tożsamość bieżącego zapytania do geokodera - nowa przy każdej zmianie jego wejść. */
|
|
78
78
|
const geocodeRequest = useMemo(() => (geocoder && autofillFields.length > 0 ? { geocoder, at, locale, autofillFields } : null), [geocoder, at, locale, autofillFields]);
|
|
79
79
|
/** Zapytanie, na które przyszła już odpowiedź (albo błąd). */
|
|
80
80
|
const [settledRequest, setSettledRequest] = useState(null);
|
|
81
|
-
/** Trwa zapytanie do geokodera
|
|
81
|
+
/** Trwa zapytanie do geokodera - pokazujemy notkę zamiast ciszy. */
|
|
82
82
|
const geocoding = geocodeRequest !== null && settledRequest !== geocodeRequest;
|
|
83
83
|
/**
|
|
84
84
|
* Podpowiada adres z geokodowania wstecznego współrzędnych kliknięcia. Wypełnia wyłącznie
|
|
85
|
-
* pola z `autofill` i wyłącznie te, które są jeszcze puste
|
|
85
|
+
* pola z `autofill` i wyłącznie te, które są jeszcze puste - podpowiedź nigdy nie kasuje
|
|
86
86
|
* tego, co użytkownik zdążył wpisać.
|
|
87
87
|
*/
|
|
88
88
|
useEffect(() => {
|
|
@@ -118,7 +118,7 @@ export function KptMapCreateDialog({ category, at, geocoder = null, onSave, onCa
|
|
|
118
118
|
}, [geocodeRequest]);
|
|
119
119
|
/**
|
|
120
120
|
* Komunikat błędu pola albo `null`. Dzień otwarty musi mieć obie godziny i różne od siebie;
|
|
121
|
-
* dzień oznaczony jako zamknięty przechodzi bez zastrzeżeń
|
|
121
|
+
* dzień oznaczony jako zamknięty przechodzi bez zastrzeżeń - to prawidłowa odpowiedź,
|
|
122
122
|
* a nie brak danych.
|
|
123
123
|
*/
|
|
124
124
|
const errorFor = (def) => {
|
|
@@ -6,14 +6,14 @@ export interface KptMapHoursFieldProps extends Omit<ComponentPropsWithRef<'div'>
|
|
|
6
6
|
onValueChange: (value: KptMapOpeningHours) => void;
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
readOnly?: boolean;
|
|
9
|
-
/** Wywoływane po każdej zmianie
|
|
9
|
+
/** Wywoływane po każdej zmianie - moment, w którym pole staje się dotknięte. */
|
|
10
10
|
onTouch?: () => void;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Pole
|
|
13
|
+
* Pole "godziny otwarcia" formularza dodawania lokalizacji (`type: 'hours'` w schemie).
|
|
14
14
|
*
|
|
15
|
-
* Siedem wierszy od poniedziałku, każdy z parą godzin i znacznikiem
|
|
16
|
-
*
|
|
15
|
+
* Siedem wierszy od poniedziałku, każdy z parą godzin i znacznikiem "zamknięte". Skrót
|
|
16
|
+
* "tak samo przez cały tydzień" kopiuje poniedziałek na pozostałe dni - bez niego wypełnienie
|
|
17
17
|
* formularza to czternaście pól.
|
|
18
18
|
*
|
|
19
19
|
* Nazwy dni idą z `Intl`, nie ze słownika: rozkład tygodnia jest uniwersalny, a tłumaczenie
|
|
@@ -11,15 +11,15 @@ import { KptIconButton } from "../icon-button/icon-button.js";
|
|
|
11
11
|
/** Ile przedziałów na dobę dopuszczamy. Dwa pokrywają przerwę i dobę przez północ. */
|
|
12
12
|
const MAX_RANGES = 2;
|
|
13
13
|
/**
|
|
14
|
-
* Snap minut na tarczy zegara. Godziny otwarcia chodzą co kwadrans, a nie co minutę
|
|
14
|
+
* Snap minut na tarczy zegara. Godziny otwarcia chodzą co kwadrans, a nie co minutę -
|
|
15
15
|
* krok 5 daje trafienie w 07:30 czy 22:45 bez celowania w pojedynczą minutę.
|
|
16
16
|
*/
|
|
17
17
|
const MINUTE_STEP = 5;
|
|
18
18
|
/**
|
|
19
|
-
* Pole
|
|
19
|
+
* Pole "godziny otwarcia" formularza dodawania lokalizacji (`type: 'hours'` w schemie).
|
|
20
20
|
*
|
|
21
|
-
* Siedem wierszy od poniedziałku, każdy z parą godzin i znacznikiem
|
|
22
|
-
*
|
|
21
|
+
* Siedem wierszy od poniedziałku, każdy z parą godzin i znacznikiem "zamknięte". Skrót
|
|
22
|
+
* "tak samo przez cały tydzień" kopiuje poniedziałek na pozostałe dni - bez niego wypełnienie
|
|
23
23
|
* formularza to czternaście pól.
|
|
24
24
|
*
|
|
25
25
|
* Nazwy dni idą z `Intl`, nie ze słownika: rozkład tygodnia jest uniwersalny, a tłumaczenie
|
|
@@ -27,7 +27,7 @@ const MINUTE_STEP = 5;
|
|
|
27
27
|
*/
|
|
28
28
|
export function KptMapHoursField({ value, onValueChange, disabled = false, readOnly = false, onTouch, locale: localeOverride, dictionary, className, ...rest }) {
|
|
29
29
|
const { t, locale } = useKptMessages({ locale: localeOverride, dictionary });
|
|
30
|
-
/** Skrót
|
|
30
|
+
/** Skrót "tak samo przez cały tydzień" - stan pola, nie część wartości. */
|
|
31
31
|
const [sameAllWeek, setSameAllWeek] = useState(false);
|
|
32
32
|
const rows = Array.from({ length: 7 }, (_, index) => {
|
|
33
33
|
const day = (index + 1);
|
|
@@ -39,7 +39,7 @@ export function KptMapHoursField({ value, onValueChange, disabled = false, readO
|
|
|
39
39
|
ranges: (entry?.ranges ?? []).map((range) => ({ from: range.from, to: range.to })),
|
|
40
40
|
};
|
|
41
41
|
});
|
|
42
|
-
/** Zapis zawsze przez pełny, uporządkowany tydzień
|
|
42
|
+
/** Zapis zawsze przez pełny, uporządkowany tydzień - model nie ma dziur. */
|
|
43
43
|
const write = (change) => {
|
|
44
44
|
const base = emptyWeek().map((day) => value.find((entry) => entry.day === day.day) ?? day);
|
|
45
45
|
onValueChange(change(base));
|
|
@@ -80,7 +80,7 @@ export function KptMapHoursField({ value, onValueChange, disabled = false, readO
|
|
|
80
80
|
ranges[index][edge] = time;
|
|
81
81
|
return { ...day, closed: false, ranges };
|
|
82
82
|
});
|
|
83
|
-
return (_jsxs("div", { className: cn('kpt-map-hours-field', className), ...rest, children: [_jsx(KptCheckbox, { className: "kpt-map-hours-field__same", checked: sameAllWeek, onCheckedChange: onSameAllWeek, disabled: disabled || readOnly, label: t('map.field.hoursSameAllWeek') }), _jsx("ul", { className: "kpt-map-hours-field__week", children: rows.map((row) => (_jsxs("li", { className: "kpt-map-hours-field__day", "data-locked": locked(row) ? '' : undefined, children: [_jsx("span", { className: "kpt-map-hours-field__name", children: row.name }), _jsx("div", { className: "kpt-map-hours-field__ranges", children: !row.closed ? (_jsxs(_Fragment, { children: [row.ranges.map((range, index) => (_jsxs("div", { className: "kpt-map-hours-field__range", children: [_jsx(KptDatepicker, { selectionMode: "time", minuteStep: MINUTE_STEP, value: range.from, onValueChange: (time) => setTime(row, index, 'from', String(time ?? '')), disabled: locked(row), "aria-label": `${t('map.field.hoursFrom')}
|
|
83
|
+
return (_jsxs("div", { className: cn('kpt-map-hours-field', className), ...rest, children: [_jsx(KptCheckbox, { className: "kpt-map-hours-field__same", checked: sameAllWeek, onCheckedChange: onSameAllWeek, disabled: disabled || readOnly, label: t('map.field.hoursSameAllWeek') }), _jsx("ul", { className: "kpt-map-hours-field__week", children: rows.map((row) => (_jsxs("li", { className: "kpt-map-hours-field__day", "data-locked": locked(row) ? '' : undefined, children: [_jsx("span", { className: "kpt-map-hours-field__name", children: row.name }), _jsx("div", { className: "kpt-map-hours-field__ranges", children: !row.closed ? (_jsxs(_Fragment, { children: [row.ranges.map((range, index) => (_jsxs("div", { className: "kpt-map-hours-field__range", children: [_jsx(KptDatepicker, { selectionMode: "time", minuteStep: MINUTE_STEP, value: range.from, onValueChange: (time) => setTime(row, index, 'from', String(time ?? '')), disabled: locked(row), "aria-label": `${t('map.field.hoursFrom')} - ${row.name}`, onTouch: onTouch }), _jsx("span", { className: "kpt-map-hours-field__dash", "aria-hidden": "true", children: "-" }), _jsx(KptDatepicker, { selectionMode: "time", minuteStep: MINUTE_STEP, value: range.to, onValueChange: (time) => setTime(row, index, 'to', String(time ?? '')), disabled: locked(row), "aria-label": `${t('map.field.hoursTo')} - ${row.name}`, onTouch: onTouch }), row.ranges.length > 1 ? (_jsx(KptIconButton, { variant: "text", size: "sm", disabled: locked(row), "aria-label": t('map.field.hoursRemoveRange'), onClick: () => patch(row.day, (day) => ({
|
|
84
84
|
...day,
|
|
85
85
|
ranges: day.ranges.filter((_, i) => i !== index).map((r) => ({ ...r })),
|
|
86
86
|
})), children: _jsx(KptIcon, { name: "minus" }) })) : null] }, index))), row.ranges.length < MAX_RANGES ? (_jsxs("button", { className: "kpt-map-hours-field__add", type: "button", disabled: locked(row), onClick: () => patch(row.day, (day) => ({
|
|
@@ -12,13 +12,13 @@ export interface KptMapImageFieldProps extends Omit<ComponentPropsWithRef<'div'>
|
|
|
12
12
|
onTouch?: () => void;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* Pole
|
|
15
|
+
* Pole "zdjęcie" formularza dodawania lokalizacji (`type: 'image'` w schemie kategorii).
|
|
16
16
|
*
|
|
17
17
|
* Wartością jest zawsze **string**: albo `data:` z wybranego pliku, albo adres wklejony przez
|
|
18
18
|
* użytkownika. Karta miejsca nie rozróżnia jednego od drugiego, więc formularz nie musi
|
|
19
19
|
* decydować za aplikację, gdzie zdjęcia mieszkają.
|
|
20
20
|
*
|
|
21
|
-
* Plik czytamy w przeglądarce i nigdzie nie wysyłamy
|
|
21
|
+
* Plik czytamy w przeglądarce i nigdzie nie wysyłamy - biblioteka nie ma i nie chce mieć
|
|
22
22
|
* wiedzy o storage'u aplikacji.
|
|
23
23
|
*/
|
|
24
24
|
export declare function KptMapImageField({ value, onValueChange, disabled, readOnly, invalid, touched, maxBytes, onTouch, locale, dictionary, className, ...rest }: Readonly<KptMapImageFieldProps>): import("react").JSX.Element;
|
|
@@ -6,16 +6,16 @@ import { useKptMessages } from "../i18n/i18n-context.js";
|
|
|
6
6
|
import { KptFileUpload } from "../file-upload/file-upload.js";
|
|
7
7
|
import { KptIcon } from "../icon/icon.js";
|
|
8
8
|
import { KptInput } from "../input/input.js";
|
|
9
|
-
/** Domyślny limit pliku. Data URL puchnie o
|
|
9
|
+
/** Domyślny limit pliku. Data URL puchnie o ~1/3, a wartość leci w `onLocationCreate`. */
|
|
10
10
|
const DEFAULT_MAX_BYTES = 2 * 1024 * 1024;
|
|
11
11
|
/**
|
|
12
|
-
* Pole
|
|
12
|
+
* Pole "zdjęcie" formularza dodawania lokalizacji (`type: 'image'` w schemie kategorii).
|
|
13
13
|
*
|
|
14
14
|
* Wartością jest zawsze **string**: albo `data:` z wybranego pliku, albo adres wklejony przez
|
|
15
15
|
* użytkownika. Karta miejsca nie rozróżnia jednego od drugiego, więc formularz nie musi
|
|
16
16
|
* decydować za aplikację, gdzie zdjęcia mieszkają.
|
|
17
17
|
*
|
|
18
|
-
* Plik czytamy w przeglądarce i nigdzie nie wysyłamy
|
|
18
|
+
* Plik czytamy w przeglądarce i nigdzie nie wysyłamy - biblioteka nie ma i nie chce mieć
|
|
19
19
|
* wiedzy o storage'u aplikacji.
|
|
20
20
|
*/
|
|
21
21
|
export function KptMapImageField({ value, onValueChange, disabled = false, readOnly = false, invalid = false, touched = false, maxBytes = DEFAULT_MAX_BYTES, onTouch, locale, dictionary, className, ...rest }) {
|
|
@@ -48,7 +48,7 @@ export function KptMapImageField({ value, onValueChange, disabled = false, readO
|
|
|
48
48
|
reader.readAsDataURL(file);
|
|
49
49
|
};
|
|
50
50
|
return (_jsxs("div", { className: cn('kpt-map-image-field', className), ...rest, children: [_jsx(KptFileUpload, { accept: "image/*", value: files, onValueChange: onFiles, disabled: disabled || readOnly, invalid: invalid, touched: touched }), _jsxs("label", { className: "kpt-map-image-field__url", children: [_jsx("span", { className: "kpt-map-image-field__url-label", children: t('map.field.orPasteUrl') }), _jsx(KptInput, { type: "url", value: urlValue, onValueChange: (url) => {
|
|
51
|
-
// Adres i plik wykluczają się
|
|
51
|
+
// Adres i plik wykluczają się - dwa źródła jednej wartości myliłyby użytkownika.
|
|
52
52
|
if (url)
|
|
53
53
|
setFiles([]);
|
|
54
54
|
setSizeError(null);
|
package/dist/map/map-legend.d.ts
CHANGED
|
@@ -4,20 +4,20 @@ import { type KptI18nOverrides } from '../i18n/i18n-context.tsx';
|
|
|
4
4
|
export interface KptMapLegendProps extends Omit<ComponentPropsWithRef<'div'>, 'children'>, KptI18nOverrides {
|
|
5
5
|
categories: readonly KptMapCategory[];
|
|
6
6
|
/**
|
|
7
|
-
* Identyfikatory ukrytych kategorii
|
|
7
|
+
* Identyfikatory ukrytych kategorii - kontrolowane. Nazwa dłuższa niż `hidden` z portu
|
|
8
8
|
* Angulara, bo `hidden` na elemencie DOM jest booleanem i kolidowałoby z propsem `<div>`.
|
|
9
9
|
*/
|
|
10
10
|
hiddenCategories?: string[];
|
|
11
11
|
defaultHiddenCategories?: string[];
|
|
12
12
|
onHiddenCategoriesChange?: (hidden: string[]) => void;
|
|
13
|
-
/** Opcjonalne liczniki `{ categoryId: liczba }`
|
|
13
|
+
/** Opcjonalne liczniki `{ categoryId: liczba }` - pokazywane przy etykiecie. */
|
|
14
14
|
counts?: Record<string, number> | null;
|
|
15
15
|
orientation?: 'horizontal' | 'vertical';
|
|
16
|
-
/** Wyłącza chowanie kategorii
|
|
16
|
+
/** Wyłącza chowanie kategorii - legenda staje się czysto informacyjna. */
|
|
17
17
|
interactive?: boolean;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* Legenda mapy
|
|
20
|
+
* Legenda mapy - lista kategorii ze znacznikiem koloru i ikoną. Pozycje są przyciskami:
|
|
21
21
|
* kliknięcie chowa i pokazuje kategorię.
|
|
22
22
|
*
|
|
23
23
|
* `KptMap` renderuje ją sam pod mapą przy `legend`; kto chce ją gdzie indziej, wyłącza tamto
|
package/dist/map/map-legend.js
CHANGED
|
@@ -6,7 +6,7 @@ import { useControllableState } from "../internal/use-controllable-state.js";
|
|
|
6
6
|
import { useKptMessages } from "../i18n/i18n-context.js";
|
|
7
7
|
import { KptIcon } from "../icon/icon.js";
|
|
8
8
|
/**
|
|
9
|
-
* Legenda mapy
|
|
9
|
+
* Legenda mapy - lista kategorii ze znacznikiem koloru i ikoną. Pozycje są przyciskami:
|
|
10
10
|
* kliknięcie chowa i pokazuje kategorię.
|
|
11
11
|
*
|
|
12
12
|
* `KptMap` renderuje ją sam pod mapą przy `legend`; kto chce ją gdzie indziej, wyłącza tamto
|
|
@@ -34,7 +34,7 @@ export function KptMapLegend({ categories, hiddenCategories, defaultHiddenCatego
|
|
|
34
34
|
const isHidden = hiddenSet.has(category.id);
|
|
35
35
|
const label = t(isHidden ? 'map.showCategory' : 'map.hideCategory', { category: category.label });
|
|
36
36
|
return (_jsxs("button", { type: "button", className: cn('kpt-map-legend__item', isHidden && 'kpt-map-legend__item--off'), style: {
|
|
37
|
-
// Glif dostaje kolor kontrastowy
|
|
37
|
+
// Glif dostaje kolor kontrastowy - zaszyta biel gubi się na jasnych rolach.
|
|
38
38
|
'--_kpt-legend-color': colorVarOf(category.color),
|
|
39
39
|
'--_kpt-legend-fg': contrastVarOf(category.color),
|
|
40
40
|
}, "aria-pressed": interactive ? !isHidden : undefined, "aria-label": interactive ? label : undefined, disabled: !interactive, onClick: () => toggle(category.id), children: [_jsx("span", { className: "kpt-map-legend__swatch", "aria-hidden": "true", children: category.icon ? _jsx(KptIcon, { name: category.icon }) : null }), _jsx("span", { className: "kpt-map-legend__label", children: category.label }), counts ? _jsx("span", { className: "kpt-map-legend__count", children: counts[category.id] ?? 0 }) : null] }, category.id));
|
|
@@ -24,14 +24,14 @@ export interface KptMapPoiCardProps extends Omit<ComponentPropsWithRef<'div'>, '
|
|
|
24
24
|
onShare?: (poi: KptMapPoi) => void;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
* Karta miejsca do popupu mapy
|
|
27
|
+
* Karta miejsca do popupu mapy - dystans, zdjęcie, akcje, kategoria, rozwijane godziny
|
|
28
28
|
* otwarcia i wiersze kontaktowe z kopiowaniem.
|
|
29
29
|
*
|
|
30
30
|
* Komponent jest sterowany danymi: bierze `KptMapPoi`, a nie model domenowy aplikacji.
|
|
31
|
-
* Mapowanie `KptMapLocation.data`
|
|
31
|
+
* Mapowanie `KptMapLocation.data` -> `KptMapPoi` robi aplikacja, dzięki czemu karta nie wie,
|
|
32
32
|
* czy pokazuje ładowarkę, restaurację, czy punkt serwisowy.
|
|
33
33
|
*
|
|
34
|
-
* Sam popup trzeba przełączyć na `popupLayout="card"`
|
|
34
|
+
* Sam popup trzeba przełączyć na `popupLayout="card"` - inaczej karta dostanie szerokość
|
|
35
35
|
* i padding przeznaczone dla treści tekstowej.
|
|
36
36
|
*
|
|
37
37
|
* @example
|
package/dist/map/map-poi-card.js
CHANGED
|
@@ -9,14 +9,14 @@ import { KptButton } from "../button/button.js";
|
|
|
9
9
|
import { KptIcon } from "../icon/icon.js";
|
|
10
10
|
import { KptIconButton } from "../icon-button/icon-button.js";
|
|
11
11
|
/**
|
|
12
|
-
* Karta miejsca do popupu mapy
|
|
12
|
+
* Karta miejsca do popupu mapy - dystans, zdjęcie, akcje, kategoria, rozwijane godziny
|
|
13
13
|
* otwarcia i wiersze kontaktowe z kopiowaniem.
|
|
14
14
|
*
|
|
15
15
|
* Komponent jest sterowany danymi: bierze `KptMapPoi`, a nie model domenowy aplikacji.
|
|
16
|
-
* Mapowanie `KptMapLocation.data`
|
|
16
|
+
* Mapowanie `KptMapLocation.data` -> `KptMapPoi` robi aplikacja, dzięki czemu karta nie wie,
|
|
17
17
|
* czy pokazuje ładowarkę, restaurację, czy punkt serwisowy.
|
|
18
18
|
*
|
|
19
|
-
* Sam popup trzeba przełączyć na `popupLayout="card"`
|
|
19
|
+
* Sam popup trzeba przełączyć na `popupLayout="card"` - inaczej karta dostanie szerokość
|
|
20
20
|
* i padding przeznaczone dla treści tekstowej.
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
@@ -38,9 +38,9 @@ export function KptMapPoiCard({ poi, distance = null, category = null, primaryLa
|
|
|
38
38
|
defaultValue: defaultHoursExpanded,
|
|
39
39
|
onChange: onHoursExpandedChange,
|
|
40
40
|
});
|
|
41
|
-
/** Rośnie przy każdym rozwinięciu godzin
|
|
41
|
+
/** Rośnie przy każdym rozwinięciu godzin - karta bywa otwarta dłużej niż minutę. */
|
|
42
42
|
const [now, setNow] = useState(() => Date.now());
|
|
43
|
-
/** Klucz wiersza, którego wartość właśnie skopiowano
|
|
43
|
+
/** Klucz wiersza, którego wartość właśnie skopiowano - przełącza ikonę na "check". */
|
|
44
44
|
const [justCopied, setJustCopied] = useState(null);
|
|
45
45
|
const copyTimer = useRef(null);
|
|
46
46
|
/** Bez API schowka przycisk kopiowania w ogóle się nie renderuje. */
|
|
@@ -51,7 +51,7 @@ export function KptMapPoiCard({ poi, distance = null, category = null, primaryLa
|
|
|
51
51
|
const open = isOpenAt(poi.hours, new Date(now));
|
|
52
52
|
const hoursGroups = groupWeek(poi.hours, locale);
|
|
53
53
|
const statusLabel = alwaysOpen ? t('map.poi.alwaysOpen') : t(open ? 'map.poi.openNow' : 'map.poi.closedNow');
|
|
54
|
-
/** Dopisek
|
|
54
|
+
/** Dopisek "otwarcie o 11:00" - nie ma go dla 24/7 ani gdy zmiana jest dalej niż doba. */
|
|
55
55
|
const statusHint = (() => {
|
|
56
56
|
if (alwaysOpen || !hasHours)
|
|
57
57
|
return null;
|
|
@@ -111,7 +111,7 @@ export function KptMapPoiCard({ poi, distance = null, category = null, primaryLa
|
|
|
111
111
|
await navigator.clipboard.writeText(row.copyValue);
|
|
112
112
|
}
|
|
113
113
|
catch {
|
|
114
|
-
// Odmowa zgody albo brak bezpiecznego kontekstu
|
|
114
|
+
// Odmowa zgody albo brak bezpiecznego kontekstu - nie ma czego zgłaszać użytkownikowi.
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
117
|
setJustCopied(row.kind);
|
|
@@ -146,8 +146,8 @@ export function KptMapPoiCard({ poi, distance = null, category = null, primaryLa
|
|
|
146
146
|
};
|
|
147
147
|
const distanceLabel = formatDistance(distance, locale);
|
|
148
148
|
return (_jsxs("div", { className: cn('kpt-map-poi', className), ...rest, children: [_jsxs("header", { className: "kpt-map-poi__head", children: [_jsx("p", { className: "kpt-map-poi__title", role: "heading", "aria-level": 3, children: poi.title }), closable ? (_jsx(KptIconButton, { hostProps: { className: 'kpt-map-poi__close' }, variant: "text", size: "sm", "aria-label": t('common.close'), onClick: onClose, children: _jsx(KptIcon, { name: "x" }) })) : null] }), _jsxs("p", { className: "kpt-map-poi__meta", children: [distanceLabel ? _jsx("strong", { className: "kpt-map-poi__distance", children: distanceLabel }) : null, poi.address ? _jsx("span", { className: "kpt-map-poi__address", children: poi.address }) : null] }), _jsxs("div", { className: "kpt-map-poi__scroll", children: [_jsx("div", { className: "kpt-map-poi__media", children: poi.photo ? (_jsx("img", { className: "kpt-map-poi__photo", src: poi.photo, alt: poi.photoAlt ?? poi.title, loading: "lazy", decoding: "async" })) : (_jsx("div", { className: "kpt-map-poi__photo-empty", "aria-label": t('map.poi.noPhoto'), role: "img", children: _jsx(KptIcon, { name: "photo", size: "1.75rem" }) })) }), _jsxs("div", { className: "kpt-map-poi__actions", children: [primaryLabel ? (_jsx(KptButton, { hostProps: { className: 'kpt-map-poi__cta' }, size: "sm", fullWidth: true, onClick: () => onPrimaryAction?.(poi), children: primaryLabel })) : null, showShare ? (_jsx(KptIconButton, { variant: "outline", size: "sm", "aria-label": t('map.poi.share'), onClick: share, children: _jsx(KptIcon, { name: "share" }) })) : null, showFavourite ? (_jsx(KptIconButton, { hostProps: { className: 'kpt-map-poi__fav', 'data-on': isFavourite ? '' : undefined }, variant: "outline", size: "sm", "aria-pressed": isFavourite, "aria-label": t(isFavourite ? 'map.poi.removeFavourite' : 'map.poi.addFavourite'), onClick: () => setFavourite(!isFavourite), children: _jsx(KptIcon, { name: "star" }) })) : null] }), category ? (_jsxs("p", { className: "kpt-map-poi__category", style: { '--_kpt-poi-color': foregroundVarOf(category.color) }, children: [category.icon ? _jsx(KptIcon, { className: "kpt-map-poi__category-icon", name: category.icon }) : null, category.label] })) : null, hasHours ? (_jsxs("div", { className: "kpt-map-poi__hours", children: [_jsxs("button", { className: "kpt-map-poi__hours-toggle", type: "button", "aria-expanded": expanded, "aria-controls": hoursId, onClick: () => {
|
|
149
|
-
// Odświeżamy zegar przy rozwinięciu
|
|
149
|
+
// Odświeżamy zegar przy rozwinięciu - karta bywa otwarta dłużej niż minutę.
|
|
150
150
|
setNow(Date.now());
|
|
151
151
|
setExpanded(!expanded);
|
|
152
|
-
}, children: [_jsx(KptIcon, { className: "kpt-map-poi__row-icon", name: "clock" }), _jsx("span", { className: "kpt-map-poi__status", "data-open": open || alwaysOpen, children: statusLabel }), statusHint ? _jsxs("span", { className: "kpt-map-poi__status-hint", children: ["
|
|
152
|
+
}, children: [_jsx(KptIcon, { className: "kpt-map-poi__row-icon", name: "clock" }), _jsx("span", { className: "kpt-map-poi__status", "data-open": open || alwaysOpen, children: statusLabel }), statusHint ? _jsxs("span", { className: "kpt-map-poi__status-hint", children: [", ", statusHint] }) : null, _jsx(KptIcon, { className: "kpt-map-poi__chevron", name: "chevron-down" })] }), expanded ? (_jsx("dl", { className: "kpt-map-poi__week", id: hoursId, children: hoursGroups.map((group) => (_jsxs("div", { style: { display: 'contents' }, children: [_jsx("dt", { className: "kpt-map-poi__week-day", children: group.label }), _jsx("dd", { className: "kpt-map-poi__week-hours", children: group.closed ? (_jsx("span", { className: "kpt-map-poi__week-closed", children: t('map.poi.closedDay') })) : (group.ranges.map((range) => (_jsx("span", { className: "kpt-map-poi__week-range", children: range }, range)))) })] }, group.label))) })) : null] })) : null, rows.length || poi.facts?.length ? (_jsxs("ul", { className: "kpt-map-poi__rows", children: [rows.map((row) => (_jsxs("li", { className: "kpt-map-poi__row", children: [_jsx(KptIcon, { className: "kpt-map-poi__row-icon", name: row.icon }), row.href ? (_jsx("a", { className: "kpt-map-poi__row-value kpt-map-poi__row-link", href: row.href, target: row.external ? '_blank' : undefined, rel: row.external ? 'noopener noreferrer' : undefined, children: row.text })) : (_jsx("span", { className: "kpt-map-poi__row-value", children: row.text })), _jsxs("span", { className: "kpt-map-poi__row-actions", children: [row.href ? (_jsx("a", { className: "kpt-map-poi__row-action", href: row.href, target: row.external ? '_blank' : undefined, rel: row.external ? 'noopener noreferrer' : undefined, "aria-label": row.actionLabel, title: row.actionLabel, children: _jsx(KptIcon, { name: row.actionIcon }) })) : null, canCopy ? (_jsx("button", { className: "kpt-map-poi__row-action", type: "button", "aria-label": t('map.poi.copy'), title: t('map.poi.copy'), onClick: () => void copy(row), children: _jsx(KptIcon, { name: justCopied === row.kind ? 'check' : 'copy' }) })) : null] })] }, row.kind))), (poi.facts ?? []).map((fact) => (_jsxs("li", { className: "kpt-map-poi__row kpt-map-poi__row--fact", children: [fact.icon ? (_jsx(KptIcon, { className: "kpt-map-poi__row-icon", name: fact.icon })) : (_jsx("span", { className: "kpt-map-poi__row-icon", "aria-hidden": "true" })), _jsxs("span", { className: "kpt-map-poi__row-value", children: [_jsx("span", { className: "kpt-map-poi__fact-label", children: fact.label }), " ", fact.value] })] }, fact.label)))] })) : null, _jsx("p", { className: "kpt-map-poi__live", "aria-live": "polite", children: justCopied ? t('map.poi.copied') : '' })] })] }));
|
|
153
153
|
}
|
package/dist/map/map-search.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { KptMapBounds, KptMapSearchResult } from '@konce-pt/map';
|
|
2
2
|
import { type ComponentPropsWithRef } from 'react';
|
|
3
3
|
import { type KptI18nOverrides } from '../i18n/i18n-context.tsx';
|
|
4
|
+
import { type KptSpeechColor } from '../speech/speech-button.tsx';
|
|
4
5
|
import type { KptMapGeocoderPort } from './ports.ts';
|
|
5
6
|
export interface KptMapSearchProps extends Omit<ComponentPropsWithRef<'div'>, 'children' | 'onSelect'>, KptI18nOverrides {
|
|
6
7
|
/** Geokoder tego pola. Bez metody `search()` pole renderuje się wyłączone. */
|
|
@@ -13,25 +14,35 @@ export interface KptMapSearchProps extends Omit<ComponentPropsWithRef<'div'>, 'c
|
|
|
13
14
|
debounce?: number;
|
|
14
15
|
/** Ile podpowiedzi najwyżej. */
|
|
15
16
|
limit?: number;
|
|
16
|
-
/** Zawężenie twarde do krajów (ISO 3166-1 alpha-2)
|
|
17
|
+
/** Zawężenie twarde do krajów (ISO 3166-1 alpha-2) - wyniki spoza nich nie wrócą. */
|
|
17
18
|
countryCodes?: readonly string[] | null;
|
|
18
19
|
/** Preferowany prostokąt wyników. Nie odcina reszty świata, tylko przesuwa ją niżej. */
|
|
19
20
|
viewbox?: KptMapBounds | null;
|
|
20
21
|
disabled?: boolean;
|
|
21
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Mikrofon w polu (Web Speech API): kliknięcie czyści frazę, a jedna podyktowana wypowiedź
|
|
24
|
+
* staje się zapytaniem - z tym samym `debounce` i `minLength` co pisanie. Bez wsparcia
|
|
25
|
+
* przeglądarki się nie pokazuje.
|
|
26
|
+
*/
|
|
27
|
+
speech?: boolean;
|
|
28
|
+
/** Język dyktowania (BCP 47); bez niego z `KptI18nProvider`. */
|
|
29
|
+
speechLang?: string;
|
|
30
|
+
/** Kolor "stop" i fali w trakcie nasłuchu; domyślnie kolor motywu. */
|
|
31
|
+
speechColor?: KptSpeechColor;
|
|
32
|
+
/** Wybrano miejsce - **zawsze ze współrzędnymi**. */
|
|
22
33
|
onSelect?: (result: KptMapSearchResult) => void;
|
|
23
|
-
/** Pole wyczyszczone
|
|
34
|
+
/** Pole wyczyszczone - rodzic sprząta po sobie (np. chowa tymczasową pinezkę). */
|
|
24
35
|
onClear?: () => void;
|
|
25
36
|
}
|
|
26
37
|
/**
|
|
27
38
|
* Wyszukiwarka adresów: pole z podpowiedziami z geokodera. Wynik wyboru leci w `onSelect`,
|
|
28
|
-
* a co z nim zrobić
|
|
39
|
+
* a co z nim zrobić - decyduje rodzic (`KptMap` przenosi na niego widok).
|
|
29
40
|
*
|
|
30
41
|
* Świadomie **nie** stoi na `KptAutocomplete`: tamten filtruje opcje po stronie klienta (wyniki
|
|
31
42
|
* geokodera, tolerancyjne na literówki, wypadałyby z listy), a jego wartością jest sam `string`
|
|
32
|
-
*
|
|
43
|
+
* - nie ma czym przewieźć współrzędnych.
|
|
33
44
|
*
|
|
34
45
|
* @example
|
|
35
46
|
* <KptMapSearch geocoder={geocoder} viewbox={bounds} onSelect={goTo} />
|
|
36
47
|
*/
|
|
37
|
-
export declare function KptMapSearch({ geocoder, placeholder, minLength, debounce, limit, countryCodes, viewbox, disabled, onSelect, onClear, locale: localeOverride, dictionary, className, ...rest }: Readonly<KptMapSearchProps>): import("react").JSX.Element;
|
|
48
|
+
export declare function KptMapSearch({ geocoder, placeholder, minLength, debounce, limit, countryCodes, viewbox, disabled, speech, speechLang, speechColor, onSelect, onClear, locale: localeOverride, dictionary, className, ...rest }: Readonly<KptMapSearchProps>): import("react").JSX.Element;
|
package/dist/map/map-search.js
CHANGED
|
@@ -4,42 +4,45 @@ import { useEffect, useId, useMemo, useRef, useState } from 'react';
|
|
|
4
4
|
import { cn } from "../internal/cn.js";
|
|
5
5
|
import { useKptMessages } from "../i18n/i18n-context.js";
|
|
6
6
|
import { KptIcon } from "../icon/icon.js";
|
|
7
|
+
import { KptSpeechButton } from "../speech/speech-button.js";
|
|
7
8
|
/**
|
|
8
9
|
* Wyszukiwarka adresów: pole z podpowiedziami z geokodera. Wynik wyboru leci w `onSelect`,
|
|
9
|
-
* a co z nim zrobić
|
|
10
|
+
* a co z nim zrobić - decyduje rodzic (`KptMap` przenosi na niego widok).
|
|
10
11
|
*
|
|
11
12
|
* Świadomie **nie** stoi na `KptAutocomplete`: tamten filtruje opcje po stronie klienta (wyniki
|
|
12
13
|
* geokodera, tolerancyjne na literówki, wypadałyby z listy), a jego wartością jest sam `string`
|
|
13
|
-
*
|
|
14
|
+
* - nie ma czym przewieźć współrzędnych.
|
|
14
15
|
*
|
|
15
16
|
* @example
|
|
16
17
|
* <KptMapSearch geocoder={geocoder} viewbox={bounds} onSelect={goTo} />
|
|
17
18
|
*/
|
|
18
|
-
export function KptMapSearch({ geocoder = null, placeholder = '', minLength = 3, debounce = 300, limit = 5, countryCodes = null, viewbox = null, disabled = false, onSelect, onClear, locale: localeOverride, dictionary, className, ...rest }) {
|
|
19
|
+
export function KptMapSearch({ geocoder = null, placeholder = '', minLength = 3, debounce = 300, limit = 5, countryCodes = null, viewbox = null, disabled = false, speech = false, speechLang, speechColor, onSelect, onClear, locale: localeOverride, dictionary, className, ...rest }) {
|
|
19
20
|
const { t, locale } = useKptMessages({ locale: localeOverride, dictionary });
|
|
20
21
|
const uid = useId();
|
|
21
22
|
/** Tekst widoczny w polu. Wybór podpowiedzi wpisuje tu jego etykietę. */
|
|
22
23
|
const [query, setQuery] = useState('');
|
|
23
24
|
/**
|
|
24
25
|
* Fraza do odpytania geokodera. Osobna od `query`, bo wybór podpowiedzi zmienia treść pola
|
|
25
|
-
*
|
|
26
|
+
* - a to nie może wywołać kolejnego zapytania o coś, co już znaleźliśmy.
|
|
26
27
|
*/
|
|
27
28
|
const [term, setTerm] = useState('');
|
|
28
29
|
const [results, setResults] = useState([]);
|
|
29
|
-
/** Trwa dociąganie współrzędnych wybranej podpowiedzi
|
|
30
|
+
/** Trwa dociąganie współrzędnych wybranej podpowiedzi - inny moment niż czekanie na listę. */
|
|
30
31
|
const [resolving, setResolving] = useState(false);
|
|
31
|
-
/** Czy jakieś zapytanie już wróciło
|
|
32
|
+
/** Czy jakieś zapytanie już wróciło - bez tego "brak wyników" mignąłby przed pierwszym. */
|
|
32
33
|
const [searched, setSearched] = useState(false);
|
|
33
34
|
const [open, setOpen] = useState(false);
|
|
34
35
|
const [activeIndex, setActiveIndex] = useState(-1);
|
|
35
|
-
/** Nie udało się ustalić miejsca wybranej podpowiedzi
|
|
36
|
+
/** Nie udało się ustalić miejsca wybranej podpowiedzi - komunikat zamiast cichej ciszy. */
|
|
36
37
|
const [unresolved, setUnresolved] = useState(false);
|
|
37
|
-
/** Przerywacz dociągania w locie
|
|
38
|
+
/** Przerywacz dociągania w locie - kolejny wybór i czyszczenie pola go używają. */
|
|
38
39
|
const pending = useRef(null);
|
|
40
|
+
/** Pole - cel dyktowania (`speech`). */
|
|
41
|
+
const inputRef = useRef(null);
|
|
39
42
|
const canSearch = !!geocoder?.search;
|
|
40
43
|
/*
|
|
41
44
|
* Zapytanie do geokodera jako wartość: nowa tożsamość = nowe zapytanie. `viewbox` i `countryCodes`
|
|
42
|
-
* wchodzą jako klucze tekstowe
|
|
45
|
+
* wchodzą jako klucze tekstowe - rodzic podaje je zwykle świeżą tablicą w każdym renderze, a to
|
|
43
46
|
* restartowałoby odliczanie przy każdym ruchu mapy i zapytanie nigdy by nie wyszło.
|
|
44
47
|
*/
|
|
45
48
|
const needle = term.trim();
|
|
@@ -62,7 +65,7 @@ export function KptMapSearch({ geocoder = null, placeholder = '', minLength = 3,
|
|
|
62
65
|
/** Zapytanie, na które przyszła już odpowiedź (albo błąd). */
|
|
63
66
|
const [settled, setSettled] = useState(null);
|
|
64
67
|
const loading = request !== null && settled !== request;
|
|
65
|
-
// Fraza za krótka (albo brak geokodera)
|
|
68
|
+
// Fraza za krótka (albo brak geokodera) - lista i stan wracają do zera. W renderze, nie w efekcie,
|
|
66
69
|
// żeby nie mignęła jedna klatka starych wyników.
|
|
67
70
|
const [hadRequest, setHadRequest] = useState(request !== null);
|
|
68
71
|
if (hadRequest !== (request !== null)) {
|
|
@@ -77,13 +80,13 @@ export function KptMapSearch({ geocoder = null, placeholder = '', minLength = 3,
|
|
|
77
80
|
const tooShort = query.trim().length > 0 && query.trim().length < minLength;
|
|
78
81
|
const hasPanel = open && (tooShort || busy || results.length > 0 || searched);
|
|
79
82
|
// Odpytanie geokodera po odczekaniu `debounce` od ostatniego znaku. Sprzątanie kasuje
|
|
80
|
-
// zarówno niewystrzelony timer, jak i zapytanie w locie
|
|
83
|
+
// zarówno niewystrzelony timer, jak i zapytanie w locie - adapter przerywa wtedy `fetch`.
|
|
81
84
|
useEffect(() => {
|
|
82
85
|
if (!request)
|
|
83
86
|
return;
|
|
84
87
|
const { geocoder: port, needle: phrase, options } = request;
|
|
85
88
|
const applyResults = (found) => {
|
|
86
|
-
// Podpowiedź bez współrzędnych ma sens tylko wtedy, gdy port umie ją uzupełnić
|
|
89
|
+
// Podpowiedź bez współrzędnych ma sens tylko wtedy, gdy port umie ją uzupełnić -
|
|
87
90
|
// pozycja, która nie ma dokąd polecieć, jest gorsza od jej braku.
|
|
88
91
|
setResults(port.resolve ? found : found.filter((suggestion) => suggestion.at));
|
|
89
92
|
setSettled(request);
|
|
@@ -126,11 +129,11 @@ export function KptMapSearch({ geocoder = null, placeholder = '', minLength = 3,
|
|
|
126
129
|
})();
|
|
127
130
|
/**
|
|
128
131
|
* Wybór podpowiedzi. Dostawca, który podał współrzędne na liście, emituje natychmiast;
|
|
129
|
-
* podpowiedź bez `at` trzeba najpierw uzupełnić
|
|
132
|
+
* podpowiedź bez `at` trzeba najpierw uzupełnić - jedno wywołanie `resolve()` na *wybór*,
|
|
130
133
|
* nigdy w trakcie pisania.
|
|
131
134
|
*/
|
|
132
135
|
const pick = (suggestion) => {
|
|
133
|
-
// Etykieta wraca do pola, ale `term` zostaje
|
|
136
|
+
// Etykieta wraca do pola, ale `term` zostaje - inaczej wybór odpaliłby kolejne zapytanie.
|
|
134
137
|
setQuery(suggestion.label);
|
|
135
138
|
setActiveIndex(-1);
|
|
136
139
|
setUnresolved(false);
|
|
@@ -195,14 +198,14 @@ export function KptMapSearch({ geocoder = null, placeholder = '', minLength = 3,
|
|
|
195
198
|
case 'Enter': {
|
|
196
199
|
const result = results[activeIndex];
|
|
197
200
|
if (result) {
|
|
198
|
-
// Pole bywa w formularzu aplikacji
|
|
201
|
+
// Pole bywa w formularzu aplikacji - Enter nie ma go wysyłać.
|
|
199
202
|
event.preventDefault();
|
|
200
203
|
pick(result);
|
|
201
204
|
}
|
|
202
205
|
break;
|
|
203
206
|
}
|
|
204
207
|
case 'Escape':
|
|
205
|
-
// Pierwszy Esc zamyka listę, drugi czyści pole
|
|
208
|
+
// Pierwszy Esc zamyka listę, drugi czyści pole - jak w polu wyszukiwania przeglądarki.
|
|
206
209
|
if (open)
|
|
207
210
|
setOpen(false);
|
|
208
211
|
else if (query)
|
|
@@ -213,12 +216,12 @@ export function KptMapSearch({ geocoder = null, placeholder = '', minLength = 3,
|
|
|
213
216
|
}
|
|
214
217
|
};
|
|
215
218
|
const optionId = (index) => `${uid}-opt-${index}`;
|
|
216
|
-
return (_jsxs("div", { className: cn('kpt-map-search', className), ...rest, children: [_jsxs("div", { className: "kpt-map-search__field", children: [_jsx("span", { className: "kpt-map-search__icon", "aria-hidden": "true", children: _jsx(KptIcon, { name: "search" }) }), _jsx("input", { className: "kpt-map-search__input", type: "text", autoComplete: "off", autoCapitalize: "off", spellCheck: false, role: "combobox", "aria-autocomplete": "list", id: uid, value: query, placeholder: placeholder || t('map.search.placeholder'), disabled: disabled || !canSearch, "aria-label": t('map.search.label'), "aria-expanded": hasPanel, "aria-busy": busy || undefined, "aria-controls": hasPanel && results.length && !tooShort && !busy ? `${uid}-list` : undefined, "aria-activedescendant": activeIndex >= 0 ? optionId(activeIndex) : undefined, onChange: (event) => {
|
|
219
|
+
return (_jsxs("div", { className: cn('kpt-map-search', className), ...rest, children: [_jsxs("div", { className: "kpt-map-search__field", children: [_jsx("span", { className: "kpt-map-search__icon", "aria-hidden": "true", children: _jsx(KptIcon, { name: "search" }) }), _jsx("input", { ref: inputRef, className: "kpt-map-search__input", type: "text", autoComplete: "off", autoCapitalize: "off", spellCheck: false, role: "combobox", "aria-autocomplete": "list", id: uid, value: query, placeholder: placeholder || t('map.search.placeholder'), disabled: disabled || !canSearch, "aria-label": t('map.search.label'), "aria-expanded": hasPanel, "aria-busy": busy || undefined, "aria-controls": hasPanel && results.length && !tooShort && !busy ? `${uid}-list` : undefined, "aria-activedescendant": activeIndex >= 0 ? optionId(activeIndex) : undefined, onChange: (event) => {
|
|
217
220
|
setQuery(event.target.value);
|
|
218
221
|
setTerm(event.target.value);
|
|
219
222
|
setOpen(true);
|
|
220
223
|
setUnresolved(false);
|
|
221
|
-
}, onFocus: () => setOpen(true), onBlur: () => setOpen(false), onKeyDown: onKeyDown }), query ? (_jsx("button", { className: "kpt-map-search__clear", type: "button", "aria-label": t('map.search.clear'), title: t('map.search.clear'), onClick: clear, children: _jsx(KptIcon, { name: "x" }) })) : null] }), hasPanel ? (_jsx("div", { className: "kpt-map-search__panel", id: `${uid}-panel`, children: tooShort ? (_jsx("p", { className: "kpt-map-search__note", children: t('map.search.minLength', { count: minLength }) })) : busy ? (_jsx("p", { className: "kpt-map-search__note", children: t('map.search.searching') })) : results.length ? (_jsx("ul", { className: "kpt-map-search__list", id: `${uid}-list`, role: "listbox", "aria-label": t('map.search.results'), children: results.map((result, index) => (_jsxs("li", { className: cn('kpt-map-search__option', index === activeIndex && 'is-active'), role: "option", id: optionId(index), "aria-selected": index === activeIndex, onMouseDown: (event) => {
|
|
224
|
+
}, onFocus: () => setOpen(true), onBlur: () => setOpen(false), onKeyDown: onKeyDown }), query ? (_jsx("button", { className: "kpt-map-search__clear", type: "button", "aria-label": t('map.search.clear'), title: t('map.search.clear'), onClick: clear, children: _jsx(KptIcon, { name: "x" }) })) : null, speech ? (_jsx(KptSpeechButton, { listeningColor: speechColor, target: inputRef, lang: speechLang, mode: "replace", continuous: false, size: "sm", unsupported: "hide", disabled: disabled || !canSearch, hostProps: { className: 'kpt-map-search__speech' } })) : null] }), hasPanel ? (_jsx("div", { className: "kpt-map-search__panel", id: `${uid}-panel`, children: tooShort ? (_jsx("p", { className: "kpt-map-search__note", children: t('map.search.minLength', { count: minLength }) })) : busy ? (_jsx("p", { className: "kpt-map-search__note", children: t('map.search.searching') })) : results.length ? (_jsx("ul", { className: "kpt-map-search__list", id: `${uid}-list`, role: "listbox", "aria-label": t('map.search.results'), children: results.map((result, index) => (_jsxs("li", { className: cn('kpt-map-search__option', index === activeIndex && 'is-active'), role: "option", id: optionId(index), "aria-selected": index === activeIndex, onMouseDown: (event) => {
|
|
222
225
|
event.preventDefault();
|
|
223
226
|
pick(result);
|
|
224
227
|
}, onMouseEnter: () => setActiveIndex(index), children: [_jsx("span", { className: "kpt-map-search__pin", "aria-hidden": "true", children: _jsx(KptIcon, { name: "map-pin" }) }), _jsx("span", { className: "kpt-map-search__label", children: result.label })] }, result.id))) })) : (_jsx("p", { className: "kpt-map-search__note", children: t('map.search.noResults') })) })) : null, _jsx("p", { className: "kpt-map-search__status", "aria-live": "polite", children: status })] }));
|