@zayne-labs/ui-react 0.9.15 → 0.9.17

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 (138) hide show
  1. package/dist/esm/await-Fe4LFRKd.js +89 -0
  2. package/dist/esm/await-Fe4LFRKd.js.map +1 -0
  3. package/dist/esm/card-DRjs-vtv.js +54 -0
  4. package/dist/esm/card-DRjs-vtv.js.map +1 -0
  5. package/dist/esm/carousel-Dznupnx8.js +270 -0
  6. package/dist/esm/carousel-Dznupnx8.js.map +1 -0
  7. package/dist/esm/chunk-Cl8Af3a2.js +11 -0
  8. package/dist/esm/cn-_FbtIrlZ.js +8 -0
  9. package/dist/esm/cn-_FbtIrlZ.js.map +1 -0
  10. package/dist/esm/common-BYWy8Q78.js +0 -0
  11. package/dist/esm/components/common/await/index.d.ts +6 -14
  12. package/dist/esm/components/common/await/index.js +10 -8
  13. package/dist/esm/components/common/error-boundary/index.d.ts +2 -17
  14. package/dist/esm/components/common/error-boundary/index.js +6 -4
  15. package/dist/esm/components/common/for/index.d.ts +2 -10
  16. package/dist/esm/components/common/for/index.js +3 -4
  17. package/dist/esm/components/common/index.d.ts +11 -13
  18. package/dist/esm/components/common/index.js +13 -14
  19. package/dist/esm/components/common/show/index.d.ts +2 -26
  20. package/dist/esm/components/common/show/index.js +7 -5
  21. package/dist/esm/components/common/slot/index.d.ts +2 -12
  22. package/dist/esm/components/common/slot/index.js +3 -4
  23. package/dist/esm/components/common/suspense-with-boundary/index.d.ts +3 -11
  24. package/dist/esm/components/common/suspense-with-boundary/index.js +4 -5
  25. package/dist/esm/components/common/switch/index.d.ts +2 -25
  26. package/dist/esm/components/common/switch/index.js +7 -5
  27. package/dist/esm/components/common/teleport/index.d.ts +2 -12
  28. package/dist/esm/components/common/teleport/index.js +3 -4
  29. package/dist/esm/components/ui/card/index.d.ts +2 -17
  30. package/dist/esm/components/ui/card/index.js +5 -6
  31. package/dist/esm/components/ui/carousel/index.d.ts +2 -95
  32. package/dist/esm/components/ui/carousel/index.js +18 -16
  33. package/dist/esm/components/ui/drag-scroll/index.d.ts +2 -21
  34. package/dist/esm/components/ui/drag-scroll/index.js +4 -5
  35. package/dist/esm/components/ui/drop-zone/index.d.ts +3 -11
  36. package/dist/esm/components/ui/drop-zone/index.js +18 -16
  37. package/dist/esm/components/ui/form/index.d.ts +2 -228
  38. package/dist/esm/components/ui/form/index.js +10 -8
  39. package/dist/esm/components/ui/index.d.ts +7 -11
  40. package/dist/esm/components/ui/index.js +19 -20
  41. package/dist/esm/drag-scroll-BLjij7aI.js +111 -0
  42. package/dist/esm/drag-scroll-BLjij7aI.js.map +1 -0
  43. package/dist/esm/drop-zone-_YK9C3Xj.js +313 -0
  44. package/dist/esm/drop-zone-_YK9C3Xj.js.map +1 -0
  45. package/dist/esm/error-boundary-B3ycUZ1t.js +126 -0
  46. package/dist/esm/error-boundary-B3ycUZ1t.js.map +1 -0
  47. package/dist/esm/for-aTw1TgJo.js +42 -0
  48. package/dist/esm/for-aTw1TgJo.js.map +1 -0
  49. package/dist/esm/form-DytCfL6R.js +590 -0
  50. package/dist/esm/form-DytCfL6R.js.map +1 -0
  51. package/dist/esm/getSlot-BIcGgBwN.js +85 -0
  52. package/dist/esm/getSlot-BIcGgBwN.js.map +1 -0
  53. package/dist/esm/{getSlotMap-DTkxtGhd.d.ts → getSlotMap-DA_uhXqU.d.ts} +17 -16
  54. package/dist/esm/index--1COprHP.d.ts +32 -0
  55. package/dist/esm/index-1UCPJf7B.d.ts +19 -0
  56. package/dist/esm/index-BC0r1cBF.d.ts +104 -0
  57. package/dist/esm/index-BPeZJS-v.d.ts +191 -0
  58. package/dist/esm/index-BSJ30pGj.d.ts +68 -0
  59. package/dist/esm/{for-BH5FhFuV.d.ts → index-BhpBx8dH.d.ts} +14 -6
  60. package/dist/esm/index-BuSQsDCX.d.ts +22 -0
  61. package/dist/esm/index-C0XZoIZD.d.ts +35 -0
  62. package/dist/esm/index-C4ub0yqe.d.ts +49 -0
  63. package/dist/esm/index-CTZr4PTO.d.ts +24 -0
  64. package/dist/esm/index-DKfm0Dyj.d.ts +61 -0
  65. package/dist/esm/index-DQ1yFGd2.d.ts +229 -0
  66. package/dist/esm/index-DmOz1yDZ.d.ts +14 -0
  67. package/dist/esm/index-DnaUCh8d.d.ts +15 -0
  68. package/dist/esm/lib/utils/index.d.ts +3 -61
  69. package/dist/esm/lib/utils/index.js +4 -5
  70. package/dist/esm/show-BgYrfIxJ.js +41 -0
  71. package/dist/esm/show-BgYrfIxJ.js.map +1 -0
  72. package/dist/esm/slot-RXTKo4L7.js +58 -0
  73. package/dist/esm/slot-RXTKo4L7.js.map +1 -0
  74. package/dist/esm/suspense-with-boundary-TrQxYRG6.js +21 -0
  75. package/dist/esm/suspense-with-boundary-TrQxYRG6.js.map +1 -0
  76. package/dist/esm/switch-PF5xTJfr.js +42 -0
  77. package/dist/esm/switch-PF5xTJfr.js.map +1 -0
  78. package/dist/esm/teleport-dlSjWj_t.js +32 -0
  79. package/dist/esm/teleport-dlSjWj_t.js.map +1 -0
  80. package/dist/esm/utils-D4YNWj2X.js +89 -0
  81. package/dist/esm/utils-D4YNWj2X.js.map +1 -0
  82. package/package.json +5 -5
  83. package/dist/esm/await-parts-BJ6C-y1f.d.ts +0 -36
  84. package/dist/esm/chunk-2DHK7TOF.js +0 -336
  85. package/dist/esm/chunk-2DHK7TOF.js.map +0 -1
  86. package/dist/esm/chunk-3KZXPREF.js +0 -626
  87. package/dist/esm/chunk-3KZXPREF.js.map +0 -1
  88. package/dist/esm/chunk-BJ7WR4XW.js +0 -274
  89. package/dist/esm/chunk-BJ7WR4XW.js.map +0 -1
  90. package/dist/esm/chunk-CWUEUCR5.js +0 -3
  91. package/dist/esm/chunk-CWUEUCR5.js.map +0 -1
  92. package/dist/esm/chunk-EYWTW54R.js +0 -42
  93. package/dist/esm/chunk-EYWTW54R.js.map +0 -1
  94. package/dist/esm/chunk-G5BNZM66.js +0 -32
  95. package/dist/esm/chunk-G5BNZM66.js.map +0 -1
  96. package/dist/esm/chunk-JC52CA2O.js +0 -113
  97. package/dist/esm/chunk-JC52CA2O.js.map +0 -1
  98. package/dist/esm/chunk-KLEJZWKY.js +0 -45
  99. package/dist/esm/chunk-KLEJZWKY.js.map +0 -1
  100. package/dist/esm/chunk-M7YXNGT6.js +0 -48
  101. package/dist/esm/chunk-M7YXNGT6.js.map +0 -1
  102. package/dist/esm/chunk-MT2MQDK2.js +0 -13
  103. package/dist/esm/chunk-MT2MQDK2.js.map +0 -1
  104. package/dist/esm/chunk-N4274N5K.js +0 -50
  105. package/dist/esm/chunk-N4274N5K.js.map +0 -1
  106. package/dist/esm/chunk-NXZZXJRH.js +0 -41
  107. package/dist/esm/chunk-NXZZXJRH.js.map +0 -1
  108. package/dist/esm/chunk-OHG7GB7O.js +0 -8
  109. package/dist/esm/chunk-OHG7GB7O.js.map +0 -1
  110. package/dist/esm/chunk-PZ5AY32C.js +0 -9
  111. package/dist/esm/chunk-PZ5AY32C.js.map +0 -1
  112. package/dist/esm/chunk-V5ZPMMIH.js +0 -121
  113. package/dist/esm/chunk-V5ZPMMIH.js.map +0 -1
  114. package/dist/esm/chunk-Y5VBSXZS.js +0 -55
  115. package/dist/esm/chunk-Y5VBSXZS.js.map +0 -1
  116. package/dist/esm/chunk-YO5LJ7ZJ.js +0 -74
  117. package/dist/esm/chunk-YO5LJ7ZJ.js.map +0 -1
  118. package/dist/esm/chunk-Z6JJE4G6.js +0 -68
  119. package/dist/esm/chunk-Z6JJE4G6.js.map +0 -1
  120. package/dist/esm/components/common/await/index.js.map +0 -1
  121. package/dist/esm/components/common/error-boundary/index.js.map +0 -1
  122. package/dist/esm/components/common/for/index.js.map +0 -1
  123. package/dist/esm/components/common/index.js.map +0 -1
  124. package/dist/esm/components/common/show/index.js.map +0 -1
  125. package/dist/esm/components/common/slot/index.js.map +0 -1
  126. package/dist/esm/components/common/suspense-with-boundary/index.js.map +0 -1
  127. package/dist/esm/components/common/switch/index.js.map +0 -1
  128. package/dist/esm/components/common/teleport/index.js.map +0 -1
  129. package/dist/esm/components/ui/card/index.js.map +0 -1
  130. package/dist/esm/components/ui/carousel/index.js.map +0 -1
  131. package/dist/esm/components/ui/drag-scroll/index.js.map +0 -1
  132. package/dist/esm/components/ui/drop-zone/index.js.map +0 -1
  133. package/dist/esm/components/ui/form/index.js.map +0 -1
  134. package/dist/esm/components/ui/index.js.map +0 -1
  135. package/dist/esm/drop-zone-parts-CvseSoXA.d.ts +0 -186
  136. package/dist/esm/error-boundary-BD0X61Sg.d.ts +0 -28
  137. package/dist/esm/lib/utils/index.js.map +0 -1
  138. package/dist/esm/types-mdfDDNrr.d.ts +0 -25
@@ -1,74 +0,0 @@
1
- import { toArray } from '@zayne-labs/toolkit-core';
2
- import { isFunction, isArray, AssertionError } from '@zayne-labs/toolkit-type-helpers';
3
- import { isValidElement, Fragment } from 'react';
4
-
5
- // src/lib/utils/getSlot/getSlot.ts
6
- var isWithSlotSymbol = (component) => {
7
- return "slotSymbol" in component && Boolean(component.slotSymbol);
8
- };
9
- var isWithSlotReference = (component) => {
10
- return "slotReference" in component && Boolean(component.slotReference);
11
- };
12
- var matchesSlotComponent = (child, SlotComponent) => {
13
- if (!isValidElement(child) || !isFunction(child.type)) {
14
- return false;
15
- }
16
- const resolvedChildType = isWithSlotReference(child.type) ? child.type.slotReference : child.type;
17
- const hasMatchingSlotSymbol = isWithSlotSymbol(resolvedChildType) && isWithSlotSymbol(SlotComponent) && resolvedChildType.slotSymbol === SlotComponent.slotSymbol;
18
- if (hasMatchingSlotSymbol) {
19
- return true;
20
- }
21
- if (child.type.name === SlotComponent.name) {
22
- return true;
23
- }
24
- return false;
25
- };
26
- var matchesAnySlotComponent = (child, SlotComponents) => {
27
- const matchesSlot = SlotComponents.some((SlotComponent) => matchesSlotComponent(child, SlotComponent));
28
- return matchesSlot;
29
- };
30
- var calculateSlotOccurrences = (childrenArray, SlotComponent) => {
31
- let count = 0;
32
- for (const child of childrenArray) {
33
- if (!matchesSlotComponent(child, SlotComponent)) continue;
34
- count += 1;
35
- }
36
- return count;
37
- };
38
- var getSingleSlot = (children, SlotComponent, options = {}) => {
39
- const {
40
- errorMessage = "Only one instance of the SlotComponent is allowed",
41
- throwOnMultipleSlotMatch = false
42
- } = options;
43
- const actualChildren = isValidElement(children) && children.type === Fragment ? children.props.children : children;
44
- const childrenArray = toArray(actualChildren);
45
- const shouldThrow = throwOnMultipleSlotMatch && calculateSlotOccurrences(childrenArray, SlotComponent) > 1;
46
- if (shouldThrow) {
47
- throw new AssertionError(errorMessage);
48
- }
49
- const slotElement = childrenArray.find((child) => matchesSlotComponent(child, SlotComponent));
50
- return slotElement;
51
- };
52
- var getMultipleSlots = (children, SlotComponents, options) => {
53
- const { errorMessage, throwOnMultipleSlotMatch } = options ?? {};
54
- const slots = SlotComponents.map(
55
- (SlotComponent, index) => getSingleSlot(children, SlotComponent, {
56
- errorMessage: isArray(errorMessage) ? errorMessage[index] : errorMessage,
57
- throwOnMultipleSlotMatch: isArray(throwOnMultipleSlotMatch) ? throwOnMultipleSlotMatch[index] : throwOnMultipleSlotMatch
58
- })
59
- );
60
- const regularChildren = getRegularChildren(children, SlotComponents);
61
- return { regularChildren, slots };
62
- };
63
- var getRegularChildren = (children, SlotComponentOrComponents) => {
64
- const actualChildren = isValidElement(children) && children.type === Fragment ? children.props.children : children;
65
- const childrenArray = toArray(actualChildren);
66
- const regularChildren = childrenArray.filter(
67
- (child) => !matchesAnySlotComponent(child, toArray(SlotComponentOrComponents))
68
- );
69
- return regularChildren;
70
- };
71
-
72
- export { getMultipleSlots, getRegularChildren, getSingleSlot, matchesAnySlotComponent, matchesSlotComponent };
73
- //# sourceMappingURL=chunk-YO5LJ7ZJ.js.map
74
- //# sourceMappingURL=chunk-YO5LJ7ZJ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/lib/utils/getSlot/getSlot.ts"],"names":["ReactFragment"],"mappings":";;;;;AAcA,IAAM,gBAAA,GAAmB,CAC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A,GACF;AAEA,EAAM,MAAA,eAAA,GAAkB,kBAAmB,CAAA,QAAA,EAAU,cAAc,CAAA;AAEnE,EAAO,OAAA,EAAE,iBAAiB,KAAM,EAAA;AACjC;AAKa,IAAA,kBAAA,GAAqB,CACjC,QAAA,EACA,yBACI,KAAA;AACJ,EAAM,MAAA,cAAA,GACL,eAAiD,QAAQ,CAAA,IAAK,SAAS,IAAS,KAAAA,QAAA,GAC7E,QAAS,CAAA,KAAA,CAAM,QACf,GAAA,QAAA;AAEJ,EAAM,MAAA,aAAA,GAAgB,QAAyB,cAAc,CAAA;AAE7D,EAAA,MAAM,kBAAkB,aAAc,CAAA,MAAA;AAAA,IACrC,CAAC,KAAU,KAAA,CAAC,wBAAwB,KAAO,EAAA,OAAA,CAAQ,yBAAyB,CAAC;AAAA,GAC9E;AAEA,EAAO,OAAA,eAAA;AACR","file":"chunk-YO5LJ7ZJ.js","sourcesContent":["import { toArray } from \"@zayne-labs/toolkit-core\";\nimport type { InferProps } from \"@zayne-labs/toolkit-react/utils\";\nimport {\n\ttype AnyFunction,\n\tAssertionError,\n\ttype Prettify,\n\ttype UnknownObject,\n\tisArray,\n\tisFunction,\n} from \"@zayne-labs/toolkit-type-helpers\";\nimport { Fragment as ReactFragment, isValidElement } from \"react\";\n\nexport type FunctionalComponent<TProps extends UnknownObject = never> = React.FunctionComponent<TProps>;\n\nconst isWithSlotSymbol = <TFunction extends AnyFunction>(\n\tcomponent: TFunction\n): component is Record<\"slotSymbol\", unknown> & TFunction => {\n\treturn \"slotSymbol\" in component && Boolean(component.slotSymbol);\n};\n\nconst isWithSlotReference = <TFunction extends AnyFunction>(\n\tcomponent: TFunction\n): component is Record<\"slotReference\", unknown> & TFunction => {\n\treturn \"slotReference\" in component && Boolean(component.slotReference);\n};\n/**\n * @description Checks if a react child (within the children array) matches the provided SlotComponent using multiple matching strategies:\n * 1. Matches by slot symbol property\n * 2. Matches by component name\n */\n\nexport const matchesSlotComponent = (child: React.ReactNode, SlotComponent: FunctionalComponent) => {\n\tif (!isValidElement(child) || !isFunction(child.type)) {\n\t\treturn false;\n\t}\n\n\tconst resolvedChildType = isWithSlotReference(child.type)\n\t\t? (child.type.slotReference as FunctionalComponent)\n\t\t: child.type;\n\n\tconst hasMatchingSlotSymbol =\n\t\tisWithSlotSymbol(resolvedChildType)\n\t\t&& isWithSlotSymbol(SlotComponent)\n\t\t&& resolvedChildType.slotSymbol === SlotComponent.slotSymbol;\n\n\tif (hasMatchingSlotSymbol) {\n\t\treturn true;\n\t}\n\n\tif (child.type.name === SlotComponent.name) {\n\t\treturn true;\n\t}\n\n\treturn false;\n};\n\n/**\n * @description Checks if a react child (within the children array) matches any of the provided SlotComponents.\n */\nexport const matchesAnySlotComponent = (child: React.ReactNode, SlotComponents: FunctionalComponent[]) => {\n\tconst matchesSlot = SlotComponents.some((SlotComponent) => matchesSlotComponent(child, SlotComponent));\n\n\treturn matchesSlot;\n};\n\ntype SlotOptions = {\n\t/**\n\t * @description The error message to throw when multiple slots are found for a given slot component\n\t */\n\terrorMessage?: string;\n\t/**\n\t * @description When true, an AssertionError will be thrown if multiple slots are found for a given slot component\n\t */\n\tthrowOnMultipleSlotMatch?: boolean;\n};\n\n/**\n * @description Counts how many times a given slot component appears in an array of children\n * @internal\n */\nconst calculateSlotOccurrences = (\n\tchildrenArray: React.ReactNode[],\n\tSlotComponent: FunctionalComponent\n) => {\n\tlet count = 0;\n\n\tfor (const child of childrenArray) {\n\t\tif (!matchesSlotComponent(child, SlotComponent)) continue;\n\n\t\tcount += 1;\n\t}\n\n\treturn count;\n};\n\n/**\n * @description Retrieves a single slot element from a collection of React children that matches the provided SlotComponent component.\n *\n * @throws { AssertionError } when throwOnMultipleSlotMatch is true and multiple slots are found\n */\nexport const getSingleSlot = (\n\tchildren: React.ReactNode,\n\tSlotComponent: FunctionalComponent,\n\toptions: SlotOptions = {}\n) => {\n\tconst {\n\t\terrorMessage = \"Only one instance of the SlotComponent is allowed\",\n\t\tthrowOnMultipleSlotMatch = false,\n\t} = options;\n\n\tconst actualChildren =\n\t\tisValidElement<InferProps<typeof ReactFragment>>(children) && children.type === ReactFragment\n\t\t\t? children.props.children\n\t\t\t: children;\n\n\tconst childrenArray = toArray<React.ReactNode>(actualChildren);\n\n\tconst shouldThrow =\n\t\tthrowOnMultipleSlotMatch && calculateSlotOccurrences(childrenArray, SlotComponent) > 1;\n\n\tif (shouldThrow) {\n\t\tthrow new AssertionError(errorMessage);\n\t}\n\n\tconst slotElement = childrenArray.find((child) => matchesSlotComponent(child, SlotComponent));\n\n\treturn slotElement;\n};\n\n// NOTE - You can imitate const type parameter by extending readonly[] | []\n\ntype MultipleSlotsOptions = {\n\t/**\n\t * @description The error message to throw when multiple slots are found for a given slot component\n\t * If a string is provided, the same message will be used for all slot components\n\t * If an array is provided, each string in the array will be used as the errorMessage for the corresponding slot component\n\t */\n\terrorMessage?: string | string[];\n\t/**\n\t * @description When true, an AssertionError will be thrown if multiple slots are found for a given slot component\n\t * If a boolean is provided, the same value will be used for all slot components\n\t * If an array is provided, each boolean in the array will be used as the throwOnMultipleSlotMatch value for the corresponding slot component\n\t */\n\tthrowOnMultipleSlotMatch?: boolean | boolean[];\n};\n\ntype GetMultipleSlotsResult<TSlotComponents extends FunctionalComponent[]> = {\n\tregularChildren: React.ReactNode[];\n\tslots: { [Key in keyof TSlotComponents]: ReturnType<TSlotComponents[Key]> };\n};\n\n/**\n * @description The same as getSingleSlot, but for multiple slot components\n */\nexport const getMultipleSlots = <const TSlotComponents extends FunctionalComponent[]>(\n\tchildren: React.ReactNode,\n\tSlotComponents: TSlotComponents,\n\toptions?: MultipleSlotsOptions\n): Prettify<GetMultipleSlotsResult<TSlotComponents>> => {\n\tconst { errorMessage, throwOnMultipleSlotMatch } = options ?? {};\n\n\tconst slots = SlotComponents.map((SlotComponent, index) =>\n\t\tgetSingleSlot(children, SlotComponent, {\n\t\t\terrorMessage: isArray(errorMessage) ? errorMessage[index] : errorMessage,\n\t\t\tthrowOnMultipleSlotMatch: isArray(throwOnMultipleSlotMatch)\n\t\t\t\t? throwOnMultipleSlotMatch[index]\n\t\t\t\t: throwOnMultipleSlotMatch,\n\t\t})\n\t);\n\n\tconst regularChildren = getRegularChildren(children, SlotComponents);\n\n\treturn { regularChildren, slots } as GetMultipleSlotsResult<TSlotComponents>;\n};\n\n/**\n * @description Returns all children that are not slot elements (i.e., don't match any of the provided slot components)\n */\nexport const getRegularChildren = (\n\tchildren: React.ReactNode,\n\tSlotComponentOrComponents: FunctionalComponent | FunctionalComponent[]\n) => {\n\tconst actualChildren =\n\t\tisValidElement<InferProps<typeof ReactFragment>>(children) && children.type === ReactFragment\n\t\t\t? children.props.children\n\t\t\t: children;\n\n\tconst childrenArray = toArray<React.ReactNode>(actualChildren);\n\n\tconst regularChildren = childrenArray.filter(\n\t\t(child) => !matchesAnySlotComponent(child, toArray(SlotComponentOrComponents))\n\t);\n\n\treturn regularChildren;\n};\n"]}
@@ -1,68 +0,0 @@
1
- import { withSlotNameAndSymbol, getSlotMap } from './chunk-N4274N5K.js';
2
- import { useErrorBoundaryContext, ErrorBoundary } from './chunk-JC52CA2O.js';
3
- import { slot_parts_exports } from './chunk-Y5VBSXZS.js';
4
- import { __export } from './chunk-PZ5AY32C.js';
5
- import * as React from 'react';
6
- import { Fragment, Suspense, use, useMemo } from 'react';
7
- import { isFunction } from '@zayne-labs/toolkit-type-helpers';
8
- import { createCustomContext } from '@zayne-labs/toolkit-react';
9
-
10
- var [AwaitContextProvider, useAwaitContextImpl] = createCustomContext({
11
- hookName: "useAwaitContext",
12
- name: "AwaitContext",
13
- providerName: "AwaitInner"
14
- });
15
- var useAwaitContext = () => useAwaitContextImpl();
16
-
17
- // src/components/common/await/await.tsx
18
- function AwaitRoot(props) {
19
- const { children, errorFallback, fallback, wrapperVariant = "all", ...restOfProps } = props;
20
- const withErrorBoundary = wrapperVariant === "all" || wrapperVariant === "only-errorBoundary";
21
- const withSuspense = wrapperVariant === "all" || wrapperVariant === "only-suspense";
22
- const WithErrorBoundary = withErrorBoundary ? ErrorBoundary : Fragment;
23
- const WithSuspense = withSuspense ? Suspense : Fragment;
24
- const slots = !isFunction(children) ? getSlotMap(children) : { default: children };
25
- const selectedPendingFallback = slots.pending ?? fallback;
26
- const selectedErrorFallback = slots.error ?? errorFallback;
27
- return /* @__PURE__ */ React.createElement(WithErrorBoundary, { ...Boolean(selectedErrorFallback) && { fallback: selectedErrorFallback } }, /* @__PURE__ */ React.createElement(WithSuspense, { ...Boolean(selectedPendingFallback) && { fallback: selectedPendingFallback } }, /* @__PURE__ */ React.createElement(AwaitRootInner, { ...restOfProps }, slots.default)));
28
- }
29
- function AwaitRootInner(props) {
30
- const { asChild, children, promise } = props;
31
- const result = use(promise);
32
- const resolvedChildren = isFunction(children) ? children(result) : children;
33
- const Component = asChild ? slot_parts_exports.Root : Fragment;
34
- const contextValue = useMemo(() => ({ promise, result }), [promise, result]);
35
- return /* @__PURE__ */ React.createElement(AwaitContextProvider, { value: contextValue }, /* @__PURE__ */ React.createElement(Component, { ...asChild && contextValue }, resolvedChildren));
36
- }
37
- function AwaitSuccess(props) {
38
- if (isFunction(props.children)) {
39
- const { result } = useAwaitContext();
40
- return props.children(result);
41
- }
42
- return props.children;
43
- }
44
- Object.assign(AwaitSuccess, withSlotNameAndSymbol("default"));
45
- var AwaitPending = withSlotNameAndSymbol("pending");
46
- var AwaitError = withSlotNameAndSymbol(
47
- "error",
48
- (props) => {
49
- const { asChild, children } = props;
50
- const errorBoundaryContext = useErrorBoundaryContext();
51
- const Component = asChild ? slot_parts_exports.Root : Fragment;
52
- const resolvedChildren = isFunction(children) ? children(errorBoundaryContext) : children;
53
- return /* @__PURE__ */ React.createElement(Component, { ...asChild && errorBoundaryContext }, resolvedChildren);
54
- }
55
- );
56
-
57
- // src/components/common/await/await-parts.ts
58
- var await_parts_exports = {};
59
- __export(await_parts_exports, {
60
- Error: () => AwaitError,
61
- Pending: () => AwaitPending,
62
- Root: () => AwaitRoot,
63
- Success: () => AwaitSuccess
64
- });
65
-
66
- export { AwaitError, AwaitPending, AwaitRoot, AwaitSuccess, await_parts_exports, useAwaitContext };
67
- //# sourceMappingURL=chunk-Z6JJE4G6.js.map
68
- //# sourceMappingURL=chunk-Z6JJE4G6.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/common/await/await-context.ts","../../src/components/common/await/await.tsx","../../src/components/common/await/await-parts.ts"],"names":["ReactFragment"],"mappings":";;;;;;;;;AAOO,IAAM,CAAC,oBAAA,EAAsB,mBAAmB,CAAA,GAAI,mBAAsC,CAAA;AAAA,EAChG,QAAU,EAAA,iBAAA;AAAA,EACV,IAAM,EAAA,cAAA;AAAA,EACN,YAAc,EAAA;AACf,CAAC,CAAA;AAEY,IAAA,eAAA,GAAkB,MAAc,mBAAoB;;;ACU1D,SAAS,UAAkB,KAA+B,EAAA;AAChE,EAAM,MAAA,EAAE,UAAU,aAAe,EAAA,QAAA,EAAU,iBAAiB,KAAO,EAAA,GAAG,aAAgB,GAAA,KAAA;AAEtF,EAAM,MAAA,iBAAA,GAAoB,cAAmB,KAAA,KAAA,IAAS,cAAmB,KAAA,oBAAA;AACzE,EAAM,MAAA,YAAA,GAAe,cAAmB,KAAA,KAAA,IAAS,cAAmB,KAAA,eAAA;AAEpE,EAAM,MAAA,iBAAA,GAAoB,oBAAoB,aAAgB,GAAAA,QAAA;AAC9D,EAAM,MAAA,YAAA,GAAe,eAAe,QAAW,GAAAA,QAAA;AAE/C,EAAM,MAAA,KAAA,GAAQ,CAAC,UAAA,CAAW,QAAQ,CAAA,GAC/B,WAA+B,QAAQ,CAAA,GACtC,EAAE,OAAA,EAAS,QAAS,EAAA;AAExB,EAAM,MAAA,uBAAA,GAA0B,MAAM,OAAW,IAAA,QAAA;AACjD,EAAM,MAAA,qBAAA,GAAwB,MAAM,KAAS,IAAA,aAAA;AAE7C,EACC,uBAAA,KAAA,CAAA,aAAA,CAAC,iBAAmB,EAAA,EAAA,GAAI,OAAQ,CAAA,qBAAqB,CA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CAAC,CAAA;AAIlE,IAAA,YAAA,GAAe,sBAAyC,SAAS;AAIvE,IAAM,UAAa,GAAA,qBAAA;AAAA,EACzB,OAAA;AAAA,EACA,CAAC,KAAU,KAAA;AACV,IAAM,MAAA,EAAE,OAAS,EAAA,QAAA,EAAa,GAAA,KAAA;AAE9B,IAAA,MAAM,uBAAuB,uBAAwB,EAAA;AAErD,IAAM,MAAA,SAAA,GAAY,OAAU,GAAA,kBAAA,CAAK,IAAO,GAAAA,QAAA;AAExC,IAAA,MAAM,mBAAmB,UAAW,CAAA,QAAQ,CAAI,GAAA,QAAA,CAAS,oBAAoB,CAAI,GAAA,QAAA;AAEjF,IAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,EAAW,GAAI,OAAA,IAAW,wBAAwB,gBAAiB,CAAA;AAAA;AAE7E;;;AC1GA,IAAA,mBAAA,GAAA;AAAA,QAAA,CAAA,mBAAA,EAAA;AAAA,EAAA,KAAA,EAAA,MAAA,UAAA;AAAA,EAAA,OAAA,EAAA,MAAA,YAAA;AAAA,EAAA,IAAA,EAAA,MAAA,SAAA;AAAA,EAAA,OAAA,EAAA,MAAA;AAAA,CAAA,CAAA","file":"chunk-Z6JJE4G6.js","sourcesContent":["import { createCustomContext } from \"@zayne-labs/toolkit-react\";\n\nexport type AwaitContextType<TValue = unknown> = {\n\tpromise: Promise<TValue>;\n\tresult: TValue;\n};\n\nexport const [AwaitContextProvider, useAwaitContextImpl] = createCustomContext<AwaitContextType>({\n\thookName: \"useAwaitContext\",\n\tname: \"AwaitContext\",\n\tproviderName: \"AwaitInner\",\n});\n\nexport const useAwaitContext = <TValue>() => useAwaitContextImpl() as AwaitContextType<TValue>;\n","\"use client\";\n\nimport * as React from \"react\";\n\nimport { type GetSlotComponentProps, getSlotMap, withSlotNameAndSymbol } from \"@/lib/utils\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport { Fragment as ReactFragment, Suspense, use, useMemo } from \"react\";\nimport { ErrorBoundary, type ErrorBoundaryProps, useErrorBoundaryContext } from \"../error-boundary\";\nimport { Slot } from \"../slot\";\nimport type { SuspenseWithBoundaryProps } from \"../suspense-with-boundary\";\nimport { AwaitContextProvider, useAwaitContext } from \"./await-context\";\n\ntype RenderPropFn<TValue> = (result: TValue) => React.ReactNode;\n\ntype ChildrenType<TValue> = React.ReactNode | RenderPropFn<TValue>;\n\ntype AwaitRootProps<TValue> = Pick<SuspenseWithBoundaryProps, \"errorFallback\" | \"fallback\"> & {\n\tasChild?: boolean;\n\tchildren: ChildrenType<TValue>;\n\tpromise: Promise<TValue>;\n\twrapperVariant?: \"all\" | \"none\" | \"only-errorBoundary\" | \"only-suspense\";\n};\n\nexport function AwaitRoot<TValue>(props: AwaitRootProps<TValue>) {\n\tconst { children, errorFallback, fallback, wrapperVariant = \"all\", ...restOfProps } = props;\n\n\tconst withErrorBoundary = wrapperVariant === \"all\" || wrapperVariant === \"only-errorBoundary\";\n\tconst withSuspense = wrapperVariant === \"all\" || wrapperVariant === \"only-suspense\";\n\n\tconst WithErrorBoundary = withErrorBoundary ? ErrorBoundary : ReactFragment;\n\tconst WithSuspense = withSuspense ? Suspense : ReactFragment;\n\n\tconst slots = !isFunction(children)\n\t\t? getSlotMap<SlotComponentProps>(children)\n\t\t: ({ default: children } as unknown as ReturnType<typeof getSlotMap<SlotComponentProps>>);\n\n\tconst selectedPendingFallback = slots.pending ?? fallback;\n\tconst selectedErrorFallback = slots.error ?? errorFallback;\n\n\treturn (\n\t\t<WithErrorBoundary {...(Boolean(selectedErrorFallback) && { fallback: selectedErrorFallback })}>\n\t\t\t<WithSuspense {...(Boolean(selectedPendingFallback) && { fallback: selectedPendingFallback })}>\n\t\t\t\t<AwaitRootInner {...restOfProps}>{slots.default}</AwaitRootInner>\n\t\t\t</WithSuspense>\n\t\t</WithErrorBoundary>\n\t);\n}\n\ntype AwaitRootInnerProps<TValue> = Pick<AwaitRootProps<TValue>, \"asChild\" | \"children\" | \"promise\">;\n\nfunction AwaitRootInner<TValue>(props: AwaitRootInnerProps<TValue>) {\n\tconst { asChild, children, promise } = props;\n\n\tconst result = use(promise);\n\n\tconst resolvedChildren = isFunction(children) ? children(result) : children;\n\n\tconst Component = asChild ? Slot.Root : ReactFragment;\n\n\tconst contextValue = useMemo(() => ({ promise, result }), [promise, result]);\n\n\treturn (\n\t\t<AwaitContextProvider value={contextValue}>\n\t\t\t<Component {...(asChild && contextValue)}>{resolvedChildren}</Component>\n\t\t</AwaitContextProvider>\n\t);\n}\n\ntype SlotComponentProps = AwaitErrorProps | AwaitPendingProps | AwaitSuccessProps;\n\ntype AwaitSuccessProps<TValue = unknown> = GetSlotComponentProps<\"default\", ChildrenType<TValue>>;\n\nexport function AwaitSuccess<TPromiseOrValue, TValue = Awaited<TPromiseOrValue>>(\n\tprops: Pick<AwaitSuccessProps<TValue>, \"children\">\n) {\n\tif (isFunction(props.children)) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks -- This hook only uses `use` under the hood so this is safe\n\t\tconst { result } = useAwaitContext<TValue>();\n\n\t\treturn props.children(result);\n\t}\n\n\treturn props.children;\n}\n\nObject.assign(AwaitSuccess, withSlotNameAndSymbol<AwaitSuccessProps>(\"default\"));\n\ntype AwaitPendingProps = GetSlotComponentProps<\"pending\", React.SuspenseProps[\"fallback\"]>;\n\nexport const AwaitPending = withSlotNameAndSymbol<AwaitPendingProps>(\"pending\");\n\ntype AwaitErrorProps = GetSlotComponentProps<\"error\", ErrorBoundaryProps[\"fallback\"]>;\n\nexport const AwaitError = withSlotNameAndSymbol<AwaitErrorProps, { asChild?: boolean }>(\n\t\"error\",\n\t(props) => {\n\t\tconst { asChild, children } = props;\n\n\t\tconst errorBoundaryContext = useErrorBoundaryContext();\n\n\t\tconst Component = asChild ? Slot.Root : ReactFragment;\n\n\t\tconst resolvedChildren = isFunction(children) ? children(errorBoundaryContext) : children;\n\n\t\treturn <Component {...(asChild && errorBoundaryContext)}>{resolvedChildren}</Component>;\n\t}\n);\n","export {\n\tAwaitRoot as Root,\n\tAwaitError as Error,\n\tAwaitPending as Pending,\n\tAwaitSuccess as Success,\n} from \"./await\";\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1,186 +0,0 @@
1
- import * as React$1 from 'react';
2
- import { a as GetSlotComponentProps } from './getSlotMap-DTkxtGhd.js';
3
- import { InferProps, DiscriminatedRenderProps, PolymorphicProps } from '@zayne-labs/toolkit-react/utils';
4
- import { FileMeta, FileValidationErrorContext, FileValidationOptions } from '@zayne-labs/toolkit-core';
5
- import { Prettify } from '@zayne-labs/toolkit-type-helpers';
6
-
7
- type ContainerProps = InferProps<HTMLElement> & {
8
- classNames?: {
9
- base?: string;
10
- isDragging?: string;
11
- };
12
- };
13
- type InputProps = InferProps<"input">;
14
- type FileWithPreview = {
15
- /**
16
- * File object or file metadata
17
- */
18
- file: File | FileMeta;
19
- /**
20
- * Unique ID for the file
21
- */
22
- id: string;
23
- /**
24
- * Preview URL for the file
25
- * - Will be undefined if `disallowPreviewForNonImageFiles` is set to `true` and the file is not an image
26
- * - Can also be undefined if `URL.createObjectURL` fails
27
- */
28
- preview: string | undefined;
29
- };
30
- type DropZoneState = {
31
- /**
32
- * List of validation errors
33
- */
34
- errors: FileValidationErrorContext[];
35
- /**
36
- * List of files with their preview URLs and unique IDs
37
- */
38
- filesWithPreview: FileWithPreview[];
39
- /**
40
- * Whether or not a file is currently being dragged over the drop zone
41
- */
42
- isDragging: boolean;
43
- };
44
- type ChangeOrDragEvent = React.ChangeEvent<HTMLInputElement> | React.DragEvent<HTMLElement>;
45
- type DropZoneActions = {
46
- addFiles: (fileList: File[] | FileList | null, event?: ChangeOrDragEvent) => void;
47
- clearErrors: () => void;
48
- clearFiles: () => void;
49
- handleDragEnter: (event: React.DragEvent<HTMLElement>) => void;
50
- handleDragLeave: (event: React.DragEvent<HTMLElement>) => void;
51
- handleDragOver: (event: React.DragEvent<HTMLElement>) => void;
52
- handleFileUpload: (event: ChangeOrDragEvent) => void;
53
- openFilePicker: () => void;
54
- removeFile: (fileToRemoveOrId: string | FileWithPreview) => void;
55
- };
56
- type UseDropZoneResult = {
57
- dropZoneActions: DropZoneActions;
58
- dropZoneState: DropZoneState;
59
- getContainerProps: (containerProps?: ContainerProps) => ContainerProps;
60
- getInputProps: (inputProps?: InputProps) => InputProps;
61
- inputRef: React.RefObject<HTMLInputElement | null>;
62
- };
63
- type UseDropZoneProps = {
64
- /**
65
- * Allowed file types to be uploaded.
66
- */
67
- allowedFileTypes?: string[];
68
- /**
69
- * CSS classes to apply to the various parts of the drop zone
70
- */
71
- classNames?: Prettify<ContainerProps["classNames"] & {
72
- input?: string;
73
- }>;
74
- /**
75
- * Whether to disallow duplicate files
76
- * @default true
77
- */
78
- disallowDuplicates?: boolean;
79
- /**
80
- * Whether to disallow preview for non-image files
81
- * @default true
82
- */
83
- disallowPreviewForNonImageFiles?: boolean;
84
- /**
85
- * Extra props to pass to the container element
86
- */
87
- extraContainerProps?: ContainerProps;
88
- /**
89
- * Extra props to pass to the input element
90
- */
91
- extraInputProps?: InputProps;
92
- /**
93
- * Initial files to populate the drop zone
94
- */
95
- initialFiles?: FileMeta | FileMeta[] | null;
96
- /**
97
- * Maximum number of files that can be uploaded.
98
- */
99
- maxFileCount?: number;
100
- /**
101
- * Maximum file size in MB
102
- */
103
- maxFileSize?: number;
104
- /**
105
- * Whether to allow multiple files to be uploaded
106
- */
107
- multiple?: boolean;
108
- /**
109
- * Callback function to be called when internal files state changes
110
- */
111
- onFilesChange?: (context: {
112
- filesWithPreview: FileWithPreview[];
113
- }) => void;
114
- /**
115
- * Callback function to be called when the render props change
116
- */
117
- onRenderPropsChange?: (props: UseDropZoneResult) => void;
118
- /**
119
- * Callback function to be called when new files are uploaded
120
- */
121
- onUpload?: (context: {
122
- event: ChangeOrDragEvent;
123
- filesWithPreview: FileWithPreview[];
124
- }) => void;
125
- /**
126
- * Callback function to be called on each file upload as they occur
127
- */
128
- onUploadError?: FileValidationOptions["onError"];
129
- /**
130
- * Callback function to be called once after all file upload errors have occurred
131
- */
132
- onUploadErrors?: FileValidationOptions["onErrors"];
133
- /**
134
- * Callback function to be called on file upload success
135
- */
136
- onUploadSuccess?: FileValidationOptions["onSuccess"];
137
- /**
138
- * Custom validation function.
139
- *
140
- * If the function returns false, the file will be rejected
141
- */
142
- validator?: NonNullable<FileValidationOptions["validationSettings"]>["validator"];
143
- /**
144
- * Custom validation function that runs after all file validation has occurred
145
- */
146
- validatorForAllFiles?: FileValidationOptions["validatorForAllFiles"];
147
- /**
148
- * Whether to allow the default file picker via the file input element
149
- * @default true
150
- */
151
- withDefaultFilePicker?: boolean;
152
- };
153
- declare const useDropZone: (props?: UseDropZoneProps) => UseDropZoneResult;
154
-
155
- type DropZoneRenderPropType = DiscriminatedRenderProps<React$1.ReactNode | ((props: UseDropZoneResult) => React$1.ReactNode)>;
156
- type DropZoneRootProps = DropZoneRenderPropType & UseDropZoneProps & {
157
- /**
158
- * Controls whether to include internal elements (root and input) or not.
159
- */
160
- withInternalElements?: boolean;
161
- };
162
- declare function DropZoneRoot(props: DropZoneRootProps): React$1.JSX.Element;
163
- type DropZoneInputProps = InputProps & {
164
- asChild?: boolean;
165
- };
166
- declare function DropZoneInput(props: DropZoneInputProps): React$1.JSX.Element;
167
- type DropZoneContainerProps = ContainerProps & {
168
- asChild?: boolean;
169
- };
170
- declare function DropZoneContainer<TElement extends React$1.ElementType = "div">(props: PolymorphicProps<TElement, DropZoneContainerProps>): React$1.JSX.Element;
171
- type RenderPropFn = (props: UseDropZoneResult) => React$1.ReactNode;
172
- type SlotComponentProps = GetSlotComponentProps<"preview", React$1.ReactNode | RenderPropFn>;
173
- declare function DropZoneContext(props: {
174
- children: RenderPropFn;
175
- }): React$1.ReactNode;
176
- declare const DropZoneImagePreview: {
177
- (props: Pick<SlotComponentProps, "children">): React$1.ReactNode;
178
- readonly slotName?: "preview" | undefined;
179
- readonly slotSymbol?: symbol;
180
- };
181
-
182
- declare namespace dropZoneParts {
183
- export { DropZoneContainer as Container, DropZoneContext as Context, DropZoneImagePreview as ImagePreview, DropZoneInput as Input, DropZoneRoot as Root };
184
- }
185
-
186
- export { type ContainerProps as C, type DropZoneRenderPropType as D, type FileWithPreview as F, type InputProps as I, type UseDropZoneResult as U, type DropZoneRootProps as a, DropZoneRoot as b, DropZoneInput as c, dropZoneParts as d, DropZoneContainer as e, DropZoneContext as f, DropZoneImagePreview as g, type DropZoneState as h, type DropZoneActions as i, type UseDropZoneProps as j, useDropZone as u };
@@ -1,28 +0,0 @@
1
- import * as React from 'react';
2
- import { Component } from 'react';
3
- import { E as ErrorBoundaryProps } from './types-mdfDDNrr.js';
4
-
5
- type ErrorBoundaryState = {
6
- error: Error;
7
- hasError: true;
8
- } | {
9
- error: null;
10
- hasError: false;
11
- };
12
- /**
13
- * Copied from react-error-boundary package
14
- * @see https://github.com/bvaughn/react-error-boundary
15
- */
16
- declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
17
- #private;
18
- constructor(props: ErrorBoundaryProps);
19
- static getDerivedStateFromError(error: Error): {
20
- error: Error;
21
- hasError: boolean;
22
- };
23
- componentDidCatch(error: Error, info: React.ErrorInfo): void;
24
- componentDidUpdate(prevProps: ErrorBoundaryProps, prevState: ErrorBoundaryState): void;
25
- render(): React.JSX.Element;
26
- }
27
-
28
- export { ErrorBoundary as E };
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1,25 +0,0 @@
1
- type FallbackProps = {
2
- error: unknown;
3
- resetErrorBoundary: (...args: unknown[]) => void;
4
- };
5
- type ErrorBoundaryProps = {
6
- children: React.ReactNode;
7
- fallback?: React.ReactNode | ((props: FallbackProps) => React.ReactNode);
8
- onError?: (context: {
9
- error: Error;
10
- info: React.ErrorInfo & {
11
- ownerStack?: string;
12
- };
13
- }) => void;
14
- onReset?: (context: {
15
- args: unknown[];
16
- reason: "imperative-api";
17
- } | {
18
- next: unknown[] | undefined;
19
- prev: unknown[] | undefined;
20
- reason: "keys";
21
- }) => void;
22
- resetKeys?: unknown[];
23
- };
24
-
25
- export type { ErrorBoundaryProps as E, FallbackProps as F };