@makeswift/runtime 0.0.0-ef05bba → 0.0.0-f750971
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builder.js +1 -0
- package/dist/actions.cjs.js +29 -2
- package/dist/actions.cjs.js.map +1 -1
- package/dist/actions.es.js +25 -2
- package/dist/actions.es.js.map +1 -1
- package/dist/api.cjs.js +1 -2
- package/dist/api.cjs.js.map +1 -1
- package/dist/box-model.cjs.js +1 -2
- package/dist/box-model.cjs.js.map +1 -1
- package/dist/box-models.cjs.js +2 -0
- package/dist/box-models.cjs.js.map +1 -1
- package/dist/box-models.es.js +2 -0
- package/dist/box-models.es.js.map +1 -1
- package/dist/builder.cjs.js +9 -0
- package/dist/builder.cjs.js.map +1 -0
- package/dist/builder.es.js +3 -0
- package/dist/builder.es.js.map +1 -0
- package/dist/components.cjs.js +4 -2
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +3 -1
- package/dist/components.es.js.map +1 -1
- package/dist/constants.cjs.js +96 -1
- package/dist/constants.cjs.js.map +1 -1
- package/dist/constants.es.js +96 -1
- package/dist/constants.es.js.map +1 -1
- package/dist/control-serialization.cjs.js +147 -0
- package/dist/control-serialization.cjs.js.map +1 -0
- package/dist/control-serialization.es.js +143 -0
- package/dist/control-serialization.es.js.map +1 -0
- package/dist/descriptors.cjs.js +9 -3
- package/dist/descriptors.cjs.js.map +1 -1
- package/dist/descriptors.es.js +8 -4
- package/dist/descriptors.es.js.map +1 -1
- package/dist/instances.cjs.js +17 -0
- package/dist/instances.cjs.js.map +1 -1
- package/dist/instances.es.js +17 -1
- package/dist/instances.es.js.map +1 -1
- package/dist/main.cjs.js +9 -2
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +5 -1
- package/dist/main.es.js.map +1 -1
- package/dist/next.cjs.js +11 -8
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +11 -7
- package/dist/next.es.js.map +1 -1
- package/dist/prop-controllers.cjs.js +2 -2
- package/dist/prop-controllers.es.js +1 -1
- package/dist/react-builder-preview.cjs.js +33 -39
- package/dist/react-builder-preview.cjs.js.map +1 -1
- package/dist/react-builder-preview.es.js +31 -37
- package/dist/react-builder-preview.es.js.map +1 -1
- package/dist/react-page.cjs.js +262 -0
- package/dist/react-page.cjs.js.map +1 -0
- package/dist/react-page.es.js +241 -0
- package/dist/react-page.es.js.map +1 -0
- package/dist/react.cjs.js +6 -3
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.cjs2.js +2078 -409
- package/dist/react.cjs2.js.map +1 -1
- package/dist/react.es.js +3 -1
- package/dist/react.es.js.map +1 -1
- package/dist/react.es2.js +2077 -401
- package/dist/react.es2.js.map +1 -1
- package/dist/types/api/constants.d.ts.map +1 -1
- package/dist/types/api/generated/graphql.d.ts +59 -0
- package/dist/types/api/generated/graphql.d.ts.map +1 -1
- package/dist/types/api/react.d.ts +3 -1
- package/dist/types/api/react.d.ts.map +1 -1
- package/dist/types/api/types.d.ts +2 -2
- package/dist/types/api/types.d.ts.map +1 -1
- package/dist/types/builder/index.d.ts +2 -0
- package/dist/types/builder/index.d.ts.map +1 -0
- package/dist/types/builder/serialization/control-serialization.d.ts +78 -0
- package/dist/types/builder/serialization/control-serialization.d.ts.map +1 -0
- package/dist/types/builder/serialization/function-serialization.d.ts +11 -0
- package/dist/types/builder/serialization/function-serialization.d.ts.map +1 -0
- package/dist/types/builder/serialization/index.d.ts +3 -0
- package/dist/types/builder/serialization/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/Form.d.ts +41 -0
- package/dist/types/components/builtin/Form/Form.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +15 -0
- package/dist/types/components/builtin/Form/components/Field/components/Checkbox/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Field/components/CheckboxTableField/index.d.ts +15 -0
- package/dist/types/components/builtin/Form/components/Field/components/CheckboxTableField/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Field/components/EmailTableField/index.d.ts +11 -0
- package/dist/types/components/builtin/Form/components/Field/components/EmailTableField/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Field/components/Input/index.d.ts +14 -0
- package/dist/types/components/builtin/Form/components/Field/components/Input/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Field/components/Label/index.d.ts +16 -0
- package/dist/types/components/builtin/Form/components/Field/components/Label/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Field/components/LongTextTableField/index.d.ts +10 -0
- package/dist/types/components/builtin/Form/components/Field/components/LongTextTableField/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Field/components/MultipleSelectTableField/index.d.ts +23 -0
- package/dist/types/components/builtin/Form/components/Field/components/MultipleSelectTableField/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Field/components/NumberTableField/index.d.ts +11 -0
- package/dist/types/components/builtin/Form/components/Field/components/NumberTableField/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Field/components/PhoneNumberTableField/index.d.ts +11 -0
- package/dist/types/components/builtin/Form/components/Field/components/PhoneNumberTableField/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Field/components/PlaceholderTableField/index.d.ts +3 -0
- package/dist/types/components/builtin/Form/components/Field/components/PlaceholderTableField/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Field/components/RadioButton/index.d.ts +17 -0
- package/dist/types/components/builtin/Form/components/Field/components/RadioButton/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Field/components/SingleLineTextTableField/index.d.ts +11 -0
- package/dist/types/components/builtin/Form/components/Field/components/SingleLineTextTableField/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Field/components/SingleSelectTableField/components/TableColumnRadioButtonGroup/index.d.ts +23 -0
- package/dist/types/components/builtin/Form/components/Field/components/SingleSelectTableField/components/TableColumnRadioButtonGroup/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Field/components/SingleSelectTableField/components/TableColumnSingleSelect/index.d.ts +19 -0
- package/dist/types/components/builtin/Form/components/Field/components/SingleSelectTableField/components/TableColumnSingleSelect/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Field/components/SingleSelectTableField/index.d.ts +24 -0
- package/dist/types/components/builtin/Form/components/Field/components/SingleSelectTableField/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Field/components/TextArea/index.d.ts +13 -0
- package/dist/types/components/builtin/Form/components/Field/components/TextArea/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Field/components/URLTableField/index.d.ts +11 -0
- package/dist/types/components/builtin/Form/components/Field/components/URLTableField/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Field/index.d.ts +19 -0
- package/dist/types/components/builtin/Form/components/Field/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Field/services/cssField.d.ts +11 -0
- package/dist/types/components/builtin/Form/components/Field/services/cssField.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Placeholder/index.d.ts +9 -0
- package/dist/types/components/builtin/Form/components/Placeholder/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/components/Spinner/index.d.ts +3 -0
- package/dist/types/components/builtin/Form/components/Spinner/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/context/FormContext.d.ts +32 -0
- package/dist/types/components/builtin/Form/context/FormContext.d.ts.map +1 -0
- package/dist/types/components/builtin/Form/index.d.ts +2 -0
- package/dist/types/components/builtin/Form/index.d.ts.map +1 -0
- package/dist/types/components/builtin/index.d.ts +1 -0
- package/dist/types/components/builtin/index.d.ts.map +1 -1
- package/dist/types/components/hooks/index.d.ts +1 -0
- package/dist/types/components/hooks/index.d.ts.map +1 -1
- package/dist/types/components/hooks/useTable.d.ts +66 -0
- package/dist/types/components/hooks/useTable.d.ts.map +1 -0
- package/dist/types/components/hooks/useTableFormFieldRefs.d.ts +8 -0
- package/dist/types/components/hooks/useTableFormFieldRefs.d.ts.map +1 -0
- package/dist/types/components/utils/queries.d.ts +1 -0
- package/dist/types/components/utils/queries.d.ts.map +1 -1
- package/dist/types/components/utils/types.d.ts +1 -2
- package/dist/types/components/utils/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/next.d.ts +4 -3
- package/dist/types/next.d.ts.map +1 -1
- package/dist/types/prop-controllers/descriptors.d.ts +31 -12
- package/dist/types/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/prop-controllers/index.d.ts +3 -3
- package/dist/types/prop-controllers/index.d.ts.map +1 -1
- package/dist/types/prop-controllers/instances.d.ts +36 -4
- package/dist/types/prop-controllers/instances.d.ts.map +1 -1
- package/dist/types/react.d.ts +1 -1
- package/dist/types/react.d.ts.map +1 -1
- package/dist/types/runtimes/react.d.ts +12 -5
- package/dist/types/runtimes/react.d.ts.map +1 -1
- package/dist/types/state/actions.d.ts +47 -1
- package/dist/types/state/actions.d.ts.map +1 -1
- package/dist/types/state/modules/box-models.d.ts.map +1 -1
- package/dist/types/state/modules/read-only-documents.d.ts +8 -4
- package/dist/types/state/modules/read-only-documents.d.ts.map +1 -1
- package/dist/types/state/modules/read-write-documents.d.ts +1 -1
- package/dist/types/state/modules/read-write-documents.d.ts.map +1 -1
- package/dist/types/state/react-builder-preview.d.ts.map +1 -1
- package/dist/types/state/react-page.d.ts +3 -3
- package/dist/types/state/react-page.d.ts.map +1 -1
- package/package.json +17 -5
package/dist/react.cjs2.js
CHANGED
|
@@ -33,22 +33,22 @@ var __objRest = (source, exclude) => {
|
|
|
33
33
|
var React = require("react");
|
|
34
34
|
var withSelector = require("use-sync-external-store/shim/with-selector");
|
|
35
35
|
var client = require("@apollo/client");
|
|
36
|
-
var
|
|
37
|
-
var thunk = require("redux-thunk");
|
|
36
|
+
var reactPage = require("./react-page.cjs.js");
|
|
38
37
|
var actions = require("./actions.cjs.js");
|
|
39
|
-
var descriptors = require("./descriptors.cjs.js");
|
|
40
38
|
var styled = require("styled-components");
|
|
41
39
|
var framerMotion = require("framer-motion");
|
|
42
40
|
var jsxRuntime = require("react/jsx-runtime");
|
|
43
41
|
var boxModels = require("./box-models.cjs.js");
|
|
44
42
|
var NextImage = require("next/image");
|
|
45
43
|
var ReactPlayer = require("react-player");
|
|
44
|
+
var descriptors = require("./descriptors.cjs.js");
|
|
46
45
|
var ColorHelper = require("color");
|
|
47
46
|
var scrollIntoView = require("scroll-into-view-if-needed");
|
|
48
47
|
var NextLink = require("next/link");
|
|
49
48
|
var reactUseGesture = require("react-use-gesture");
|
|
50
49
|
var popcorn = require("@popmotion/popcorn");
|
|
51
50
|
var uuid = require("uuid/v4");
|
|
51
|
+
var formik = require("formik");
|
|
52
52
|
var polished = require("polished");
|
|
53
53
|
var slate = require("slate");
|
|
54
54
|
var Hotkeys = require("slate-hotkeys");
|
|
@@ -61,7 +61,7 @@ function _interopDefaultLegacy(e) {
|
|
|
61
61
|
function _interopNamespace(e) {
|
|
62
62
|
if (e && e.__esModule)
|
|
63
63
|
return e;
|
|
64
|
-
var n =
|
|
64
|
+
var n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
65
65
|
if (e) {
|
|
66
66
|
Object.keys(e).forEach(function(k) {
|
|
67
67
|
if (k !== "default") {
|
|
@@ -79,7 +79,6 @@ function _interopNamespace(e) {
|
|
|
79
79
|
return Object.freeze(n);
|
|
80
80
|
}
|
|
81
81
|
var React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
82
|
-
var thunk__default = /* @__PURE__ */ _interopDefaultLegacy(thunk);
|
|
83
82
|
var styled__default = /* @__PURE__ */ _interopDefaultLegacy(styled);
|
|
84
83
|
var NextImage__default = /* @__PURE__ */ _interopDefaultLegacy(NextImage);
|
|
85
84
|
var ReactPlayer__default = /* @__PURE__ */ _interopDefaultLegacy(ReactPlayer);
|
|
@@ -90,213 +89,6 @@ var uuid__default = /* @__PURE__ */ _interopDefaultLegacy(uuid);
|
|
|
90
89
|
var Hotkeys__default = /* @__PURE__ */ _interopDefaultLegacy(Hotkeys);
|
|
91
90
|
var ipsum__default = /* @__PURE__ */ _interopDefaultLegacy(ipsum);
|
|
92
91
|
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
92
|
const PlaceholderBase$1 = styled__default["default"].div`
|
|
301
93
|
width: 100%;
|
|
302
94
|
background: rgba(161, 168, 194, 0.18);
|
|
@@ -306,7 +98,7 @@ const PlaceholderBase$1 = styled__default["default"].div`
|
|
|
306
98
|
hide
|
|
307
99
|
}) => hide === true ? "hidden" : "initial"};
|
|
308
100
|
`;
|
|
309
|
-
var Placeholder$
|
|
101
|
+
var Placeholder$2 = React.forwardRef(function Placeholder2(_a, ref) {
|
|
310
102
|
var _b = _a, {
|
|
311
103
|
hide = false
|
|
312
104
|
} = _b, restOfProps = __objRest(_b, [
|
|
@@ -420,21 +212,51 @@ const TYPOGRAPHIES_BY_ID = client.gql`
|
|
|
420
212
|
|
|
421
213
|
${TYPOGRAPHY_FRAGMENT}
|
|
422
214
|
`;
|
|
215
|
+
const TABLE_BY_ID = client.gql`
|
|
216
|
+
query TableById($id: ID!) {
|
|
217
|
+
table(id: $id) {
|
|
218
|
+
id
|
|
219
|
+
name
|
|
220
|
+
columns {
|
|
221
|
+
id
|
|
222
|
+
name
|
|
223
|
+
... on MultipleSelectTableColumn {
|
|
224
|
+
options {
|
|
225
|
+
id
|
|
226
|
+
name
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
... on SingleSelectTableColumn {
|
|
230
|
+
options {
|
|
231
|
+
id
|
|
232
|
+
name
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
`;
|
|
423
239
|
function isNonNullable(value) {
|
|
424
240
|
return value != null;
|
|
425
241
|
}
|
|
426
|
-
const Context$
|
|
242
|
+
const Context$2 = React.createContext(void 0);
|
|
427
243
|
function useQuery(query, options) {
|
|
428
|
-
const client$1 = React.useContext(Context$
|
|
244
|
+
const client$1 = React.useContext(Context$2);
|
|
429
245
|
return client.useQuery(query, __spreadValues({
|
|
430
246
|
client: client$1
|
|
431
247
|
}, options));
|
|
432
248
|
}
|
|
249
|
+
function useMutation(mutation, options) {
|
|
250
|
+
const client$1 = React.useContext(Context$2);
|
|
251
|
+
return client.useMutation(mutation, __spreadValues({
|
|
252
|
+
client: client$1
|
|
253
|
+
}, options));
|
|
254
|
+
}
|
|
433
255
|
function ApolloProvider({
|
|
434
256
|
client: client2,
|
|
435
257
|
children
|
|
436
258
|
}) {
|
|
437
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Context$
|
|
259
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Context$2.Provider, {
|
|
438
260
|
value: client2,
|
|
439
261
|
children
|
|
440
262
|
});
|
|
@@ -647,8 +469,8 @@ function shallowMerge(a, b) {
|
|
|
647
469
|
}
|
|
648
470
|
const DEVICES = [
|
|
649
471
|
{ id: "desktop", minWidth: 769 },
|
|
650
|
-
{ id: "tablet", minWidth:
|
|
651
|
-
{ id: "mobile", maxWidth:
|
|
472
|
+
{ id: "tablet", minWidth: 576, maxWidth: 768 },
|
|
473
|
+
{ id: "mobile", maxWidth: 575 }
|
|
652
474
|
];
|
|
653
475
|
const getDevice = (deviceId) => {
|
|
654
476
|
const device = DEVICES.find(({ id }) => id === deviceId);
|
|
@@ -722,6 +544,12 @@ function usePage(pageId) {
|
|
|
722
544
|
const { pagePathnamesById: [page] = [] } = data;
|
|
723
545
|
return page;
|
|
724
546
|
}
|
|
547
|
+
function useTable(tableId) {
|
|
548
|
+
return useQuery(TABLE_BY_ID, {
|
|
549
|
+
skip: tableId == null,
|
|
550
|
+
variables: { id: tableId }
|
|
551
|
+
});
|
|
552
|
+
}
|
|
725
553
|
const defaultExitedProps = {
|
|
726
554
|
opacity: 0,
|
|
727
555
|
x: 0,
|
|
@@ -1192,8 +1020,8 @@ function getScrollParent(element) {
|
|
|
1192
1020
|
return element;
|
|
1193
1021
|
return getScrollParent(parentElement);
|
|
1194
1022
|
}
|
|
1195
|
-
function Parallax(
|
|
1196
|
-
var _h =
|
|
1023
|
+
function Parallax(_g2) {
|
|
1024
|
+
var _h = _g2, {
|
|
1197
1025
|
strength,
|
|
1198
1026
|
children
|
|
1199
1027
|
} = _h, rest = __objRest(_h, [
|
|
@@ -1279,7 +1107,7 @@ function Parallax(_g) {
|
|
|
1279
1107
|
children: children(getProps)
|
|
1280
1108
|
}));
|
|
1281
1109
|
}
|
|
1282
|
-
const Container$
|
|
1110
|
+
const Container$c = styled__default["default"].div`
|
|
1283
1111
|
position: absolute;
|
|
1284
1112
|
top: 0;
|
|
1285
1113
|
left: 0;
|
|
@@ -1333,7 +1161,7 @@ function BackgroundVideo({
|
|
|
1333
1161
|
}, [aspectRatio, zoom]);
|
|
1334
1162
|
if (!ReactPlayer__default["default"].canPlay(url))
|
|
1335
1163
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
1336
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Container$
|
|
1164
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Container$c, {
|
|
1337
1165
|
ref: container,
|
|
1338
1166
|
children: [container.current && /* @__PURE__ */ jsxRuntime.jsx(ReactPlayer__default["default"], {
|
|
1339
1167
|
url,
|
|
@@ -1412,10 +1240,10 @@ const AbsoluteFill = styled__default["default"].div`
|
|
|
1412
1240
|
right: 0;
|
|
1413
1241
|
bottom: 0;
|
|
1414
1242
|
`;
|
|
1415
|
-
const Container$
|
|
1243
|
+
const Container$b = styled__default["default"](AbsoluteFill)`
|
|
1416
1244
|
border-radius: inherit;
|
|
1417
1245
|
`;
|
|
1418
|
-
const BackgroundsContainer$1 = styled__default["default"](Container$
|
|
1246
|
+
const BackgroundsContainer$1 = styled__default["default"](Container$b)`
|
|
1419
1247
|
overflow: hidden;
|
|
1420
1248
|
${(p) => cssMediaRules([p.visibility], ([visibility]) => styled.css`
|
|
1421
1249
|
display: ${visibility === true ? "block" : "none"};
|
|
@@ -1439,7 +1267,7 @@ function Backgrounds({
|
|
|
1439
1267
|
visibility,
|
|
1440
1268
|
children: [...value].reverse().map((bg) => {
|
|
1441
1269
|
if (bg.type === "color") {
|
|
1442
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Container$
|
|
1270
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Container$b, {
|
|
1443
1271
|
style: {
|
|
1444
1272
|
backgroundColor: getColor(bg.payload)
|
|
1445
1273
|
}
|
|
@@ -1475,7 +1303,7 @@ function Backgrounds({
|
|
|
1475
1303
|
}
|
|
1476
1304
|
return /* @__PURE__ */ jsxRuntime.jsx(Parallax, {
|
|
1477
1305
|
strength: parallax,
|
|
1478
|
-
children: (getParallaxProps) => /* @__PURE__ */ jsxRuntime.jsx(Container$
|
|
1306
|
+
children: (getParallaxProps) => /* @__PURE__ */ jsxRuntime.jsx(Container$b, __spreadValues({}, getParallaxProps({
|
|
1479
1307
|
style: {
|
|
1480
1308
|
backgroundImage: publicUrl != null ? `url('${publicUrl}')` : void 0,
|
|
1481
1309
|
backgroundPosition,
|
|
@@ -1493,7 +1321,7 @@ function Backgrounds({
|
|
|
1493
1321
|
isRadial
|
|
1494
1322
|
} = bg.payload;
|
|
1495
1323
|
const gradient = `${getStopsStyle(stops)}`;
|
|
1496
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Container$
|
|
1324
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Container$b, {
|
|
1497
1325
|
style: {
|
|
1498
1326
|
background: isRadial ? `radial-gradient(${gradient})` : `linear-gradient(${angle}rad, ${gradient})`
|
|
1499
1327
|
}
|
|
@@ -1510,7 +1338,7 @@ function Backgrounds({
|
|
|
1510
1338
|
} = bg.payload;
|
|
1511
1339
|
return /* @__PURE__ */ jsxRuntime.jsx(Parallax, {
|
|
1512
1340
|
strength: parallax,
|
|
1513
|
-
children: (getParallaxProps) => /* @__PURE__ */ jsxRuntime.jsx(Container$
|
|
1341
|
+
children: (getParallaxProps) => /* @__PURE__ */ jsxRuntime.jsx(Container$b, __spreadProps(__spreadValues({}, getParallaxProps({})), {
|
|
1514
1342
|
children: /* @__PURE__ */ jsxRuntime.jsx(BackgroundVideo, {
|
|
1515
1343
|
url,
|
|
1516
1344
|
zoom,
|
|
@@ -1578,7 +1406,7 @@ const Grid$1 = styled__default["default"](framerMotion.motion.div)`
|
|
|
1578
1406
|
alignContent
|
|
1579
1407
|
}))}
|
|
1580
1408
|
`;
|
|
1581
|
-
const GridItem$
|
|
1409
|
+
const GridItem$2 = styled__default["default"](framerMotion.motion.div)`
|
|
1582
1410
|
display: flex;
|
|
1583
1411
|
|
|
1584
1412
|
/* IE11 doesn't recognize space-between and treats it as stretch, so we fall back to flex-start */
|
|
@@ -1689,7 +1517,7 @@ const Box = React.forwardRef(function Box2({
|
|
|
1689
1517
|
animate: animate == null ? void 0 : animate.parent,
|
|
1690
1518
|
initial: initial == null ? void 0 : initial.parent,
|
|
1691
1519
|
transition: transition == null ? void 0 : transition.parent,
|
|
1692
|
-
children: children && children.elements.length > 0 ? children.elements.map((child, index) => /* @__PURE__ */ jsxRuntime.jsx(GridItem$
|
|
1520
|
+
children: children && children.elements.length > 0 ? children.elements.map((child, index) => /* @__PURE__ */ jsxRuntime.jsx(GridItem$2, {
|
|
1693
1521
|
grid: children.columns,
|
|
1694
1522
|
index,
|
|
1695
1523
|
columnGap,
|
|
@@ -1700,13 +1528,13 @@ const Box = React.forwardRef(function Box2({
|
|
|
1700
1528
|
children: /* @__PURE__ */ jsxRuntime.jsx(Element$1, {
|
|
1701
1529
|
element: child
|
|
1702
1530
|
})
|
|
1703
|
-
}, child.key)) : /* @__PURE__ */ jsxRuntime.jsx(Placeholder$
|
|
1531
|
+
}, child.key)) : /* @__PURE__ */ jsxRuntime.jsx(Placeholder$2, {
|
|
1704
1532
|
hide: hidePlaceholder
|
|
1705
1533
|
})
|
|
1706
1534
|
})
|
|
1707
1535
|
}, key == null ? void 0 : key.container);
|
|
1708
1536
|
});
|
|
1709
|
-
function registerComponent$
|
|
1537
|
+
function registerComponent$b(runtime) {
|
|
1710
1538
|
return runtime.registerComponent(Box, {
|
|
1711
1539
|
type: "./components/Box/index.js",
|
|
1712
1540
|
label: "Box",
|
|
@@ -1971,7 +1799,7 @@ const Link = React.forwardRef(function Link2(_k, ref) {
|
|
|
1971
1799
|
}))
|
|
1972
1800
|
});
|
|
1973
1801
|
});
|
|
1974
|
-
const StyledButton = styled__default["default"](Link)`
|
|
1802
|
+
const StyledButton$1 = styled__default["default"](Link)`
|
|
1975
1803
|
display: table;
|
|
1976
1804
|
border: 0;
|
|
1977
1805
|
outline: 0;
|
|
@@ -2163,7 +1991,7 @@ const StyledButton = styled__default["default"](Link)`
|
|
|
2163
1991
|
})}
|
|
2164
1992
|
${cssTextStyle()}
|
|
2165
1993
|
`;
|
|
2166
|
-
const Button = React.forwardRef(function Button2(_m, ref) {
|
|
1994
|
+
const Button$1 = React.forwardRef(function Button2(_m, ref) {
|
|
2167
1995
|
var _n = _m, {
|
|
2168
1996
|
id,
|
|
2169
1997
|
children,
|
|
@@ -2189,7 +2017,7 @@ const Button = React.forwardRef(function Button2(_m, ref) {
|
|
|
2189
2017
|
"width",
|
|
2190
2018
|
"margin"
|
|
2191
2019
|
]);
|
|
2192
|
-
return /* @__PURE__ */ jsxRuntime.jsx(StyledButton, __spreadProps(__spreadValues({}, restOfProps), {
|
|
2020
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledButton$1, __spreadProps(__spreadValues({}, restOfProps), {
|
|
2193
2021
|
ref,
|
|
2194
2022
|
id,
|
|
2195
2023
|
color: useColor(color),
|
|
@@ -2204,8 +2032,8 @@ const Button = React.forwardRef(function Button2(_m, ref) {
|
|
|
2204
2032
|
children: children == null ? "Button Text" : children
|
|
2205
2033
|
}));
|
|
2206
2034
|
});
|
|
2207
|
-
function registerComponent$
|
|
2208
|
-
return runtime.registerComponent(Button, {
|
|
2035
|
+
function registerComponent$a(runtime) {
|
|
2036
|
+
return runtime.registerComponent(Button$1, {
|
|
2209
2037
|
type: "./components/Button/index.js",
|
|
2210
2038
|
label: "Button",
|
|
2211
2039
|
props: {
|
|
@@ -2405,7 +2233,7 @@ const ImageComponent = React.forwardRef(function Image2({
|
|
|
2405
2233
|
})
|
|
2406
2234
|
});
|
|
2407
2235
|
});
|
|
2408
|
-
function registerComponent$
|
|
2236
|
+
function registerComponent$9(runtime) {
|
|
2409
2237
|
return runtime.registerComponent(ImageComponent, {
|
|
2410
2238
|
type: "./components/Image/index.js",
|
|
2411
2239
|
label: "Image",
|
|
@@ -2454,7 +2282,7 @@ const RightChevron = () => /* @__PURE__ */ jsxRuntime.jsx("svg", {
|
|
|
2454
2282
|
strokeWidth: "2"
|
|
2455
2283
|
})
|
|
2456
2284
|
});
|
|
2457
|
-
const Container$
|
|
2285
|
+
const Container$a = styled__default["default"].div`
|
|
2458
2286
|
position: relative;
|
|
2459
2287
|
height: 100%;
|
|
2460
2288
|
`;
|
|
@@ -2754,7 +2582,7 @@ const Carousel = React.forwardRef(function Carousel2({
|
|
|
2754
2582
|
break;
|
|
2755
2583
|
}
|
|
2756
2584
|
},
|
|
2757
|
-
children: [/* @__PURE__ */ jsxRuntime.jsxs(Container$
|
|
2585
|
+
children: [/* @__PURE__ */ jsxRuntime.jsxs(Container$a, {
|
|
2758
2586
|
children: [/* @__PURE__ */ jsxRuntime.jsx(ClipMask, {
|
|
2759
2587
|
children: /* @__PURE__ */ jsxRuntime.jsx(Page, __spreadProps(__spreadValues({}, bindPage()), {
|
|
2760
2588
|
animate: animation,
|
|
@@ -2830,7 +2658,7 @@ const Carousel = React.forwardRef(function Carousel2({
|
|
|
2830
2658
|
})]
|
|
2831
2659
|
});
|
|
2832
2660
|
});
|
|
2833
|
-
function registerComponent$
|
|
2661
|
+
function registerComponent$8(runtime) {
|
|
2834
2662
|
return runtime.registerComponent(Carousel, {
|
|
2835
2663
|
type: "./components/Carousel/index.js",
|
|
2836
2664
|
label: "Carousel",
|
|
@@ -2950,14 +2778,14 @@ const Block$1 = styled__default["default"].div`
|
|
|
2950
2778
|
padding: 0.5em;
|
|
2951
2779
|
font-size: 1em;
|
|
2952
2780
|
`;
|
|
2953
|
-
const Label = styled__default["default"].div`
|
|
2781
|
+
const Label$3 = styled__default["default"].div`
|
|
2954
2782
|
margin-top: 0.25em;
|
|
2955
2783
|
`;
|
|
2956
2784
|
const Segment = styled__default["default"].div`
|
|
2957
2785
|
flex: 1;
|
|
2958
2786
|
text-align: center;
|
|
2959
2787
|
`;
|
|
2960
|
-
const Container$
|
|
2788
|
+
const Container$9 = styled__default["default"].div`
|
|
2961
2789
|
display: flex;
|
|
2962
2790
|
${cssWidth("560px")}
|
|
2963
2791
|
${cssMargin()}
|
|
@@ -2967,7 +2795,7 @@ const Container$5 = styled__default["default"].div`
|
|
|
2967
2795
|
return styled.css`
|
|
2968
2796
|
font-size: 18px;
|
|
2969
2797
|
|
|
2970
|
-
${Label} {
|
|
2798
|
+
${Label$3} {
|
|
2971
2799
|
font-size: 14px;
|
|
2972
2800
|
}
|
|
2973
2801
|
`;
|
|
@@ -2975,7 +2803,7 @@ const Container$5 = styled__default["default"].div`
|
|
|
2975
2803
|
return styled.css`
|
|
2976
2804
|
font-size: 32px;
|
|
2977
2805
|
|
|
2978
|
-
${Label} {
|
|
2806
|
+
${Label$3} {
|
|
2979
2807
|
font-size: 18px;
|
|
2980
2808
|
}
|
|
2981
2809
|
`;
|
|
@@ -2983,7 +2811,7 @@ const Container$5 = styled__default["default"].div`
|
|
|
2983
2811
|
return styled.css`
|
|
2984
2812
|
font-size: 24px;
|
|
2985
2813
|
|
|
2986
|
-
${Label} {
|
|
2814
|
+
${Label$3} {
|
|
2987
2815
|
font-size: 16px;
|
|
2988
2816
|
}
|
|
2989
2817
|
`;
|
|
@@ -3120,7 +2948,7 @@ const Container$5 = styled__default["default"].div`
|
|
|
3120
2948
|
})}
|
|
3121
2949
|
}
|
|
3122
2950
|
|
|
3123
|
-
${Label} {
|
|
2951
|
+
${Label$3} {
|
|
3124
2952
|
${(p) => cssMediaRules([p.labelColor, p.labelFont], ([labelColor = {
|
|
3125
2953
|
swatch: {
|
|
3126
2954
|
hue: 0,
|
|
@@ -3197,7 +3025,7 @@ const Countdown = React.forwardRef(function Countdown2({
|
|
|
3197
3025
|
}, 1e3);
|
|
3198
3026
|
return () => clearInterval(intervalId);
|
|
3199
3027
|
}, [date]);
|
|
3200
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Container$
|
|
3028
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Container$9, {
|
|
3201
3029
|
ref,
|
|
3202
3030
|
id,
|
|
3203
3031
|
width,
|
|
@@ -3216,7 +3044,7 @@ const Countdown = React.forwardRef(function Countdown2({
|
|
|
3216
3044
|
children: /* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
3217
3045
|
children: days
|
|
3218
3046
|
})
|
|
3219
|
-
}), /* @__PURE__ */ jsxRuntime.jsx(Label, {
|
|
3047
|
+
}), /* @__PURE__ */ jsxRuntime.jsx(Label$3, {
|
|
3220
3048
|
children: daysLabel == null ? "Days" : daysLabel
|
|
3221
3049
|
})]
|
|
3222
3050
|
}), /* @__PURE__ */ jsxRuntime.jsxs(Segment, {
|
|
@@ -3224,7 +3052,7 @@ const Countdown = React.forwardRef(function Countdown2({
|
|
|
3224
3052
|
children: /* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
3225
3053
|
children: hours
|
|
3226
3054
|
})
|
|
3227
|
-
}), /* @__PURE__ */ jsxRuntime.jsx(Label, {
|
|
3055
|
+
}), /* @__PURE__ */ jsxRuntime.jsx(Label$3, {
|
|
3228
3056
|
children: hoursLabel == null ? "Hours" : hoursLabel
|
|
3229
3057
|
})]
|
|
3230
3058
|
}), /* @__PURE__ */ jsxRuntime.jsxs(Segment, {
|
|
@@ -3232,7 +3060,7 @@ const Countdown = React.forwardRef(function Countdown2({
|
|
|
3232
3060
|
children: /* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
3233
3061
|
children: minutes
|
|
3234
3062
|
})
|
|
3235
|
-
}), /* @__PURE__ */ jsxRuntime.jsx(Label, {
|
|
3063
|
+
}), /* @__PURE__ */ jsxRuntime.jsx(Label$3, {
|
|
3236
3064
|
children: minutesLabel == null ? "Minutes" : minutesLabel
|
|
3237
3065
|
})]
|
|
3238
3066
|
}), /* @__PURE__ */ jsxRuntime.jsxs(Segment, {
|
|
@@ -3240,13 +3068,13 @@ const Countdown = React.forwardRef(function Countdown2({
|
|
|
3240
3068
|
children: /* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
3241
3069
|
children: seconds
|
|
3242
3070
|
})
|
|
3243
|
-
}), /* @__PURE__ */ jsxRuntime.jsx(Label, {
|
|
3071
|
+
}), /* @__PURE__ */ jsxRuntime.jsx(Label$3, {
|
|
3244
3072
|
children: secondsLabel == null ? "Seconds" : secondsLabel
|
|
3245
3073
|
})]
|
|
3246
3074
|
})]
|
|
3247
3075
|
});
|
|
3248
3076
|
});
|
|
3249
|
-
function registerComponent$
|
|
3077
|
+
function registerComponent$7(runtime) {
|
|
3250
3078
|
return runtime.registerComponent(Countdown, {
|
|
3251
3079
|
type: "./components/Countdown/index.js",
|
|
3252
3080
|
label: "Countdown",
|
|
@@ -3382,7 +3210,7 @@ const IE11MinHeightContainer = styled__default["default"].div`
|
|
|
3382
3210
|
${cssWidth()}
|
|
3383
3211
|
${cssMargin()}
|
|
3384
3212
|
`;
|
|
3385
|
-
const Container$
|
|
3213
|
+
const Container$8 = styled__default["default"].div`
|
|
3386
3214
|
display: flex;
|
|
3387
3215
|
flex-direction: column;
|
|
3388
3216
|
justify-content: center;
|
|
@@ -3441,7 +3269,7 @@ const Divider = React.forwardRef(function Divider2({
|
|
|
3441
3269
|
id,
|
|
3442
3270
|
width,
|
|
3443
3271
|
margin,
|
|
3444
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Container$
|
|
3272
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Container$8, {
|
|
3445
3273
|
children: /* @__PURE__ */ jsxRuntime.jsx(Line, {
|
|
3446
3274
|
variant,
|
|
3447
3275
|
thickness,
|
|
@@ -3450,7 +3278,7 @@ const Divider = React.forwardRef(function Divider2({
|
|
|
3450
3278
|
})
|
|
3451
3279
|
});
|
|
3452
3280
|
});
|
|
3453
|
-
function registerComponent$
|
|
3281
|
+
function registerComponent$6(runtime) {
|
|
3454
3282
|
return runtime.registerComponent(Divider, {
|
|
3455
3283
|
type: "./components/Divider/index.js",
|
|
3456
3284
|
label: "Divider",
|
|
@@ -3500,7 +3328,7 @@ function registerComponent$5(runtime) {
|
|
|
3500
3328
|
}
|
|
3501
3329
|
});
|
|
3502
3330
|
}
|
|
3503
|
-
const Container$
|
|
3331
|
+
const Container$7 = styled__default["default"].div`
|
|
3504
3332
|
min-height: 15px;
|
|
3505
3333
|
${cssWidth()}
|
|
3506
3334
|
${cssMargin()}
|
|
@@ -3580,7 +3408,7 @@ const Embed = React.forwardRef(function Embed2({
|
|
|
3580
3408
|
}, [container, html]);
|
|
3581
3409
|
if (shouldRender === false)
|
|
3582
3410
|
return null;
|
|
3583
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Container$
|
|
3411
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Container$7, {
|
|
3584
3412
|
ref: setContainer,
|
|
3585
3413
|
id,
|
|
3586
3414
|
margin,
|
|
@@ -3590,7 +3418,7 @@ const Embed = React.forwardRef(function Embed2({
|
|
|
3590
3418
|
}
|
|
3591
3419
|
});
|
|
3592
3420
|
});
|
|
3593
|
-
function registerComponent$
|
|
3421
|
+
function registerComponent$5(runtime) {
|
|
3594
3422
|
return runtime.registerComponent(Embed, {
|
|
3595
3423
|
type: "./components/Embed/index.js",
|
|
3596
3424
|
label: "Embed",
|
|
@@ -3606,9 +3434,9 @@ function registerComponent$4(runtime) {
|
|
|
3606
3434
|
}
|
|
3607
3435
|
});
|
|
3608
3436
|
}
|
|
3609
|
-
var _path$
|
|
3610
|
-
function _extends$
|
|
3611
|
-
_extends$
|
|
3437
|
+
var _path$s;
|
|
3438
|
+
function _extends$t() {
|
|
3439
|
+
_extends$t = Object.assign || function(target) {
|
|
3612
3440
|
for (var i = 1; i < arguments.length; i++) {
|
|
3613
3441
|
var source = arguments[i];
|
|
3614
3442
|
for (var key in source) {
|
|
@@ -3619,85 +3447,1863 @@ function _extends$r() {
|
|
|
3619
3447
|
}
|
|
3620
3448
|
return target;
|
|
3621
3449
|
};
|
|
3622
|
-
return _extends$
|
|
3450
|
+
return _extends$t.apply(this, arguments);
|
|
3623
3451
|
}
|
|
3624
|
-
var
|
|
3625
|
-
return /* @__PURE__ */ React__namespace.createElement("svg", _extends$
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
}, props), _path$
|
|
3630
|
-
|
|
3452
|
+
var SvgCheck12 = function SvgCheck122(props) {
|
|
3453
|
+
return /* @__PURE__ */ React__namespace.createElement("svg", _extends$t({
|
|
3454
|
+
width: 12,
|
|
3455
|
+
height: 12,
|
|
3456
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
3457
|
+
}, props), _path$s || (_path$s = /* @__PURE__ */ React__namespace.createElement("path", {
|
|
3458
|
+
fillRule: "evenodd",
|
|
3459
|
+
clipRule: "evenodd",
|
|
3460
|
+
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
3461
|
})));
|
|
3632
3462
|
};
|
|
3633
|
-
const
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
}
|
|
3638
|
-
|
|
3639
|
-
|
|
3463
|
+
const Shapes = Object.freeze({
|
|
3464
|
+
SQUARE: "square",
|
|
3465
|
+
ROUNDED: "rounded",
|
|
3466
|
+
PILL: "pill"
|
|
3467
|
+
});
|
|
3468
|
+
const Sizes = Object.freeze({
|
|
3469
|
+
SMALL: "small",
|
|
3470
|
+
MEDIUM: "medium",
|
|
3471
|
+
LARGE: "large"
|
|
3472
|
+
});
|
|
3473
|
+
const Contrasts = Object.freeze({
|
|
3474
|
+
LIGHT: "light",
|
|
3475
|
+
DARK: "dark"
|
|
3476
|
+
});
|
|
3477
|
+
const Context$1 = React.createContext({});
|
|
3478
|
+
function useFormContext() {
|
|
3479
|
+
return React.useContext(Context$1);
|
|
3480
|
+
}
|
|
3481
|
+
const { Provider } = Context$1;
|
|
3482
|
+
function getSizeHeight$2(size) {
|
|
3483
|
+
switch (size) {
|
|
3484
|
+
case Sizes.SMALL:
|
|
3485
|
+
return 30;
|
|
3486
|
+
case Sizes.MEDIUM:
|
|
3487
|
+
return 38;
|
|
3488
|
+
case Sizes.LARGE:
|
|
3489
|
+
return 48;
|
|
3490
|
+
default:
|
|
3491
|
+
throw new Error(`Invalid form size "${size}"`);
|
|
3492
|
+
}
|
|
3493
|
+
}
|
|
3494
|
+
function getSizeHorizontalPadding(size) {
|
|
3495
|
+
switch (size) {
|
|
3496
|
+
case Sizes.SMALL:
|
|
3497
|
+
return 8;
|
|
3498
|
+
case Sizes.MEDIUM:
|
|
3499
|
+
return 12;
|
|
3500
|
+
case Sizes.LARGE:
|
|
3501
|
+
return 16;
|
|
3502
|
+
default:
|
|
3503
|
+
throw new Error(`Invalid form size "${size}"`);
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3506
|
+
function getSizeVerticalPadding(size) {
|
|
3507
|
+
switch (size) {
|
|
3508
|
+
case Sizes.SMALL:
|
|
3509
|
+
return 3;
|
|
3510
|
+
case Sizes.MEDIUM:
|
|
3511
|
+
return 7;
|
|
3512
|
+
case Sizes.LARGE:
|
|
3513
|
+
return 11;
|
|
3514
|
+
default:
|
|
3515
|
+
throw new Error(`Invalid form size "${size}"`);
|
|
3516
|
+
}
|
|
3517
|
+
}
|
|
3518
|
+
function getShapeBorderRadius(shape) {
|
|
3519
|
+
switch (shape) {
|
|
3520
|
+
case Shapes.SQUARE:
|
|
3521
|
+
return 0;
|
|
3522
|
+
case Shapes.ROUNDED:
|
|
3523
|
+
return 4;
|
|
3524
|
+
case Shapes.PILL:
|
|
3525
|
+
return 500;
|
|
3526
|
+
default:
|
|
3527
|
+
throw new Error(`Invalid form shape "${shape}"`);
|
|
3528
|
+
}
|
|
3529
|
+
}
|
|
3530
|
+
function getContrastBorderColor(contrast, error) {
|
|
3531
|
+
switch (contrast) {
|
|
3532
|
+
case Contrasts.LIGHT:
|
|
3533
|
+
return error ? "rgba(255, 0, 0, 0.7)" : "rgba(0, 0, 0, 0.25)";
|
|
3534
|
+
case Contrasts.DARK:
|
|
3535
|
+
return error ? "rgba(255, 0, 0, 0.7)" : "rgba(255, 255, 255, 0.6)";
|
|
3536
|
+
default:
|
|
3537
|
+
throw new Error(`Invalid form contrast "${contrast}"`);
|
|
3538
|
+
}
|
|
3539
|
+
}
|
|
3540
|
+
function getContrastBackgroundColor(contrast) {
|
|
3541
|
+
switch (contrast) {
|
|
3542
|
+
case Contrasts.LIGHT:
|
|
3543
|
+
return "white";
|
|
3544
|
+
case Contrasts.DARK:
|
|
3545
|
+
return "rgba(0, 0, 0, 0.7)";
|
|
3546
|
+
default:
|
|
3547
|
+
throw new Error(`Invalid form contrast "${contrast}"`);
|
|
3548
|
+
}
|
|
3549
|
+
}
|
|
3550
|
+
function getContrastColor$1(contrast) {
|
|
3551
|
+
switch (contrast) {
|
|
3552
|
+
case Contrasts.LIGHT:
|
|
3553
|
+
return "rgba(0, 0, 0, 0.95)";
|
|
3554
|
+
case Contrasts.DARK:
|
|
3555
|
+
return "white";
|
|
3556
|
+
default:
|
|
3557
|
+
throw new Error(`Invalid form contrast "${contrast}"`);
|
|
3558
|
+
}
|
|
3559
|
+
}
|
|
3560
|
+
function getContrastPlaceholderColor(contrast) {
|
|
3561
|
+
switch (contrast) {
|
|
3562
|
+
case Contrasts.LIGHT:
|
|
3563
|
+
return "rgba(0, 0, 0, 0.3)";
|
|
3564
|
+
case Contrasts.DARK:
|
|
3565
|
+
return "rgba(255,255,255,0.3)";
|
|
3566
|
+
default:
|
|
3567
|
+
throw new Error(`Invalid form contrast "${contrast}"`);
|
|
3568
|
+
}
|
|
3569
|
+
}
|
|
3570
|
+
function cssField() {
|
|
3571
|
+
return styled.css`
|
|
3572
|
+
display: block;
|
|
3573
|
+
width: 100%;
|
|
3574
|
+
outline: none;
|
|
3575
|
+
border-width: 1px;
|
|
3576
|
+
border-style: solid;
|
|
3577
|
+
transition: border-color 200ms;
|
|
3578
|
+
${(props) => cssMediaRules([props.shape, props.size, props.contrast, props.brandColor], ([
|
|
3579
|
+
shape = Shapes.ROUNDED,
|
|
3580
|
+
size = Sizes.MEDIUM,
|
|
3581
|
+
contrast = Contrasts.LIGHT,
|
|
3582
|
+
brandColor = { swatch: { hue: 0, saturation: 0, lightness: 0 }, alpha: 1 }
|
|
3583
|
+
]) => styled.css`
|
|
3584
|
+
padding: ${getSizeVerticalPadding(size)}px ${getSizeHorizontalPadding(size)}px;
|
|
3585
|
+
border-radius: ${getShapeBorderRadius(shape)}px;
|
|
3586
|
+
border-color: ${getContrastBorderColor(contrast, props.error)};
|
|
3587
|
+
color: ${getContrastColor$1(contrast)};
|
|
3588
|
+
background-color: ${getContrastBackgroundColor(contrast)};
|
|
3589
|
+
|
|
3590
|
+
:focus,
|
|
3591
|
+
:focus-within {
|
|
3592
|
+
border-color: ${colorToString(brandColor)};
|
|
3593
|
+
}
|
|
3594
|
+
|
|
3595
|
+
::placeholder {
|
|
3596
|
+
color: ${getContrastPlaceholderColor(contrast)};
|
|
3597
|
+
}
|
|
3598
|
+
`)}
|
|
3599
|
+
`;
|
|
3600
|
+
}
|
|
3601
|
+
function getSizeHeight$1(size) {
|
|
3602
|
+
switch (size) {
|
|
3603
|
+
case Sizes.SMALL:
|
|
3604
|
+
return 36;
|
|
3605
|
+
case Sizes.MEDIUM:
|
|
3606
|
+
return 42;
|
|
3607
|
+
case Sizes.LARGE:
|
|
3608
|
+
return 48;
|
|
3609
|
+
default:
|
|
3610
|
+
throw new Error(`Invalid form size "${size}"`);
|
|
3611
|
+
}
|
|
3612
|
+
}
|
|
3613
|
+
const Base$2 = styled__default["default"].input`
|
|
3614
|
+
${cssField()}
|
|
3615
|
+
${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => styled.css`
|
|
3616
|
+
min-height: ${getSizeHeight$1(size)}px;
|
|
3617
|
+
max-height: ${getSizeHeight$1(size)}px;
|
|
3640
3618
|
`)}
|
|
3641
3619
|
`;
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3620
|
+
var Input$2 = React.forwardRef(function Input2(_o, ref) {
|
|
3621
|
+
var _p = _o, {
|
|
3622
|
+
error = false,
|
|
3623
|
+
form
|
|
3624
|
+
} = _p, restOfProps = __objRest(_p, [
|
|
3625
|
+
"error",
|
|
3626
|
+
"form"
|
|
3627
|
+
]);
|
|
3628
|
+
const {
|
|
3629
|
+
shape,
|
|
3630
|
+
size,
|
|
3631
|
+
contrast,
|
|
3632
|
+
brandColor
|
|
3633
|
+
} = useFormContext();
|
|
3634
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Base$2, __spreadProps(__spreadValues({}, restOfProps), {
|
|
3635
|
+
ref,
|
|
3636
|
+
error,
|
|
3637
|
+
shape,
|
|
3638
|
+
size,
|
|
3639
|
+
contrast,
|
|
3640
|
+
brandColor
|
|
3641
|
+
}));
|
|
3642
|
+
});
|
|
3643
|
+
const Container$6 = styled__default["default"].div`
|
|
3644
|
+
display: flex;
|
|
3645
|
+
flex-direction: column;
|
|
3646
|
+
${cssWidth()};
|
|
3647
|
+
${cssMargin()};
|
|
3648
|
+
`;
|
|
3649
|
+
const Label$2 = styled__default["default"].div`
|
|
3650
|
+
max-width: 120px;
|
|
3651
|
+
min-width: 60px;
|
|
3652
|
+
height: 8px;
|
|
3653
|
+
border-radius: 2px;
|
|
3645
3654
|
background-color: #a1a8c2;
|
|
3646
|
-
border-radius: ${(props) => props.button === true ? 6 : 2}px;
|
|
3647
3655
|
opacity: 0.4;
|
|
3656
|
+
margin-bottom: 8px;
|
|
3648
3657
|
`;
|
|
3649
|
-
const
|
|
3650
|
-
width:
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3658
|
+
const Input$1 = styled__default["default"].div`
|
|
3659
|
+
min-width: 80px;
|
|
3660
|
+
height: 32px;
|
|
3661
|
+
border-radius: 4px;
|
|
3662
|
+
border-width: 2px;
|
|
3663
|
+
border-style: solid;
|
|
3664
|
+
border-color: #a1a8c2;
|
|
3665
|
+
opacity: 0.4;
|
|
3666
|
+
`;
|
|
3667
|
+
const Button = styled__default["default"].div`
|
|
3668
|
+
min-width: 140px;
|
|
3669
|
+
height: 32px;
|
|
3670
|
+
border-radius: 4px;
|
|
3671
|
+
background-color: #a1a8c2;
|
|
3672
|
+
opacity: 0.4;
|
|
3673
|
+
`;
|
|
3674
|
+
var Placeholder$1 = React.forwardRef(function Placeholder3({
|
|
3675
|
+
width,
|
|
3676
|
+
margin
|
|
3677
|
+
}, ref) {
|
|
3678
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Container$6, {
|
|
3679
|
+
ref,
|
|
3680
|
+
width,
|
|
3681
|
+
margin,
|
|
3682
|
+
children: [/* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
3683
|
+
style: {
|
|
3684
|
+
display: "flex",
|
|
3685
|
+
flexDirection: "column",
|
|
3686
|
+
marginBottom: 16
|
|
3687
|
+
},
|
|
3688
|
+
children: [/* @__PURE__ */ jsxRuntime.jsx(Label$2, {}), /* @__PURE__ */ jsxRuntime.jsx(Input$1, {})]
|
|
3689
|
+
}), /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
3690
|
+
style: {
|
|
3691
|
+
display: "flex",
|
|
3692
|
+
flexDirection: "column",
|
|
3693
|
+
marginBottom: 16
|
|
3694
|
+
},
|
|
3695
|
+
children: [/* @__PURE__ */ jsxRuntime.jsx(Label$2, {}), /* @__PURE__ */ jsxRuntime.jsx(Input$1, {})]
|
|
3696
|
+
}), /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
3697
|
+
style: {
|
|
3698
|
+
display: "flex",
|
|
3699
|
+
flexDirection: "column",
|
|
3700
|
+
justifyContent: "flex-end"
|
|
3701
|
+
},
|
|
3702
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Button, {})
|
|
3703
|
+
})]
|
|
3669
3704
|
});
|
|
3705
|
+
});
|
|
3706
|
+
function getSizeHeight(size) {
|
|
3707
|
+
switch (size) {
|
|
3708
|
+
case Sizes.SMALL:
|
|
3709
|
+
return 14;
|
|
3710
|
+
case Sizes.MEDIUM:
|
|
3711
|
+
return 18;
|
|
3712
|
+
case Sizes.LARGE:
|
|
3713
|
+
return 22;
|
|
3714
|
+
default:
|
|
3715
|
+
throw new Error(`Invalid form size "${size}"`);
|
|
3716
|
+
}
|
|
3670
3717
|
}
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
}
|
|
3681
|
-
}
|
|
3682
|
-
return target;
|
|
3683
|
-
};
|
|
3684
|
-
return _extends$q.apply(this, arguments);
|
|
3718
|
+
function getContrastColor(contrast) {
|
|
3719
|
+
switch (contrast) {
|
|
3720
|
+
case Contrasts.LIGHT:
|
|
3721
|
+
return "rgba(0, 0, 0, 0.8)";
|
|
3722
|
+
case Contrasts.DARK:
|
|
3723
|
+
return "rgba(255, 255, 255, 0.95)";
|
|
3724
|
+
default:
|
|
3725
|
+
throw new Error(`Invalid form contrast "${contrast}"`);
|
|
3726
|
+
}
|
|
3685
3727
|
}
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3728
|
+
const Base$1 = styled__default["default"].label`
|
|
3729
|
+
display: block;
|
|
3730
|
+
margin: 0 0 0.25em 0;
|
|
3731
|
+
${cssTextStyle()}
|
|
3732
|
+
${(props) => cssMediaRules([props.size, props.contrast, props.textColor], ([size = Sizes.MEDIUM, contrast = Contrasts.LIGHT, textColor]) => styled.css`
|
|
3733
|
+
min-height: ${getSizeHeight(size)}px;
|
|
3734
|
+
color: ${textColor == null ? getContrastColor(contrast) : colorToString(textColor)};
|
|
3735
|
+
`)}
|
|
3736
|
+
`;
|
|
3737
|
+
function Label$1(props) {
|
|
3738
|
+
const {
|
|
3739
|
+
contrast,
|
|
3740
|
+
size,
|
|
3741
|
+
labelTextStyle,
|
|
3742
|
+
labelTextColor
|
|
3743
|
+
} = useFormContext();
|
|
3744
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Base$1, __spreadProps(__spreadValues({}, props), {
|
|
3745
|
+
contrast,
|
|
3746
|
+
size,
|
|
3747
|
+
textStyle: labelTextStyle,
|
|
3748
|
+
textColor: useColor(labelTextColor)
|
|
3749
|
+
}));
|
|
3750
|
+
}
|
|
3751
|
+
var SingleLineTextTableField = React.forwardRef(function SingleLineTextTableField2(_q, ref) {
|
|
3752
|
+
var _r = _q, {
|
|
3753
|
+
id,
|
|
3754
|
+
label = "",
|
|
3755
|
+
name,
|
|
3756
|
+
error,
|
|
3757
|
+
hideLabel = false
|
|
3758
|
+
} = _r, restOfProps = __objRest(_r, [
|
|
3759
|
+
"id",
|
|
3760
|
+
"label",
|
|
3761
|
+
"name",
|
|
3762
|
+
"error",
|
|
3763
|
+
"hideLabel"
|
|
3764
|
+
]);
|
|
3765
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3766
|
+
children: [!hideLabel && /* @__PURE__ */ jsxRuntime.jsx(Label$1, {
|
|
3767
|
+
htmlFor: id,
|
|
3768
|
+
children: label
|
|
3769
|
+
}), /* @__PURE__ */ jsxRuntime.jsx(Input$2, __spreadProps(__spreadValues({}, restOfProps), {
|
|
3770
|
+
"aria-label": label,
|
|
3771
|
+
ref,
|
|
3772
|
+
id,
|
|
3773
|
+
name,
|
|
3774
|
+
type: "text",
|
|
3775
|
+
error: error != null
|
|
3776
|
+
}))]
|
|
3777
|
+
});
|
|
3778
|
+
});
|
|
3779
|
+
const Base = styled__default["default"].textarea`
|
|
3780
|
+
resize: vertical;
|
|
3781
|
+
${cssField()}
|
|
3782
|
+
`;
|
|
3783
|
+
var TextArea = React.forwardRef(function TextArea2(_s, ref) {
|
|
3784
|
+
var _t = _s, {
|
|
3785
|
+
error = false,
|
|
3786
|
+
form
|
|
3787
|
+
} = _t, restOfProps = __objRest(_t, [
|
|
3788
|
+
"error",
|
|
3789
|
+
"form"
|
|
3790
|
+
]);
|
|
3791
|
+
const {
|
|
3792
|
+
shape,
|
|
3793
|
+
size,
|
|
3794
|
+
contrast,
|
|
3795
|
+
brandColor
|
|
3796
|
+
} = useFormContext();
|
|
3797
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Base, __spreadProps(__spreadValues({}, restOfProps), {
|
|
3798
|
+
ref,
|
|
3799
|
+
rows: 4,
|
|
3800
|
+
error,
|
|
3801
|
+
shape,
|
|
3802
|
+
size,
|
|
3803
|
+
contrast,
|
|
3804
|
+
brandColor
|
|
3805
|
+
}));
|
|
3806
|
+
});
|
|
3807
|
+
var LongTextTableField = React.forwardRef(function LongTextTableField2(_u, ref) {
|
|
3808
|
+
var _v = _u, {
|
|
3809
|
+
id,
|
|
3810
|
+
label = "",
|
|
3811
|
+
error,
|
|
3812
|
+
hideLabel = false
|
|
3813
|
+
} = _v, restOfProps = __objRest(_v, [
|
|
3814
|
+
"id",
|
|
3815
|
+
"label",
|
|
3816
|
+
"error",
|
|
3817
|
+
"hideLabel"
|
|
3818
|
+
]);
|
|
3819
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3820
|
+
children: [!hideLabel && /* @__PURE__ */ jsxRuntime.jsx(Label$1, {
|
|
3821
|
+
htmlFor: id,
|
|
3822
|
+
children: label
|
|
3823
|
+
}), /* @__PURE__ */ jsxRuntime.jsx(TextArea, __spreadProps(__spreadValues({}, restOfProps), {
|
|
3824
|
+
"aria-label": label,
|
|
3825
|
+
ref,
|
|
3826
|
+
id,
|
|
3827
|
+
error: error != null
|
|
3828
|
+
}))]
|
|
3829
|
+
});
|
|
3830
|
+
});
|
|
3831
|
+
function getCheckmarkColor$1({
|
|
3832
|
+
swatch: {
|
|
3833
|
+
hue: h,
|
|
3834
|
+
saturation: s,
|
|
3835
|
+
lightness: l
|
|
3836
|
+
},
|
|
3837
|
+
alpha: a
|
|
3838
|
+
}) {
|
|
3839
|
+
return ColorHelper__default["default"]({
|
|
3840
|
+
h,
|
|
3841
|
+
s,
|
|
3842
|
+
l
|
|
3843
|
+
}).alpha(a).isLight() ? "rgba(0, 0, 0, 0.7)" : "rgba(255, 255, 255, 0.95)";
|
|
3844
|
+
}
|
|
3845
|
+
const Container$5 = styled__default["default"].div`
|
|
3846
|
+
position: relative;
|
|
3847
|
+
${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => styled.css`
|
|
3848
|
+
height: ${getSizeHeight(size)}px;
|
|
3849
|
+
width: ${getSizeHeight(size)}px;
|
|
3850
|
+
`)}
|
|
3851
|
+
`;
|
|
3852
|
+
const FakeCheckbox = styled__default["default"].div`
|
|
3853
|
+
position: absolute;
|
|
3854
|
+
width: 100%;
|
|
3855
|
+
height: 100%;
|
|
3856
|
+
border-style: solid;
|
|
3857
|
+
border-radius: 4px;
|
|
3858
|
+
pointer-events: none;
|
|
3859
|
+
border-width: 1px;
|
|
3860
|
+
${(props) => cssMediaRules([props.contrast], ([contrast = Contrasts.LIGHT]) => styled.css`
|
|
3861
|
+
border-color: ${getContrastBorderColor(contrast, props.error)};
|
|
3862
|
+
background-color: ${getContrastBackgroundColor(contrast)};
|
|
3863
|
+
`)}
|
|
3864
|
+
`;
|
|
3865
|
+
const HiddenCheckbox = styled__default["default"].input`
|
|
3866
|
+
position: absolute;
|
|
3867
|
+
opacity: 0;
|
|
3868
|
+
width: 100%;
|
|
3869
|
+
height: 100%;
|
|
3870
|
+
cursor: pointer;
|
|
3871
|
+
|
|
3872
|
+
&:disabled {
|
|
3873
|
+
cursor: no-drop;
|
|
3874
|
+
|
|
3875
|
+
& ~ ${FakeCheckbox} {
|
|
3876
|
+
opacity: 0.5;
|
|
3877
|
+
}
|
|
3878
|
+
}
|
|
3879
|
+
|
|
3880
|
+
&:checked ~ ${FakeCheckbox} {
|
|
3881
|
+
${(props) => cssMediaRules([props.brandColor], ([{
|
|
3882
|
+
swatch = {
|
|
3883
|
+
hue: 0,
|
|
3884
|
+
saturation: 0,
|
|
3885
|
+
lightness: 0
|
|
3886
|
+
},
|
|
3887
|
+
alpha = 1
|
|
3888
|
+
} = {}]) => styled.css`
|
|
3889
|
+
background-color: ${colorToString({
|
|
3890
|
+
swatch,
|
|
3891
|
+
alpha
|
|
3892
|
+
})};
|
|
3893
|
+
`)}
|
|
3894
|
+
border-color: transparent;
|
|
3895
|
+
|
|
3896
|
+
&::after {
|
|
3897
|
+
content: '';
|
|
3898
|
+
position: absolute;
|
|
3899
|
+
box-sizing: content-box;
|
|
3900
|
+
width: 25%;
|
|
3901
|
+
height: 50%;
|
|
3902
|
+
${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => styled.css`
|
|
3903
|
+
border-width: ${getSizeHeight(size) * 0.1}px;
|
|
3904
|
+
border-left: 0;
|
|
3905
|
+
border-top: 0;
|
|
3906
|
+
`)}
|
|
3907
|
+
border-style: solid;
|
|
3908
|
+
${(props) => cssMediaRules([props.brandColor], ([{
|
|
3909
|
+
swatch = {
|
|
3910
|
+
hue: 0,
|
|
3911
|
+
saturation: 0,
|
|
3912
|
+
lightness: 0
|
|
3913
|
+
},
|
|
3914
|
+
alpha = 1
|
|
3915
|
+
} = {}]) => styled.css`
|
|
3916
|
+
border-color: ${getCheckmarkColor$1({
|
|
3917
|
+
swatch,
|
|
3918
|
+
alpha
|
|
3919
|
+
})};
|
|
3920
|
+
`)}
|
|
3921
|
+
transform: rotate(45deg) translate3d(91%, -23%, 0);
|
|
3922
|
+
}
|
|
3923
|
+
}
|
|
3924
|
+
|
|
3925
|
+
&:not(:disabled) {
|
|
3926
|
+
&:focus ~ ${FakeCheckbox} {
|
|
3927
|
+
${(props) => cssMediaRules([props.brandColor], ([brandColor = {
|
|
3928
|
+
swatch: {
|
|
3929
|
+
hue: 0,
|
|
3930
|
+
saturation: 0,
|
|
3931
|
+
lightness: 0
|
|
3932
|
+
},
|
|
3933
|
+
alpha: 1
|
|
3934
|
+
}]) => styled.css`
|
|
3935
|
+
border-color: ${colorToString(brandColor)};
|
|
3936
|
+
`)}
|
|
3937
|
+
}
|
|
3938
|
+
}
|
|
3939
|
+
|
|
3940
|
+
&:not(:disabled):checked {
|
|
3941
|
+
&:focus ~ ${FakeCheckbox} {
|
|
3942
|
+
${(props) => cssMediaRules([props.contrast], ([contrast = Contrasts.LIGHT]) => styled.css`
|
|
3943
|
+
border-color: ${getContrastBorderColor(contrast, props.error)};
|
|
3944
|
+
`)}
|
|
3945
|
+
}
|
|
3946
|
+
}
|
|
3947
|
+
`;
|
|
3948
|
+
var Checkbox = React.forwardRef(function Checkbox2(_w, ref) {
|
|
3949
|
+
var _x = _w, {
|
|
3950
|
+
error,
|
|
3951
|
+
className,
|
|
3952
|
+
style,
|
|
3953
|
+
form
|
|
3954
|
+
} = _x, restOfProps = __objRest(_x, [
|
|
3955
|
+
"error",
|
|
3956
|
+
"className",
|
|
3957
|
+
"style",
|
|
3958
|
+
"form"
|
|
3959
|
+
]);
|
|
3960
|
+
const {
|
|
3961
|
+
size,
|
|
3962
|
+
contrast,
|
|
3963
|
+
brandColor
|
|
3964
|
+
} = useFormContext();
|
|
3965
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Container$5, {
|
|
3966
|
+
size,
|
|
3967
|
+
children: [/* @__PURE__ */ jsxRuntime.jsx(HiddenCheckbox, __spreadProps(__spreadValues({}, restOfProps), {
|
|
3968
|
+
type: "checkbox",
|
|
3969
|
+
ref,
|
|
3970
|
+
error,
|
|
3971
|
+
size,
|
|
3972
|
+
contrast,
|
|
3973
|
+
brandColor
|
|
3974
|
+
})), /* @__PURE__ */ jsxRuntime.jsx(FakeCheckbox, {
|
|
3975
|
+
className,
|
|
3976
|
+
error,
|
|
3977
|
+
contrast,
|
|
3978
|
+
style
|
|
3979
|
+
})]
|
|
3980
|
+
});
|
|
3981
|
+
});
|
|
3982
|
+
const StyledLabel$2 = styled__default["default"](Label$1)`
|
|
3983
|
+
display: flex;
|
|
3984
|
+
align-items: center;
|
|
3985
|
+
margin: 0;
|
|
3986
|
+
${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => styled.css`
|
|
3987
|
+
min-height: ${getSizeHeight$1(size)}px;
|
|
3988
|
+
max-height: ${getSizeHeight$1(size)}px;
|
|
3989
|
+
`)}
|
|
3990
|
+
`;
|
|
3991
|
+
const CheckboxContainer$1 = styled__default["default"].span`
|
|
3992
|
+
margin-right: 8px;
|
|
3993
|
+
`;
|
|
3994
|
+
var CheckboxTableField = React.forwardRef(function CheckboxTableField2(_y, ref) {
|
|
3995
|
+
var _z = _y, {
|
|
3996
|
+
form,
|
|
3997
|
+
id,
|
|
3998
|
+
name,
|
|
3999
|
+
label = "",
|
|
4000
|
+
value = false,
|
|
4001
|
+
error
|
|
4002
|
+
} = _z, restOfProps = __objRest(_z, [
|
|
4003
|
+
"form",
|
|
4004
|
+
"id",
|
|
4005
|
+
"name",
|
|
4006
|
+
"label",
|
|
4007
|
+
"value",
|
|
4008
|
+
"error"
|
|
4009
|
+
]);
|
|
4010
|
+
const {
|
|
4011
|
+
size
|
|
4012
|
+
} = useFormContext();
|
|
4013
|
+
function handleChange(event) {
|
|
4014
|
+
form.setFieldValue(name, event.currentTarget.checked);
|
|
4015
|
+
}
|
|
4016
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(StyledLabel$2, {
|
|
4017
|
+
htmlFor: id,
|
|
4018
|
+
size,
|
|
4019
|
+
children: [/* @__PURE__ */ jsxRuntime.jsx(CheckboxContainer$1, {
|
|
4020
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Checkbox, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4021
|
+
"aria-label": label,
|
|
4022
|
+
checked: value,
|
|
4023
|
+
onChange: handleChange,
|
|
4024
|
+
ref,
|
|
4025
|
+
id,
|
|
4026
|
+
error: error != null
|
|
4027
|
+
}))
|
|
4028
|
+
}), label]
|
|
4029
|
+
});
|
|
4030
|
+
});
|
|
4031
|
+
const MainLabel = styled__default["default"](Label$1)`
|
|
4032
|
+
margin: 0 0 4px 0;
|
|
4033
|
+
`;
|
|
4034
|
+
const StyledLabel$1 = styled__default["default"](Label$1)`
|
|
4035
|
+
display: flex;
|
|
4036
|
+
align-items: center;
|
|
4037
|
+
margin: 8px 0;
|
|
4038
|
+
|
|
4039
|
+
&:last-of-type {
|
|
4040
|
+
margin-bottom: 0;
|
|
4041
|
+
}
|
|
4042
|
+
`;
|
|
4043
|
+
const CheckboxContainer = styled__default["default"].span`
|
|
4044
|
+
margin-right: 8px;
|
|
4045
|
+
`;
|
|
4046
|
+
var MultipleSelectTableField = React.forwardRef(function MultipleSelectTableField2(_A, ref) {
|
|
4047
|
+
var _B = _A, {
|
|
4048
|
+
tableColumn,
|
|
4049
|
+
label = "",
|
|
4050
|
+
required,
|
|
4051
|
+
value = [],
|
|
4052
|
+
onChange,
|
|
4053
|
+
hideLabel = false
|
|
4054
|
+
} = _B, restOfProps = __objRest(_B, [
|
|
4055
|
+
"tableColumn",
|
|
4056
|
+
"label",
|
|
4057
|
+
"required",
|
|
4058
|
+
"value",
|
|
4059
|
+
"onChange",
|
|
4060
|
+
"hideLabel"
|
|
4061
|
+
]);
|
|
4062
|
+
const handle = React.useRef({
|
|
4063
|
+
validity: {
|
|
4064
|
+
valueMissing: required === true && value.length === 0,
|
|
4065
|
+
typeMismatch: false
|
|
4066
|
+
}
|
|
4067
|
+
});
|
|
4068
|
+
React.useImperativeHandle(ref, () => handle.current, []);
|
|
4069
|
+
function handleChange(event) {
|
|
4070
|
+
handle.current.validity.valueMissing = required === true && !event.currentTarget.checked && value.filter((v) => v !== event.currentTarget.value).length === 0;
|
|
4071
|
+
onChange(event);
|
|
4072
|
+
}
|
|
4073
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
4074
|
+
children: [!hideLabel && /* @__PURE__ */ jsxRuntime.jsx(MainLabel, {
|
|
4075
|
+
children: label
|
|
4076
|
+
}), tableColumn.options.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(StyledLabel$1, {
|
|
4077
|
+
htmlFor: option.id,
|
|
4078
|
+
children: [/* @__PURE__ */ jsxRuntime.jsx(CheckboxContainer, {
|
|
4079
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Checkbox, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4080
|
+
"aria-label": label,
|
|
4081
|
+
onChange: handleChange,
|
|
4082
|
+
checked: value.includes(option.name),
|
|
4083
|
+
id: option.id,
|
|
4084
|
+
value: option.name
|
|
4085
|
+
}))
|
|
4086
|
+
}), option.name]
|
|
4087
|
+
}, option.id))]
|
|
4088
|
+
});
|
|
4089
|
+
});
|
|
4090
|
+
function getCheckmarkColor({
|
|
4091
|
+
swatch: {
|
|
4092
|
+
hue: h,
|
|
4093
|
+
saturation: s,
|
|
4094
|
+
lightness: l
|
|
4095
|
+
} = {
|
|
4096
|
+
hue: 0,
|
|
4097
|
+
saturation: 0,
|
|
4098
|
+
lightness: 0
|
|
4099
|
+
},
|
|
4100
|
+
alpha: a
|
|
4101
|
+
}) {
|
|
4102
|
+
return ColorHelper__default["default"]({
|
|
4103
|
+
h,
|
|
4104
|
+
s,
|
|
4105
|
+
l
|
|
4106
|
+
}).alpha(a).isLight() ? "rgba(0, 0, 0, 0.7)" : "rgba(255, 255, 255, 0.95)";
|
|
4107
|
+
}
|
|
4108
|
+
const Container$4 = styled__default["default"].div`
|
|
4109
|
+
position: relative;
|
|
4110
|
+
${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => styled.css`
|
|
4111
|
+
height: ${getSizeHeight(size)}px;
|
|
4112
|
+
width: ${getSizeHeight(size)}px;
|
|
4113
|
+
`)}
|
|
4114
|
+
`;
|
|
4115
|
+
const FakeRadioButton = styled__default["default"].div`
|
|
4116
|
+
position: absolute;
|
|
4117
|
+
width: 100%;
|
|
4118
|
+
height: 100%;
|
|
4119
|
+
border-style: solid;
|
|
4120
|
+
border-radius: 50%;
|
|
4121
|
+
pointer-events: none;
|
|
4122
|
+
border-width: 1px;
|
|
4123
|
+
${(props) => cssMediaRules([props.contrast], ([contrast = Contrasts.LIGHT]) => styled.css`
|
|
4124
|
+
border-color: ${getContrastBorderColor(contrast, props.error)};
|
|
4125
|
+
background-color: ${getContrastBackgroundColor(contrast)};
|
|
4126
|
+
`)}
|
|
4127
|
+
`;
|
|
4128
|
+
const HiddenRadioButton = styled__default["default"].input.attrs({
|
|
4129
|
+
type: "radio"
|
|
4130
|
+
})`
|
|
4131
|
+
position: absolute;
|
|
4132
|
+
opacity: 0;
|
|
4133
|
+
width: 100%;
|
|
4134
|
+
height: 100%;
|
|
4135
|
+
cursor: pointer;
|
|
4136
|
+
|
|
4137
|
+
&:disabled {
|
|
4138
|
+
cursor: no-drop;
|
|
4139
|
+
|
|
4140
|
+
& ~ ${FakeRadioButton} {
|
|
4141
|
+
opacity: 0.5;
|
|
4142
|
+
}
|
|
4143
|
+
}
|
|
4144
|
+
|
|
4145
|
+
&:checked ~ ${FakeRadioButton} {
|
|
4146
|
+
${(props) => cssMediaRules([props.brandColor], ([brandColor = {
|
|
4147
|
+
swatch: {
|
|
4148
|
+
hue: 0,
|
|
4149
|
+
saturation: 0,
|
|
4150
|
+
lightness: 0
|
|
4151
|
+
},
|
|
4152
|
+
alpha: 1
|
|
4153
|
+
}]) => styled.css`
|
|
4154
|
+
background-color: ${colorToString(brandColor)};
|
|
4155
|
+
`)}
|
|
4156
|
+
border-color: transparent;
|
|
4157
|
+
|
|
4158
|
+
&::after {
|
|
4159
|
+
content: '';
|
|
4160
|
+
position: absolute;
|
|
4161
|
+
box-sizing: content-box;
|
|
4162
|
+
top: 50%;
|
|
4163
|
+
left: 50%;
|
|
4164
|
+
width: 50%;
|
|
4165
|
+
height: 50%;
|
|
4166
|
+
border-radius: 50%;
|
|
4167
|
+
transform: translate(-50%, -50%);
|
|
4168
|
+
${(props) => cssMediaRules([props.brandColor], ([brandColor = {
|
|
4169
|
+
swatch: {
|
|
4170
|
+
hue: 0,
|
|
4171
|
+
saturation: 0,
|
|
4172
|
+
lightness: 0
|
|
4173
|
+
},
|
|
4174
|
+
alpha: 1
|
|
4175
|
+
}]) => styled.css`
|
|
4176
|
+
background-color: ${getCheckmarkColor(brandColor)};
|
|
4177
|
+
`)}
|
|
4178
|
+
}
|
|
4179
|
+
}
|
|
4180
|
+
|
|
4181
|
+
&:not(:disabled) {
|
|
4182
|
+
&:focus ~ ${FakeRadioButton} {
|
|
4183
|
+
${(props) => cssMediaRules([props.brandColor], ([brandColor = {
|
|
4184
|
+
swatch: {
|
|
4185
|
+
hue: 0,
|
|
4186
|
+
saturation: 0,
|
|
4187
|
+
lightness: 0
|
|
4188
|
+
},
|
|
4189
|
+
alpha: 1
|
|
4190
|
+
}]) => styled.css`
|
|
4191
|
+
border-color: ${colorToString(brandColor)};
|
|
4192
|
+
`)}
|
|
4193
|
+
}
|
|
4194
|
+
}
|
|
4195
|
+
|
|
4196
|
+
&:not(:disabled):checked {
|
|
4197
|
+
&:focus ~ ${FakeRadioButton} {
|
|
4198
|
+
${(props) => cssMediaRules([props.contrast], ([contrast = Contrasts.LIGHT]) => styled.css`
|
|
4199
|
+
border-color: ${getContrastBorderColor(contrast, props.error)};
|
|
4200
|
+
`)}
|
|
4201
|
+
}
|
|
4202
|
+
}
|
|
4203
|
+
`;
|
|
4204
|
+
var RadioButton = React.forwardRef(function RadioButton2(_C, ref) {
|
|
4205
|
+
var _D = _C, {
|
|
4206
|
+
error,
|
|
4207
|
+
className,
|
|
4208
|
+
style,
|
|
4209
|
+
form
|
|
4210
|
+
} = _D, restOfProps = __objRest(_D, [
|
|
4211
|
+
"error",
|
|
4212
|
+
"className",
|
|
4213
|
+
"style",
|
|
4214
|
+
"form"
|
|
4215
|
+
]);
|
|
4216
|
+
const {
|
|
4217
|
+
size,
|
|
4218
|
+
contrast,
|
|
4219
|
+
brandColor
|
|
4220
|
+
} = useFormContext();
|
|
4221
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Container$4, {
|
|
4222
|
+
size,
|
|
4223
|
+
children: [/* @__PURE__ */ jsxRuntime.jsx(HiddenRadioButton, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4224
|
+
ref,
|
|
4225
|
+
error,
|
|
4226
|
+
contrast,
|
|
4227
|
+
brandColor
|
|
4228
|
+
})), /* @__PURE__ */ jsxRuntime.jsx(FakeRadioButton, {
|
|
4229
|
+
className,
|
|
4230
|
+
error,
|
|
4231
|
+
contrast,
|
|
4232
|
+
style
|
|
4233
|
+
})]
|
|
4234
|
+
});
|
|
4235
|
+
});
|
|
4236
|
+
const StyledLabel = styled__default["default"](Label$1)`
|
|
4237
|
+
display: flex;
|
|
4238
|
+
align-items: center;
|
|
4239
|
+
margin: 8px 0;
|
|
4240
|
+
|
|
4241
|
+
&:last-of-type {
|
|
4242
|
+
margin-bottom: 0;
|
|
4243
|
+
}
|
|
4244
|
+
`;
|
|
4245
|
+
const RadioButtonContainer = styled__default["default"].span`
|
|
4246
|
+
margin-right: 8px;
|
|
4247
|
+
`;
|
|
4248
|
+
var TableColumnRadioButtonGroup = React.forwardRef(function TableColumnRadioButtonGroup2(_E, ref) {
|
|
4249
|
+
var _F = _E, {
|
|
4250
|
+
tableColumn,
|
|
4251
|
+
label = "",
|
|
4252
|
+
value = "",
|
|
4253
|
+
required = false,
|
|
4254
|
+
hideLabel = false,
|
|
4255
|
+
onChange
|
|
4256
|
+
} = _F, restOfProps = __objRest(_F, [
|
|
4257
|
+
"tableColumn",
|
|
4258
|
+
"label",
|
|
4259
|
+
"value",
|
|
4260
|
+
"required",
|
|
4261
|
+
"hideLabel",
|
|
4262
|
+
"onChange"
|
|
4263
|
+
]);
|
|
4264
|
+
const handle = React.useRef({
|
|
4265
|
+
validity: {
|
|
4266
|
+
valueMissing: required === true && value === "",
|
|
4267
|
+
typeMismatch: false
|
|
4268
|
+
}
|
|
4269
|
+
});
|
|
4270
|
+
React.useImperativeHandle(ref, () => handle.current, []);
|
|
4271
|
+
function handleChange(event) {
|
|
4272
|
+
handle.current.validity.valueMissing = required === true && !event.currentTarget.checked;
|
|
4273
|
+
onChange(event);
|
|
4274
|
+
}
|
|
4275
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
4276
|
+
children: [!hideLabel && /* @__PURE__ */ jsxRuntime.jsx(Label$1, {
|
|
4277
|
+
as: "p",
|
|
4278
|
+
children: label
|
|
4279
|
+
}), tableColumn.options.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(StyledLabel, {
|
|
4280
|
+
htmlFor: option.id,
|
|
4281
|
+
"aria-label": label,
|
|
4282
|
+
children: [/* @__PURE__ */ jsxRuntime.jsx(RadioButtonContainer, {
|
|
4283
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(RadioButton, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4284
|
+
onChange: handleChange,
|
|
4285
|
+
checked: value === option.name,
|
|
4286
|
+
id: option.id,
|
|
4287
|
+
value: option.name
|
|
4288
|
+
}))
|
|
4289
|
+
}), option.name]
|
|
4290
|
+
}, option.id))]
|
|
4291
|
+
});
|
|
4292
|
+
});
|
|
4293
|
+
const Container$3 = styled__default["default"].div`
|
|
4294
|
+
${cssField()}
|
|
4295
|
+
display: flex;
|
|
4296
|
+
align-items: center;
|
|
4297
|
+
position: relative;
|
|
4298
|
+
user-select: none;
|
|
4299
|
+
border-color: #f19eb9;
|
|
4300
|
+
|
|
4301
|
+
&:focus,
|
|
4302
|
+
&:focus-within {
|
|
4303
|
+
border-color: #e54e7f;
|
|
4304
|
+
}
|
|
4305
|
+
|
|
4306
|
+
${(props) => cssMediaRules([props.size, props.contrast], ([size = Sizes.MEDIUM, contrast = Contrasts.LIGHT]) => styled.css`
|
|
4307
|
+
min-height: ${getSizeHeight$2(size)}px;
|
|
4308
|
+
max-height: ${getSizeHeight$2(size)}px;
|
|
4309
|
+
|
|
4310
|
+
&::after {
|
|
4311
|
+
content: '';
|
|
4312
|
+
position: absolute;
|
|
4313
|
+
right: ${getSizeHorizontalPadding(size)}px;
|
|
4314
|
+
top: 50%;
|
|
4315
|
+
transform: translate3d(0, -25%, 0);
|
|
4316
|
+
border: solid 0.35em transparent;
|
|
4317
|
+
border-top-color: ${getContrastColor$1(contrast)};
|
|
4318
|
+
}
|
|
4319
|
+
`)}
|
|
4320
|
+
`;
|
|
4321
|
+
const Select = styled__default["default"].select`
|
|
4322
|
+
appearance: none;
|
|
4323
|
+
position: absolute;
|
|
4324
|
+
top: 0;
|
|
4325
|
+
left: 0;
|
|
4326
|
+
opacity: 0;
|
|
4327
|
+
width: 100%;
|
|
4328
|
+
height: 100%;
|
|
4329
|
+
`;
|
|
4330
|
+
var TableColumnSingleSelect = React.forwardRef(function TableColumnSingleSelect2(_G, ref) {
|
|
4331
|
+
var _H = _G, {
|
|
4332
|
+
id,
|
|
4333
|
+
tableColumn,
|
|
4334
|
+
value = "",
|
|
4335
|
+
label = "",
|
|
4336
|
+
error = false,
|
|
4337
|
+
hideLabel = false,
|
|
4338
|
+
form
|
|
4339
|
+
} = _H, restOfProps = __objRest(_H, [
|
|
4340
|
+
"id",
|
|
4341
|
+
"tableColumn",
|
|
4342
|
+
"value",
|
|
4343
|
+
"label",
|
|
4344
|
+
"error",
|
|
4345
|
+
"hideLabel",
|
|
4346
|
+
"form"
|
|
4347
|
+
]);
|
|
4348
|
+
const {
|
|
4349
|
+
shape,
|
|
4350
|
+
size,
|
|
4351
|
+
contrast,
|
|
4352
|
+
brandColor
|
|
4353
|
+
} = useFormContext();
|
|
4354
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
4355
|
+
children: [!hideLabel && /* @__PURE__ */ jsxRuntime.jsx(Label$1, {
|
|
4356
|
+
htmlFor: id,
|
|
4357
|
+
children: label
|
|
4358
|
+
}), /* @__PURE__ */ jsxRuntime.jsxs(Container$3, {
|
|
4359
|
+
error,
|
|
4360
|
+
shape,
|
|
4361
|
+
size,
|
|
4362
|
+
contrast,
|
|
4363
|
+
brandColor,
|
|
4364
|
+
children: [/* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
4365
|
+
children: value === "" ? "-" : value
|
|
4366
|
+
}), /* @__PURE__ */ jsxRuntime.jsxs(Select, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4367
|
+
"aria-label": label,
|
|
4368
|
+
ref,
|
|
4369
|
+
id,
|
|
4370
|
+
value,
|
|
4371
|
+
children: [/* @__PURE__ */ jsxRuntime.jsx("option", {
|
|
4372
|
+
value: "",
|
|
4373
|
+
children: "-"
|
|
4374
|
+
}), tableColumn.options.map((option) => /* @__PURE__ */ jsxRuntime.jsx("option", {
|
|
4375
|
+
value: option.name,
|
|
4376
|
+
children: option.name
|
|
4377
|
+
}, option.id))]
|
|
4378
|
+
}))]
|
|
4379
|
+
})]
|
|
4380
|
+
});
|
|
4381
|
+
});
|
|
4382
|
+
var SingleSelectTableField = React.forwardRef(function SingleSelectTableField2(_I, ref) {
|
|
4383
|
+
var _J = _I, {
|
|
4384
|
+
type
|
|
4385
|
+
} = _J, restOfProps = __objRest(_J, [
|
|
4386
|
+
"type"
|
|
4387
|
+
]);
|
|
4388
|
+
return type === "select" ? /* @__PURE__ */ jsxRuntime.jsx(TableColumnSingleSelect, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4389
|
+
ref
|
|
4390
|
+
})) : /* @__PURE__ */ jsxRuntime.jsx(TableColumnRadioButtonGroup, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4391
|
+
ref
|
|
4392
|
+
}));
|
|
4393
|
+
});
|
|
4394
|
+
var PhoneNumberTableField = React.forwardRef(function PhoneNumberTableField2(_K, ref) {
|
|
4395
|
+
var _L = _K, {
|
|
4396
|
+
id,
|
|
4397
|
+
label = "",
|
|
4398
|
+
name,
|
|
4399
|
+
error,
|
|
4400
|
+
hideLabel = false
|
|
4401
|
+
} = _L, restOfProps = __objRest(_L, [
|
|
4402
|
+
"id",
|
|
4403
|
+
"label",
|
|
4404
|
+
"name",
|
|
4405
|
+
"error",
|
|
4406
|
+
"hideLabel"
|
|
4407
|
+
]);
|
|
4408
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
4409
|
+
children: [!hideLabel && /* @__PURE__ */ jsxRuntime.jsx(Label$1, {
|
|
4410
|
+
htmlFor: id,
|
|
4411
|
+
children: label
|
|
4412
|
+
}), /* @__PURE__ */ jsxRuntime.jsx(Input$2, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4413
|
+
"aria-label": label,
|
|
4414
|
+
ref,
|
|
4415
|
+
id,
|
|
4416
|
+
name,
|
|
4417
|
+
type: "tel",
|
|
4418
|
+
error: error != null
|
|
4419
|
+
}))]
|
|
4420
|
+
});
|
|
4421
|
+
});
|
|
4422
|
+
var EmailTableField = React.forwardRef(function EmailTableField2(_M, ref) {
|
|
4423
|
+
var _N = _M, {
|
|
4424
|
+
id,
|
|
4425
|
+
label = "",
|
|
4426
|
+
name,
|
|
4427
|
+
error,
|
|
4428
|
+
hideLabel = false
|
|
4429
|
+
} = _N, restOfProps = __objRest(_N, [
|
|
4430
|
+
"id",
|
|
4431
|
+
"label",
|
|
4432
|
+
"name",
|
|
4433
|
+
"error",
|
|
4434
|
+
"hideLabel"
|
|
4435
|
+
]);
|
|
4436
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
4437
|
+
children: [!hideLabel && /* @__PURE__ */ jsxRuntime.jsx(Label$1, {
|
|
4438
|
+
htmlFor: id,
|
|
4439
|
+
children: label
|
|
4440
|
+
}), /* @__PURE__ */ jsxRuntime.jsx(Input$2, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4441
|
+
"aria-label": label,
|
|
4442
|
+
ref,
|
|
4443
|
+
id,
|
|
4444
|
+
name,
|
|
4445
|
+
type: "email",
|
|
4446
|
+
error: error != null
|
|
4447
|
+
}))]
|
|
4448
|
+
});
|
|
4449
|
+
});
|
|
4450
|
+
var URLTableField = React.forwardRef(function URLTableField2(_O, ref) {
|
|
4451
|
+
var _P = _O, {
|
|
4452
|
+
id,
|
|
4453
|
+
label = "",
|
|
4454
|
+
name,
|
|
4455
|
+
error,
|
|
4456
|
+
hideLabel = false
|
|
4457
|
+
} = _P, restOfProps = __objRest(_P, [
|
|
4458
|
+
"id",
|
|
4459
|
+
"label",
|
|
4460
|
+
"name",
|
|
4461
|
+
"error",
|
|
4462
|
+
"hideLabel"
|
|
4463
|
+
]);
|
|
4464
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
4465
|
+
children: [!hideLabel && /* @__PURE__ */ jsxRuntime.jsx(Label$1, {
|
|
4466
|
+
htmlFor: id,
|
|
4467
|
+
children: label
|
|
4468
|
+
}), /* @__PURE__ */ jsxRuntime.jsx(Input$2, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4469
|
+
"aria-label": label,
|
|
4470
|
+
ref,
|
|
4471
|
+
id,
|
|
4472
|
+
name,
|
|
4473
|
+
type: "url",
|
|
4474
|
+
error: error != null
|
|
4475
|
+
}))]
|
|
4476
|
+
});
|
|
4477
|
+
});
|
|
4478
|
+
var NumberTableField = React.forwardRef(function NumberTableField2(_Q, ref) {
|
|
4479
|
+
var _R = _Q, {
|
|
4480
|
+
id,
|
|
4481
|
+
label = "",
|
|
4482
|
+
name,
|
|
4483
|
+
error,
|
|
4484
|
+
hideLabel = false
|
|
4485
|
+
} = _R, restOfProps = __objRest(_R, [
|
|
4486
|
+
"id",
|
|
4487
|
+
"label",
|
|
4488
|
+
"name",
|
|
4489
|
+
"error",
|
|
4490
|
+
"hideLabel"
|
|
4491
|
+
]);
|
|
4492
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
4493
|
+
children: [!hideLabel && /* @__PURE__ */ jsxRuntime.jsx(Label$1, {
|
|
4494
|
+
htmlFor: id,
|
|
4495
|
+
children: label
|
|
4496
|
+
}), /* @__PURE__ */ jsxRuntime.jsx(Input$2, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4497
|
+
"aria-label": label,
|
|
4498
|
+
ref,
|
|
4499
|
+
id,
|
|
4500
|
+
name,
|
|
4501
|
+
type: "number",
|
|
4502
|
+
error: error != null
|
|
4503
|
+
}))]
|
|
4504
|
+
});
|
|
4505
|
+
});
|
|
4506
|
+
const Label = styled__default["default"].div`
|
|
4507
|
+
display: block;
|
|
4508
|
+
max-width: 120px;
|
|
4509
|
+
min-width: 60px;
|
|
4510
|
+
border-radius: 2px;
|
|
4511
|
+
background-color: #5f49f4;
|
|
4512
|
+
opacity: 0.4;
|
|
4513
|
+
${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => styled.css`
|
|
4514
|
+
margin: calc(0.25 * ${getSizeHeight(size)}px + 2px) 0;
|
|
4515
|
+
min-height: ${0.5 * getSizeHeight(size)}px;
|
|
4516
|
+
max-height: ${0.5 * getSizeHeight(size)}px;
|
|
4517
|
+
`)}
|
|
4518
|
+
`;
|
|
4519
|
+
const Input = styled__default["default"].div`
|
|
4520
|
+
display: block;
|
|
4521
|
+
width: 100%;
|
|
4522
|
+
border-width: 2px;
|
|
4523
|
+
border-style: solid;
|
|
4524
|
+
border-color: #5f49f4;
|
|
4525
|
+
opacity: 0.4;
|
|
4526
|
+
${(props) => cssMediaRules([props.shape, props.size], ([shape = Shapes.ROUNDED, size = Sizes.MEDIUM]) => styled.css`
|
|
4527
|
+
min-height: ${getSizeHeight$1(size)}px;
|
|
4528
|
+
max-height: ${getSizeHeight$1(size)}px;
|
|
4529
|
+
border-radius: ${getShapeBorderRadius(shape)}px;
|
|
4530
|
+
`)}
|
|
4531
|
+
`;
|
|
4532
|
+
function PlaceholderTableField() {
|
|
4533
|
+
const {
|
|
4534
|
+
size,
|
|
4535
|
+
shape
|
|
4536
|
+
} = useFormContext();
|
|
4537
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
4538
|
+
children: [/* @__PURE__ */ jsxRuntime.jsx(Label, {
|
|
4539
|
+
size
|
|
4540
|
+
}), /* @__PURE__ */ jsxRuntime.jsx(Input, {
|
|
4541
|
+
shape,
|
|
4542
|
+
size
|
|
4543
|
+
})]
|
|
4544
|
+
});
|
|
4545
|
+
}
|
|
4546
|
+
function getTypeMismatchErrorMessage(tableColumn, label) {
|
|
4547
|
+
switch ((tableColumn || {}).__typename) {
|
|
4548
|
+
case "PhoneNumberTableColumn":
|
|
4549
|
+
return `${label} field must be a valid phone number.`;
|
|
4550
|
+
case "EmailTableColumn":
|
|
4551
|
+
return `${label} field must be a valid email.`;
|
|
4552
|
+
case "URLTableColumn":
|
|
4553
|
+
return `${label} field must be a valid URL.`;
|
|
4554
|
+
case "NumberTableColumn":
|
|
4555
|
+
return `${label} field must be a valid number.`;
|
|
4556
|
+
case "SingleLineTextTableColumn":
|
|
4557
|
+
case "LongTextTableColumn":
|
|
4558
|
+
case "CheckboxTableColumn":
|
|
4559
|
+
default:
|
|
4560
|
+
return `${label} field is invalid.`;
|
|
4561
|
+
}
|
|
4562
|
+
}
|
|
4563
|
+
function getTableColumnField(tableColumn) {
|
|
4564
|
+
switch ((tableColumn || {}).__typename) {
|
|
4565
|
+
case "SingleLineTextTableColumn":
|
|
4566
|
+
return SingleLineTextTableField;
|
|
4567
|
+
case "LongTextTableColumn":
|
|
4568
|
+
return LongTextTableField;
|
|
4569
|
+
case "CheckboxTableColumn":
|
|
4570
|
+
return CheckboxTableField;
|
|
4571
|
+
case "MultipleSelectTableColumn":
|
|
4572
|
+
return MultipleSelectTableField;
|
|
4573
|
+
case "SingleSelectTableColumn":
|
|
4574
|
+
return SingleSelectTableField;
|
|
4575
|
+
case "PhoneNumberTableColumn":
|
|
4576
|
+
return PhoneNumberTableField;
|
|
4577
|
+
case "EmailTableColumn":
|
|
4578
|
+
return EmailTableField;
|
|
4579
|
+
case "URLTableColumn":
|
|
4580
|
+
return URLTableField;
|
|
4581
|
+
case "NumberTableColumn":
|
|
4582
|
+
return NumberTableField;
|
|
4583
|
+
default:
|
|
4584
|
+
return SingleLineTextTableField;
|
|
4585
|
+
}
|
|
4586
|
+
}
|
|
4587
|
+
function Field({
|
|
4588
|
+
tableColumn,
|
|
4589
|
+
tableFormField: {
|
|
4590
|
+
id,
|
|
4591
|
+
label = "",
|
|
4592
|
+
placeholder: placeholder2,
|
|
4593
|
+
required = false,
|
|
4594
|
+
hidden = false,
|
|
4595
|
+
type = "radio",
|
|
4596
|
+
hideLabel = false
|
|
4597
|
+
}
|
|
4598
|
+
}) {
|
|
4599
|
+
const TableColumnField = getTableColumnField(tableColumn);
|
|
4600
|
+
const input = React.useRef(null);
|
|
4601
|
+
if (!tableColumn)
|
|
4602
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PlaceholderTableField, {});
|
|
4603
|
+
function validate() {
|
|
4604
|
+
let errorMessage;
|
|
4605
|
+
if (input.current) {
|
|
4606
|
+
const {
|
|
4607
|
+
validity = {}
|
|
4608
|
+
} = input.current;
|
|
4609
|
+
if (validity.valueMissing)
|
|
4610
|
+
errorMessage = `${label} is required.`;
|
|
4611
|
+
if (validity.typeMismatch)
|
|
4612
|
+
errorMessage = getTypeMismatchErrorMessage(tableColumn, label);
|
|
4613
|
+
}
|
|
4614
|
+
return errorMessage;
|
|
4615
|
+
}
|
|
4616
|
+
return /* @__PURE__ */ jsxRuntime.jsx(formik.Field, {
|
|
4617
|
+
name: tableColumn.name,
|
|
4618
|
+
validate,
|
|
4619
|
+
children: ({
|
|
4620
|
+
field,
|
|
4621
|
+
form
|
|
4622
|
+
}) => hidden ? /* @__PURE__ */ jsxRuntime.jsx("input", __spreadProps(__spreadValues({}, field), {
|
|
4623
|
+
ref: input,
|
|
4624
|
+
type: "hidden"
|
|
4625
|
+
})) : /* @__PURE__ */ jsxRuntime.jsx(TableColumnField, __spreadProps(__spreadValues({}, field), {
|
|
4626
|
+
type,
|
|
4627
|
+
form,
|
|
4628
|
+
tableColumn,
|
|
4629
|
+
ref: input,
|
|
4630
|
+
id,
|
|
4631
|
+
error: formik.getIn(form.touched, field.name) && formik.getIn(form.errors, field.name),
|
|
4632
|
+
label,
|
|
4633
|
+
placeholder: placeholder2,
|
|
4634
|
+
required,
|
|
4635
|
+
hideLabel
|
|
4636
|
+
}))
|
|
4637
|
+
});
|
|
4638
|
+
}
|
|
4639
|
+
var _g;
|
|
4640
|
+
function _extends$s() {
|
|
4641
|
+
_extends$s = Object.assign || function(target) {
|
|
4642
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
4643
|
+
var source = arguments[i];
|
|
4644
|
+
for (var key in source) {
|
|
4645
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
4646
|
+
target[key] = source[key];
|
|
4647
|
+
}
|
|
4648
|
+
}
|
|
4649
|
+
}
|
|
4650
|
+
return target;
|
|
4651
|
+
};
|
|
4652
|
+
return _extends$s.apply(this, arguments);
|
|
4653
|
+
}
|
|
4654
|
+
var SvgSpinner20 = function SvgSpinner202(props) {
|
|
4655
|
+
return /* @__PURE__ */ React__namespace.createElement("svg", _extends$s({
|
|
4656
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4657
|
+
width: 20,
|
|
4658
|
+
height: 20
|
|
4659
|
+
}, props), _g || (_g = /* @__PURE__ */ React__namespace.createElement("g", {
|
|
4660
|
+
fill: "none",
|
|
4661
|
+
strokeWidth: 2,
|
|
4662
|
+
transform: "translate(1 1)"
|
|
4663
|
+
}, /* @__PURE__ */ React__namespace.createElement("circle", {
|
|
4664
|
+
stroke: "currentColor",
|
|
4665
|
+
cx: 9,
|
|
4666
|
+
cy: 9,
|
|
4667
|
+
r: 9,
|
|
4668
|
+
strokeOpacity: 0.4
|
|
4669
|
+
}), /* @__PURE__ */ React__namespace.createElement("path", {
|
|
4670
|
+
d: "M9 18A9 9 0 0 0 9 0"
|
|
4671
|
+
}))));
|
|
4672
|
+
};
|
|
4673
|
+
const spin = styled.keyframes`
|
|
4674
|
+
from {
|
|
4675
|
+
transform: rotate(0deg);
|
|
4676
|
+
}
|
|
4677
|
+
to {
|
|
4678
|
+
transform: rotate(360deg);
|
|
4679
|
+
}
|
|
4680
|
+
`;
|
|
4681
|
+
const Icon = styled__default["default"](SvgSpinner20)`
|
|
4682
|
+
display: inline-flex;
|
|
4683
|
+
animation: ${spin} 1s linear infinite;
|
|
4684
|
+
stroke: currentColor;
|
|
4685
|
+
`;
|
|
4686
|
+
function Spinner() {
|
|
4687
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon, {});
|
|
4688
|
+
}
|
|
4689
|
+
function useTableFormFieldRefs(propController, { fieldsCount }) {
|
|
4690
|
+
const [container, setContainer] = React.useState(null);
|
|
4691
|
+
const [items, setItems] = React.useState(Array(fieldsCount + 1).fill(null));
|
|
4692
|
+
const isInBuilder = useIsInBuilder();
|
|
4693
|
+
React.useEffect(() => {
|
|
4694
|
+
if (!isInBuilder)
|
|
4695
|
+
return;
|
|
4696
|
+
let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest);
|
|
4697
|
+
return () => {
|
|
4698
|
+
cancelAnimationFrame(animationFrameHandle);
|
|
4699
|
+
};
|
|
4700
|
+
function handleAnimationFrameRequest() {
|
|
4701
|
+
if (propController == null)
|
|
4702
|
+
return;
|
|
4703
|
+
if (container != null)
|
|
4704
|
+
propController.tableFormLayoutChange({ layout: boxModels.getBox(container) });
|
|
4705
|
+
items.map((item, index) => {
|
|
4706
|
+
if (item == null)
|
|
4707
|
+
return;
|
|
4708
|
+
propController.tableFormFieldLayoutChange({ index, layout: boxModels.getBox(item) });
|
|
4709
|
+
});
|
|
4710
|
+
animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest);
|
|
4711
|
+
}
|
|
4712
|
+
}, [propController, container, items, isInBuilder]);
|
|
4713
|
+
const itemRefs = React.useMemo(() => Array.from({ length: fieldsCount + 1 }).map((_, index) => (item) => {
|
|
4714
|
+
setItems((is) => [...is.slice(0, index), item, ...is.slice(index + 1)]);
|
|
4715
|
+
}), [fieldsCount, setItems]);
|
|
4716
|
+
return { container: setContainer, items: itemRefs };
|
|
4717
|
+
}
|
|
4718
|
+
const LOCAL_STORAGE_NAMESPACE = "@@makeswift/components/form";
|
|
4719
|
+
function getSizeFontSize(size) {
|
|
4720
|
+
switch (size) {
|
|
4721
|
+
case Sizes.SMALL:
|
|
4722
|
+
return 12;
|
|
4723
|
+
case Sizes.MEDIUM:
|
|
4724
|
+
return 14;
|
|
4725
|
+
case Sizes.LARGE:
|
|
4726
|
+
return 18;
|
|
4727
|
+
default:
|
|
4728
|
+
throw new Error(`Invalid form size "${size}"`);
|
|
4729
|
+
}
|
|
4730
|
+
}
|
|
4731
|
+
const Alignments = {
|
|
4732
|
+
LEFT: "left",
|
|
4733
|
+
CENTER: "center",
|
|
4734
|
+
RIGHT: "right"
|
|
4735
|
+
};
|
|
4736
|
+
const GridForm = styled__default["default"].form`
|
|
4737
|
+
display: flex;
|
|
4738
|
+
flex-wrap: wrap;
|
|
4739
|
+
width: 100%;
|
|
4740
|
+
${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => styled.css`
|
|
4741
|
+
font-size: ${getSizeFontSize(size)}px;
|
|
4742
|
+
`)}
|
|
4743
|
+
${cssWidth()}
|
|
4744
|
+
${cssMargin()}
|
|
4745
|
+
`;
|
|
4746
|
+
const GridItem$1 = styled__default["default"].div`
|
|
4747
|
+
align-self: flex-end;
|
|
4748
|
+
flex-direction: column;
|
|
4749
|
+
${cssGridItem()}
|
|
4750
|
+
`;
|
|
4751
|
+
function getAlignmentMargin(alignment) {
|
|
4752
|
+
switch (alignment) {
|
|
4753
|
+
case Alignments.LEFT:
|
|
4754
|
+
return "0 auto 0 0";
|
|
4755
|
+
case Alignments.RIGHT:
|
|
4756
|
+
return "0 0 0 auto";
|
|
4757
|
+
default:
|
|
4758
|
+
return "0 auto";
|
|
4759
|
+
}
|
|
4760
|
+
}
|
|
4761
|
+
const StyledButton = styled__default["default"]((props) => /* @__PURE__ */ jsxRuntime.jsx(Button$1, __spreadProps(__spreadValues({}, props), {
|
|
4762
|
+
as: "button"
|
|
4763
|
+
})))`
|
|
4764
|
+
display: flex;
|
|
4765
|
+
align-items: center;
|
|
4766
|
+
justify-content: center;
|
|
4767
|
+
${(props) => cssMediaRules([props.size, props.alignment], ([size = Sizes.MEDIUM, alignment = Alignments.CENTER]) => styled.css`
|
|
4768
|
+
min-height: ${getSizeHeight$1(size)}px;
|
|
4769
|
+
max-height: ${getSizeHeight$1(size)}px;
|
|
4770
|
+
margin: ${getAlignmentMargin(alignment)};
|
|
4771
|
+
padding-top: 0;
|
|
4772
|
+
padding-bottom: 0;
|
|
4773
|
+
`)}
|
|
4774
|
+
`;
|
|
4775
|
+
const ErrorContainer = styled__default["default"].div`
|
|
4776
|
+
padding: 8px 16px;
|
|
4777
|
+
background-color: #f19eb9;
|
|
4778
|
+
border-radius: 4px;
|
|
4779
|
+
margin-top: 16px;
|
|
4780
|
+
`;
|
|
4781
|
+
const IconContainer = styled__default["default"].div`
|
|
4782
|
+
fill: currentColor;
|
|
4783
|
+
`;
|
|
4784
|
+
const ErrorMessage = styled__default["default"].p`
|
|
4785
|
+
font-size: 12px;
|
|
4786
|
+
margin: 8px 0;
|
|
4787
|
+
color: rgba(127, 0, 0, 0.95);
|
|
4788
|
+
`;
|
|
4789
|
+
function getTableColumnDefaultValue(tableColumn) {
|
|
4790
|
+
switch (tableColumn.__typename) {
|
|
4791
|
+
case "CheckboxTableColumn":
|
|
4792
|
+
return false;
|
|
4793
|
+
case "MultipleSelectTableColumn":
|
|
4794
|
+
return [];
|
|
4795
|
+
case "SingleLineTextTableColumn":
|
|
4796
|
+
case "LongTextTableColumn":
|
|
4797
|
+
case "SingleSelectTableColumn":
|
|
4798
|
+
case "PhoneNumberTableColumn":
|
|
4799
|
+
case "EmailTableColumn":
|
|
4800
|
+
case "URLTableColumn":
|
|
4801
|
+
case "NumberTableColumn":
|
|
4802
|
+
default:
|
|
4803
|
+
return "";
|
|
4804
|
+
}
|
|
4805
|
+
}
|
|
4806
|
+
const CREATE_TABLE_RECORD = client.gql`
|
|
4807
|
+
mutation CreateTableRecord($input: CreateTableRecordInput!) {
|
|
4808
|
+
createTableRecord(input: $input) {
|
|
4809
|
+
tableRecord {
|
|
4810
|
+
id
|
|
4811
|
+
}
|
|
4812
|
+
}
|
|
4813
|
+
}
|
|
4814
|
+
`;
|
|
4815
|
+
const Form = React.forwardRef(function Form2({
|
|
4816
|
+
id,
|
|
4817
|
+
tableId,
|
|
4818
|
+
fields: fieldsProp,
|
|
4819
|
+
submitLabel = "Submit",
|
|
4820
|
+
submitLink,
|
|
4821
|
+
shape,
|
|
4822
|
+
size,
|
|
4823
|
+
contrast,
|
|
4824
|
+
brandColor,
|
|
4825
|
+
gap,
|
|
4826
|
+
width,
|
|
4827
|
+
margin,
|
|
4828
|
+
submitTextStyle,
|
|
4829
|
+
submitVariant,
|
|
4830
|
+
submitTextColor,
|
|
4831
|
+
submitWidth,
|
|
4832
|
+
submitAlignment,
|
|
4833
|
+
labelTextStyle,
|
|
4834
|
+
labelTextColor
|
|
4835
|
+
}, ref) {
|
|
4836
|
+
const fields = React.useMemo(() => {
|
|
4837
|
+
var _a;
|
|
4838
|
+
return (_a = fieldsProp == null ? void 0 : fieldsProp.fields) != null ? _a : [];
|
|
4839
|
+
}, [fieldsProp]);
|
|
4840
|
+
const grid = React.useMemo(() => {
|
|
4841
|
+
var _a;
|
|
4842
|
+
return (_a = fieldsProp == null ? void 0 : fieldsProp.grid) != null ? _a : [];
|
|
4843
|
+
}, [fieldsProp]);
|
|
4844
|
+
const {
|
|
4845
|
+
data: {
|
|
4846
|
+
table
|
|
4847
|
+
} = {}
|
|
4848
|
+
} = useTable(tableId);
|
|
4849
|
+
const [createTableRecord] = useMutation(CREATE_TABLE_RECORD);
|
|
4850
|
+
const [refEl, setRefEl] = React.useState(null);
|
|
4851
|
+
const [propControllers, setPropControllers] = React.useState(null);
|
|
4852
|
+
const [initialValues, setInitialValues] = React.useState(() => fields.reduce((acc, formField) => {
|
|
4853
|
+
const tableColumn = table && table.columns.find((field) => field.id === formField.tableColumnId);
|
|
4854
|
+
const defaultValue = formField ? formField.defaultValue : null;
|
|
4855
|
+
if (tableColumn) {
|
|
4856
|
+
acc[tableColumn.name] = defaultValue == null ? getTableColumnDefaultValue(tableColumn) : defaultValue;
|
|
4857
|
+
}
|
|
4858
|
+
return acc;
|
|
4859
|
+
}, {}));
|
|
4860
|
+
const controller = propControllers == null ? void 0 : propControllers.fields;
|
|
4861
|
+
const {
|
|
4862
|
+
container,
|
|
4863
|
+
items
|
|
4864
|
+
} = useTableFormFieldRefs(controller, {
|
|
4865
|
+
fieldsCount: fields.length
|
|
4866
|
+
});
|
|
4867
|
+
const [isDone, setIsDone] = React.useState(false);
|
|
4868
|
+
const linkRef = React.useRef(null);
|
|
4869
|
+
React.useImperativeHandle(ref, () => ({
|
|
4870
|
+
getBoxModel() {
|
|
4871
|
+
return refEl instanceof Element ? boxModels.getBox(refEl) : null;
|
|
4872
|
+
},
|
|
4873
|
+
setPropControllers
|
|
4874
|
+
}), [refEl, setPropControllers]);
|
|
4875
|
+
React.useEffect(() => {
|
|
4876
|
+
container(refEl);
|
|
4877
|
+
}, [container, refEl]);
|
|
4878
|
+
React.useEffect(() => {
|
|
4879
|
+
if (!isDone)
|
|
4880
|
+
return;
|
|
4881
|
+
let timeoutId = setTimeout(() => setIsDone(false), 2500);
|
|
4882
|
+
return () => clearTimeout(timeoutId);
|
|
4883
|
+
}, [isDone]);
|
|
4884
|
+
function getTableColumn({
|
|
4885
|
+
tableColumnId
|
|
4886
|
+
}) {
|
|
4887
|
+
return table && table.columns.find((field) => tableColumnId === field.id);
|
|
4888
|
+
}
|
|
4889
|
+
async function handleSubmit(values, {
|
|
4890
|
+
setSubmitting,
|
|
4891
|
+
resetForm,
|
|
4892
|
+
setStatus
|
|
4893
|
+
}) {
|
|
4894
|
+
if (table) {
|
|
4895
|
+
const columns = [];
|
|
4896
|
+
fields.forEach((field) => {
|
|
4897
|
+
const tableColumn = getTableColumn(field);
|
|
4898
|
+
if (tableColumn) {
|
|
4899
|
+
const data = values[tableColumn.name];
|
|
4900
|
+
if (data) {
|
|
4901
|
+
columns.push({
|
|
4902
|
+
columnId: field.tableColumnId,
|
|
4903
|
+
data
|
|
4904
|
+
});
|
|
4905
|
+
if (field.autofill) {
|
|
4906
|
+
localStorage.setItem(`${LOCAL_STORAGE_NAMESPACE}/${tableColumn.name}`, JSON.stringify(data));
|
|
4907
|
+
}
|
|
4908
|
+
}
|
|
4909
|
+
}
|
|
4910
|
+
});
|
|
4911
|
+
try {
|
|
4912
|
+
await createTableRecord({
|
|
4913
|
+
variables: {
|
|
4914
|
+
input: {
|
|
4915
|
+
data: {
|
|
4916
|
+
tableId: table.id,
|
|
4917
|
+
columns
|
|
4918
|
+
}
|
|
4919
|
+
}
|
|
4920
|
+
}
|
|
4921
|
+
});
|
|
4922
|
+
setIsDone(true);
|
|
4923
|
+
setInitialValues((prev) => fields.reduce((acc, field) => {
|
|
4924
|
+
const tableColumn = getTableColumn(field);
|
|
4925
|
+
if (tableColumn) {
|
|
4926
|
+
const data = values[tableColumn.name];
|
|
4927
|
+
if (data && field.autofill)
|
|
4928
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
4929
|
+
[tableColumn.name]: data
|
|
4930
|
+
});
|
|
4931
|
+
}
|
|
4932
|
+
return acc;
|
|
4933
|
+
}, __spreadValues({}, prev)));
|
|
4934
|
+
resetForm();
|
|
4935
|
+
if (linkRef.current != null)
|
|
4936
|
+
linkRef.current.click();
|
|
4937
|
+
} catch (error) {
|
|
4938
|
+
setStatus({
|
|
4939
|
+
error: "An unexpected error has occurred, please try again later"
|
|
4940
|
+
});
|
|
4941
|
+
} finally {
|
|
4942
|
+
setSubmitting(false);
|
|
4943
|
+
}
|
|
4944
|
+
}
|
|
4945
|
+
}
|
|
4946
|
+
React.useEffect(() => {
|
|
4947
|
+
setInitialValues((prev) => fields.reduce((acc, formField) => {
|
|
4948
|
+
const tableColumn = table && table.columns.find((field) => field.id === formField.tableColumnId);
|
|
4949
|
+
if (tableColumn && formField.autofill) {
|
|
4950
|
+
const storedValue = localStorage.getItem(`${LOCAL_STORAGE_NAMESPACE}/${tableColumn.name}`);
|
|
4951
|
+
if (storedValue) {
|
|
4952
|
+
try {
|
|
4953
|
+
acc[tableColumn.name] = JSON.parse(storedValue);
|
|
4954
|
+
} catch (e) {
|
|
4955
|
+
}
|
|
4956
|
+
}
|
|
4957
|
+
}
|
|
4958
|
+
return acc;
|
|
4959
|
+
}, __spreadValues({}, prev)));
|
|
4960
|
+
}, [fields, table]);
|
|
4961
|
+
const brandColorData = useColor(brandColor);
|
|
4962
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Provider, {
|
|
4963
|
+
value: {
|
|
4964
|
+
shape,
|
|
4965
|
+
size,
|
|
4966
|
+
contrast,
|
|
4967
|
+
brandColor: brandColorData,
|
|
4968
|
+
labelTextStyle,
|
|
4969
|
+
labelTextColor
|
|
4970
|
+
},
|
|
4971
|
+
children: tableId == null ? /* @__PURE__ */ jsxRuntime.jsx(Placeholder$1, {
|
|
4972
|
+
ref: setRefEl,
|
|
4973
|
+
width,
|
|
4974
|
+
margin
|
|
4975
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
4976
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(formik.Formik, {
|
|
4977
|
+
onSubmit: handleSubmit,
|
|
4978
|
+
initialValues,
|
|
4979
|
+
initialStatus: {
|
|
4980
|
+
error: null
|
|
4981
|
+
},
|
|
4982
|
+
enableReinitialize: true,
|
|
4983
|
+
children: (formik$1) => {
|
|
4984
|
+
const error = formik$1.status && formik$1.status.error;
|
|
4985
|
+
const errors = fields.map((field) => {
|
|
4986
|
+
const tableColumn = getTableColumn(field);
|
|
4987
|
+
return tableColumn && formik.getIn(formik$1.touched, tableColumn.name) && formik.getIn(formik$1.errors, tableColumn.name);
|
|
4988
|
+
}).filter((message) => typeof message === "string");
|
|
4989
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
4990
|
+
children: [/* @__PURE__ */ jsxRuntime.jsxs(GridForm, {
|
|
4991
|
+
ref: setRefEl,
|
|
4992
|
+
id,
|
|
4993
|
+
width,
|
|
4994
|
+
margin,
|
|
4995
|
+
size,
|
|
4996
|
+
onSubmit: formik$1.handleSubmit,
|
|
4997
|
+
onReset: formik$1.handleReset,
|
|
4998
|
+
noValidate: true,
|
|
4999
|
+
children: [fields.map((field, index) => {
|
|
5000
|
+
const tableColumn = getTableColumn(field);
|
|
5001
|
+
return /* @__PURE__ */ jsxRuntime.jsx(GridItem$1, {
|
|
5002
|
+
ref: items[index],
|
|
5003
|
+
grid,
|
|
5004
|
+
index,
|
|
5005
|
+
rowGap: gap,
|
|
5006
|
+
columnGap: gap,
|
|
5007
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Field, {
|
|
5008
|
+
tableColumn,
|
|
5009
|
+
tableFormField: field
|
|
5010
|
+
})
|
|
5011
|
+
}, field.id);
|
|
5012
|
+
}), /* @__PURE__ */ jsxRuntime.jsxs(GridItem$1, {
|
|
5013
|
+
ref: items[fields.length],
|
|
5014
|
+
grid,
|
|
5015
|
+
index: fields.length,
|
|
5016
|
+
rowGap: gap,
|
|
5017
|
+
columnGap: gap,
|
|
5018
|
+
children: [/* @__PURE__ */ jsxRuntime.jsx(StyledButton, {
|
|
5019
|
+
type: "submit",
|
|
5020
|
+
disabled: formik$1.isSubmitting || isDone,
|
|
5021
|
+
shape,
|
|
5022
|
+
size,
|
|
5023
|
+
color: brandColor,
|
|
5024
|
+
variant: submitVariant,
|
|
5025
|
+
textColor: submitTextColor,
|
|
5026
|
+
width: submitWidth,
|
|
5027
|
+
alignment: submitAlignment,
|
|
5028
|
+
textStyle: submitTextStyle,
|
|
5029
|
+
children: formik$1.isSubmitting ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, {}) : isDone ? /* @__PURE__ */ jsxRuntime.jsx(IconContainer, {
|
|
5030
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(SvgCheck12, {})
|
|
5031
|
+
}) : submitLabel
|
|
5032
|
+
}), (errors.length > 0 || error) && /* @__PURE__ */ jsxRuntime.jsxs(ErrorContainer, {
|
|
5033
|
+
children: [errors.map((message) => /* @__PURE__ */ jsxRuntime.jsx(ErrorMessage, {
|
|
5034
|
+
children: message
|
|
5035
|
+
}, message)), error != null && /* @__PURE__ */ jsxRuntime.jsx(ErrorMessage, {
|
|
5036
|
+
children: error
|
|
5037
|
+
})]
|
|
5038
|
+
})]
|
|
5039
|
+
})]
|
|
5040
|
+
}), submitLink != null && /* @__PURE__ */ jsxRuntime.jsx(Link, {
|
|
5041
|
+
ref: linkRef,
|
|
5042
|
+
hidden: true,
|
|
5043
|
+
link: submitLink
|
|
5044
|
+
})]
|
|
5045
|
+
});
|
|
5046
|
+
}
|
|
5047
|
+
})
|
|
5048
|
+
})
|
|
5049
|
+
});
|
|
5050
|
+
});
|
|
5051
|
+
function registerComponent$4(runtime) {
|
|
5052
|
+
return runtime.registerComponent(Form, {
|
|
5053
|
+
type: "./components/Form/index.js",
|
|
5054
|
+
label: "Form",
|
|
5055
|
+
icon: "Form40",
|
|
5056
|
+
props: {
|
|
5057
|
+
id: descriptors.ElementID(),
|
|
5058
|
+
tableId: descriptors.Table(),
|
|
5059
|
+
fields: descriptors.TableFormFields(),
|
|
5060
|
+
submitLink: descriptors.Link({
|
|
5061
|
+
label: "Redirect to",
|
|
5062
|
+
options: [{
|
|
5063
|
+
value: "OPEN_PAGE",
|
|
5064
|
+
label: "Open page"
|
|
5065
|
+
}, {
|
|
5066
|
+
value: "OPEN_URL",
|
|
5067
|
+
label: "Open URL"
|
|
5068
|
+
}]
|
|
5069
|
+
}),
|
|
5070
|
+
gap: descriptors.GapY({
|
|
5071
|
+
preset: [{
|
|
5072
|
+
deviceId: "desktop",
|
|
5073
|
+
value: {
|
|
5074
|
+
value: 10,
|
|
5075
|
+
unit: "px"
|
|
5076
|
+
}
|
|
5077
|
+
}],
|
|
5078
|
+
label: "Gap",
|
|
5079
|
+
defaultValue: {
|
|
5080
|
+
value: 0,
|
|
5081
|
+
unit: "px"
|
|
5082
|
+
}
|
|
5083
|
+
}),
|
|
5084
|
+
shape: descriptors.ResponsiveIconRadioGroup({
|
|
5085
|
+
label: "Shape",
|
|
5086
|
+
options: [{
|
|
5087
|
+
label: "Pill",
|
|
5088
|
+
value: Shapes.PILL,
|
|
5089
|
+
icon: "ButtonPill16"
|
|
5090
|
+
}, {
|
|
5091
|
+
label: "Rounded",
|
|
5092
|
+
value: Shapes.ROUNDED,
|
|
5093
|
+
icon: "ButtonRounded16"
|
|
5094
|
+
}, {
|
|
5095
|
+
label: "Square",
|
|
5096
|
+
value: Shapes.SQUARE,
|
|
5097
|
+
icon: "ButtonSquare16"
|
|
5098
|
+
}],
|
|
5099
|
+
defaultValue: Shapes.ROUNDED
|
|
5100
|
+
}),
|
|
5101
|
+
size: descriptors.ResponsiveIconRadioGroup({
|
|
5102
|
+
label: "Size",
|
|
5103
|
+
options: [{
|
|
5104
|
+
label: "Small",
|
|
5105
|
+
value: Sizes.SMALL,
|
|
5106
|
+
icon: "SizeSmall16"
|
|
5107
|
+
}, {
|
|
5108
|
+
label: "Medium",
|
|
5109
|
+
value: Sizes.MEDIUM,
|
|
5110
|
+
icon: "SizeMedium16"
|
|
5111
|
+
}, {
|
|
5112
|
+
label: "Large",
|
|
5113
|
+
value: Sizes.LARGE,
|
|
5114
|
+
icon: "SizeLarge16"
|
|
5115
|
+
}],
|
|
5116
|
+
defaultValue: Sizes.MEDIUM
|
|
5117
|
+
}),
|
|
5118
|
+
contrast: descriptors.ResponsiveIconRadioGroup({
|
|
5119
|
+
label: "Color",
|
|
5120
|
+
options: [{
|
|
5121
|
+
label: "Light mode",
|
|
5122
|
+
value: Contrasts.LIGHT,
|
|
5123
|
+
icon: "Sun16"
|
|
5124
|
+
}, {
|
|
5125
|
+
label: "Dark mode",
|
|
5126
|
+
value: Contrasts.DARK,
|
|
5127
|
+
icon: "Moon16"
|
|
5128
|
+
}],
|
|
5129
|
+
defaultValue: Contrasts.LIGHT
|
|
5130
|
+
}),
|
|
5131
|
+
labelTextStyle: descriptors.TextStyle({
|
|
5132
|
+
label: "Label text style"
|
|
5133
|
+
}),
|
|
5134
|
+
labelTextColor: descriptors.ResponsiveColor({
|
|
5135
|
+
label: "Label text color"
|
|
5136
|
+
}),
|
|
5137
|
+
submitTextStyle: descriptors.TextStyle({
|
|
5138
|
+
label: "Button text style"
|
|
5139
|
+
}),
|
|
5140
|
+
brandColor: descriptors.ResponsiveColor({
|
|
5141
|
+
label: "Button color",
|
|
5142
|
+
placeholder: "black"
|
|
5143
|
+
}),
|
|
5144
|
+
submitTextColor: descriptors.ResponsiveColor({
|
|
5145
|
+
label: "Button text color",
|
|
5146
|
+
placeholder: "white"
|
|
5147
|
+
}),
|
|
5148
|
+
submitLabel: descriptors.TextInput({
|
|
5149
|
+
label: "Button label",
|
|
5150
|
+
placeholder: "Submit"
|
|
5151
|
+
}),
|
|
5152
|
+
submitVariant: descriptors.ResponsiveSelect({
|
|
5153
|
+
label: "Button style",
|
|
5154
|
+
options: [{
|
|
5155
|
+
value: "flat",
|
|
5156
|
+
label: "Flat"
|
|
5157
|
+
}, {
|
|
5158
|
+
value: "outline",
|
|
5159
|
+
label: "Outline"
|
|
5160
|
+
}, {
|
|
5161
|
+
value: "shadow",
|
|
5162
|
+
label: "Floating"
|
|
5163
|
+
}, {
|
|
5164
|
+
value: "clear",
|
|
5165
|
+
label: "Clear"
|
|
5166
|
+
}, {
|
|
5167
|
+
value: "blocky",
|
|
5168
|
+
label: "Blocky"
|
|
5169
|
+
}, {
|
|
5170
|
+
value: "bubbly",
|
|
5171
|
+
label: "Bubbly"
|
|
5172
|
+
}, {
|
|
5173
|
+
value: "skewed",
|
|
5174
|
+
label: "Skewed"
|
|
5175
|
+
}],
|
|
5176
|
+
defaultValue: "flat"
|
|
5177
|
+
}),
|
|
5178
|
+
submitWidth: descriptors.ResponsiveLength({
|
|
5179
|
+
label: "Button width"
|
|
5180
|
+
}),
|
|
5181
|
+
submitAlignment: descriptors.ResponsiveIconRadioGroup({
|
|
5182
|
+
label: "Button alignment",
|
|
5183
|
+
options: [{
|
|
5184
|
+
label: "Left",
|
|
5185
|
+
value: Alignments.LEFT,
|
|
5186
|
+
icon: "AlignLeft16"
|
|
5187
|
+
}, {
|
|
5188
|
+
label: "Center",
|
|
5189
|
+
value: Alignments.CENTER,
|
|
5190
|
+
icon: "AlignCenter16"
|
|
5191
|
+
}, {
|
|
5192
|
+
label: "Right",
|
|
5193
|
+
value: Alignments.RIGHT,
|
|
5194
|
+
icon: "AlignRight16"
|
|
5195
|
+
}],
|
|
5196
|
+
defaultValue: Alignments.CENTER
|
|
5197
|
+
}),
|
|
5198
|
+
width: descriptors.Width({
|
|
5199
|
+
preset: [{
|
|
5200
|
+
deviceId: "desktop",
|
|
5201
|
+
value: {
|
|
5202
|
+
value: 550,
|
|
5203
|
+
unit: "px"
|
|
5204
|
+
}
|
|
5205
|
+
}],
|
|
5206
|
+
defaultValue: {
|
|
5207
|
+
value: 100,
|
|
5208
|
+
unit: "%"
|
|
5209
|
+
}
|
|
5210
|
+
}),
|
|
5211
|
+
margin: descriptors.Margin()
|
|
5212
|
+
}
|
|
5213
|
+
});
|
|
5214
|
+
}
|
|
5215
|
+
var _path$r;
|
|
5216
|
+
function _extends$r() {
|
|
5217
|
+
_extends$r = Object.assign || function(target) {
|
|
5218
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
5219
|
+
var source = arguments[i];
|
|
5220
|
+
for (var key in source) {
|
|
5221
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
5222
|
+
target[key] = source[key];
|
|
5223
|
+
}
|
|
5224
|
+
}
|
|
5225
|
+
}
|
|
5226
|
+
return target;
|
|
5227
|
+
};
|
|
5228
|
+
return _extends$r.apply(this, arguments);
|
|
5229
|
+
}
|
|
5230
|
+
var SvgMobileMenu28 = function SvgMobileMenu282(props) {
|
|
5231
|
+
return /* @__PURE__ */ React__namespace.createElement("svg", _extends$r({
|
|
5232
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5233
|
+
width: 28,
|
|
5234
|
+
height: 28
|
|
5235
|
+
}, props), _path$r || (_path$r = /* @__PURE__ */ React__namespace.createElement("path", {
|
|
5236
|
+
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"
|
|
5237
|
+
})));
|
|
5238
|
+
};
|
|
5239
|
+
const GutterContainer = styled__default["default"].div`
|
|
5240
|
+
${(p) => cssMediaRules([p.gutter], ([gutter = {
|
|
5241
|
+
value: 0,
|
|
5242
|
+
unit: "px"
|
|
5243
|
+
}]) => styled.css`
|
|
5244
|
+
padding-left: ${p.first ? "0px" : `${gutter.value / 2}${gutter.unit}`};
|
|
5245
|
+
padding-right: ${p.last ? "0px" : `${gutter.value / 2}${gutter.unit}`};
|
|
5246
|
+
`)}
|
|
5247
|
+
`;
|
|
5248
|
+
const PlaceholderLink$1 = styled__default["default"].div`
|
|
5249
|
+
width: ${(props) => props.width}px;
|
|
5250
|
+
height: ${(props) => props.button === true ? 32 : 8}px;
|
|
5251
|
+
background-color: #a1a8c2;
|
|
5252
|
+
border-radius: ${(props) => props.button === true ? 6 : 2}px;
|
|
5253
|
+
opacity: 0.4;
|
|
5254
|
+
`;
|
|
5255
|
+
const links$1 = [{
|
|
5256
|
+
width: 50
|
|
5257
|
+
}, {
|
|
5258
|
+
width: 70
|
|
5259
|
+
}, {
|
|
5260
|
+
width: 60
|
|
5261
|
+
}, {
|
|
5262
|
+
width: 80,
|
|
5263
|
+
button: true
|
|
5264
|
+
}];
|
|
5265
|
+
function LinksPlaceholder({
|
|
5266
|
+
gutter
|
|
5267
|
+
}) {
|
|
5268
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
5269
|
+
children: links$1.map((link, i) => /* @__PURE__ */ jsxRuntime.jsx(GutterContainer, {
|
|
5270
|
+
gutter,
|
|
5271
|
+
first: i === 0,
|
|
5272
|
+
last: i === links$1.length - 1,
|
|
5273
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(PlaceholderLink$1, __spreadValues({}, link))
|
|
5274
|
+
}, i))
|
|
5275
|
+
});
|
|
5276
|
+
}
|
|
5277
|
+
var _path$q;
|
|
5278
|
+
function _extends$q() {
|
|
5279
|
+
_extends$q = Object.assign || function(target) {
|
|
5280
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
5281
|
+
var source = arguments[i];
|
|
5282
|
+
for (var key in source) {
|
|
5283
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
5284
|
+
target[key] = source[key];
|
|
5285
|
+
}
|
|
5286
|
+
}
|
|
5287
|
+
}
|
|
5288
|
+
return target;
|
|
5289
|
+
};
|
|
5290
|
+
return _extends$q.apply(this, arguments);
|
|
5291
|
+
}
|
|
5292
|
+
var SvgCaretDown8 = function SvgCaretDown82(props) {
|
|
5293
|
+
return /* @__PURE__ */ React__namespace.createElement("svg", _extends$q({
|
|
5294
|
+
width: 8,
|
|
5295
|
+
height: 8,
|
|
5296
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
5297
|
+
}, props), _path$q || (_path$q = /* @__PURE__ */ React__namespace.createElement("path", {
|
|
5298
|
+
d: "M1 2a1 1 0 0 0-.707 1.707l3 3a1 1 0 0 0 1.414 0l3-3A1 1 0 0 0 7 2H1z"
|
|
5299
|
+
})));
|
|
5300
|
+
};
|
|
5301
|
+
var _path$p;
|
|
5302
|
+
function _extends$p() {
|
|
5303
|
+
_extends$p = Object.assign || function(target) {
|
|
5304
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
5305
|
+
var source = arguments[i];
|
|
5306
|
+
for (var key in source) {
|
|
3701
5307
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
3702
5308
|
target[key] = source[key];
|
|
3703
5309
|
}
|
|
@@ -3835,22 +5441,22 @@ const StyledDropDownItem = styled__default["default"](Link)`
|
|
|
3835
5441
|
background-color: rgba(0, 0, 0, 0.04);
|
|
3836
5442
|
}
|
|
3837
5443
|
`;
|
|
3838
|
-
function DropDownItem$1(
|
|
3839
|
-
var
|
|
5444
|
+
function DropDownItem$1(_S) {
|
|
5445
|
+
var _T = _S, {
|
|
3840
5446
|
color
|
|
3841
|
-
} =
|
|
5447
|
+
} = _T, restOfProps = __objRest(_T, [
|
|
3842
5448
|
"color"
|
|
3843
5449
|
]);
|
|
3844
5450
|
return /* @__PURE__ */ jsxRuntime.jsx(StyledDropDownItem, __spreadProps(__spreadValues({}, restOfProps), {
|
|
3845
5451
|
color: useColor(color)
|
|
3846
5452
|
}));
|
|
3847
5453
|
}
|
|
3848
|
-
function DropDownButton(
|
|
3849
|
-
var
|
|
5454
|
+
function DropDownButton(_U) {
|
|
5455
|
+
var _V = _U, {
|
|
3850
5456
|
label,
|
|
3851
5457
|
caret = "caret",
|
|
3852
5458
|
links: links2 = []
|
|
3853
|
-
} =
|
|
5459
|
+
} = _V, restOfProps = __objRest(_V, [
|
|
3854
5460
|
"label",
|
|
3855
5461
|
"caret",
|
|
3856
5462
|
"links"
|
|
@@ -3866,7 +5472,7 @@ function DropDownButton(_q) {
|
|
|
3866
5472
|
}, [setPosition]);
|
|
3867
5473
|
return /* @__PURE__ */ jsxRuntime.jsxs(DropDownContainer, {
|
|
3868
5474
|
ref: container,
|
|
3869
|
-
children: [/* @__PURE__ */ jsxRuntime.jsx(Button, __spreadProps(__spreadValues({}, restOfProps), {
|
|
5475
|
+
children: [/* @__PURE__ */ jsxRuntime.jsx(Button$1, __spreadProps(__spreadValues({}, restOfProps), {
|
|
3870
5476
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
3871
5477
|
style: {
|
|
3872
5478
|
display: "flex",
|
|
@@ -3927,7 +5533,7 @@ const DropDownMenu = styled__default["default"].div`
|
|
|
3927
5533
|
flex-direction: column;
|
|
3928
5534
|
padding: 8px;
|
|
3929
5535
|
`;
|
|
3930
|
-
const ButtonLink$1 = styled__default["default"](Button)`
|
|
5536
|
+
const ButtonLink$1 = styled__default["default"](Button$1)`
|
|
3931
5537
|
margin: 8px 0;
|
|
3932
5538
|
`;
|
|
3933
5539
|
const StyledLink$2 = styled__default["default"](Link)`
|
|
@@ -3940,24 +5546,24 @@ const StyledLink$2 = styled__default["default"](Link)`
|
|
|
3940
5546
|
color: ${color == null ? "black" : colorToString(color)};
|
|
3941
5547
|
`)}
|
|
3942
5548
|
`;
|
|
3943
|
-
function DropDownItem(
|
|
3944
|
-
var
|
|
5549
|
+
function DropDownItem(_W) {
|
|
5550
|
+
var _X = _W, {
|
|
3945
5551
|
color
|
|
3946
|
-
} =
|
|
5552
|
+
} = _X, restOfProps = __objRest(_X, [
|
|
3947
5553
|
"color"
|
|
3948
5554
|
]);
|
|
3949
5555
|
return /* @__PURE__ */ jsxRuntime.jsx(StyledLink$2, __spreadProps(__spreadValues({}, restOfProps), {
|
|
3950
5556
|
color: useColor(color)
|
|
3951
5557
|
}));
|
|
3952
5558
|
}
|
|
3953
|
-
function MobileDropDownButton(
|
|
3954
|
-
var
|
|
5559
|
+
function MobileDropDownButton(_Y) {
|
|
5560
|
+
var _Z = _Y, {
|
|
3955
5561
|
label,
|
|
3956
5562
|
caret,
|
|
3957
5563
|
links: links2 = [],
|
|
3958
5564
|
onClose = () => {
|
|
3959
5565
|
}
|
|
3960
|
-
} =
|
|
5566
|
+
} = _Z, restOfProps = __objRest(_Z, [
|
|
3961
5567
|
"label",
|
|
3962
5568
|
"caret",
|
|
3963
5569
|
"links",
|
|
@@ -3999,7 +5605,7 @@ function MobileDropDownButton(_u) {
|
|
|
3999
5605
|
})]
|
|
4000
5606
|
});
|
|
4001
5607
|
}
|
|
4002
|
-
const ButtonLink = styled__default["default"](Button)`
|
|
5608
|
+
const ButtonLink = styled__default["default"](Button$1)`
|
|
4003
5609
|
margin: 8px 0;
|
|
4004
5610
|
`;
|
|
4005
5611
|
const Container$2 = styled__default["default"].div`
|
|
@@ -4164,7 +5770,7 @@ const Navigation = React.forwardRef(function Navigation2({
|
|
|
4164
5770
|
gutter,
|
|
4165
5771
|
first: i === 0,
|
|
4166
5772
|
last: i === links2.length - 1,
|
|
4167
|
-
children: [link.type === "button" && /* @__PURE__ */ jsxRuntime.jsx(Button, __spreadProps(__spreadValues({}, link.payload), {
|
|
5773
|
+
children: [link.type === "button" && /* @__PURE__ */ jsxRuntime.jsx(Button$1, __spreadProps(__spreadValues({}, link.payload), {
|
|
4168
5774
|
children: link.payload.label
|
|
4169
5775
|
})), link.type === "dropdown" && /* @__PURE__ */ jsxRuntime.jsx(DropDownButton, __spreadValues({}, link.payload))]
|
|
4170
5776
|
}, link.id)) : /* @__PURE__ */ jsxRuntime.jsx(LinksPlaceholder, {
|
|
@@ -4291,7 +5897,7 @@ const PlaceholderBase = styled__default["default"].div`
|
|
|
4291
5897
|
height: 80px;
|
|
4292
5898
|
padding: 8px;
|
|
4293
5899
|
`;
|
|
4294
|
-
var Placeholder = React.forwardRef(function
|
|
5900
|
+
var Placeholder = React.forwardRef(function Placeholder4(props, ref) {
|
|
4295
5901
|
return /* @__PURE__ */ jsxRuntime.jsx(PlaceholderBase, __spreadProps(__spreadValues({}, props), {
|
|
4296
5902
|
ref,
|
|
4297
5903
|
children: /* @__PURE__ */ jsxRuntime.jsx("svg", {
|
|
@@ -5409,10 +7015,10 @@ const Span = styled__default["default"].span`
|
|
|
5409
7015
|
`}
|
|
5410
7016
|
`, shallowMergeFallbacks)}
|
|
5411
7017
|
`;
|
|
5412
|
-
function Mark(
|
|
5413
|
-
var
|
|
7018
|
+
function Mark(__) {
|
|
7019
|
+
var _$ = __, {
|
|
5414
7020
|
value
|
|
5415
|
-
} =
|
|
7021
|
+
} = _$, restOfProps = __objRest(_$, [
|
|
5416
7022
|
"value"
|
|
5417
7023
|
]);
|
|
5418
7024
|
const typographyStyle = useTypographyMark(value);
|
|
@@ -5450,10 +7056,10 @@ const StyledBlock = styled__default["default"].div`
|
|
|
5450
7056
|
border-left: 5px solid rgba(0, 0, 0, 0.1);
|
|
5451
7057
|
` : ""}
|
|
5452
7058
|
`;
|
|
5453
|
-
var Block = React.forwardRef(function Block2(
|
|
5454
|
-
var
|
|
7059
|
+
var Block = React.forwardRef(function Block2(_aa, ref) {
|
|
7060
|
+
var _ba = _aa, {
|
|
5455
7061
|
textAlign
|
|
5456
|
-
} =
|
|
7062
|
+
} = _ba, restOfProps = __objRest(_ba, [
|
|
5457
7063
|
"textAlign"
|
|
5458
7064
|
]);
|
|
5459
7065
|
return /* @__PURE__ */ jsxRuntime.jsx(StyledBlock, __spreadProps(__spreadValues({}, restOfProps), {
|
|
@@ -5578,10 +7184,10 @@ function Inlines() {
|
|
|
5578
7184
|
}
|
|
5579
7185
|
};
|
|
5580
7186
|
}
|
|
5581
|
-
const RichTextEditor = styled__default["default"](React.forwardRef(function RichTextEditor2(
|
|
5582
|
-
var
|
|
7187
|
+
const RichTextEditor = styled__default["default"](React.forwardRef(function RichTextEditor2(_ca, ref) {
|
|
7188
|
+
var _da = _ca, {
|
|
5583
7189
|
placeholder: placeholder2 = "Write some text..."
|
|
5584
|
-
} =
|
|
7190
|
+
} = _da, restOfProps = __objRest(_da, [
|
|
5585
7191
|
"placeholder"
|
|
5586
7192
|
]);
|
|
5587
7193
|
const plugins = React.useMemo(() => [Lists__default["default"](), LinkPlugin(), Inlines(), DeviceOverridesBlockPlugin(), DeviceOverridesMarksPlugin()], []);
|
|
@@ -5777,13 +7383,14 @@ function registerComponent(runtime) {
|
|
|
5777
7383
|
});
|
|
5778
7384
|
}
|
|
5779
7385
|
function registerBuiltinComponents(runtime) {
|
|
5780
|
-
const unregisterBoxComponent = registerComponent$
|
|
5781
|
-
const unregisterButtonComponent = registerComponent$
|
|
5782
|
-
const unregisterCarouselComponent = registerComponent$
|
|
5783
|
-
const unregisterCountdownComponent = registerComponent$
|
|
5784
|
-
const unregisterDividerComponent = registerComponent$
|
|
5785
|
-
const unregisterEmbedComponent = registerComponent$
|
|
5786
|
-
const
|
|
7386
|
+
const unregisterBoxComponent = registerComponent$b(runtime);
|
|
7387
|
+
const unregisterButtonComponent = registerComponent$a(runtime);
|
|
7388
|
+
const unregisterCarouselComponent = registerComponent$8(runtime);
|
|
7389
|
+
const unregisterCountdownComponent = registerComponent$7(runtime);
|
|
7390
|
+
const unregisterDividerComponent = registerComponent$6(runtime);
|
|
7391
|
+
const unregisterEmbedComponent = registerComponent$5(runtime);
|
|
7392
|
+
const unregisterFormComponent = registerComponent$4(runtime);
|
|
7393
|
+
const unregisterImageComponent = registerComponent$9(runtime);
|
|
5787
7394
|
const unregisterNavigationComponent = registerComponent$3(runtime);
|
|
5788
7395
|
const unregisterRootComponent = registerComponent$2(runtime);
|
|
5789
7396
|
const unregisterSocialLinksComponent = registerComponent$1(runtime);
|
|
@@ -5795,6 +7402,7 @@ function registerBuiltinComponents(runtime) {
|
|
|
5795
7402
|
unregisterCountdownComponent();
|
|
5796
7403
|
unregisterDividerComponent();
|
|
5797
7404
|
unregisterEmbedComponent();
|
|
7405
|
+
unregisterFormComponent();
|
|
5798
7406
|
unregisterImageComponent();
|
|
5799
7407
|
unregisterNavigationComponent();
|
|
5800
7408
|
unregisterRootComponent();
|
|
@@ -5802,7 +7410,7 @@ function registerBuiltinComponents(runtime) {
|
|
|
5802
7410
|
unregisterTextComponent();
|
|
5803
7411
|
};
|
|
5804
7412
|
}
|
|
5805
|
-
const contextDefaultValue = configureStore();
|
|
7413
|
+
const contextDefaultValue = reactPage.configureStore();
|
|
5806
7414
|
function createReactRuntime(store) {
|
|
5807
7415
|
return {
|
|
5808
7416
|
registerComponent(component, {
|
|
@@ -5834,7 +7442,7 @@ function RuntimeProvider({
|
|
|
5834
7442
|
makeswiftApiEndpoint
|
|
5835
7443
|
}) {
|
|
5836
7444
|
const [store, setStore] = React.useState(() => {
|
|
5837
|
-
const store2 = configureStore({
|
|
7445
|
+
const store2 = reactPage.configureStore({
|
|
5838
7446
|
preloadedState: contextDefaultValue.getState(),
|
|
5839
7447
|
rootElements: defaultRootElements
|
|
5840
7448
|
});
|
|
@@ -5904,6 +7512,25 @@ function RuntimeProvider({
|
|
|
5904
7512
|
})
|
|
5905
7513
|
});
|
|
5906
7514
|
}
|
|
7515
|
+
const PageContext = React.createContext(null);
|
|
7516
|
+
function usePageIdOrNull() {
|
|
7517
|
+
return React.useContext(PageContext);
|
|
7518
|
+
}
|
|
7519
|
+
function usePageId() {
|
|
7520
|
+
const pageIdOrNull = usePageIdOrNull();
|
|
7521
|
+
if (pageIdOrNull == null)
|
|
7522
|
+
throw new Error("`usePageId` must be used with `<PageProvider>`");
|
|
7523
|
+
return pageIdOrNull;
|
|
7524
|
+
}
|
|
7525
|
+
function PageProvider({
|
|
7526
|
+
id,
|
|
7527
|
+
children
|
|
7528
|
+
}) {
|
|
7529
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PageContext.Provider, {
|
|
7530
|
+
value: id,
|
|
7531
|
+
children
|
|
7532
|
+
});
|
|
7533
|
+
}
|
|
5907
7534
|
const DocumentContext = React.createContext(null);
|
|
5908
7535
|
function useDocumentKey() {
|
|
5909
7536
|
return React.useContext(DocumentContext);
|
|
@@ -5913,17 +7540,17 @@ function useSelector(selector) {
|
|
|
5913
7540
|
return withSelector.useSyncExternalStoreWithSelector(store.subscribe, store.getState, store.getState, selector);
|
|
5914
7541
|
}
|
|
5915
7542
|
function useComponent(type) {
|
|
5916
|
-
return useSelector((state) => getReactComponent(state, type));
|
|
7543
|
+
return useSelector((state) => reactPage.getReactComponent(state, type));
|
|
5917
7544
|
}
|
|
5918
7545
|
function useElementId(elementKey) {
|
|
5919
7546
|
const documentKey = useDocumentKey();
|
|
5920
|
-
return useSelector((state) => documentKey == null || elementKey == null ? null : getElementId(state, documentKey, elementKey));
|
|
7547
|
+
return useSelector((state) => documentKey == null || elementKey == null ? null : reactPage.getElementId(state, documentKey, elementKey));
|
|
5921
7548
|
}
|
|
5922
|
-
function
|
|
5923
|
-
return useSelector((state) =>
|
|
7549
|
+
function useDocument(documentKey) {
|
|
7550
|
+
return useSelector((state) => reactPage.getDocument(state, documentKey));
|
|
5924
7551
|
}
|
|
5925
7552
|
function useIsInBuilder() {
|
|
5926
|
-
return useSelector((state) => getIsInBuilder(state));
|
|
7553
|
+
return useSelector((state) => reactPage.getIsInBuilder(state));
|
|
5927
7554
|
}
|
|
5928
7555
|
function useDispatch() {
|
|
5929
7556
|
const store = React.useContext(Context);
|
|
@@ -5953,24 +7580,64 @@ const ElementData = React.memo(React.forwardRef(function ElementData2({
|
|
|
5953
7580
|
const ElementReference = React.memo(React.forwardRef(function ElementReference2({
|
|
5954
7581
|
elementReference
|
|
5955
7582
|
}, ref) {
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
7583
|
+
var _a;
|
|
7584
|
+
const {
|
|
7585
|
+
error,
|
|
7586
|
+
data
|
|
7587
|
+
} = useQuery(client.gql`
|
|
7588
|
+
query ElementReferenceGlobalElement($id: ID!) {
|
|
7589
|
+
globalElement(id: $id) {
|
|
7590
|
+
id
|
|
7591
|
+
data
|
|
7592
|
+
}
|
|
7593
|
+
}
|
|
7594
|
+
`, {
|
|
7595
|
+
variables: {
|
|
7596
|
+
id: elementReference.value
|
|
7597
|
+
}
|
|
7598
|
+
});
|
|
7599
|
+
const globalElementData = (_a = data == null ? void 0 : data.globalElement) == null ? void 0 : _a.data;
|
|
7600
|
+
const elementReferenceDocument = useDocument(elementReference.key);
|
|
7601
|
+
if (error != null) {
|
|
7602
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
7603
|
+
ref,
|
|
7604
|
+
children: [/* @__PURE__ */ jsxRuntime.jsx("p", {
|
|
7605
|
+
children: "Something went wrong!"
|
|
7606
|
+
}), /* @__PURE__ */ jsxRuntime.jsx("pre", {
|
|
7607
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("code", {
|
|
7608
|
+
children: JSON.stringify(error, null, 2)
|
|
7609
|
+
})
|
|
7610
|
+
})]
|
|
7611
|
+
});
|
|
7612
|
+
}
|
|
7613
|
+
if (globalElementData == null) {
|
|
7614
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
7615
|
+
ref,
|
|
7616
|
+
children: [/* @__PURE__ */ jsxRuntime.jsx("p", {
|
|
7617
|
+
children: "Not Found"
|
|
7618
|
+
}), /* @__PURE__ */ jsxRuntime.jsx("pre", {
|
|
7619
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("code", {
|
|
7620
|
+
children: JSON.stringify(elementReference, null, 2)
|
|
7621
|
+
})
|
|
7622
|
+
})]
|
|
7623
|
+
});
|
|
7624
|
+
}
|
|
7625
|
+
return elementReferenceDocument != null ? /* @__PURE__ */ jsxRuntime.jsx(Document, {
|
|
7626
|
+
document: elementReferenceDocument,
|
|
7627
|
+
ref
|
|
7628
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx(ElementData, {
|
|
7629
|
+
elementData: globalElementData,
|
|
7630
|
+
ref
|
|
5965
7631
|
});
|
|
5966
7632
|
}));
|
|
5967
|
-
const Element$1 = React.memo(function Element2({
|
|
7633
|
+
const Element$1 = React.memo(React.forwardRef(function Element2({
|
|
5968
7634
|
element
|
|
5969
|
-
}) {
|
|
7635
|
+
}, ref) {
|
|
5970
7636
|
const elementKey = element.key;
|
|
5971
7637
|
const dispatch = useDispatch();
|
|
5972
7638
|
const documentKey = useDocumentKey();
|
|
5973
7639
|
const [handle, setHandle] = React.useState(null);
|
|
7640
|
+
React.useImperativeHandle(ref, () => handle, [handle]);
|
|
5974
7641
|
React.useEffect(() => {
|
|
5975
7642
|
if (documentKey == null)
|
|
5976
7643
|
return;
|
|
@@ -5981,40 +7648,48 @@ const Element$1 = React.memo(function Element2({
|
|
|
5981
7648
|
return;
|
|
5982
7649
|
return dispatch(actions.mountComponentEffect(documentKey, elementKey));
|
|
5983
7650
|
}, [dispatch, documentKey, elementKey]);
|
|
5984
|
-
return isElementReference(element) ? /* @__PURE__ */ jsxRuntime.jsx(ElementReference, {
|
|
7651
|
+
return reactPage.isElementReference(element) ? /* @__PURE__ */ jsxRuntime.jsx(ElementReference, {
|
|
5985
7652
|
ref: setHandle,
|
|
5986
7653
|
elementReference: element
|
|
5987
7654
|
}, elementKey) : /* @__PURE__ */ jsxRuntime.jsx(ElementData, {
|
|
5988
7655
|
ref: setHandle,
|
|
5989
7656
|
elementData: element
|
|
5990
7657
|
}, elementKey);
|
|
5991
|
-
});
|
|
5992
|
-
const Document = React.memo(function Document2({
|
|
5993
|
-
|
|
5994
|
-
}) {
|
|
5995
|
-
|
|
5996
|
-
|
|
7658
|
+
}));
|
|
7659
|
+
const Document = React.memo(React.forwardRef(function Document2({
|
|
7660
|
+
document
|
|
7661
|
+
}, ref) {
|
|
7662
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DocumentContext.Provider, {
|
|
7663
|
+
value: document.key,
|
|
7664
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Element$1, {
|
|
7665
|
+
ref,
|
|
7666
|
+
element: document.rootElement
|
|
7667
|
+
})
|
|
7668
|
+
});
|
|
7669
|
+
}));
|
|
7670
|
+
const DocumentReference = React.memo(React.forwardRef(function DocumentReference2({
|
|
7671
|
+
documentReference
|
|
7672
|
+
}, ref) {
|
|
7673
|
+
const document = useDocument(documentReference.key);
|
|
7674
|
+
if (document == null) {
|
|
5997
7675
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
7676
|
+
ref,
|
|
5998
7677
|
children: [/* @__PURE__ */ jsxRuntime.jsx("p", {
|
|
5999
7678
|
children: "Document Not Found"
|
|
6000
7679
|
}), /* @__PURE__ */ jsxRuntime.jsx("pre", {
|
|
6001
7680
|
children: /* @__PURE__ */ jsxRuntime.jsx("code", {
|
|
6002
|
-
children: JSON.stringify(
|
|
6003
|
-
documentKey
|
|
6004
|
-
}, null, 2)
|
|
7681
|
+
children: JSON.stringify(documentReference, null, 2)
|
|
6005
7682
|
})
|
|
6006
7683
|
})]
|
|
6007
7684
|
});
|
|
6008
7685
|
}
|
|
6009
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
element: documentRootElement
|
|
6013
|
-
})
|
|
7686
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Document, {
|
|
7687
|
+
ref,
|
|
7688
|
+
document
|
|
6014
7689
|
});
|
|
6015
|
-
});
|
|
7690
|
+
}));
|
|
6016
7691
|
exports.Box = Box;
|
|
6017
|
-
exports.Button = Button;
|
|
7692
|
+
exports.Button = Button$1;
|
|
6018
7693
|
exports.Carousel = Carousel;
|
|
6019
7694
|
exports.Countdown = Countdown;
|
|
6020
7695
|
exports.DEFAULT_BOX_ANIMATE_DELAY = DEFAULT_BOX_ANIMATE_DELAY;
|
|
@@ -6025,17 +7700,18 @@ exports.DEFAULT_ITEM_ANIMATE_DURATION = DEFAULT_ITEM_ANIMATE_DURATION;
|
|
|
6025
7700
|
exports.DEFAULT_ITEM_ANIMATE_TYPE = DEFAULT_ITEM_ANIMATE_TYPE;
|
|
6026
7701
|
exports.DEFAULT_ITEM_STAGGER_DURATION = DEFAULT_ITEM_STAGGER_DURATION;
|
|
6027
7702
|
exports.Divider = Divider;
|
|
6028
|
-
exports.
|
|
7703
|
+
exports.DocumentReference = DocumentReference;
|
|
6029
7704
|
exports.Element = Element$1;
|
|
6030
7705
|
exports.Embed = Embed;
|
|
7706
|
+
exports.Form = Form;
|
|
6031
7707
|
exports.ImageComponent = ImageComponent;
|
|
6032
7708
|
exports.Navigation = Navigation;
|
|
7709
|
+
exports.PageProvider = PageProvider;
|
|
6033
7710
|
exports.ReactRuntime = ReactRuntime;
|
|
6034
7711
|
exports.Root = Root;
|
|
6035
7712
|
exports.RuntimeProvider = RuntimeProvider;
|
|
6036
7713
|
exports.SocialLinks = SocialLinks;
|
|
6037
7714
|
exports.Text = Text;
|
|
6038
|
-
exports.createDocument = createDocument;
|
|
6039
7715
|
exports.cssBorder = cssBorder;
|
|
6040
7716
|
exports.cssBorderRadius = cssBorderRadius;
|
|
6041
7717
|
exports.cssBoxShadow = cssBoxShadow;
|
|
@@ -6045,15 +7721,8 @@ exports.cssMediaRules = cssMediaRules;
|
|
|
6045
7721
|
exports.cssPadding = cssPadding;
|
|
6046
7722
|
exports.cssTextStyle = cssTextStyle;
|
|
6047
7723
|
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
7724
|
exports.registerBuiltinComponents = registerBuiltinComponents;
|
|
6057
|
-
exports.registerComponent = registerComponent$
|
|
7725
|
+
exports.registerComponent = registerComponent$b;
|
|
6058
7726
|
exports.useIsInBuilder = useIsInBuilder;
|
|
7727
|
+
exports.usePageId = usePageId;
|
|
6059
7728
|
//# sourceMappingURL=react.cjs2.js.map
|