@makeswift/runtime 0.0.0-6baa2a2 → 0.0.0-76a2297
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builder.js +1 -0
- package/dist/Page.cjs.js +215 -0
- package/dist/Page.cjs.js.map +1 -0
- package/dist/Page.es.js +209 -0
- package/dist/Page.es.js.map +1 -0
- package/dist/actions.cjs.js +34 -2
- package/dist/actions.cjs.js.map +1 -1
- package/dist/actions.es.js +29 -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 +18 -3
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +8 -2
- 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 +10 -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 +10 -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 +40 -18
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +40 -17
- 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 +36 -39
- package/dist/react-builder-preview.cjs.js.map +1 -1
- package/dist/react-builder-preview.es.js +34 -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 +10 -4
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.cjs2.js +2292 -428
- package/dist/react.cjs2.js.map +1 -1
- package/dist/react.es.js +7 -2
- package/dist/react.es.js.map +1 -1
- package/dist/react.es2.js +2281 -419
- 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 +24 -4
- 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/Form/prop-controllers.d.ts +1 -0
- package/dist/types/components/builtin/Form/prop-controllers.d.ts.map +1 -0
- package/dist/types/components/builtin/Video/Video.d.ts +15 -0
- package/dist/types/components/builtin/Video/Video.d.ts.map +1 -0
- package/dist/types/components/builtin/Video/index.d.ts +2 -0
- package/dist/types/components/builtin/Video/index.d.ts.map +1 -0
- package/dist/types/components/builtin/Video/prop-controllers.d.ts +50 -0
- package/dist/types/components/builtin/Video/prop-controllers.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/hooks/useTableWorkspace.d.ts +14 -0
- package/dist/types/components/hooks/useTableWorkspace.d.ts.map +1 -0
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/components/page/BodySnippet.d.ts +7 -0
- package/dist/types/components/page/BodySnippet.d.ts.map +1 -0
- package/dist/types/components/page/Page.d.ts +45 -0
- package/dist/types/components/page/Page.d.ts.map +1 -0
- package/dist/types/components/page/index.d.ts +2 -0
- package/dist/types/components/page/index.d.ts.map +1 -0
- package/dist/types/components/utils/layout.d.ts +16 -0
- package/dist/types/components/utils/layout.d.ts.map +1 -0
- package/dist/types/components/utils/placeholders.d.ts +7 -0
- package/dist/types/components/utils/placeholders.d.ts.map +1 -1
- package/dist/types/components/utils/pollAnimationFrame.d.ts +2 -0
- package/dist/types/components/utils/pollAnimationFrame.d.ts.map +1 -0
- package/dist/types/components/utils/pollElementLayout.d.ts +8 -0
- package/dist/types/components/utils/pollElementLayout.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/requestBatchedAnimationFrame.d.ts +4 -0
- package/dist/types/components/utils/requestBatchedAnimationFrame.d.ts.map +1 -0
- 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 +6 -4
- 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/page.d.ts +9 -0
- package/dist/types/runtimes/page.d.ts.map +1 -0
- package/dist/types/runtimes/react.d.ts +15 -8
- package/dist/types/runtimes/react.d.ts.map +1 -1
- package/dist/types/state/actions.d.ts +55 -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/dist/types/utils/get-redirect-match.d.ts +10 -0
- package/dist/types/utils/get-redirect-match.d.ts.map +1 -0
- package/dist/types/utils/get-redirect-match.test.d.ts +1 -0
- package/dist/types/utils/get-redirect-match.test.d.ts.map +1 -0
- package/package.json +19 -6
package/dist/react.es2.js
CHANGED
|
@@ -29,239 +29,39 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
+
var __publicField = (obj, key, value) => {
|
|
33
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
34
|
+
return value;
|
|
35
|
+
};
|
|
32
36
|
import * as React from "react";
|
|
33
37
|
import { forwardRef, createContext, useContext, useMemo, useState, useLayoutEffect, useCallback, useEffect, useRef, useImperativeHandle, Children, createElement, Fragment as Fragment$1, memo } from "react";
|
|
34
38
|
import { useSyncExternalStoreWithSelector } from "use-sync-external-store/shim/with-selector";
|
|
35
|
-
import { gql, useQuery as useQuery$1, ApolloClient, InMemoryCache } from "@apollo/client";
|
|
36
|
-
import {
|
|
37
|
-
import
|
|
38
|
-
import { A as ActionTypes, r as registerComponentHandleEffect, e as mountComponentEffect, f as registerComponentEffect, g as registerReactComponentEffect } from "./actions.es.js";
|
|
39
|
-
import { T as Types, E as ElementID, B as Backgrounds$1, W as Width, R as ResponsiveIconRadioGroup, M as Margin, P as Padding, a as Border, b as BorderRadius, S as Shadows, G as GapY, c as GapX, e as ResponsiveSelect, f as ResponsiveNumber, C as Checkbox, g as Grid$2, h as TextInput, L as Link$1, i as ResponsiveColor, j as TextStyle, I as Image$1, k as ResponsiveOpacity, l as Images, N as Number$1, D as Date$1, F as Font, m as ResponsiveLength, n as TextArea, o as NavigationLinks, p as SocialLinks$1, q as RichText } from "./descriptors.es.js";
|
|
39
|
+
import { gql, useQuery as useQuery$1, useMutation as useMutation$1, ApolloClient, InMemoryCache } from "@apollo/client";
|
|
40
|
+
import { a as createDocumentReference, g as getIsInBuilder, b as configureStore, d as getElementId, e as getReactComponent, f as getDocument, i as isElementReference } from "./react-page.es.js";
|
|
41
|
+
import { f as registerComponentHandleEffect, g as mountComponentEffect, h as registerComponentEffect, j as registerReactComponentEffect } from "./actions.es.js";
|
|
40
42
|
import styled, { css, keyframes, createGlobalStyle } from "styled-components";
|
|
41
43
|
import { useReducedMotion, useAnimation, motion } from "framer-motion";
|
|
44
|
+
import { getDataFromTree } from "@apollo/client/react/ssr";
|
|
45
|
+
import uuid from "uuid/v4";
|
|
42
46
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
47
|
+
import "html-react-parser";
|
|
48
|
+
import "next/head";
|
|
43
49
|
import { p as parse, c as createBox, g as getBox } from "./box-models.es.js";
|
|
44
50
|
import NextImage from "next/image";
|
|
45
51
|
import ReactPlayer from "react-player";
|
|
52
|
+
import { E as ElementID, B as Backgrounds$1, W as Width, R as ResponsiveIconRadioGroup, M as Margin, P as Padding, a as Border, b as BorderRadius, S as Shadows, G as GapY, c as GapX, e as ResponsiveSelect, f as ResponsiveNumber, C as Checkbox$1, g as Grid$2, h as TextInput, L as Link$1, i as ResponsiveColor, j as TextStyle, I as Image$1, k as ResponsiveOpacity, l as Images, N as Number$1, D as Date$1, F as Font, m as ResponsiveLength, n as TextArea$1, o as Table, p as TableFormFields, q as NavigationLinks, r as SocialLinks$1, s as RichText, V as Video$1 } from "./descriptors.es.js";
|
|
46
53
|
import ColorHelper from "color";
|
|
47
54
|
import scrollIntoView from "scroll-into-view-if-needed";
|
|
48
55
|
import NextLink from "next/link";
|
|
49
56
|
import { useGesture } from "react-use-gesture";
|
|
50
57
|
import { wrap } from "@popmotion/popcorn";
|
|
51
|
-
import
|
|
58
|
+
import { Field as Field$1, getIn, Formik } from "formik";
|
|
52
59
|
import { normalize } from "polished";
|
|
53
60
|
import { Value } from "slate";
|
|
54
61
|
import Hotkeys from "slate-hotkeys";
|
|
55
62
|
import ipsum from "corporate-ipsum";
|
|
56
63
|
import { Editor } from "slate-react";
|
|
57
64
|
import Lists from "@convertkit/slate-lists";
|
|
58
|
-
function isElementReference(element) {
|
|
59
|
-
return !("props" in element);
|
|
60
|
-
}
|
|
61
|
-
function createDocument(rootElement) {
|
|
62
|
-
return { rootElement };
|
|
63
|
-
}
|
|
64
|
-
function getInitialState$3({
|
|
65
|
-
rootElements = /* @__PURE__ */ new Map()
|
|
66
|
-
} = {}) {
|
|
67
|
-
const initialState = /* @__PURE__ */ new Map();
|
|
68
|
-
rootElements.forEach((rootElement, elementKey) => {
|
|
69
|
-
initialState.set(elementKey, createDocument(rootElement));
|
|
70
|
-
});
|
|
71
|
-
return initialState;
|
|
72
|
-
}
|
|
73
|
-
function getDocuments(state) {
|
|
74
|
-
return state;
|
|
75
|
-
}
|
|
76
|
-
function getDocument(state, documentKey) {
|
|
77
|
-
var _a;
|
|
78
|
-
return (_a = getDocuments(state).get(documentKey)) != null ? _a : null;
|
|
79
|
-
}
|
|
80
|
-
function getDocumentRootElement$1(state, documentKey) {
|
|
81
|
-
var _a, _b;
|
|
82
|
-
return (_b = (_a = getDocument(state, documentKey)) == null ? void 0 : _a.rootElement) != null ? _b : null;
|
|
83
|
-
}
|
|
84
|
-
function reducer$4(state = getInitialState$3(), _action) {
|
|
85
|
-
return state;
|
|
86
|
-
}
|
|
87
|
-
function getInitialState$2({
|
|
88
|
-
reactComponents = /* @__PURE__ */ new Map()
|
|
89
|
-
} = {}) {
|
|
90
|
-
return reactComponents;
|
|
91
|
-
}
|
|
92
|
-
function getReactComponents(state) {
|
|
93
|
-
return state;
|
|
94
|
-
}
|
|
95
|
-
function getReactComponent$1(state, type) {
|
|
96
|
-
var _a;
|
|
97
|
-
return (_a = getReactComponents(state).get(type)) != null ? _a : null;
|
|
98
|
-
}
|
|
99
|
-
function reducer$3(state = getInitialState$2(), action) {
|
|
100
|
-
switch (action.type) {
|
|
101
|
-
case ActionTypes.REGISTER_REACT_COMPONENT:
|
|
102
|
-
return new Map(state).set(action.payload.type, action.payload.component);
|
|
103
|
-
case ActionTypes.UNREGISTER_REACT_COMPONENT: {
|
|
104
|
-
const nextState = new Map(state);
|
|
105
|
-
const deleted = nextState.delete(action.payload.type);
|
|
106
|
-
return deleted ? nextState : state;
|
|
107
|
-
}
|
|
108
|
-
default:
|
|
109
|
-
return state;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
function getInitialState$1({
|
|
113
|
-
componentsMeta = /* @__PURE__ */ new Map()
|
|
114
|
-
} = {}) {
|
|
115
|
-
return componentsMeta;
|
|
116
|
-
}
|
|
117
|
-
function getComponentsMeta(state) {
|
|
118
|
-
return state;
|
|
119
|
-
}
|
|
120
|
-
function reducer$2(state = getInitialState$1(), action) {
|
|
121
|
-
switch (action.type) {
|
|
122
|
-
case ActionTypes.REGISTER_COMPONENT:
|
|
123
|
-
return new Map(state).set(action.payload.type, action.payload.meta);
|
|
124
|
-
case ActionTypes.UNREGISTER_COMPONENT: {
|
|
125
|
-
const nextState = new Map(state);
|
|
126
|
-
const deleted = nextState.delete(action.payload.type);
|
|
127
|
-
return deleted ? nextState : state;
|
|
128
|
-
}
|
|
129
|
-
default:
|
|
130
|
-
return state;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
function getInitialState({
|
|
134
|
-
propControllerDescriptors = /* @__PURE__ */ new Map()
|
|
135
|
-
} = {}) {
|
|
136
|
-
return propControllerDescriptors;
|
|
137
|
-
}
|
|
138
|
-
function getPropControllerDescriptors$1(state) {
|
|
139
|
-
return state;
|
|
140
|
-
}
|
|
141
|
-
function getComponentPropControllerDescriptors$1(state, componentType) {
|
|
142
|
-
var _a;
|
|
143
|
-
return (_a = getPropControllerDescriptors$1(state).get(componentType)) != null ? _a : null;
|
|
144
|
-
}
|
|
145
|
-
function reducer$1(state = getInitialState(), action) {
|
|
146
|
-
switch (action.type) {
|
|
147
|
-
case ActionTypes.REGISTER_COMPONENT:
|
|
148
|
-
return new Map(state).set(action.payload.type, action.payload.propControllerDescriptors);
|
|
149
|
-
case ActionTypes.UNREGISTER_COMPONENT: {
|
|
150
|
-
const nextState = new Map(state);
|
|
151
|
-
const deleted = nextState.delete(action.payload.type);
|
|
152
|
-
return deleted ? nextState : state;
|
|
153
|
-
}
|
|
154
|
-
default:
|
|
155
|
-
return state;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
function getElementChildren(descriptor, prop) {
|
|
159
|
-
if (prop == null)
|
|
160
|
-
return [];
|
|
161
|
-
switch (descriptor.type) {
|
|
162
|
-
case Types.Grid:
|
|
163
|
-
return prop.elements;
|
|
164
|
-
default:
|
|
165
|
-
return [];
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
function getElementId$1(descriptor, prop) {
|
|
169
|
-
if (prop == null)
|
|
170
|
-
return null;
|
|
171
|
-
switch (descriptor.type) {
|
|
172
|
-
case Types.ElementID:
|
|
173
|
-
return prop;
|
|
174
|
-
default:
|
|
175
|
-
return null;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
const reducer = combineReducers({
|
|
179
|
-
documents: reducer$4,
|
|
180
|
-
reactComponents: reducer$3,
|
|
181
|
-
componentsMeta: reducer$2,
|
|
182
|
-
propControllers: reducer$1,
|
|
183
|
-
isInBuilder: (_state = false, _action) => false
|
|
184
|
-
});
|
|
185
|
-
function getDocumentsStateSlice(state) {
|
|
186
|
-
return state.documents;
|
|
187
|
-
}
|
|
188
|
-
function getDocumentRootElement(state, documentKey) {
|
|
189
|
-
return getDocumentRootElement$1(getDocumentsStateSlice(state), documentKey);
|
|
190
|
-
}
|
|
191
|
-
function getReactComponentsStateSlice(state) {
|
|
192
|
-
return state.reactComponents;
|
|
193
|
-
}
|
|
194
|
-
function getReactComponent(state, type) {
|
|
195
|
-
return getReactComponent$1(getReactComponentsStateSlice(state), type);
|
|
196
|
-
}
|
|
197
|
-
function getPropControllersStateSlice(state) {
|
|
198
|
-
return state.propControllers;
|
|
199
|
-
}
|
|
200
|
-
function getPropControllerDescriptors(state) {
|
|
201
|
-
return getPropControllerDescriptors$1(getPropControllersStateSlice(state));
|
|
202
|
-
}
|
|
203
|
-
function getComponentPropControllerDescriptors(state, componentType) {
|
|
204
|
-
return getComponentPropControllerDescriptors$1(getPropControllersStateSlice(state), componentType);
|
|
205
|
-
}
|
|
206
|
-
function normalizeElement(element, descriptors) {
|
|
207
|
-
const elements = /* @__PURE__ */ new Map();
|
|
208
|
-
const remaining = [element];
|
|
209
|
-
let current;
|
|
210
|
-
while (current = remaining.pop()) {
|
|
211
|
-
elements.set(current.key, current);
|
|
212
|
-
if (isElementReference(current))
|
|
213
|
-
continue;
|
|
214
|
-
const elementDescriptors = descriptors.get(element.type);
|
|
215
|
-
if (elementDescriptors == null)
|
|
216
|
-
continue;
|
|
217
|
-
const parent = current;
|
|
218
|
-
const children = Object.entries(elementDescriptors).reduce((acc, [propName, descriptor]) => {
|
|
219
|
-
return [...acc, ...getElementChildren(descriptor, parent.props[propName])];
|
|
220
|
-
}, []);
|
|
221
|
-
remaining.push(...children);
|
|
222
|
-
}
|
|
223
|
-
return elements;
|
|
224
|
-
}
|
|
225
|
-
function getDocumentElements(state, documentKey) {
|
|
226
|
-
const rootElement = getDocumentRootElement(state, documentKey);
|
|
227
|
-
const descriptors = getPropControllerDescriptors(state);
|
|
228
|
-
if (rootElement == null)
|
|
229
|
-
return /* @__PURE__ */ new Map();
|
|
230
|
-
return normalizeElement(rootElement, descriptors);
|
|
231
|
-
}
|
|
232
|
-
function getElement(state, documentKey, elementKey) {
|
|
233
|
-
var _a;
|
|
234
|
-
return (_a = getDocumentElements(state, documentKey).get(elementKey)) != null ? _a : null;
|
|
235
|
-
}
|
|
236
|
-
function getElementPropControllerDescriptors(state, documentKey, elementKey) {
|
|
237
|
-
const element = getElement(state, documentKey, elementKey);
|
|
238
|
-
if (element == null || isElementReference(element))
|
|
239
|
-
return null;
|
|
240
|
-
return getComponentPropControllerDescriptors(state, element.type);
|
|
241
|
-
}
|
|
242
|
-
function getElementId(state, documentKey, elementKey) {
|
|
243
|
-
const element = getElement(state, documentKey, elementKey);
|
|
244
|
-
if (element == null || isElementReference(element))
|
|
245
|
-
return null;
|
|
246
|
-
const descriptors = getComponentPropControllerDescriptors(state, element.type);
|
|
247
|
-
if (descriptors == null)
|
|
248
|
-
return null;
|
|
249
|
-
const elementId = Object.entries(descriptors).reduce((acc, [propName, descriptor]) => {
|
|
250
|
-
if (acc != null)
|
|
251
|
-
return acc;
|
|
252
|
-
return getElementId$1(descriptor, element.props[propName]);
|
|
253
|
-
}, null);
|
|
254
|
-
return elementId;
|
|
255
|
-
}
|
|
256
|
-
function getIsInBuilder(state) {
|
|
257
|
-
return state.isInBuilder;
|
|
258
|
-
}
|
|
259
|
-
function configureStore({
|
|
260
|
-
rootElements,
|
|
261
|
-
preloadedState
|
|
262
|
-
} = {}) {
|
|
263
|
-
return createStore(reducer, __spreadProps(__spreadValues({}, preloadedState), { documents: getInitialState$3({ rootElements }) }), applyMiddleware(thunk));
|
|
264
|
-
}
|
|
265
65
|
const PlaceholderBase$1 = styled.div`
|
|
266
66
|
width: 100%;
|
|
267
67
|
background: rgba(161, 168, 194, 0.18);
|
|
@@ -271,7 +71,7 @@ const PlaceholderBase$1 = styled.div`
|
|
|
271
71
|
hide
|
|
272
72
|
}) => hide === true ? "hidden" : "initial"};
|
|
273
73
|
`;
|
|
274
|
-
var Placeholder$
|
|
74
|
+
var Placeholder$2 = forwardRef(function Placeholder(_a, ref) {
|
|
275
75
|
var _b = _a, {
|
|
276
76
|
hide = false
|
|
277
77
|
} = _b, restOfProps = __objRest(_b, [
|
|
@@ -385,21 +185,157 @@ const TYPOGRAPHIES_BY_ID = gql`
|
|
|
385
185
|
|
|
386
186
|
${TYPOGRAPHY_FRAGMENT}
|
|
387
187
|
`;
|
|
188
|
+
const TABLE_BY_ID = gql`
|
|
189
|
+
query TableById($id: ID!) {
|
|
190
|
+
table(id: $id) {
|
|
191
|
+
id
|
|
192
|
+
name
|
|
193
|
+
columns {
|
|
194
|
+
id
|
|
195
|
+
name
|
|
196
|
+
... on MultipleSelectTableColumn {
|
|
197
|
+
options {
|
|
198
|
+
id
|
|
199
|
+
name
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
... on SingleSelectTableColumn {
|
|
203
|
+
options {
|
|
204
|
+
id
|
|
205
|
+
name
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
`;
|
|
388
212
|
function isNonNullable(value) {
|
|
389
213
|
return value != null;
|
|
390
214
|
}
|
|
391
|
-
const
|
|
215
|
+
const typePolicies = {
|
|
216
|
+
Query: {
|
|
217
|
+
fields: {
|
|
218
|
+
swatches(existingData, {
|
|
219
|
+
args,
|
|
220
|
+
toReference
|
|
221
|
+
}) {
|
|
222
|
+
return existingData != null ? existingData : args == null ? void 0 : args.ids.map((id) => toReference({
|
|
223
|
+
__typename: "Swatch",
|
|
224
|
+
id
|
|
225
|
+
}, true));
|
|
226
|
+
},
|
|
227
|
+
file(existingData, {
|
|
228
|
+
args,
|
|
229
|
+
toReference
|
|
230
|
+
}) {
|
|
231
|
+
return existingData != null ? existingData : toReference({
|
|
232
|
+
__typename: "File",
|
|
233
|
+
id: args == null ? void 0 : args.id
|
|
234
|
+
}, true);
|
|
235
|
+
},
|
|
236
|
+
files(existingData, {
|
|
237
|
+
args,
|
|
238
|
+
toReference
|
|
239
|
+
}) {
|
|
240
|
+
return existingData != null ? existingData : args == null ? void 0 : args.ids.map((id) => toReference({
|
|
241
|
+
__typename: "File",
|
|
242
|
+
id
|
|
243
|
+
}, true));
|
|
244
|
+
},
|
|
245
|
+
typographies(existingData, {
|
|
246
|
+
args,
|
|
247
|
+
toReference
|
|
248
|
+
}) {
|
|
249
|
+
return existingData != null ? existingData : args == null ? void 0 : args.ids.map((id) => toReference({
|
|
250
|
+
__typename: "Typography",
|
|
251
|
+
id
|
|
252
|
+
}, true));
|
|
253
|
+
},
|
|
254
|
+
pagePathnamesById(existingData, {
|
|
255
|
+
args,
|
|
256
|
+
toReference
|
|
257
|
+
}) {
|
|
258
|
+
return existingData != null ? existingData : args == null ? void 0 : args.ids.map((id) => toReference({
|
|
259
|
+
__typename: "PagePathnameSlice",
|
|
260
|
+
id
|
|
261
|
+
}, true));
|
|
262
|
+
},
|
|
263
|
+
globalElement(existingData, {
|
|
264
|
+
args,
|
|
265
|
+
toReference
|
|
266
|
+
}) {
|
|
267
|
+
return existingData != null ? existingData : toReference({
|
|
268
|
+
__typename: "GlobalElement",
|
|
269
|
+
id: args == null ? void 0 : args.id
|
|
270
|
+
}, true);
|
|
271
|
+
},
|
|
272
|
+
table(existingData, {
|
|
273
|
+
args,
|
|
274
|
+
toReference
|
|
275
|
+
}) {
|
|
276
|
+
return existingData != null ? existingData : toReference({
|
|
277
|
+
__typename: "Table",
|
|
278
|
+
id: args == null ? void 0 : args.id
|
|
279
|
+
}, true);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
function createApolloClient({
|
|
285
|
+
uri,
|
|
286
|
+
cacheData
|
|
287
|
+
}) {
|
|
288
|
+
const cache = new InMemoryCache({
|
|
289
|
+
typePolicies
|
|
290
|
+
});
|
|
291
|
+
if (cacheData)
|
|
292
|
+
cache.restore(cacheData);
|
|
293
|
+
return new ApolloClient({
|
|
294
|
+
uri,
|
|
295
|
+
cache
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
class MakeswiftClient {
|
|
299
|
+
constructor({
|
|
300
|
+
uri,
|
|
301
|
+
cacheData
|
|
302
|
+
}) {
|
|
303
|
+
__publicField(this, "apolloClient");
|
|
304
|
+
this.apolloClient = createApolloClient({
|
|
305
|
+
uri,
|
|
306
|
+
cacheData
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
async prefetch(element) {
|
|
310
|
+
const id = uuid();
|
|
311
|
+
await getDataFromTree(/* @__PURE__ */ jsx(RuntimeProvider, {
|
|
312
|
+
client: this,
|
|
313
|
+
defaultRootElements: /* @__PURE__ */ new Map([[id, element]]),
|
|
314
|
+
children: /* @__PURE__ */ jsx(DocumentReference, {
|
|
315
|
+
documentReference: createDocumentReference(id)
|
|
316
|
+
})
|
|
317
|
+
}));
|
|
318
|
+
return this.apolloClient.cache.extract();
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
const Context$2 = createContext(void 0);
|
|
392
322
|
function useQuery(query, options) {
|
|
393
|
-
const client = useContext(Context$
|
|
323
|
+
const client = useContext(Context$2);
|
|
394
324
|
return useQuery$1(query, __spreadValues({
|
|
395
|
-
client
|
|
325
|
+
client: client == null ? void 0 : client.apolloClient
|
|
326
|
+
}, options));
|
|
327
|
+
}
|
|
328
|
+
function useMutation(mutation, options) {
|
|
329
|
+
const client = useContext(Context$2);
|
|
330
|
+
return useMutation$1(mutation, __spreadValues({
|
|
331
|
+
client: client == null ? void 0 : client.apolloClient
|
|
396
332
|
}, options));
|
|
397
333
|
}
|
|
398
|
-
function
|
|
334
|
+
function MakeswiftProvider({
|
|
399
335
|
client,
|
|
400
336
|
children
|
|
401
337
|
}) {
|
|
402
|
-
return /* @__PURE__ */ jsx(Context$
|
|
338
|
+
return /* @__PURE__ */ jsx(Context$2.Provider, {
|
|
403
339
|
value: client,
|
|
404
340
|
children
|
|
405
341
|
});
|
|
@@ -612,8 +548,8 @@ function shallowMerge(a, b) {
|
|
|
612
548
|
}
|
|
613
549
|
const DEVICES = [
|
|
614
550
|
{ id: "desktop", minWidth: 769 },
|
|
615
|
-
{ id: "tablet", minWidth:
|
|
616
|
-
{ id: "mobile", maxWidth:
|
|
551
|
+
{ id: "tablet", minWidth: 576, maxWidth: 768 },
|
|
552
|
+
{ id: "mobile", maxWidth: 575 }
|
|
617
553
|
];
|
|
618
554
|
const getDevice = (deviceId) => {
|
|
619
555
|
const device = DEVICES.find(({ id }) => id === deviceId);
|
|
@@ -687,6 +623,12 @@ function usePage(pageId) {
|
|
|
687
623
|
const { pagePathnamesById: [page] = [] } = data;
|
|
688
624
|
return page;
|
|
689
625
|
}
|
|
626
|
+
function useTable(tableId) {
|
|
627
|
+
return useQuery(TABLE_BY_ID, {
|
|
628
|
+
skip: tableId == null,
|
|
629
|
+
variables: { id: tableId }
|
|
630
|
+
});
|
|
631
|
+
}
|
|
690
632
|
const defaultExitedProps = {
|
|
691
633
|
opacity: 0,
|
|
692
634
|
x: 0,
|
|
@@ -1157,8 +1099,8 @@ function getScrollParent(element) {
|
|
|
1157
1099
|
return element;
|
|
1158
1100
|
return getScrollParent(parentElement);
|
|
1159
1101
|
}
|
|
1160
|
-
function Parallax(
|
|
1161
|
-
var _h =
|
|
1102
|
+
function Parallax(_g2) {
|
|
1103
|
+
var _h = _g2, {
|
|
1162
1104
|
strength,
|
|
1163
1105
|
children
|
|
1164
1106
|
} = _h, rest = __objRest(_h, [
|
|
@@ -1244,7 +1186,7 @@ function Parallax(_g) {
|
|
|
1244
1186
|
children: children(getProps)
|
|
1245
1187
|
}));
|
|
1246
1188
|
}
|
|
1247
|
-
const Container$
|
|
1189
|
+
const Container$d = styled.div`
|
|
1248
1190
|
position: absolute;
|
|
1249
1191
|
top: 0;
|
|
1250
1192
|
left: 0;
|
|
@@ -1298,7 +1240,7 @@ function BackgroundVideo({
|
|
|
1298
1240
|
}, [aspectRatio, zoom]);
|
|
1299
1241
|
if (!ReactPlayer.canPlay(url))
|
|
1300
1242
|
return /* @__PURE__ */ jsx(Fragment, {});
|
|
1301
|
-
return /* @__PURE__ */ jsxs(Container$
|
|
1243
|
+
return /* @__PURE__ */ jsxs(Container$d, {
|
|
1302
1244
|
ref: container,
|
|
1303
1245
|
children: [container.current && /* @__PURE__ */ jsx(ReactPlayer, {
|
|
1304
1246
|
url,
|
|
@@ -1377,10 +1319,10 @@ const AbsoluteFill = styled.div`
|
|
|
1377
1319
|
right: 0;
|
|
1378
1320
|
bottom: 0;
|
|
1379
1321
|
`;
|
|
1380
|
-
const Container$
|
|
1322
|
+
const Container$c = styled(AbsoluteFill)`
|
|
1381
1323
|
border-radius: inherit;
|
|
1382
1324
|
`;
|
|
1383
|
-
const BackgroundsContainer$1 = styled(Container$
|
|
1325
|
+
const BackgroundsContainer$1 = styled(Container$c)`
|
|
1384
1326
|
overflow: hidden;
|
|
1385
1327
|
${(p) => cssMediaRules([p.visibility], ([visibility]) => css`
|
|
1386
1328
|
display: ${visibility === true ? "block" : "none"};
|
|
@@ -1404,7 +1346,7 @@ function Backgrounds({
|
|
|
1404
1346
|
visibility,
|
|
1405
1347
|
children: [...value].reverse().map((bg) => {
|
|
1406
1348
|
if (bg.type === "color") {
|
|
1407
|
-
return /* @__PURE__ */ jsx(Container$
|
|
1349
|
+
return /* @__PURE__ */ jsx(Container$c, {
|
|
1408
1350
|
style: {
|
|
1409
1351
|
backgroundColor: getColor(bg.payload)
|
|
1410
1352
|
}
|
|
@@ -1440,7 +1382,7 @@ function Backgrounds({
|
|
|
1440
1382
|
}
|
|
1441
1383
|
return /* @__PURE__ */ jsx(Parallax, {
|
|
1442
1384
|
strength: parallax,
|
|
1443
|
-
children: (getParallaxProps) => /* @__PURE__ */ jsx(Container$
|
|
1385
|
+
children: (getParallaxProps) => /* @__PURE__ */ jsx(Container$c, __spreadValues({}, getParallaxProps({
|
|
1444
1386
|
style: {
|
|
1445
1387
|
backgroundImage: publicUrl != null ? `url('${publicUrl}')` : void 0,
|
|
1446
1388
|
backgroundPosition,
|
|
@@ -1458,7 +1400,7 @@ function Backgrounds({
|
|
|
1458
1400
|
isRadial
|
|
1459
1401
|
} = bg.payload;
|
|
1460
1402
|
const gradient = `${getStopsStyle(stops)}`;
|
|
1461
|
-
return /* @__PURE__ */ jsx(Container$
|
|
1403
|
+
return /* @__PURE__ */ jsx(Container$c, {
|
|
1462
1404
|
style: {
|
|
1463
1405
|
background: isRadial ? `radial-gradient(${gradient})` : `linear-gradient(${angle}rad, ${gradient})`
|
|
1464
1406
|
}
|
|
@@ -1475,7 +1417,7 @@ function Backgrounds({
|
|
|
1475
1417
|
} = bg.payload;
|
|
1476
1418
|
return /* @__PURE__ */ jsx(Parallax, {
|
|
1477
1419
|
strength: parallax,
|
|
1478
|
-
children: (getParallaxProps) => /* @__PURE__ */ jsx(Container$
|
|
1420
|
+
children: (getParallaxProps) => /* @__PURE__ */ jsx(Container$c, __spreadProps(__spreadValues({}, getParallaxProps({})), {
|
|
1479
1421
|
children: /* @__PURE__ */ jsx(BackgroundVideo, {
|
|
1480
1422
|
url,
|
|
1481
1423
|
zoom,
|
|
@@ -1543,7 +1485,7 @@ const Grid$1 = styled(motion.div)`
|
|
|
1543
1485
|
alignContent
|
|
1544
1486
|
}))}
|
|
1545
1487
|
`;
|
|
1546
|
-
const GridItem$
|
|
1488
|
+
const GridItem$2 = styled(motion.div)`
|
|
1547
1489
|
display: flex;
|
|
1548
1490
|
|
|
1549
1491
|
/* IE11 doesn't recognize space-between and treats it as stretch, so we fall back to flex-start */
|
|
@@ -1654,7 +1596,7 @@ const Box = forwardRef(function Box2({
|
|
|
1654
1596
|
animate: animate == null ? void 0 : animate.parent,
|
|
1655
1597
|
initial: initial == null ? void 0 : initial.parent,
|
|
1656
1598
|
transition: transition == null ? void 0 : transition.parent,
|
|
1657
|
-
children: children && children.elements.length > 0 ? children.elements.map((child, index) => /* @__PURE__ */ jsx(GridItem$
|
|
1599
|
+
children: children && children.elements.length > 0 ? children.elements.map((child, index) => /* @__PURE__ */ jsx(GridItem$2, {
|
|
1658
1600
|
grid: children.columns,
|
|
1659
1601
|
index,
|
|
1660
1602
|
columnGap,
|
|
@@ -1665,13 +1607,13 @@ const Box = forwardRef(function Box2({
|
|
|
1665
1607
|
children: /* @__PURE__ */ jsx(Element$1, {
|
|
1666
1608
|
element: child
|
|
1667
1609
|
})
|
|
1668
|
-
}, child.key)) : /* @__PURE__ */ jsx(Placeholder$
|
|
1610
|
+
}, child.key)) : /* @__PURE__ */ jsx(Placeholder$2, {
|
|
1669
1611
|
hide: hidePlaceholder
|
|
1670
1612
|
})
|
|
1671
1613
|
})
|
|
1672
1614
|
}, key == null ? void 0 : key.container);
|
|
1673
1615
|
});
|
|
1674
|
-
function registerComponent$
|
|
1616
|
+
function registerComponent$c(runtime) {
|
|
1675
1617
|
return runtime.registerComponent(Box, {
|
|
1676
1618
|
type: "./components/Box/index.js",
|
|
1677
1619
|
label: "Box",
|
|
@@ -1843,7 +1785,7 @@ function registerComponent$a(runtime) {
|
|
|
1843
1785
|
suffix: "s",
|
|
1844
1786
|
defaultValue: DEFAULT_ITEM_STAGGER_DURATION
|
|
1845
1787
|
}),
|
|
1846
|
-
hidePlaceholder: Checkbox({
|
|
1788
|
+
hidePlaceholder: Checkbox$1({
|
|
1847
1789
|
label: "Hide placeholder"
|
|
1848
1790
|
}),
|
|
1849
1791
|
children: Grid$2()
|
|
@@ -1936,7 +1878,7 @@ const Link = forwardRef(function Link2(_k, ref) {
|
|
|
1936
1878
|
}))
|
|
1937
1879
|
});
|
|
1938
1880
|
});
|
|
1939
|
-
const StyledButton = styled(Link)`
|
|
1881
|
+
const StyledButton$1 = styled(Link)`
|
|
1940
1882
|
display: table;
|
|
1941
1883
|
border: 0;
|
|
1942
1884
|
outline: 0;
|
|
@@ -2128,7 +2070,7 @@ const StyledButton = styled(Link)`
|
|
|
2128
2070
|
})}
|
|
2129
2071
|
${cssTextStyle()}
|
|
2130
2072
|
`;
|
|
2131
|
-
const Button = forwardRef(function Button2(_m, ref) {
|
|
2073
|
+
const Button$1 = forwardRef(function Button2(_m, ref) {
|
|
2132
2074
|
var _n = _m, {
|
|
2133
2075
|
id,
|
|
2134
2076
|
children,
|
|
@@ -2154,7 +2096,7 @@ const Button = forwardRef(function Button2(_m, ref) {
|
|
|
2154
2096
|
"width",
|
|
2155
2097
|
"margin"
|
|
2156
2098
|
]);
|
|
2157
|
-
return /* @__PURE__ */ jsx(StyledButton, __spreadProps(__spreadValues({}, restOfProps), {
|
|
2099
|
+
return /* @__PURE__ */ jsx(StyledButton$1, __spreadProps(__spreadValues({}, restOfProps), {
|
|
2158
2100
|
ref,
|
|
2159
2101
|
id,
|
|
2160
2102
|
color: useColor(color),
|
|
@@ -2169,8 +2111,8 @@ const Button = forwardRef(function Button2(_m, ref) {
|
|
|
2169
2111
|
children: children == null ? "Button Text" : children
|
|
2170
2112
|
}));
|
|
2171
2113
|
});
|
|
2172
|
-
function registerComponent$
|
|
2173
|
-
return runtime.registerComponent(Button, {
|
|
2114
|
+
function registerComponent$b(runtime) {
|
|
2115
|
+
return runtime.registerComponent(Button$1, {
|
|
2174
2116
|
type: "./components/Button/index.js",
|
|
2175
2117
|
label: "Button",
|
|
2176
2118
|
props: {
|
|
@@ -2265,6 +2207,10 @@ const placeholders = {
|
|
|
2265
2207
|
image: {
|
|
2266
2208
|
src: "data:image/svg+xml,%3Csvg width='360' height='240' viewBox='0 0 360 240' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg clip-path='url(%23clip0)'%3E%3Cpath d='M0 0H360V240H0V0Z' fill='%23A1A8C2' fill-opacity='0.18'/%3E%3Cpath d='M260 59C260 78.33 244.33 94 225 94C205.67 94 190 78.33 190 59C190 39.67 205.67 24 225 24C244.33 24 260 39.67 260 59Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M319 250H417L291.485 124.485C286.799 119.799 279.201 119.799 274.515 124.485L234 165L319 250Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3Cpath d='M311 250L-89 250L102.515 58.4853C107.201 53.799 114.799 53.799 119.485 58.4853L311 250Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0'%3E%3Cpath d='M0 0H360V240H0V0Z' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E%0A",
|
|
2267
2209
|
dimensions: { width: 360, height: 240 }
|
|
2210
|
+
},
|
|
2211
|
+
video: {
|
|
2212
|
+
src: "data:image/svg+xml,%3Csvg width='712' height='400' viewBox='0 0 712 400' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M712 0H0V400H712V0ZM356 240C378.091 240 396 222.091 396 200C396 177.909 378.091 160 356 160C333.909 160 316 177.909 316 200C316 222.091 333.909 240 356 240Z' fill='%23A1A8C2' fill-opacity='0.18'/%3E%3Cpath d='M344 216.503V183.497C344 181.95 345.681 180.989 347.014 181.773L375.069 198.276C376.384 199.049 376.384 200.951 375.069 201.724L347.014 218.227C345.681 219.011 344 218.05 344 216.503Z' fill='%23A1A8C2' fill-opacity='0.4'/%3E%3C/svg%3E%0A",
|
|
2213
|
+
dimensions: { width: 712, height: 400 }
|
|
2268
2214
|
}
|
|
2269
2215
|
};
|
|
2270
2216
|
function loadImage(src) {
|
|
@@ -2370,7 +2316,7 @@ const ImageComponent = forwardRef(function Image2({
|
|
|
2370
2316
|
})
|
|
2371
2317
|
});
|
|
2372
2318
|
});
|
|
2373
|
-
function registerComponent$
|
|
2319
|
+
function registerComponent$a(runtime) {
|
|
2374
2320
|
return runtime.registerComponent(ImageComponent, {
|
|
2375
2321
|
type: "./components/Image/index.js",
|
|
2376
2322
|
label: "Image",
|
|
@@ -2419,7 +2365,7 @@ const RightChevron = () => /* @__PURE__ */ jsx("svg", {
|
|
|
2419
2365
|
strokeWidth: "2"
|
|
2420
2366
|
})
|
|
2421
2367
|
});
|
|
2422
|
-
const Container$
|
|
2368
|
+
const Container$b = styled.div`
|
|
2423
2369
|
position: relative;
|
|
2424
2370
|
height: 100%;
|
|
2425
2371
|
`;
|
|
@@ -2719,7 +2665,7 @@ const Carousel = forwardRef(function Carousel2({
|
|
|
2719
2665
|
break;
|
|
2720
2666
|
}
|
|
2721
2667
|
},
|
|
2722
|
-
children: [/* @__PURE__ */ jsxs(Container$
|
|
2668
|
+
children: [/* @__PURE__ */ jsxs(Container$b, {
|
|
2723
2669
|
children: [/* @__PURE__ */ jsx(ClipMask, {
|
|
2724
2670
|
children: /* @__PURE__ */ jsx(Page, __spreadProps(__spreadValues({}, bindPage()), {
|
|
2725
2671
|
animate: animation,
|
|
@@ -2795,7 +2741,7 @@ const Carousel = forwardRef(function Carousel2({
|
|
|
2795
2741
|
})]
|
|
2796
2742
|
});
|
|
2797
2743
|
});
|
|
2798
|
-
function registerComponent$
|
|
2744
|
+
function registerComponent$9(runtime) {
|
|
2799
2745
|
return runtime.registerComponent(Carousel, {
|
|
2800
2746
|
type: "./components/Carousel/index.js",
|
|
2801
2747
|
label: "Carousel",
|
|
@@ -2858,7 +2804,7 @@ function registerComponent$7(runtime) {
|
|
|
2858
2804
|
unit: "px"
|
|
2859
2805
|
}
|
|
2860
2806
|
}),
|
|
2861
|
-
autoplay: Checkbox({
|
|
2807
|
+
autoplay: Checkbox$1({
|
|
2862
2808
|
label: "Autoplay"
|
|
2863
2809
|
}),
|
|
2864
2810
|
delay: Number$1({
|
|
@@ -2868,7 +2814,7 @@ function registerComponent$7(runtime) {
|
|
|
2868
2814
|
step: 0.1,
|
|
2869
2815
|
suffix: "seconds"
|
|
2870
2816
|
}),
|
|
2871
|
-
showArrows: Checkbox({
|
|
2817
|
+
showArrows: Checkbox$1({
|
|
2872
2818
|
preset: true,
|
|
2873
2819
|
label: "Show arrows"
|
|
2874
2820
|
}),
|
|
@@ -2897,7 +2843,7 @@ function registerComponent$7(runtime) {
|
|
|
2897
2843
|
label: "Arrow background",
|
|
2898
2844
|
placeholder: "white"
|
|
2899
2845
|
}),
|
|
2900
|
-
showDots: Checkbox({
|
|
2846
|
+
showDots: Checkbox$1({
|
|
2901
2847
|
preset: true,
|
|
2902
2848
|
label: "Show dots"
|
|
2903
2849
|
}),
|
|
@@ -2915,14 +2861,14 @@ const Block$1 = styled.div`
|
|
|
2915
2861
|
padding: 0.5em;
|
|
2916
2862
|
font-size: 1em;
|
|
2917
2863
|
`;
|
|
2918
|
-
const Label = styled.div`
|
|
2864
|
+
const Label$3 = styled.div`
|
|
2919
2865
|
margin-top: 0.25em;
|
|
2920
2866
|
`;
|
|
2921
2867
|
const Segment = styled.div`
|
|
2922
2868
|
flex: 1;
|
|
2923
2869
|
text-align: center;
|
|
2924
2870
|
`;
|
|
2925
|
-
const Container$
|
|
2871
|
+
const Container$a = styled.div`
|
|
2926
2872
|
display: flex;
|
|
2927
2873
|
${cssWidth("560px")}
|
|
2928
2874
|
${cssMargin()}
|
|
@@ -2932,7 +2878,7 @@ const Container$5 = styled.div`
|
|
|
2932
2878
|
return css`
|
|
2933
2879
|
font-size: 18px;
|
|
2934
2880
|
|
|
2935
|
-
${Label} {
|
|
2881
|
+
${Label$3} {
|
|
2936
2882
|
font-size: 14px;
|
|
2937
2883
|
}
|
|
2938
2884
|
`;
|
|
@@ -2940,7 +2886,7 @@ const Container$5 = styled.div`
|
|
|
2940
2886
|
return css`
|
|
2941
2887
|
font-size: 32px;
|
|
2942
2888
|
|
|
2943
|
-
${Label} {
|
|
2889
|
+
${Label$3} {
|
|
2944
2890
|
font-size: 18px;
|
|
2945
2891
|
}
|
|
2946
2892
|
`;
|
|
@@ -2948,7 +2894,7 @@ const Container$5 = styled.div`
|
|
|
2948
2894
|
return css`
|
|
2949
2895
|
font-size: 24px;
|
|
2950
2896
|
|
|
2951
|
-
${Label} {
|
|
2897
|
+
${Label$3} {
|
|
2952
2898
|
font-size: 16px;
|
|
2953
2899
|
}
|
|
2954
2900
|
`;
|
|
@@ -3085,7 +3031,7 @@ const Container$5 = styled.div`
|
|
|
3085
3031
|
})}
|
|
3086
3032
|
}
|
|
3087
3033
|
|
|
3088
|
-
${Label} {
|
|
3034
|
+
${Label$3} {
|
|
3089
3035
|
${(p) => cssMediaRules([p.labelColor, p.labelFont], ([labelColor = {
|
|
3090
3036
|
swatch: {
|
|
3091
3037
|
hue: 0,
|
|
@@ -3162,7 +3108,7 @@ const Countdown = forwardRef(function Countdown2({
|
|
|
3162
3108
|
}, 1e3);
|
|
3163
3109
|
return () => clearInterval(intervalId);
|
|
3164
3110
|
}, [date]);
|
|
3165
|
-
return /* @__PURE__ */ jsxs(Container$
|
|
3111
|
+
return /* @__PURE__ */ jsxs(Container$a, {
|
|
3166
3112
|
ref,
|
|
3167
3113
|
id,
|
|
3168
3114
|
width,
|
|
@@ -3181,7 +3127,7 @@ const Countdown = forwardRef(function Countdown2({
|
|
|
3181
3127
|
children: /* @__PURE__ */ jsx("span", {
|
|
3182
3128
|
children: days
|
|
3183
3129
|
})
|
|
3184
|
-
}), /* @__PURE__ */ jsx(Label, {
|
|
3130
|
+
}), /* @__PURE__ */ jsx(Label$3, {
|
|
3185
3131
|
children: daysLabel == null ? "Days" : daysLabel
|
|
3186
3132
|
})]
|
|
3187
3133
|
}), /* @__PURE__ */ jsxs(Segment, {
|
|
@@ -3189,7 +3135,7 @@ const Countdown = forwardRef(function Countdown2({
|
|
|
3189
3135
|
children: /* @__PURE__ */ jsx("span", {
|
|
3190
3136
|
children: hours
|
|
3191
3137
|
})
|
|
3192
|
-
}), /* @__PURE__ */ jsx(Label, {
|
|
3138
|
+
}), /* @__PURE__ */ jsx(Label$3, {
|
|
3193
3139
|
children: hoursLabel == null ? "Hours" : hoursLabel
|
|
3194
3140
|
})]
|
|
3195
3141
|
}), /* @__PURE__ */ jsxs(Segment, {
|
|
@@ -3197,7 +3143,7 @@ const Countdown = forwardRef(function Countdown2({
|
|
|
3197
3143
|
children: /* @__PURE__ */ jsx("span", {
|
|
3198
3144
|
children: minutes
|
|
3199
3145
|
})
|
|
3200
|
-
}), /* @__PURE__ */ jsx(Label, {
|
|
3146
|
+
}), /* @__PURE__ */ jsx(Label$3, {
|
|
3201
3147
|
children: minutesLabel == null ? "Minutes" : minutesLabel
|
|
3202
3148
|
})]
|
|
3203
3149
|
}), /* @__PURE__ */ jsxs(Segment, {
|
|
@@ -3205,13 +3151,13 @@ const Countdown = forwardRef(function Countdown2({
|
|
|
3205
3151
|
children: /* @__PURE__ */ jsx("span", {
|
|
3206
3152
|
children: seconds
|
|
3207
3153
|
})
|
|
3208
|
-
}), /* @__PURE__ */ jsx(Label, {
|
|
3154
|
+
}), /* @__PURE__ */ jsx(Label$3, {
|
|
3209
3155
|
children: secondsLabel == null ? "Seconds" : secondsLabel
|
|
3210
3156
|
})]
|
|
3211
3157
|
})]
|
|
3212
3158
|
});
|
|
3213
3159
|
});
|
|
3214
|
-
function registerComponent$
|
|
3160
|
+
function registerComponent$8(runtime) {
|
|
3215
3161
|
return runtime.registerComponent(Countdown, {
|
|
3216
3162
|
type: "./components/Countdown/index.js",
|
|
3217
3163
|
label: "Countdown",
|
|
@@ -3347,7 +3293,7 @@ const IE11MinHeightContainer = styled.div`
|
|
|
3347
3293
|
${cssWidth()}
|
|
3348
3294
|
${cssMargin()}
|
|
3349
3295
|
`;
|
|
3350
|
-
const Container$
|
|
3296
|
+
const Container$9 = styled.div`
|
|
3351
3297
|
display: flex;
|
|
3352
3298
|
flex-direction: column;
|
|
3353
3299
|
justify-content: center;
|
|
@@ -3406,7 +3352,7 @@ const Divider = forwardRef(function Divider2({
|
|
|
3406
3352
|
id,
|
|
3407
3353
|
width,
|
|
3408
3354
|
margin,
|
|
3409
|
-
children: /* @__PURE__ */ jsx(Container$
|
|
3355
|
+
children: /* @__PURE__ */ jsx(Container$9, {
|
|
3410
3356
|
children: /* @__PURE__ */ jsx(Line, {
|
|
3411
3357
|
variant,
|
|
3412
3358
|
thickness,
|
|
@@ -3415,7 +3361,7 @@ const Divider = forwardRef(function Divider2({
|
|
|
3415
3361
|
})
|
|
3416
3362
|
});
|
|
3417
3363
|
});
|
|
3418
|
-
function registerComponent$
|
|
3364
|
+
function registerComponent$7(runtime) {
|
|
3419
3365
|
return runtime.registerComponent(Divider, {
|
|
3420
3366
|
type: "./components/Divider/index.js",
|
|
3421
3367
|
label: "Divider",
|
|
@@ -3465,7 +3411,7 @@ function registerComponent$5(runtime) {
|
|
|
3465
3411
|
}
|
|
3466
3412
|
});
|
|
3467
3413
|
}
|
|
3468
|
-
const Container$
|
|
3414
|
+
const Container$8 = styled.div`
|
|
3469
3415
|
min-height: 15px;
|
|
3470
3416
|
${cssWidth()}
|
|
3471
3417
|
${cssMargin()}
|
|
@@ -3545,7 +3491,7 @@ const Embed = forwardRef(function Embed2({
|
|
|
3545
3491
|
}, [container, html]);
|
|
3546
3492
|
if (shouldRender === false)
|
|
3547
3493
|
return null;
|
|
3548
|
-
return /* @__PURE__ */ jsx(Container$
|
|
3494
|
+
return /* @__PURE__ */ jsx(Container$8, {
|
|
3549
3495
|
ref: setContainer,
|
|
3550
3496
|
id,
|
|
3551
3497
|
margin,
|
|
@@ -3555,14 +3501,14 @@ const Embed = forwardRef(function Embed2({
|
|
|
3555
3501
|
}
|
|
3556
3502
|
});
|
|
3557
3503
|
});
|
|
3558
|
-
function registerComponent$
|
|
3504
|
+
function registerComponent$6(runtime) {
|
|
3559
3505
|
return runtime.registerComponent(Embed, {
|
|
3560
3506
|
type: "./components/Embed/index.js",
|
|
3561
3507
|
label: "Embed",
|
|
3562
3508
|
icon: "Code40",
|
|
3563
3509
|
props: {
|
|
3564
3510
|
id: ElementID(),
|
|
3565
|
-
html: TextArea({
|
|
3511
|
+
html: TextArea$1({
|
|
3566
3512
|
label: "Code",
|
|
3567
3513
|
rows: 20
|
|
3568
3514
|
}),
|
|
@@ -3571,9 +3517,9 @@ function registerComponent$4(runtime) {
|
|
|
3571
3517
|
}
|
|
3572
3518
|
});
|
|
3573
3519
|
}
|
|
3574
|
-
var _path$
|
|
3575
|
-
function _extends$
|
|
3576
|
-
_extends$
|
|
3520
|
+
var _path$s;
|
|
3521
|
+
function _extends$t() {
|
|
3522
|
+
_extends$t = Object.assign || function(target) {
|
|
3577
3523
|
for (var i = 1; i < arguments.length; i++) {
|
|
3578
3524
|
var source = arguments[i];
|
|
3579
3525
|
for (var key in source) {
|
|
@@ -3584,66 +3530,1844 @@ function _extends$r() {
|
|
|
3584
3530
|
}
|
|
3585
3531
|
return target;
|
|
3586
3532
|
};
|
|
3587
|
-
return _extends$
|
|
3533
|
+
return _extends$t.apply(this, arguments);
|
|
3588
3534
|
}
|
|
3589
|
-
var
|
|
3590
|
-
return /* @__PURE__ */ React.createElement("svg", _extends$
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
}, props), _path$
|
|
3595
|
-
|
|
3535
|
+
var SvgCheck12 = function SvgCheck122(props) {
|
|
3536
|
+
return /* @__PURE__ */ React.createElement("svg", _extends$t({
|
|
3537
|
+
width: 12,
|
|
3538
|
+
height: 12,
|
|
3539
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
3540
|
+
}, props), _path$s || (_path$s = /* @__PURE__ */ React.createElement("path", {
|
|
3541
|
+
fillRule: "evenodd",
|
|
3542
|
+
clipRule: "evenodd",
|
|
3543
|
+
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"
|
|
3596
3544
|
})));
|
|
3597
3545
|
};
|
|
3598
|
-
const
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
}
|
|
3603
|
-
|
|
3604
|
-
|
|
3546
|
+
const Shapes = Object.freeze({
|
|
3547
|
+
SQUARE: "square",
|
|
3548
|
+
ROUNDED: "rounded",
|
|
3549
|
+
PILL: "pill"
|
|
3550
|
+
});
|
|
3551
|
+
const Sizes = Object.freeze({
|
|
3552
|
+
SMALL: "small",
|
|
3553
|
+
MEDIUM: "medium",
|
|
3554
|
+
LARGE: "large"
|
|
3555
|
+
});
|
|
3556
|
+
const Contrasts = Object.freeze({
|
|
3557
|
+
LIGHT: "light",
|
|
3558
|
+
DARK: "dark"
|
|
3559
|
+
});
|
|
3560
|
+
const Context$1 = createContext({});
|
|
3561
|
+
function useFormContext() {
|
|
3562
|
+
return useContext(Context$1);
|
|
3563
|
+
}
|
|
3564
|
+
const { Provider } = Context$1;
|
|
3565
|
+
function getSizeHeight$2(size) {
|
|
3566
|
+
switch (size) {
|
|
3567
|
+
case Sizes.SMALL:
|
|
3568
|
+
return 30;
|
|
3569
|
+
case Sizes.MEDIUM:
|
|
3570
|
+
return 38;
|
|
3571
|
+
case Sizes.LARGE:
|
|
3572
|
+
return 48;
|
|
3573
|
+
default:
|
|
3574
|
+
throw new Error(`Invalid form size "${size}"`);
|
|
3575
|
+
}
|
|
3576
|
+
}
|
|
3577
|
+
function getSizeHorizontalPadding(size) {
|
|
3578
|
+
switch (size) {
|
|
3579
|
+
case Sizes.SMALL:
|
|
3580
|
+
return 8;
|
|
3581
|
+
case Sizes.MEDIUM:
|
|
3582
|
+
return 12;
|
|
3583
|
+
case Sizes.LARGE:
|
|
3584
|
+
return 16;
|
|
3585
|
+
default:
|
|
3586
|
+
throw new Error(`Invalid form size "${size}"`);
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
function getSizeVerticalPadding(size) {
|
|
3590
|
+
switch (size) {
|
|
3591
|
+
case Sizes.SMALL:
|
|
3592
|
+
return 3;
|
|
3593
|
+
case Sizes.MEDIUM:
|
|
3594
|
+
return 7;
|
|
3595
|
+
case Sizes.LARGE:
|
|
3596
|
+
return 11;
|
|
3597
|
+
default:
|
|
3598
|
+
throw new Error(`Invalid form size "${size}"`);
|
|
3599
|
+
}
|
|
3600
|
+
}
|
|
3601
|
+
function getShapeBorderRadius(shape) {
|
|
3602
|
+
switch (shape) {
|
|
3603
|
+
case Shapes.SQUARE:
|
|
3604
|
+
return 0;
|
|
3605
|
+
case Shapes.ROUNDED:
|
|
3606
|
+
return 4;
|
|
3607
|
+
case Shapes.PILL:
|
|
3608
|
+
return 500;
|
|
3609
|
+
default:
|
|
3610
|
+
throw new Error(`Invalid form shape "${shape}"`);
|
|
3611
|
+
}
|
|
3612
|
+
}
|
|
3613
|
+
function getContrastBorderColor(contrast, error) {
|
|
3614
|
+
switch (contrast) {
|
|
3615
|
+
case Contrasts.LIGHT:
|
|
3616
|
+
return error ? "rgba(255, 0, 0, 0.7)" : "rgba(0, 0, 0, 0.25)";
|
|
3617
|
+
case Contrasts.DARK:
|
|
3618
|
+
return error ? "rgba(255, 0, 0, 0.7)" : "rgba(255, 255, 255, 0.6)";
|
|
3619
|
+
default:
|
|
3620
|
+
throw new Error(`Invalid form contrast "${contrast}"`);
|
|
3621
|
+
}
|
|
3622
|
+
}
|
|
3623
|
+
function getContrastBackgroundColor(contrast) {
|
|
3624
|
+
switch (contrast) {
|
|
3625
|
+
case Contrasts.LIGHT:
|
|
3626
|
+
return "white";
|
|
3627
|
+
case Contrasts.DARK:
|
|
3628
|
+
return "rgba(0, 0, 0, 0.7)";
|
|
3629
|
+
default:
|
|
3630
|
+
throw new Error(`Invalid form contrast "${contrast}"`);
|
|
3631
|
+
}
|
|
3632
|
+
}
|
|
3633
|
+
function getContrastColor$1(contrast) {
|
|
3634
|
+
switch (contrast) {
|
|
3635
|
+
case Contrasts.LIGHT:
|
|
3636
|
+
return "rgba(0, 0, 0, 0.95)";
|
|
3637
|
+
case Contrasts.DARK:
|
|
3638
|
+
return "white";
|
|
3639
|
+
default:
|
|
3640
|
+
throw new Error(`Invalid form contrast "${contrast}"`);
|
|
3641
|
+
}
|
|
3642
|
+
}
|
|
3643
|
+
function getContrastPlaceholderColor(contrast) {
|
|
3644
|
+
switch (contrast) {
|
|
3645
|
+
case Contrasts.LIGHT:
|
|
3646
|
+
return "rgba(0, 0, 0, 0.3)";
|
|
3647
|
+
case Contrasts.DARK:
|
|
3648
|
+
return "rgba(255,255,255,0.3)";
|
|
3649
|
+
default:
|
|
3650
|
+
throw new Error(`Invalid form contrast "${contrast}"`);
|
|
3651
|
+
}
|
|
3652
|
+
}
|
|
3653
|
+
function cssField() {
|
|
3654
|
+
return css`
|
|
3655
|
+
display: block;
|
|
3656
|
+
width: 100%;
|
|
3657
|
+
outline: none;
|
|
3658
|
+
border-width: 1px;
|
|
3659
|
+
border-style: solid;
|
|
3660
|
+
transition: border-color 200ms;
|
|
3661
|
+
${(props) => cssMediaRules([props.shape, props.size, props.contrast, props.brandColor], ([
|
|
3662
|
+
shape = Shapes.ROUNDED,
|
|
3663
|
+
size = Sizes.MEDIUM,
|
|
3664
|
+
contrast = Contrasts.LIGHT,
|
|
3665
|
+
brandColor = { swatch: { hue: 0, saturation: 0, lightness: 0 }, alpha: 1 }
|
|
3666
|
+
]) => css`
|
|
3667
|
+
padding: ${getSizeVerticalPadding(size)}px ${getSizeHorizontalPadding(size)}px;
|
|
3668
|
+
border-radius: ${getShapeBorderRadius(shape)}px;
|
|
3669
|
+
border-color: ${getContrastBorderColor(contrast, props.error)};
|
|
3670
|
+
color: ${getContrastColor$1(contrast)};
|
|
3671
|
+
background-color: ${getContrastBackgroundColor(contrast)};
|
|
3672
|
+
|
|
3673
|
+
:focus,
|
|
3674
|
+
:focus-within {
|
|
3675
|
+
border-color: ${colorToString(brandColor)};
|
|
3676
|
+
}
|
|
3677
|
+
|
|
3678
|
+
::placeholder {
|
|
3679
|
+
color: ${getContrastPlaceholderColor(contrast)};
|
|
3680
|
+
}
|
|
3681
|
+
`)}
|
|
3682
|
+
`;
|
|
3683
|
+
}
|
|
3684
|
+
function getSizeHeight$1(size) {
|
|
3685
|
+
switch (size) {
|
|
3686
|
+
case Sizes.SMALL:
|
|
3687
|
+
return 36;
|
|
3688
|
+
case Sizes.MEDIUM:
|
|
3689
|
+
return 42;
|
|
3690
|
+
case Sizes.LARGE:
|
|
3691
|
+
return 48;
|
|
3692
|
+
default:
|
|
3693
|
+
throw new Error(`Invalid form size "${size}"`);
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3696
|
+
const Base$2 = styled.input`
|
|
3697
|
+
${cssField()}
|
|
3698
|
+
${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => css`
|
|
3699
|
+
min-height: ${getSizeHeight$1(size)}px;
|
|
3700
|
+
max-height: ${getSizeHeight$1(size)}px;
|
|
3605
3701
|
`)}
|
|
3606
3702
|
`;
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3703
|
+
var Input$2 = forwardRef(function Input(_o, ref) {
|
|
3704
|
+
var _p = _o, {
|
|
3705
|
+
error = false,
|
|
3706
|
+
form
|
|
3707
|
+
} = _p, restOfProps = __objRest(_p, [
|
|
3708
|
+
"error",
|
|
3709
|
+
"form"
|
|
3710
|
+
]);
|
|
3711
|
+
const {
|
|
3712
|
+
shape,
|
|
3713
|
+
size,
|
|
3714
|
+
contrast,
|
|
3715
|
+
brandColor
|
|
3716
|
+
} = useFormContext();
|
|
3717
|
+
return /* @__PURE__ */ jsx(Base$2, __spreadProps(__spreadValues({}, restOfProps), {
|
|
3718
|
+
ref,
|
|
3719
|
+
error,
|
|
3720
|
+
shape,
|
|
3721
|
+
size,
|
|
3722
|
+
contrast,
|
|
3723
|
+
brandColor
|
|
3724
|
+
}));
|
|
3725
|
+
});
|
|
3726
|
+
const Container$7 = styled.div`
|
|
3727
|
+
display: flex;
|
|
3728
|
+
flex-direction: column;
|
|
3729
|
+
${cssWidth()};
|
|
3730
|
+
${cssMargin()};
|
|
3731
|
+
`;
|
|
3732
|
+
const Label$2 = styled.div`
|
|
3733
|
+
max-width: 120px;
|
|
3734
|
+
min-width: 60px;
|
|
3735
|
+
height: 8px;
|
|
3736
|
+
border-radius: 2px;
|
|
3610
3737
|
background-color: #a1a8c2;
|
|
3611
|
-
border-radius: ${(props) => props.button === true ? 6 : 2}px;
|
|
3612
3738
|
opacity: 0.4;
|
|
3739
|
+
margin-bottom: 8px;
|
|
3613
3740
|
`;
|
|
3614
|
-
const
|
|
3615
|
-
width:
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3741
|
+
const Input$1 = styled.div`
|
|
3742
|
+
min-width: 80px;
|
|
3743
|
+
height: 32px;
|
|
3744
|
+
border-radius: 4px;
|
|
3745
|
+
border-width: 2px;
|
|
3746
|
+
border-style: solid;
|
|
3747
|
+
border-color: #a1a8c2;
|
|
3748
|
+
opacity: 0.4;
|
|
3749
|
+
`;
|
|
3750
|
+
const Button = styled.div`
|
|
3751
|
+
min-width: 140px;
|
|
3752
|
+
height: 32px;
|
|
3753
|
+
border-radius: 4px;
|
|
3754
|
+
background-color: #a1a8c2;
|
|
3755
|
+
opacity: 0.4;
|
|
3756
|
+
`;
|
|
3757
|
+
var Placeholder$1 = forwardRef(function Placeholder2({
|
|
3758
|
+
width,
|
|
3759
|
+
margin
|
|
3760
|
+
}, ref) {
|
|
3761
|
+
return /* @__PURE__ */ jsxs(Container$7, {
|
|
3762
|
+
ref,
|
|
3763
|
+
width,
|
|
3764
|
+
margin,
|
|
3765
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
3766
|
+
style: {
|
|
3767
|
+
display: "flex",
|
|
3768
|
+
flexDirection: "column",
|
|
3769
|
+
marginBottom: 16
|
|
3770
|
+
},
|
|
3771
|
+
children: [/* @__PURE__ */ jsx(Label$2, {}), /* @__PURE__ */ jsx(Input$1, {})]
|
|
3772
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
3773
|
+
style: {
|
|
3774
|
+
display: "flex",
|
|
3775
|
+
flexDirection: "column",
|
|
3776
|
+
marginBottom: 16
|
|
3777
|
+
},
|
|
3778
|
+
children: [/* @__PURE__ */ jsx(Label$2, {}), /* @__PURE__ */ jsx(Input$1, {})]
|
|
3779
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
3780
|
+
style: {
|
|
3781
|
+
display: "flex",
|
|
3782
|
+
flexDirection: "column",
|
|
3783
|
+
justifyContent: "flex-end"
|
|
3784
|
+
},
|
|
3785
|
+
children: /* @__PURE__ */ jsx(Button, {})
|
|
3786
|
+
})]
|
|
3634
3787
|
});
|
|
3788
|
+
});
|
|
3789
|
+
function getSizeHeight(size) {
|
|
3790
|
+
switch (size) {
|
|
3791
|
+
case Sizes.SMALL:
|
|
3792
|
+
return 14;
|
|
3793
|
+
case Sizes.MEDIUM:
|
|
3794
|
+
return 18;
|
|
3795
|
+
case Sizes.LARGE:
|
|
3796
|
+
return 22;
|
|
3797
|
+
default:
|
|
3798
|
+
throw new Error(`Invalid form size "${size}"`);
|
|
3799
|
+
}
|
|
3635
3800
|
}
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3801
|
+
function getContrastColor(contrast) {
|
|
3802
|
+
switch (contrast) {
|
|
3803
|
+
case Contrasts.LIGHT:
|
|
3804
|
+
return "rgba(0, 0, 0, 0.8)";
|
|
3805
|
+
case Contrasts.DARK:
|
|
3806
|
+
return "rgba(255, 255, 255, 0.95)";
|
|
3807
|
+
default:
|
|
3808
|
+
throw new Error(`Invalid form contrast "${contrast}"`);
|
|
3809
|
+
}
|
|
3810
|
+
}
|
|
3811
|
+
const Base$1 = styled.label`
|
|
3812
|
+
display: block;
|
|
3813
|
+
margin: 0 0 0.25em 0;
|
|
3814
|
+
${cssTextStyle()}
|
|
3815
|
+
${(props) => cssMediaRules([props.size, props.contrast, props.textColor], ([size = Sizes.MEDIUM, contrast = Contrasts.LIGHT, textColor]) => css`
|
|
3816
|
+
min-height: ${getSizeHeight(size)}px;
|
|
3817
|
+
color: ${textColor == null ? getContrastColor(contrast) : colorToString(textColor)};
|
|
3818
|
+
`)}
|
|
3819
|
+
`;
|
|
3820
|
+
function Label$1(props) {
|
|
3821
|
+
const {
|
|
3822
|
+
contrast,
|
|
3823
|
+
size,
|
|
3824
|
+
labelTextStyle,
|
|
3825
|
+
labelTextColor
|
|
3826
|
+
} = useFormContext();
|
|
3827
|
+
return /* @__PURE__ */ jsx(Base$1, __spreadProps(__spreadValues({}, props), {
|
|
3828
|
+
contrast,
|
|
3829
|
+
size,
|
|
3830
|
+
textStyle: labelTextStyle,
|
|
3831
|
+
textColor: useColor(labelTextColor)
|
|
3832
|
+
}));
|
|
3833
|
+
}
|
|
3834
|
+
var SingleLineTextTableField = forwardRef(function SingleLineTextTableField2(_q, ref) {
|
|
3835
|
+
var _r = _q, {
|
|
3836
|
+
id,
|
|
3837
|
+
label = "",
|
|
3838
|
+
name,
|
|
3839
|
+
error,
|
|
3840
|
+
hideLabel = false
|
|
3841
|
+
} = _r, restOfProps = __objRest(_r, [
|
|
3842
|
+
"id",
|
|
3843
|
+
"label",
|
|
3844
|
+
"name",
|
|
3845
|
+
"error",
|
|
3846
|
+
"hideLabel"
|
|
3847
|
+
]);
|
|
3848
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
3849
|
+
children: [!hideLabel && /* @__PURE__ */ jsx(Label$1, {
|
|
3850
|
+
htmlFor: id,
|
|
3851
|
+
children: label
|
|
3852
|
+
}), /* @__PURE__ */ jsx(Input$2, __spreadProps(__spreadValues({}, restOfProps), {
|
|
3853
|
+
"aria-label": label,
|
|
3854
|
+
ref,
|
|
3855
|
+
id,
|
|
3856
|
+
name,
|
|
3857
|
+
type: "text",
|
|
3858
|
+
error: error != null
|
|
3859
|
+
}))]
|
|
3860
|
+
});
|
|
3861
|
+
});
|
|
3862
|
+
const Base = styled.textarea`
|
|
3863
|
+
resize: vertical;
|
|
3864
|
+
${cssField()}
|
|
3865
|
+
`;
|
|
3866
|
+
var TextArea = forwardRef(function TextArea2(_s, ref) {
|
|
3867
|
+
var _t = _s, {
|
|
3868
|
+
error = false,
|
|
3869
|
+
form
|
|
3870
|
+
} = _t, restOfProps = __objRest(_t, [
|
|
3871
|
+
"error",
|
|
3872
|
+
"form"
|
|
3873
|
+
]);
|
|
3874
|
+
const {
|
|
3875
|
+
shape,
|
|
3876
|
+
size,
|
|
3877
|
+
contrast,
|
|
3878
|
+
brandColor
|
|
3879
|
+
} = useFormContext();
|
|
3880
|
+
return /* @__PURE__ */ jsx(Base, __spreadProps(__spreadValues({}, restOfProps), {
|
|
3881
|
+
ref,
|
|
3882
|
+
rows: 4,
|
|
3883
|
+
error,
|
|
3884
|
+
shape,
|
|
3885
|
+
size,
|
|
3886
|
+
contrast,
|
|
3887
|
+
brandColor
|
|
3888
|
+
}));
|
|
3889
|
+
});
|
|
3890
|
+
var LongTextTableField = forwardRef(function LongTextTableField2(_u, ref) {
|
|
3891
|
+
var _v = _u, {
|
|
3892
|
+
id,
|
|
3893
|
+
label = "",
|
|
3894
|
+
error,
|
|
3895
|
+
hideLabel = false
|
|
3896
|
+
} = _v, restOfProps = __objRest(_v, [
|
|
3897
|
+
"id",
|
|
3898
|
+
"label",
|
|
3899
|
+
"error",
|
|
3900
|
+
"hideLabel"
|
|
3901
|
+
]);
|
|
3902
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
3903
|
+
children: [!hideLabel && /* @__PURE__ */ jsx(Label$1, {
|
|
3904
|
+
htmlFor: id,
|
|
3905
|
+
children: label
|
|
3906
|
+
}), /* @__PURE__ */ jsx(TextArea, __spreadProps(__spreadValues({}, restOfProps), {
|
|
3907
|
+
"aria-label": label,
|
|
3908
|
+
ref,
|
|
3909
|
+
id,
|
|
3910
|
+
error: error != null
|
|
3911
|
+
}))]
|
|
3912
|
+
});
|
|
3913
|
+
});
|
|
3914
|
+
function getCheckmarkColor$1({
|
|
3915
|
+
swatch: {
|
|
3916
|
+
hue: h,
|
|
3917
|
+
saturation: s,
|
|
3918
|
+
lightness: l
|
|
3919
|
+
},
|
|
3920
|
+
alpha: a
|
|
3921
|
+
}) {
|
|
3922
|
+
return ColorHelper({
|
|
3923
|
+
h,
|
|
3924
|
+
s,
|
|
3925
|
+
l
|
|
3926
|
+
}).alpha(a).isLight() ? "rgba(0, 0, 0, 0.7)" : "rgba(255, 255, 255, 0.95)";
|
|
3927
|
+
}
|
|
3928
|
+
const Container$6 = styled.div`
|
|
3929
|
+
position: relative;
|
|
3930
|
+
${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => css`
|
|
3931
|
+
height: ${getSizeHeight(size)}px;
|
|
3932
|
+
width: ${getSizeHeight(size)}px;
|
|
3933
|
+
`)}
|
|
3934
|
+
`;
|
|
3935
|
+
const FakeCheckbox = styled.div`
|
|
3936
|
+
position: absolute;
|
|
3937
|
+
width: 100%;
|
|
3938
|
+
height: 100%;
|
|
3939
|
+
border-style: solid;
|
|
3940
|
+
border-radius: 4px;
|
|
3941
|
+
pointer-events: none;
|
|
3942
|
+
border-width: 1px;
|
|
3943
|
+
${(props) => cssMediaRules([props.contrast], ([contrast = Contrasts.LIGHT]) => css`
|
|
3944
|
+
border-color: ${getContrastBorderColor(contrast, props.error)};
|
|
3945
|
+
background-color: ${getContrastBackgroundColor(contrast)};
|
|
3946
|
+
`)}
|
|
3947
|
+
`;
|
|
3948
|
+
const HiddenCheckbox = styled.input`
|
|
3949
|
+
position: absolute;
|
|
3950
|
+
opacity: 0;
|
|
3951
|
+
width: 100%;
|
|
3952
|
+
height: 100%;
|
|
3953
|
+
cursor: pointer;
|
|
3954
|
+
|
|
3955
|
+
&:disabled {
|
|
3956
|
+
cursor: no-drop;
|
|
3957
|
+
|
|
3958
|
+
& ~ ${FakeCheckbox} {
|
|
3959
|
+
opacity: 0.5;
|
|
3960
|
+
}
|
|
3961
|
+
}
|
|
3962
|
+
|
|
3963
|
+
&:checked ~ ${FakeCheckbox} {
|
|
3964
|
+
${(props) => cssMediaRules([props.brandColor], ([{
|
|
3965
|
+
swatch = {
|
|
3966
|
+
hue: 0,
|
|
3967
|
+
saturation: 0,
|
|
3968
|
+
lightness: 0
|
|
3969
|
+
},
|
|
3970
|
+
alpha = 1
|
|
3971
|
+
} = {}]) => css`
|
|
3972
|
+
background-color: ${colorToString({
|
|
3973
|
+
swatch,
|
|
3974
|
+
alpha
|
|
3975
|
+
})};
|
|
3976
|
+
`)}
|
|
3977
|
+
border-color: transparent;
|
|
3978
|
+
|
|
3979
|
+
&::after {
|
|
3980
|
+
content: '';
|
|
3981
|
+
position: absolute;
|
|
3982
|
+
box-sizing: content-box;
|
|
3983
|
+
width: 25%;
|
|
3984
|
+
height: 50%;
|
|
3985
|
+
${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => css`
|
|
3986
|
+
border-width: ${getSizeHeight(size) * 0.1}px;
|
|
3987
|
+
border-left: 0;
|
|
3988
|
+
border-top: 0;
|
|
3989
|
+
`)}
|
|
3990
|
+
border-style: solid;
|
|
3991
|
+
${(props) => cssMediaRules([props.brandColor], ([{
|
|
3992
|
+
swatch = {
|
|
3993
|
+
hue: 0,
|
|
3994
|
+
saturation: 0,
|
|
3995
|
+
lightness: 0
|
|
3996
|
+
},
|
|
3997
|
+
alpha = 1
|
|
3998
|
+
} = {}]) => css`
|
|
3999
|
+
border-color: ${getCheckmarkColor$1({
|
|
4000
|
+
swatch,
|
|
4001
|
+
alpha
|
|
4002
|
+
})};
|
|
4003
|
+
`)}
|
|
4004
|
+
transform: rotate(45deg) translate3d(91%, -23%, 0);
|
|
4005
|
+
}
|
|
4006
|
+
}
|
|
4007
|
+
|
|
4008
|
+
&:not(:disabled) {
|
|
4009
|
+
&:focus ~ ${FakeCheckbox} {
|
|
4010
|
+
${(props) => cssMediaRules([props.brandColor], ([brandColor = {
|
|
4011
|
+
swatch: {
|
|
4012
|
+
hue: 0,
|
|
4013
|
+
saturation: 0,
|
|
4014
|
+
lightness: 0
|
|
4015
|
+
},
|
|
4016
|
+
alpha: 1
|
|
4017
|
+
}]) => css`
|
|
4018
|
+
border-color: ${colorToString(brandColor)};
|
|
4019
|
+
`)}
|
|
4020
|
+
}
|
|
4021
|
+
}
|
|
4022
|
+
|
|
4023
|
+
&:not(:disabled):checked {
|
|
4024
|
+
&:focus ~ ${FakeCheckbox} {
|
|
4025
|
+
${(props) => cssMediaRules([props.contrast], ([contrast = Contrasts.LIGHT]) => css`
|
|
4026
|
+
border-color: ${getContrastBorderColor(contrast, props.error)};
|
|
4027
|
+
`)}
|
|
4028
|
+
}
|
|
4029
|
+
}
|
|
4030
|
+
`;
|
|
4031
|
+
var Checkbox = forwardRef(function Checkbox2(_w, ref) {
|
|
4032
|
+
var _x = _w, {
|
|
4033
|
+
error,
|
|
4034
|
+
className,
|
|
4035
|
+
style,
|
|
4036
|
+
form
|
|
4037
|
+
} = _x, restOfProps = __objRest(_x, [
|
|
4038
|
+
"error",
|
|
4039
|
+
"className",
|
|
4040
|
+
"style",
|
|
4041
|
+
"form"
|
|
4042
|
+
]);
|
|
4043
|
+
const {
|
|
4044
|
+
size,
|
|
4045
|
+
contrast,
|
|
4046
|
+
brandColor
|
|
4047
|
+
} = useFormContext();
|
|
4048
|
+
return /* @__PURE__ */ jsxs(Container$6, {
|
|
4049
|
+
size,
|
|
4050
|
+
children: [/* @__PURE__ */ jsx(HiddenCheckbox, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4051
|
+
type: "checkbox",
|
|
4052
|
+
ref,
|
|
4053
|
+
error,
|
|
4054
|
+
size,
|
|
4055
|
+
contrast,
|
|
4056
|
+
brandColor
|
|
4057
|
+
})), /* @__PURE__ */ jsx(FakeCheckbox, {
|
|
4058
|
+
className,
|
|
4059
|
+
error,
|
|
4060
|
+
contrast,
|
|
4061
|
+
style
|
|
4062
|
+
})]
|
|
4063
|
+
});
|
|
4064
|
+
});
|
|
4065
|
+
const StyledLabel$2 = styled(Label$1)`
|
|
4066
|
+
display: flex;
|
|
4067
|
+
align-items: center;
|
|
4068
|
+
margin: 0;
|
|
4069
|
+
${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => css`
|
|
4070
|
+
min-height: ${getSizeHeight$1(size)}px;
|
|
4071
|
+
max-height: ${getSizeHeight$1(size)}px;
|
|
4072
|
+
`)}
|
|
4073
|
+
`;
|
|
4074
|
+
const CheckboxContainer$1 = styled.span`
|
|
4075
|
+
margin-right: 8px;
|
|
4076
|
+
`;
|
|
4077
|
+
var CheckboxTableField = forwardRef(function CheckboxTableField2(_y, ref) {
|
|
4078
|
+
var _z = _y, {
|
|
4079
|
+
form,
|
|
4080
|
+
id,
|
|
4081
|
+
name,
|
|
4082
|
+
label = "",
|
|
4083
|
+
value = false,
|
|
4084
|
+
error
|
|
4085
|
+
} = _z, restOfProps = __objRest(_z, [
|
|
4086
|
+
"form",
|
|
4087
|
+
"id",
|
|
4088
|
+
"name",
|
|
4089
|
+
"label",
|
|
4090
|
+
"value",
|
|
4091
|
+
"error"
|
|
4092
|
+
]);
|
|
4093
|
+
const {
|
|
4094
|
+
size
|
|
4095
|
+
} = useFormContext();
|
|
4096
|
+
function handleChange(event) {
|
|
4097
|
+
form.setFieldValue(name, event.currentTarget.checked);
|
|
4098
|
+
}
|
|
4099
|
+
return /* @__PURE__ */ jsxs(StyledLabel$2, {
|
|
4100
|
+
htmlFor: id,
|
|
4101
|
+
size,
|
|
4102
|
+
children: [/* @__PURE__ */ jsx(CheckboxContainer$1, {
|
|
4103
|
+
children: /* @__PURE__ */ jsx(Checkbox, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4104
|
+
"aria-label": label,
|
|
4105
|
+
checked: value,
|
|
4106
|
+
onChange: handleChange,
|
|
4107
|
+
ref,
|
|
4108
|
+
id,
|
|
4109
|
+
error: error != null
|
|
4110
|
+
}))
|
|
4111
|
+
}), label]
|
|
4112
|
+
});
|
|
4113
|
+
});
|
|
4114
|
+
const MainLabel = styled(Label$1)`
|
|
4115
|
+
margin: 0 0 4px 0;
|
|
4116
|
+
`;
|
|
4117
|
+
const StyledLabel$1 = styled(Label$1)`
|
|
4118
|
+
display: flex;
|
|
4119
|
+
align-items: center;
|
|
4120
|
+
margin: 8px 0;
|
|
4121
|
+
|
|
4122
|
+
&:last-of-type {
|
|
4123
|
+
margin-bottom: 0;
|
|
4124
|
+
}
|
|
4125
|
+
`;
|
|
4126
|
+
const CheckboxContainer = styled.span`
|
|
4127
|
+
margin-right: 8px;
|
|
4128
|
+
`;
|
|
4129
|
+
var MultipleSelectTableField = forwardRef(function MultipleSelectTableField2(_A, ref) {
|
|
4130
|
+
var _B = _A, {
|
|
4131
|
+
tableColumn,
|
|
4132
|
+
label = "",
|
|
4133
|
+
required,
|
|
4134
|
+
value = [],
|
|
4135
|
+
onChange,
|
|
4136
|
+
hideLabel = false
|
|
4137
|
+
} = _B, restOfProps = __objRest(_B, [
|
|
4138
|
+
"tableColumn",
|
|
4139
|
+
"label",
|
|
4140
|
+
"required",
|
|
4141
|
+
"value",
|
|
4142
|
+
"onChange",
|
|
4143
|
+
"hideLabel"
|
|
4144
|
+
]);
|
|
4145
|
+
const handle = useRef({
|
|
4146
|
+
validity: {
|
|
4147
|
+
valueMissing: required === true && value.length === 0,
|
|
4148
|
+
typeMismatch: false
|
|
4149
|
+
}
|
|
4150
|
+
});
|
|
4151
|
+
useImperativeHandle(ref, () => handle.current, []);
|
|
4152
|
+
function handleChange(event) {
|
|
4153
|
+
handle.current.validity.valueMissing = required === true && !event.currentTarget.checked && value.filter((v) => v !== event.currentTarget.value).length === 0;
|
|
4154
|
+
onChange(event);
|
|
4155
|
+
}
|
|
4156
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4157
|
+
children: [!hideLabel && /* @__PURE__ */ jsx(MainLabel, {
|
|
4158
|
+
children: label
|
|
4159
|
+
}), tableColumn.options.map((option) => /* @__PURE__ */ jsxs(StyledLabel$1, {
|
|
4160
|
+
htmlFor: option.id,
|
|
4161
|
+
children: [/* @__PURE__ */ jsx(CheckboxContainer, {
|
|
4162
|
+
children: /* @__PURE__ */ jsx(Checkbox, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4163
|
+
"aria-label": label,
|
|
4164
|
+
onChange: handleChange,
|
|
4165
|
+
checked: value.includes(option.name),
|
|
4166
|
+
id: option.id,
|
|
4167
|
+
value: option.name
|
|
4168
|
+
}))
|
|
4169
|
+
}), option.name]
|
|
4170
|
+
}, option.id))]
|
|
4171
|
+
});
|
|
4172
|
+
});
|
|
4173
|
+
function getCheckmarkColor({
|
|
4174
|
+
swatch: {
|
|
4175
|
+
hue: h,
|
|
4176
|
+
saturation: s,
|
|
4177
|
+
lightness: l
|
|
4178
|
+
} = {
|
|
4179
|
+
hue: 0,
|
|
4180
|
+
saturation: 0,
|
|
4181
|
+
lightness: 0
|
|
4182
|
+
},
|
|
4183
|
+
alpha: a
|
|
4184
|
+
}) {
|
|
4185
|
+
return ColorHelper({
|
|
4186
|
+
h,
|
|
4187
|
+
s,
|
|
4188
|
+
l
|
|
4189
|
+
}).alpha(a).isLight() ? "rgba(0, 0, 0, 0.7)" : "rgba(255, 255, 255, 0.95)";
|
|
4190
|
+
}
|
|
4191
|
+
const Container$5 = styled.div`
|
|
4192
|
+
position: relative;
|
|
4193
|
+
${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => css`
|
|
4194
|
+
height: ${getSizeHeight(size)}px;
|
|
4195
|
+
width: ${getSizeHeight(size)}px;
|
|
4196
|
+
`)}
|
|
4197
|
+
`;
|
|
4198
|
+
const FakeRadioButton = styled.div`
|
|
4199
|
+
position: absolute;
|
|
4200
|
+
width: 100%;
|
|
4201
|
+
height: 100%;
|
|
4202
|
+
border-style: solid;
|
|
4203
|
+
border-radius: 50%;
|
|
4204
|
+
pointer-events: none;
|
|
4205
|
+
border-width: 1px;
|
|
4206
|
+
${(props) => cssMediaRules([props.contrast], ([contrast = Contrasts.LIGHT]) => css`
|
|
4207
|
+
border-color: ${getContrastBorderColor(contrast, props.error)};
|
|
4208
|
+
background-color: ${getContrastBackgroundColor(contrast)};
|
|
4209
|
+
`)}
|
|
4210
|
+
`;
|
|
4211
|
+
const HiddenRadioButton = styled.input.attrs({
|
|
4212
|
+
type: "radio"
|
|
4213
|
+
})`
|
|
4214
|
+
position: absolute;
|
|
4215
|
+
opacity: 0;
|
|
4216
|
+
width: 100%;
|
|
4217
|
+
height: 100%;
|
|
4218
|
+
cursor: pointer;
|
|
4219
|
+
|
|
4220
|
+
&:disabled {
|
|
4221
|
+
cursor: no-drop;
|
|
4222
|
+
|
|
4223
|
+
& ~ ${FakeRadioButton} {
|
|
4224
|
+
opacity: 0.5;
|
|
4225
|
+
}
|
|
4226
|
+
}
|
|
4227
|
+
|
|
4228
|
+
&:checked ~ ${FakeRadioButton} {
|
|
4229
|
+
${(props) => cssMediaRules([props.brandColor], ([brandColor = {
|
|
4230
|
+
swatch: {
|
|
4231
|
+
hue: 0,
|
|
4232
|
+
saturation: 0,
|
|
4233
|
+
lightness: 0
|
|
4234
|
+
},
|
|
4235
|
+
alpha: 1
|
|
4236
|
+
}]) => css`
|
|
4237
|
+
background-color: ${colorToString(brandColor)};
|
|
4238
|
+
`)}
|
|
4239
|
+
border-color: transparent;
|
|
4240
|
+
|
|
4241
|
+
&::after {
|
|
4242
|
+
content: '';
|
|
4243
|
+
position: absolute;
|
|
4244
|
+
box-sizing: content-box;
|
|
4245
|
+
top: 50%;
|
|
4246
|
+
left: 50%;
|
|
4247
|
+
width: 50%;
|
|
4248
|
+
height: 50%;
|
|
4249
|
+
border-radius: 50%;
|
|
4250
|
+
transform: translate(-50%, -50%);
|
|
4251
|
+
${(props) => cssMediaRules([props.brandColor], ([brandColor = {
|
|
4252
|
+
swatch: {
|
|
4253
|
+
hue: 0,
|
|
4254
|
+
saturation: 0,
|
|
4255
|
+
lightness: 0
|
|
4256
|
+
},
|
|
4257
|
+
alpha: 1
|
|
4258
|
+
}]) => css`
|
|
4259
|
+
background-color: ${getCheckmarkColor(brandColor)};
|
|
4260
|
+
`)}
|
|
4261
|
+
}
|
|
4262
|
+
}
|
|
4263
|
+
|
|
4264
|
+
&:not(:disabled) {
|
|
4265
|
+
&:focus ~ ${FakeRadioButton} {
|
|
4266
|
+
${(props) => cssMediaRules([props.brandColor], ([brandColor = {
|
|
4267
|
+
swatch: {
|
|
4268
|
+
hue: 0,
|
|
4269
|
+
saturation: 0,
|
|
4270
|
+
lightness: 0
|
|
4271
|
+
},
|
|
4272
|
+
alpha: 1
|
|
4273
|
+
}]) => css`
|
|
4274
|
+
border-color: ${colorToString(brandColor)};
|
|
4275
|
+
`)}
|
|
4276
|
+
}
|
|
4277
|
+
}
|
|
4278
|
+
|
|
4279
|
+
&:not(:disabled):checked {
|
|
4280
|
+
&:focus ~ ${FakeRadioButton} {
|
|
4281
|
+
${(props) => cssMediaRules([props.contrast], ([contrast = Contrasts.LIGHT]) => css`
|
|
4282
|
+
border-color: ${getContrastBorderColor(contrast, props.error)};
|
|
4283
|
+
`)}
|
|
4284
|
+
}
|
|
4285
|
+
}
|
|
4286
|
+
`;
|
|
4287
|
+
var RadioButton = forwardRef(function RadioButton2(_C, ref) {
|
|
4288
|
+
var _D = _C, {
|
|
4289
|
+
error,
|
|
4290
|
+
className,
|
|
4291
|
+
style,
|
|
4292
|
+
form
|
|
4293
|
+
} = _D, restOfProps = __objRest(_D, [
|
|
4294
|
+
"error",
|
|
4295
|
+
"className",
|
|
4296
|
+
"style",
|
|
4297
|
+
"form"
|
|
4298
|
+
]);
|
|
4299
|
+
const {
|
|
4300
|
+
size,
|
|
4301
|
+
contrast,
|
|
4302
|
+
brandColor
|
|
4303
|
+
} = useFormContext();
|
|
4304
|
+
return /* @__PURE__ */ jsxs(Container$5, {
|
|
4305
|
+
size,
|
|
4306
|
+
children: [/* @__PURE__ */ jsx(HiddenRadioButton, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4307
|
+
ref,
|
|
4308
|
+
error,
|
|
4309
|
+
contrast,
|
|
4310
|
+
brandColor
|
|
4311
|
+
})), /* @__PURE__ */ jsx(FakeRadioButton, {
|
|
4312
|
+
className,
|
|
4313
|
+
error,
|
|
4314
|
+
contrast,
|
|
4315
|
+
style
|
|
4316
|
+
})]
|
|
4317
|
+
});
|
|
4318
|
+
});
|
|
4319
|
+
const StyledLabel = styled(Label$1)`
|
|
4320
|
+
display: flex;
|
|
4321
|
+
align-items: center;
|
|
4322
|
+
margin: 8px 0;
|
|
4323
|
+
|
|
4324
|
+
&:last-of-type {
|
|
4325
|
+
margin-bottom: 0;
|
|
4326
|
+
}
|
|
4327
|
+
`;
|
|
4328
|
+
const RadioButtonContainer = styled.span`
|
|
4329
|
+
margin-right: 8px;
|
|
4330
|
+
`;
|
|
4331
|
+
var TableColumnRadioButtonGroup = forwardRef(function TableColumnRadioButtonGroup2(_E, ref) {
|
|
4332
|
+
var _F = _E, {
|
|
4333
|
+
tableColumn,
|
|
4334
|
+
label = "",
|
|
4335
|
+
value = "",
|
|
4336
|
+
required = false,
|
|
4337
|
+
hideLabel = false,
|
|
4338
|
+
onChange
|
|
4339
|
+
} = _F, restOfProps = __objRest(_F, [
|
|
4340
|
+
"tableColumn",
|
|
4341
|
+
"label",
|
|
4342
|
+
"value",
|
|
4343
|
+
"required",
|
|
4344
|
+
"hideLabel",
|
|
4345
|
+
"onChange"
|
|
4346
|
+
]);
|
|
4347
|
+
const handle = useRef({
|
|
4348
|
+
validity: {
|
|
4349
|
+
valueMissing: required === true && value === "",
|
|
4350
|
+
typeMismatch: false
|
|
4351
|
+
}
|
|
4352
|
+
});
|
|
4353
|
+
useImperativeHandle(ref, () => handle.current, []);
|
|
4354
|
+
function handleChange(event) {
|
|
4355
|
+
handle.current.validity.valueMissing = required === true && !event.currentTarget.checked;
|
|
4356
|
+
onChange(event);
|
|
4357
|
+
}
|
|
4358
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4359
|
+
children: [!hideLabel && /* @__PURE__ */ jsx(Label$1, {
|
|
4360
|
+
as: "p",
|
|
4361
|
+
children: label
|
|
4362
|
+
}), tableColumn.options.map((option) => /* @__PURE__ */ jsxs(StyledLabel, {
|
|
4363
|
+
htmlFor: option.id,
|
|
4364
|
+
"aria-label": label,
|
|
4365
|
+
children: [/* @__PURE__ */ jsx(RadioButtonContainer, {
|
|
4366
|
+
children: /* @__PURE__ */ jsx(RadioButton, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4367
|
+
onChange: handleChange,
|
|
4368
|
+
checked: value === option.name,
|
|
4369
|
+
id: option.id,
|
|
4370
|
+
value: option.name
|
|
4371
|
+
}))
|
|
4372
|
+
}), option.name]
|
|
4373
|
+
}, option.id))]
|
|
4374
|
+
});
|
|
4375
|
+
});
|
|
4376
|
+
const Container$4 = styled.div`
|
|
4377
|
+
${cssField()}
|
|
4378
|
+
display: flex;
|
|
4379
|
+
align-items: center;
|
|
4380
|
+
position: relative;
|
|
4381
|
+
user-select: none;
|
|
4382
|
+
border-color: #f19eb9;
|
|
4383
|
+
|
|
4384
|
+
&:focus,
|
|
4385
|
+
&:focus-within {
|
|
4386
|
+
border-color: #e54e7f;
|
|
4387
|
+
}
|
|
4388
|
+
|
|
4389
|
+
${(props) => cssMediaRules([props.size, props.contrast], ([size = Sizes.MEDIUM, contrast = Contrasts.LIGHT]) => css`
|
|
4390
|
+
min-height: ${getSizeHeight$2(size)}px;
|
|
4391
|
+
max-height: ${getSizeHeight$2(size)}px;
|
|
4392
|
+
|
|
4393
|
+
&::after {
|
|
4394
|
+
content: '';
|
|
4395
|
+
position: absolute;
|
|
4396
|
+
right: ${getSizeHorizontalPadding(size)}px;
|
|
4397
|
+
top: 50%;
|
|
4398
|
+
transform: translate3d(0, -25%, 0);
|
|
4399
|
+
border: solid 0.35em transparent;
|
|
4400
|
+
border-top-color: ${getContrastColor$1(contrast)};
|
|
4401
|
+
}
|
|
4402
|
+
`)}
|
|
4403
|
+
`;
|
|
4404
|
+
const Select = styled.select`
|
|
4405
|
+
appearance: none;
|
|
4406
|
+
position: absolute;
|
|
4407
|
+
top: 0;
|
|
4408
|
+
left: 0;
|
|
4409
|
+
opacity: 0;
|
|
4410
|
+
width: 100%;
|
|
4411
|
+
height: 100%;
|
|
4412
|
+
`;
|
|
4413
|
+
var TableColumnSingleSelect = forwardRef(function TableColumnSingleSelect2(_G, ref) {
|
|
4414
|
+
var _H = _G, {
|
|
4415
|
+
id,
|
|
4416
|
+
tableColumn,
|
|
4417
|
+
value = "",
|
|
4418
|
+
label = "",
|
|
4419
|
+
error = false,
|
|
4420
|
+
hideLabel = false,
|
|
4421
|
+
form
|
|
4422
|
+
} = _H, restOfProps = __objRest(_H, [
|
|
4423
|
+
"id",
|
|
4424
|
+
"tableColumn",
|
|
4425
|
+
"value",
|
|
4426
|
+
"label",
|
|
4427
|
+
"error",
|
|
4428
|
+
"hideLabel",
|
|
4429
|
+
"form"
|
|
4430
|
+
]);
|
|
4431
|
+
const {
|
|
4432
|
+
shape,
|
|
4433
|
+
size,
|
|
4434
|
+
contrast,
|
|
4435
|
+
brandColor
|
|
4436
|
+
} = useFormContext();
|
|
4437
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
4438
|
+
children: [!hideLabel && /* @__PURE__ */ jsx(Label$1, {
|
|
4439
|
+
htmlFor: id,
|
|
4440
|
+
children: label
|
|
4441
|
+
}), /* @__PURE__ */ jsxs(Container$4, {
|
|
4442
|
+
error,
|
|
4443
|
+
shape,
|
|
4444
|
+
size,
|
|
4445
|
+
contrast,
|
|
4446
|
+
brandColor,
|
|
4447
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
4448
|
+
children: value === "" ? "-" : value
|
|
4449
|
+
}), /* @__PURE__ */ jsxs(Select, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4450
|
+
"aria-label": label,
|
|
4451
|
+
ref,
|
|
4452
|
+
id,
|
|
4453
|
+
value,
|
|
4454
|
+
children: [/* @__PURE__ */ jsx("option", {
|
|
4455
|
+
value: "",
|
|
4456
|
+
children: "-"
|
|
4457
|
+
}), tableColumn.options.map((option) => /* @__PURE__ */ jsx("option", {
|
|
4458
|
+
value: option.name,
|
|
4459
|
+
children: option.name
|
|
4460
|
+
}, option.id))]
|
|
4461
|
+
}))]
|
|
4462
|
+
})]
|
|
4463
|
+
});
|
|
4464
|
+
});
|
|
4465
|
+
var SingleSelectTableField = forwardRef(function SingleSelectTableField2(_I, ref) {
|
|
4466
|
+
var _J = _I, {
|
|
4467
|
+
type
|
|
4468
|
+
} = _J, restOfProps = __objRest(_J, [
|
|
4469
|
+
"type"
|
|
4470
|
+
]);
|
|
4471
|
+
return type === "select" ? /* @__PURE__ */ jsx(TableColumnSingleSelect, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4472
|
+
ref
|
|
4473
|
+
})) : /* @__PURE__ */ jsx(TableColumnRadioButtonGroup, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4474
|
+
ref
|
|
4475
|
+
}));
|
|
4476
|
+
});
|
|
4477
|
+
var PhoneNumberTableField = forwardRef(function PhoneNumberTableField2(_K, ref) {
|
|
4478
|
+
var _L = _K, {
|
|
4479
|
+
id,
|
|
4480
|
+
label = "",
|
|
4481
|
+
name,
|
|
4482
|
+
error,
|
|
4483
|
+
hideLabel = false
|
|
4484
|
+
} = _L, restOfProps = __objRest(_L, [
|
|
4485
|
+
"id",
|
|
4486
|
+
"label",
|
|
4487
|
+
"name",
|
|
4488
|
+
"error",
|
|
4489
|
+
"hideLabel"
|
|
4490
|
+
]);
|
|
4491
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
4492
|
+
children: [!hideLabel && /* @__PURE__ */ jsx(Label$1, {
|
|
4493
|
+
htmlFor: id,
|
|
4494
|
+
children: label
|
|
4495
|
+
}), /* @__PURE__ */ jsx(Input$2, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4496
|
+
"aria-label": label,
|
|
4497
|
+
ref,
|
|
4498
|
+
id,
|
|
4499
|
+
name,
|
|
4500
|
+
type: "tel",
|
|
4501
|
+
error: error != null
|
|
4502
|
+
}))]
|
|
4503
|
+
});
|
|
4504
|
+
});
|
|
4505
|
+
var EmailTableField = forwardRef(function EmailTableField2(_M, ref) {
|
|
4506
|
+
var _N = _M, {
|
|
4507
|
+
id,
|
|
4508
|
+
label = "",
|
|
4509
|
+
name,
|
|
4510
|
+
error,
|
|
4511
|
+
hideLabel = false
|
|
4512
|
+
} = _N, restOfProps = __objRest(_N, [
|
|
4513
|
+
"id",
|
|
4514
|
+
"label",
|
|
4515
|
+
"name",
|
|
4516
|
+
"error",
|
|
4517
|
+
"hideLabel"
|
|
4518
|
+
]);
|
|
4519
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
4520
|
+
children: [!hideLabel && /* @__PURE__ */ jsx(Label$1, {
|
|
4521
|
+
htmlFor: id,
|
|
4522
|
+
children: label
|
|
4523
|
+
}), /* @__PURE__ */ jsx(Input$2, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4524
|
+
"aria-label": label,
|
|
4525
|
+
ref,
|
|
4526
|
+
id,
|
|
4527
|
+
name,
|
|
4528
|
+
type: "email",
|
|
4529
|
+
error: error != null
|
|
4530
|
+
}))]
|
|
4531
|
+
});
|
|
4532
|
+
});
|
|
4533
|
+
var URLTableField = forwardRef(function URLTableField2(_O, ref) {
|
|
4534
|
+
var _P = _O, {
|
|
4535
|
+
id,
|
|
4536
|
+
label = "",
|
|
4537
|
+
name,
|
|
4538
|
+
error,
|
|
4539
|
+
hideLabel = false
|
|
4540
|
+
} = _P, restOfProps = __objRest(_P, [
|
|
4541
|
+
"id",
|
|
4542
|
+
"label",
|
|
4543
|
+
"name",
|
|
4544
|
+
"error",
|
|
4545
|
+
"hideLabel"
|
|
4546
|
+
]);
|
|
4547
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
4548
|
+
children: [!hideLabel && /* @__PURE__ */ jsx(Label$1, {
|
|
4549
|
+
htmlFor: id,
|
|
4550
|
+
children: label
|
|
4551
|
+
}), /* @__PURE__ */ jsx(Input$2, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4552
|
+
"aria-label": label,
|
|
4553
|
+
ref,
|
|
4554
|
+
id,
|
|
4555
|
+
name,
|
|
4556
|
+
type: "url",
|
|
4557
|
+
error: error != null
|
|
4558
|
+
}))]
|
|
4559
|
+
});
|
|
4560
|
+
});
|
|
4561
|
+
var NumberTableField = forwardRef(function NumberTableField2(_Q, ref) {
|
|
4562
|
+
var _R = _Q, {
|
|
4563
|
+
id,
|
|
4564
|
+
label = "",
|
|
4565
|
+
name,
|
|
4566
|
+
error,
|
|
4567
|
+
hideLabel = false
|
|
4568
|
+
} = _R, restOfProps = __objRest(_R, [
|
|
4569
|
+
"id",
|
|
4570
|
+
"label",
|
|
4571
|
+
"name",
|
|
4572
|
+
"error",
|
|
4573
|
+
"hideLabel"
|
|
4574
|
+
]);
|
|
4575
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
4576
|
+
children: [!hideLabel && /* @__PURE__ */ jsx(Label$1, {
|
|
4577
|
+
htmlFor: id,
|
|
4578
|
+
children: label
|
|
4579
|
+
}), /* @__PURE__ */ jsx(Input$2, __spreadProps(__spreadValues({}, restOfProps), {
|
|
4580
|
+
"aria-label": label,
|
|
4581
|
+
ref,
|
|
4582
|
+
id,
|
|
4583
|
+
name,
|
|
4584
|
+
type: "number",
|
|
4585
|
+
error: error != null
|
|
4586
|
+
}))]
|
|
4587
|
+
});
|
|
4588
|
+
});
|
|
4589
|
+
const Label = styled.div`
|
|
4590
|
+
display: block;
|
|
4591
|
+
max-width: 120px;
|
|
4592
|
+
min-width: 60px;
|
|
4593
|
+
border-radius: 2px;
|
|
4594
|
+
background-color: #5f49f4;
|
|
4595
|
+
opacity: 0.4;
|
|
4596
|
+
${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => css`
|
|
4597
|
+
margin: calc(0.25 * ${getSizeHeight(size)}px + 2px) 0;
|
|
4598
|
+
min-height: ${0.5 * getSizeHeight(size)}px;
|
|
4599
|
+
max-height: ${0.5 * getSizeHeight(size)}px;
|
|
4600
|
+
`)}
|
|
4601
|
+
`;
|
|
4602
|
+
const Input2 = styled.div`
|
|
4603
|
+
display: block;
|
|
4604
|
+
width: 100%;
|
|
4605
|
+
border-width: 2px;
|
|
4606
|
+
border-style: solid;
|
|
4607
|
+
border-color: #5f49f4;
|
|
4608
|
+
opacity: 0.4;
|
|
4609
|
+
${(props) => cssMediaRules([props.shape, props.size], ([shape = Shapes.ROUNDED, size = Sizes.MEDIUM]) => css`
|
|
4610
|
+
min-height: ${getSizeHeight$1(size)}px;
|
|
4611
|
+
max-height: ${getSizeHeight$1(size)}px;
|
|
4612
|
+
border-radius: ${getShapeBorderRadius(shape)}px;
|
|
4613
|
+
`)}
|
|
4614
|
+
`;
|
|
4615
|
+
function PlaceholderTableField() {
|
|
4616
|
+
const {
|
|
4617
|
+
size,
|
|
4618
|
+
shape
|
|
4619
|
+
} = useFormContext();
|
|
4620
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
4621
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
4622
|
+
size
|
|
4623
|
+
}), /* @__PURE__ */ jsx(Input2, {
|
|
4624
|
+
shape,
|
|
4625
|
+
size
|
|
4626
|
+
})]
|
|
4627
|
+
});
|
|
4628
|
+
}
|
|
4629
|
+
function getTypeMismatchErrorMessage(tableColumn, label) {
|
|
4630
|
+
switch ((tableColumn || {}).__typename) {
|
|
4631
|
+
case "PhoneNumberTableColumn":
|
|
4632
|
+
return `${label} field must be a valid phone number.`;
|
|
4633
|
+
case "EmailTableColumn":
|
|
4634
|
+
return `${label} field must be a valid email.`;
|
|
4635
|
+
case "URLTableColumn":
|
|
4636
|
+
return `${label} field must be a valid URL.`;
|
|
4637
|
+
case "NumberTableColumn":
|
|
4638
|
+
return `${label} field must be a valid number.`;
|
|
4639
|
+
case "SingleLineTextTableColumn":
|
|
4640
|
+
case "LongTextTableColumn":
|
|
4641
|
+
case "CheckboxTableColumn":
|
|
4642
|
+
default:
|
|
4643
|
+
return `${label} field is invalid.`;
|
|
4644
|
+
}
|
|
4645
|
+
}
|
|
4646
|
+
function getTableColumnField(tableColumn) {
|
|
4647
|
+
switch ((tableColumn || {}).__typename) {
|
|
4648
|
+
case "SingleLineTextTableColumn":
|
|
4649
|
+
return SingleLineTextTableField;
|
|
4650
|
+
case "LongTextTableColumn":
|
|
4651
|
+
return LongTextTableField;
|
|
4652
|
+
case "CheckboxTableColumn":
|
|
4653
|
+
return CheckboxTableField;
|
|
4654
|
+
case "MultipleSelectTableColumn":
|
|
4655
|
+
return MultipleSelectTableField;
|
|
4656
|
+
case "SingleSelectTableColumn":
|
|
4657
|
+
return SingleSelectTableField;
|
|
4658
|
+
case "PhoneNumberTableColumn":
|
|
4659
|
+
return PhoneNumberTableField;
|
|
4660
|
+
case "EmailTableColumn":
|
|
4661
|
+
return EmailTableField;
|
|
4662
|
+
case "URLTableColumn":
|
|
4663
|
+
return URLTableField;
|
|
4664
|
+
case "NumberTableColumn":
|
|
4665
|
+
return NumberTableField;
|
|
4666
|
+
default:
|
|
4667
|
+
return SingleLineTextTableField;
|
|
4668
|
+
}
|
|
4669
|
+
}
|
|
4670
|
+
function Field({
|
|
4671
|
+
tableColumn,
|
|
4672
|
+
tableFormField: {
|
|
4673
|
+
id,
|
|
4674
|
+
label = "",
|
|
4675
|
+
placeholder: placeholder2,
|
|
4676
|
+
required = false,
|
|
4677
|
+
hidden = false,
|
|
4678
|
+
type = "radio",
|
|
4679
|
+
hideLabel = false
|
|
4680
|
+
}
|
|
4681
|
+
}) {
|
|
4682
|
+
const TableColumnField = getTableColumnField(tableColumn);
|
|
4683
|
+
const input = useRef(null);
|
|
4684
|
+
if (!tableColumn)
|
|
4685
|
+
return /* @__PURE__ */ jsx(PlaceholderTableField, {});
|
|
4686
|
+
function validate() {
|
|
4687
|
+
let errorMessage;
|
|
4688
|
+
if (input.current) {
|
|
4689
|
+
const {
|
|
4690
|
+
validity = {}
|
|
4691
|
+
} = input.current;
|
|
4692
|
+
if (validity.valueMissing)
|
|
4693
|
+
errorMessage = `${label} is required.`;
|
|
4694
|
+
if (validity.typeMismatch)
|
|
4695
|
+
errorMessage = getTypeMismatchErrorMessage(tableColumn, label);
|
|
4696
|
+
}
|
|
4697
|
+
return errorMessage;
|
|
4698
|
+
}
|
|
4699
|
+
return /* @__PURE__ */ jsx(Field$1, {
|
|
4700
|
+
name: tableColumn.name,
|
|
4701
|
+
validate,
|
|
4702
|
+
children: ({
|
|
4703
|
+
field,
|
|
4704
|
+
form
|
|
4705
|
+
}) => hidden ? /* @__PURE__ */ jsx("input", __spreadProps(__spreadValues({}, field), {
|
|
4706
|
+
ref: input,
|
|
4707
|
+
type: "hidden"
|
|
4708
|
+
})) : /* @__PURE__ */ jsx(TableColumnField, __spreadProps(__spreadValues({}, field), {
|
|
4709
|
+
type,
|
|
4710
|
+
form,
|
|
4711
|
+
tableColumn,
|
|
4712
|
+
ref: input,
|
|
4713
|
+
id,
|
|
4714
|
+
error: getIn(form.touched, field.name) && getIn(form.errors, field.name),
|
|
4715
|
+
label,
|
|
4716
|
+
placeholder: placeholder2,
|
|
4717
|
+
required,
|
|
4718
|
+
hideLabel
|
|
4719
|
+
}))
|
|
4720
|
+
});
|
|
4721
|
+
}
|
|
4722
|
+
var _g;
|
|
4723
|
+
function _extends$s() {
|
|
4724
|
+
_extends$s = Object.assign || function(target) {
|
|
4725
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
4726
|
+
var source = arguments[i];
|
|
4727
|
+
for (var key in source) {
|
|
4728
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
4729
|
+
target[key] = source[key];
|
|
4730
|
+
}
|
|
4731
|
+
}
|
|
4732
|
+
}
|
|
4733
|
+
return target;
|
|
4734
|
+
};
|
|
4735
|
+
return _extends$s.apply(this, arguments);
|
|
4736
|
+
}
|
|
4737
|
+
var SvgSpinner20 = function SvgSpinner202(props) {
|
|
4738
|
+
return /* @__PURE__ */ React.createElement("svg", _extends$s({
|
|
4739
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4740
|
+
width: 20,
|
|
4741
|
+
height: 20
|
|
4742
|
+
}, props), _g || (_g = /* @__PURE__ */ React.createElement("g", {
|
|
4743
|
+
fill: "none",
|
|
4744
|
+
strokeWidth: 2,
|
|
4745
|
+
transform: "translate(1 1)"
|
|
4746
|
+
}, /* @__PURE__ */ React.createElement("circle", {
|
|
4747
|
+
stroke: "currentColor",
|
|
4748
|
+
cx: 9,
|
|
4749
|
+
cy: 9,
|
|
4750
|
+
r: 9,
|
|
4751
|
+
strokeOpacity: 0.4
|
|
4752
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
4753
|
+
d: "M9 18A9 9 0 0 0 9 0"
|
|
4754
|
+
}))));
|
|
4755
|
+
};
|
|
4756
|
+
const spin = keyframes`
|
|
4757
|
+
from {
|
|
4758
|
+
transform: rotate(0deg);
|
|
4759
|
+
}
|
|
4760
|
+
to {
|
|
4761
|
+
transform: rotate(360deg);
|
|
4762
|
+
}
|
|
4763
|
+
`;
|
|
4764
|
+
const Icon = styled(SvgSpinner20)`
|
|
4765
|
+
display: inline-flex;
|
|
4766
|
+
animation: ${spin} 1s linear infinite;
|
|
4767
|
+
stroke: currentColor;
|
|
4768
|
+
`;
|
|
4769
|
+
function Spinner() {
|
|
4770
|
+
return /* @__PURE__ */ jsx(Icon, {});
|
|
4771
|
+
}
|
|
4772
|
+
function useTableFormFieldRefs(propController, { fieldsCount }) {
|
|
4773
|
+
const [container, setContainer] = useState(null);
|
|
4774
|
+
const [items, setItems] = useState(Array(fieldsCount + 1).fill(null));
|
|
4775
|
+
const isInBuilder = useIsInBuilder();
|
|
4776
|
+
useEffect(() => {
|
|
4777
|
+
if (!isInBuilder)
|
|
4778
|
+
return;
|
|
4779
|
+
let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest);
|
|
4780
|
+
return () => {
|
|
4781
|
+
cancelAnimationFrame(animationFrameHandle);
|
|
4782
|
+
};
|
|
4783
|
+
function handleAnimationFrameRequest() {
|
|
4784
|
+
if (propController == null)
|
|
4785
|
+
return;
|
|
4786
|
+
if (container != null)
|
|
4787
|
+
propController.tableFormLayoutChange({ layout: getBox(container) });
|
|
4788
|
+
items.map((item, index) => {
|
|
4789
|
+
if (item == null)
|
|
4790
|
+
return;
|
|
4791
|
+
propController.tableFormFieldLayoutChange({ index, layout: getBox(item) });
|
|
4792
|
+
});
|
|
4793
|
+
animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest);
|
|
4794
|
+
}
|
|
4795
|
+
}, [propController, container, items, isInBuilder]);
|
|
4796
|
+
const itemRefs = useMemo(() => Array.from({ length: fieldsCount + 1 }).map((_, index) => (item) => {
|
|
4797
|
+
setItems((is) => [...is.slice(0, index), item, ...is.slice(index + 1)]);
|
|
4798
|
+
}), [fieldsCount, setItems]);
|
|
4799
|
+
return { container: setContainer, items: itemRefs };
|
|
4800
|
+
}
|
|
4801
|
+
const LOCAL_STORAGE_NAMESPACE = "@@makeswift/components/form";
|
|
4802
|
+
function getSizeFontSize(size) {
|
|
4803
|
+
switch (size) {
|
|
4804
|
+
case Sizes.SMALL:
|
|
4805
|
+
return 12;
|
|
4806
|
+
case Sizes.MEDIUM:
|
|
4807
|
+
return 14;
|
|
4808
|
+
case Sizes.LARGE:
|
|
4809
|
+
return 18;
|
|
4810
|
+
default:
|
|
4811
|
+
throw new Error(`Invalid form size "${size}"`);
|
|
4812
|
+
}
|
|
4813
|
+
}
|
|
4814
|
+
const Alignments = {
|
|
4815
|
+
LEFT: "left",
|
|
4816
|
+
CENTER: "center",
|
|
4817
|
+
RIGHT: "right"
|
|
4818
|
+
};
|
|
4819
|
+
const GridForm = styled.form`
|
|
4820
|
+
display: flex;
|
|
4821
|
+
flex-wrap: wrap;
|
|
4822
|
+
width: 100%;
|
|
4823
|
+
${(props) => cssMediaRules([props.size], ([size = Sizes.MEDIUM]) => css`
|
|
4824
|
+
font-size: ${getSizeFontSize(size)}px;
|
|
4825
|
+
`)}
|
|
4826
|
+
${cssWidth()}
|
|
4827
|
+
${cssMargin()}
|
|
4828
|
+
`;
|
|
4829
|
+
const GridItem$1 = styled.div`
|
|
4830
|
+
align-self: flex-end;
|
|
4831
|
+
flex-direction: column;
|
|
4832
|
+
${cssGridItem()}
|
|
4833
|
+
`;
|
|
4834
|
+
function getAlignmentMargin(alignment) {
|
|
4835
|
+
switch (alignment) {
|
|
4836
|
+
case Alignments.LEFT:
|
|
4837
|
+
return "0 auto 0 0";
|
|
4838
|
+
case Alignments.RIGHT:
|
|
4839
|
+
return "0 0 0 auto";
|
|
4840
|
+
default:
|
|
4841
|
+
return "0 auto";
|
|
4842
|
+
}
|
|
4843
|
+
}
|
|
4844
|
+
const StyledButton = styled((props) => /* @__PURE__ */ jsx(Button$1, __spreadProps(__spreadValues({}, props), {
|
|
4845
|
+
as: "button"
|
|
4846
|
+
})))`
|
|
4847
|
+
display: flex;
|
|
4848
|
+
align-items: center;
|
|
4849
|
+
justify-content: center;
|
|
4850
|
+
${(props) => cssMediaRules([props.size, props.alignment], ([size = Sizes.MEDIUM, alignment = Alignments.CENTER]) => css`
|
|
4851
|
+
min-height: ${getSizeHeight$1(size)}px;
|
|
4852
|
+
max-height: ${getSizeHeight$1(size)}px;
|
|
4853
|
+
margin: ${getAlignmentMargin(alignment)};
|
|
4854
|
+
padding-top: 0;
|
|
4855
|
+
padding-bottom: 0;
|
|
4856
|
+
`)}
|
|
4857
|
+
`;
|
|
4858
|
+
const ErrorContainer = styled.div`
|
|
4859
|
+
padding: 8px 16px;
|
|
4860
|
+
background-color: #f19eb9;
|
|
4861
|
+
border-radius: 4px;
|
|
4862
|
+
margin-top: 16px;
|
|
4863
|
+
`;
|
|
4864
|
+
const IconContainer = styled.div`
|
|
4865
|
+
fill: currentColor;
|
|
4866
|
+
`;
|
|
4867
|
+
const ErrorMessage = styled.p`
|
|
4868
|
+
font-size: 12px;
|
|
4869
|
+
margin: 8px 0;
|
|
4870
|
+
color: rgba(127, 0, 0, 0.95);
|
|
4871
|
+
`;
|
|
4872
|
+
function getTableColumnDefaultValue(tableColumn) {
|
|
4873
|
+
switch (tableColumn.__typename) {
|
|
4874
|
+
case "CheckboxTableColumn":
|
|
4875
|
+
return false;
|
|
4876
|
+
case "MultipleSelectTableColumn":
|
|
4877
|
+
return [];
|
|
4878
|
+
case "SingleLineTextTableColumn":
|
|
4879
|
+
case "LongTextTableColumn":
|
|
4880
|
+
case "SingleSelectTableColumn":
|
|
4881
|
+
case "PhoneNumberTableColumn":
|
|
4882
|
+
case "EmailTableColumn":
|
|
4883
|
+
case "URLTableColumn":
|
|
4884
|
+
case "NumberTableColumn":
|
|
4885
|
+
default:
|
|
4886
|
+
return "";
|
|
4887
|
+
}
|
|
4888
|
+
}
|
|
4889
|
+
const CREATE_TABLE_RECORD = gql`
|
|
4890
|
+
mutation CreateTableRecord($input: CreateTableRecordInput!) {
|
|
4891
|
+
createTableRecord(input: $input) {
|
|
4892
|
+
tableRecord {
|
|
4893
|
+
id
|
|
4894
|
+
}
|
|
4895
|
+
}
|
|
4896
|
+
}
|
|
4897
|
+
`;
|
|
4898
|
+
const Form = forwardRef(function Form2({
|
|
4899
|
+
id,
|
|
4900
|
+
tableId,
|
|
4901
|
+
fields: fieldsProp,
|
|
4902
|
+
submitLabel = "Submit",
|
|
4903
|
+
submitLink,
|
|
4904
|
+
shape,
|
|
4905
|
+
size,
|
|
4906
|
+
contrast,
|
|
4907
|
+
brandColor,
|
|
4908
|
+
gap,
|
|
4909
|
+
width,
|
|
4910
|
+
margin,
|
|
4911
|
+
submitTextStyle,
|
|
4912
|
+
submitVariant,
|
|
4913
|
+
submitTextColor,
|
|
4914
|
+
submitWidth,
|
|
4915
|
+
submitAlignment,
|
|
4916
|
+
labelTextStyle,
|
|
4917
|
+
labelTextColor
|
|
4918
|
+
}, ref) {
|
|
4919
|
+
const fields = useMemo(() => {
|
|
4920
|
+
var _a;
|
|
4921
|
+
return (_a = fieldsProp == null ? void 0 : fieldsProp.fields) != null ? _a : [];
|
|
4922
|
+
}, [fieldsProp]);
|
|
4923
|
+
const grid = useMemo(() => {
|
|
4924
|
+
var _a;
|
|
4925
|
+
return (_a = fieldsProp == null ? void 0 : fieldsProp.grid) != null ? _a : [];
|
|
4926
|
+
}, [fieldsProp]);
|
|
4927
|
+
const {
|
|
4928
|
+
data: {
|
|
4929
|
+
table
|
|
4930
|
+
} = {}
|
|
4931
|
+
} = useTable(tableId);
|
|
4932
|
+
const [createTableRecord] = useMutation(CREATE_TABLE_RECORD);
|
|
4933
|
+
const [refEl, setRefEl] = useState(null);
|
|
4934
|
+
const [propControllers, setPropControllers] = useState(null);
|
|
4935
|
+
const [initialValues, setInitialValues] = useState(() => fields.reduce((acc, formField) => {
|
|
4936
|
+
const tableColumn = table && table.columns.find((field) => field.id === formField.tableColumnId);
|
|
4937
|
+
const defaultValue = formField ? formField.defaultValue : null;
|
|
4938
|
+
if (tableColumn) {
|
|
4939
|
+
acc[tableColumn.name] = defaultValue == null ? getTableColumnDefaultValue(tableColumn) : defaultValue;
|
|
4940
|
+
}
|
|
4941
|
+
return acc;
|
|
4942
|
+
}, {}));
|
|
4943
|
+
const controller = propControllers == null ? void 0 : propControllers.fields;
|
|
4944
|
+
const {
|
|
4945
|
+
container,
|
|
4946
|
+
items
|
|
4947
|
+
} = useTableFormFieldRefs(controller, {
|
|
4948
|
+
fieldsCount: fields.length
|
|
4949
|
+
});
|
|
4950
|
+
const [isDone, setIsDone] = useState(false);
|
|
4951
|
+
const linkRef = useRef(null);
|
|
4952
|
+
useImperativeHandle(ref, () => ({
|
|
4953
|
+
getBoxModel() {
|
|
4954
|
+
return refEl instanceof Element ? getBox(refEl) : null;
|
|
4955
|
+
},
|
|
4956
|
+
setPropControllers
|
|
4957
|
+
}), [refEl, setPropControllers]);
|
|
4958
|
+
useEffect(() => {
|
|
4959
|
+
container(refEl);
|
|
4960
|
+
}, [container, refEl]);
|
|
4961
|
+
useEffect(() => {
|
|
4962
|
+
if (!isDone)
|
|
4963
|
+
return;
|
|
4964
|
+
let timeoutId = setTimeout(() => setIsDone(false), 2500);
|
|
4965
|
+
return () => clearTimeout(timeoutId);
|
|
4966
|
+
}, [isDone]);
|
|
4967
|
+
function getTableColumn({
|
|
4968
|
+
tableColumnId
|
|
4969
|
+
}) {
|
|
4970
|
+
return table && table.columns.find((field) => tableColumnId === field.id);
|
|
4971
|
+
}
|
|
4972
|
+
async function handleSubmit(values, {
|
|
4973
|
+
setSubmitting,
|
|
4974
|
+
resetForm,
|
|
4975
|
+
setStatus
|
|
4976
|
+
}) {
|
|
4977
|
+
if (table) {
|
|
4978
|
+
const columns = [];
|
|
4979
|
+
fields.forEach((field) => {
|
|
4980
|
+
const tableColumn = getTableColumn(field);
|
|
4981
|
+
if (tableColumn) {
|
|
4982
|
+
const data = values[tableColumn.name];
|
|
4983
|
+
if (data) {
|
|
4984
|
+
columns.push({
|
|
4985
|
+
columnId: field.tableColumnId,
|
|
4986
|
+
data
|
|
4987
|
+
});
|
|
4988
|
+
if (field.autofill) {
|
|
4989
|
+
localStorage.setItem(`${LOCAL_STORAGE_NAMESPACE}/${tableColumn.name}`, JSON.stringify(data));
|
|
4990
|
+
}
|
|
4991
|
+
}
|
|
4992
|
+
}
|
|
4993
|
+
});
|
|
4994
|
+
try {
|
|
4995
|
+
await createTableRecord({
|
|
4996
|
+
variables: {
|
|
4997
|
+
input: {
|
|
4998
|
+
data: {
|
|
4999
|
+
tableId: table.id,
|
|
5000
|
+
columns
|
|
5001
|
+
}
|
|
5002
|
+
}
|
|
5003
|
+
}
|
|
5004
|
+
});
|
|
5005
|
+
setIsDone(true);
|
|
5006
|
+
setInitialValues((prev) => fields.reduce((acc, field) => {
|
|
5007
|
+
const tableColumn = getTableColumn(field);
|
|
5008
|
+
if (tableColumn) {
|
|
5009
|
+
const data = values[tableColumn.name];
|
|
5010
|
+
if (data && field.autofill)
|
|
5011
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
5012
|
+
[tableColumn.name]: data
|
|
5013
|
+
});
|
|
5014
|
+
}
|
|
5015
|
+
return acc;
|
|
5016
|
+
}, __spreadValues({}, prev)));
|
|
5017
|
+
resetForm();
|
|
5018
|
+
if (linkRef.current != null)
|
|
5019
|
+
linkRef.current.click();
|
|
5020
|
+
} catch (error) {
|
|
5021
|
+
setStatus({
|
|
5022
|
+
error: "An unexpected error has occurred, please try again later"
|
|
5023
|
+
});
|
|
5024
|
+
} finally {
|
|
5025
|
+
setSubmitting(false);
|
|
5026
|
+
}
|
|
5027
|
+
}
|
|
5028
|
+
}
|
|
5029
|
+
useEffect(() => {
|
|
5030
|
+
setInitialValues((prev) => fields.reduce((acc, formField) => {
|
|
5031
|
+
const tableColumn = table && table.columns.find((field) => field.id === formField.tableColumnId);
|
|
5032
|
+
if (tableColumn && formField.autofill) {
|
|
5033
|
+
const storedValue = localStorage.getItem(`${LOCAL_STORAGE_NAMESPACE}/${tableColumn.name}`);
|
|
5034
|
+
if (storedValue) {
|
|
5035
|
+
try {
|
|
5036
|
+
acc[tableColumn.name] = JSON.parse(storedValue);
|
|
5037
|
+
} catch (e) {
|
|
5038
|
+
}
|
|
5039
|
+
}
|
|
5040
|
+
}
|
|
5041
|
+
return acc;
|
|
5042
|
+
}, __spreadValues({}, prev)));
|
|
5043
|
+
}, [fields, table]);
|
|
5044
|
+
const brandColorData = useColor(brandColor);
|
|
5045
|
+
return /* @__PURE__ */ jsx(Provider, {
|
|
5046
|
+
value: {
|
|
5047
|
+
shape,
|
|
5048
|
+
size,
|
|
5049
|
+
contrast,
|
|
5050
|
+
brandColor: brandColorData,
|
|
5051
|
+
labelTextStyle,
|
|
5052
|
+
labelTextColor
|
|
5053
|
+
},
|
|
5054
|
+
children: tableId == null ? /* @__PURE__ */ jsx(Placeholder$1, {
|
|
5055
|
+
ref: setRefEl,
|
|
5056
|
+
width,
|
|
5057
|
+
margin
|
|
5058
|
+
}) : /* @__PURE__ */ jsx(Fragment, {
|
|
5059
|
+
children: /* @__PURE__ */ jsx(Formik, {
|
|
5060
|
+
onSubmit: handleSubmit,
|
|
5061
|
+
initialValues,
|
|
5062
|
+
initialStatus: {
|
|
5063
|
+
error: null
|
|
5064
|
+
},
|
|
5065
|
+
enableReinitialize: true,
|
|
5066
|
+
children: (formik) => {
|
|
5067
|
+
const error = formik.status && formik.status.error;
|
|
5068
|
+
const errors = fields.map((field) => {
|
|
5069
|
+
const tableColumn = getTableColumn(field);
|
|
5070
|
+
return tableColumn && getIn(formik.touched, tableColumn.name) && getIn(formik.errors, tableColumn.name);
|
|
5071
|
+
}).filter((message) => typeof message === "string");
|
|
5072
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
5073
|
+
children: [/* @__PURE__ */ jsxs(GridForm, {
|
|
5074
|
+
ref: setRefEl,
|
|
5075
|
+
id,
|
|
5076
|
+
width,
|
|
5077
|
+
margin,
|
|
5078
|
+
size,
|
|
5079
|
+
onSubmit: formik.handleSubmit,
|
|
5080
|
+
onReset: formik.handleReset,
|
|
5081
|
+
noValidate: true,
|
|
5082
|
+
children: [fields.map((field, index) => {
|
|
5083
|
+
const tableColumn = getTableColumn(field);
|
|
5084
|
+
return /* @__PURE__ */ jsx(GridItem$1, {
|
|
5085
|
+
ref: items[index],
|
|
5086
|
+
grid,
|
|
5087
|
+
index,
|
|
5088
|
+
rowGap: gap,
|
|
5089
|
+
columnGap: gap,
|
|
5090
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
5091
|
+
tableColumn,
|
|
5092
|
+
tableFormField: field
|
|
5093
|
+
})
|
|
5094
|
+
}, field.id);
|
|
5095
|
+
}), /* @__PURE__ */ jsxs(GridItem$1, {
|
|
5096
|
+
ref: items[fields.length],
|
|
5097
|
+
grid,
|
|
5098
|
+
index: fields.length,
|
|
5099
|
+
rowGap: gap,
|
|
5100
|
+
columnGap: gap,
|
|
5101
|
+
children: [/* @__PURE__ */ jsx(StyledButton, {
|
|
5102
|
+
type: "submit",
|
|
5103
|
+
disabled: formik.isSubmitting || isDone,
|
|
5104
|
+
shape,
|
|
5105
|
+
size,
|
|
5106
|
+
color: brandColor,
|
|
5107
|
+
variant: submitVariant,
|
|
5108
|
+
textColor: submitTextColor,
|
|
5109
|
+
width: submitWidth,
|
|
5110
|
+
alignment: submitAlignment,
|
|
5111
|
+
textStyle: submitTextStyle,
|
|
5112
|
+
children: formik.isSubmitting ? /* @__PURE__ */ jsx(Spinner, {}) : isDone ? /* @__PURE__ */ jsx(IconContainer, {
|
|
5113
|
+
children: /* @__PURE__ */ jsx(SvgCheck12, {})
|
|
5114
|
+
}) : submitLabel
|
|
5115
|
+
}), (errors.length > 0 || error) && /* @__PURE__ */ jsxs(ErrorContainer, {
|
|
5116
|
+
children: [errors.map((message) => /* @__PURE__ */ jsx(ErrorMessage, {
|
|
5117
|
+
children: message
|
|
5118
|
+
}, message)), error != null && /* @__PURE__ */ jsx(ErrorMessage, {
|
|
5119
|
+
children: error
|
|
5120
|
+
})]
|
|
5121
|
+
})]
|
|
5122
|
+
})]
|
|
5123
|
+
}), submitLink != null && /* @__PURE__ */ jsx(Link, {
|
|
5124
|
+
ref: linkRef,
|
|
5125
|
+
hidden: true,
|
|
5126
|
+
link: submitLink
|
|
5127
|
+
})]
|
|
5128
|
+
});
|
|
5129
|
+
}
|
|
5130
|
+
})
|
|
5131
|
+
})
|
|
5132
|
+
});
|
|
5133
|
+
});
|
|
5134
|
+
function registerComponent$5(runtime) {
|
|
5135
|
+
return runtime.registerComponent(Form, {
|
|
5136
|
+
type: "./components/Form/index.js",
|
|
5137
|
+
label: "Form",
|
|
5138
|
+
icon: "Form40",
|
|
5139
|
+
props: {
|
|
5140
|
+
id: ElementID(),
|
|
5141
|
+
tableId: Table(),
|
|
5142
|
+
fields: TableFormFields(),
|
|
5143
|
+
submitLink: Link$1({
|
|
5144
|
+
label: "Redirect to",
|
|
5145
|
+
options: [{
|
|
5146
|
+
value: "OPEN_PAGE",
|
|
5147
|
+
label: "Open page"
|
|
5148
|
+
}, {
|
|
5149
|
+
value: "OPEN_URL",
|
|
5150
|
+
label: "Open URL"
|
|
5151
|
+
}]
|
|
5152
|
+
}),
|
|
5153
|
+
gap: GapY({
|
|
5154
|
+
preset: [{
|
|
5155
|
+
deviceId: "desktop",
|
|
5156
|
+
value: {
|
|
5157
|
+
value: 10,
|
|
5158
|
+
unit: "px"
|
|
5159
|
+
}
|
|
5160
|
+
}],
|
|
5161
|
+
label: "Gap",
|
|
5162
|
+
defaultValue: {
|
|
5163
|
+
value: 0,
|
|
5164
|
+
unit: "px"
|
|
5165
|
+
}
|
|
5166
|
+
}),
|
|
5167
|
+
shape: ResponsiveIconRadioGroup({
|
|
5168
|
+
label: "Shape",
|
|
5169
|
+
options: [{
|
|
5170
|
+
label: "Pill",
|
|
5171
|
+
value: Shapes.PILL,
|
|
5172
|
+
icon: "ButtonPill16"
|
|
5173
|
+
}, {
|
|
5174
|
+
label: "Rounded",
|
|
5175
|
+
value: Shapes.ROUNDED,
|
|
5176
|
+
icon: "ButtonRounded16"
|
|
5177
|
+
}, {
|
|
5178
|
+
label: "Square",
|
|
5179
|
+
value: Shapes.SQUARE,
|
|
5180
|
+
icon: "ButtonSquare16"
|
|
5181
|
+
}],
|
|
5182
|
+
defaultValue: Shapes.ROUNDED
|
|
5183
|
+
}),
|
|
5184
|
+
size: ResponsiveIconRadioGroup({
|
|
5185
|
+
label: "Size",
|
|
5186
|
+
options: [{
|
|
5187
|
+
label: "Small",
|
|
5188
|
+
value: Sizes.SMALL,
|
|
5189
|
+
icon: "SizeSmall16"
|
|
5190
|
+
}, {
|
|
5191
|
+
label: "Medium",
|
|
5192
|
+
value: Sizes.MEDIUM,
|
|
5193
|
+
icon: "SizeMedium16"
|
|
5194
|
+
}, {
|
|
5195
|
+
label: "Large",
|
|
5196
|
+
value: Sizes.LARGE,
|
|
5197
|
+
icon: "SizeLarge16"
|
|
5198
|
+
}],
|
|
5199
|
+
defaultValue: Sizes.MEDIUM
|
|
5200
|
+
}),
|
|
5201
|
+
contrast: ResponsiveIconRadioGroup({
|
|
5202
|
+
label: "Color",
|
|
5203
|
+
options: [{
|
|
5204
|
+
label: "Light mode",
|
|
5205
|
+
value: Contrasts.LIGHT,
|
|
5206
|
+
icon: "Sun16"
|
|
5207
|
+
}, {
|
|
5208
|
+
label: "Dark mode",
|
|
5209
|
+
value: Contrasts.DARK,
|
|
5210
|
+
icon: "Moon16"
|
|
5211
|
+
}],
|
|
5212
|
+
defaultValue: Contrasts.LIGHT
|
|
5213
|
+
}),
|
|
5214
|
+
labelTextStyle: TextStyle({
|
|
5215
|
+
label: "Label text style"
|
|
5216
|
+
}),
|
|
5217
|
+
labelTextColor: ResponsiveColor({
|
|
5218
|
+
label: "Label text color"
|
|
5219
|
+
}),
|
|
5220
|
+
submitTextStyle: TextStyle({
|
|
5221
|
+
label: "Button text style"
|
|
5222
|
+
}),
|
|
5223
|
+
brandColor: ResponsiveColor({
|
|
5224
|
+
label: "Button color",
|
|
5225
|
+
placeholder: "black"
|
|
5226
|
+
}),
|
|
5227
|
+
submitTextColor: ResponsiveColor({
|
|
5228
|
+
label: "Button text color",
|
|
5229
|
+
placeholder: "white"
|
|
5230
|
+
}),
|
|
5231
|
+
submitLabel: TextInput({
|
|
5232
|
+
label: "Button label",
|
|
5233
|
+
placeholder: "Submit"
|
|
5234
|
+
}),
|
|
5235
|
+
submitVariant: ResponsiveSelect({
|
|
5236
|
+
label: "Button style",
|
|
5237
|
+
options: [{
|
|
5238
|
+
value: "flat",
|
|
5239
|
+
label: "Flat"
|
|
5240
|
+
}, {
|
|
5241
|
+
value: "outline",
|
|
5242
|
+
label: "Outline"
|
|
5243
|
+
}, {
|
|
5244
|
+
value: "shadow",
|
|
5245
|
+
label: "Floating"
|
|
5246
|
+
}, {
|
|
5247
|
+
value: "clear",
|
|
5248
|
+
label: "Clear"
|
|
5249
|
+
}, {
|
|
5250
|
+
value: "blocky",
|
|
5251
|
+
label: "Blocky"
|
|
5252
|
+
}, {
|
|
5253
|
+
value: "bubbly",
|
|
5254
|
+
label: "Bubbly"
|
|
5255
|
+
}, {
|
|
5256
|
+
value: "skewed",
|
|
5257
|
+
label: "Skewed"
|
|
5258
|
+
}],
|
|
5259
|
+
defaultValue: "flat"
|
|
5260
|
+
}),
|
|
5261
|
+
submitWidth: ResponsiveLength({
|
|
5262
|
+
label: "Button width"
|
|
5263
|
+
}),
|
|
5264
|
+
submitAlignment: ResponsiveIconRadioGroup({
|
|
5265
|
+
label: "Button alignment",
|
|
5266
|
+
options: [{
|
|
5267
|
+
label: "Left",
|
|
5268
|
+
value: Alignments.LEFT,
|
|
5269
|
+
icon: "AlignLeft16"
|
|
5270
|
+
}, {
|
|
5271
|
+
label: "Center",
|
|
5272
|
+
value: Alignments.CENTER,
|
|
5273
|
+
icon: "AlignCenter16"
|
|
5274
|
+
}, {
|
|
5275
|
+
label: "Right",
|
|
5276
|
+
value: Alignments.RIGHT,
|
|
5277
|
+
icon: "AlignRight16"
|
|
5278
|
+
}],
|
|
5279
|
+
defaultValue: Alignments.CENTER
|
|
5280
|
+
}),
|
|
5281
|
+
width: Width({
|
|
5282
|
+
preset: [{
|
|
5283
|
+
deviceId: "desktop",
|
|
5284
|
+
value: {
|
|
5285
|
+
value: 550,
|
|
5286
|
+
unit: "px"
|
|
5287
|
+
}
|
|
5288
|
+
}],
|
|
5289
|
+
defaultValue: {
|
|
5290
|
+
value: 100,
|
|
5291
|
+
unit: "%"
|
|
5292
|
+
}
|
|
5293
|
+
}),
|
|
5294
|
+
margin: Margin()
|
|
5295
|
+
}
|
|
5296
|
+
});
|
|
5297
|
+
}
|
|
5298
|
+
var _path$r;
|
|
5299
|
+
function _extends$r() {
|
|
5300
|
+
_extends$r = Object.assign || function(target) {
|
|
5301
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
5302
|
+
var source = arguments[i];
|
|
5303
|
+
for (var key in source) {
|
|
5304
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
5305
|
+
target[key] = source[key];
|
|
5306
|
+
}
|
|
5307
|
+
}
|
|
5308
|
+
}
|
|
5309
|
+
return target;
|
|
5310
|
+
};
|
|
5311
|
+
return _extends$r.apply(this, arguments);
|
|
5312
|
+
}
|
|
5313
|
+
var SvgMobileMenu28 = function SvgMobileMenu282(props) {
|
|
5314
|
+
return /* @__PURE__ */ React.createElement("svg", _extends$r({
|
|
5315
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5316
|
+
width: 28,
|
|
5317
|
+
height: 28
|
|
5318
|
+
}, props), _path$r || (_path$r = /* @__PURE__ */ React.createElement("path", {
|
|
5319
|
+
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"
|
|
5320
|
+
})));
|
|
5321
|
+
};
|
|
5322
|
+
const GutterContainer = styled.div`
|
|
5323
|
+
${(p) => cssMediaRules([p.gutter], ([gutter = {
|
|
5324
|
+
value: 0,
|
|
5325
|
+
unit: "px"
|
|
5326
|
+
}]) => css`
|
|
5327
|
+
padding-left: ${p.first ? "0px" : `${gutter.value / 2}${gutter.unit}`};
|
|
5328
|
+
padding-right: ${p.last ? "0px" : `${gutter.value / 2}${gutter.unit}`};
|
|
5329
|
+
`)}
|
|
5330
|
+
`;
|
|
5331
|
+
const PlaceholderLink$1 = styled.div`
|
|
5332
|
+
width: ${(props) => props.width}px;
|
|
5333
|
+
height: ${(props) => props.button === true ? 32 : 8}px;
|
|
5334
|
+
background-color: #a1a8c2;
|
|
5335
|
+
border-radius: ${(props) => props.button === true ? 6 : 2}px;
|
|
5336
|
+
opacity: 0.4;
|
|
5337
|
+
`;
|
|
5338
|
+
const links$1 = [{
|
|
5339
|
+
width: 50
|
|
5340
|
+
}, {
|
|
5341
|
+
width: 70
|
|
5342
|
+
}, {
|
|
5343
|
+
width: 60
|
|
5344
|
+
}, {
|
|
5345
|
+
width: 80,
|
|
5346
|
+
button: true
|
|
5347
|
+
}];
|
|
5348
|
+
function LinksPlaceholder({
|
|
5349
|
+
gutter
|
|
5350
|
+
}) {
|
|
5351
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
5352
|
+
children: links$1.map((link, i) => /* @__PURE__ */ jsx(GutterContainer, {
|
|
5353
|
+
gutter,
|
|
5354
|
+
first: i === 0,
|
|
5355
|
+
last: i === links$1.length - 1,
|
|
5356
|
+
children: /* @__PURE__ */ jsx(PlaceholderLink$1, __spreadValues({}, link))
|
|
5357
|
+
}, i))
|
|
5358
|
+
});
|
|
5359
|
+
}
|
|
5360
|
+
var _path$q;
|
|
5361
|
+
function _extends$q() {
|
|
5362
|
+
_extends$q = Object.assign || function(target) {
|
|
5363
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
5364
|
+
var source = arguments[i];
|
|
5365
|
+
for (var key in source) {
|
|
5366
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
5367
|
+
target[key] = source[key];
|
|
5368
|
+
}
|
|
5369
|
+
}
|
|
5370
|
+
}
|
|
3647
5371
|
return target;
|
|
3648
5372
|
};
|
|
3649
5373
|
return _extends$q.apply(this, arguments);
|
|
@@ -3800,22 +5524,22 @@ const StyledDropDownItem = styled(Link)`
|
|
|
3800
5524
|
background-color: rgba(0, 0, 0, 0.04);
|
|
3801
5525
|
}
|
|
3802
5526
|
`;
|
|
3803
|
-
function DropDownItem$1(
|
|
3804
|
-
var
|
|
5527
|
+
function DropDownItem$1(_S) {
|
|
5528
|
+
var _T = _S, {
|
|
3805
5529
|
color
|
|
3806
|
-
} =
|
|
5530
|
+
} = _T, restOfProps = __objRest(_T, [
|
|
3807
5531
|
"color"
|
|
3808
5532
|
]);
|
|
3809
5533
|
return /* @__PURE__ */ jsx(StyledDropDownItem, __spreadProps(__spreadValues({}, restOfProps), {
|
|
3810
5534
|
color: useColor(color)
|
|
3811
5535
|
}));
|
|
3812
5536
|
}
|
|
3813
|
-
function DropDownButton(
|
|
3814
|
-
var
|
|
5537
|
+
function DropDownButton(_U) {
|
|
5538
|
+
var _V = _U, {
|
|
3815
5539
|
label,
|
|
3816
5540
|
caret = "caret",
|
|
3817
5541
|
links: links2 = []
|
|
3818
|
-
} =
|
|
5542
|
+
} = _V, restOfProps = __objRest(_V, [
|
|
3819
5543
|
"label",
|
|
3820
5544
|
"caret",
|
|
3821
5545
|
"links"
|
|
@@ -3831,7 +5555,7 @@ function DropDownButton(_q) {
|
|
|
3831
5555
|
}, [setPosition]);
|
|
3832
5556
|
return /* @__PURE__ */ jsxs(DropDownContainer, {
|
|
3833
5557
|
ref: container,
|
|
3834
|
-
children: [/* @__PURE__ */ jsx(Button, __spreadProps(__spreadValues({}, restOfProps), {
|
|
5558
|
+
children: [/* @__PURE__ */ jsx(Button$1, __spreadProps(__spreadValues({}, restOfProps), {
|
|
3835
5559
|
children: /* @__PURE__ */ jsxs("div", {
|
|
3836
5560
|
style: {
|
|
3837
5561
|
display: "flex",
|
|
@@ -3892,7 +5616,7 @@ const DropDownMenu = styled.div`
|
|
|
3892
5616
|
flex-direction: column;
|
|
3893
5617
|
padding: 8px;
|
|
3894
5618
|
`;
|
|
3895
|
-
const ButtonLink$1 = styled(Button)`
|
|
5619
|
+
const ButtonLink$1 = styled(Button$1)`
|
|
3896
5620
|
margin: 8px 0;
|
|
3897
5621
|
`;
|
|
3898
5622
|
const StyledLink$2 = styled(Link)`
|
|
@@ -3905,24 +5629,24 @@ const StyledLink$2 = styled(Link)`
|
|
|
3905
5629
|
color: ${color == null ? "black" : colorToString(color)};
|
|
3906
5630
|
`)}
|
|
3907
5631
|
`;
|
|
3908
|
-
function DropDownItem(
|
|
3909
|
-
var
|
|
5632
|
+
function DropDownItem(_W) {
|
|
5633
|
+
var _X = _W, {
|
|
3910
5634
|
color
|
|
3911
|
-
} =
|
|
5635
|
+
} = _X, restOfProps = __objRest(_X, [
|
|
3912
5636
|
"color"
|
|
3913
5637
|
]);
|
|
3914
5638
|
return /* @__PURE__ */ jsx(StyledLink$2, __spreadProps(__spreadValues({}, restOfProps), {
|
|
3915
5639
|
color: useColor(color)
|
|
3916
5640
|
}));
|
|
3917
5641
|
}
|
|
3918
|
-
function MobileDropDownButton(
|
|
3919
|
-
var
|
|
5642
|
+
function MobileDropDownButton(_Y) {
|
|
5643
|
+
var _Z = _Y, {
|
|
3920
5644
|
label,
|
|
3921
5645
|
caret,
|
|
3922
5646
|
links: links2 = [],
|
|
3923
5647
|
onClose = () => {
|
|
3924
5648
|
}
|
|
3925
|
-
} =
|
|
5649
|
+
} = _Z, restOfProps = __objRest(_Z, [
|
|
3926
5650
|
"label",
|
|
3927
5651
|
"caret",
|
|
3928
5652
|
"links",
|
|
@@ -3964,10 +5688,10 @@ function MobileDropDownButton(_u) {
|
|
|
3964
5688
|
})]
|
|
3965
5689
|
});
|
|
3966
5690
|
}
|
|
3967
|
-
const ButtonLink = styled(Button)`
|
|
5691
|
+
const ButtonLink = styled(Button$1)`
|
|
3968
5692
|
margin: 8px 0;
|
|
3969
5693
|
`;
|
|
3970
|
-
const Container$
|
|
5694
|
+
const Container$3 = styled.div`
|
|
3971
5695
|
position: fixed;
|
|
3972
5696
|
flex-direction: column;
|
|
3973
5697
|
width: 100%;
|
|
@@ -4021,7 +5745,7 @@ function MobileMenu({
|
|
|
4021
5745
|
onClose = () => {
|
|
4022
5746
|
}
|
|
4023
5747
|
}) {
|
|
4024
|
-
return /* @__PURE__ */ jsxs(Container$
|
|
5748
|
+
return /* @__PURE__ */ jsxs(Container$3, {
|
|
4025
5749
|
animation,
|
|
4026
5750
|
backgroundColor: useColor(backgroundColor),
|
|
4027
5751
|
open,
|
|
@@ -4047,7 +5771,7 @@ function MobileMenu({
|
|
|
4047
5771
|
})]
|
|
4048
5772
|
});
|
|
4049
5773
|
}
|
|
4050
|
-
const Container$
|
|
5774
|
+
const Container$2 = styled.nav`
|
|
4051
5775
|
display: flex;
|
|
4052
5776
|
align-items: center;
|
|
4053
5777
|
${cssWidth()}
|
|
@@ -4104,7 +5828,7 @@ const Navigation = forwardRef(function Navigation2({
|
|
|
4104
5828
|
margin
|
|
4105
5829
|
}, ref) {
|
|
4106
5830
|
const [isOpen, setIsOpen] = useState(false);
|
|
4107
|
-
return /* @__PURE__ */ jsxs(Container$
|
|
5831
|
+
return /* @__PURE__ */ jsxs(Container$2, {
|
|
4108
5832
|
ref,
|
|
4109
5833
|
id,
|
|
4110
5834
|
margin,
|
|
@@ -4129,7 +5853,7 @@ const Navigation = forwardRef(function Navigation2({
|
|
|
4129
5853
|
gutter,
|
|
4130
5854
|
first: i === 0,
|
|
4131
5855
|
last: i === links2.length - 1,
|
|
4132
|
-
children: [link.type === "button" && /* @__PURE__ */ jsx(Button, __spreadProps(__spreadValues({}, link.payload), {
|
|
5856
|
+
children: [link.type === "button" && /* @__PURE__ */ jsx(Button$1, __spreadProps(__spreadValues({}, link.payload), {
|
|
4133
5857
|
children: link.payload.label
|
|
4134
5858
|
})), link.type === "dropdown" && /* @__PURE__ */ jsx(DropDownButton, __spreadValues({}, link.payload))]
|
|
4135
5859
|
}, link.id)) : /* @__PURE__ */ jsx(LinksPlaceholder, {
|
|
@@ -4152,7 +5876,7 @@ const Navigation = forwardRef(function Navigation2({
|
|
|
4152
5876
|
})]
|
|
4153
5877
|
});
|
|
4154
5878
|
});
|
|
4155
|
-
function registerComponent$
|
|
5879
|
+
function registerComponent$4(runtime) {
|
|
4156
5880
|
return runtime.registerComponent(Navigation, {
|
|
4157
5881
|
type: "./components/Navigation/index.js",
|
|
4158
5882
|
label: "Navigation",
|
|
@@ -4163,7 +5887,7 @@ function registerComponent$3(runtime) {
|
|
|
4163
5887
|
linkTextStyle: TextStyle({
|
|
4164
5888
|
label: "Link text style"
|
|
4165
5889
|
}),
|
|
4166
|
-
showLogo: Checkbox({
|
|
5890
|
+
showLogo: Checkbox$1({
|
|
4167
5891
|
preset: true,
|
|
4168
5892
|
label: "Show logo"
|
|
4169
5893
|
}),
|
|
@@ -4256,7 +5980,7 @@ const PlaceholderBase = styled.div`
|
|
|
4256
5980
|
height: 80px;
|
|
4257
5981
|
padding: 8px;
|
|
4258
5982
|
`;
|
|
4259
|
-
var
|
|
5983
|
+
var Placeholder3 = forwardRef(function Placeholder4(props, ref) {
|
|
4260
5984
|
return /* @__PURE__ */ jsx(PlaceholderBase, __spreadProps(__spreadValues({}, props), {
|
|
4261
5985
|
ref,
|
|
4262
5986
|
children: /* @__PURE__ */ jsx("svg", {
|
|
@@ -4324,12 +6048,12 @@ const Root = forwardRef(function Page2({
|
|
|
4324
6048
|
children: /* @__PURE__ */ jsx(Element$1, {
|
|
4325
6049
|
element: child
|
|
4326
6050
|
})
|
|
4327
|
-
}, child.key)) : /* @__PURE__ */ jsx(
|
|
6051
|
+
}, child.key)) : /* @__PURE__ */ jsx(Placeholder3, {})
|
|
4328
6052
|
})
|
|
4329
6053
|
})]
|
|
4330
6054
|
});
|
|
4331
6055
|
});
|
|
4332
|
-
function registerComponent$
|
|
6056
|
+
function registerComponent$3(runtime) {
|
|
4333
6057
|
return runtime.registerComponent(Root, {
|
|
4334
6058
|
type: "./components/Root/index.js",
|
|
4335
6059
|
label: "Page",
|
|
@@ -5006,7 +6730,7 @@ function SocialLinksPlaceholder({
|
|
|
5006
6730
|
}, link.id))
|
|
5007
6731
|
});
|
|
5008
6732
|
}
|
|
5009
|
-
const Container = styled.div`
|
|
6733
|
+
const Container$1 = styled.div`
|
|
5010
6734
|
display: flex;
|
|
5011
6735
|
flex-direction: row;
|
|
5012
6736
|
flex-wrap: wrap;
|
|
@@ -5090,7 +6814,7 @@ const SocialLinks = forwardRef(function SocialLinks2({
|
|
|
5090
6814
|
}, ref) {
|
|
5091
6815
|
const fillData = useColor(fill);
|
|
5092
6816
|
const backgroundColorData = useColor(backgroundColor);
|
|
5093
|
-
return /* @__PURE__ */ jsx(Container, {
|
|
6817
|
+
return /* @__PURE__ */ jsx(Container$1, {
|
|
5094
6818
|
ref,
|
|
5095
6819
|
id,
|
|
5096
6820
|
alignment,
|
|
@@ -5126,7 +6850,7 @@ const SocialLinks = forwardRef(function SocialLinks2({
|
|
|
5126
6850
|
})
|
|
5127
6851
|
});
|
|
5128
6852
|
});
|
|
5129
|
-
function registerComponent$
|
|
6853
|
+
function registerComponent$2(runtime) {
|
|
5130
6854
|
return runtime.registerComponent(SocialLinks, {
|
|
5131
6855
|
type: "./components/SocialLinks/index.js",
|
|
5132
6856
|
label: "Social Links",
|
|
@@ -5374,10 +7098,10 @@ const Span = styled.span`
|
|
|
5374
7098
|
`}
|
|
5375
7099
|
`, shallowMergeFallbacks)}
|
|
5376
7100
|
`;
|
|
5377
|
-
function Mark(
|
|
5378
|
-
var
|
|
7101
|
+
function Mark(__) {
|
|
7102
|
+
var _$ = __, {
|
|
5379
7103
|
value
|
|
5380
|
-
} =
|
|
7104
|
+
} = _$, restOfProps = __objRest(_$, [
|
|
5381
7105
|
"value"
|
|
5382
7106
|
]);
|
|
5383
7107
|
const typographyStyle = useTypographyMark(value);
|
|
@@ -5415,10 +7139,10 @@ const StyledBlock = styled.div`
|
|
|
5415
7139
|
border-left: 5px solid rgba(0, 0, 0, 0.1);
|
|
5416
7140
|
` : ""}
|
|
5417
7141
|
`;
|
|
5418
|
-
var Block = forwardRef(function Block2(
|
|
5419
|
-
var
|
|
7142
|
+
var Block = forwardRef(function Block2(_aa, ref) {
|
|
7143
|
+
var _ba = _aa, {
|
|
5420
7144
|
textAlign
|
|
5421
|
-
} =
|
|
7145
|
+
} = _ba, restOfProps = __objRest(_ba, [
|
|
5422
7146
|
"textAlign"
|
|
5423
7147
|
]);
|
|
5424
7148
|
return /* @__PURE__ */ jsx(StyledBlock, __spreadProps(__spreadValues({}, restOfProps), {
|
|
@@ -5543,10 +7267,10 @@ function Inlines() {
|
|
|
5543
7267
|
}
|
|
5544
7268
|
};
|
|
5545
7269
|
}
|
|
5546
|
-
const RichTextEditor = styled(forwardRef(function RichTextEditor2(
|
|
5547
|
-
var
|
|
7270
|
+
const RichTextEditor = styled(forwardRef(function RichTextEditor2(_ca, ref) {
|
|
7271
|
+
var _da = _ca, {
|
|
5548
7272
|
placeholder: placeholder2 = "Write some text..."
|
|
5549
|
-
} =
|
|
7273
|
+
} = _da, restOfProps = __objRest(_da, [
|
|
5550
7274
|
"placeholder"
|
|
5551
7275
|
]);
|
|
5552
7276
|
const plugins = useMemo(() => [Lists(), LinkPlugin(), Inlines(), DeviceOverridesBlockPlugin(), DeviceOverridesMarksPlugin()], []);
|
|
@@ -5663,7 +7387,7 @@ const Text = forwardRef(function Text2({
|
|
|
5663
7387
|
onKeyDown: handleKeyDown
|
|
5664
7388
|
});
|
|
5665
7389
|
});
|
|
5666
|
-
function registerComponent(runtime) {
|
|
7390
|
+
function registerComponent$1(runtime) {
|
|
5667
7391
|
return runtime.registerComponent(Text, {
|
|
5668
7392
|
type: "./components/Text/index.js",
|
|
5669
7393
|
label: "Text",
|
|
@@ -5741,18 +7465,103 @@ function registerComponent(runtime) {
|
|
|
5741
7465
|
}
|
|
5742
7466
|
});
|
|
5743
7467
|
}
|
|
7468
|
+
const Container = styled.div`
|
|
7469
|
+
display: flex;
|
|
7470
|
+
flex-direction: column;
|
|
7471
|
+
overflow: hidden;
|
|
7472
|
+
${cssWidth("560px")}
|
|
7473
|
+
${cssMargin()}
|
|
7474
|
+
${cssBorderRadius()}
|
|
7475
|
+
`;
|
|
7476
|
+
const ASPECT_RATIO = 16 / 9;
|
|
7477
|
+
const Video = forwardRef(function Video2({
|
|
7478
|
+
id,
|
|
7479
|
+
video,
|
|
7480
|
+
width,
|
|
7481
|
+
margin,
|
|
7482
|
+
borderRadius
|
|
7483
|
+
}, ref) {
|
|
7484
|
+
const canPlayUrl = video && video.url != null && ReactPlayer.canPlay(video.url);
|
|
7485
|
+
return /* @__PURE__ */ jsx(Container, {
|
|
7486
|
+
ref,
|
|
7487
|
+
id,
|
|
7488
|
+
width,
|
|
7489
|
+
margin,
|
|
7490
|
+
borderRadius,
|
|
7491
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
7492
|
+
style: {
|
|
7493
|
+
position: "relative",
|
|
7494
|
+
paddingTop: `${100 / ASPECT_RATIO}%`
|
|
7495
|
+
},
|
|
7496
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
7497
|
+
style: {
|
|
7498
|
+
position: "absolute",
|
|
7499
|
+
top: 0,
|
|
7500
|
+
left: 0,
|
|
7501
|
+
right: 0,
|
|
7502
|
+
bottom: 0
|
|
7503
|
+
},
|
|
7504
|
+
children: canPlayUrl === true ? /* @__PURE__ */ jsx(ReactPlayer, __spreadProps(__spreadValues({}, video), {
|
|
7505
|
+
width: "100%",
|
|
7506
|
+
height: "100%",
|
|
7507
|
+
config: {
|
|
7508
|
+
vimeo: {
|
|
7509
|
+
playerOptions: {
|
|
7510
|
+
background: video != null && !video.controls
|
|
7511
|
+
}
|
|
7512
|
+
},
|
|
7513
|
+
wistia: {
|
|
7514
|
+
options: {
|
|
7515
|
+
endVideoBehavior: video != null && video.loop === true ? "loop" : "default"
|
|
7516
|
+
}
|
|
7517
|
+
}
|
|
7518
|
+
}
|
|
7519
|
+
})) : /* @__PURE__ */ jsx("img", {
|
|
7520
|
+
width: "100%",
|
|
7521
|
+
src: placeholders.video.src,
|
|
7522
|
+
alt: "Video Placeholder"
|
|
7523
|
+
})
|
|
7524
|
+
})
|
|
7525
|
+
})
|
|
7526
|
+
});
|
|
7527
|
+
});
|
|
7528
|
+
function registerComponent(runtime) {
|
|
7529
|
+
return runtime.registerComponent(Video, {
|
|
7530
|
+
type: "./components/Video/index.js",
|
|
7531
|
+
label: "Video",
|
|
7532
|
+
icon: "Video40",
|
|
7533
|
+
props: {
|
|
7534
|
+
id: ElementID(),
|
|
7535
|
+
video: Video$1({
|
|
7536
|
+
preset: {
|
|
7537
|
+
controls: true
|
|
7538
|
+
}
|
|
7539
|
+
}),
|
|
7540
|
+
width: Width({
|
|
7541
|
+
defaultValue: {
|
|
7542
|
+
value: 560,
|
|
7543
|
+
unit: "px"
|
|
7544
|
+
}
|
|
7545
|
+
}),
|
|
7546
|
+
margin: Margin(),
|
|
7547
|
+
borderRadius: BorderRadius()
|
|
7548
|
+
}
|
|
7549
|
+
});
|
|
7550
|
+
}
|
|
5744
7551
|
function registerBuiltinComponents(runtime) {
|
|
5745
|
-
const unregisterBoxComponent = registerComponent$
|
|
5746
|
-
const unregisterButtonComponent = registerComponent$
|
|
5747
|
-
const unregisterCarouselComponent = registerComponent$
|
|
5748
|
-
const unregisterCountdownComponent = registerComponent$
|
|
5749
|
-
const unregisterDividerComponent = registerComponent$
|
|
5750
|
-
const unregisterEmbedComponent = registerComponent$
|
|
5751
|
-
const
|
|
5752
|
-
const
|
|
5753
|
-
const
|
|
5754
|
-
const
|
|
5755
|
-
const
|
|
7552
|
+
const unregisterBoxComponent = registerComponent$c(runtime);
|
|
7553
|
+
const unregisterButtonComponent = registerComponent$b(runtime);
|
|
7554
|
+
const unregisterCarouselComponent = registerComponent$9(runtime);
|
|
7555
|
+
const unregisterCountdownComponent = registerComponent$8(runtime);
|
|
7556
|
+
const unregisterDividerComponent = registerComponent$7(runtime);
|
|
7557
|
+
const unregisterEmbedComponent = registerComponent$6(runtime);
|
|
7558
|
+
const unregisterFormComponent = registerComponent$5(runtime);
|
|
7559
|
+
const unregisterImageComponent = registerComponent$a(runtime);
|
|
7560
|
+
const unregisterNavigationComponent = registerComponent$4(runtime);
|
|
7561
|
+
const unregisterRootComponent = registerComponent$3(runtime);
|
|
7562
|
+
const unregisterSocialLinksComponent = registerComponent$2(runtime);
|
|
7563
|
+
const unregisterTextComponent = registerComponent$1(runtime);
|
|
7564
|
+
const unregisterVideoComponent = registerComponent(runtime);
|
|
5756
7565
|
return () => {
|
|
5757
7566
|
unregisterBoxComponent();
|
|
5758
7567
|
unregisterButtonComponent();
|
|
@@ -5760,11 +7569,14 @@ function registerBuiltinComponents(runtime) {
|
|
|
5760
7569
|
unregisterCountdownComponent();
|
|
5761
7570
|
unregisterDividerComponent();
|
|
5762
7571
|
unregisterEmbedComponent();
|
|
7572
|
+
unregisterFormComponent();
|
|
5763
7573
|
unregisterImageComponent();
|
|
5764
7574
|
unregisterNavigationComponent();
|
|
5765
7575
|
unregisterRootComponent();
|
|
5766
7576
|
unregisterSocialLinksComponent();
|
|
5767
7577
|
unregisterTextComponent();
|
|
7578
|
+
unregisterTextComponent();
|
|
7579
|
+
unregisterVideoComponent();
|
|
5768
7580
|
};
|
|
5769
7581
|
}
|
|
5770
7582
|
const contextDefaultValue = configureStore();
|
|
@@ -5793,10 +7605,9 @@ function createReactRuntime(store) {
|
|
|
5793
7605
|
const ReactRuntime = createReactRuntime(contextDefaultValue);
|
|
5794
7606
|
const Context = createContext(contextDefaultValue);
|
|
5795
7607
|
function RuntimeProvider({
|
|
7608
|
+
client,
|
|
5796
7609
|
children,
|
|
5797
|
-
defaultRootElements
|
|
5798
|
-
registerComponents,
|
|
5799
|
-
makeswiftApiEndpoint
|
|
7610
|
+
defaultRootElements
|
|
5800
7611
|
}) {
|
|
5801
7612
|
const [store, setStore] = useState(() => {
|
|
5802
7613
|
const store2 = configureStore({
|
|
@@ -5805,27 +7616,11 @@ function RuntimeProvider({
|
|
|
5805
7616
|
});
|
|
5806
7617
|
const runtime = createReactRuntime(store2);
|
|
5807
7618
|
registerBuiltinComponents(runtime);
|
|
5808
|
-
registerComponents == null ? void 0 : registerComponents(runtime);
|
|
5809
7619
|
return store2;
|
|
5810
7620
|
});
|
|
5811
|
-
const [client, setClient] = useState(new ApolloClient({
|
|
5812
|
-
uri: makeswiftApiEndpoint,
|
|
5813
|
-
cache: new InMemoryCache()
|
|
5814
|
-
}));
|
|
5815
|
-
useEffect(() => {
|
|
5816
|
-
setClient(({
|
|
5817
|
-
cache
|
|
5818
|
-
}) => new ApolloClient({
|
|
5819
|
-
uri: makeswiftApiEndpoint,
|
|
5820
|
-
cache
|
|
5821
|
-
}));
|
|
5822
|
-
}, [makeswiftApiEndpoint]);
|
|
5823
7621
|
useEffect(() => {
|
|
5824
7622
|
return registerBuiltinComponents(createReactRuntime(store));
|
|
5825
7623
|
}, [store]);
|
|
5826
|
-
useEffect(() => {
|
|
5827
|
-
return registerComponents == null ? void 0 : registerComponents(createReactRuntime(store));
|
|
5828
|
-
}, [store, registerComponents]);
|
|
5829
7624
|
useEffect(() => {
|
|
5830
7625
|
const isInBuilder = window.parent !== window;
|
|
5831
7626
|
if (isInBuilder)
|
|
@@ -5834,7 +7629,7 @@ function RuntimeProvider({
|
|
|
5834
7629
|
const ReactBuilderPreview = await import("./react-builder-preview.es.js");
|
|
5835
7630
|
setStore((store2) => ReactBuilderPreview.configureStore({
|
|
5836
7631
|
preloadedState: store2.getState(),
|
|
5837
|
-
client
|
|
7632
|
+
client: client.apolloClient
|
|
5838
7633
|
}));
|
|
5839
7634
|
}
|
|
5840
7635
|
}, [client]);
|
|
@@ -5861,12 +7656,31 @@ function RuntimeProvider({
|
|
|
5861
7656
|
}, []);
|
|
5862
7657
|
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
5863
7658
|
value: store,
|
|
5864
|
-
children: /* @__PURE__ */ jsx(
|
|
7659
|
+
children: /* @__PURE__ */ jsx(MakeswiftProvider, {
|
|
5865
7660
|
client,
|
|
5866
7661
|
children
|
|
5867
7662
|
})
|
|
5868
7663
|
});
|
|
5869
7664
|
}
|
|
7665
|
+
const PageContext = createContext(null);
|
|
7666
|
+
function usePageIdOrNull() {
|
|
7667
|
+
return useContext(PageContext);
|
|
7668
|
+
}
|
|
7669
|
+
function usePageId() {
|
|
7670
|
+
const pageIdOrNull = usePageIdOrNull();
|
|
7671
|
+
if (pageIdOrNull == null)
|
|
7672
|
+
throw new Error("`usePageId` must be used with `<PageProvider>`");
|
|
7673
|
+
return pageIdOrNull;
|
|
7674
|
+
}
|
|
7675
|
+
function PageProvider({
|
|
7676
|
+
id,
|
|
7677
|
+
children
|
|
7678
|
+
}) {
|
|
7679
|
+
return /* @__PURE__ */ jsx(PageContext.Provider, {
|
|
7680
|
+
value: id,
|
|
7681
|
+
children
|
|
7682
|
+
});
|
|
7683
|
+
}
|
|
5870
7684
|
const DocumentContext = createContext(null);
|
|
5871
7685
|
function useDocumentKey() {
|
|
5872
7686
|
return useContext(DocumentContext);
|
|
@@ -5882,8 +7696,8 @@ function useElementId(elementKey) {
|
|
|
5882
7696
|
const documentKey = useDocumentKey();
|
|
5883
7697
|
return useSelector((state) => documentKey == null || elementKey == null ? null : getElementId(state, documentKey, elementKey));
|
|
5884
7698
|
}
|
|
5885
|
-
function
|
|
5886
|
-
return useSelector((state) =>
|
|
7699
|
+
function useDocument(documentKey) {
|
|
7700
|
+
return useSelector((state) => getDocument(state, documentKey));
|
|
5887
7701
|
}
|
|
5888
7702
|
function useIsInBuilder() {
|
|
5889
7703
|
return useSelector((state) => getIsInBuilder(state));
|
|
@@ -5916,24 +7730,64 @@ const ElementData = memo(forwardRef(function ElementData2({
|
|
|
5916
7730
|
const ElementReference = memo(forwardRef(function ElementReference2({
|
|
5917
7731
|
elementReference
|
|
5918
7732
|
}, ref) {
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
7733
|
+
var _a;
|
|
7734
|
+
const {
|
|
7735
|
+
error,
|
|
7736
|
+
data
|
|
7737
|
+
} = useQuery(gql`
|
|
7738
|
+
query ElementReferenceGlobalElement($id: ID!) {
|
|
7739
|
+
globalElement(id: $id) {
|
|
7740
|
+
id
|
|
7741
|
+
data
|
|
7742
|
+
}
|
|
7743
|
+
}
|
|
7744
|
+
`, {
|
|
7745
|
+
variables: {
|
|
7746
|
+
id: elementReference.value
|
|
7747
|
+
}
|
|
7748
|
+
});
|
|
7749
|
+
const globalElementData = (_a = data == null ? void 0 : data.globalElement) == null ? void 0 : _a.data;
|
|
7750
|
+
const elementReferenceDocument = useDocument(elementReference.key);
|
|
7751
|
+
if (error != null) {
|
|
7752
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7753
|
+
ref,
|
|
7754
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
7755
|
+
children: "Something went wrong!"
|
|
7756
|
+
}), /* @__PURE__ */ jsx("pre", {
|
|
7757
|
+
children: /* @__PURE__ */ jsx("code", {
|
|
7758
|
+
children: JSON.stringify(error, null, 2)
|
|
7759
|
+
})
|
|
7760
|
+
})]
|
|
7761
|
+
});
|
|
7762
|
+
}
|
|
7763
|
+
if (globalElementData == null) {
|
|
7764
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7765
|
+
ref,
|
|
7766
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
7767
|
+
children: "Not Found"
|
|
7768
|
+
}), /* @__PURE__ */ jsx("pre", {
|
|
7769
|
+
children: /* @__PURE__ */ jsx("code", {
|
|
7770
|
+
children: JSON.stringify(elementReference, null, 2)
|
|
7771
|
+
})
|
|
7772
|
+
})]
|
|
7773
|
+
});
|
|
7774
|
+
}
|
|
7775
|
+
return elementReferenceDocument != null ? /* @__PURE__ */ jsx(Document, {
|
|
7776
|
+
document: elementReferenceDocument,
|
|
7777
|
+
ref
|
|
7778
|
+
}) : /* @__PURE__ */ jsx(ElementData, {
|
|
7779
|
+
elementData: globalElementData,
|
|
7780
|
+
ref
|
|
5928
7781
|
});
|
|
5929
7782
|
}));
|
|
5930
|
-
const Element$1 = memo(function Element2({
|
|
7783
|
+
const Element$1 = memo(forwardRef(function Element2({
|
|
5931
7784
|
element
|
|
5932
|
-
}) {
|
|
7785
|
+
}, ref) {
|
|
5933
7786
|
const elementKey = element.key;
|
|
5934
7787
|
const dispatch = useDispatch();
|
|
5935
7788
|
const documentKey = useDocumentKey();
|
|
5936
7789
|
const [handle, setHandle] = useState(null);
|
|
7790
|
+
useImperativeHandle(ref, () => handle, [handle]);
|
|
5937
7791
|
useEffect(() => {
|
|
5938
7792
|
if (documentKey == null)
|
|
5939
7793
|
return;
|
|
@@ -5951,30 +7805,38 @@ const Element$1 = memo(function Element2({
|
|
|
5951
7805
|
ref: setHandle,
|
|
5952
7806
|
elementData: element
|
|
5953
7807
|
}, elementKey);
|
|
5954
|
-
});
|
|
5955
|
-
const Document = memo(function Document2({
|
|
5956
|
-
|
|
5957
|
-
}) {
|
|
5958
|
-
|
|
5959
|
-
|
|
7808
|
+
}));
|
|
7809
|
+
const Document = memo(forwardRef(function Document2({
|
|
7810
|
+
document
|
|
7811
|
+
}, ref) {
|
|
7812
|
+
return /* @__PURE__ */ jsx(DocumentContext.Provider, {
|
|
7813
|
+
value: document.key,
|
|
7814
|
+
children: /* @__PURE__ */ jsx(Element$1, {
|
|
7815
|
+
ref,
|
|
7816
|
+
element: document.rootElement
|
|
7817
|
+
})
|
|
7818
|
+
});
|
|
7819
|
+
}));
|
|
7820
|
+
const DocumentReference = memo(forwardRef(function DocumentReference2({
|
|
7821
|
+
documentReference
|
|
7822
|
+
}, ref) {
|
|
7823
|
+
const document = useDocument(documentReference.key);
|
|
7824
|
+
if (document == null) {
|
|
5960
7825
|
return /* @__PURE__ */ jsxs("div", {
|
|
7826
|
+
ref,
|
|
5961
7827
|
children: [/* @__PURE__ */ jsx("p", {
|
|
5962
7828
|
children: "Document Not Found"
|
|
5963
7829
|
}), /* @__PURE__ */ jsx("pre", {
|
|
5964
7830
|
children: /* @__PURE__ */ jsx("code", {
|
|
5965
|
-
children: JSON.stringify(
|
|
5966
|
-
documentKey
|
|
5967
|
-
}, null, 2)
|
|
7831
|
+
children: JSON.stringify(documentReference, null, 2)
|
|
5968
7832
|
})
|
|
5969
7833
|
})]
|
|
5970
7834
|
});
|
|
5971
7835
|
}
|
|
5972
|
-
return /* @__PURE__ */ jsx(
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
element: documentRootElement
|
|
5976
|
-
})
|
|
7836
|
+
return /* @__PURE__ */ jsx(Document, {
|
|
7837
|
+
ref,
|
|
7838
|
+
document
|
|
5977
7839
|
});
|
|
5978
|
-
});
|
|
5979
|
-
export {
|
|
7840
|
+
}));
|
|
7841
|
+
export { useBackgrounds as A, Box as B, Carousel as C, DocumentReference as D, Element$1 as E, Form as F, useBorder as G, useBoxShadow as H, ImageComponent as I, useColor as J, useFile as K, useMediaQuery as L, usePage as M, Navigation as N, useTable as O, PageProvider as P, MakeswiftClient as Q, RuntimeProvider as R, SocialLinks as S, Text as T, ReactRuntime as a, usePageId as b, Button$1 as c, Countdown as d, Divider as e, Embed as f, Root as g, registerComponent$c as h, DEFAULT_BOX_ANIMATE_TYPE as i, DEFAULT_BOX_ANIMATE_DELAY as j, DEFAULT_BOX_ANIMATE_DURATION as k, DEFAULT_ITEM_ANIMATE_TYPE as l, DEFAULT_ITEM_ANIMATE_DELAY as m, DEFAULT_ITEM_ANIMATE_DURATION as n, DEFAULT_ITEM_STAGGER_DURATION as o, cssMediaRules as p, cssWidth as q, registerBuiltinComponents as r, cssMargin as s, cssPadding as t, useIsInBuilder as u, cssBorder as v, cssBorderRadius as w, cssBoxShadow as x, cssGridItem as y, cssTextStyle as z };
|
|
5980
7842
|
//# sourceMappingURL=react.es2.js.map
|