@contember/react-select 2.1.0-alpha.30 → 2.1.0-alpha.36

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 (128) hide show
  1. package/package.json +12 -12
  2. package/src/components/MultiSelect.tsx +1 -2
  3. package/src/components/Select.tsx +0 -1
  4. package/src/components/SelectDataView.tsx +1 -1
  5. package/src/components/SelectEachItem.tsx +0 -1
  6. package/src/components/SelectItemTrigger.tsx +1 -1
  7. package/src/components/SelectNewItem.tsx +27 -10
  8. package/src/components/SortableMultiSelect.tsx +64 -60
  9. package/src/contexts.ts +0 -2
  10. package/dist/development/index.cjs +0 -30
  11. package/dist/development/index.cjs.map +0 -1
  12. package/dist/development/index.js +0 -30
  13. package/dist/development/index.js.map +0 -1
  14. package/dist/development/src/components/MultiSelect.cjs +0 -54
  15. package/dist/development/src/components/MultiSelect.cjs.map +0 -1
  16. package/dist/development/src/components/MultiSelect.js +0 -54
  17. package/dist/development/src/components/MultiSelect.js.map +0 -1
  18. package/dist/development/src/components/Select.cjs +0 -52
  19. package/dist/development/src/components/Select.cjs.map +0 -1
  20. package/dist/development/src/components/Select.js +0 -52
  21. package/dist/development/src/components/Select.js.map +0 -1
  22. package/dist/development/src/components/SelectDataView.cjs +0 -30
  23. package/dist/development/src/components/SelectDataView.cjs.map +0 -1
  24. package/dist/development/src/components/SelectDataView.js +0 -30
  25. package/dist/development/src/components/SelectDataView.js.map +0 -1
  26. package/dist/development/src/components/SelectEachItem.cjs +0 -15
  27. package/dist/development/src/components/SelectEachItem.cjs.map +0 -1
  28. package/dist/development/src/components/SelectEachItem.js +0 -15
  29. package/dist/development/src/components/SelectEachItem.js.map +0 -1
  30. package/dist/development/src/components/SelectItemTrigger.cjs +0 -23
  31. package/dist/development/src/components/SelectItemTrigger.cjs.map +0 -1
  32. package/dist/development/src/components/SelectItemTrigger.js +0 -23
  33. package/dist/development/src/components/SelectItemTrigger.js.map +0 -1
  34. package/dist/development/src/components/SelectNewItem.cjs +0 -60
  35. package/dist/development/src/components/SelectNewItem.cjs.map +0 -1
  36. package/dist/development/src/components/SelectNewItem.js +0 -60
  37. package/dist/development/src/components/SelectNewItem.js.map +0 -1
  38. package/dist/development/src/components/SelectOption.cjs +0 -30
  39. package/dist/development/src/components/SelectOption.cjs.map +0 -1
  40. package/dist/development/src/components/SelectOption.js +0 -30
  41. package/dist/development/src/components/SelectOption.js.map +0 -1
  42. package/dist/development/src/components/SelectPlaceholder.cjs +0 -14
  43. package/dist/development/src/components/SelectPlaceholder.cjs.map +0 -1
  44. package/dist/development/src/components/SelectPlaceholder.js +0 -14
  45. package/dist/development/src/components/SelectPlaceholder.js.map +0 -1
  46. package/dist/development/src/components/SortableMultiSelect.cjs +0 -78
  47. package/dist/development/src/components/SortableMultiSelect.cjs.map +0 -1
  48. package/dist/development/src/components/SortableMultiSelect.js +0 -78
  49. package/dist/development/src/components/SortableMultiSelect.js.map +0 -1
  50. package/dist/development/src/contexts.cjs +0 -24
  51. package/dist/development/src/contexts.cjs.map +0 -1
  52. package/dist/development/src/contexts.js +0 -24
  53. package/dist/development/src/contexts.js.map +0 -1
  54. package/dist/production/index.cjs +0 -30
  55. package/dist/production/index.cjs.map +0 -1
  56. package/dist/production/index.js +0 -30
  57. package/dist/production/index.js.map +0 -1
  58. package/dist/production/src/components/MultiSelect.cjs +0 -34
  59. package/dist/production/src/components/MultiSelect.cjs.map +0 -1
  60. package/dist/production/src/components/MultiSelect.js +0 -34
  61. package/dist/production/src/components/MultiSelect.js.map +0 -1
  62. package/dist/production/src/components/Select.cjs +0 -32
  63. package/dist/production/src/components/Select.cjs.map +0 -1
  64. package/dist/production/src/components/Select.js +0 -32
  65. package/dist/production/src/components/Select.js.map +0 -1
  66. package/dist/production/src/components/SelectDataView.cjs +0 -22
  67. package/dist/production/src/components/SelectDataView.cjs.map +0 -1
  68. package/dist/production/src/components/SelectDataView.js +0 -22
  69. package/dist/production/src/components/SelectDataView.js.map +0 -1
  70. package/dist/production/src/components/SelectEachItem.cjs +0 -11
  71. package/dist/production/src/components/SelectEachItem.cjs.map +0 -1
  72. package/dist/production/src/components/SelectEachItem.js +0 -11
  73. package/dist/production/src/components/SelectEachItem.js.map +0 -1
  74. package/dist/production/src/components/SelectItemTrigger.cjs +0 -19
  75. package/dist/production/src/components/SelectItemTrigger.cjs.map +0 -1
  76. package/dist/production/src/components/SelectItemTrigger.js +0 -19
  77. package/dist/production/src/components/SelectItemTrigger.js.map +0 -1
  78. package/dist/production/src/components/SelectNewItem.cjs +0 -40
  79. package/dist/production/src/components/SelectNewItem.cjs.map +0 -1
  80. package/dist/production/src/components/SelectNewItem.js +0 -40
  81. package/dist/production/src/components/SelectNewItem.js.map +0 -1
  82. package/dist/production/src/components/SelectOption.cjs +0 -22
  83. package/dist/production/src/components/SelectOption.cjs.map +0 -1
  84. package/dist/production/src/components/SelectOption.js +0 -22
  85. package/dist/production/src/components/SelectOption.js.map +0 -1
  86. package/dist/production/src/components/SelectPlaceholder.cjs +0 -10
  87. package/dist/production/src/components/SelectPlaceholder.cjs.map +0 -1
  88. package/dist/production/src/components/SelectPlaceholder.js +0 -10
  89. package/dist/production/src/components/SelectPlaceholder.js.map +0 -1
  90. package/dist/production/src/components/SortableMultiSelect.cjs +0 -50
  91. package/dist/production/src/components/SortableMultiSelect.cjs.map +0 -1
  92. package/dist/production/src/components/SortableMultiSelect.js +0 -50
  93. package/dist/production/src/components/SortableMultiSelect.js.map +0 -1
  94. package/dist/production/src/contexts.cjs +0 -24
  95. package/dist/production/src/contexts.cjs.map +0 -1
  96. package/dist/production/src/contexts.js +0 -24
  97. package/dist/production/src/contexts.js.map +0 -1
  98. package/dist/types/components/MultiSelect.d.ts +0 -14
  99. package/dist/types/components/MultiSelect.d.ts.map +0 -1
  100. package/dist/types/components/Select.d.ts +0 -16
  101. package/dist/types/components/Select.d.ts.map +0 -1
  102. package/dist/types/components/SelectDataView.d.ts +0 -7
  103. package/dist/types/components/SelectDataView.d.ts.map +0 -1
  104. package/dist/types/components/SelectEachItem.d.ts +0 -5
  105. package/dist/types/components/SelectEachItem.d.ts.map +0 -1
  106. package/dist/types/components/SelectItemTrigger.d.ts +0 -8
  107. package/dist/types/components/SelectItemTrigger.d.ts.map +0 -1
  108. package/dist/types/components/SelectNewItem.d.ts +0 -5
  109. package/dist/types/components/SelectNewItem.d.ts.map +0 -1
  110. package/dist/types/components/SelectOption.d.ts +0 -7
  111. package/dist/types/components/SelectOption.d.ts.map +0 -1
  112. package/dist/types/components/SelectPlaceholder.d.ts +0 -5
  113. package/dist/types/components/SelectPlaceholder.d.ts.map +0 -1
  114. package/dist/types/components/SortableMultiSelect.d.ts +0 -18
  115. package/dist/types/components/SortableMultiSelect.d.ts.map +0 -1
  116. package/dist/types/components/index.d.ts +0 -10
  117. package/dist/types/components/index.d.ts.map +0 -1
  118. package/dist/types/contexts.d.ts +0 -23
  119. package/dist/types/contexts.d.ts.map +0 -1
  120. package/dist/types/hooks/index.d.ts +0 -2
  121. package/dist/types/hooks/index.d.ts.map +0 -1
  122. package/dist/types/index.d.ts +0 -5
  123. package/dist/types/index.d.ts.map +0 -1
  124. package/dist/types/tsconfig.tsbuildinfo +0 -1
  125. package/dist/types/types/events.d.ts +0 -6
  126. package/dist/types/types/events.d.ts.map +0 -1
  127. package/dist/types/types/index.d.ts +0 -2
  128. package/dist/types/types/index.d.ts.map +0 -1
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxDevRuntime = require("react/jsx-dev-runtime");
4
- const contexts = require("../contexts.cjs");
5
- const reactDataview = require("@contember/react-dataview");
6
- const SelectDataView = (props) => {
7
- const handleSelect = contexts.useSelectHandleSelect();
8
- const entities = contexts.useSelectOptions();
9
- return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
10
- reactDataview.DataView,
11
- {
12
- onSelectHighlighted: handleSelect,
13
- entities,
14
- filteringStateStorage: "null",
15
- sortingStateStorage: "null",
16
- currentPageStateStorage: "null",
17
- ...props
18
- },
19
- void 0,
20
- false,
21
- {
22
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectDataView.tsx",
23
- lineNumber: 16,
24
- columnNumber: 3
25
- },
26
- void 0
27
- );
28
- };
29
- exports.SelectDataView = SelectDataView;
30
- //# sourceMappingURL=SelectDataView.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectDataView.cjs","sources":["../../../../../packages/react-select/src/components/SelectDataView.tsx"],"sourcesContent":["import React, { ReactNode, useMemo } from 'react'\nimport { useSelectHandleSelect, useSelectOptions } from '../contexts'\nimport { DataViewProps, DataView, DataViewFilterHandlerRegistry } from '@contember/react-dataview'\n\nexport type SelectDataViewProps =\n\t& Omit<DataViewProps, 'entities'>\n\t& {\n\t\tchildren: ReactNode\n\t}\n\nexport const SelectDataView = (props: SelectDataViewProps) => {\n\tconst handleSelect = useSelectHandleSelect()\n\tconst entities = useSelectOptions()\n\n\treturn (\n\t\t<DataView\n\t\t\tonSelectHighlighted={handleSelect}\n\t\t\tentities={entities}\n\t\t\tfilteringStateStorage=\"null\"\n\t\t\tsortingStateStorage=\"null\"\n\t\t\tcurrentPageStateStorage=\"null\"\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n"],"names":["useSelectHandleSelect","useSelectOptions","jsxDEV","DataView","this"],"mappings":";;;;;AAUa,MAAA,iBAAiB,CAAC,UAA+B;AAC7D,QAAM,eAAeA,SAAAA,sBAAsB;AAC3C,QAAM,WAAWC,SAAAA,iBAAiB;AAGjC,SAAAC,8BAAA;AAAA,IAACC,cAAA;AAAA,IAAA;AAAA,MACA,qBAAqB;AAAA,MACrB;AAAA,MACA,uBAAsB;AAAA,MACtB,qBAAoB;AAAA,MACpB,yBAAwB;AAAA,MACvB,GAAG;AAAA,IAAA;AAAA,IANL;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAC;AAAAA,EAOA;AAEF;;"}
@@ -1,30 +0,0 @@
1
- import { jsxDEV } from "react/jsx-dev-runtime";
2
- import { useSelectHandleSelect, useSelectOptions } from "../contexts.js";
3
- import { DataView } from "@contember/react-dataview";
4
- const SelectDataView = (props) => {
5
- const handleSelect = useSelectHandleSelect();
6
- const entities = useSelectOptions();
7
- return /* @__PURE__ */ jsxDEV(
8
- DataView,
9
- {
10
- onSelectHighlighted: handleSelect,
11
- entities,
12
- filteringStateStorage: "null",
13
- sortingStateStorage: "null",
14
- currentPageStateStorage: "null",
15
- ...props
16
- },
17
- void 0,
18
- false,
19
- {
20
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectDataView.tsx",
21
- lineNumber: 16,
22
- columnNumber: 3
23
- },
24
- void 0
25
- );
26
- };
27
- export {
28
- SelectDataView
29
- };
30
- //# sourceMappingURL=SelectDataView.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectDataView.js","sources":["../../../../../packages/react-select/src/components/SelectDataView.tsx"],"sourcesContent":["import React, { ReactNode, useMemo } from 'react'\nimport { useSelectHandleSelect, useSelectOptions } from '../contexts'\nimport { DataViewProps, DataView, DataViewFilterHandlerRegistry } from '@contember/react-dataview'\n\nexport type SelectDataViewProps =\n\t& Omit<DataViewProps, 'entities'>\n\t& {\n\t\tchildren: ReactNode\n\t}\n\nexport const SelectDataView = (props: SelectDataViewProps) => {\n\tconst handleSelect = useSelectHandleSelect()\n\tconst entities = useSelectOptions()\n\n\treturn (\n\t\t<DataView\n\t\t\tonSelectHighlighted={handleSelect}\n\t\t\tentities={entities}\n\t\t\tfilteringStateStorage=\"null\"\n\t\t\tsortingStateStorage=\"null\"\n\t\t\tcurrentPageStateStorage=\"null\"\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n"],"names":["this"],"mappings":";;;AAUa,MAAA,iBAAiB,CAAC,UAA+B;AAC7D,QAAM,eAAe,sBAAsB;AAC3C,QAAM,WAAW,iBAAiB;AAGjC,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,qBAAqB;AAAA,MACrB;AAAA,MACA,uBAAsB;AAAA,MACtB,qBAAoB;AAAA,MACpB,yBAAwB;AAAA,MACvB,GAAG;AAAA,IAAA;AAAA,IANL;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAOA;AAEF;"}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxDevRuntime = require("react/jsx-dev-runtime");
4
- const contexts = require("../contexts.cjs");
5
- const reactBinding = require("@contember/react-binding");
6
- const SelectEachValue = ({ children }) => {
7
- const entities = contexts.useSelectCurrentEntities();
8
- return entities.map((entity) => /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactBinding.Entity, { accessor: entity, children }, entity.key, false, {
9
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectEachItem.tsx",
10
- lineNumber: 9,
11
- columnNumber: 3
12
- }, void 0));
13
- };
14
- exports.SelectEachValue = SelectEachValue;
15
- //# sourceMappingURL=SelectEachItem.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectEachItem.cjs","sources":["../../../../../packages/react-select/src/components/SelectEachItem.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useSelectCurrentEntities } from '../contexts'\nimport { Entity } from '@contember/react-binding'\n\n\nexport const SelectEachValue = ({ children }: { children: ReactNode }) => {\n\tconst entities = useSelectCurrentEntities()\n\treturn entities.map(entity => (\n\t\t<Entity key={entity.key} accessor={entity}>\n\t\t\t{children}\n\t\t</Entity>\n\t))\n}\n"],"names":["useSelectCurrentEntities","jsxDEV","Entity","this"],"mappings":";;;;;AAKO,MAAM,kBAAkB,CAAC,EAAE,eAAwC;AACzE,QAAM,WAAWA,SAAAA,yBAAyB;AACnC,SAAA,SAAS,IAAI,CACnB,WAAAC,8BAAA,OAACC,uBAAwB,UAAU,QACjC,SADW,GAAA,OAAO,KAApB,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAEA,CACA;AACF;;"}
@@ -1,15 +0,0 @@
1
- import { jsxDEV } from "react/jsx-dev-runtime";
2
- import { useSelectCurrentEntities } from "../contexts.js";
3
- import { Entity } from "@contember/react-binding";
4
- const SelectEachValue = ({ children }) => {
5
- const entities = useSelectCurrentEntities();
6
- return entities.map((entity) => /* @__PURE__ */ jsxDEV(Entity, { accessor: entity, children }, entity.key, false, {
7
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectEachItem.tsx",
8
- lineNumber: 9,
9
- columnNumber: 3
10
- }, void 0));
11
- };
12
- export {
13
- SelectEachValue
14
- };
15
- //# sourceMappingURL=SelectEachItem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectEachItem.js","sources":["../../../../../packages/react-select/src/components/SelectEachItem.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useSelectCurrentEntities } from '../contexts'\nimport { Entity } from '@contember/react-binding'\n\n\nexport const SelectEachValue = ({ children }: { children: ReactNode }) => {\n\tconst entities = useSelectCurrentEntities()\n\treturn entities.map(entity => (\n\t\t<Entity key={entity.key} accessor={entity}>\n\t\t\t{children}\n\t\t</Entity>\n\t))\n}\n"],"names":["this"],"mappings":";;;AAKO,MAAM,kBAAkB,CAAC,EAAE,eAAwC;AACzE,QAAM,WAAW,yBAAyB;AACnC,SAAA,SAAS,IAAI,CACnB,WAAA,uBAAC,UAAwB,UAAU,QACjC,SADW,GAAA,OAAO,KAApB,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAEA,CACA;AACF;"}
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxDevRuntime = require("react/jsx-dev-runtime");
4
- const React = require("react");
5
- const contexts = require("../contexts.cjs");
6
- const reactSlot = require("@radix-ui/react-slot");
7
- const reactBinding = require("@contember/react-binding");
8
- const SelectItemTrigger = React.forwardRef(({ action, ...props }, ref) => {
9
- const handleSelect = contexts.useSelectHandleSelect();
10
- const entity = reactBinding.useEntity();
11
- const onClickProp = props.onClick;
12
- const onClick = React.useCallback((e) => {
13
- handleSelect?.(entity, action);
14
- onClickProp?.(e);
15
- }, [action, entity, handleSelect, onClickProp]);
16
- return /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactSlot.Slot, { ...props, onClick, ref }, void 0, false, {
17
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectItemTrigger.tsx",
18
- lineNumber: 20,
19
- columnNumber: 9
20
- }, void 0);
21
- });
22
- exports.SelectItemTrigger = SelectItemTrigger;
23
- //# sourceMappingURL=SelectItemTrigger.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectItemTrigger.cjs","sources":["../../../../../packages/react-select/src/components/SelectItemTrigger.tsx"],"sourcesContent":["import React, { forwardRef, ReactElement, useCallback } from 'react'\nimport { useSelectHandleSelect } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useEntity } from '@contember/react-binding'\n\nexport type SelectItemTriggerProps = {\n\tchildren: ReactElement\n\taction?: 'select' | 'unselect' | 'toggle'\n\tonClick?: (event: React.MouseEvent<HTMLElement>) => void\n}\n\nexport const SelectItemTrigger = forwardRef<HTMLElement, SelectItemTriggerProps>(({ action, ...props }: SelectItemTriggerProps, ref) => {\n\tconst handleSelect = useSelectHandleSelect()\n\tconst entity = useEntity()\n\tconst onClickProp = props.onClick\n\tconst onClick = useCallback((e: React.MouseEvent<HTMLElement>) => {\n\t\thandleSelect?.(entity, action)\n\t\tonClickProp?.(e)\n\t}, [action, entity, handleSelect, onClickProp])\n\treturn <Slot {...props} onClick={onClick} ref={ref} />\n})\n"],"names":["forwardRef","useSelectHandleSelect","useEntity","useCallback","jsxDEV","Slot","this"],"mappings":";;;;;;;AAWa,MAAA,oBAAoBA,iBAAgD,CAAC,EAAE,QAAQ,GAAG,SAAiC,QAAQ;AACvI,QAAM,eAAeC,SAAAA,sBAAsB;AAC3C,QAAM,SAASC,aAAAA,UAAU;AACzB,QAAM,cAAc,MAAM;AACpB,QAAA,UAAUC,kBAAY,CAAC,MAAqC;AACjE,mBAAe,QAAQ,MAAM;AAC7B,kBAAc,CAAC;AAAA,KACb,CAAC,QAAQ,QAAQ,cAAc,WAAW,CAAC;AAC9C,SAAQC,8BAAA,OAAAC,gBAAA,EAAM,GAAG,OAAO,SAAmB,IAApC,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAA8C,GAAAC,MAAA;AACtD,CAAC;;"}
@@ -1,23 +0,0 @@
1
- import { jsxDEV } from "react/jsx-dev-runtime";
2
- import { forwardRef, useCallback } from "react";
3
- import { useSelectHandleSelect } from "../contexts.js";
4
- import { Slot } from "@radix-ui/react-slot";
5
- import { useEntity } from "@contember/react-binding";
6
- const SelectItemTrigger = forwardRef(({ action, ...props }, ref) => {
7
- const handleSelect = useSelectHandleSelect();
8
- const entity = useEntity();
9
- const onClickProp = props.onClick;
10
- const onClick = useCallback((e) => {
11
- handleSelect?.(entity, action);
12
- onClickProp?.(e);
13
- }, [action, entity, handleSelect, onClickProp]);
14
- return /* @__PURE__ */ jsxDEV(Slot, { ...props, onClick, ref }, void 0, false, {
15
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectItemTrigger.tsx",
16
- lineNumber: 20,
17
- columnNumber: 9
18
- }, void 0);
19
- });
20
- export {
21
- SelectItemTrigger
22
- };
23
- //# sourceMappingURL=SelectItemTrigger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectItemTrigger.js","sources":["../../../../../packages/react-select/src/components/SelectItemTrigger.tsx"],"sourcesContent":["import React, { forwardRef, ReactElement, useCallback } from 'react'\nimport { useSelectHandleSelect } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useEntity } from '@contember/react-binding'\n\nexport type SelectItemTriggerProps = {\n\tchildren: ReactElement\n\taction?: 'select' | 'unselect' | 'toggle'\n\tonClick?: (event: React.MouseEvent<HTMLElement>) => void\n}\n\nexport const SelectItemTrigger = forwardRef<HTMLElement, SelectItemTriggerProps>(({ action, ...props }: SelectItemTriggerProps, ref) => {\n\tconst handleSelect = useSelectHandleSelect()\n\tconst entity = useEntity()\n\tconst onClickProp = props.onClick\n\tconst onClick = useCallback((e: React.MouseEvent<HTMLElement>) => {\n\t\thandleSelect?.(entity, action)\n\t\tonClickProp?.(e)\n\t}, [action, entity, handleSelect, onClickProp])\n\treturn <Slot {...props} onClick={onClick} ref={ref} />\n})\n"],"names":["this"],"mappings":";;;;;AAWa,MAAA,oBAAoB,WAAgD,CAAC,EAAE,QAAQ,GAAG,SAAiC,QAAQ;AACvI,QAAM,eAAe,sBAAsB;AAC3C,QAAM,SAAS,UAAU;AACzB,QAAM,cAAc,MAAM;AACpB,QAAA,UAAU,YAAY,CAAC,MAAqC;AACjE,mBAAe,QAAQ,MAAM;AAC7B,kBAAc,CAAC;AAAA,KACb,CAAC,QAAQ,QAAQ,cAAc,WAAW,CAAC;AAC9C,SAAQ,uBAAA,MAAA,EAAM,GAAG,OAAO,SAAmB,IAApC,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAA8C,GAAAA,MAAA;AACtD,CAAC;"}
@@ -1,60 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxDevRuntime = require("react/jsx-dev-runtime");
4
- const reactBinding = require("@contember/react-binding");
5
- const React = require("react");
6
- const contexts = require("../contexts.cjs");
7
- const SelectNewItem = ({ children }) => {
8
- const options = contexts.useSelectOptions();
9
- const env = reactBinding.useEnvironment();
10
- const { entityName } = React.useMemo(() => reactBinding.QueryLanguage.desugarQualifiedEntityList({ entities: options }, env), [env, options]);
11
- const [state, setState] = React.useState(null);
12
- const extendTree = reactBinding.useExtendTree();
13
- const getSubTree = reactBinding.useGetEntitySubTree();
14
- React.useEffect(() => {
15
- (async () => {
16
- const treeRootId = await extendTree(/* @__PURE__ */ jsxDevRuntime.jsxDEV(jsxDevRuntime.Fragment, { children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactBinding.EntitySubTree, { entity: {
17
- entityName
18
- }, expectedMutation: "none", isUnpersisted: true, isCreating: true, children }, void 0, false, {
19
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectNewItem.tsx",
20
- lineNumber: 18,
21
- columnNumber: 5
22
- }, void 0) }, void 0, false, {
23
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectNewItem.tsx",
24
- lineNumber: 17,
25
- columnNumber: 40
26
- }, void 0));
27
- if (!treeRootId) {
28
- return;
29
- }
30
- const entity = getSubTree({
31
- entity: {
32
- entityName
33
- },
34
- isCreating: true
35
- }, treeRootId);
36
- setState({
37
- entity,
38
- treeRootId
39
- });
40
- })();
41
- }, [children, entityName, extendTree, getSubTree]);
42
- if (!state) {
43
- return null;
44
- }
45
- return /* @__PURE__ */ jsxDevRuntime.jsxDEV(jsxDevRuntime.Fragment, { children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactBinding.TreeRootIdProvider, { treeRootId: state.treeRootId, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactBinding.Entity, { accessor: state.entity, children }, void 0, false, {
46
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectNewItem.tsx",
47
- lineNumber: 48,
48
- columnNumber: 5
49
- }, void 0) }, void 0, false, {
50
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectNewItem.tsx",
51
- lineNumber: 47,
52
- columnNumber: 4
53
- }, void 0) }, void 0, false, {
54
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectNewItem.tsx",
55
- lineNumber: 46,
56
- columnNumber: 3
57
- }, void 0);
58
- };
59
- exports.SelectNewItem = SelectNewItem;
60
- //# sourceMappingURL=SelectNewItem.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectNewItem.cjs","sources":["../../../../../packages/react-select/src/components/SelectNewItem.tsx"],"sourcesContent":["import { Entity, EntityAccessor, EntitySubTree, QueryLanguage, TreeRootId, TreeRootIdProvider, useEnvironment, useExtendTree, useGetEntitySubTree } from '@contember/react-binding'\nimport * as React from 'react'\nimport { ReactNode, useEffect, useMemo, useState } from 'react'\nimport { useSelectOptions } from '../contexts'\n\nexport const SelectNewItem = ({ children }: { children: ReactNode }) => {\n\tconst options = useSelectOptions()\n\tconst env = useEnvironment()\n\tconst { entityName } = useMemo((() => QueryLanguage.desugarQualifiedEntityList({ entities: options }, env)), [env, options])\n\n\tconst [state, setState] = useState<{ entity: EntityAccessor; treeRootId: TreeRootId } | null>(null)\n\tconst extendTree = useExtendTree()\n\tconst getSubTree = useGetEntitySubTree()\n\n\tuseEffect(() => {\n\t\t(async () => {\n\t\t\tconst treeRootId = await extendTree(<>\n\t\t\t\t<EntitySubTree entity={{\n\t\t\t\t\tentityName,\n\t\t\t\t}} expectedMutation={'none'} isUnpersisted isCreating>\n\t\t\t\t\t{children}\n\t\t\t\t</EntitySubTree>\n\t\t\t</>)\n\t\t\tif (!treeRootId) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst entity = getSubTree({\n\t\t\t\tentity: {\n\t\t\t\t\tentityName: entityName,\n\t\t\t\t},\n\t\t\t\tisCreating: true,\n\t\t\t}, treeRootId)\n\t\t\tsetState({\n\t\t\t\tentity,\n\t\t\t\ttreeRootId,\n\t\t\t})\n\t\t})()\n\t}, [children, entityName, extendTree, getSubTree])\n\n\tif (!state) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<TreeRootIdProvider treeRootId={state.treeRootId}>\n\t\t\t\t<Entity accessor={state.entity}>\n\t\t\t\t\t{children}\n\t\t\t\t</Entity>\n\t\t\t</TreeRootIdProvider>\n\t\t</>\n\t)\n}\n"],"names":["useSelectOptions","useEnvironment","useMemo","QueryLanguage","useState","useExtendTree","useGetEntitySubTree","useEffect","jsxDEV","Fragment","EntitySubTree","this","TreeRootIdProvider","Entity"],"mappings":";;;;;;AAKO,MAAM,gBAAgB,CAAC,EAAE,eAAwC;AACvE,QAAM,UAAUA,SAAAA,iBAAiB;AACjC,QAAM,MAAMC,aAAAA,eAAe;AAC3B,QAAM,EAAE,WAAW,IAAIC,MAAS,QAAA,MAAMC,aAAAA,cAAc,2BAA2B,EAAE,UAAU,WAAW,GAAG,GAAI,CAAC,KAAK,OAAO,CAAC;AAE3H,QAAM,CAAC,OAAO,QAAQ,IAAIC,MAAAA,SAAoE,IAAI;AAClG,QAAM,aAAaC,aAAAA,cAAc;AACjC,QAAM,aAAaC,aAAAA,oBAAoB;AAEvCC,QAAAA,UAAU,MAAM;AACf,KAAC,YAAY;AACZ,YAAM,aAAa,MAAM,WACxBC,qCAAAC,cAAAA,UAAA,EAAA,UAAAD,8BAAA,OAACE,8BAAc,QAAQ;AAAA,QACtB;AAAA,SACE,kBAAkB,QAAQ,eAAa,MAAC,YAAU,MACnD,SAHF,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAA,GAAAC,MAIA,EALmC,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAA,GAAAA,MAMpC,CAAG;AACH,UAAI,CAAC,YAAY;AAChB;AAAA,MAAA;AAGD,YAAM,SAAS,WAAW;AAAA,QACzB,QAAQ;AAAA,UACP;AAAA,QACD;AAAA,QACA,YAAY;AAAA,SACV,UAAU;AACJ,eAAA;AAAA,QACR;AAAA,QACA;AAAA,MAAA,CACA;AAAA,IAAA,GACC;AAAA,KACD,CAAC,UAAU,YAAY,YAAY,UAAU,CAAC;AAEjD,MAAI,CAAC,OAAO;AACJ,WAAA;AAAA,EAAA;AAIP,SAAAH,8BAAA,OAAAC,cAAA,UAAA,EACC,UAACD,8BAAA,OAAAI,iCAAA,EAAmB,YAAY,MAAM,YACrC,UAAAJ,qCAACK,aAAAA,QAAO,EAAA,UAAU,MAAM,QACtB,SADF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAF,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAIA,EALD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAMA,GAAAA,MAAA;AAEF;;"}
@@ -1,60 +0,0 @@
1
- import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
2
- import { useEnvironment, QueryLanguage, useExtendTree, useGetEntitySubTree, EntitySubTree, TreeRootIdProvider, Entity } from "@contember/react-binding";
3
- import { useMemo, useState, useEffect } from "react";
4
- import { useSelectOptions } from "../contexts.js";
5
- const SelectNewItem = ({ children }) => {
6
- const options = useSelectOptions();
7
- const env = useEnvironment();
8
- const { entityName } = useMemo(() => QueryLanguage.desugarQualifiedEntityList({ entities: options }, env), [env, options]);
9
- const [state, setState] = useState(null);
10
- const extendTree = useExtendTree();
11
- const getSubTree = useGetEntitySubTree();
12
- useEffect(() => {
13
- (async () => {
14
- const treeRootId = await extendTree(/* @__PURE__ */ jsxDEV(Fragment, { children: /* @__PURE__ */ jsxDEV(EntitySubTree, { entity: {
15
- entityName
16
- }, expectedMutation: "none", isUnpersisted: true, isCreating: true, children }, void 0, false, {
17
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectNewItem.tsx",
18
- lineNumber: 18,
19
- columnNumber: 5
20
- }, void 0) }, void 0, false, {
21
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectNewItem.tsx",
22
- lineNumber: 17,
23
- columnNumber: 40
24
- }, void 0));
25
- if (!treeRootId) {
26
- return;
27
- }
28
- const entity = getSubTree({
29
- entity: {
30
- entityName
31
- },
32
- isCreating: true
33
- }, treeRootId);
34
- setState({
35
- entity,
36
- treeRootId
37
- });
38
- })();
39
- }, [children, entityName, extendTree, getSubTree]);
40
- if (!state) {
41
- return null;
42
- }
43
- return /* @__PURE__ */ jsxDEV(Fragment, { children: /* @__PURE__ */ jsxDEV(TreeRootIdProvider, { treeRootId: state.treeRootId, children: /* @__PURE__ */ jsxDEV(Entity, { accessor: state.entity, children }, void 0, false, {
44
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectNewItem.tsx",
45
- lineNumber: 48,
46
- columnNumber: 5
47
- }, void 0) }, void 0, false, {
48
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectNewItem.tsx",
49
- lineNumber: 47,
50
- columnNumber: 4
51
- }, void 0) }, void 0, false, {
52
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectNewItem.tsx",
53
- lineNumber: 46,
54
- columnNumber: 3
55
- }, void 0);
56
- };
57
- export {
58
- SelectNewItem
59
- };
60
- //# sourceMappingURL=SelectNewItem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectNewItem.js","sources":["../../../../../packages/react-select/src/components/SelectNewItem.tsx"],"sourcesContent":["import { Entity, EntityAccessor, EntitySubTree, QueryLanguage, TreeRootId, TreeRootIdProvider, useEnvironment, useExtendTree, useGetEntitySubTree } from '@contember/react-binding'\nimport * as React from 'react'\nimport { ReactNode, useEffect, useMemo, useState } from 'react'\nimport { useSelectOptions } from '../contexts'\n\nexport const SelectNewItem = ({ children }: { children: ReactNode }) => {\n\tconst options = useSelectOptions()\n\tconst env = useEnvironment()\n\tconst { entityName } = useMemo((() => QueryLanguage.desugarQualifiedEntityList({ entities: options }, env)), [env, options])\n\n\tconst [state, setState] = useState<{ entity: EntityAccessor; treeRootId: TreeRootId } | null>(null)\n\tconst extendTree = useExtendTree()\n\tconst getSubTree = useGetEntitySubTree()\n\n\tuseEffect(() => {\n\t\t(async () => {\n\t\t\tconst treeRootId = await extendTree(<>\n\t\t\t\t<EntitySubTree entity={{\n\t\t\t\t\tentityName,\n\t\t\t\t}} expectedMutation={'none'} isUnpersisted isCreating>\n\t\t\t\t\t{children}\n\t\t\t\t</EntitySubTree>\n\t\t\t</>)\n\t\t\tif (!treeRootId) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst entity = getSubTree({\n\t\t\t\tentity: {\n\t\t\t\t\tentityName: entityName,\n\t\t\t\t},\n\t\t\t\tisCreating: true,\n\t\t\t}, treeRootId)\n\t\t\tsetState({\n\t\t\t\tentity,\n\t\t\t\ttreeRootId,\n\t\t\t})\n\t\t})()\n\t}, [children, entityName, extendTree, getSubTree])\n\n\tif (!state) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<TreeRootIdProvider treeRootId={state.treeRootId}>\n\t\t\t\t<Entity accessor={state.entity}>\n\t\t\t\t\t{children}\n\t\t\t\t</Entity>\n\t\t\t</TreeRootIdProvider>\n\t\t</>\n\t)\n}\n"],"names":["this"],"mappings":";;;;AAKO,MAAM,gBAAgB,CAAC,EAAE,eAAwC;AACvE,QAAM,UAAU,iBAAiB;AACjC,QAAM,MAAM,eAAe;AAC3B,QAAM,EAAE,WAAW,IAAI,QAAS,MAAM,cAAc,2BAA2B,EAAE,UAAU,WAAW,GAAG,GAAI,CAAC,KAAK,OAAO,CAAC;AAE3H,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoE,IAAI;AAClG,QAAM,aAAa,cAAc;AACjC,QAAM,aAAa,oBAAoB;AAEvC,YAAU,MAAM;AACf,KAAC,YAAY;AACZ,YAAM,aAAa,MAAM,WACxB,uBAAA,UAAA,EAAA,UAAA,uBAAC,iBAAc,QAAQ;AAAA,QACtB;AAAA,SACE,kBAAkB,QAAQ,eAAa,MAAC,YAAU,MACnD,SAHF,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAA,GAAAA,MAIA,EALmC,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAA,GAAAA,MAMpC,CAAG;AACH,UAAI,CAAC,YAAY;AAChB;AAAA,MAAA;AAGD,YAAM,SAAS,WAAW;AAAA,QACzB,QAAQ;AAAA,UACP;AAAA,QACD;AAAA,QACA,YAAY;AAAA,SACV,UAAU;AACJ,eAAA;AAAA,QACR;AAAA,QACA;AAAA,MAAA,CACA;AAAA,IAAA,GACC;AAAA,KACD,CAAC,UAAU,YAAY,YAAY,UAAU,CAAC;AAEjD,MAAI,CAAC,OAAO;AACJ,WAAA;AAAA,EAAA;AAIP,SAAA,uBAAA,UAAA,EACC,UAAC,uBAAA,oBAAA,EAAmB,YAAY,MAAM,YACrC,UAAA,uBAAC,QAAO,EAAA,UAAU,MAAM,QACtB,SADF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAIA,EALD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAMA,GAAAA,MAAA;AAEF;"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxDevRuntime = require("react/jsx-dev-runtime");
4
- const React = require("react");
5
- const contexts = require("../contexts.cjs");
6
- const reactSlot = require("@radix-ui/react-slot");
7
- const reactBinding = require("@contember/react-binding");
8
- const utilities = require("@contember/utilities");
9
- const SelectOption = React.forwardRef(({ action, ...props }, ref) => {
10
- const isSelected = contexts.useSelectIsSelected();
11
- const entity = reactBinding.useEntity();
12
- return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
13
- reactSlot.Slot,
14
- {
15
- ref,
16
- "data-selected": utilities.dataAttribute(isSelected?.(entity)),
17
- ...props
18
- },
19
- void 0,
20
- false,
21
- {
22
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectOption.tsx",
23
- lineNumber: 16,
24
- columnNumber: 3
25
- },
26
- void 0
27
- );
28
- });
29
- exports.SelectOption = SelectOption;
30
- //# sourceMappingURL=SelectOption.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectOption.cjs","sources":["../../../../../packages/react-select/src/components/SelectOption.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode } from 'react'\nimport { useSelectIsSelected } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useEntity } from '@contember/react-binding'\nimport { dataAttribute } from '@contember/utilities'\n\nexport type SelectOptionProps = {\n\tchildren: ReactNode\n\taction?: 'select' | 'unselect' | 'toggle'\n}\n\nexport const SelectOption = forwardRef<HTMLElement, SelectOptionProps>(({ action, ...props }, ref) => {\n\tconst isSelected = useSelectIsSelected()\n\tconst entity = useEntity()\n\treturn (\n\t\t<Slot\n\t\t\tref={ref}\n\t\t\tdata-selected={dataAttribute(isSelected?.(entity))}\n\t\t\t{...props}\n\t\t/>\n\t)\n})\n"],"names":["forwardRef","useSelectIsSelected","useEntity","jsxDEV","Slot","dataAttribute","this"],"mappings":";;;;;;;;AAWa,MAAA,eAAeA,iBAA2C,CAAC,EAAE,QAAQ,GAAG,SAAS,QAAQ;AACrG,QAAM,aAAaC,SAAAA,oBAAoB;AACvC,QAAM,SAASC,aAAAA,UAAU;AAExB,SAAAC,8BAAA;AAAA,IAACC,UAAA;AAAA,IAAA;AAAA,MACA;AAAA,MACA,iBAAeC,UAAA,cAAc,aAAa,MAAM,CAAC;AAAA,MAChD,GAAG;AAAA,IAAA;AAAA,IAHL;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAC;AAAAA,EAIA;AAEF,CAAC;;"}
@@ -1,30 +0,0 @@
1
- import { jsxDEV } from "react/jsx-dev-runtime";
2
- import { forwardRef } from "react";
3
- import { useSelectIsSelected } from "../contexts.js";
4
- import { Slot } from "@radix-ui/react-slot";
5
- import { useEntity } from "@contember/react-binding";
6
- import { dataAttribute } from "@contember/utilities";
7
- const SelectOption = forwardRef(({ action, ...props }, ref) => {
8
- const isSelected = useSelectIsSelected();
9
- const entity = useEntity();
10
- return /* @__PURE__ */ jsxDEV(
11
- Slot,
12
- {
13
- ref,
14
- "data-selected": dataAttribute(isSelected?.(entity)),
15
- ...props
16
- },
17
- void 0,
18
- false,
19
- {
20
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectOption.tsx",
21
- lineNumber: 16,
22
- columnNumber: 3
23
- },
24
- void 0
25
- );
26
- });
27
- export {
28
- SelectOption
29
- };
30
- //# sourceMappingURL=SelectOption.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectOption.js","sources":["../../../../../packages/react-select/src/components/SelectOption.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode } from 'react'\nimport { useSelectIsSelected } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useEntity } from '@contember/react-binding'\nimport { dataAttribute } from '@contember/utilities'\n\nexport type SelectOptionProps = {\n\tchildren: ReactNode\n\taction?: 'select' | 'unselect' | 'toggle'\n}\n\nexport const SelectOption = forwardRef<HTMLElement, SelectOptionProps>(({ action, ...props }, ref) => {\n\tconst isSelected = useSelectIsSelected()\n\tconst entity = useEntity()\n\treturn (\n\t\t<Slot\n\t\t\tref={ref}\n\t\t\tdata-selected={dataAttribute(isSelected?.(entity))}\n\t\t\t{...props}\n\t\t/>\n\t)\n})\n"],"names":["this"],"mappings":";;;;;;AAWa,MAAA,eAAe,WAA2C,CAAC,EAAE,QAAQ,GAAG,SAAS,QAAQ;AACrG,QAAM,aAAa,oBAAoB;AACvC,QAAM,SAAS,UAAU;AAExB,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA,iBAAe,cAAc,aAAa,MAAM,CAAC;AAAA,MAChD,GAAG;AAAA,IAAA;AAAA,IAHL;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAIA;AAEF,CAAC;"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxDevRuntime = require("react/jsx-dev-runtime");
4
- const contexts = require("../contexts.cjs");
5
- const SelectPlaceholder = ({ children }) => {
6
- const hasEntities = contexts.useSelectCurrentEntities().length > 0;
7
- return hasEntities ? null : /* @__PURE__ */ jsxDevRuntime.jsxDEV(jsxDevRuntime.Fragment, { children }, void 0, false, {
8
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectPlaceholder.tsx",
9
- lineNumber: 6,
10
- columnNumber: 30
11
- }, void 0);
12
- };
13
- exports.SelectPlaceholder = SelectPlaceholder;
14
- //# sourceMappingURL=SelectPlaceholder.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectPlaceholder.cjs","sources":["../../../../../packages/react-select/src/components/SelectPlaceholder.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useSelectCurrentEntities } from '../contexts'\n\nexport const SelectPlaceholder = ({ children }: { children: ReactNode }) => {\n\tconst hasEntities = useSelectCurrentEntities().length > 0\n\treturn hasEntities ? null : <>{children}</>\n}\n"],"names":["useSelectCurrentEntities","jsxDEV","Fragment","this"],"mappings":";;;;AAGO,MAAM,oBAAoB,CAAC,EAAE,eAAwC;AACrE,QAAA,cAAcA,SAAAA,2BAA2B,SAAS;AACjD,SAAA,cAAc,OAAOC,qCAAAC,cAAAA,UAAA,EAAG,SAAH,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAY,GAAAC,MAAA;AACzC;;"}
@@ -1,14 +0,0 @@
1
- import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
2
- import { useSelectCurrentEntities } from "../contexts.js";
3
- const SelectPlaceholder = ({ children }) => {
4
- const hasEntities = useSelectCurrentEntities().length > 0;
5
- return hasEntities ? null : /* @__PURE__ */ jsxDEV(Fragment, { children }, void 0, false, {
6
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SelectPlaceholder.tsx",
7
- lineNumber: 6,
8
- columnNumber: 30
9
- }, void 0);
10
- };
11
- export {
12
- SelectPlaceholder
13
- };
14
- //# sourceMappingURL=SelectPlaceholder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectPlaceholder.js","sources":["../../../../../packages/react-select/src/components/SelectPlaceholder.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useSelectCurrentEntities } from '../contexts'\n\nexport const SelectPlaceholder = ({ children }: { children: ReactNode }) => {\n\tconst hasEntities = useSelectCurrentEntities().length > 0\n\treturn hasEntities ? null : <>{children}</>\n}\n"],"names":["this"],"mappings":";;AAGO,MAAM,oBAAoB,CAAC,EAAE,eAAwC;AACrE,QAAA,cAAc,2BAA2B,SAAS;AACjD,SAAA,cAAc,OAAO,uBAAA,UAAA,EAAG,SAAH,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAY,GAAAA,MAAA;AACzC;"}
@@ -1,78 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxDevRuntime = require("react/jsx-dev-runtime");
4
- const React = require("react");
5
- const contexts = require("../contexts.cjs");
6
- const reactBinding = require("@contember/react-binding");
7
- const reactUtils = require("@contember/react-utils");
8
- const reactRepeater = require("@contember/react-repeater");
9
- const SortableMultiSelect = reactBinding.Component(({ field, children, sortableBy, connectAt, options, onSelect, onUnselect }) => {
10
- const list = reactBinding.useEntityList({ field });
11
- const entitiesArr = React.useMemo(() => Array.from(list), [list]);
12
- const optionsMarker = React.useMemo(() => {
13
- const desugared = reactBinding.QueryLanguage.desugarRelativeSingleEntity({ field: connectAt }, list.environment);
14
- let marker = list.getMarker();
15
- for (let relation of desugared.hasOneRelationPath) {
16
- const placeholder = reactBinding.PlaceholderGenerator.getHasOneRelationPlaceholder(relation);
17
- const relationMarker = marker.fields.markers.get(placeholder);
18
- if (!relationMarker || relationMarker instanceof reactBinding.FieldMarker) {
19
- throw new Error("Invalid marker");
20
- }
21
- marker = relationMarker;
22
- }
23
- return marker;
24
- }, [connectAt, list]);
25
- options ?? (options = optionsMarker.environment.getSubTreeNode().entity.name);
26
- const selectedEntities = React.useMemo(() => Array.from(list).map((it) => it.getEntity({ field: connectAt }).id), [connectAt, list]);
27
- const handler = reactUtils.useReferentiallyStableCallback((entity, action = "toggle") => {
28
- const isSelected2 = selectedEntities.includes(entity.id);
29
- if (action === "toggle") {
30
- action = isSelected2 ? "unselect" : "select";
31
- }
32
- if (action === "unselect" && isSelected2) {
33
- Array.from(list).find((it) => it.getEntity({ field: connectAt }).id === entity.id)?.deleteEntity();
34
- onUnselect?.(entity);
35
- } else if (action === "select" && !isSelected2) {
36
- list.createNewEntity((getEntity) => {
37
- getEntity().connectEntityAtField({ field: connectAt }, entity);
38
- onSelect?.(entity);
39
- });
40
- }
41
- });
42
- const isSelected = React.useCallback((entity) => {
43
- return selectedEntities.includes(entity.id);
44
- }, [selectedEntities]);
45
- return /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactRepeater.Repeater, { field, sortableBy, initialEntityCount: 0, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(contexts.SelectCurrentEntitiesContext.Provider, { value: entitiesArr, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(contexts.SelectIsSelectedContext.Provider, { value: isSelected, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(contexts.SelectHandleSelectContext.Provider, { value: handler, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(contexts.SelectOptionsContext.Provider, { value: options, children }, void 0, false, {
46
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SortableMultiSelect.tsx",
47
- lineNumber: 78,
48
- columnNumber: 7
49
- }, void 0) }, void 0, false, {
50
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SortableMultiSelect.tsx",
51
- lineNumber: 77,
52
- columnNumber: 6
53
- }, void 0) }, void 0, false, {
54
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SortableMultiSelect.tsx",
55
- lineNumber: 76,
56
- columnNumber: 5
57
- }, void 0) }, void 0, false, {
58
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SortableMultiSelect.tsx",
59
- lineNumber: 75,
60
- columnNumber: 4
61
- }, void 0) }, void 0, false, {
62
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SortableMultiSelect.tsx",
63
- lineNumber: 74,
64
- columnNumber: 3
65
- }, void 0);
66
- }, ({ children, field, sortableBy, connectAt }) => {
67
- return /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactRepeater.Repeater, { field, sortableBy, initialEntityCount: 0, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactBinding.HasOne, { field: connectAt, expectedMutation: "connectOrDisconnect", children }, void 0, false, {
68
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SortableMultiSelect.tsx",
69
- lineNumber: 89,
70
- columnNumber: 4
71
- }, void 0) }, void 0, false, {
72
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SortableMultiSelect.tsx",
73
- lineNumber: 88,
74
- columnNumber: 3
75
- }, void 0);
76
- });
77
- exports.SortableMultiSelect = SortableMultiSelect;
78
- //# sourceMappingURL=SortableMultiSelect.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SortableMultiSelect.cjs","sources":["../../../../../packages/react-select/src/components/SortableMultiSelect.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo } from 'react'\nimport { SelectCurrentEntitiesContext, SelectHandler, SelectHandleSelectContext, SelectIsSelectedContext, SelectOptionsContext } from '../contexts'\nimport {\n\tComponent,\n\tEntityAccessor,\n\tFieldMarker,\n\tHasOne,\n\tMeaningfulMarker,\n\tPlaceholderGenerator,\n\tQueryLanguage,\n\tSugaredQualifiedEntityList,\n\tSugaredRelativeEntityList,\n\tSugaredRelativeSingleEntity,\n\tSugaredRelativeSingleField,\n\tuseEntityList,\n} from '@contember/react-binding'\nimport { useReferentiallyStableCallback } from '@contember/react-utils'\nimport { Repeater } from '@contember/react-repeater'\nimport { SelectEvents } from '../types'\n\nexport type SortableMultiSelectProps =\n\t& {\n\t\tchildren: ReactNode\n\t\tfield: SugaredRelativeEntityList['field']\n\t\toptions?: SugaredQualifiedEntityList['entities']\n\t\tsortableBy: SugaredRelativeSingleField['field']\n\t\tconnectAt: SugaredRelativeSingleEntity['field']\n\t}\n\t& SelectEvents\n\nexport const SortableMultiSelect = Component(({ field, children, sortableBy, connectAt, options, onSelect, onUnselect }: SortableMultiSelectProps) => {\n\tconst list = useEntityList({ field })\n\tconst entitiesArr = useMemo(() => Array.from(list), [list])\n\n\tconst optionsMarker = useMemo(() => {\n\t\tconst desugared = QueryLanguage.desugarRelativeSingleEntity({ field: connectAt }, list.environment)\n\t\tlet marker: Exclude<MeaningfulMarker, FieldMarker> = list.getMarker()\n\t\tfor (let relation of desugared.hasOneRelationPath) {\n\t\t\tconst placeholder = PlaceholderGenerator.getHasOneRelationPlaceholder(relation)\n\t\t\tconst relationMarker = marker.fields.markers.get(placeholder)\n\t\t\tif (!relationMarker || relationMarker instanceof FieldMarker) {\n\t\t\t\tthrow new Error('Invalid marker')\n\t\t\t}\n\t\t\tmarker = relationMarker\n\t\t}\n\t\treturn marker\n\t}, [connectAt, list])\n\n\toptions ??= optionsMarker.environment.getSubTreeNode().entity.name\n\n\n\tconst selectedEntities = useMemo(() => Array.from(list).map(it => it.getEntity({ field: connectAt }).id), [connectAt, list])\n\n\tconst handler = useReferentiallyStableCallback<SelectHandler>((entity, action = 'toggle') => {\n\t\tconst isSelected = selectedEntities.includes(entity.id)\n\t\tif (action === 'toggle') {\n\t\t\taction = isSelected ? 'unselect' : 'select'\n\t\t}\n\t\tif (action === 'unselect' && isSelected) {\n\t\t\tArray.from(list).find(it => it.getEntity({ field: connectAt }).id === entity.id)?.deleteEntity()\n\t\t\tonUnselect?.(entity)\n\t\t} else if (action === 'select' && !isSelected) {\n\t\t\tlist.createNewEntity(getEntity => {\n\t\t\t\tgetEntity().connectEntityAtField({ field: connectAt }, entity)\n\t\t\t\tonSelect?.(entity)\n\t\t\t})\n\t\t}\n\t})\n\tconst isSelected = useCallback((entity: EntityAccessor) => {\n\t\treturn selectedEntities.includes(entity.id)\n\t}, [selectedEntities])\n\n\treturn (\n\t\t<Repeater field={field} sortableBy={sortableBy} initialEntityCount={0}>\n\t\t\t<SelectCurrentEntitiesContext.Provider value={entitiesArr}>\n\t\t\t\t<SelectIsSelectedContext.Provider value={isSelected}>\n\t\t\t\t\t<SelectHandleSelectContext.Provider value={handler}>\n\t\t\t\t\t\t<SelectOptionsContext.Provider value={options}>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</SelectOptionsContext.Provider>\n\t\t\t\t\t</SelectHandleSelectContext.Provider>\n\t\t\t\t</SelectIsSelectedContext.Provider>\n\t\t\t</SelectCurrentEntitiesContext.Provider>\n\t\t</Repeater>\n\t)\n}, ({ children, field, sortableBy, connectAt }) => {\n\treturn (\n\t\t<Repeater field={field} sortableBy={sortableBy} initialEntityCount={0}>\n\t\t\t<HasOne field={connectAt} expectedMutation=\"connectOrDisconnect\">\n\t\t\t\t{children}\n\t\t\t</HasOne>\n\t\t</Repeater>\n\t)\n})\n\n"],"names":["Component","useEntityList","useMemo","QueryLanguage","PlaceholderGenerator","FieldMarker","useReferentiallyStableCallback","isS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E,UAAU,OAAO,YAAY,gBAAgB;AAClD,SACEN,8BAAA,OAAAC,cAAA,UAAA,EAAS,OAAc,YAAwB,oBAAoB,GACnE,UAACD,8BAAA,OAAAO,aAAA,QAAA,EAAO,OAAO,WAAW,kBAAiB,uBACzC,YADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAD,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAIA,GAAAA,MAAA;AAEF,CAAC;;"}
@@ -1,78 +0,0 @@
1
- import { jsxDEV } from "react/jsx-dev-runtime";
2
- import { useMemo, useCallback } from "react";
3
- import { SelectCurrentEntitiesContext, SelectIsSelectedContext, SelectHandleSelectContext, SelectOptionsContext } from "../contexts.js";
4
- import { Component, useEntityList, QueryLanguage, PlaceholderGenerator, FieldMarker, HasOne } from "@contember/react-binding";
5
- import { useReferentiallyStableCallback } from "@contember/react-utils";
6
- import { Repeater } from "@contember/react-repeater";
7
- const SortableMultiSelect = Component(({ field, children, sortableBy, connectAt, options, onSelect, onUnselect }) => {
8
- const list = useEntityList({ field });
9
- const entitiesArr = useMemo(() => Array.from(list), [list]);
10
- const optionsMarker = useMemo(() => {
11
- const desugared = QueryLanguage.desugarRelativeSingleEntity({ field: connectAt }, list.environment);
12
- let marker = list.getMarker();
13
- for (let relation of desugared.hasOneRelationPath) {
14
- const placeholder = PlaceholderGenerator.getHasOneRelationPlaceholder(relation);
15
- const relationMarker = marker.fields.markers.get(placeholder);
16
- if (!relationMarker || relationMarker instanceof FieldMarker) {
17
- throw new Error("Invalid marker");
18
- }
19
- marker = relationMarker;
20
- }
21
- return marker;
22
- }, [connectAt, list]);
23
- options ?? (options = optionsMarker.environment.getSubTreeNode().entity.name);
24
- const selectedEntities = useMemo(() => Array.from(list).map((it) => it.getEntity({ field: connectAt }).id), [connectAt, list]);
25
- const handler = useReferentiallyStableCallback((entity, action = "toggle") => {
26
- const isSelected2 = selectedEntities.includes(entity.id);
27
- if (action === "toggle") {
28
- action = isSelected2 ? "unselect" : "select";
29
- }
30
- if (action === "unselect" && isSelected2) {
31
- Array.from(list).find((it) => it.getEntity({ field: connectAt }).id === entity.id)?.deleteEntity();
32
- onUnselect?.(entity);
33
- } else if (action === "select" && !isSelected2) {
34
- list.createNewEntity((getEntity) => {
35
- getEntity().connectEntityAtField({ field: connectAt }, entity);
36
- onSelect?.(entity);
37
- });
38
- }
39
- });
40
- const isSelected = useCallback((entity) => {
41
- return selectedEntities.includes(entity.id);
42
- }, [selectedEntities]);
43
- return /* @__PURE__ */ jsxDEV(Repeater, { field, sortableBy, initialEntityCount: 0, children: /* @__PURE__ */ jsxDEV(SelectCurrentEntitiesContext.Provider, { value: entitiesArr, children: /* @__PURE__ */ jsxDEV(SelectIsSelectedContext.Provider, { value: isSelected, children: /* @__PURE__ */ jsxDEV(SelectHandleSelectContext.Provider, { value: handler, children: /* @__PURE__ */ jsxDEV(SelectOptionsContext.Provider, { value: options, children }, void 0, false, {
44
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SortableMultiSelect.tsx",
45
- lineNumber: 78,
46
- columnNumber: 7
47
- }, void 0) }, void 0, false, {
48
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SortableMultiSelect.tsx",
49
- lineNumber: 77,
50
- columnNumber: 6
51
- }, void 0) }, void 0, false, {
52
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SortableMultiSelect.tsx",
53
- lineNumber: 76,
54
- columnNumber: 5
55
- }, void 0) }, void 0, false, {
56
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SortableMultiSelect.tsx",
57
- lineNumber: 75,
58
- columnNumber: 4
59
- }, void 0) }, void 0, false, {
60
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SortableMultiSelect.tsx",
61
- lineNumber: 74,
62
- columnNumber: 3
63
- }, void 0);
64
- }, ({ children, field, sortableBy, connectAt }) => {
65
- return /* @__PURE__ */ jsxDEV(Repeater, { field, sortableBy, initialEntityCount: 0, children: /* @__PURE__ */ jsxDEV(HasOne, { field: connectAt, expectedMutation: "connectOrDisconnect", children }, void 0, false, {
66
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SortableMultiSelect.tsx",
67
- lineNumber: 89,
68
- columnNumber: 4
69
- }, void 0) }, void 0, false, {
70
- fileName: "/home/runner/work/contember/contember/packages/react-select/src/components/SortableMultiSelect.tsx",
71
- lineNumber: 88,
72
- columnNumber: 3
73
- }, void 0);
74
- });
75
- export {
76
- SortableMultiSelect
77
- };
78
- //# sourceMappingURL=SortableMultiSelect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SortableMultiSelect.js","sources":["../../../../../packages/react-select/src/components/SortableMultiSelect.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo } from 'react'\nimport { SelectCurrentEntitiesContext, SelectHandler, SelectHandleSelectContext, SelectIsSelectedContext, SelectOptionsContext } from '../contexts'\nimport {\n\tComponent,\n\tEntityAccessor,\n\tFieldMarker,\n\tHasOne,\n\tMeaningfulMarker,\n\tPlaceholderGenerator,\n\tQueryLanguage,\n\tSugaredQualifiedEntityList,\n\tSugaredRelativeEntityList,\n\tSugaredRelativeSingleEntity,\n\tSugaredRelativeSingleField,\n\tuseEntityList,\n} from '@contember/react-binding'\nimport { useReferentiallyStableCallback } from '@contember/react-utils'\nimport { Repeater } from '@contember/react-repeater'\nimport { SelectEvents } from '../types'\n\nexport type SortableMultiSelectProps =\n\t& {\n\t\tchildren: ReactNode\n\t\tfield: SugaredRelativeEntityList['field']\n\t\toptions?: SugaredQualifiedEntityList['entities']\n\t\tsortableBy: SugaredRelativeSingleField['field']\n\t\tconnectAt: SugaredRelativeSingleEntity['field']\n\t}\n\t& SelectEvents\n\nexport const SortableMultiSelect = Component(({ field, children, sortableBy, connectAt, options, onSelect, onUnselect }: SortableMultiSelectProps) => {\n\tconst list = useEntityList({ field })\n\tconst entitiesArr = useMemo(() => Array.from(list), [list])\n\n\tconst optionsMarker = useMemo(() => {\n\t\tconst desugared = QueryLanguage.desugarRelativeSingleEntity({ field: connectAt }, list.environment)\n\t\tlet marker: Exclude<MeaningfulMarker, FieldMarker> = list.getMarker()\n\t\tfor (let relation of desugared.hasOneRelationPath) {\n\t\t\tconst placeholder = PlaceholderGenerator.getHasOneRelationPlaceholder(relation)\n\t\t\tconst relationMarker = marker.fields.markers.get(placeholder)\n\t\t\tif (!relationMarker || relationMarker instanceof FieldMarker) {\n\t\t\t\tthrow new Error('Invalid marker')\n\t\t\t}\n\t\t\tmarker = relationMarker\n\t\t}\n\t\treturn marker\n\t}, [connectAt, list])\n\n\toptions ??= optionsMarker.environment.getSubTreeNode().entity.name\n\n\n\tconst selectedEntities = useMemo(() => Array.from(list).map(it => it.getEntity({ field: connectAt }).id), [connectAt, list])\n\n\tconst handler = useReferentiallyStableCallback<SelectHandler>((entity, action = 'toggle') => {\n\t\tconst isSelected = selectedEntities.includes(entity.id)\n\t\tif (action === 'toggle') {\n\t\t\taction = isSelected ? 'unselect' : 'select'\n\t\t}\n\t\tif (action === 'unselect' && isSelected) {\n\t\t\tArray.from(list).find(it => it.getEntity({ field: connectAt }).id === entity.id)?.deleteEntity()\n\t\t\tonUnselect?.(entity)\n\t\t} else if (action === 'select' && !isSelected) {\n\t\t\tlist.createNewEntity(getEntity => {\n\t\t\t\tgetEntity().connectEntityAtField({ field: connectAt }, entity)\n\t\t\t\tonSelect?.(entity)\n\t\t\t})\n\t\t}\n\t})\n\tconst isSelected = useCallback((entity: EntityAccessor) => {\n\t\treturn selectedEntities.includes(entity.id)\n\t}, [selectedEntities])\n\n\treturn (\n\t\t<Repeater field={field} sortableBy={sortableBy} initialEntityCount={0}>\n\t\t\t<SelectCurrentEntitiesContext.Provider value={entitiesArr}>\n\t\t\t\t<SelectIsSelectedContext.Provider value={isSelected}>\n\t\t\t\t\t<SelectHandleSelectContext.Provider value={handler}>\n\t\t\t\t\t\t<SelectOptionsContext.Provider value={options}>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</SelectOptionsContext.Provider>\n\t\t\t\t\t</SelectHandleSelectContext.Provider>\n\t\t\t\t</SelectIsSelectedContext.Provider>\n\t\t\t</SelectCurrentEntitiesContext.Provider>\n\t\t</Repeater>\n\t)\n}, ({ children, field, sortableBy, connectAt }) => {\n\treturn (\n\t\t<Repeater field={field} sortableBy={sortableBy} initialEntityCount={0}>\n\t\t\t<HasOne field={connectAt} expectedMutation=\"connectOrDisconnect\">\n\t\t\t\t{children}\n\t\t\t</HasOne>\n\t\t</Repeater>\n\t)\n})\n\n"],"names":["isSelected","this"],"mappings":";;;;;;AA8Ba,MAAA,sBAAsB,UAAU,CAAC,EAAE,OAAO,UAAU,YAAY,WAAW,SAAS,UAAU,iBAA2C;AACrJ,QAAM,OAAO,cAAc,EAAE,OAAO;AAC9B,QAAA,cAAc,QAAQ,MAAM,MAAM,KAAK,IAAI,GAAG,CAAC,IAAI,CAAC;AAEpD,QAAA,gBAAgB,QAAQ,MAAM;AAC7B,UAAA,YAAY,cAAc,4BAA4B,EAAE,OAAO,UAAU,GAAG,KAAK,WAAW;AAC9F,QAAA,SAAiD,KAAK,UAAU;AAC3D,aAAA,YAAY,UAAU,oBAAoB;AAC5C,YAAA,cAAc,qBAAqB,6BAA6B,QAAQ;AAC9E,YAAM,iBAAiB,OAAO,OAAO,QAAQ,IAAI,WAAW;AACxD,UAAA,CAAC,kBAAkB,0BAA0B,aAAa;AACvD,cAAA,IAAI,MAAM,gBAAgB;AAAA,MAAA;AAExB,eAAA;AAAA,IAAA;AAEH,WAAA;AAAA,EAAA,GACL,CAAC,WAAW,IAAI,CAAC;AAEpB,cAAA,UAAY,cAAc,YAAY,eAAe,EAAE,OAAO;AAGxD,QAAA,mBAAmB,QAAQ,MAAM,MAAM,KAAK,IAAI,EAAE,IAAI,CAAM,OAAA,GAAG,UAAU,EAAE,OAAO,UAAW,CAAA,EAAE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