@makeswift/runtime 0.0.0-6baa2a2 → 0.0.0-76a2297

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 (201) hide show
  1. package/builder.js +1 -0
  2. package/dist/Page.cjs.js +215 -0
  3. package/dist/Page.cjs.js.map +1 -0
  4. package/dist/Page.es.js +209 -0
  5. package/dist/Page.es.js.map +1 -0
  6. package/dist/actions.cjs.js +34 -2
  7. package/dist/actions.cjs.js.map +1 -1
  8. package/dist/actions.es.js +29 -2
  9. package/dist/actions.es.js.map +1 -1
  10. package/dist/api.cjs.js +1 -2
  11. package/dist/api.cjs.js.map +1 -1
  12. package/dist/box-model.cjs.js +1 -2
  13. package/dist/box-model.cjs.js.map +1 -1
  14. package/dist/box-models.cjs.js +2 -0
  15. package/dist/box-models.cjs.js.map +1 -1
  16. package/dist/box-models.es.js +2 -0
  17. package/dist/box-models.es.js.map +1 -1
  18. package/dist/builder.cjs.js +9 -0
  19. package/dist/builder.cjs.js.map +1 -0
  20. package/dist/builder.es.js +3 -0
  21. package/dist/builder.es.js.map +1 -0
  22. package/dist/components.cjs.js +18 -3
  23. package/dist/components.cjs.js.map +1 -1
  24. package/dist/components.es.js +8 -2
  25. package/dist/components.es.js.map +1 -1
  26. package/dist/constants.cjs.js +96 -1
  27. package/dist/constants.cjs.js.map +1 -1
  28. package/dist/constants.es.js +96 -1
  29. package/dist/constants.es.js.map +1 -1
  30. package/dist/control-serialization.cjs.js +147 -0
  31. package/dist/control-serialization.cjs.js.map +1 -0
  32. package/dist/control-serialization.es.js +143 -0
  33. package/dist/control-serialization.es.js.map +1 -0
  34. package/dist/descriptors.cjs.js +10 -3
  35. package/dist/descriptors.cjs.js.map +1 -1
  36. package/dist/descriptors.es.js +8 -4
  37. package/dist/descriptors.es.js.map +1 -1
  38. package/dist/instances.cjs.js +17 -0
  39. package/dist/instances.cjs.js.map +1 -1
  40. package/dist/instances.es.js +17 -1
  41. package/dist/instances.es.js.map +1 -1
  42. package/dist/main.cjs.js +10 -2
  43. package/dist/main.cjs.js.map +1 -1
  44. package/dist/main.es.js +5 -1
  45. package/dist/main.es.js.map +1 -1
  46. package/dist/next.cjs.js +40 -18
  47. package/dist/next.cjs.js.map +1 -1
  48. package/dist/next.es.js +40 -17
  49. package/dist/next.es.js.map +1 -1
  50. package/dist/prop-controllers.cjs.js +2 -2
  51. package/dist/prop-controllers.es.js +1 -1
  52. package/dist/react-builder-preview.cjs.js +36 -39
  53. package/dist/react-builder-preview.cjs.js.map +1 -1
  54. package/dist/react-builder-preview.es.js +34 -37
  55. package/dist/react-builder-preview.es.js.map +1 -1
  56. package/dist/react-page.cjs.js +262 -0
  57. package/dist/react-page.cjs.js.map +1 -0
  58. package/dist/react-page.es.js +241 -0
  59. package/dist/react-page.es.js.map +1 -0
  60. package/dist/react.cjs.js +10 -4
  61. package/dist/react.cjs.js.map +1 -1
  62. package/dist/react.cjs2.js +2292 -428
  63. package/dist/react.cjs2.js.map +1 -1
  64. package/dist/react.es.js +7 -2
  65. package/dist/react.es.js.map +1 -1
  66. package/dist/react.es2.js +2281 -419
  67. package/dist/react.es2.js.map +1 -1
  68. package/dist/types/api/constants.d.ts.map +1 -1
  69. package/dist/types/api/generated/graphql.d.ts +59 -0
  70. package/dist/types/api/generated/graphql.d.ts.map +1 -1
  71. package/dist/types/api/react.d.ts +24 -4
  72. package/dist/types/api/react.d.ts.map +1 -1
  73. package/dist/types/api/types.d.ts +2 -2
  74. package/dist/types/api/types.d.ts.map +1 -1
  75. package/dist/types/builder/index.d.ts +2 -0
  76. package/dist/types/builder/index.d.ts.map +1 -0
  77. package/dist/types/builder/serialization/control-serialization.d.ts +78 -0
  78. package/dist/types/builder/serialization/control-serialization.d.ts.map +1 -0
  79. package/dist/types/builder/serialization/function-serialization.d.ts +11 -0
  80. package/dist/types/builder/serialization/function-serialization.d.ts.map +1 -0
  81. package/dist/types/builder/serialization/index.d.ts +3 -0
  82. package/dist/types/builder/serialization/index.d.ts.map +1 -0
  83. package/dist/types/components/builtin/Form/Form.d.ts +41 -0
  84. package/dist/types/components/builtin/Form/Form.d.ts.map +1 -0
  85. package/dist/types/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +15 -0
  86. package/dist/types/components/builtin/Form/components/Field/components/Checkbox/index.d.ts.map +1 -0
  87. package/dist/types/components/builtin/Form/components/Field/components/CheckboxTableField/index.d.ts +15 -0
  88. package/dist/types/components/builtin/Form/components/Field/components/CheckboxTableField/index.d.ts.map +1 -0
  89. package/dist/types/components/builtin/Form/components/Field/components/EmailTableField/index.d.ts +11 -0
  90. package/dist/types/components/builtin/Form/components/Field/components/EmailTableField/index.d.ts.map +1 -0
  91. package/dist/types/components/builtin/Form/components/Field/components/Input/index.d.ts +14 -0
  92. package/dist/types/components/builtin/Form/components/Field/components/Input/index.d.ts.map +1 -0
  93. package/dist/types/components/builtin/Form/components/Field/components/Label/index.d.ts +16 -0
  94. package/dist/types/components/builtin/Form/components/Field/components/Label/index.d.ts.map +1 -0
  95. package/dist/types/components/builtin/Form/components/Field/components/LongTextTableField/index.d.ts +10 -0
  96. package/dist/types/components/builtin/Form/components/Field/components/LongTextTableField/index.d.ts.map +1 -0
  97. package/dist/types/components/builtin/Form/components/Field/components/MultipleSelectTableField/index.d.ts +23 -0
  98. package/dist/types/components/builtin/Form/components/Field/components/MultipleSelectTableField/index.d.ts.map +1 -0
  99. package/dist/types/components/builtin/Form/components/Field/components/NumberTableField/index.d.ts +11 -0
  100. package/dist/types/components/builtin/Form/components/Field/components/NumberTableField/index.d.ts.map +1 -0
  101. package/dist/types/components/builtin/Form/components/Field/components/PhoneNumberTableField/index.d.ts +11 -0
  102. package/dist/types/components/builtin/Form/components/Field/components/PhoneNumberTableField/index.d.ts.map +1 -0
  103. package/dist/types/components/builtin/Form/components/Field/components/PlaceholderTableField/index.d.ts +3 -0
  104. package/dist/types/components/builtin/Form/components/Field/components/PlaceholderTableField/index.d.ts.map +1 -0
  105. package/dist/types/components/builtin/Form/components/Field/components/RadioButton/index.d.ts +17 -0
  106. package/dist/types/components/builtin/Form/components/Field/components/RadioButton/index.d.ts.map +1 -0
  107. package/dist/types/components/builtin/Form/components/Field/components/SingleLineTextTableField/index.d.ts +11 -0
  108. package/dist/types/components/builtin/Form/components/Field/components/SingleLineTextTableField/index.d.ts.map +1 -0
  109. package/dist/types/components/builtin/Form/components/Field/components/SingleSelectTableField/components/TableColumnRadioButtonGroup/index.d.ts +23 -0
  110. package/dist/types/components/builtin/Form/components/Field/components/SingleSelectTableField/components/TableColumnRadioButtonGroup/index.d.ts.map +1 -0
  111. package/dist/types/components/builtin/Form/components/Field/components/SingleSelectTableField/components/TableColumnSingleSelect/index.d.ts +19 -0
  112. package/dist/types/components/builtin/Form/components/Field/components/SingleSelectTableField/components/TableColumnSingleSelect/index.d.ts.map +1 -0
  113. package/dist/types/components/builtin/Form/components/Field/components/SingleSelectTableField/index.d.ts +24 -0
  114. package/dist/types/components/builtin/Form/components/Field/components/SingleSelectTableField/index.d.ts.map +1 -0
  115. package/dist/types/components/builtin/Form/components/Field/components/TextArea/index.d.ts +13 -0
  116. package/dist/types/components/builtin/Form/components/Field/components/TextArea/index.d.ts.map +1 -0
  117. package/dist/types/components/builtin/Form/components/Field/components/URLTableField/index.d.ts +11 -0
  118. package/dist/types/components/builtin/Form/components/Field/components/URLTableField/index.d.ts.map +1 -0
  119. package/dist/types/components/builtin/Form/components/Field/index.d.ts +19 -0
  120. package/dist/types/components/builtin/Form/components/Field/index.d.ts.map +1 -0
  121. package/dist/types/components/builtin/Form/components/Field/services/cssField.d.ts +11 -0
  122. package/dist/types/components/builtin/Form/components/Field/services/cssField.d.ts.map +1 -0
  123. package/dist/types/components/builtin/Form/components/Placeholder/index.d.ts +9 -0
  124. package/dist/types/components/builtin/Form/components/Placeholder/index.d.ts.map +1 -0
  125. package/dist/types/components/builtin/Form/components/Spinner/index.d.ts +3 -0
  126. package/dist/types/components/builtin/Form/components/Spinner/index.d.ts.map +1 -0
  127. package/dist/types/components/builtin/Form/context/FormContext.d.ts +32 -0
  128. package/dist/types/components/builtin/Form/context/FormContext.d.ts.map +1 -0
  129. package/dist/types/components/builtin/Form/index.d.ts +2 -0
  130. package/dist/types/components/builtin/Form/index.d.ts.map +1 -0
  131. package/dist/types/components/builtin/Form/prop-controllers.d.ts +1 -0
  132. package/dist/types/components/builtin/Form/prop-controllers.d.ts.map +1 -0
  133. package/dist/types/components/builtin/Video/Video.d.ts +15 -0
  134. package/dist/types/components/builtin/Video/Video.d.ts.map +1 -0
  135. package/dist/types/components/builtin/Video/index.d.ts +2 -0
  136. package/dist/types/components/builtin/Video/index.d.ts.map +1 -0
  137. package/dist/types/components/builtin/Video/prop-controllers.d.ts +50 -0
  138. package/dist/types/components/builtin/Video/prop-controllers.d.ts.map +1 -0
  139. package/dist/types/components/builtin/index.d.ts +1 -0
  140. package/dist/types/components/builtin/index.d.ts.map +1 -1
  141. package/dist/types/components/hooks/index.d.ts +1 -0
  142. package/dist/types/components/hooks/index.d.ts.map +1 -1
  143. package/dist/types/components/hooks/useTable.d.ts +66 -0
  144. package/dist/types/components/hooks/useTable.d.ts.map +1 -0
  145. package/dist/types/components/hooks/useTableFormFieldRefs.d.ts +8 -0
  146. package/dist/types/components/hooks/useTableFormFieldRefs.d.ts.map +1 -0
  147. package/dist/types/components/hooks/useTableWorkspace.d.ts +14 -0
  148. package/dist/types/components/hooks/useTableWorkspace.d.ts.map +1 -0
  149. package/dist/types/components/index.d.ts +2 -0
  150. package/dist/types/components/index.d.ts.map +1 -1
  151. package/dist/types/components/page/BodySnippet.d.ts +7 -0
  152. package/dist/types/components/page/BodySnippet.d.ts.map +1 -0
  153. package/dist/types/components/page/Page.d.ts +45 -0
  154. package/dist/types/components/page/Page.d.ts.map +1 -0
  155. package/dist/types/components/page/index.d.ts +2 -0
  156. package/dist/types/components/page/index.d.ts.map +1 -0
  157. package/dist/types/components/utils/layout.d.ts +16 -0
  158. package/dist/types/components/utils/layout.d.ts.map +1 -0
  159. package/dist/types/components/utils/placeholders.d.ts +7 -0
  160. package/dist/types/components/utils/placeholders.d.ts.map +1 -1
  161. package/dist/types/components/utils/pollAnimationFrame.d.ts +2 -0
  162. package/dist/types/components/utils/pollAnimationFrame.d.ts.map +1 -0
  163. package/dist/types/components/utils/pollElementLayout.d.ts +8 -0
  164. package/dist/types/components/utils/pollElementLayout.d.ts.map +1 -0
  165. package/dist/types/components/utils/queries.d.ts +1 -0
  166. package/dist/types/components/utils/queries.d.ts.map +1 -1
  167. package/dist/types/components/utils/requestBatchedAnimationFrame.d.ts +4 -0
  168. package/dist/types/components/utils/requestBatchedAnimationFrame.d.ts.map +1 -0
  169. package/dist/types/components/utils/types.d.ts +1 -2
  170. package/dist/types/components/utils/types.d.ts.map +1 -1
  171. package/dist/types/index.d.ts +2 -1
  172. package/dist/types/index.d.ts.map +1 -1
  173. package/dist/types/next.d.ts +6 -4
  174. package/dist/types/next.d.ts.map +1 -1
  175. package/dist/types/prop-controllers/descriptors.d.ts +31 -12
  176. package/dist/types/prop-controllers/descriptors.d.ts.map +1 -1
  177. package/dist/types/prop-controllers/index.d.ts +3 -3
  178. package/dist/types/prop-controllers/index.d.ts.map +1 -1
  179. package/dist/types/prop-controllers/instances.d.ts +36 -4
  180. package/dist/types/prop-controllers/instances.d.ts.map +1 -1
  181. package/dist/types/react.d.ts +1 -1
  182. package/dist/types/react.d.ts.map +1 -1
  183. package/dist/types/runtimes/page.d.ts +9 -0
  184. package/dist/types/runtimes/page.d.ts.map +1 -0
  185. package/dist/types/runtimes/react.d.ts +15 -8
  186. package/dist/types/runtimes/react.d.ts.map +1 -1
  187. package/dist/types/state/actions.d.ts +55 -1
  188. package/dist/types/state/actions.d.ts.map +1 -1
  189. package/dist/types/state/modules/box-models.d.ts.map +1 -1
  190. package/dist/types/state/modules/read-only-documents.d.ts +8 -4
  191. package/dist/types/state/modules/read-only-documents.d.ts.map +1 -1
  192. package/dist/types/state/modules/read-write-documents.d.ts +1 -1
  193. package/dist/types/state/modules/read-write-documents.d.ts.map +1 -1
  194. package/dist/types/state/react-builder-preview.d.ts.map +1 -1
  195. package/dist/types/state/react-page.d.ts +3 -3
  196. package/dist/types/state/react-page.d.ts.map +1 -1
  197. package/dist/types/utils/get-redirect-match.d.ts +10 -0
  198. package/dist/types/utils/get-redirect-match.d.ts.map +1 -0
  199. package/dist/types/utils/get-redirect-match.test.d.ts +1 -0
  200. package/dist/types/utils/get-redirect-match.test.d.ts.map +1 -0
  201. package/package.json +19 -6
@@ -30,25 +30,32 @@ var __objRest = (source, exclude) => {
30
30
  }
31
31
  return target;
32
32
  };
33
+ var __publicField = (obj, key, value) => {
34
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
35
+ return value;
36
+ };
33
37
  var React = require("react");
34
38
  var withSelector = require("use-sync-external-store/shim/with-selector");
35
39
  var client = require("@apollo/client");
36
- var redux = require("redux");
37
- var thunk = require("redux-thunk");
40
+ var reactPage = require("./react-page.cjs.js");
38
41
  var actions = require("./actions.cjs.js");
39
- var descriptors = require("./descriptors.cjs.js");
40
42
  var styled = require("styled-components");
41
43
  var framerMotion = require("framer-motion");
44
+ var ssr = require("@apollo/client/react/ssr");
45
+ var uuid = require("uuid/v4");
42
46
  var jsxRuntime = require("react/jsx-runtime");
47
+ require("html-react-parser");
48
+ require("next/head");
43
49
  var boxModels = require("./box-models.cjs.js");
44
50
  var NextImage = require("next/image");
45
51
  var ReactPlayer = require("react-player");
52
+ var descriptors = require("./descriptors.cjs.js");
46
53
  var ColorHelper = require("color");
47
54
  var scrollIntoView = require("scroll-into-view-if-needed");
48
55
  var NextLink = require("next/link");
49
56
  var reactUseGesture = require("react-use-gesture");
50
57
  var popcorn = require("@popmotion/popcorn");
51
- var uuid = require("uuid/v4");
58
+ var formik = require("formik");
52
59
  var polished = require("polished");
53
60
  var slate = require("slate");
54
61
  var Hotkeys = require("slate-hotkeys");
@@ -61,7 +68,7 @@ function _interopDefaultLegacy(e) {
61
68
  function _interopNamespace(e) {
62
69
  if (e && e.__esModule)
63
70
  return e;
64
- var n = { __proto__: null, [Symbol.toStringTag]: "Module" };
71
+ var n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
65
72
  if (e) {
66
73
  Object.keys(e).forEach(function(k) {
67
74
  if (k !== "default") {
@@ -79,224 +86,16 @@ function _interopNamespace(e) {
79
86
  return Object.freeze(n);
80
87
  }
81
88
  var React__namespace = /* @__PURE__ */ _interopNamespace(React);
82
- var thunk__default = /* @__PURE__ */ _interopDefaultLegacy(thunk);
83
89
  var styled__default = /* @__PURE__ */ _interopDefaultLegacy(styled);
90
+ var uuid__default = /* @__PURE__ */ _interopDefaultLegacy(uuid);
84
91
  var NextImage__default = /* @__PURE__ */ _interopDefaultLegacy(NextImage);
85
92
  var ReactPlayer__default = /* @__PURE__ */ _interopDefaultLegacy(ReactPlayer);
86
93
  var ColorHelper__default = /* @__PURE__ */ _interopDefaultLegacy(ColorHelper);
87
94
  var scrollIntoView__default = /* @__PURE__ */ _interopDefaultLegacy(scrollIntoView);
88
95
  var NextLink__default = /* @__PURE__ */ _interopDefaultLegacy(NextLink);
89
- var uuid__default = /* @__PURE__ */ _interopDefaultLegacy(uuid);
90
96
  var Hotkeys__default = /* @__PURE__ */ _interopDefaultLegacy(Hotkeys);
91
97
  var ipsum__default = /* @__PURE__ */ _interopDefaultLegacy(ipsum);
92
98
  var Lists__default = /* @__PURE__ */ _interopDefaultLegacy(Lists);
93
- function isElementReference(element) {
94
- return !("props" in element);
95
- }
96
- function createDocument(rootElement) {
97
- return { rootElement };
98
- }
99
- function getInitialState$3({
100
- rootElements = /* @__PURE__ */ new Map()
101
- } = {}) {
102
- const initialState = /* @__PURE__ */ new Map();
103
- rootElements.forEach((rootElement, elementKey) => {
104
- initialState.set(elementKey, createDocument(rootElement));
105
- });
106
- return initialState;
107
- }
108
- function getDocuments(state) {
109
- return state;
110
- }
111
- function getDocument(state, documentKey) {
112
- var _a;
113
- return (_a = getDocuments(state).get(documentKey)) != null ? _a : null;
114
- }
115
- function getDocumentRootElement$1(state, documentKey) {
116
- var _a, _b;
117
- return (_b = (_a = getDocument(state, documentKey)) == null ? void 0 : _a.rootElement) != null ? _b : null;
118
- }
119
- function reducer$4(state = getInitialState$3(), _action) {
120
- return state;
121
- }
122
- function getInitialState$2({
123
- reactComponents = /* @__PURE__ */ new Map()
124
- } = {}) {
125
- return reactComponents;
126
- }
127
- function getReactComponents(state) {
128
- return state;
129
- }
130
- function getReactComponent$1(state, type) {
131
- var _a;
132
- return (_a = getReactComponents(state).get(type)) != null ? _a : null;
133
- }
134
- function reducer$3(state = getInitialState$2(), action) {
135
- switch (action.type) {
136
- case actions.ActionTypes.REGISTER_REACT_COMPONENT:
137
- return new Map(state).set(action.payload.type, action.payload.component);
138
- case actions.ActionTypes.UNREGISTER_REACT_COMPONENT: {
139
- const nextState = new Map(state);
140
- const deleted = nextState.delete(action.payload.type);
141
- return deleted ? nextState : state;
142
- }
143
- default:
144
- return state;
145
- }
146
- }
147
- function getInitialState$1({
148
- componentsMeta = /* @__PURE__ */ new Map()
149
- } = {}) {
150
- return componentsMeta;
151
- }
152
- function getComponentsMeta(state) {
153
- return state;
154
- }
155
- function reducer$2(state = getInitialState$1(), action) {
156
- switch (action.type) {
157
- case actions.ActionTypes.REGISTER_COMPONENT:
158
- return new Map(state).set(action.payload.type, action.payload.meta);
159
- case actions.ActionTypes.UNREGISTER_COMPONENT: {
160
- const nextState = new Map(state);
161
- const deleted = nextState.delete(action.payload.type);
162
- return deleted ? nextState : state;
163
- }
164
- default:
165
- return state;
166
- }
167
- }
168
- function getInitialState({
169
- propControllerDescriptors = /* @__PURE__ */ new Map()
170
- } = {}) {
171
- return propControllerDescriptors;
172
- }
173
- function getPropControllerDescriptors$1(state) {
174
- return state;
175
- }
176
- function getComponentPropControllerDescriptors$1(state, componentType) {
177
- var _a;
178
- return (_a = getPropControllerDescriptors$1(state).get(componentType)) != null ? _a : null;
179
- }
180
- function reducer$1(state = getInitialState(), action) {
181
- switch (action.type) {
182
- case actions.ActionTypes.REGISTER_COMPONENT:
183
- return new Map(state).set(action.payload.type, action.payload.propControllerDescriptors);
184
- case actions.ActionTypes.UNREGISTER_COMPONENT: {
185
- const nextState = new Map(state);
186
- const deleted = nextState.delete(action.payload.type);
187
- return deleted ? nextState : state;
188
- }
189
- default:
190
- return state;
191
- }
192
- }
193
- function getElementChildren(descriptor, prop) {
194
- if (prop == null)
195
- return [];
196
- switch (descriptor.type) {
197
- case descriptors.Types.Grid:
198
- return prop.elements;
199
- default:
200
- return [];
201
- }
202
- }
203
- function getElementId$1(descriptor, prop) {
204
- if (prop == null)
205
- return null;
206
- switch (descriptor.type) {
207
- case descriptors.Types.ElementID:
208
- return prop;
209
- default:
210
- return null;
211
- }
212
- }
213
- const reducer = redux.combineReducers({
214
- documents: reducer$4,
215
- reactComponents: reducer$3,
216
- componentsMeta: reducer$2,
217
- propControllers: reducer$1,
218
- isInBuilder: (_state = false, _action) => false
219
- });
220
- function getDocumentsStateSlice(state) {
221
- return state.documents;
222
- }
223
- function getDocumentRootElement(state, documentKey) {
224
- return getDocumentRootElement$1(getDocumentsStateSlice(state), documentKey);
225
- }
226
- function getReactComponentsStateSlice(state) {
227
- return state.reactComponents;
228
- }
229
- function getReactComponent(state, type) {
230
- return getReactComponent$1(getReactComponentsStateSlice(state), type);
231
- }
232
- function getPropControllersStateSlice(state) {
233
- return state.propControllers;
234
- }
235
- function getPropControllerDescriptors(state) {
236
- return getPropControllerDescriptors$1(getPropControllersStateSlice(state));
237
- }
238
- function getComponentPropControllerDescriptors(state, componentType) {
239
- return getComponentPropControllerDescriptors$1(getPropControllersStateSlice(state), componentType);
240
- }
241
- function normalizeElement(element, descriptors2) {
242
- const elements = /* @__PURE__ */ new Map();
243
- const remaining = [element];
244
- let current;
245
- while (current = remaining.pop()) {
246
- elements.set(current.key, current);
247
- if (isElementReference(current))
248
- continue;
249
- const elementDescriptors = descriptors2.get(element.type);
250
- if (elementDescriptors == null)
251
- continue;
252
- const parent = current;
253
- const children = Object.entries(elementDescriptors).reduce((acc, [propName, descriptor]) => {
254
- return [...acc, ...getElementChildren(descriptor, parent.props[propName])];
255
- }, []);
256
- remaining.push(...children);
257
- }
258
- return elements;
259
- }
260
- function getDocumentElements(state, documentKey) {
261
- const rootElement = getDocumentRootElement(state, documentKey);
262
- const descriptors2 = getPropControllerDescriptors(state);
263
- if (rootElement == null)
264
- return /* @__PURE__ */ new Map();
265
- return normalizeElement(rootElement, descriptors2);
266
- }
267
- function getElement(state, documentKey, elementKey) {
268
- var _a;
269
- return (_a = getDocumentElements(state, documentKey).get(elementKey)) != null ? _a : null;
270
- }
271
- function getElementPropControllerDescriptors(state, documentKey, elementKey) {
272
- const element = getElement(state, documentKey, elementKey);
273
- if (element == null || isElementReference(element))
274
- return null;
275
- return getComponentPropControllerDescriptors(state, element.type);
276
- }
277
- function getElementId(state, documentKey, elementKey) {
278
- const element = getElement(state, documentKey, elementKey);
279
- if (element == null || isElementReference(element))
280
- return null;
281
- const descriptors2 = getComponentPropControllerDescriptors(state, element.type);
282
- if (descriptors2 == null)
283
- return null;
284
- const elementId = Object.entries(descriptors2).reduce((acc, [propName, descriptor]) => {
285
- if (acc != null)
286
- return acc;
287
- return getElementId$1(descriptor, element.props[propName]);
288
- }, null);
289
- return elementId;
290
- }
291
- function getIsInBuilder(state) {
292
- return state.isInBuilder;
293
- }
294
- function configureStore({
295
- rootElements,
296
- preloadedState
297
- } = {}) {
298
- return redux.createStore(reducer, __spreadProps(__spreadValues({}, preloadedState), { documents: getInitialState$3({ rootElements }) }), redux.applyMiddleware(thunk__default["default"]));
299
- }
300
99
  const PlaceholderBase$1 = styled__default["default"].div`
301
100
  width: 100%;
302
101
  background: rgba(161, 168, 194, 0.18);
@@ -306,7 +105,7 @@ const PlaceholderBase$1 = styled__default["default"].div`
306
105
  hide
307
106
  }) => hide === true ? "hidden" : "initial"};
308
107
  `;
309
- var Placeholder$1 = React.forwardRef(function Placeholder2(_a, ref) {
108
+ var Placeholder$2 = React.forwardRef(function Placeholder2(_a, ref) {
310
109
  var _b = _a, {
311
110
  hide = false
312
111
  } = _b, restOfProps = __objRest(_b, [
@@ -420,21 +219,157 @@ const TYPOGRAPHIES_BY_ID = client.gql`
420
219
 
421
220
  ${TYPOGRAPHY_FRAGMENT}
422
221
  `;
222
+ const TABLE_BY_ID = client.gql`
223
+ query TableById($id: ID!) {
224
+ table(id: $id) {
225
+ id
226
+ name
227
+ columns {
228
+ id
229
+ name
230
+ ... on MultipleSelectTableColumn {
231
+ options {
232
+ id
233
+ name
234
+ }
235
+ }
236
+ ... on SingleSelectTableColumn {
237
+ options {
238
+ id
239
+ name
240
+ }
241
+ }
242
+ }
243
+ }
244
+ }
245
+ `;
423
246
  function isNonNullable(value) {
424
247
  return value != null;
425
248
  }
426
- const Context$1 = React.createContext(void 0);
249
+ const typePolicies = {
250
+ Query: {
251
+ fields: {
252
+ swatches(existingData, {
253
+ args,
254
+ toReference
255
+ }) {
256
+ return existingData != null ? existingData : args == null ? void 0 : args.ids.map((id) => toReference({
257
+ __typename: "Swatch",
258
+ id
259
+ }, true));
260
+ },
261
+ file(existingData, {
262
+ args,
263
+ toReference
264
+ }) {
265
+ return existingData != null ? existingData : toReference({
266
+ __typename: "File",
267
+ id: args == null ? void 0 : args.id
268
+ }, true);
269
+ },
270
+ files(existingData, {
271
+ args,
272
+ toReference
273
+ }) {
274
+ return existingData != null ? existingData : args == null ? void 0 : args.ids.map((id) => toReference({
275
+ __typename: "File",
276
+ id
277
+ }, true));
278
+ },
279
+ typographies(existingData, {
280
+ args,
281
+ toReference
282
+ }) {
283
+ return existingData != null ? existingData : args == null ? void 0 : args.ids.map((id) => toReference({
284
+ __typename: "Typography",
285
+ id
286
+ }, true));
287
+ },
288
+ pagePathnamesById(existingData, {
289
+ args,
290
+ toReference
291
+ }) {
292
+ return existingData != null ? existingData : args == null ? void 0 : args.ids.map((id) => toReference({
293
+ __typename: "PagePathnameSlice",
294
+ id
295
+ }, true));
296
+ },
297
+ globalElement(existingData, {
298
+ args,
299
+ toReference
300
+ }) {
301
+ return existingData != null ? existingData : toReference({
302
+ __typename: "GlobalElement",
303
+ id: args == null ? void 0 : args.id
304
+ }, true);
305
+ },
306
+ table(existingData, {
307
+ args,
308
+ toReference
309
+ }) {
310
+ return existingData != null ? existingData : toReference({
311
+ __typename: "Table",
312
+ id: args == null ? void 0 : args.id
313
+ }, true);
314
+ }
315
+ }
316
+ }
317
+ };
318
+ function createApolloClient({
319
+ uri,
320
+ cacheData
321
+ }) {
322
+ const cache = new client.InMemoryCache({
323
+ typePolicies
324
+ });
325
+ if (cacheData)
326
+ cache.restore(cacheData);
327
+ return new client.ApolloClient({
328
+ uri,
329
+ cache
330
+ });
331
+ }
332
+ class MakeswiftClient {
333
+ constructor({
334
+ uri,
335
+ cacheData
336
+ }) {
337
+ __publicField(this, "apolloClient");
338
+ this.apolloClient = createApolloClient({
339
+ uri,
340
+ cacheData
341
+ });
342
+ }
343
+ async prefetch(element) {
344
+ const id = uuid__default["default"]();
345
+ await ssr.getDataFromTree(/* @__PURE__ */ jsxRuntime.jsx(RuntimeProvider, {
346
+ client: this,
347
+ defaultRootElements: /* @__PURE__ */ new Map([[id, element]]),
348
+ children: /* @__PURE__ */ jsxRuntime.jsx(DocumentReference, {
349
+ documentReference: reactPage.createDocumentReference(id)
350
+ })
351
+ }));
352
+ return this.apolloClient.cache.extract();
353
+ }
354
+ }
355
+ const Context$2 = React.createContext(void 0);
427
356
  function useQuery(query, options) {
428
- const client$1 = React.useContext(Context$1);
357
+ const client$1 = React.useContext(Context$2);
429
358
  return client.useQuery(query, __spreadValues({
430
- client: client$1
359
+ client: client$1 == null ? void 0 : client$1.apolloClient
360
+ }, options));
361
+ }
362
+ function useMutation(mutation, options) {
363
+ const client$1 = React.useContext(Context$2);
364
+ return client.useMutation(mutation, __spreadValues({
365
+ client: client$1 == null ? void 0 : client$1.apolloClient
431
366
  }, options));
432
367
  }
433
- function ApolloProvider({
368
+ function MakeswiftProvider({
434
369
  client: client2,
435
370
  children
436
371
  }) {
437
- return /* @__PURE__ */ jsxRuntime.jsx(Context$1.Provider, {
372
+ return /* @__PURE__ */ jsxRuntime.jsx(Context$2.Provider, {
438
373
  value: client2,
439
374
  children
440
375
  });
@@ -647,8 +582,8 @@ function shallowMerge(a, b) {
647
582
  }
648
583
  const DEVICES = [
649
584
  { id: "desktop", minWidth: 769 },
650
- { id: "tablet", minWidth: 476, maxWidth: 768 },
651
- { id: "mobile", maxWidth: 475 }
585
+ { id: "tablet", minWidth: 576, maxWidth: 768 },
586
+ { id: "mobile", maxWidth: 575 }
652
587
  ];
653
588
  const getDevice = (deviceId) => {
654
589
  const device = DEVICES.find(({ id }) => id === deviceId);
@@ -722,6 +657,12 @@ function usePage(pageId) {
722
657
  const { pagePathnamesById: [page] = [] } = data;
723
658
  return page;
724
659
  }
660
+ function useTable(tableId) {
661
+ return useQuery(TABLE_BY_ID, {
662
+ skip: tableId == null,
663
+ variables: { id: tableId }
664
+ });
665
+ }
725
666
  const defaultExitedProps = {
726
667
  opacity: 0,
727
668
  x: 0,
@@ -1192,8 +1133,8 @@ function getScrollParent(element) {
1192
1133
  return element;
1193
1134
  return getScrollParent(parentElement);
1194
1135
  }
1195
- function Parallax(_g) {
1196
- var _h = _g, {
1136
+ function Parallax(_g2) {
1137
+ var _h = _g2, {
1197
1138
  strength,
1198
1139
  children
1199
1140
  } = _h, rest = __objRest(_h, [
@@ -1279,7 +1220,7 @@ function Parallax(_g) {
1279
1220
  children: children(getProps)
1280
1221
  }));
1281
1222
  }
1282
- const Container$8 = styled__default["default"].div`
1223
+ const Container$d = styled__default["default"].div`
1283
1224
  position: absolute;
1284
1225
  top: 0;
1285
1226
  left: 0;
@@ -1333,7 +1274,7 @@ function BackgroundVideo({
1333
1274
  }, [aspectRatio, zoom]);
1334
1275
  if (!ReactPlayer__default["default"].canPlay(url))
1335
1276
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
1336
- return /* @__PURE__ */ jsxRuntime.jsxs(Container$8, {
1277
+ return /* @__PURE__ */ jsxRuntime.jsxs(Container$d, {
1337
1278
  ref: container,
1338
1279
  children: [container.current && /* @__PURE__ */ jsxRuntime.jsx(ReactPlayer__default["default"], {
1339
1280
  url,
@@ -1412,10 +1353,10 @@ const AbsoluteFill = styled__default["default"].div`
1412
1353
  right: 0;
1413
1354
  bottom: 0;
1414
1355
  `;
1415
- const Container$7 = styled__default["default"](AbsoluteFill)`
1356
+ const Container$c = styled__default["default"](AbsoluteFill)`
1416
1357
  border-radius: inherit;
1417
1358
  `;
1418
- const BackgroundsContainer$1 = styled__default["default"](Container$7)`
1359
+ const BackgroundsContainer$1 = styled__default["default"](Container$c)`
1419
1360
  overflow: hidden;
1420
1361
  ${(p) => cssMediaRules([p.visibility], ([visibility]) => styled.css`
1421
1362
  display: ${visibility === true ? "block" : "none"};
@@ -1439,7 +1380,7 @@ function Backgrounds({
1439
1380
  visibility,
1440
1381
  children: [...value].reverse().map((bg) => {
1441
1382
  if (bg.type === "color") {
1442
- return /* @__PURE__ */ jsxRuntime.jsx(Container$7, {
1383
+ return /* @__PURE__ */ jsxRuntime.jsx(Container$c, {
1443
1384
  style: {
1444
1385
  backgroundColor: getColor(bg.payload)
1445
1386
  }
@@ -1475,7 +1416,7 @@ function Backgrounds({
1475
1416
  }
1476
1417
  return /* @__PURE__ */ jsxRuntime.jsx(Parallax, {
1477
1418
  strength: parallax,
1478
- children: (getParallaxProps) => /* @__PURE__ */ jsxRuntime.jsx(Container$7, __spreadValues({}, getParallaxProps({
1419
+ children: (getParallaxProps) => /* @__PURE__ */ jsxRuntime.jsx(Container$c, __spreadValues({}, getParallaxProps({
1479
1420
  style: {
1480
1421
  backgroundImage: publicUrl != null ? `url('${publicUrl}')` : void 0,
1481
1422
  backgroundPosition,
@@ -1493,7 +1434,7 @@ function Backgrounds({
1493
1434
  isRadial
1494
1435
  } = bg.payload;
1495
1436
  const gradient = `${getStopsStyle(stops)}`;
1496
- return /* @__PURE__ */ jsxRuntime.jsx(Container$7, {
1437
+ return /* @__PURE__ */ jsxRuntime.jsx(Container$c, {
1497
1438
  style: {
1498
1439
  background: isRadial ? `radial-gradient(${gradient})` : `linear-gradient(${angle}rad, ${gradient})`
1499
1440
  }
@@ -1510,7 +1451,7 @@ function Backgrounds({
1510
1451
  } = bg.payload;
1511
1452
  return /* @__PURE__ */ jsxRuntime.jsx(Parallax, {
1512
1453
  strength: parallax,
1513
- children: (getParallaxProps) => /* @__PURE__ */ jsxRuntime.jsx(Container$7, __spreadProps(__spreadValues({}, getParallaxProps({})), {
1454
+ children: (getParallaxProps) => /* @__PURE__ */ jsxRuntime.jsx(Container$c, __spreadProps(__spreadValues({}, getParallaxProps({})), {
1514
1455
  children: /* @__PURE__ */ jsxRuntime.jsx(BackgroundVideo, {
1515
1456
  url,
1516
1457
  zoom,
@@ -1578,7 +1519,7 @@ const Grid$1 = styled__default["default"](framerMotion.motion.div)`
1578
1519
  alignContent
1579
1520
  }))}
1580
1521
  `;
1581
- const GridItem$1 = styled__default["default"](framerMotion.motion.div)`
1522
+ const GridItem$2 = styled__default["default"](framerMotion.motion.div)`
1582
1523
  display: flex;
1583
1524
 
1584
1525
  /* IE11 doesn't recognize space-between and treats it as stretch, so we fall back to flex-start */
@@ -1689,7 +1630,7 @@ const Box = React.forwardRef(function Box2({
1689
1630
  animate: animate == null ? void 0 : animate.parent,
1690
1631
  initial: initial == null ? void 0 : initial.parent,
1691
1632
  transition: transition == null ? void 0 : transition.parent,
1692
- children: children && children.elements.length > 0 ? children.elements.map((child, index) => /* @__PURE__ */ jsxRuntime.jsx(GridItem$1, {
1633
+ children: children && children.elements.length > 0 ? children.elements.map((child, index) => /* @__PURE__ */ jsxRuntime.jsx(GridItem$2, {
1693
1634
  grid: children.columns,
1694
1635
  index,
1695
1636
  columnGap,
@@ -1700,13 +1641,13 @@ const Box = React.forwardRef(function Box2({
1700
1641
  children: /* @__PURE__ */ jsxRuntime.jsx(Element$1, {
1701
1642
  element: child
1702
1643
  })
1703
- }, child.key)) : /* @__PURE__ */ jsxRuntime.jsx(Placeholder$1, {
1644
+ }, child.key)) : /* @__PURE__ */ jsxRuntime.jsx(Placeholder$2, {
1704
1645
  hide: hidePlaceholder
1705
1646
  })
1706
1647
  })
1707
1648
  }, key == null ? void 0 : key.container);
1708
1649
  });
1709
- function registerComponent$a(runtime) {
1650
+ function registerComponent$c(runtime) {
1710
1651
  return runtime.registerComponent(Box, {
1711
1652
  type: "./components/Box/index.js",
1712
1653
  label: "Box",
@@ -1971,7 +1912,7 @@ const Link = React.forwardRef(function Link2(_k, ref) {
1971
1912
  }))
1972
1913
  });
1973
1914
  });
1974
- const StyledButton = styled__default["default"](Link)`
1915
+ const StyledButton$1 = styled__default["default"](Link)`
1975
1916
  display: table;
1976
1917
  border: 0;
1977
1918
  outline: 0;
@@ -2163,7 +2104,7 @@ const StyledButton = styled__default["default"](Link)`
2163
2104
  })}
2164
2105
  ${cssTextStyle()}
2165
2106
  `;
2166
- const Button = React.forwardRef(function Button2(_m, ref) {
2107
+ const Button$1 = React.forwardRef(function Button2(_m, ref) {
2167
2108
  var _n = _m, {
2168
2109
  id,
2169
2110
  children,
@@ -2189,7 +2130,7 @@ const Button = React.forwardRef(function Button2(_m, ref) {
2189
2130
  "width",
2190
2131
  "margin"
2191
2132
  ]);
2192
- return /* @__PURE__ */ jsxRuntime.jsx(StyledButton, __spreadProps(__spreadValues({}, restOfProps), {
2133
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledButton$1, __spreadProps(__spreadValues({}, restOfProps), {
2193
2134
  ref,
2194
2135
  id,
2195
2136
  color: useColor(color),
@@ -2204,8 +2145,8 @@ const Button = React.forwardRef(function Button2(_m, ref) {
2204
2145
  children: children == null ? "Button Text" : children
2205
2146
  }));
2206
2147
  });
2207
- function registerComponent$9(runtime) {
2208
- return runtime.registerComponent(Button, {
2148
+ function registerComponent$b(runtime) {
2149
+ return runtime.registerComponent(Button$1, {
2209
2150
  type: "./components/Button/index.js",
2210
2151
  label: "Button",
2211
2152
  props: {
@@ -2300,6 +2241,10 @@ const placeholders = {
2300
2241
  image: {
2301
2242
  src: "data:image/svg+xml,%3Csvg width='360' height='240' viewBox='0 0 360 240' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg clip-path='url(%23clip0)'%3E%3Cpath d='M0 0H360V240H0V0Z' fill='%23A1A8C2' fill-opacity='0.18'/%3E%3Cpath d='M260 59C260 78.33 244.33 94 225 94C205.67 94 190 78.33 190 59C190 39.67 205.67 24 225 24C244.33 24 260 39.67 260 59Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M319 250H417L291.485 124.485C286.799 119.799 279.201 119.799 274.515 124.485L234 165L319 250Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3Cpath d='M311 250L-89 250L102.515 58.4853C107.201 53.799 114.799 53.799 119.485 58.4853L311 250Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0'%3E%3Cpath d='M0 0H360V240H0V0Z' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E%0A",
2302
2243
  dimensions: { width: 360, height: 240 }
2244
+ },
2245
+ video: {
2246
+ src: "data:image/svg+xml,%3Csvg width='712' height='400' viewBox='0 0 712 400' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M712 0H0V400H712V0ZM356 240C378.091 240 396 222.091 396 200C396 177.909 378.091 160 356 160C333.909 160 316 177.909 316 200C316 222.091 333.909 240 356 240Z' fill='%23A1A8C2' fill-opacity='0.18'/%3E%3Cpath d='M344 216.503V183.497C344 181.95 345.681 180.989 347.014 181.773L375.069 198.276C376.384 199.049 376.384 200.951 375.069 201.724L347.014 218.227C345.681 219.011 344 218.05 344 216.503Z' fill='%23A1A8C2' fill-opacity='0.4'/%3E%3C/svg%3E%0A",
2247
+ dimensions: { width: 712, height: 400 }
2303
2248
  }
2304
2249
  };
2305
2250
  function loadImage(src) {
@@ -2405,7 +2350,7 @@ const ImageComponent = React.forwardRef(function Image2({
2405
2350
  })
2406
2351
  });
2407
2352
  });
2408
- function registerComponent$8(runtime) {
2353
+ function registerComponent$a(runtime) {
2409
2354
  return runtime.registerComponent(ImageComponent, {
2410
2355
  type: "./components/Image/index.js",
2411
2356
  label: "Image",
@@ -2454,7 +2399,7 @@ const RightChevron = () => /* @__PURE__ */ jsxRuntime.jsx("svg", {
2454
2399
  strokeWidth: "2"
2455
2400
  })
2456
2401
  });
2457
- const Container$6 = styled__default["default"].div`
2402
+ const Container$b = styled__default["default"].div`
2458
2403
  position: relative;
2459
2404
  height: 100%;
2460
2405
  `;
@@ -2754,7 +2699,7 @@ const Carousel = React.forwardRef(function Carousel2({
2754
2699
  break;
2755
2700
  }
2756
2701
  },
2757
- children: [/* @__PURE__ */ jsxRuntime.jsxs(Container$6, {
2702
+ children: [/* @__PURE__ */ jsxRuntime.jsxs(Container$b, {
2758
2703
  children: [/* @__PURE__ */ jsxRuntime.jsx(ClipMask, {
2759
2704
  children: /* @__PURE__ */ jsxRuntime.jsx(Page, __spreadProps(__spreadValues({}, bindPage()), {
2760
2705
  animate: animation,
@@ -2830,7 +2775,7 @@ const Carousel = React.forwardRef(function Carousel2({
2830
2775
  })]
2831
2776
  });
2832
2777
  });
2833
- function registerComponent$7(runtime) {
2778
+ function registerComponent$9(runtime) {
2834
2779
  return runtime.registerComponent(Carousel, {
2835
2780
  type: "./components/Carousel/index.js",
2836
2781
  label: "Carousel",
@@ -2950,14 +2895,14 @@ const Block$1 = styled__default["default"].div`
2950
2895
  padding: 0.5em;
2951
2896
  font-size: 1em;
2952
2897
  `;
2953
- const Label = styled__default["default"].div`
2898
+ const Label$3 = styled__default["default"].div`
2954
2899
  margin-top: 0.25em;
2955
2900
  `;
2956
2901
  const Segment = styled__default["default"].div`
2957
2902
  flex: 1;
2958
2903
  text-align: center;
2959
2904
  `;
2960
- const Container$5 = styled__default["default"].div`
2905
+ const Container$a = styled__default["default"].div`
2961
2906
  display: flex;
2962
2907
  ${cssWidth("560px")}
2963
2908
  ${cssMargin()}
@@ -2967,7 +2912,7 @@ const Container$5 = styled__default["default"].div`
2967
2912
  return styled.css`
2968
2913
  font-size: 18px;
2969
2914
 
2970
- ${Label} {
2915
+ ${Label$3} {
2971
2916
  font-size: 14px;
2972
2917
  }
2973
2918
  `;
@@ -2975,7 +2920,7 @@ const Container$5 = styled__default["default"].div`
2975
2920
  return styled.css`
2976
2921
  font-size: 32px;
2977
2922
 
2978
- ${Label} {
2923
+ ${Label$3} {
2979
2924
  font-size: 18px;
2980
2925
  }
2981
2926
  `;
@@ -2983,7 +2928,7 @@ const Container$5 = styled__default["default"].div`
2983
2928
  return styled.css`
2984
2929
  font-size: 24px;
2985
2930
 
2986
- ${Label} {
2931
+ ${Label$3} {
2987
2932
  font-size: 16px;
2988
2933
  }
2989
2934
  `;
@@ -3120,7 +3065,7 @@ const Container$5 = styled__default["default"].div`
3120
3065
  })}
3121
3066
  }
3122
3067
 
3123
- ${Label} {
3068
+ ${Label$3} {
3124
3069
  ${(p) => cssMediaRules([p.labelColor, p.labelFont], ([labelColor = {
3125
3070
  swatch: {
3126
3071
  hue: 0,
@@ -3197,7 +3142,7 @@ const Countdown = React.forwardRef(function Countdown2({
3197
3142
  }, 1e3);
3198
3143
  return () => clearInterval(intervalId);
3199
3144
  }, [date]);
3200
- return /* @__PURE__ */ jsxRuntime.jsxs(Container$5, {
3145
+ return /* @__PURE__ */ jsxRuntime.jsxs(Container$a, {
3201
3146
  ref,
3202
3147
  id,
3203
3148
  width,
@@ -3216,7 +3161,7 @@ const Countdown = React.forwardRef(function Countdown2({
3216
3161
  children: /* @__PURE__ */ jsxRuntime.jsx("span", {
3217
3162
  children: days
3218
3163
  })
3219
- }), /* @__PURE__ */ jsxRuntime.jsx(Label, {
3164
+ }), /* @__PURE__ */ jsxRuntime.jsx(Label$3, {
3220
3165
  children: daysLabel == null ? "Days" : daysLabel
3221
3166
  })]
3222
3167
  }), /* @__PURE__ */ jsxRuntime.jsxs(Segment, {
@@ -3224,7 +3169,7 @@ const Countdown = React.forwardRef(function Countdown2({
3224
3169
  children: /* @__PURE__ */ jsxRuntime.jsx("span", {
3225
3170
  children: hours
3226
3171
  })
3227
- }), /* @__PURE__ */ jsxRuntime.jsx(Label, {
3172
+ }), /* @__PURE__ */ jsxRuntime.jsx(Label$3, {
3228
3173
  children: hoursLabel == null ? "Hours" : hoursLabel
3229
3174
  })]
3230
3175
  }), /* @__PURE__ */ jsxRuntime.jsxs(Segment, {
@@ -3232,7 +3177,7 @@ const Countdown = React.forwardRef(function Countdown2({
3232
3177
  children: /* @__PURE__ */ jsxRuntime.jsx("span", {
3233
3178
  children: minutes
3234
3179
  })
3235
- }), /* @__PURE__ */ jsxRuntime.jsx(Label, {
3180
+ }), /* @__PURE__ */ jsxRuntime.jsx(Label$3, {
3236
3181
  children: minutesLabel == null ? "Minutes" : minutesLabel
3237
3182
  })]
3238
3183
  }), /* @__PURE__ */ jsxRuntime.jsxs(Segment, {
@@ -3240,13 +3185,13 @@ const Countdown = React.forwardRef(function Countdown2({
3240
3185
  children: /* @__PURE__ */ jsxRuntime.jsx("span", {
3241
3186
  children: seconds
3242
3187
  })
3243
- }), /* @__PURE__ */ jsxRuntime.jsx(Label, {
3188
+ }), /* @__PURE__ */ jsxRuntime.jsx(Label$3, {
3244
3189
  children: secondsLabel == null ? "Seconds" : secondsLabel
3245
3190
  })]
3246
3191
  })]
3247
3192
  });
3248
3193
  });
3249
- function registerComponent$6(runtime) {
3194
+ function registerComponent$8(runtime) {
3250
3195
  return runtime.registerComponent(Countdown, {
3251
3196
  type: "./components/Countdown/index.js",
3252
3197
  label: "Countdown",
@@ -3382,7 +3327,7 @@ const IE11MinHeightContainer = styled__default["default"].div`
3382
3327
  ${cssWidth()}
3383
3328
  ${cssMargin()}
3384
3329
  `;
3385
- const Container$4 = styled__default["default"].div`
3330
+ const Container$9 = styled__default["default"].div`
3386
3331
  display: flex;
3387
3332
  flex-direction: column;
3388
3333
  justify-content: center;
@@ -3441,7 +3386,7 @@ const Divider = React.forwardRef(function Divider2({
3441
3386
  id,
3442
3387
  width,
3443
3388
  margin,
3444
- children: /* @__PURE__ */ jsxRuntime.jsx(Container$4, {
3389
+ children: /* @__PURE__ */ jsxRuntime.jsx(Container$9, {
3445
3390
  children: /* @__PURE__ */ jsxRuntime.jsx(Line, {
3446
3391
  variant,
3447
3392
  thickness,
@@ -3450,7 +3395,7 @@ const Divider = React.forwardRef(function Divider2({
3450
3395
  })
3451
3396
  });
3452
3397
  });
3453
- function registerComponent$5(runtime) {
3398
+ function registerComponent$7(runtime) {
3454
3399
  return runtime.registerComponent(Divider, {
3455
3400
  type: "./components/Divider/index.js",
3456
3401
  label: "Divider",
@@ -3500,7 +3445,7 @@ function registerComponent$5(runtime) {
3500
3445
  }
3501
3446
  });
3502
3447
  }
3503
- const Container$3 = styled__default["default"].div`
3448
+ const Container$8 = styled__default["default"].div`
3504
3449
  min-height: 15px;
3505
3450
  ${cssWidth()}
3506
3451
  ${cssMargin()}
@@ -3580,7 +3525,7 @@ const Embed = React.forwardRef(function Embed2({
3580
3525
  }, [container, html]);
3581
3526
  if (shouldRender === false)
3582
3527
  return null;
3583
- return /* @__PURE__ */ jsxRuntime.jsx(Container$3, {
3528
+ return /* @__PURE__ */ jsxRuntime.jsx(Container$8, {
3584
3529
  ref: setContainer,
3585
3530
  id,
3586
3531
  margin,
@@ -3590,7 +3535,7 @@ const Embed = React.forwardRef(function Embed2({
3590
3535
  }
3591
3536
  });
3592
3537
  });
3593
- function registerComponent$4(runtime) {
3538
+ function registerComponent$6(runtime) {
3594
3539
  return runtime.registerComponent(Embed, {
3595
3540
  type: "./components/Embed/index.js",
3596
3541
  label: "Embed",
@@ -3606,9 +3551,9 @@ function registerComponent$4(runtime) {
3606
3551
  }
3607
3552
  });
3608
3553
  }
3609
- var _path$r;
3610
- function _extends$r() {
3611
- _extends$r = Object.assign || function(target) {
3554
+ var _path$s;
3555
+ function _extends$t() {
3556
+ _extends$t = Object.assign || function(target) {
3612
3557
  for (var i = 1; i < arguments.length; i++) {
3613
3558
  var source = arguments[i];
3614
3559
  for (var key in source) {
@@ -3619,62 +3564,1840 @@ function _extends$r() {
3619
3564
  }
3620
3565
  return target;
3621
3566
  };
3622
- return _extends$r.apply(this, arguments);
3567
+ return _extends$t.apply(this, arguments);
3623
3568
  }
3624
- var SvgMobileMenu28 = function SvgMobileMenu282(props) {
3625
- return /* @__PURE__ */ React__namespace.createElement("svg", _extends$r({
3626
- xmlns: "http://www.w3.org/2000/svg",
3627
- width: 28,
3628
- height: 28
3629
- }, props), _path$r || (_path$r = /* @__PURE__ */ React__namespace.createElement("path", {
3630
- d: "M27 15H1a1 1 0 0 1-1-1 1 1 0 0 1 1-1h26a1 1 0 0 1 1 1 1 1 0 0 1-1 1zm0-10H1a1 1 0 0 0-1 1 1 1 0 0 0 1 1h26a1 1 0 0 0 1-1 1 1 0 0 0-1-1zm0 16H1a1 1 0 0 0-1 1 1 1 0 0 0 1 1h26a1 1 0 0 0 1-1 1 1 0 0 0-1-1z"
3569
+ var SvgCheck12 = function SvgCheck122(props) {
3570
+ return /* @__PURE__ */ React__namespace.createElement("svg", _extends$t({
3571
+ width: 12,
3572
+ height: 12,
3573
+ xmlns: "http://www.w3.org/2000/svg"
3574
+ }, props), _path$s || (_path$s = /* @__PURE__ */ React__namespace.createElement("path", {
3575
+ fillRule: "evenodd",
3576
+ clipRule: "evenodd",
3577
+ d: "M11.707 1.793a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414 0l-3-3a1 1 0 0 1 1.414-1.414L4 8.086l6.293-6.293a1 1 0 0 1 1.414 0Z"
3631
3578
  })));
3632
3579
  };
3633
- const GutterContainer = styled__default["default"].div`
3634
- ${(p) => cssMediaRules([p.gutter], ([gutter = {
3635
- value: 0,
3636
- unit: "px"
3637
- }]) => styled.css`
3638
- padding-left: ${p.first ? "0px" : `${gutter.value / 2}${gutter.unit}`};
3639
- padding-right: ${p.last ? "0px" : `${gutter.value / 2}${gutter.unit}`};
3580
+ const Shapes = Object.freeze({
3581
+ SQUARE: "square",
3582
+ ROUNDED: "rounded",
3583
+ PILL: "pill"
3584
+ });
3585
+ const Sizes = Object.freeze({
3586
+ SMALL: "small",
3587
+ MEDIUM: "medium",
3588
+ LARGE: "large"
3589
+ });
3590
+ const Contrasts = Object.freeze({
3591
+ LIGHT: "light",
3592
+ DARK: "dark"
3593
+ });
3594
+ const Context$1 = React.createContext({});
3595
+ function useFormContext() {
3596
+ return React.useContext(Context$1);
3597
+ }
3598
+ const { Provider } = Context$1;
3599
+ function getSizeHeight$2(size) {
3600
+ switch (size) {
3601
+ case Sizes.SMALL:
3602
+ return 30;
3603
+ case Sizes.MEDIUM:
3604
+ return 38;
3605
+ case Sizes.LARGE:
3606
+ return 48;
3607
+ default:
3608
+ throw new Error(`Invalid form size "${size}"`);
3609
+ }
3610
+ }
3611
+ function getSizeHorizontalPadding(size) {
3612
+ switch (size) {
3613
+ case Sizes.SMALL:
3614
+ return 8;
3615
+ case Sizes.MEDIUM:
3616
+ return 12;
3617
+ case Sizes.LARGE:
3618
+ return 16;
3619
+ default:
3620
+ throw new Error(`Invalid form size "${size}"`);
3621
+ }
3622
+ }
3623
+ function getSizeVerticalPadding(size) {
3624
+ switch (size) {
3625
+ case Sizes.SMALL:
3626
+ return 3;
3627
+ case Sizes.MEDIUM:
3628
+ return 7;
3629
+ case Sizes.LARGE:
3630
+ return 11;
3631
+ default:
3632
+ throw new Error(`Invalid form size "${size}"`);
3633
+ }
3634
+ }
3635
+ function getShapeBorderRadius(shape) {
3636
+ switch (shape) {
3637
+ case Shapes.SQUARE:
3638
+ return 0;
3639
+ case Shapes.ROUNDED:
3640
+ return 4;
3641
+ case Shapes.PILL:
3642
+ return 500;
3643
+ default:
3644
+ throw new Error(`Invalid form shape "${shape}"`);
3645
+ }
3646
+ }
3647
+ function getContrastBorderColor(contrast, error) {
3648
+ switch (contrast) {
3649
+ case Contrasts.LIGHT:
3650
+ return error ? "rgba(255, 0, 0, 0.7)" : "rgba(0, 0, 0, 0.25)";
3651
+ case Contrasts.DARK:
3652
+ return error ? "rgba(255, 0, 0, 0.7)" : "rgba(255, 255, 255, 0.6)";
3653
+ default:
3654
+ throw new Error(`Invalid form contrast "${contrast}"`);
3655
+ }
3656
+ }
3657
+ function getContrastBackgroundColor(contrast) {
3658
+ switch (contrast) {
3659
+ case Contrasts.LIGHT:
3660
+ return "white";
3661
+ case Contrasts.DARK:
3662
+ return "rgba(0, 0, 0, 0.7)";
3663
+ default:
3664
+ throw new Error(`Invalid form contrast "${contrast}"`);
3665
+ }
3666
+ }
3667
+ function getContrastColor$1(contrast) {
3668
+ switch (contrast) {
3669
+ case Contrasts.LIGHT:
3670
+ return "rgba(0, 0, 0, 0.95)";
3671
+ case Contrasts.DARK:
3672
+ return "white";
3673
+ default:
3674
+ throw new Error(`Invalid form contrast "${contrast}"`);
3675
+ }
3676
+ }
3677
+ function getContrastPlaceholderColor(contrast) {
3678
+ switch (contrast) {
3679
+ case Contrasts.LIGHT:
3680
+ return "rgba(0, 0, 0, 0.3)";
3681
+ case Contrasts.DARK:
3682
+ return "rgba(255,255,255,0.3)";
3683
+ default:
3684
+ throw new Error(`Invalid form contrast "${contrast}"`);
3685
+ }
3686
+ }
3687
+ function cssField() {
3688
+ return styled.css`
3689
+ display: block;
3690
+ width: 100%;
3691
+ outline: none;
3692
+ border-width: 1px;
3693
+ border-style: solid;
3694
+ transition: border-color 200ms;
3695
+ ${(props) => cssMediaRules([props.shape, props.size, props.contrast, props.brandColor], ([
3696
+ shape = Shapes.ROUNDED,
3697
+ size = Sizes.MEDIUM,
3698
+ contrast = Contrasts.LIGHT,
3699
+ brandColor = { swatch: { hue: 0, saturation: 0, lightness: 0 }, alpha: 1 }
3700
+ ]) => styled.css`
3701
+ padding: ${getSizeVerticalPadding(size)}px ${getSizeHorizontalPadding(size)}px;
3702
+ border-radius: ${getShapeBorderRadius(shape)}px;
3703
+ border-color: ${getContrastBorderColor(contrast, props.error)};
3704
+ color: ${getContrastColor$1(contrast)};
3705
+ background-color: ${getContrastBackgroundColor(contrast)};
3706
+
3707
+ :focus,
3708
+ :focus-within {
3709
+ border-color: ${colorToString(brandColor)};
3710
+ }
3711
+
3712
+ ::placeholder {
3713
+ color: ${getContrastPlaceholderColor(contrast)};
3714
+ }
3715
+ `)}
3716
+ `;
3717
+ }
3718
+ function getSizeHeight$1(size) {
3719
+ switch (size) {
3720
+ case Sizes.SMALL:
3721
+ return 36;
3722
+ case Sizes.MEDIUM:
3723
+ return 42;
3724
+ case Sizes.LARGE:
3725
+ return 48;
3726
+ default:
3727
+ throw new Error(`Invalid form size "${size}"`);
3728
+ }
3729
+ }
3730
+ const Base$2 = styled__default["default"].input`
3731
+ ${cssField()}
3732
+ ${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => styled.css`
3733
+ min-height: ${getSizeHeight$1(size)}px;
3734
+ max-height: ${getSizeHeight$1(size)}px;
3640
3735
  `)}
3641
3736
  `;
3642
- const PlaceholderLink$1 = styled__default["default"].div`
3643
- width: ${(props) => props.width}px;
3644
- height: ${(props) => props.button === true ? 32 : 8}px;
3737
+ var Input$2 = React.forwardRef(function Input2(_o, ref) {
3738
+ var _p = _o, {
3739
+ error = false,
3740
+ form
3741
+ } = _p, restOfProps = __objRest(_p, [
3742
+ "error",
3743
+ "form"
3744
+ ]);
3745
+ const {
3746
+ shape,
3747
+ size,
3748
+ contrast,
3749
+ brandColor
3750
+ } = useFormContext();
3751
+ return /* @__PURE__ */ jsxRuntime.jsx(Base$2, __spreadProps(__spreadValues({}, restOfProps), {
3752
+ ref,
3753
+ error,
3754
+ shape,
3755
+ size,
3756
+ contrast,
3757
+ brandColor
3758
+ }));
3759
+ });
3760
+ const Container$7 = styled__default["default"].div`
3761
+ display: flex;
3762
+ flex-direction: column;
3763
+ ${cssWidth()};
3764
+ ${cssMargin()};
3765
+ `;
3766
+ const Label$2 = styled__default["default"].div`
3767
+ max-width: 120px;
3768
+ min-width: 60px;
3769
+ height: 8px;
3770
+ border-radius: 2px;
3645
3771
  background-color: #a1a8c2;
3646
- border-radius: ${(props) => props.button === true ? 6 : 2}px;
3647
3772
  opacity: 0.4;
3773
+ margin-bottom: 8px;
3648
3774
  `;
3649
- const links$1 = [{
3650
- width: 50
3651
- }, {
3652
- width: 70
3653
- }, {
3654
- width: 60
3655
- }, {
3656
- width: 80,
3657
- button: true
3658
- }];
3659
- function LinksPlaceholder({
3660
- gutter
3661
- }) {
3662
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
3663
- children: links$1.map((link, i) => /* @__PURE__ */ jsxRuntime.jsx(GutterContainer, {
3664
- gutter,
3665
- first: i === 0,
3666
- last: i === links$1.length - 1,
3667
- children: /* @__PURE__ */ jsxRuntime.jsx(PlaceholderLink$1, __spreadValues({}, link))
3668
- }, i))
3775
+ const Input$1 = styled__default["default"].div`
3776
+ min-width: 80px;
3777
+ height: 32px;
3778
+ border-radius: 4px;
3779
+ border-width: 2px;
3780
+ border-style: solid;
3781
+ border-color: #a1a8c2;
3782
+ opacity: 0.4;
3783
+ `;
3784
+ const Button = styled__default["default"].div`
3785
+ min-width: 140px;
3786
+ height: 32px;
3787
+ border-radius: 4px;
3788
+ background-color: #a1a8c2;
3789
+ opacity: 0.4;
3790
+ `;
3791
+ var Placeholder$1 = React.forwardRef(function Placeholder3({
3792
+ width,
3793
+ margin
3794
+ }, ref) {
3795
+ return /* @__PURE__ */ jsxRuntime.jsxs(Container$7, {
3796
+ ref,
3797
+ width,
3798
+ margin,
3799
+ children: [/* @__PURE__ */ jsxRuntime.jsxs("div", {
3800
+ style: {
3801
+ display: "flex",
3802
+ flexDirection: "column",
3803
+ marginBottom: 16
3804
+ },
3805
+ children: [/* @__PURE__ */ jsxRuntime.jsx(Label$2, {}), /* @__PURE__ */ jsxRuntime.jsx(Input$1, {})]
3806
+ }), /* @__PURE__ */ jsxRuntime.jsxs("div", {
3807
+ style: {
3808
+ display: "flex",
3809
+ flexDirection: "column",
3810
+ marginBottom: 16
3811
+ },
3812
+ children: [/* @__PURE__ */ jsxRuntime.jsx(Label$2, {}), /* @__PURE__ */ jsxRuntime.jsx(Input$1, {})]
3813
+ }), /* @__PURE__ */ jsxRuntime.jsx("div", {
3814
+ style: {
3815
+ display: "flex",
3816
+ flexDirection: "column",
3817
+ justifyContent: "flex-end"
3818
+ },
3819
+ children: /* @__PURE__ */ jsxRuntime.jsx(Button, {})
3820
+ })]
3669
3821
  });
3822
+ });
3823
+ function getSizeHeight(size) {
3824
+ switch (size) {
3825
+ case Sizes.SMALL:
3826
+ return 14;
3827
+ case Sizes.MEDIUM:
3828
+ return 18;
3829
+ case Sizes.LARGE:
3830
+ return 22;
3831
+ default:
3832
+ throw new Error(`Invalid form size "${size}"`);
3833
+ }
3670
3834
  }
3671
- var _path$q;
3672
- function _extends$q() {
3673
- _extends$q = Object.assign || function(target) {
3674
- for (var i = 1; i < arguments.length; i++) {
3675
- var source = arguments[i];
3676
- for (var key in source) {
3677
- if (Object.prototype.hasOwnProperty.call(source, key)) {
3835
+ function getContrastColor(contrast) {
3836
+ switch (contrast) {
3837
+ case Contrasts.LIGHT:
3838
+ return "rgba(0, 0, 0, 0.8)";
3839
+ case Contrasts.DARK:
3840
+ return "rgba(255, 255, 255, 0.95)";
3841
+ default:
3842
+ throw new Error(`Invalid form contrast "${contrast}"`);
3843
+ }
3844
+ }
3845
+ const Base$1 = styled__default["default"].label`
3846
+ display: block;
3847
+ margin: 0 0 0.25em 0;
3848
+ ${cssTextStyle()}
3849
+ ${(props) => cssMediaRules([props.size, props.contrast, props.textColor], ([size = Sizes.MEDIUM, contrast = Contrasts.LIGHT, textColor]) => styled.css`
3850
+ min-height: ${getSizeHeight(size)}px;
3851
+ color: ${textColor == null ? getContrastColor(contrast) : colorToString(textColor)};
3852
+ `)}
3853
+ `;
3854
+ function Label$1(props) {
3855
+ const {
3856
+ contrast,
3857
+ size,
3858
+ labelTextStyle,
3859
+ labelTextColor
3860
+ } = useFormContext();
3861
+ return /* @__PURE__ */ jsxRuntime.jsx(Base$1, __spreadProps(__spreadValues({}, props), {
3862
+ contrast,
3863
+ size,
3864
+ textStyle: labelTextStyle,
3865
+ textColor: useColor(labelTextColor)
3866
+ }));
3867
+ }
3868
+ var SingleLineTextTableField = React.forwardRef(function SingleLineTextTableField2(_q, ref) {
3869
+ var _r = _q, {
3870
+ id,
3871
+ label = "",
3872
+ name,
3873
+ error,
3874
+ hideLabel = false
3875
+ } = _r, restOfProps = __objRest(_r, [
3876
+ "id",
3877
+ "label",
3878
+ "name",
3879
+ "error",
3880
+ "hideLabel"
3881
+ ]);
3882
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
3883
+ children: [!hideLabel && /* @__PURE__ */ jsxRuntime.jsx(Label$1, {
3884
+ htmlFor: id,
3885
+ children: label
3886
+ }), /* @__PURE__ */ jsxRuntime.jsx(Input$2, __spreadProps(__spreadValues({}, restOfProps), {
3887
+ "aria-label": label,
3888
+ ref,
3889
+ id,
3890
+ name,
3891
+ type: "text",
3892
+ error: error != null
3893
+ }))]
3894
+ });
3895
+ });
3896
+ const Base = styled__default["default"].textarea`
3897
+ resize: vertical;
3898
+ ${cssField()}
3899
+ `;
3900
+ var TextArea = React.forwardRef(function TextArea2(_s, ref) {
3901
+ var _t = _s, {
3902
+ error = false,
3903
+ form
3904
+ } = _t, restOfProps = __objRest(_t, [
3905
+ "error",
3906
+ "form"
3907
+ ]);
3908
+ const {
3909
+ shape,
3910
+ size,
3911
+ contrast,
3912
+ brandColor
3913
+ } = useFormContext();
3914
+ return /* @__PURE__ */ jsxRuntime.jsx(Base, __spreadProps(__spreadValues({}, restOfProps), {
3915
+ ref,
3916
+ rows: 4,
3917
+ error,
3918
+ shape,
3919
+ size,
3920
+ contrast,
3921
+ brandColor
3922
+ }));
3923
+ });
3924
+ var LongTextTableField = React.forwardRef(function LongTextTableField2(_u, ref) {
3925
+ var _v = _u, {
3926
+ id,
3927
+ label = "",
3928
+ error,
3929
+ hideLabel = false
3930
+ } = _v, restOfProps = __objRest(_v, [
3931
+ "id",
3932
+ "label",
3933
+ "error",
3934
+ "hideLabel"
3935
+ ]);
3936
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
3937
+ children: [!hideLabel && /* @__PURE__ */ jsxRuntime.jsx(Label$1, {
3938
+ htmlFor: id,
3939
+ children: label
3940
+ }), /* @__PURE__ */ jsxRuntime.jsx(TextArea, __spreadProps(__spreadValues({}, restOfProps), {
3941
+ "aria-label": label,
3942
+ ref,
3943
+ id,
3944
+ error: error != null
3945
+ }))]
3946
+ });
3947
+ });
3948
+ function getCheckmarkColor$1({
3949
+ swatch: {
3950
+ hue: h,
3951
+ saturation: s,
3952
+ lightness: l
3953
+ },
3954
+ alpha: a
3955
+ }) {
3956
+ return ColorHelper__default["default"]({
3957
+ h,
3958
+ s,
3959
+ l
3960
+ }).alpha(a).isLight() ? "rgba(0, 0, 0, 0.7)" : "rgba(255, 255, 255, 0.95)";
3961
+ }
3962
+ const Container$6 = styled__default["default"].div`
3963
+ position: relative;
3964
+ ${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => styled.css`
3965
+ height: ${getSizeHeight(size)}px;
3966
+ width: ${getSizeHeight(size)}px;
3967
+ `)}
3968
+ `;
3969
+ const FakeCheckbox = styled__default["default"].div`
3970
+ position: absolute;
3971
+ width: 100%;
3972
+ height: 100%;
3973
+ border-style: solid;
3974
+ border-radius: 4px;
3975
+ pointer-events: none;
3976
+ border-width: 1px;
3977
+ ${(props) => cssMediaRules([props.contrast], ([contrast = Contrasts.LIGHT]) => styled.css`
3978
+ border-color: ${getContrastBorderColor(contrast, props.error)};
3979
+ background-color: ${getContrastBackgroundColor(contrast)};
3980
+ `)}
3981
+ `;
3982
+ const HiddenCheckbox = styled__default["default"].input`
3983
+ position: absolute;
3984
+ opacity: 0;
3985
+ width: 100%;
3986
+ height: 100%;
3987
+ cursor: pointer;
3988
+
3989
+ &:disabled {
3990
+ cursor: no-drop;
3991
+
3992
+ & ~ ${FakeCheckbox} {
3993
+ opacity: 0.5;
3994
+ }
3995
+ }
3996
+
3997
+ &:checked ~ ${FakeCheckbox} {
3998
+ ${(props) => cssMediaRules([props.brandColor], ([{
3999
+ swatch = {
4000
+ hue: 0,
4001
+ saturation: 0,
4002
+ lightness: 0
4003
+ },
4004
+ alpha = 1
4005
+ } = {}]) => styled.css`
4006
+ background-color: ${colorToString({
4007
+ swatch,
4008
+ alpha
4009
+ })};
4010
+ `)}
4011
+ border-color: transparent;
4012
+
4013
+ &::after {
4014
+ content: '';
4015
+ position: absolute;
4016
+ box-sizing: content-box;
4017
+ width: 25%;
4018
+ height: 50%;
4019
+ ${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => styled.css`
4020
+ border-width: ${getSizeHeight(size) * 0.1}px;
4021
+ border-left: 0;
4022
+ border-top: 0;
4023
+ `)}
4024
+ border-style: solid;
4025
+ ${(props) => cssMediaRules([props.brandColor], ([{
4026
+ swatch = {
4027
+ hue: 0,
4028
+ saturation: 0,
4029
+ lightness: 0
4030
+ },
4031
+ alpha = 1
4032
+ } = {}]) => styled.css`
4033
+ border-color: ${getCheckmarkColor$1({
4034
+ swatch,
4035
+ alpha
4036
+ })};
4037
+ `)}
4038
+ transform: rotate(45deg) translate3d(91%, -23%, 0);
4039
+ }
4040
+ }
4041
+
4042
+ &:not(:disabled) {
4043
+ &:focus ~ ${FakeCheckbox} {
4044
+ ${(props) => cssMediaRules([props.brandColor], ([brandColor = {
4045
+ swatch: {
4046
+ hue: 0,
4047
+ saturation: 0,
4048
+ lightness: 0
4049
+ },
4050
+ alpha: 1
4051
+ }]) => styled.css`
4052
+ border-color: ${colorToString(brandColor)};
4053
+ `)}
4054
+ }
4055
+ }
4056
+
4057
+ &:not(:disabled):checked {
4058
+ &:focus ~ ${FakeCheckbox} {
4059
+ ${(props) => cssMediaRules([props.contrast], ([contrast = Contrasts.LIGHT]) => styled.css`
4060
+ border-color: ${getContrastBorderColor(contrast, props.error)};
4061
+ `)}
4062
+ }
4063
+ }
4064
+ `;
4065
+ var Checkbox = React.forwardRef(function Checkbox2(_w, ref) {
4066
+ var _x = _w, {
4067
+ error,
4068
+ className,
4069
+ style,
4070
+ form
4071
+ } = _x, restOfProps = __objRest(_x, [
4072
+ "error",
4073
+ "className",
4074
+ "style",
4075
+ "form"
4076
+ ]);
4077
+ const {
4078
+ size,
4079
+ contrast,
4080
+ brandColor
4081
+ } = useFormContext();
4082
+ return /* @__PURE__ */ jsxRuntime.jsxs(Container$6, {
4083
+ size,
4084
+ children: [/* @__PURE__ */ jsxRuntime.jsx(HiddenCheckbox, __spreadProps(__spreadValues({}, restOfProps), {
4085
+ type: "checkbox",
4086
+ ref,
4087
+ error,
4088
+ size,
4089
+ contrast,
4090
+ brandColor
4091
+ })), /* @__PURE__ */ jsxRuntime.jsx(FakeCheckbox, {
4092
+ className,
4093
+ error,
4094
+ contrast,
4095
+ style
4096
+ })]
4097
+ });
4098
+ });
4099
+ const StyledLabel$2 = styled__default["default"](Label$1)`
4100
+ display: flex;
4101
+ align-items: center;
4102
+ margin: 0;
4103
+ ${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => styled.css`
4104
+ min-height: ${getSizeHeight$1(size)}px;
4105
+ max-height: ${getSizeHeight$1(size)}px;
4106
+ `)}
4107
+ `;
4108
+ const CheckboxContainer$1 = styled__default["default"].span`
4109
+ margin-right: 8px;
4110
+ `;
4111
+ var CheckboxTableField = React.forwardRef(function CheckboxTableField2(_y, ref) {
4112
+ var _z = _y, {
4113
+ form,
4114
+ id,
4115
+ name,
4116
+ label = "",
4117
+ value = false,
4118
+ error
4119
+ } = _z, restOfProps = __objRest(_z, [
4120
+ "form",
4121
+ "id",
4122
+ "name",
4123
+ "label",
4124
+ "value",
4125
+ "error"
4126
+ ]);
4127
+ const {
4128
+ size
4129
+ } = useFormContext();
4130
+ function handleChange(event) {
4131
+ form.setFieldValue(name, event.currentTarget.checked);
4132
+ }
4133
+ return /* @__PURE__ */ jsxRuntime.jsxs(StyledLabel$2, {
4134
+ htmlFor: id,
4135
+ size,
4136
+ children: [/* @__PURE__ */ jsxRuntime.jsx(CheckboxContainer$1, {
4137
+ children: /* @__PURE__ */ jsxRuntime.jsx(Checkbox, __spreadProps(__spreadValues({}, restOfProps), {
4138
+ "aria-label": label,
4139
+ checked: value,
4140
+ onChange: handleChange,
4141
+ ref,
4142
+ id,
4143
+ error: error != null
4144
+ }))
4145
+ }), label]
4146
+ });
4147
+ });
4148
+ const MainLabel = styled__default["default"](Label$1)`
4149
+ margin: 0 0 4px 0;
4150
+ `;
4151
+ const StyledLabel$1 = styled__default["default"](Label$1)`
4152
+ display: flex;
4153
+ align-items: center;
4154
+ margin: 8px 0;
4155
+
4156
+ &:last-of-type {
4157
+ margin-bottom: 0;
4158
+ }
4159
+ `;
4160
+ const CheckboxContainer = styled__default["default"].span`
4161
+ margin-right: 8px;
4162
+ `;
4163
+ var MultipleSelectTableField = React.forwardRef(function MultipleSelectTableField2(_A, ref) {
4164
+ var _B = _A, {
4165
+ tableColumn,
4166
+ label = "",
4167
+ required,
4168
+ value = [],
4169
+ onChange,
4170
+ hideLabel = false
4171
+ } = _B, restOfProps = __objRest(_B, [
4172
+ "tableColumn",
4173
+ "label",
4174
+ "required",
4175
+ "value",
4176
+ "onChange",
4177
+ "hideLabel"
4178
+ ]);
4179
+ const handle = React.useRef({
4180
+ validity: {
4181
+ valueMissing: required === true && value.length === 0,
4182
+ typeMismatch: false
4183
+ }
4184
+ });
4185
+ React.useImperativeHandle(ref, () => handle.current, []);
4186
+ function handleChange(event) {
4187
+ handle.current.validity.valueMissing = required === true && !event.currentTarget.checked && value.filter((v) => v !== event.currentTarget.value).length === 0;
4188
+ onChange(event);
4189
+ }
4190
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", {
4191
+ children: [!hideLabel && /* @__PURE__ */ jsxRuntime.jsx(MainLabel, {
4192
+ children: label
4193
+ }), tableColumn.options.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(StyledLabel$1, {
4194
+ htmlFor: option.id,
4195
+ children: [/* @__PURE__ */ jsxRuntime.jsx(CheckboxContainer, {
4196
+ children: /* @__PURE__ */ jsxRuntime.jsx(Checkbox, __spreadProps(__spreadValues({}, restOfProps), {
4197
+ "aria-label": label,
4198
+ onChange: handleChange,
4199
+ checked: value.includes(option.name),
4200
+ id: option.id,
4201
+ value: option.name
4202
+ }))
4203
+ }), option.name]
4204
+ }, option.id))]
4205
+ });
4206
+ });
4207
+ function getCheckmarkColor({
4208
+ swatch: {
4209
+ hue: h,
4210
+ saturation: s,
4211
+ lightness: l
4212
+ } = {
4213
+ hue: 0,
4214
+ saturation: 0,
4215
+ lightness: 0
4216
+ },
4217
+ alpha: a
4218
+ }) {
4219
+ return ColorHelper__default["default"]({
4220
+ h,
4221
+ s,
4222
+ l
4223
+ }).alpha(a).isLight() ? "rgba(0, 0, 0, 0.7)" : "rgba(255, 255, 255, 0.95)";
4224
+ }
4225
+ const Container$5 = styled__default["default"].div`
4226
+ position: relative;
4227
+ ${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => styled.css`
4228
+ height: ${getSizeHeight(size)}px;
4229
+ width: ${getSizeHeight(size)}px;
4230
+ `)}
4231
+ `;
4232
+ const FakeRadioButton = styled__default["default"].div`
4233
+ position: absolute;
4234
+ width: 100%;
4235
+ height: 100%;
4236
+ border-style: solid;
4237
+ border-radius: 50%;
4238
+ pointer-events: none;
4239
+ border-width: 1px;
4240
+ ${(props) => cssMediaRules([props.contrast], ([contrast = Contrasts.LIGHT]) => styled.css`
4241
+ border-color: ${getContrastBorderColor(contrast, props.error)};
4242
+ background-color: ${getContrastBackgroundColor(contrast)};
4243
+ `)}
4244
+ `;
4245
+ const HiddenRadioButton = styled__default["default"].input.attrs({
4246
+ type: "radio"
4247
+ })`
4248
+ position: absolute;
4249
+ opacity: 0;
4250
+ width: 100%;
4251
+ height: 100%;
4252
+ cursor: pointer;
4253
+
4254
+ &:disabled {
4255
+ cursor: no-drop;
4256
+
4257
+ & ~ ${FakeRadioButton} {
4258
+ opacity: 0.5;
4259
+ }
4260
+ }
4261
+
4262
+ &:checked ~ ${FakeRadioButton} {
4263
+ ${(props) => cssMediaRules([props.brandColor], ([brandColor = {
4264
+ swatch: {
4265
+ hue: 0,
4266
+ saturation: 0,
4267
+ lightness: 0
4268
+ },
4269
+ alpha: 1
4270
+ }]) => styled.css`
4271
+ background-color: ${colorToString(brandColor)};
4272
+ `)}
4273
+ border-color: transparent;
4274
+
4275
+ &::after {
4276
+ content: '';
4277
+ position: absolute;
4278
+ box-sizing: content-box;
4279
+ top: 50%;
4280
+ left: 50%;
4281
+ width: 50%;
4282
+ height: 50%;
4283
+ border-radius: 50%;
4284
+ transform: translate(-50%, -50%);
4285
+ ${(props) => cssMediaRules([props.brandColor], ([brandColor = {
4286
+ swatch: {
4287
+ hue: 0,
4288
+ saturation: 0,
4289
+ lightness: 0
4290
+ },
4291
+ alpha: 1
4292
+ }]) => styled.css`
4293
+ background-color: ${getCheckmarkColor(brandColor)};
4294
+ `)}
4295
+ }
4296
+ }
4297
+
4298
+ &:not(:disabled) {
4299
+ &:focus ~ ${FakeRadioButton} {
4300
+ ${(props) => cssMediaRules([props.brandColor], ([brandColor = {
4301
+ swatch: {
4302
+ hue: 0,
4303
+ saturation: 0,
4304
+ lightness: 0
4305
+ },
4306
+ alpha: 1
4307
+ }]) => styled.css`
4308
+ border-color: ${colorToString(brandColor)};
4309
+ `)}
4310
+ }
4311
+ }
4312
+
4313
+ &:not(:disabled):checked {
4314
+ &:focus ~ ${FakeRadioButton} {
4315
+ ${(props) => cssMediaRules([props.contrast], ([contrast = Contrasts.LIGHT]) => styled.css`
4316
+ border-color: ${getContrastBorderColor(contrast, props.error)};
4317
+ `)}
4318
+ }
4319
+ }
4320
+ `;
4321
+ var RadioButton = React.forwardRef(function RadioButton2(_C, ref) {
4322
+ var _D = _C, {
4323
+ error,
4324
+ className,
4325
+ style,
4326
+ form
4327
+ } = _D, restOfProps = __objRest(_D, [
4328
+ "error",
4329
+ "className",
4330
+ "style",
4331
+ "form"
4332
+ ]);
4333
+ const {
4334
+ size,
4335
+ contrast,
4336
+ brandColor
4337
+ } = useFormContext();
4338
+ return /* @__PURE__ */ jsxRuntime.jsxs(Container$5, {
4339
+ size,
4340
+ children: [/* @__PURE__ */ jsxRuntime.jsx(HiddenRadioButton, __spreadProps(__spreadValues({}, restOfProps), {
4341
+ ref,
4342
+ error,
4343
+ contrast,
4344
+ brandColor
4345
+ })), /* @__PURE__ */ jsxRuntime.jsx(FakeRadioButton, {
4346
+ className,
4347
+ error,
4348
+ contrast,
4349
+ style
4350
+ })]
4351
+ });
4352
+ });
4353
+ const StyledLabel = styled__default["default"](Label$1)`
4354
+ display: flex;
4355
+ align-items: center;
4356
+ margin: 8px 0;
4357
+
4358
+ &:last-of-type {
4359
+ margin-bottom: 0;
4360
+ }
4361
+ `;
4362
+ const RadioButtonContainer = styled__default["default"].span`
4363
+ margin-right: 8px;
4364
+ `;
4365
+ var TableColumnRadioButtonGroup = React.forwardRef(function TableColumnRadioButtonGroup2(_E, ref) {
4366
+ var _F = _E, {
4367
+ tableColumn,
4368
+ label = "",
4369
+ value = "",
4370
+ required = false,
4371
+ hideLabel = false,
4372
+ onChange
4373
+ } = _F, restOfProps = __objRest(_F, [
4374
+ "tableColumn",
4375
+ "label",
4376
+ "value",
4377
+ "required",
4378
+ "hideLabel",
4379
+ "onChange"
4380
+ ]);
4381
+ const handle = React.useRef({
4382
+ validity: {
4383
+ valueMissing: required === true && value === "",
4384
+ typeMismatch: false
4385
+ }
4386
+ });
4387
+ React.useImperativeHandle(ref, () => handle.current, []);
4388
+ function handleChange(event) {
4389
+ handle.current.validity.valueMissing = required === true && !event.currentTarget.checked;
4390
+ onChange(event);
4391
+ }
4392
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", {
4393
+ children: [!hideLabel && /* @__PURE__ */ jsxRuntime.jsx(Label$1, {
4394
+ as: "p",
4395
+ children: label
4396
+ }), tableColumn.options.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(StyledLabel, {
4397
+ htmlFor: option.id,
4398
+ "aria-label": label,
4399
+ children: [/* @__PURE__ */ jsxRuntime.jsx(RadioButtonContainer, {
4400
+ children: /* @__PURE__ */ jsxRuntime.jsx(RadioButton, __spreadProps(__spreadValues({}, restOfProps), {
4401
+ onChange: handleChange,
4402
+ checked: value === option.name,
4403
+ id: option.id,
4404
+ value: option.name
4405
+ }))
4406
+ }), option.name]
4407
+ }, option.id))]
4408
+ });
4409
+ });
4410
+ const Container$4 = styled__default["default"].div`
4411
+ ${cssField()}
4412
+ display: flex;
4413
+ align-items: center;
4414
+ position: relative;
4415
+ user-select: none;
4416
+ border-color: #f19eb9;
4417
+
4418
+ &:focus,
4419
+ &:focus-within {
4420
+ border-color: #e54e7f;
4421
+ }
4422
+
4423
+ ${(props) => cssMediaRules([props.size, props.contrast], ([size = Sizes.MEDIUM, contrast = Contrasts.LIGHT]) => styled.css`
4424
+ min-height: ${getSizeHeight$2(size)}px;
4425
+ max-height: ${getSizeHeight$2(size)}px;
4426
+
4427
+ &::after {
4428
+ content: '';
4429
+ position: absolute;
4430
+ right: ${getSizeHorizontalPadding(size)}px;
4431
+ top: 50%;
4432
+ transform: translate3d(0, -25%, 0);
4433
+ border: solid 0.35em transparent;
4434
+ border-top-color: ${getContrastColor$1(contrast)};
4435
+ }
4436
+ `)}
4437
+ `;
4438
+ const Select = styled__default["default"].select`
4439
+ appearance: none;
4440
+ position: absolute;
4441
+ top: 0;
4442
+ left: 0;
4443
+ opacity: 0;
4444
+ width: 100%;
4445
+ height: 100%;
4446
+ `;
4447
+ var TableColumnSingleSelect = React.forwardRef(function TableColumnSingleSelect2(_G, ref) {
4448
+ var _H = _G, {
4449
+ id,
4450
+ tableColumn,
4451
+ value = "",
4452
+ label = "",
4453
+ error = false,
4454
+ hideLabel = false,
4455
+ form
4456
+ } = _H, restOfProps = __objRest(_H, [
4457
+ "id",
4458
+ "tableColumn",
4459
+ "value",
4460
+ "label",
4461
+ "error",
4462
+ "hideLabel",
4463
+ "form"
4464
+ ]);
4465
+ const {
4466
+ shape,
4467
+ size,
4468
+ contrast,
4469
+ brandColor
4470
+ } = useFormContext();
4471
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
4472
+ children: [!hideLabel && /* @__PURE__ */ jsxRuntime.jsx(Label$1, {
4473
+ htmlFor: id,
4474
+ children: label
4475
+ }), /* @__PURE__ */ jsxRuntime.jsxs(Container$4, {
4476
+ error,
4477
+ shape,
4478
+ size,
4479
+ contrast,
4480
+ brandColor,
4481
+ children: [/* @__PURE__ */ jsxRuntime.jsx("span", {
4482
+ children: value === "" ? "-" : value
4483
+ }), /* @__PURE__ */ jsxRuntime.jsxs(Select, __spreadProps(__spreadValues({}, restOfProps), {
4484
+ "aria-label": label,
4485
+ ref,
4486
+ id,
4487
+ value,
4488
+ children: [/* @__PURE__ */ jsxRuntime.jsx("option", {
4489
+ value: "",
4490
+ children: "-"
4491
+ }), tableColumn.options.map((option) => /* @__PURE__ */ jsxRuntime.jsx("option", {
4492
+ value: option.name,
4493
+ children: option.name
4494
+ }, option.id))]
4495
+ }))]
4496
+ })]
4497
+ });
4498
+ });
4499
+ var SingleSelectTableField = React.forwardRef(function SingleSelectTableField2(_I, ref) {
4500
+ var _J = _I, {
4501
+ type
4502
+ } = _J, restOfProps = __objRest(_J, [
4503
+ "type"
4504
+ ]);
4505
+ return type === "select" ? /* @__PURE__ */ jsxRuntime.jsx(TableColumnSingleSelect, __spreadProps(__spreadValues({}, restOfProps), {
4506
+ ref
4507
+ })) : /* @__PURE__ */ jsxRuntime.jsx(TableColumnRadioButtonGroup, __spreadProps(__spreadValues({}, restOfProps), {
4508
+ ref
4509
+ }));
4510
+ });
4511
+ var PhoneNumberTableField = React.forwardRef(function PhoneNumberTableField2(_K, ref) {
4512
+ var _L = _K, {
4513
+ id,
4514
+ label = "",
4515
+ name,
4516
+ error,
4517
+ hideLabel = false
4518
+ } = _L, restOfProps = __objRest(_L, [
4519
+ "id",
4520
+ "label",
4521
+ "name",
4522
+ "error",
4523
+ "hideLabel"
4524
+ ]);
4525
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
4526
+ children: [!hideLabel && /* @__PURE__ */ jsxRuntime.jsx(Label$1, {
4527
+ htmlFor: id,
4528
+ children: label
4529
+ }), /* @__PURE__ */ jsxRuntime.jsx(Input$2, __spreadProps(__spreadValues({}, restOfProps), {
4530
+ "aria-label": label,
4531
+ ref,
4532
+ id,
4533
+ name,
4534
+ type: "tel",
4535
+ error: error != null
4536
+ }))]
4537
+ });
4538
+ });
4539
+ var EmailTableField = React.forwardRef(function EmailTableField2(_M, ref) {
4540
+ var _N = _M, {
4541
+ id,
4542
+ label = "",
4543
+ name,
4544
+ error,
4545
+ hideLabel = false
4546
+ } = _N, restOfProps = __objRest(_N, [
4547
+ "id",
4548
+ "label",
4549
+ "name",
4550
+ "error",
4551
+ "hideLabel"
4552
+ ]);
4553
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
4554
+ children: [!hideLabel && /* @__PURE__ */ jsxRuntime.jsx(Label$1, {
4555
+ htmlFor: id,
4556
+ children: label
4557
+ }), /* @__PURE__ */ jsxRuntime.jsx(Input$2, __spreadProps(__spreadValues({}, restOfProps), {
4558
+ "aria-label": label,
4559
+ ref,
4560
+ id,
4561
+ name,
4562
+ type: "email",
4563
+ error: error != null
4564
+ }))]
4565
+ });
4566
+ });
4567
+ var URLTableField = React.forwardRef(function URLTableField2(_O, ref) {
4568
+ var _P = _O, {
4569
+ id,
4570
+ label = "",
4571
+ name,
4572
+ error,
4573
+ hideLabel = false
4574
+ } = _P, restOfProps = __objRest(_P, [
4575
+ "id",
4576
+ "label",
4577
+ "name",
4578
+ "error",
4579
+ "hideLabel"
4580
+ ]);
4581
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
4582
+ children: [!hideLabel && /* @__PURE__ */ jsxRuntime.jsx(Label$1, {
4583
+ htmlFor: id,
4584
+ children: label
4585
+ }), /* @__PURE__ */ jsxRuntime.jsx(Input$2, __spreadProps(__spreadValues({}, restOfProps), {
4586
+ "aria-label": label,
4587
+ ref,
4588
+ id,
4589
+ name,
4590
+ type: "url",
4591
+ error: error != null
4592
+ }))]
4593
+ });
4594
+ });
4595
+ var NumberTableField = React.forwardRef(function NumberTableField2(_Q, ref) {
4596
+ var _R = _Q, {
4597
+ id,
4598
+ label = "",
4599
+ name,
4600
+ error,
4601
+ hideLabel = false
4602
+ } = _R, restOfProps = __objRest(_R, [
4603
+ "id",
4604
+ "label",
4605
+ "name",
4606
+ "error",
4607
+ "hideLabel"
4608
+ ]);
4609
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
4610
+ children: [!hideLabel && /* @__PURE__ */ jsxRuntime.jsx(Label$1, {
4611
+ htmlFor: id,
4612
+ children: label
4613
+ }), /* @__PURE__ */ jsxRuntime.jsx(Input$2, __spreadProps(__spreadValues({}, restOfProps), {
4614
+ "aria-label": label,
4615
+ ref,
4616
+ id,
4617
+ name,
4618
+ type: "number",
4619
+ error: error != null
4620
+ }))]
4621
+ });
4622
+ });
4623
+ const Label = styled__default["default"].div`
4624
+ display: block;
4625
+ max-width: 120px;
4626
+ min-width: 60px;
4627
+ border-radius: 2px;
4628
+ background-color: #5f49f4;
4629
+ opacity: 0.4;
4630
+ ${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => styled.css`
4631
+ margin: calc(0.25 * ${getSizeHeight(size)}px + 2px) 0;
4632
+ min-height: ${0.5 * getSizeHeight(size)}px;
4633
+ max-height: ${0.5 * getSizeHeight(size)}px;
4634
+ `)}
4635
+ `;
4636
+ const Input = styled__default["default"].div`
4637
+ display: block;
4638
+ width: 100%;
4639
+ border-width: 2px;
4640
+ border-style: solid;
4641
+ border-color: #5f49f4;
4642
+ opacity: 0.4;
4643
+ ${(props) => cssMediaRules([props.shape, props.size], ([shape = Shapes.ROUNDED, size = Sizes.MEDIUM]) => styled.css`
4644
+ min-height: ${getSizeHeight$1(size)}px;
4645
+ max-height: ${getSizeHeight$1(size)}px;
4646
+ border-radius: ${getShapeBorderRadius(shape)}px;
4647
+ `)}
4648
+ `;
4649
+ function PlaceholderTableField() {
4650
+ const {
4651
+ size,
4652
+ shape
4653
+ } = useFormContext();
4654
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
4655
+ children: [/* @__PURE__ */ jsxRuntime.jsx(Label, {
4656
+ size
4657
+ }), /* @__PURE__ */ jsxRuntime.jsx(Input, {
4658
+ shape,
4659
+ size
4660
+ })]
4661
+ });
4662
+ }
4663
+ function getTypeMismatchErrorMessage(tableColumn, label) {
4664
+ switch ((tableColumn || {}).__typename) {
4665
+ case "PhoneNumberTableColumn":
4666
+ return `${label} field must be a valid phone number.`;
4667
+ case "EmailTableColumn":
4668
+ return `${label} field must be a valid email.`;
4669
+ case "URLTableColumn":
4670
+ return `${label} field must be a valid URL.`;
4671
+ case "NumberTableColumn":
4672
+ return `${label} field must be a valid number.`;
4673
+ case "SingleLineTextTableColumn":
4674
+ case "LongTextTableColumn":
4675
+ case "CheckboxTableColumn":
4676
+ default:
4677
+ return `${label} field is invalid.`;
4678
+ }
4679
+ }
4680
+ function getTableColumnField(tableColumn) {
4681
+ switch ((tableColumn || {}).__typename) {
4682
+ case "SingleLineTextTableColumn":
4683
+ return SingleLineTextTableField;
4684
+ case "LongTextTableColumn":
4685
+ return LongTextTableField;
4686
+ case "CheckboxTableColumn":
4687
+ return CheckboxTableField;
4688
+ case "MultipleSelectTableColumn":
4689
+ return MultipleSelectTableField;
4690
+ case "SingleSelectTableColumn":
4691
+ return SingleSelectTableField;
4692
+ case "PhoneNumberTableColumn":
4693
+ return PhoneNumberTableField;
4694
+ case "EmailTableColumn":
4695
+ return EmailTableField;
4696
+ case "URLTableColumn":
4697
+ return URLTableField;
4698
+ case "NumberTableColumn":
4699
+ return NumberTableField;
4700
+ default:
4701
+ return SingleLineTextTableField;
4702
+ }
4703
+ }
4704
+ function Field({
4705
+ tableColumn,
4706
+ tableFormField: {
4707
+ id,
4708
+ label = "",
4709
+ placeholder: placeholder2,
4710
+ required = false,
4711
+ hidden = false,
4712
+ type = "radio",
4713
+ hideLabel = false
4714
+ }
4715
+ }) {
4716
+ const TableColumnField = getTableColumnField(tableColumn);
4717
+ const input = React.useRef(null);
4718
+ if (!tableColumn)
4719
+ return /* @__PURE__ */ jsxRuntime.jsx(PlaceholderTableField, {});
4720
+ function validate() {
4721
+ let errorMessage;
4722
+ if (input.current) {
4723
+ const {
4724
+ validity = {}
4725
+ } = input.current;
4726
+ if (validity.valueMissing)
4727
+ errorMessage = `${label} is required.`;
4728
+ if (validity.typeMismatch)
4729
+ errorMessage = getTypeMismatchErrorMessage(tableColumn, label);
4730
+ }
4731
+ return errorMessage;
4732
+ }
4733
+ return /* @__PURE__ */ jsxRuntime.jsx(formik.Field, {
4734
+ name: tableColumn.name,
4735
+ validate,
4736
+ children: ({
4737
+ field,
4738
+ form
4739
+ }) => hidden ? /* @__PURE__ */ jsxRuntime.jsx("input", __spreadProps(__spreadValues({}, field), {
4740
+ ref: input,
4741
+ type: "hidden"
4742
+ })) : /* @__PURE__ */ jsxRuntime.jsx(TableColumnField, __spreadProps(__spreadValues({}, field), {
4743
+ type,
4744
+ form,
4745
+ tableColumn,
4746
+ ref: input,
4747
+ id,
4748
+ error: formik.getIn(form.touched, field.name) && formik.getIn(form.errors, field.name),
4749
+ label,
4750
+ placeholder: placeholder2,
4751
+ required,
4752
+ hideLabel
4753
+ }))
4754
+ });
4755
+ }
4756
+ var _g;
4757
+ function _extends$s() {
4758
+ _extends$s = Object.assign || function(target) {
4759
+ for (var i = 1; i < arguments.length; i++) {
4760
+ var source = arguments[i];
4761
+ for (var key in source) {
4762
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
4763
+ target[key] = source[key];
4764
+ }
4765
+ }
4766
+ }
4767
+ return target;
4768
+ };
4769
+ return _extends$s.apply(this, arguments);
4770
+ }
4771
+ var SvgSpinner20 = function SvgSpinner202(props) {
4772
+ return /* @__PURE__ */ React__namespace.createElement("svg", _extends$s({
4773
+ xmlns: "http://www.w3.org/2000/svg",
4774
+ width: 20,
4775
+ height: 20
4776
+ }, props), _g || (_g = /* @__PURE__ */ React__namespace.createElement("g", {
4777
+ fill: "none",
4778
+ strokeWidth: 2,
4779
+ transform: "translate(1 1)"
4780
+ }, /* @__PURE__ */ React__namespace.createElement("circle", {
4781
+ stroke: "currentColor",
4782
+ cx: 9,
4783
+ cy: 9,
4784
+ r: 9,
4785
+ strokeOpacity: 0.4
4786
+ }), /* @__PURE__ */ React__namespace.createElement("path", {
4787
+ d: "M9 18A9 9 0 0 0 9 0"
4788
+ }))));
4789
+ };
4790
+ const spin = styled.keyframes`
4791
+ from {
4792
+ transform: rotate(0deg);
4793
+ }
4794
+ to {
4795
+ transform: rotate(360deg);
4796
+ }
4797
+ `;
4798
+ const Icon = styled__default["default"](SvgSpinner20)`
4799
+ display: inline-flex;
4800
+ animation: ${spin} 1s linear infinite;
4801
+ stroke: currentColor;
4802
+ `;
4803
+ function Spinner() {
4804
+ return /* @__PURE__ */ jsxRuntime.jsx(Icon, {});
4805
+ }
4806
+ function useTableFormFieldRefs(propController, { fieldsCount }) {
4807
+ const [container, setContainer] = React.useState(null);
4808
+ const [items, setItems] = React.useState(Array(fieldsCount + 1).fill(null));
4809
+ const isInBuilder = useIsInBuilder();
4810
+ React.useEffect(() => {
4811
+ if (!isInBuilder)
4812
+ return;
4813
+ let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest);
4814
+ return () => {
4815
+ cancelAnimationFrame(animationFrameHandle);
4816
+ };
4817
+ function handleAnimationFrameRequest() {
4818
+ if (propController == null)
4819
+ return;
4820
+ if (container != null)
4821
+ propController.tableFormLayoutChange({ layout: boxModels.getBox(container) });
4822
+ items.map((item, index) => {
4823
+ if (item == null)
4824
+ return;
4825
+ propController.tableFormFieldLayoutChange({ index, layout: boxModels.getBox(item) });
4826
+ });
4827
+ animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest);
4828
+ }
4829
+ }, [propController, container, items, isInBuilder]);
4830
+ const itemRefs = React.useMemo(() => Array.from({ length: fieldsCount + 1 }).map((_, index) => (item) => {
4831
+ setItems((is) => [...is.slice(0, index), item, ...is.slice(index + 1)]);
4832
+ }), [fieldsCount, setItems]);
4833
+ return { container: setContainer, items: itemRefs };
4834
+ }
4835
+ const LOCAL_STORAGE_NAMESPACE = "@@makeswift/components/form";
4836
+ function getSizeFontSize(size) {
4837
+ switch (size) {
4838
+ case Sizes.SMALL:
4839
+ return 12;
4840
+ case Sizes.MEDIUM:
4841
+ return 14;
4842
+ case Sizes.LARGE:
4843
+ return 18;
4844
+ default:
4845
+ throw new Error(`Invalid form size "${size}"`);
4846
+ }
4847
+ }
4848
+ const Alignments = {
4849
+ LEFT: "left",
4850
+ CENTER: "center",
4851
+ RIGHT: "right"
4852
+ };
4853
+ const GridForm = styled__default["default"].form`
4854
+ display: flex;
4855
+ flex-wrap: wrap;
4856
+ width: 100%;
4857
+ ${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => styled.css`
4858
+ font-size: ${getSizeFontSize(size)}px;
4859
+ `)}
4860
+ ${cssWidth()}
4861
+ ${cssMargin()}
4862
+ `;
4863
+ const GridItem$1 = styled__default["default"].div`
4864
+ align-self: flex-end;
4865
+ flex-direction: column;
4866
+ ${cssGridItem()}
4867
+ `;
4868
+ function getAlignmentMargin(alignment) {
4869
+ switch (alignment) {
4870
+ case Alignments.LEFT:
4871
+ return "0 auto 0 0";
4872
+ case Alignments.RIGHT:
4873
+ return "0 0 0 auto";
4874
+ default:
4875
+ return "0 auto";
4876
+ }
4877
+ }
4878
+ const StyledButton = styled__default["default"]((props) => /* @__PURE__ */ jsxRuntime.jsx(Button$1, __spreadProps(__spreadValues({}, props), {
4879
+ as: "button"
4880
+ })))`
4881
+ display: flex;
4882
+ align-items: center;
4883
+ justify-content: center;
4884
+ ${(props) => cssMediaRules([props.size, props.alignment], ([size = Sizes.MEDIUM, alignment = Alignments.CENTER]) => styled.css`
4885
+ min-height: ${getSizeHeight$1(size)}px;
4886
+ max-height: ${getSizeHeight$1(size)}px;
4887
+ margin: ${getAlignmentMargin(alignment)};
4888
+ padding-top: 0;
4889
+ padding-bottom: 0;
4890
+ `)}
4891
+ `;
4892
+ const ErrorContainer = styled__default["default"].div`
4893
+ padding: 8px 16px;
4894
+ background-color: #f19eb9;
4895
+ border-radius: 4px;
4896
+ margin-top: 16px;
4897
+ `;
4898
+ const IconContainer = styled__default["default"].div`
4899
+ fill: currentColor;
4900
+ `;
4901
+ const ErrorMessage = styled__default["default"].p`
4902
+ font-size: 12px;
4903
+ margin: 8px 0;
4904
+ color: rgba(127, 0, 0, 0.95);
4905
+ `;
4906
+ function getTableColumnDefaultValue(tableColumn) {
4907
+ switch (tableColumn.__typename) {
4908
+ case "CheckboxTableColumn":
4909
+ return false;
4910
+ case "MultipleSelectTableColumn":
4911
+ return [];
4912
+ case "SingleLineTextTableColumn":
4913
+ case "LongTextTableColumn":
4914
+ case "SingleSelectTableColumn":
4915
+ case "PhoneNumberTableColumn":
4916
+ case "EmailTableColumn":
4917
+ case "URLTableColumn":
4918
+ case "NumberTableColumn":
4919
+ default:
4920
+ return "";
4921
+ }
4922
+ }
4923
+ const CREATE_TABLE_RECORD = client.gql`
4924
+ mutation CreateTableRecord($input: CreateTableRecordInput!) {
4925
+ createTableRecord(input: $input) {
4926
+ tableRecord {
4927
+ id
4928
+ }
4929
+ }
4930
+ }
4931
+ `;
4932
+ const Form = React.forwardRef(function Form2({
4933
+ id,
4934
+ tableId,
4935
+ fields: fieldsProp,
4936
+ submitLabel = "Submit",
4937
+ submitLink,
4938
+ shape,
4939
+ size,
4940
+ contrast,
4941
+ brandColor,
4942
+ gap,
4943
+ width,
4944
+ margin,
4945
+ submitTextStyle,
4946
+ submitVariant,
4947
+ submitTextColor,
4948
+ submitWidth,
4949
+ submitAlignment,
4950
+ labelTextStyle,
4951
+ labelTextColor
4952
+ }, ref) {
4953
+ const fields = React.useMemo(() => {
4954
+ var _a;
4955
+ return (_a = fieldsProp == null ? void 0 : fieldsProp.fields) != null ? _a : [];
4956
+ }, [fieldsProp]);
4957
+ const grid = React.useMemo(() => {
4958
+ var _a;
4959
+ return (_a = fieldsProp == null ? void 0 : fieldsProp.grid) != null ? _a : [];
4960
+ }, [fieldsProp]);
4961
+ const {
4962
+ data: {
4963
+ table
4964
+ } = {}
4965
+ } = useTable(tableId);
4966
+ const [createTableRecord] = useMutation(CREATE_TABLE_RECORD);
4967
+ const [refEl, setRefEl] = React.useState(null);
4968
+ const [propControllers, setPropControllers] = React.useState(null);
4969
+ const [initialValues, setInitialValues] = React.useState(() => fields.reduce((acc, formField) => {
4970
+ const tableColumn = table && table.columns.find((field) => field.id === formField.tableColumnId);
4971
+ const defaultValue = formField ? formField.defaultValue : null;
4972
+ if (tableColumn) {
4973
+ acc[tableColumn.name] = defaultValue == null ? getTableColumnDefaultValue(tableColumn) : defaultValue;
4974
+ }
4975
+ return acc;
4976
+ }, {}));
4977
+ const controller = propControllers == null ? void 0 : propControllers.fields;
4978
+ const {
4979
+ container,
4980
+ items
4981
+ } = useTableFormFieldRefs(controller, {
4982
+ fieldsCount: fields.length
4983
+ });
4984
+ const [isDone, setIsDone] = React.useState(false);
4985
+ const linkRef = React.useRef(null);
4986
+ React.useImperativeHandle(ref, () => ({
4987
+ getBoxModel() {
4988
+ return refEl instanceof Element ? boxModels.getBox(refEl) : null;
4989
+ },
4990
+ setPropControllers
4991
+ }), [refEl, setPropControllers]);
4992
+ React.useEffect(() => {
4993
+ container(refEl);
4994
+ }, [container, refEl]);
4995
+ React.useEffect(() => {
4996
+ if (!isDone)
4997
+ return;
4998
+ let timeoutId = setTimeout(() => setIsDone(false), 2500);
4999
+ return () => clearTimeout(timeoutId);
5000
+ }, [isDone]);
5001
+ function getTableColumn({
5002
+ tableColumnId
5003
+ }) {
5004
+ return table && table.columns.find((field) => tableColumnId === field.id);
5005
+ }
5006
+ async function handleSubmit(values, {
5007
+ setSubmitting,
5008
+ resetForm,
5009
+ setStatus
5010
+ }) {
5011
+ if (table) {
5012
+ const columns = [];
5013
+ fields.forEach((field) => {
5014
+ const tableColumn = getTableColumn(field);
5015
+ if (tableColumn) {
5016
+ const data = values[tableColumn.name];
5017
+ if (data) {
5018
+ columns.push({
5019
+ columnId: field.tableColumnId,
5020
+ data
5021
+ });
5022
+ if (field.autofill) {
5023
+ localStorage.setItem(`${LOCAL_STORAGE_NAMESPACE}/${tableColumn.name}`, JSON.stringify(data));
5024
+ }
5025
+ }
5026
+ }
5027
+ });
5028
+ try {
5029
+ await createTableRecord({
5030
+ variables: {
5031
+ input: {
5032
+ data: {
5033
+ tableId: table.id,
5034
+ columns
5035
+ }
5036
+ }
5037
+ }
5038
+ });
5039
+ setIsDone(true);
5040
+ setInitialValues((prev) => fields.reduce((acc, field) => {
5041
+ const tableColumn = getTableColumn(field);
5042
+ if (tableColumn) {
5043
+ const data = values[tableColumn.name];
5044
+ if (data && field.autofill)
5045
+ return __spreadProps(__spreadValues({}, acc), {
5046
+ [tableColumn.name]: data
5047
+ });
5048
+ }
5049
+ return acc;
5050
+ }, __spreadValues({}, prev)));
5051
+ resetForm();
5052
+ if (linkRef.current != null)
5053
+ linkRef.current.click();
5054
+ } catch (error) {
5055
+ setStatus({
5056
+ error: "An unexpected error has occurred, please try again later"
5057
+ });
5058
+ } finally {
5059
+ setSubmitting(false);
5060
+ }
5061
+ }
5062
+ }
5063
+ React.useEffect(() => {
5064
+ setInitialValues((prev) => fields.reduce((acc, formField) => {
5065
+ const tableColumn = table && table.columns.find((field) => field.id === formField.tableColumnId);
5066
+ if (tableColumn && formField.autofill) {
5067
+ const storedValue = localStorage.getItem(`${LOCAL_STORAGE_NAMESPACE}/${tableColumn.name}`);
5068
+ if (storedValue) {
5069
+ try {
5070
+ acc[tableColumn.name] = JSON.parse(storedValue);
5071
+ } catch (e) {
5072
+ }
5073
+ }
5074
+ }
5075
+ return acc;
5076
+ }, __spreadValues({}, prev)));
5077
+ }, [fields, table]);
5078
+ const brandColorData = useColor(brandColor);
5079
+ return /* @__PURE__ */ jsxRuntime.jsx(Provider, {
5080
+ value: {
5081
+ shape,
5082
+ size,
5083
+ contrast,
5084
+ brandColor: brandColorData,
5085
+ labelTextStyle,
5086
+ labelTextColor
5087
+ },
5088
+ children: tableId == null ? /* @__PURE__ */ jsxRuntime.jsx(Placeholder$1, {
5089
+ ref: setRefEl,
5090
+ width,
5091
+ margin
5092
+ }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
5093
+ children: /* @__PURE__ */ jsxRuntime.jsx(formik.Formik, {
5094
+ onSubmit: handleSubmit,
5095
+ initialValues,
5096
+ initialStatus: {
5097
+ error: null
5098
+ },
5099
+ enableReinitialize: true,
5100
+ children: (formik$1) => {
5101
+ const error = formik$1.status && formik$1.status.error;
5102
+ const errors = fields.map((field) => {
5103
+ const tableColumn = getTableColumn(field);
5104
+ return tableColumn && formik.getIn(formik$1.touched, tableColumn.name) && formik.getIn(formik$1.errors, tableColumn.name);
5105
+ }).filter((message) => typeof message === "string");
5106
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
5107
+ children: [/* @__PURE__ */ jsxRuntime.jsxs(GridForm, {
5108
+ ref: setRefEl,
5109
+ id,
5110
+ width,
5111
+ margin,
5112
+ size,
5113
+ onSubmit: formik$1.handleSubmit,
5114
+ onReset: formik$1.handleReset,
5115
+ noValidate: true,
5116
+ children: [fields.map((field, index) => {
5117
+ const tableColumn = getTableColumn(field);
5118
+ return /* @__PURE__ */ jsxRuntime.jsx(GridItem$1, {
5119
+ ref: items[index],
5120
+ grid,
5121
+ index,
5122
+ rowGap: gap,
5123
+ columnGap: gap,
5124
+ children: /* @__PURE__ */ jsxRuntime.jsx(Field, {
5125
+ tableColumn,
5126
+ tableFormField: field
5127
+ })
5128
+ }, field.id);
5129
+ }), /* @__PURE__ */ jsxRuntime.jsxs(GridItem$1, {
5130
+ ref: items[fields.length],
5131
+ grid,
5132
+ index: fields.length,
5133
+ rowGap: gap,
5134
+ columnGap: gap,
5135
+ children: [/* @__PURE__ */ jsxRuntime.jsx(StyledButton, {
5136
+ type: "submit",
5137
+ disabled: formik$1.isSubmitting || isDone,
5138
+ shape,
5139
+ size,
5140
+ color: brandColor,
5141
+ variant: submitVariant,
5142
+ textColor: submitTextColor,
5143
+ width: submitWidth,
5144
+ alignment: submitAlignment,
5145
+ textStyle: submitTextStyle,
5146
+ children: formik$1.isSubmitting ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) : isDone ? /* @__PURE__ */ jsxRuntime.jsx(IconContainer, {
5147
+ children: /* @__PURE__ */ jsxRuntime.jsx(SvgCheck12, {})
5148
+ }) : submitLabel
5149
+ }), (errors.length > 0 || error) && /* @__PURE__ */ jsxRuntime.jsxs(ErrorContainer, {
5150
+ children: [errors.map((message) => /* @__PURE__ */ jsxRuntime.jsx(ErrorMessage, {
5151
+ children: message
5152
+ }, message)), error != null && /* @__PURE__ */ jsxRuntime.jsx(ErrorMessage, {
5153
+ children: error
5154
+ })]
5155
+ })]
5156
+ })]
5157
+ }), submitLink != null && /* @__PURE__ */ jsxRuntime.jsx(Link, {
5158
+ ref: linkRef,
5159
+ hidden: true,
5160
+ link: submitLink
5161
+ })]
5162
+ });
5163
+ }
5164
+ })
5165
+ })
5166
+ });
5167
+ });
5168
+ function registerComponent$5(runtime) {
5169
+ return runtime.registerComponent(Form, {
5170
+ type: "./components/Form/index.js",
5171
+ label: "Form",
5172
+ icon: "Form40",
5173
+ props: {
5174
+ id: descriptors.ElementID(),
5175
+ tableId: descriptors.Table(),
5176
+ fields: descriptors.TableFormFields(),
5177
+ submitLink: descriptors.Link({
5178
+ label: "Redirect to",
5179
+ options: [{
5180
+ value: "OPEN_PAGE",
5181
+ label: "Open page"
5182
+ }, {
5183
+ value: "OPEN_URL",
5184
+ label: "Open URL"
5185
+ }]
5186
+ }),
5187
+ gap: descriptors.GapY({
5188
+ preset: [{
5189
+ deviceId: "desktop",
5190
+ value: {
5191
+ value: 10,
5192
+ unit: "px"
5193
+ }
5194
+ }],
5195
+ label: "Gap",
5196
+ defaultValue: {
5197
+ value: 0,
5198
+ unit: "px"
5199
+ }
5200
+ }),
5201
+ shape: descriptors.ResponsiveIconRadioGroup({
5202
+ label: "Shape",
5203
+ options: [{
5204
+ label: "Pill",
5205
+ value: Shapes.PILL,
5206
+ icon: "ButtonPill16"
5207
+ }, {
5208
+ label: "Rounded",
5209
+ value: Shapes.ROUNDED,
5210
+ icon: "ButtonRounded16"
5211
+ }, {
5212
+ label: "Square",
5213
+ value: Shapes.SQUARE,
5214
+ icon: "ButtonSquare16"
5215
+ }],
5216
+ defaultValue: Shapes.ROUNDED
5217
+ }),
5218
+ size: descriptors.ResponsiveIconRadioGroup({
5219
+ label: "Size",
5220
+ options: [{
5221
+ label: "Small",
5222
+ value: Sizes.SMALL,
5223
+ icon: "SizeSmall16"
5224
+ }, {
5225
+ label: "Medium",
5226
+ value: Sizes.MEDIUM,
5227
+ icon: "SizeMedium16"
5228
+ }, {
5229
+ label: "Large",
5230
+ value: Sizes.LARGE,
5231
+ icon: "SizeLarge16"
5232
+ }],
5233
+ defaultValue: Sizes.MEDIUM
5234
+ }),
5235
+ contrast: descriptors.ResponsiveIconRadioGroup({
5236
+ label: "Color",
5237
+ options: [{
5238
+ label: "Light mode",
5239
+ value: Contrasts.LIGHT,
5240
+ icon: "Sun16"
5241
+ }, {
5242
+ label: "Dark mode",
5243
+ value: Contrasts.DARK,
5244
+ icon: "Moon16"
5245
+ }],
5246
+ defaultValue: Contrasts.LIGHT
5247
+ }),
5248
+ labelTextStyle: descriptors.TextStyle({
5249
+ label: "Label text style"
5250
+ }),
5251
+ labelTextColor: descriptors.ResponsiveColor({
5252
+ label: "Label text color"
5253
+ }),
5254
+ submitTextStyle: descriptors.TextStyle({
5255
+ label: "Button text style"
5256
+ }),
5257
+ brandColor: descriptors.ResponsiveColor({
5258
+ label: "Button color",
5259
+ placeholder: "black"
5260
+ }),
5261
+ submitTextColor: descriptors.ResponsiveColor({
5262
+ label: "Button text color",
5263
+ placeholder: "white"
5264
+ }),
5265
+ submitLabel: descriptors.TextInput({
5266
+ label: "Button label",
5267
+ placeholder: "Submit"
5268
+ }),
5269
+ submitVariant: descriptors.ResponsiveSelect({
5270
+ label: "Button style",
5271
+ options: [{
5272
+ value: "flat",
5273
+ label: "Flat"
5274
+ }, {
5275
+ value: "outline",
5276
+ label: "Outline"
5277
+ }, {
5278
+ value: "shadow",
5279
+ label: "Floating"
5280
+ }, {
5281
+ value: "clear",
5282
+ label: "Clear"
5283
+ }, {
5284
+ value: "blocky",
5285
+ label: "Blocky"
5286
+ }, {
5287
+ value: "bubbly",
5288
+ label: "Bubbly"
5289
+ }, {
5290
+ value: "skewed",
5291
+ label: "Skewed"
5292
+ }],
5293
+ defaultValue: "flat"
5294
+ }),
5295
+ submitWidth: descriptors.ResponsiveLength({
5296
+ label: "Button width"
5297
+ }),
5298
+ submitAlignment: descriptors.ResponsiveIconRadioGroup({
5299
+ label: "Button alignment",
5300
+ options: [{
5301
+ label: "Left",
5302
+ value: Alignments.LEFT,
5303
+ icon: "AlignLeft16"
5304
+ }, {
5305
+ label: "Center",
5306
+ value: Alignments.CENTER,
5307
+ icon: "AlignCenter16"
5308
+ }, {
5309
+ label: "Right",
5310
+ value: Alignments.RIGHT,
5311
+ icon: "AlignRight16"
5312
+ }],
5313
+ defaultValue: Alignments.CENTER
5314
+ }),
5315
+ width: descriptors.Width({
5316
+ preset: [{
5317
+ deviceId: "desktop",
5318
+ value: {
5319
+ value: 550,
5320
+ unit: "px"
5321
+ }
5322
+ }],
5323
+ defaultValue: {
5324
+ value: 100,
5325
+ unit: "%"
5326
+ }
5327
+ }),
5328
+ margin: descriptors.Margin()
5329
+ }
5330
+ });
5331
+ }
5332
+ var _path$r;
5333
+ function _extends$r() {
5334
+ _extends$r = Object.assign || function(target) {
5335
+ for (var i = 1; i < arguments.length; i++) {
5336
+ var source = arguments[i];
5337
+ for (var key in source) {
5338
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
5339
+ target[key] = source[key];
5340
+ }
5341
+ }
5342
+ }
5343
+ return target;
5344
+ };
5345
+ return _extends$r.apply(this, arguments);
5346
+ }
5347
+ var SvgMobileMenu28 = function SvgMobileMenu282(props) {
5348
+ return /* @__PURE__ */ React__namespace.createElement("svg", _extends$r({
5349
+ xmlns: "http://www.w3.org/2000/svg",
5350
+ width: 28,
5351
+ height: 28
5352
+ }, props), _path$r || (_path$r = /* @__PURE__ */ React__namespace.createElement("path", {
5353
+ d: "M27 15H1a1 1 0 0 1-1-1 1 1 0 0 1 1-1h26a1 1 0 0 1 1 1 1 1 0 0 1-1 1zm0-10H1a1 1 0 0 0-1 1 1 1 0 0 0 1 1h26a1 1 0 0 0 1-1 1 1 0 0 0-1-1zm0 16H1a1 1 0 0 0-1 1 1 1 0 0 0 1 1h26a1 1 0 0 0 1-1 1 1 0 0 0-1-1z"
5354
+ })));
5355
+ };
5356
+ const GutterContainer = styled__default["default"].div`
5357
+ ${(p) => cssMediaRules([p.gutter], ([gutter = {
5358
+ value: 0,
5359
+ unit: "px"
5360
+ }]) => styled.css`
5361
+ padding-left: ${p.first ? "0px" : `${gutter.value / 2}${gutter.unit}`};
5362
+ padding-right: ${p.last ? "0px" : `${gutter.value / 2}${gutter.unit}`};
5363
+ `)}
5364
+ `;
5365
+ const PlaceholderLink$1 = styled__default["default"].div`
5366
+ width: ${(props) => props.width}px;
5367
+ height: ${(props) => props.button === true ? 32 : 8}px;
5368
+ background-color: #a1a8c2;
5369
+ border-radius: ${(props) => props.button === true ? 6 : 2}px;
5370
+ opacity: 0.4;
5371
+ `;
5372
+ const links$1 = [{
5373
+ width: 50
5374
+ }, {
5375
+ width: 70
5376
+ }, {
5377
+ width: 60
5378
+ }, {
5379
+ width: 80,
5380
+ button: true
5381
+ }];
5382
+ function LinksPlaceholder({
5383
+ gutter
5384
+ }) {
5385
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
5386
+ children: links$1.map((link, i) => /* @__PURE__ */ jsxRuntime.jsx(GutterContainer, {
5387
+ gutter,
5388
+ first: i === 0,
5389
+ last: i === links$1.length - 1,
5390
+ children: /* @__PURE__ */ jsxRuntime.jsx(PlaceholderLink$1, __spreadValues({}, link))
5391
+ }, i))
5392
+ });
5393
+ }
5394
+ var _path$q;
5395
+ function _extends$q() {
5396
+ _extends$q = Object.assign || function(target) {
5397
+ for (var i = 1; i < arguments.length; i++) {
5398
+ var source = arguments[i];
5399
+ for (var key in source) {
5400
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
3678
5401
  target[key] = source[key];
3679
5402
  }
3680
5403
  }
@@ -3835,22 +5558,22 @@ const StyledDropDownItem = styled__default["default"](Link)`
3835
5558
  background-color: rgba(0, 0, 0, 0.04);
3836
5559
  }
3837
5560
  `;
3838
- function DropDownItem$1(_o) {
3839
- var _p = _o, {
5561
+ function DropDownItem$1(_S) {
5562
+ var _T = _S, {
3840
5563
  color
3841
- } = _p, restOfProps = __objRest(_p, [
5564
+ } = _T, restOfProps = __objRest(_T, [
3842
5565
  "color"
3843
5566
  ]);
3844
5567
  return /* @__PURE__ */ jsxRuntime.jsx(StyledDropDownItem, __spreadProps(__spreadValues({}, restOfProps), {
3845
5568
  color: useColor(color)
3846
5569
  }));
3847
5570
  }
3848
- function DropDownButton(_q) {
3849
- var _r = _q, {
5571
+ function DropDownButton(_U) {
5572
+ var _V = _U, {
3850
5573
  label,
3851
5574
  caret = "caret",
3852
5575
  links: links2 = []
3853
- } = _r, restOfProps = __objRest(_r, [
5576
+ } = _V, restOfProps = __objRest(_V, [
3854
5577
  "label",
3855
5578
  "caret",
3856
5579
  "links"
@@ -3866,7 +5589,7 @@ function DropDownButton(_q) {
3866
5589
  }, [setPosition]);
3867
5590
  return /* @__PURE__ */ jsxRuntime.jsxs(DropDownContainer, {
3868
5591
  ref: container,
3869
- children: [/* @__PURE__ */ jsxRuntime.jsx(Button, __spreadProps(__spreadValues({}, restOfProps), {
5592
+ children: [/* @__PURE__ */ jsxRuntime.jsx(Button$1, __spreadProps(__spreadValues({}, restOfProps), {
3870
5593
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
3871
5594
  style: {
3872
5595
  display: "flex",
@@ -3927,7 +5650,7 @@ const DropDownMenu = styled__default["default"].div`
3927
5650
  flex-direction: column;
3928
5651
  padding: 8px;
3929
5652
  `;
3930
- const ButtonLink$1 = styled__default["default"](Button)`
5653
+ const ButtonLink$1 = styled__default["default"](Button$1)`
3931
5654
  margin: 8px 0;
3932
5655
  `;
3933
5656
  const StyledLink$2 = styled__default["default"](Link)`
@@ -3940,24 +5663,24 @@ const StyledLink$2 = styled__default["default"](Link)`
3940
5663
  color: ${color == null ? "black" : colorToString(color)};
3941
5664
  `)}
3942
5665
  `;
3943
- function DropDownItem(_s) {
3944
- var _t = _s, {
5666
+ function DropDownItem(_W) {
5667
+ var _X = _W, {
3945
5668
  color
3946
- } = _t, restOfProps = __objRest(_t, [
5669
+ } = _X, restOfProps = __objRest(_X, [
3947
5670
  "color"
3948
5671
  ]);
3949
5672
  return /* @__PURE__ */ jsxRuntime.jsx(StyledLink$2, __spreadProps(__spreadValues({}, restOfProps), {
3950
5673
  color: useColor(color)
3951
5674
  }));
3952
5675
  }
3953
- function MobileDropDownButton(_u) {
3954
- var _v = _u, {
5676
+ function MobileDropDownButton(_Y) {
5677
+ var _Z = _Y, {
3955
5678
  label,
3956
5679
  caret,
3957
5680
  links: links2 = [],
3958
5681
  onClose = () => {
3959
5682
  }
3960
- } = _v, restOfProps = __objRest(_v, [
5683
+ } = _Z, restOfProps = __objRest(_Z, [
3961
5684
  "label",
3962
5685
  "caret",
3963
5686
  "links",
@@ -3999,10 +5722,10 @@ function MobileDropDownButton(_u) {
3999
5722
  })]
4000
5723
  });
4001
5724
  }
4002
- const ButtonLink = styled__default["default"](Button)`
5725
+ const ButtonLink = styled__default["default"](Button$1)`
4003
5726
  margin: 8px 0;
4004
5727
  `;
4005
- const Container$2 = styled__default["default"].div`
5728
+ const Container$3 = styled__default["default"].div`
4006
5729
  position: fixed;
4007
5730
  flex-direction: column;
4008
5731
  width: 100%;
@@ -4056,7 +5779,7 @@ function MobileMenu({
4056
5779
  onClose = () => {
4057
5780
  }
4058
5781
  }) {
4059
- return /* @__PURE__ */ jsxRuntime.jsxs(Container$2, {
5782
+ return /* @__PURE__ */ jsxRuntime.jsxs(Container$3, {
4060
5783
  animation,
4061
5784
  backgroundColor: useColor(backgroundColor),
4062
5785
  open,
@@ -4082,7 +5805,7 @@ function MobileMenu({
4082
5805
  })]
4083
5806
  });
4084
5807
  }
4085
- const Container$1 = styled__default["default"].nav`
5808
+ const Container$2 = styled__default["default"].nav`
4086
5809
  display: flex;
4087
5810
  align-items: center;
4088
5811
  ${cssWidth()}
@@ -4139,7 +5862,7 @@ const Navigation = React.forwardRef(function Navigation2({
4139
5862
  margin
4140
5863
  }, ref) {
4141
5864
  const [isOpen, setIsOpen] = React.useState(false);
4142
- return /* @__PURE__ */ jsxRuntime.jsxs(Container$1, {
5865
+ return /* @__PURE__ */ jsxRuntime.jsxs(Container$2, {
4143
5866
  ref,
4144
5867
  id,
4145
5868
  margin,
@@ -4164,7 +5887,7 @@ const Navigation = React.forwardRef(function Navigation2({
4164
5887
  gutter,
4165
5888
  first: i === 0,
4166
5889
  last: i === links2.length - 1,
4167
- children: [link.type === "button" && /* @__PURE__ */ jsxRuntime.jsx(Button, __spreadProps(__spreadValues({}, link.payload), {
5890
+ children: [link.type === "button" && /* @__PURE__ */ jsxRuntime.jsx(Button$1, __spreadProps(__spreadValues({}, link.payload), {
4168
5891
  children: link.payload.label
4169
5892
  })), link.type === "dropdown" && /* @__PURE__ */ jsxRuntime.jsx(DropDownButton, __spreadValues({}, link.payload))]
4170
5893
  }, link.id)) : /* @__PURE__ */ jsxRuntime.jsx(LinksPlaceholder, {
@@ -4187,7 +5910,7 @@ const Navigation = React.forwardRef(function Navigation2({
4187
5910
  })]
4188
5911
  });
4189
5912
  });
4190
- function registerComponent$3(runtime) {
5913
+ function registerComponent$4(runtime) {
4191
5914
  return runtime.registerComponent(Navigation, {
4192
5915
  type: "./components/Navigation/index.js",
4193
5916
  label: "Navigation",
@@ -4291,7 +6014,7 @@ const PlaceholderBase = styled__default["default"].div`
4291
6014
  height: 80px;
4292
6015
  padding: 8px;
4293
6016
  `;
4294
- var Placeholder = React.forwardRef(function Placeholder3(props, ref) {
6017
+ var Placeholder = React.forwardRef(function Placeholder4(props, ref) {
4295
6018
  return /* @__PURE__ */ jsxRuntime.jsx(PlaceholderBase, __spreadProps(__spreadValues({}, props), {
4296
6019
  ref,
4297
6020
  children: /* @__PURE__ */ jsxRuntime.jsx("svg", {
@@ -4364,7 +6087,7 @@ const Root = React.forwardRef(function Page2({
4364
6087
  })]
4365
6088
  });
4366
6089
  });
4367
- function registerComponent$2(runtime) {
6090
+ function registerComponent$3(runtime) {
4368
6091
  return runtime.registerComponent(Root, {
4369
6092
  type: "./components/Root/index.js",
4370
6093
  label: "Page",
@@ -5041,7 +6764,7 @@ function SocialLinksPlaceholder({
5041
6764
  }, link.id))
5042
6765
  });
5043
6766
  }
5044
- const Container = styled__default["default"].div`
6767
+ const Container$1 = styled__default["default"].div`
5045
6768
  display: flex;
5046
6769
  flex-direction: row;
5047
6770
  flex-wrap: wrap;
@@ -5125,7 +6848,7 @@ const SocialLinks = React.forwardRef(function SocialLinks2({
5125
6848
  }, ref) {
5126
6849
  const fillData = useColor(fill);
5127
6850
  const backgroundColorData = useColor(backgroundColor);
5128
- return /* @__PURE__ */ jsxRuntime.jsx(Container, {
6851
+ return /* @__PURE__ */ jsxRuntime.jsx(Container$1, {
5129
6852
  ref,
5130
6853
  id,
5131
6854
  alignment,
@@ -5161,7 +6884,7 @@ const SocialLinks = React.forwardRef(function SocialLinks2({
5161
6884
  })
5162
6885
  });
5163
6886
  });
5164
- function registerComponent$1(runtime) {
6887
+ function registerComponent$2(runtime) {
5165
6888
  return runtime.registerComponent(SocialLinks, {
5166
6889
  type: "./components/SocialLinks/index.js",
5167
6890
  label: "Social Links",
@@ -5409,10 +7132,10 @@ const Span = styled__default["default"].span`
5409
7132
  `}
5410
7133
  `, shallowMergeFallbacks)}
5411
7134
  `;
5412
- function Mark(_w) {
5413
- var _x = _w, {
7135
+ function Mark(__) {
7136
+ var _$ = __, {
5414
7137
  value
5415
- } = _x, restOfProps = __objRest(_x, [
7138
+ } = _$, restOfProps = __objRest(_$, [
5416
7139
  "value"
5417
7140
  ]);
5418
7141
  const typographyStyle = useTypographyMark(value);
@@ -5450,10 +7173,10 @@ const StyledBlock = styled__default["default"].div`
5450
7173
  border-left: 5px solid rgba(0, 0, 0, 0.1);
5451
7174
  ` : ""}
5452
7175
  `;
5453
- var Block = React.forwardRef(function Block2(_y, ref) {
5454
- var _z = _y, {
7176
+ var Block = React.forwardRef(function Block2(_aa, ref) {
7177
+ var _ba = _aa, {
5455
7178
  textAlign
5456
- } = _z, restOfProps = __objRest(_z, [
7179
+ } = _ba, restOfProps = __objRest(_ba, [
5457
7180
  "textAlign"
5458
7181
  ]);
5459
7182
  return /* @__PURE__ */ jsxRuntime.jsx(StyledBlock, __spreadProps(__spreadValues({}, restOfProps), {
@@ -5578,10 +7301,10 @@ function Inlines() {
5578
7301
  }
5579
7302
  };
5580
7303
  }
5581
- const RichTextEditor = styled__default["default"](React.forwardRef(function RichTextEditor2(_A, ref) {
5582
- var _B = _A, {
7304
+ const RichTextEditor = styled__default["default"](React.forwardRef(function RichTextEditor2(_ca, ref) {
7305
+ var _da = _ca, {
5583
7306
  placeholder: placeholder2 = "Write some text..."
5584
- } = _B, restOfProps = __objRest(_B, [
7307
+ } = _da, restOfProps = __objRest(_da, [
5585
7308
  "placeholder"
5586
7309
  ]);
5587
7310
  const plugins = React.useMemo(() => [Lists__default["default"](), LinkPlugin(), Inlines(), DeviceOverridesBlockPlugin(), DeviceOverridesMarksPlugin()], []);
@@ -5698,7 +7421,7 @@ const Text = React.forwardRef(function Text2({
5698
7421
  onKeyDown: handleKeyDown
5699
7422
  });
5700
7423
  });
5701
- function registerComponent(runtime) {
7424
+ function registerComponent$1(runtime) {
5702
7425
  return runtime.registerComponent(Text, {
5703
7426
  type: "./components/Text/index.js",
5704
7427
  label: "Text",
@@ -5776,18 +7499,103 @@ function registerComponent(runtime) {
5776
7499
  }
5777
7500
  });
5778
7501
  }
7502
+ const Container = styled__default["default"].div`
7503
+ display: flex;
7504
+ flex-direction: column;
7505
+ overflow: hidden;
7506
+ ${cssWidth("560px")}
7507
+ ${cssMargin()}
7508
+ ${cssBorderRadius()}
7509
+ `;
7510
+ const ASPECT_RATIO = 16 / 9;
7511
+ const Video = React.forwardRef(function Video2({
7512
+ id,
7513
+ video,
7514
+ width,
7515
+ margin,
7516
+ borderRadius
7517
+ }, ref) {
7518
+ const canPlayUrl = video && video.url != null && ReactPlayer__default["default"].canPlay(video.url);
7519
+ return /* @__PURE__ */ jsxRuntime.jsx(Container, {
7520
+ ref,
7521
+ id,
7522
+ width,
7523
+ margin,
7524
+ borderRadius,
7525
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", {
7526
+ style: {
7527
+ position: "relative",
7528
+ paddingTop: `${100 / ASPECT_RATIO}%`
7529
+ },
7530
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", {
7531
+ style: {
7532
+ position: "absolute",
7533
+ top: 0,
7534
+ left: 0,
7535
+ right: 0,
7536
+ bottom: 0
7537
+ },
7538
+ children: canPlayUrl === true ? /* @__PURE__ */ jsxRuntime.jsx(ReactPlayer__default["default"], __spreadProps(__spreadValues({}, video), {
7539
+ width: "100%",
7540
+ height: "100%",
7541
+ config: {
7542
+ vimeo: {
7543
+ playerOptions: {
7544
+ background: video != null && !video.controls
7545
+ }
7546
+ },
7547
+ wistia: {
7548
+ options: {
7549
+ endVideoBehavior: video != null && video.loop === true ? "loop" : "default"
7550
+ }
7551
+ }
7552
+ }
7553
+ })) : /* @__PURE__ */ jsxRuntime.jsx("img", {
7554
+ width: "100%",
7555
+ src: placeholders.video.src,
7556
+ alt: "Video Placeholder"
7557
+ })
7558
+ })
7559
+ })
7560
+ });
7561
+ });
7562
+ function registerComponent(runtime) {
7563
+ return runtime.registerComponent(Video, {
7564
+ type: "./components/Video/index.js",
7565
+ label: "Video",
7566
+ icon: "Video40",
7567
+ props: {
7568
+ id: descriptors.ElementID(),
7569
+ video: descriptors.Video({
7570
+ preset: {
7571
+ controls: true
7572
+ }
7573
+ }),
7574
+ width: descriptors.Width({
7575
+ defaultValue: {
7576
+ value: 560,
7577
+ unit: "px"
7578
+ }
7579
+ }),
7580
+ margin: descriptors.Margin(),
7581
+ borderRadius: descriptors.BorderRadius()
7582
+ }
7583
+ });
7584
+ }
5779
7585
  function registerBuiltinComponents(runtime) {
5780
- const unregisterBoxComponent = registerComponent$a(runtime);
5781
- const unregisterButtonComponent = registerComponent$9(runtime);
5782
- const unregisterCarouselComponent = registerComponent$7(runtime);
5783
- const unregisterCountdownComponent = registerComponent$6(runtime);
5784
- const unregisterDividerComponent = registerComponent$5(runtime);
5785
- const unregisterEmbedComponent = registerComponent$4(runtime);
5786
- const unregisterImageComponent = registerComponent$8(runtime);
5787
- const unregisterNavigationComponent = registerComponent$3(runtime);
5788
- const unregisterRootComponent = registerComponent$2(runtime);
5789
- const unregisterSocialLinksComponent = registerComponent$1(runtime);
5790
- const unregisterTextComponent = registerComponent(runtime);
7586
+ const unregisterBoxComponent = registerComponent$c(runtime);
7587
+ const unregisterButtonComponent = registerComponent$b(runtime);
7588
+ const unregisterCarouselComponent = registerComponent$9(runtime);
7589
+ const unregisterCountdownComponent = registerComponent$8(runtime);
7590
+ const unregisterDividerComponent = registerComponent$7(runtime);
7591
+ const unregisterEmbedComponent = registerComponent$6(runtime);
7592
+ const unregisterFormComponent = registerComponent$5(runtime);
7593
+ const unregisterImageComponent = registerComponent$a(runtime);
7594
+ const unregisterNavigationComponent = registerComponent$4(runtime);
7595
+ const unregisterRootComponent = registerComponent$3(runtime);
7596
+ const unregisterSocialLinksComponent = registerComponent$2(runtime);
7597
+ const unregisterTextComponent = registerComponent$1(runtime);
7598
+ const unregisterVideoComponent = registerComponent(runtime);
5791
7599
  return () => {
5792
7600
  unregisterBoxComponent();
5793
7601
  unregisterButtonComponent();
@@ -5795,14 +7603,17 @@ function registerBuiltinComponents(runtime) {
5795
7603
  unregisterCountdownComponent();
5796
7604
  unregisterDividerComponent();
5797
7605
  unregisterEmbedComponent();
7606
+ unregisterFormComponent();
5798
7607
  unregisterImageComponent();
5799
7608
  unregisterNavigationComponent();
5800
7609
  unregisterRootComponent();
5801
7610
  unregisterSocialLinksComponent();
5802
7611
  unregisterTextComponent();
7612
+ unregisterTextComponent();
7613
+ unregisterVideoComponent();
5803
7614
  };
5804
7615
  }
5805
- const contextDefaultValue = configureStore();
7616
+ const contextDefaultValue = reactPage.configureStore();
5806
7617
  function createReactRuntime(store) {
5807
7618
  return {
5808
7619
  registerComponent(component, {
@@ -5828,39 +7639,22 @@ function createReactRuntime(store) {
5828
7639
  const ReactRuntime = createReactRuntime(contextDefaultValue);
5829
7640
  const Context = React.createContext(contextDefaultValue);
5830
7641
  function RuntimeProvider({
7642
+ client: client2,
5831
7643
  children,
5832
- defaultRootElements,
5833
- registerComponents,
5834
- makeswiftApiEndpoint
7644
+ defaultRootElements
5835
7645
  }) {
5836
7646
  const [store, setStore] = React.useState(() => {
5837
- const store2 = configureStore({
7647
+ const store2 = reactPage.configureStore({
5838
7648
  preloadedState: contextDefaultValue.getState(),
5839
7649
  rootElements: defaultRootElements
5840
7650
  });
5841
7651
  const runtime = createReactRuntime(store2);
5842
7652
  registerBuiltinComponents(runtime);
5843
- registerComponents == null ? void 0 : registerComponents(runtime);
5844
7653
  return store2;
5845
7654
  });
5846
- const [client$1, setClient] = React.useState(new client.ApolloClient({
5847
- uri: makeswiftApiEndpoint,
5848
- cache: new client.InMemoryCache()
5849
- }));
5850
- React.useEffect(() => {
5851
- setClient(({
5852
- cache
5853
- }) => new client.ApolloClient({
5854
- uri: makeswiftApiEndpoint,
5855
- cache
5856
- }));
5857
- }, [makeswiftApiEndpoint]);
5858
7655
  React.useEffect(() => {
5859
7656
  return registerBuiltinComponents(createReactRuntime(store));
5860
7657
  }, [store]);
5861
- React.useEffect(() => {
5862
- return registerComponents == null ? void 0 : registerComponents(createReactRuntime(store));
5863
- }, [store, registerComponents]);
5864
7658
  React.useEffect(() => {
5865
7659
  const isInBuilder = window.parent !== window;
5866
7660
  if (isInBuilder)
@@ -5871,10 +7665,10 @@ function RuntimeProvider({
5871
7665
  });
5872
7666
  setStore((store2) => ReactBuilderPreview.configureStore({
5873
7667
  preloadedState: store2.getState(),
5874
- client: client$1
7668
+ client: client2.apolloClient
5875
7669
  }));
5876
7670
  }
5877
- }, [client$1]);
7671
+ }, [client2]);
5878
7672
  React.useEffect(() => {
5879
7673
  const isInBuilder = window.parent !== window;
5880
7674
  if (!isInBuilder)
@@ -5898,12 +7692,31 @@ function RuntimeProvider({
5898
7692
  }, []);
5899
7693
  return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, {
5900
7694
  value: store,
5901
- children: /* @__PURE__ */ jsxRuntime.jsx(ApolloProvider, {
5902
- client: client$1,
7695
+ children: /* @__PURE__ */ jsxRuntime.jsx(MakeswiftProvider, {
7696
+ client: client2,
5903
7697
  children
5904
7698
  })
5905
7699
  });
5906
7700
  }
7701
+ const PageContext = React.createContext(null);
7702
+ function usePageIdOrNull() {
7703
+ return React.useContext(PageContext);
7704
+ }
7705
+ function usePageId() {
7706
+ const pageIdOrNull = usePageIdOrNull();
7707
+ if (pageIdOrNull == null)
7708
+ throw new Error("`usePageId` must be used with `<PageProvider>`");
7709
+ return pageIdOrNull;
7710
+ }
7711
+ function PageProvider({
7712
+ id,
7713
+ children
7714
+ }) {
7715
+ return /* @__PURE__ */ jsxRuntime.jsx(PageContext.Provider, {
7716
+ value: id,
7717
+ children
7718
+ });
7719
+ }
5907
7720
  const DocumentContext = React.createContext(null);
5908
7721
  function useDocumentKey() {
5909
7722
  return React.useContext(DocumentContext);
@@ -5913,17 +7726,17 @@ function useSelector(selector) {
5913
7726
  return withSelector.useSyncExternalStoreWithSelector(store.subscribe, store.getState, store.getState, selector);
5914
7727
  }
5915
7728
  function useComponent(type) {
5916
- return useSelector((state) => getReactComponent(state, type));
7729
+ return useSelector((state) => reactPage.getReactComponent(state, type));
5917
7730
  }
5918
7731
  function useElementId(elementKey) {
5919
7732
  const documentKey = useDocumentKey();
5920
- return useSelector((state) => documentKey == null || elementKey == null ? null : getElementId(state, documentKey, elementKey));
7733
+ return useSelector((state) => documentKey == null || elementKey == null ? null : reactPage.getElementId(state, documentKey, elementKey));
5921
7734
  }
5922
- function useDocumentRootElement(documentKey) {
5923
- return useSelector((state) => getDocumentRootElement(state, documentKey));
7735
+ function useDocument(documentKey) {
7736
+ return useSelector((state) => reactPage.getDocument(state, documentKey));
5924
7737
  }
5925
7738
  function useIsInBuilder() {
5926
- return useSelector((state) => getIsInBuilder(state));
7739
+ return useSelector((state) => reactPage.getIsInBuilder(state));
5927
7740
  }
5928
7741
  function useDispatch() {
5929
7742
  const store = React.useContext(Context);
@@ -5953,24 +7766,64 @@ const ElementData = React.memo(React.forwardRef(function ElementData2({
5953
7766
  const ElementReference = React.memo(React.forwardRef(function ElementReference2({
5954
7767
  elementReference
5955
7768
  }, ref) {
5956
- return /* @__PURE__ */ jsxRuntime.jsxs("div", {
5957
- ref,
5958
- children: [/* @__PURE__ */ jsxRuntime.jsx("p", {
5959
- children: "Not Implemented"
5960
- }), /* @__PURE__ */ jsxRuntime.jsx("pre", {
5961
- children: /* @__PURE__ */ jsxRuntime.jsx("code", {
5962
- children: JSON.stringify(elementReference, null, 2)
5963
- })
5964
- })]
7769
+ var _a;
7770
+ const {
7771
+ error,
7772
+ data
7773
+ } = useQuery(client.gql`
7774
+ query ElementReferenceGlobalElement($id: ID!) {
7775
+ globalElement(id: $id) {
7776
+ id
7777
+ data
7778
+ }
7779
+ }
7780
+ `, {
7781
+ variables: {
7782
+ id: elementReference.value
7783
+ }
7784
+ });
7785
+ const globalElementData = (_a = data == null ? void 0 : data.globalElement) == null ? void 0 : _a.data;
7786
+ const elementReferenceDocument = useDocument(elementReference.key);
7787
+ if (error != null) {
7788
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", {
7789
+ ref,
7790
+ children: [/* @__PURE__ */ jsxRuntime.jsx("p", {
7791
+ children: "Something went wrong!"
7792
+ }), /* @__PURE__ */ jsxRuntime.jsx("pre", {
7793
+ children: /* @__PURE__ */ jsxRuntime.jsx("code", {
7794
+ children: JSON.stringify(error, null, 2)
7795
+ })
7796
+ })]
7797
+ });
7798
+ }
7799
+ if (globalElementData == null) {
7800
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", {
7801
+ ref,
7802
+ children: [/* @__PURE__ */ jsxRuntime.jsx("p", {
7803
+ children: "Not Found"
7804
+ }), /* @__PURE__ */ jsxRuntime.jsx("pre", {
7805
+ children: /* @__PURE__ */ jsxRuntime.jsx("code", {
7806
+ children: JSON.stringify(elementReference, null, 2)
7807
+ })
7808
+ })]
7809
+ });
7810
+ }
7811
+ return elementReferenceDocument != null ? /* @__PURE__ */ jsxRuntime.jsx(Document, {
7812
+ document: elementReferenceDocument,
7813
+ ref
7814
+ }) : /* @__PURE__ */ jsxRuntime.jsx(ElementData, {
7815
+ elementData: globalElementData,
7816
+ ref
5965
7817
  });
5966
7818
  }));
5967
- const Element$1 = React.memo(function Element2({
7819
+ const Element$1 = React.memo(React.forwardRef(function Element2({
5968
7820
  element
5969
- }) {
7821
+ }, ref) {
5970
7822
  const elementKey = element.key;
5971
7823
  const dispatch = useDispatch();
5972
7824
  const documentKey = useDocumentKey();
5973
7825
  const [handle, setHandle] = React.useState(null);
7826
+ React.useImperativeHandle(ref, () => handle, [handle]);
5974
7827
  React.useEffect(() => {
5975
7828
  if (documentKey == null)
5976
7829
  return;
@@ -5981,40 +7834,48 @@ const Element$1 = React.memo(function Element2({
5981
7834
  return;
5982
7835
  return dispatch(actions.mountComponentEffect(documentKey, elementKey));
5983
7836
  }, [dispatch, documentKey, elementKey]);
5984
- return isElementReference(element) ? /* @__PURE__ */ jsxRuntime.jsx(ElementReference, {
7837
+ return reactPage.isElementReference(element) ? /* @__PURE__ */ jsxRuntime.jsx(ElementReference, {
5985
7838
  ref: setHandle,
5986
7839
  elementReference: element
5987
7840
  }, elementKey) : /* @__PURE__ */ jsxRuntime.jsx(ElementData, {
5988
7841
  ref: setHandle,
5989
7842
  elementData: element
5990
7843
  }, elementKey);
5991
- });
5992
- const Document = React.memo(function Document2({
5993
- documentKey
5994
- }) {
5995
- const documentRootElement = useDocumentRootElement(documentKey);
5996
- if (documentRootElement == null) {
7844
+ }));
7845
+ const Document = React.memo(React.forwardRef(function Document2({
7846
+ document
7847
+ }, ref) {
7848
+ return /* @__PURE__ */ jsxRuntime.jsx(DocumentContext.Provider, {
7849
+ value: document.key,
7850
+ children: /* @__PURE__ */ jsxRuntime.jsx(Element$1, {
7851
+ ref,
7852
+ element: document.rootElement
7853
+ })
7854
+ });
7855
+ }));
7856
+ const DocumentReference = React.memo(React.forwardRef(function DocumentReference2({
7857
+ documentReference
7858
+ }, ref) {
7859
+ const document = useDocument(documentReference.key);
7860
+ if (document == null) {
5997
7861
  return /* @__PURE__ */ jsxRuntime.jsxs("div", {
7862
+ ref,
5998
7863
  children: [/* @__PURE__ */ jsxRuntime.jsx("p", {
5999
7864
  children: "Document Not Found"
6000
7865
  }), /* @__PURE__ */ jsxRuntime.jsx("pre", {
6001
7866
  children: /* @__PURE__ */ jsxRuntime.jsx("code", {
6002
- children: JSON.stringify({
6003
- documentKey
6004
- }, null, 2)
7867
+ children: JSON.stringify(documentReference, null, 2)
6005
7868
  })
6006
7869
  })]
6007
7870
  });
6008
7871
  }
6009
- return /* @__PURE__ */ jsxRuntime.jsx(DocumentContext.Provider, {
6010
- value: documentKey,
6011
- children: /* @__PURE__ */ jsxRuntime.jsx(Element$1, {
6012
- element: documentRootElement
6013
- })
7872
+ return /* @__PURE__ */ jsxRuntime.jsx(Document, {
7873
+ ref,
7874
+ document
6014
7875
  });
6015
- });
7876
+ }));
6016
7877
  exports.Box = Box;
6017
- exports.Button = Button;
7878
+ exports.Button = Button$1;
6018
7879
  exports.Carousel = Carousel;
6019
7880
  exports.Countdown = Countdown;
6020
7881
  exports.DEFAULT_BOX_ANIMATE_DELAY = DEFAULT_BOX_ANIMATE_DELAY;
@@ -6025,17 +7886,19 @@ exports.DEFAULT_ITEM_ANIMATE_DURATION = DEFAULT_ITEM_ANIMATE_DURATION;
6025
7886
  exports.DEFAULT_ITEM_ANIMATE_TYPE = DEFAULT_ITEM_ANIMATE_TYPE;
6026
7887
  exports.DEFAULT_ITEM_STAGGER_DURATION = DEFAULT_ITEM_STAGGER_DURATION;
6027
7888
  exports.Divider = Divider;
6028
- exports.Document = Document;
7889
+ exports.DocumentReference = DocumentReference;
6029
7890
  exports.Element = Element$1;
6030
7891
  exports.Embed = Embed;
7892
+ exports.Form = Form;
6031
7893
  exports.ImageComponent = ImageComponent;
7894
+ exports.MakeswiftClient = MakeswiftClient;
6032
7895
  exports.Navigation = Navigation;
7896
+ exports.PageProvider = PageProvider;
6033
7897
  exports.ReactRuntime = ReactRuntime;
6034
7898
  exports.Root = Root;
6035
7899
  exports.RuntimeProvider = RuntimeProvider;
6036
7900
  exports.SocialLinks = SocialLinks;
6037
7901
  exports.Text = Text;
6038
- exports.createDocument = createDocument;
6039
7902
  exports.cssBorder = cssBorder;
6040
7903
  exports.cssBorderRadius = cssBorderRadius;
6041
7904
  exports.cssBoxShadow = cssBoxShadow;
@@ -6045,15 +7908,16 @@ exports.cssMediaRules = cssMediaRules;
6045
7908
  exports.cssPadding = cssPadding;
6046
7909
  exports.cssTextStyle = cssTextStyle;
6047
7910
  exports.cssWidth = cssWidth;
6048
- exports.getComponentPropControllerDescriptors = getComponentPropControllerDescriptors$1;
6049
- exports.getComponentsMeta = getComponentsMeta;
6050
- exports.getDocumentRootElement = getDocumentRootElement$1;
6051
- exports.getElementPropControllerDescriptors = getElementPropControllerDescriptors;
6052
- exports.getInitialState = getInitialState$3;
6053
- exports.reducer = reducer$3;
6054
- exports.reducer$1 = reducer$2;
6055
- exports.reducer$2 = reducer$1;
6056
7911
  exports.registerBuiltinComponents = registerBuiltinComponents;
6057
- exports.registerComponent = registerComponent$a;
7912
+ exports.registerComponent = registerComponent$c;
7913
+ exports.useBackgrounds = useBackgrounds;
7914
+ exports.useBorder = useBorder;
7915
+ exports.useBoxShadow = useBoxShadow;
7916
+ exports.useColor = useColor;
7917
+ exports.useFile = useFile;
6058
7918
  exports.useIsInBuilder = useIsInBuilder;
7919
+ exports.useMediaQuery = useMediaQuery;
7920
+ exports.usePage = usePage;
7921
+ exports.usePageId = usePageId;
7922
+ exports.useTable = useTable;
6059
7923
  //# sourceMappingURL=react.cjs2.js.map