@krak-stack/registry 0.11.6 → 0.11.9

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.
Files changed (123) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +39 -0
  3. package/dist/components/app-switcher/html.d.ts +2 -2
  4. package/dist/components/asset-input/html.d.ts +70 -0
  5. package/dist/components/asset-input/html.js +1549 -0
  6. package/dist/components/asset-input/index.d.ts +280 -0
  7. package/dist/components/asset-input/react.d.ts +32 -0
  8. package/dist/components/asset-input/react.js +2269 -0
  9. package/dist/components/asset-input/schema.d.ts +93 -0
  10. package/dist/components/asset-input/upload.d.ts +15 -0
  11. package/dist/components/asset-table/html.d.ts +110 -0
  12. package/dist/components/asset-table/html.js +4934 -0
  13. package/dist/components/asset-table/index.d.ts +225 -0
  14. package/dist/components/asset-table/react.d.ts +21 -0
  15. package/dist/components/asset-table/react.js +8241 -0
  16. package/dist/components/asset-table/schema.d.ts +73 -0
  17. package/dist/components/audit-log-table/classes.d.ts +1 -0
  18. package/dist/components/audit-log-table/html.d.ts +158 -0
  19. package/dist/components/audit-log-table/html.js +3294 -0
  20. package/dist/components/audit-log-table/index.d.ts +37 -0
  21. package/dist/components/audit-log-table/react.d.ts +3 -51
  22. package/dist/components/audit-log-table/react.js +130 -89
  23. package/dist/components/audit-log-table/schema.d.ts +122 -0
  24. package/dist/components/danger-confirmation/html.d.ts +2 -2
  25. package/dist/components/danger-confirmation/index.d.ts +2 -2
  26. package/dist/components/data-table/classes.d.ts +3 -0
  27. package/dist/components/data-table/html.d.ts +70 -12
  28. package/dist/components/data-table/html.js +56 -19
  29. package/dist/components/data-table/index.d.ts +51 -1
  30. package/dist/components/data-table/react.d.ts +1 -0
  31. package/dist/components/data-table/react.js +46 -16
  32. package/dist/components/data-table/schema.d.ts +93 -3
  33. package/dist/components/docs/html.js +22 -4
  34. package/dist/components/docs/react.js +33 -2
  35. package/dist/components/editable-text/html.d.ts +2 -2
  36. package/dist/components/editable-text/index.d.ts +4 -4
  37. package/dist/components/effect-form/react.js +343 -138
  38. package/dist/components/email-editor/legacy-editor.html.d.ts +6 -6
  39. package/dist/components/file-input/classes.d.ts +1 -1
  40. package/dist/components/file-input/file-type.d.ts +1 -0
  41. package/dist/components/file-input/html.d.ts +8 -1
  42. package/dist/components/file-input/html.js +170 -12
  43. package/dist/components/file-input/index.d.ts +1 -0
  44. package/dist/components/file-input/react.d.ts +9 -1
  45. package/dist/components/file-input/react.js +277 -127
  46. package/dist/components/file-input/schema.d.ts +1 -0
  47. package/dist/components/form/react.js +343 -138
  48. package/dist/components/icon-input/html.js +19 -5
  49. package/dist/components/icon-input/react.js +70 -13
  50. package/dist/components/map-menu/html.d.ts +6 -0
  51. package/dist/components/map-menu/html.js +13 -8
  52. package/dist/components/map-menu/index.d.ts +5 -4
  53. package/dist/components/map-menu/react.d.ts +28 -17
  54. package/dist/components/map-menu/react.js +84 -178
  55. package/dist/components/map-menu/schema.d.ts +6 -0
  56. package/dist/components/map-menu/shared.d.ts +4 -0
  57. package/dist/components/permissions-input/classes.d.ts +8 -0
  58. package/dist/components/permissions-input/html.d.ts +41 -0
  59. package/dist/components/permissions-input/html.js +130 -0
  60. package/dist/components/permissions-input/index.d.ts +80 -0
  61. package/dist/components/permissions-input/react.d.ts +7 -0
  62. package/dist/components/permissions-input/react.js +201 -0
  63. package/dist/components/permissions-input/schema.d.ts +33 -0
  64. package/dist/components/phone-number-input/html.js +48 -14
  65. package/dist/components/phone-number-input/react.js +67 -10
  66. package/dist/components/search-menu/html.d.ts +2 -2
  67. package/dist/components/select-with-custom-input/html.d.ts +2 -2
  68. package/dist/components/sidebar-layout/html.d.ts +3 -2
  69. package/dist/components/sidebar-layout/html.js +20 -2
  70. package/dist/components/sidebar-layout/index.d.ts +1 -0
  71. package/dist/components/sidebar-layout/react.js +33 -2
  72. package/dist/components/switch/react.d.ts +14 -0
  73. package/dist/components/switch/react.js +55 -0
  74. package/dist/components/theme-switcher/html.d.ts +2 -2
  75. package/dist/components/time-input/html.d.ts +2 -2
  76. package/dist/components/timezone-input/html.js +48 -14
  77. package/dist/components/timezone-input/react.js +67 -10
  78. package/dist/components/tracking-notice/classes.d.ts +6 -0
  79. package/dist/components/tracking-notice/html.d.ts +85 -0
  80. package/dist/components/tracking-notice/html.js +354 -0
  81. package/dist/components/tracking-notice/index.d.ts +95 -0
  82. package/dist/components/tracking-notice/react.d.ts +5 -27
  83. package/dist/components/tracking-notice/react.js +189 -59
  84. package/dist/components/tracking-notice/schema.d.ts +45 -0
  85. package/dist/components/upload-attachment/classes.d.ts +3 -2
  86. package/dist/components/upload-attachment/html.d.ts +5 -5
  87. package/dist/components/upload-attachment/html.js +7 -5
  88. package/dist/components/upload-attachment/react.d.ts +3 -1
  89. package/dist/components/upload-attachment/react.js +25 -17
  90. package/dist/components/virtualized-combobox/classes.d.ts +12 -0
  91. package/dist/components/virtualized-combobox/html.d.ts +42 -0
  92. package/dist/components/virtualized-combobox/html.js +48 -14
  93. package/dist/components/virtualized-combobox/index.d.ts +55 -4
  94. package/dist/components/virtualized-combobox/react.d.ts +6 -2
  95. package/dist/components/virtualized-combobox/react.js +67 -10
  96. package/dist/components/virtualized-combobox/schema.d.ts +60 -4
  97. package/dist/components/webhook-delivery-table/html.js +56 -19
  98. package/dist/components/webhook-delivery-table/react.js +46 -16
  99. package/dist/lib/access/index.d.ts +61 -0
  100. package/dist/lib/access/index.js +92 -0
  101. package/dist/lib/access/table/classes.d.ts +13 -0
  102. package/dist/lib/access/table/html.d.ts +39 -0
  103. package/dist/lib/access/table/html.js +157 -0
  104. package/dist/lib/access/table/index.d.ts +32 -0
  105. package/dist/lib/access/table/react.d.ts +3 -0
  106. package/dist/lib/access/table/react.js +195 -0
  107. package/dist/lib/access/table/schema.d.ts +43 -0
  108. package/dist/lib/docs.integrations.server.js +23 -1
  109. package/dist/lib/docs.js +33 -2
  110. package/dist/lib/docs.server.js +29 -2
  111. package/dist/lib/documentation-toolkit.js +23 -1
  112. package/dist/lib/effect-ui-adapter/use-model.d.ts +1 -1
  113. package/dist/lib/effect-ui-adapter/use-model.js +19 -11
  114. package/dist/lib/lucide-effect.d.ts +19 -19
  115. package/dist/lib/lucide-effect.js +38 -38
  116. package/dist/services/assets/library.d.ts +221 -0
  117. package/dist/services/assets/schema.d.ts +3 -0
  118. package/dist/services/assets/url.d.ts +12 -0
  119. package/dist/services/assets/use-library.d.ts +20 -0
  120. package/dist/services/events/browser.js +39 -26
  121. package/dist/services/events/index.js +23 -19
  122. package/dist/services/opentelemetry/web-vitals.js +27 -23
  123. package/package.json +21 -1
@@ -506,9 +506,73 @@ import {
506
506
  } from "@/components/ui/select";
507
507
  import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider/react";
508
508
 
509
- // ../../src/components/map-menu/index.ts
510
- import { Effect, Redacted, Schema as Schema3 } from "effect";
511
- import { Command, Component, UiSchema } from "effect/ui";
509
+ // ../../src/components/map-menu/shared.ts
510
+ var mapMenuSelectionMatches = ({
511
+ selectedLocation,
512
+ input
513
+ }) => selectedLocation?.label === input.trim();
514
+ var mapMenuRadiiKm = [
515
+ 1,
516
+ 2,
517
+ 5,
518
+ 10,
519
+ 20,
520
+ 40,
521
+ 50,
522
+ 60,
523
+ 80,
524
+ 100,
525
+ 250,
526
+ 500
527
+ ];
528
+ var labels = {
529
+ en: {
530
+ title: "Choose your location",
531
+ location: "City or address",
532
+ placeholder: "Search a city or address…",
533
+ clear: "Clear location",
534
+ close: "Close",
535
+ currentLocation: "Use my location",
536
+ searchWithin: "Search within",
537
+ suggestions: "Location suggestions",
538
+ loading: "Finding matching places…",
539
+ noResults: "No matching places. Try a city or address.",
540
+ searchHint: "Search for a place and choose a suggestion to preview it on the map.",
541
+ ipNotice: "Using your approximate location from your IP address.",
542
+ browserNotice: "Using your browser location.",
543
+ radiusHint: "The circle shows your search area.",
544
+ cancel: "Cancel",
545
+ confirm: "Use this location",
546
+ confirmError: "Your location could not be saved. Try again."
547
+ },
548
+ fr: {
549
+ title: "Choisir votre lieu",
550
+ location: "Ville ou adresse",
551
+ placeholder: "Rechercher une ville ou une adresse…",
552
+ clear: "Effacer le lieu",
553
+ close: "Fermer",
554
+ currentLocation: "Utiliser ma position",
555
+ searchWithin: "Rechercher dans un rayon de",
556
+ suggestions: "Suggestions de lieux",
557
+ loading: "Recherche de lieux…",
558
+ noResults: "Aucun lieu correspondant. Essayez une ville ou une adresse.",
559
+ searchHint: "Recherchez un lieu et choisissez une suggestion pour le voir sur la carte.",
560
+ ipNotice: "Position approximative obtenue à partir de votre adresse IP.",
561
+ browserNotice: "Position fournie par votre navigateur.",
562
+ radiusHint: "Le cercle indique votre zone de recherche.",
563
+ cancel: "Annuler",
564
+ confirm: "Utiliser ce lieu",
565
+ confirmError: "Votre lieu n’a pas pu être enregistré. Réessayez."
566
+ }
567
+ };
568
+ var mapMenuMessages = (locale = "en", messages) => {
569
+ const base = locale.split("-")[0] ?? locale;
570
+ return {
571
+ ...base === "fr" ? labels.fr : labels.en,
572
+ ...messages?.[base],
573
+ ...messages?.[locale]
574
+ };
575
+ };
512
576
 
513
577
  // ../../src/components/map-menu/schema.ts
514
578
  import { Schema as Schema2, Struct } from "effect";
@@ -556,6 +620,9 @@ var MapMenuLocationSchema = Schema2.Struct({
556
620
  }).annotate({ identifier: "MapMenuLocation" });
557
621
  var MapMenuClassesOverridesSchema = Schema2.Record(Schema2.Literals(Struct.keys(mapMenuClasses)), Schema2.optionalKey(Schema2.String)).annotate({ identifier: "MapMenuClassesOverrides" });
558
622
  var MapMenuSharedPropsSchema = Schema2.Struct({
623
+ showMap: Schema2.optional(Schema2.Boolean),
624
+ confirmation: Schema2.optional(Schema2.Literals(["explicit", "selection"])),
625
+ showCurrentLocation: Schema2.optional(Schema2.Boolean),
559
626
  classes: Schema2.optional(MapMenuClassesOverridesSchema),
560
627
  input: Schema2.String,
561
628
  selectedLocation: Schema2.NullOr(MapMenuLocationSchema),
@@ -594,177 +661,12 @@ var MapMenuSelectionSchema = Schema2.Struct({
594
661
  radiusKm: Schema2.optionalKey(Schema2.Finite)
595
662
  }).annotate({ identifier: "MapMenuSelection" });
596
663
 
597
- // ../../src/components/map-menu/index.ts
598
- var mapMenuSelectionMatches = ({
599
- selectedLocation,
600
- input
601
- }) => selectedLocation?.label === input.trim();
602
- var mapMenuRadiiKm = [
603
- 1,
604
- 2,
605
- 5,
606
- 10,
607
- 20,
608
- 40,
609
- 50,
610
- 60,
611
- 80,
612
- 100,
613
- 250,
614
- 500
615
- ];
616
- var labels = {
617
- en: {
618
- title: "Choose your location",
619
- location: "City or address",
620
- placeholder: "Search a city or address…",
621
- clear: "Clear location",
622
- close: "Close",
623
- currentLocation: "Use my location",
624
- searchWithin: "Search within",
625
- suggestions: "Location suggestions",
626
- loading: "Finding matching places…",
627
- noResults: "No matching places. Try a city or address.",
628
- searchHint: "Search for a place and choose a suggestion to preview it on the map.",
629
- ipNotice: "Using your approximate location from your IP address.",
630
- browserNotice: "Using your browser location.",
631
- radiusHint: "The circle shows your search area.",
632
- cancel: "Cancel",
633
- confirm: "Use this location",
634
- confirmError: "Your location could not be saved. Try again."
635
- },
636
- fr: {
637
- title: "Choisir votre lieu",
638
- location: "Ville ou adresse",
639
- placeholder: "Rechercher une ville ou une adresse…",
640
- clear: "Effacer le lieu",
641
- close: "Fermer",
642
- currentLocation: "Utiliser ma position",
643
- searchWithin: "Rechercher dans un rayon de",
644
- suggestions: "Suggestions de lieux",
645
- loading: "Recherche de lieux…",
646
- noResults: "Aucun lieu correspondant. Essayez une ville ou une adresse.",
647
- searchHint: "Recherchez un lieu et choisissez une suggestion pour le voir sur la carte.",
648
- ipNotice: "Position approximative obtenue à partir de votre adresse IP.",
649
- browserNotice: "Position fournie par votre navigateur.",
650
- radiusHint: "Le cercle indique votre zone de recherche.",
651
- cancel: "Annuler",
652
- confirm: "Utiliser ce lieu",
653
- confirmError: "Votre lieu n’a pas pu être enregistré. Réessayez."
654
- }
655
- };
656
- var mapMenuMessages = (locale = "en", messages) => {
657
- const base = locale.split("-")[0] ?? locale;
658
- return {
659
- ...base === "fr" ? labels.fr : labels.en,
660
- ...messages?.[base],
661
- ...messages?.[locale]
662
- };
663
- };
664
- var MapMenuEvent = UiSchema.TaggedEnum({
665
- InputChanged: { input: Schema3.String },
666
- LocationSelected: { location: MapMenuLocationSchema },
667
- RadiusChanged: { radiusKm: Schema3.Finite },
668
- CurrentLocationRequested: {},
669
- OpenChanged: { open: Schema3.Boolean },
670
- Cancelled: {},
671
- Confirmed: {}
672
- });
673
- var CameraAction = Schema3.Literals(["in", "out", "fit"]);
674
- var MapMenuMessage = UiSchema.TaggedEnum({
675
- Edited: { input: Schema3.String },
676
- SuggestionsOpened: {},
677
- SuggestionsClosed: {},
678
- Picked: { id: Schema3.String },
679
- RadiusPicked: { radiusKm: Schema3.Finite },
680
- Locate: {},
681
- Cancel: {},
682
- Confirm: {},
683
- Finished: { success: Schema3.Boolean },
684
- CameraRequested: { action: CameraAction },
685
- MapStatus: {
686
- status: Schema3.Literals(["loading", "ready", "configuration", "load"])
687
- },
688
- ZoomChanged: { zoom: Schema3.Finite }
689
- });
690
- var Selection = Schema3.Redacted(MapMenuSelectionSchema, {
691
- disallowJsonEncode: true
692
- });
693
-
694
- class SaveMapSelection extends Command.Service()("map-menu/SaveSelection", { args: { selection: Selection }, success: MapMenuMessage }) {
695
- static layerFromSave = (save) => SaveMapSelection.toLayer(({ selection }) => Effect.suspend(() => save(Redacted.value(selection))).pipe(Effect.match({
696
- onSuccess: () => MapMenuMessage.Finished({ success: true }),
697
- onFailure: () => MapMenuMessage.Finished({ success: false })
698
- })));
699
- }
700
- var CameraRequest = Schema3.Struct({
701
- action: CameraAction,
702
- revision: Schema3.Int
703
- });
704
- var mapMenuOptions = {
705
- name: "MapMenu",
706
- props: MapMenuHtmlPropsSchema,
707
- model: Schema3.Struct({
708
- suggestionsOpen: Schema3.Boolean,
709
- save: Schema3.Literals(["idle", "pending", "failed"]),
710
- mapStatus: Schema3.Literals(["loading", "ready", "configuration", "load"]),
711
- zoom: Schema3.NullOr(Schema3.Finite),
712
- camera: Schema3.NullOr(CameraRequest)
713
- }),
714
- message: MapMenuMessage,
715
- events: MapMenuEvent,
716
- restore: false
717
- };
718
- var inline = (props) => props.presentation === "inline" /* Inline */;
719
- var visible = (props) => inline(props) || props.open === true;
720
- var mapMenuCanConfirm = (props) => visible(props) && !props.locating && mapMenuSelectionMatches(props) && (props.mode === "point" /* Point */ || props.radiusKm !== undefined);
721
- var update = Component.define(mapMenuOptions).update({
722
- Edited: ($, { input }) => $.model.save === "pending" ? $.model : $.evolve({
723
- suggestionsOpen: Boolean(input.trim()),
724
- save: "idle"
725
- }).emit(MapMenuEvent.InputChanged({ input })),
726
- SuggestionsOpened: ($) => $.model.save === "pending" ? $.model : $.evolve({ suggestionsOpen: true }),
727
- SuggestionsClosed: ($) => $.evolve({ suggestionsOpen: false }),
728
- Picked: ($, { id }) => {
729
- if ($.model.save === "pending")
730
- return $.model;
731
- const location = $.props.suggestions.slice(0, 3).find((item) => item.id === id);
732
- return location ? $.evolve({ suggestionsOpen: false, save: "idle" }).emit(MapMenuEvent.InputChanged({ input: location.label })).emit(MapMenuEvent.LocationSelected({ location })) : $.model;
733
- },
734
- RadiusPicked: ($, { radiusKm }) => $.model.save === "pending" || $.props.mode === "point" /* Point */ || !($.props.radiusOptions ?? mapMenuRadiiKm).includes(radiusKm) ? $.model : $.emit(MapMenuEvent.RadiusChanged({ radiusKm })),
735
- Locate: ($) => $.model.save !== "pending" && $.props.canUseCurrentLocation && !$.props.locating ? $.evolve({ suggestionsOpen: false }).emit(MapMenuEvent.CurrentLocationRequested()) : $.model,
736
- Cancel: ($) => $.model.save === "pending" ? $.model : $.evolve({ save: "idle", suggestionsOpen: false }).emit(inline($.props) ? MapMenuEvent.Cancelled() : MapMenuEvent.OpenChanged({ open: false })),
737
- Confirm: ($) => {
738
- const { selectedLocation, mode, radiusKm } = $.props;
739
- if ($.model.save === "pending" || !selectedLocation || !mapMenuCanConfirm($.props))
740
- return $.model;
741
- const selection = mode === "point" /* Point */ || radiusKm === undefined ? { location: selectedLocation } : { location: selectedLocation, radiusKm };
742
- return $.evolve({ save: "pending", suggestionsOpen: false }).run(SaveMapSelection.make({ selection: Redacted.make(selection) }));
743
- },
744
- Finished: ($, { success }) => {
745
- if ($.model.save !== "pending")
746
- return $.model;
747
- if (!success)
748
- return $.evolve({ save: "failed" });
749
- const next = $.evolve({ save: "idle" }).emit(MapMenuEvent.Confirmed());
750
- return inline($.props) ? next : next.emit(MapMenuEvent.OpenChanged({ open: false }));
751
- },
752
- CameraRequested: ($, { action }) => $.model.mapStatus === "ready" ? $.evolve({
753
- camera: { action, revision: ($.model.camera?.revision ?? 0) + 1 }
754
- }) : $.model,
755
- MapStatus: ($, { status }) => $.evolve({
756
- mapStatus: status,
757
- zoom: status === "ready" ? $.model.zoom : null
758
- }),
759
- ZoomChanged: ($, { zoom }) => $.evolve({ zoom })
760
- });
761
-
762
664
  // ../../src/components/map-menu/react.tsx
763
665
  import { jsx as jsx2, jsxs as jsxs2, Fragment as Fragment2 } from "react/jsx-runtime";
764
666
  var MapMenu = (props) => {
765
667
  const mapMenuClasses = resolveMapMenuClasses(props.classes);
766
668
  const {
767
- apiKey,
669
+ apiKey = "",
768
670
  input,
769
671
  onInputChange,
770
672
  selectedLocation,
@@ -772,7 +674,6 @@ var MapMenu = (props) => {
772
674
  onSelectLocation,
773
675
  radiusKm,
774
676
  radiusOptions = mapMenuRadiiKm,
775
- onUseCurrentLocation,
776
677
  locating = false,
777
678
  loadingSuggestions = false,
778
679
  suggestionsError,
@@ -784,6 +685,8 @@ var MapMenu = (props) => {
784
685
  locale: localeOverride,
785
686
  messages
786
687
  } = props;
688
+ const onUseCurrentLocation = props.showCurrentLocation === false ? undefined : props.onUseCurrentLocation;
689
+ const explicit = props.confirmation !== "selection";
787
690
  const inline = props.presentation === "inline" /* Inline */;
788
691
  const open = inline || props.open;
789
692
  const radiusEnabled = props.mode !== "point" /* Point */;
@@ -831,7 +734,7 @@ var MapMenu = (props) => {
831
734
  setConfirmFailed(false);
832
735
  if (props.presentation === "inline" /* Inline */) {
833
736
  if (!next)
834
- props.onCancel();
737
+ props.onCancel?.();
835
738
  } else {
836
739
  props.onOpenChange(next);
837
740
  }
@@ -851,9 +754,9 @@ var MapMenu = (props) => {
851
754
  setDropdownOpen(false);
852
755
  try {
853
756
  if (props.mode === "point" /* Point */) {
854
- await props.onConfirm({ location: selectedLocation });
757
+ await props.onConfirm?.({ location: selectedLocation });
855
758
  } else {
856
- await props.onConfirm({
759
+ await props.onConfirm?.({
857
760
  location: selectedLocation,
858
761
  radiusKm: props.radiusKm
859
762
  });
@@ -1021,7 +924,10 @@ var MapMenu = (props) => {
1021
924
  }) : !suggestions.length ? /* @__PURE__ */ jsx2("p", {
1022
925
  className: mapMenuClasses.status,
1023
926
  children: labels.noResults
1024
- }) : null
927
+ }) : null,
928
+ suggestions.length > 0 && props.suggestionAttribution && /* @__PURE__ */ jsx2("small", {
929
+ children: props.suggestionAttribution
930
+ })
1025
931
  ]
1026
932
  }) : null
1027
933
  ]
@@ -1040,7 +946,7 @@ var MapMenu = (props) => {
1040
946
  labels.currentLocation
1041
947
  ]
1042
948
  }) : null,
1043
- /* @__PURE__ */ jsxs2("div", {
949
+ (props.showMap !== false || provenance) && /* @__PURE__ */ jsxs2("div", {
1044
950
  className: "col-span-full grid text-xs leading-5",
1045
951
  children: [
1046
952
  [labels.ipNotice, labels.browserNotice, labels.searchHint].map((text) => /* @__PURE__ */ jsx2("span", {
@@ -1106,7 +1012,7 @@ var MapMenu = (props) => {
1106
1012
  }) : null
1107
1013
  ]
1108
1014
  }),
1109
- /* @__PURE__ */ jsxs2("div", {
1015
+ props.showMap !== false && /* @__PURE__ */ jsxs2("div", {
1110
1016
  "data-slot": "map-menu-map",
1111
1017
  className: inline ? "relative h-80 min-w-0 sm:h-96" : "relative min-h-56 min-w-0 flex-[1_0_14rem] [@media(max-height:599px)]:min-h-[182px] [@media(max-height:599px)]:basis-[182px]",
1112
1018
  children: [
@@ -1139,7 +1045,7 @@ var MapMenu = (props) => {
1139
1045
  })
1140
1046
  ]
1141
1047
  }),
1142
- /* @__PURE__ */ jsxs2(DialogFooter, {
1048
+ (explicit || error || confirmFailed) && /* @__PURE__ */ jsxs2(DialogFooter, {
1143
1049
  className: inline ? "gap-3 border-0 bg-transparent p-0" : "shrink-0 gap-3 border-0 bg-transparent px-5 pt-[18px] pb-[max(18px,env(safe-area-inset-bottom))] sm:px-7 [@media(max-height:599px)]:pt-3 [@media(max-height:599px)]:pb-[max(12px,env(safe-area-inset-bottom))]",
1144
1050
  children: [
1145
1051
  error || confirmFailed ? /* @__PURE__ */ jsx2("p", {
@@ -1147,7 +1053,7 @@ var MapMenu = (props) => {
1147
1053
  className: "text-destructive w-full self-center text-sm sm:mr-auto sm:w-auto",
1148
1054
  children: error ?? labels.confirmError
1149
1055
  }) : null,
1150
- /* @__PURE__ */ jsxs2("div", {
1056
+ explicit && /* @__PURE__ */ jsxs2("div", {
1151
1057
  className: "flex gap-2",
1152
1058
  children: [
1153
1059
  /* @__PURE__ */ jsx2(Button, {
@@ -28,6 +28,9 @@ export type MapMenuLocation = typeof MapMenuLocationSchema.Type;
28
28
  declare const MapMenuClassesOverridesSchema: Schema.$Record<Schema.Literals<("error" | "resultDescription" | "resultTitle" | "status")[]>, Schema.optionalKey<Schema.String>>;
29
29
  export type MapMenuClassesOverrides = typeof MapMenuClassesOverridesSchema.Type;
30
30
  export declare const MapMenuSharedPropsSchema: Schema.Struct<{
31
+ readonly showMap: Schema.optional<Schema.Boolean>;
32
+ readonly confirmation: Schema.optional<Schema.Literals<readonly ["explicit", "selection"]>>;
33
+ readonly showCurrentLocation: Schema.optional<Schema.Boolean>;
31
34
  readonly classes: Schema.optional<Schema.$Record<Schema.Literals<("error" | "resultDescription" | "resultTitle" | "status")[]>, Schema.optionalKey<Schema.String>>>;
32
35
  readonly input: Schema.String;
33
36
  readonly selectedLocation: Schema.NullOr<Schema.Struct<{
@@ -74,6 +77,9 @@ export declare const MapMenuViewportSchema: Schema.Struct<{
74
77
  export type MapMenuViewport = typeof MapMenuViewportSchema.Type;
75
78
  export declare const MapMenuBrowserKey: Schema.Redacted<Schema.String>;
76
79
  export declare const MapMenuHtmlPropsSchema: Schema.Struct<{
80
+ readonly showMap: Schema.optional<Schema.Boolean>;
81
+ readonly confirmation: Schema.optional<Schema.Literals<readonly ["explicit", "selection"]>>;
82
+ readonly showCurrentLocation: Schema.optional<Schema.Boolean>;
77
83
  readonly classes: Schema.optional<Schema.$Record<Schema.Literals<("error" | "resultDescription" | "resultTitle" | "status")[]>, Schema.optionalKey<Schema.String>>>;
78
84
  readonly input: Schema.String;
79
85
  readonly selectedLocation: Schema.NullOr<Schema.Struct<{
@@ -0,0 +1,4 @@
1
+ import type { MapMenuSharedProps, MapMenuMessages } from "./schema.js";
2
+ export declare const mapMenuSelectionMatches: ({ selectedLocation, input, }: Pick<MapMenuSharedProps, "selectedLocation" | "input">) => boolean;
3
+ export declare const mapMenuRadiiKm: readonly [1, 2, 5, 10, 20, 40, 50, 60, 80, 100, 250, 500];
4
+ export declare const mapMenuMessages: (locale?: string, messages?: MapMenuSharedProps["messages"]) => MapMenuMessages;
@@ -0,0 +1,8 @@
1
+ import type { PermissionsInputProps } from "./schema.js";
2
+ export declare const permissionsInputHeaderClass = "flex flex-wrap items-center justify-between gap-2";
3
+ export declare const permissionsInputActionsClass = "ml-auto flex flex-wrap justify-end gap-2";
4
+ export declare const permissionsInputClasses: (overrides: PermissionsInputProps["classes"]) => {
5
+ groups: string;
6
+ trigger: string;
7
+ options: string;
8
+ };
@@ -0,0 +1,41 @@
1
+ import { Html } from "effect/ui/html";
2
+ export type { PermissionsInputChange } from "./index.js";
3
+ export type { PermissionsInputGroup, PermissionsInputProps } from "./schema.js";
4
+ export declare const PermissionsInput: import("effect/ui/Component").Component<"PermissionsInput", {
5
+ readonly title: string;
6
+ readonly description?: string | undefined;
7
+ readonly selectAllLabel: string;
8
+ readonly clearAllLabel: string;
9
+ readonly groups: readonly {
10
+ readonly id: string;
11
+ readonly label: string;
12
+ readonly options: readonly {
13
+ readonly id: string;
14
+ readonly label: string;
15
+ }[];
16
+ }[];
17
+ readonly selected: {
18
+ readonly [x: string]: boolean;
19
+ };
20
+ readonly disabled?: boolean | undefined;
21
+ readonly classes?: {
22
+ readonly groups?: string | undefined;
23
+ readonly trigger?: string | undefined;
24
+ readonly options?: string | undefined;
25
+ } | undefined;
26
+ }, readonly string[], {
27
+ readonly _tag: "All";
28
+ readonly checked: boolean;
29
+ } | {
30
+ readonly _tag: "Group";
31
+ readonly id: string;
32
+ readonly open: boolean;
33
+ } | {
34
+ readonly _tag: "Toggle";
35
+ readonly id: string;
36
+ readonly checked: boolean;
37
+ }, {
38
+ readonly _tag: "Changed";
39
+ readonly ids: readonly string[];
40
+ readonly checked: boolean;
41
+ }, never, Html.Elements, {}, never>;
@@ -0,0 +1,130 @@
1
+ // ../../src/components/permissions-input/html.ts
2
+ import { Html } from "effect/ui/html";
3
+ import { Collapsible } from "effect/ui/kit";
4
+ import { Button } from "@/components/effectcn/button";
5
+
6
+ // ../../src/components/permissions-input/classes.ts
7
+ var permissionsInputHeaderClass = "flex flex-wrap items-center justify-between gap-2";
8
+ var permissionsInputActionsClass = "ml-auto flex flex-wrap justify-end gap-2";
9
+ var permissionsInputClasses = (overrides) => ({
10
+ groups: "divide-y overflow-hidden rounded-lg border",
11
+ trigger: "hover:bg-muted/50 focus-visible:ring-ring flex w-full items-center justify-between gap-3 px-4 py-3 text-left text-sm font-medium outline-none focus-visible:ring-2 focus-visible:ring-inset",
12
+ options: "grid gap-3 border-t px-4 py-3 sm:grid-cols-2",
13
+ ...overrides
14
+ });
15
+
16
+ // ../../src/components/permissions-input/index.ts
17
+ import { Schema as Schema2 } from "effect";
18
+ import { Component, UiSchema } from "effect/ui";
19
+
20
+ // ../../src/components/permissions-input/schema.ts
21
+ import { Schema } from "effect";
22
+ var text = Schema.optionalKey(Schema.String);
23
+ var PermissionsInputOption = Schema.Struct({
24
+ id: Schema.String,
25
+ label: Schema.String
26
+ }).annotate({ identifier: "PermissionsInputOption" });
27
+ var PermissionsInputGroup = Schema.Struct({
28
+ id: Schema.String,
29
+ label: Schema.String,
30
+ options: Schema.Array(PermissionsInputOption)
31
+ }).annotate({ identifier: "PermissionsInputGroup" });
32
+ var PermissionsInputProps = Schema.Struct({
33
+ title: Schema.String,
34
+ description: text,
35
+ selectAllLabel: Schema.String,
36
+ clearAllLabel: Schema.String,
37
+ groups: Schema.Array(PermissionsInputGroup),
38
+ selected: Schema.Record(Schema.String, Schema.Boolean),
39
+ disabled: Schema.optionalKey(Schema.Boolean),
40
+ classes: Schema.optionalKey(Schema.Struct({
41
+ groups: text,
42
+ trigger: text,
43
+ options: text
44
+ }))
45
+ }).annotate({ identifier: "PermissionsInputProps" });
46
+
47
+ // ../../src/components/permissions-input/index.ts
48
+ var PermissionsInputMessage = UiSchema.TaggedEnum({
49
+ Group: { id: Schema2.String, open: Schema2.Boolean },
50
+ Toggle: { id: Schema2.String, checked: Schema2.Boolean },
51
+ All: { checked: Schema2.Boolean }
52
+ }).annotate({ identifier: "PermissionsInputMessage" });
53
+ var PermissionsInputEvent = UiSchema.TaggedEnum({
54
+ Changed: { ids: Schema2.Array(Schema2.String), checked: Schema2.Boolean }
55
+ }).annotate({ identifier: "PermissionsInputEvent" });
56
+ var optionIds = ({ groups }) => [
57
+ ...new Set(groups.flatMap(({ options }) => options.map(({ id }) => id)))
58
+ ];
59
+ var selectedCount = (options, selected) => options.filter(({ id }) => selected[id] === true).length;
60
+ var hasSelection = (props) => optionIds(props).some((id) => props.selected[id] === true);
61
+ var permissionsInputOptions = {
62
+ name: "PermissionsInput",
63
+ props: PermissionsInputProps,
64
+ model: Schema2.Array(Schema2.String),
65
+ message: PermissionsInputMessage,
66
+ events: PermissionsInputEvent,
67
+ restore: false
68
+ };
69
+ var update = Component.define(permissionsInputOptions).update({
70
+ Group: ($, { id, open }) => {
71
+ const groups = new Set($.model);
72
+ if (open)
73
+ groups.add(id);
74
+ else
75
+ groups.delete(id);
76
+ return [...groups];
77
+ },
78
+ Toggle: ($, { id, checked }) => $.props.disabled || !optionIds($.props).includes(id) ? $.model : $.emit(PermissionsInputEvent.Changed({ ids: [id], checked })),
79
+ All: ($, { checked }) => {
80
+ const ids = optionIds($.props);
81
+ return $.props.disabled || !ids.length ? $.model : $.emit(PermissionsInputEvent.Changed({ ids, checked }));
82
+ }
83
+ });
84
+ var permissionsInputBehaviours = {
85
+ init: ({ props }) => props.groups.filter(({ options }) => selectedCount(options, props.selected) > 0).map(({ id }) => id),
86
+ update
87
+ };
88
+
89
+ // ../../src/components/permissions-input/html.ts
90
+ var PermissionsInput = Html.component(permissionsInputOptions).make({
91
+ ...permissionsInputBehaviours,
92
+ view: (h, model) => {
93
+ const { groups, selected, disabled } = h.props;
94
+ const classes = permissionsInputClasses(h.props.classes);
95
+ if (!groups.length)
96
+ return h.div.attr("hidden", "");
97
+ const titleId = h.id("title");
98
+ return h.fieldset.class("grid min-w-0 gap-3").attr("aria-labelledby", titleId).children(h.div.class(permissionsInputHeaderClass).children(h.span.id(titleId).class("text-sm font-medium").children(h.props.title), h.div.class(permissionsInputActionsClass).children(Button(h, {
99
+ props: { type: "button", disabled },
100
+ size: "sm",
101
+ variant: "outline",
102
+ onPress: PermissionsInputMessage.All({ checked: true })
103
+ }).children(h.props.selectAllLabel), hasSelection(h.props) && Button(h, {
104
+ props: { type: "button", disabled },
105
+ size: "sm",
106
+ variant: "outline",
107
+ onPress: PermissionsInputMessage.All({ checked: false })
108
+ }).children(h.props.clearAllLabel))), h.props.description && h.p.class("text-muted-foreground text-sm").children(h.props.description), h.div.class(classes.groups).children(groups.map(({ id, label, options }) => Collapsible(h, {
109
+ key: id,
110
+ props: { open: model.includes(id) },
111
+ onEmit: {
112
+ Toggled: ({ open }) => PermissionsInputMessage.Group({ id, open }),
113
+ Settled: () => {
114
+ return;
115
+ }
116
+ },
117
+ view: (parts) => parts.root(h.div).children(parts.trigger(h.button.class(classes.trigger).attr("type", "button")).children(h.span.children(label), " ", h.span.attr("data-slot", "badge").class("bg-secondary text-secondary-foreground inline-flex h-5 shrink-0 items-center justify-center rounded-full border border-transparent px-2 text-xs font-medium whitespace-nowrap tabular-nums").children(`${selectedCount(options, selected)}/${options.length}`)), parts.panel(h.div.class(classes.options))?.children(options.map((option) => h.label.key(option.id).class("flex items-center gap-2 text-sm").children(h.input.class("accent-primary").attrs({
118
+ type: "checkbox",
119
+ checked: selected[option.id] === true ? "" : undefined,
120
+ disabled: disabled ? "" : undefined
121
+ }).on("change", ({ checked }) => PermissionsInputMessage.Toggle({
122
+ id: option.id,
123
+ checked: Boolean(checked)
124
+ })), option.label))))
125
+ }))));
126
+ }
127
+ });
128
+ export {
129
+ PermissionsInput
130
+ };
@@ -0,0 +1,80 @@
1
+ import { Schema } from "effect";
2
+ import { Component, UiSchema } from "effect/ui";
3
+ import { PermissionsInputProps } from "./schema.js";
4
+ export declare const PermissionsInputMessage: UiSchema.TaggedEnum<{
5
+ readonly All: Schema.TaggedStruct<"All", {
6
+ readonly checked: Schema.Boolean;
7
+ }>;
8
+ readonly Group: Schema.TaggedStruct<"Group", {
9
+ readonly id: Schema.String;
10
+ readonly open: Schema.Boolean;
11
+ }>;
12
+ readonly Toggle: Schema.TaggedStruct<"Toggle", {
13
+ readonly id: Schema.String;
14
+ readonly checked: Schema.Boolean;
15
+ }>;
16
+ }>;
17
+ declare const PermissionsInputEvent: UiSchema.TaggedEnum<{
18
+ readonly Changed: Schema.TaggedStruct<"Changed", {
19
+ readonly ids: Schema.$Array<Schema.String>;
20
+ readonly checked: Schema.Boolean;
21
+ }>;
22
+ }>;
23
+ export type PermissionsInputChange = Omit<typeof PermissionsInputEvent.Type, "_tag">;
24
+ export declare const selectedCount: (options: PermissionsInputProps["groups"][number]["options"], selected: PermissionsInputProps["selected"]) => number;
25
+ export declare const hasSelection: (props: PermissionsInputProps) => boolean;
26
+ export declare const permissionsInputOptions: {
27
+ readonly name: "PermissionsInput";
28
+ readonly props: Schema.Struct<{
29
+ readonly title: Schema.String;
30
+ readonly description: Schema.optionalKey<Schema.String>;
31
+ readonly selectAllLabel: Schema.String;
32
+ readonly clearAllLabel: Schema.String;
33
+ readonly groups: Schema.$Array<Schema.Struct<{
34
+ readonly id: Schema.String;
35
+ readonly label: Schema.String;
36
+ readonly options: Schema.$Array<Schema.Struct<{
37
+ readonly id: Schema.String;
38
+ readonly label: Schema.String;
39
+ }>>;
40
+ }>>;
41
+ readonly selected: Schema.$Record<Schema.String, Schema.Boolean>;
42
+ readonly disabled: Schema.optionalKey<Schema.Boolean>;
43
+ readonly classes: Schema.optionalKey<Schema.Struct<{
44
+ readonly groups: Schema.optionalKey<Schema.String>;
45
+ readonly trigger: Schema.optionalKey<Schema.String>;
46
+ readonly options: Schema.optionalKey<Schema.String>;
47
+ }>>;
48
+ }>;
49
+ readonly model: Schema.$Array<Schema.String>;
50
+ readonly message: UiSchema.TaggedEnum<{
51
+ readonly All: Schema.TaggedStruct<"All", {
52
+ readonly checked: Schema.Boolean;
53
+ }>;
54
+ readonly Group: Schema.TaggedStruct<"Group", {
55
+ readonly id: Schema.String;
56
+ readonly open: Schema.Boolean;
57
+ }>;
58
+ readonly Toggle: Schema.TaggedStruct<"Toggle", {
59
+ readonly id: Schema.String;
60
+ readonly checked: Schema.Boolean;
61
+ }>;
62
+ }>;
63
+ readonly events: UiSchema.TaggedEnum<{
64
+ readonly Changed: Schema.TaggedStruct<"Changed", {
65
+ readonly ids: Schema.$Array<Schema.String>;
66
+ readonly checked: Schema.Boolean;
67
+ }>;
68
+ }>;
69
+ readonly restore: false;
70
+ };
71
+ type Model = typeof permissionsInputOptions.model.Type;
72
+ type Message = typeof PermissionsInputMessage.Type;
73
+ type Events = typeof PermissionsInputEvent.Type;
74
+ export declare const permissionsInputBehaviours: {
75
+ init: ({ props }: {
76
+ props: PermissionsInputProps;
77
+ }) => string[];
78
+ update: (context: Component.Update<Model, Message, Events, PermissionsInputProps>, message: Message) => Model | Component.Step<Model, Message, Events, never>;
79
+ };
80
+ export {};
@@ -0,0 +1,7 @@
1
+ import { type PermissionsInputChange } from "./index.js";
2
+ import type { PermissionsInputProps } from "./schema.js";
3
+ export type { PermissionsInputChange } from "./index.js";
4
+ export type { PermissionsInputGroup, PermissionsInputProps } from "./schema.js";
5
+ export declare const PermissionsInput: ({ onChange, ...props }: PermissionsInputProps & {
6
+ onChange: (change: PermissionsInputChange) => void;
7
+ }) => import("react").JSX.Element | null;