@makeswift/runtime 0.2.2 → 0.2.4
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/dist/Box.cjs.js +14 -14
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Button.cjs.js +23 -23
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Carousel.cjs.js +8 -8
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.cjs.js +13 -13
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Divider.cjs.js +4 -4
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Embed.cjs.js +2 -2
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Form.cjs.js +72 -72
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Image.cjs2.js +10 -10
- package/dist/Image.cjs2.js.map +1 -1
- package/dist/Navigation.cjs.js +17 -17
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Root.cjs.js +2 -2
- package/dist/Root.cjs.js.map +1 -1
- package/dist/SocialLinks.cjs.js +3 -3
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/Text.cjs.js +21 -21
- package/dist/Text.cjs.js.map +1 -1
- package/dist/actions.es.js +1 -1
- package/dist/components.cjs.js +18 -18
- package/dist/cssMediaRules.cjs.js +7 -7
- package/dist/cssMediaRules.cjs.js.map +1 -1
- package/dist/index.cjs.js +374 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs2.js +10 -10
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.cjs3.js +3 -3
- package/dist/index.cjs3.js.map +1 -1
- package/dist/index.es.js +367 -12
- package/dist/index.es.js.map +1 -1
- package/dist/index.es2.js.map +1 -1
- package/dist/next.cjs.js +22 -402
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +12 -388
- package/dist/next.es.js.map +1 -1
- package/dist/react-builder-preview.cjs.js +11 -11
- package/dist/react-builder-preview.cjs.js.map +1 -1
- package/dist/react-builder-preview.es.js +1 -1
- package/dist/react.cjs.js +8 -8
- package/dist/types/src/next/api-handler.d.ts +25 -1
- package/dist/types/src/next/api-handler.d.ts.map +1 -1
- package/dist/types/src/next/index.d.ts +1 -1
- package/dist/types/src/next/index.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/use-style.d.ts.map +1 -1
- package/dist/useBoxShadow.cjs.js +3 -3
- package/dist/useBoxShadow.cjs.js.map +1 -1
- package/dist/useMediaQuery.cjs.js +6 -6
- package/dist/useMediaQuery.cjs.js.map +1 -1
- package/package.json +4 -4
package/dist/Form.cjs.js
CHANGED
|
@@ -35,11 +35,11 @@ var React = require("react");
|
|
|
35
35
|
var styled = require("styled-components");
|
|
36
36
|
var formik = require("formik");
|
|
37
37
|
var cssMediaRules = require("./cssMediaRules.cjs.js");
|
|
38
|
-
var
|
|
38
|
+
var next = require("./index.cjs.js");
|
|
39
39
|
var jsxRuntime = require("react/jsx-runtime");
|
|
40
40
|
var ColorHelper = require("color");
|
|
41
41
|
var Button$1 = require("./Button.cjs.js");
|
|
42
|
-
var index
|
|
42
|
+
var index = require("./index.cjs3.js");
|
|
43
43
|
var boxModels = require("./box-models.cjs.js");
|
|
44
44
|
var client = require("@apollo/client");
|
|
45
45
|
require("use-sync-external-store/shim/with-selector");
|
|
@@ -126,11 +126,11 @@ var SvgCheck12 = function SvgCheck122(props) {
|
|
|
126
126
|
};
|
|
127
127
|
function getSizeHeight$2(size) {
|
|
128
128
|
switch (size) {
|
|
129
|
-
case
|
|
129
|
+
case next.Sizes.SMALL:
|
|
130
130
|
return 30;
|
|
131
|
-
case
|
|
131
|
+
case next.Sizes.MEDIUM:
|
|
132
132
|
return 38;
|
|
133
|
-
case
|
|
133
|
+
case next.Sizes.LARGE:
|
|
134
134
|
return 48;
|
|
135
135
|
default:
|
|
136
136
|
throw new Error(`Invalid form size "${size}"`);
|
|
@@ -138,11 +138,11 @@ function getSizeHeight$2(size) {
|
|
|
138
138
|
}
|
|
139
139
|
function getSizeHorizontalPadding(size) {
|
|
140
140
|
switch (size) {
|
|
141
|
-
case
|
|
141
|
+
case next.Sizes.SMALL:
|
|
142
142
|
return 8;
|
|
143
|
-
case
|
|
143
|
+
case next.Sizes.MEDIUM:
|
|
144
144
|
return 12;
|
|
145
|
-
case
|
|
145
|
+
case next.Sizes.LARGE:
|
|
146
146
|
return 16;
|
|
147
147
|
default:
|
|
148
148
|
throw new Error(`Invalid form size "${size}"`);
|
|
@@ -150,11 +150,11 @@ function getSizeHorizontalPadding(size) {
|
|
|
150
150
|
}
|
|
151
151
|
function getSizeVerticalPadding(size) {
|
|
152
152
|
switch (size) {
|
|
153
|
-
case
|
|
153
|
+
case next.Sizes.SMALL:
|
|
154
154
|
return 3;
|
|
155
|
-
case
|
|
155
|
+
case next.Sizes.MEDIUM:
|
|
156
156
|
return 7;
|
|
157
|
-
case
|
|
157
|
+
case next.Sizes.LARGE:
|
|
158
158
|
return 11;
|
|
159
159
|
default:
|
|
160
160
|
throw new Error(`Invalid form size "${size}"`);
|
|
@@ -162,11 +162,11 @@ function getSizeVerticalPadding(size) {
|
|
|
162
162
|
}
|
|
163
163
|
function getShapeBorderRadius(shape) {
|
|
164
164
|
switch (shape) {
|
|
165
|
-
case
|
|
165
|
+
case next.Shapes.SQUARE:
|
|
166
166
|
return 0;
|
|
167
|
-
case
|
|
167
|
+
case next.Shapes.ROUNDED:
|
|
168
168
|
return 4;
|
|
169
|
-
case
|
|
169
|
+
case next.Shapes.PILL:
|
|
170
170
|
return 500;
|
|
171
171
|
default:
|
|
172
172
|
throw new Error(`Invalid form shape "${shape}"`);
|
|
@@ -174,9 +174,9 @@ function getShapeBorderRadius(shape) {
|
|
|
174
174
|
}
|
|
175
175
|
function getContrastBorderColor(contrast, error) {
|
|
176
176
|
switch (contrast) {
|
|
177
|
-
case
|
|
177
|
+
case next.Contrasts.LIGHT:
|
|
178
178
|
return error ? "rgba(255, 0, 0, 0.7)" : "rgba(0, 0, 0, 0.25)";
|
|
179
|
-
case
|
|
179
|
+
case next.Contrasts.DARK:
|
|
180
180
|
return error ? "rgba(255, 0, 0, 0.7)" : "rgba(255, 255, 255, 0.6)";
|
|
181
181
|
default:
|
|
182
182
|
throw new Error(`Invalid form contrast "${contrast}"`);
|
|
@@ -184,9 +184,9 @@ function getContrastBorderColor(contrast, error) {
|
|
|
184
184
|
}
|
|
185
185
|
function getContrastBackgroundColor(contrast) {
|
|
186
186
|
switch (contrast) {
|
|
187
|
-
case
|
|
187
|
+
case next.Contrasts.LIGHT:
|
|
188
188
|
return "white";
|
|
189
|
-
case
|
|
189
|
+
case next.Contrasts.DARK:
|
|
190
190
|
return "rgba(0, 0, 0, 0.7)";
|
|
191
191
|
default:
|
|
192
192
|
throw new Error(`Invalid form contrast "${contrast}"`);
|
|
@@ -194,9 +194,9 @@ function getContrastBackgroundColor(contrast) {
|
|
|
194
194
|
}
|
|
195
195
|
function getContrastColor$1(contrast) {
|
|
196
196
|
switch (contrast) {
|
|
197
|
-
case
|
|
197
|
+
case next.Contrasts.LIGHT:
|
|
198
198
|
return "rgba(0, 0, 0, 0.95)";
|
|
199
|
-
case
|
|
199
|
+
case next.Contrasts.DARK:
|
|
200
200
|
return "white";
|
|
201
201
|
default:
|
|
202
202
|
throw new Error(`Invalid form contrast "${contrast}"`);
|
|
@@ -204,9 +204,9 @@ function getContrastColor$1(contrast) {
|
|
|
204
204
|
}
|
|
205
205
|
function getContrastPlaceholderColor(contrast) {
|
|
206
206
|
switch (contrast) {
|
|
207
|
-
case
|
|
207
|
+
case next.Contrasts.LIGHT:
|
|
208
208
|
return "rgba(0, 0, 0, 0.3)";
|
|
209
|
-
case
|
|
209
|
+
case next.Contrasts.DARK:
|
|
210
210
|
return "rgba(255,255,255,0.3)";
|
|
211
211
|
default:
|
|
212
212
|
throw new Error(`Invalid form contrast "${contrast}"`);
|
|
@@ -221,9 +221,9 @@ function cssField() {
|
|
|
221
221
|
border-style: solid;
|
|
222
222
|
transition: border-color 200ms;
|
|
223
223
|
${(props) => cssMediaRules.cssMediaRules([props.shape, props.size, props.contrast, props.brandColor], ([
|
|
224
|
-
shape =
|
|
225
|
-
size =
|
|
226
|
-
contrast =
|
|
224
|
+
shape = next.Shapes.ROUNDED,
|
|
225
|
+
size = next.Sizes.MEDIUM,
|
|
226
|
+
contrast = next.Contrasts.LIGHT,
|
|
227
227
|
brandColor = { swatch: { hue: 0, saturation: 0, lightness: 0 }, alpha: 1 }
|
|
228
228
|
]) => styled.css`
|
|
229
229
|
padding: ${getSizeVerticalPadding(size)}px ${getSizeHorizontalPadding(size)}px;
|
|
@@ -234,7 +234,7 @@ function cssField() {
|
|
|
234
234
|
|
|
235
235
|
:focus,
|
|
236
236
|
:focus-within {
|
|
237
|
-
border-color: ${
|
|
237
|
+
border-color: ${next.colorToString(brandColor)};
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
::placeholder {
|
|
@@ -245,11 +245,11 @@ function cssField() {
|
|
|
245
245
|
}
|
|
246
246
|
function getSizeHeight$1(size) {
|
|
247
247
|
switch (size) {
|
|
248
|
-
case
|
|
248
|
+
case next.Sizes.SMALL:
|
|
249
249
|
return 36;
|
|
250
|
-
case
|
|
250
|
+
case next.Sizes.MEDIUM:
|
|
251
251
|
return 42;
|
|
252
|
-
case
|
|
252
|
+
case next.Sizes.LARGE:
|
|
253
253
|
return 48;
|
|
254
254
|
default:
|
|
255
255
|
throw new Error(`Invalid form size "${size}"`);
|
|
@@ -259,7 +259,7 @@ const Base$2 = styled__default["default"].input.withConfig({
|
|
|
259
259
|
shouldForwardProp: (prop, defaultValidator) => !["shape", "size", "contrast", "brandColor", "error"].includes(prop.toString()) && defaultValidator(prop)
|
|
260
260
|
})`
|
|
261
261
|
${cssField()}
|
|
262
|
-
${(props) => cssMediaRules.cssMediaRules([props.size], ([size =
|
|
262
|
+
${(props) => cssMediaRules.cssMediaRules([props.size], ([size = next.Sizes.MEDIUM]) => styled.css`
|
|
263
263
|
min-height: ${getSizeHeight$1(size)}px;
|
|
264
264
|
max-height: ${getSizeHeight$1(size)}px;
|
|
265
265
|
`)}
|
|
@@ -277,7 +277,7 @@ var Input$2 = React.forwardRef(function Input2(_a, ref) {
|
|
|
277
277
|
size,
|
|
278
278
|
contrast,
|
|
279
279
|
brandColor
|
|
280
|
-
} =
|
|
280
|
+
} = next.useFormContext();
|
|
281
281
|
return /* @__PURE__ */ jsxRuntime.jsx(Base$2, __spreadProps(__spreadValues({}, restOfProps), {
|
|
282
282
|
ref,
|
|
283
283
|
error,
|
|
@@ -356,11 +356,11 @@ var Placeholder = React.forwardRef(function Placeholder2({
|
|
|
356
356
|
});
|
|
357
357
|
function getSizeHeight(size) {
|
|
358
358
|
switch (size) {
|
|
359
|
-
case
|
|
359
|
+
case next.Sizes.SMALL:
|
|
360
360
|
return 14;
|
|
361
|
-
case
|
|
361
|
+
case next.Sizes.MEDIUM:
|
|
362
362
|
return 18;
|
|
363
|
-
case
|
|
363
|
+
case next.Sizes.LARGE:
|
|
364
364
|
return 22;
|
|
365
365
|
default:
|
|
366
366
|
throw new Error(`Invalid form size "${size}"`);
|
|
@@ -368,9 +368,9 @@ function getSizeHeight(size) {
|
|
|
368
368
|
}
|
|
369
369
|
function getContrastColor(contrast) {
|
|
370
370
|
switch (contrast) {
|
|
371
|
-
case
|
|
371
|
+
case next.Contrasts.LIGHT:
|
|
372
372
|
return "rgba(0, 0, 0, 0.8)";
|
|
373
|
-
case
|
|
373
|
+
case next.Contrasts.DARK:
|
|
374
374
|
return "rgba(255, 255, 255, 0.95)";
|
|
375
375
|
default:
|
|
376
376
|
throw new Error(`Invalid form contrast "${contrast}"`);
|
|
@@ -382,9 +382,9 @@ const Base$1 = styled__default["default"].label.withConfig({
|
|
|
382
382
|
display: block;
|
|
383
383
|
margin: 0 0 0.25em 0;
|
|
384
384
|
${cssMediaRules.cssTextStyle()}
|
|
385
|
-
${(props) => cssMediaRules.cssMediaRules([props.size, props.contrast, props.textColor], ([size =
|
|
385
|
+
${(props) => cssMediaRules.cssMediaRules([props.size, props.contrast, props.textColor], ([size = next.Sizes.MEDIUM, contrast = next.Contrasts.LIGHT, textColor]) => styled.css`
|
|
386
386
|
min-height: ${getSizeHeight(size)}px;
|
|
387
|
-
color: ${textColor == null ? getContrastColor(contrast) :
|
|
387
|
+
color: ${textColor == null ? getContrastColor(contrast) : next.colorToString(textColor)};
|
|
388
388
|
`)}
|
|
389
389
|
`;
|
|
390
390
|
function Label$1(props) {
|
|
@@ -393,7 +393,7 @@ function Label$1(props) {
|
|
|
393
393
|
size,
|
|
394
394
|
labelTextStyle,
|
|
395
395
|
labelTextColor
|
|
396
|
-
} =
|
|
396
|
+
} = next.useFormContext();
|
|
397
397
|
return /* @__PURE__ */ jsxRuntime.jsx(Base$1, __spreadProps(__spreadValues({}, props), {
|
|
398
398
|
contrast,
|
|
399
399
|
size,
|
|
@@ -448,7 +448,7 @@ var TextArea = React.forwardRef(function TextArea2(_e, ref) {
|
|
|
448
448
|
size,
|
|
449
449
|
contrast,
|
|
450
450
|
brandColor
|
|
451
|
-
} =
|
|
451
|
+
} = next.useFormContext();
|
|
452
452
|
return /* @__PURE__ */ jsxRuntime.jsx(Base, __spreadProps(__spreadValues({}, restOfProps), {
|
|
453
453
|
ref,
|
|
454
454
|
rows: 4,
|
|
@@ -501,7 +501,7 @@ const Container$2 = styled__default["default"].div.withConfig({
|
|
|
501
501
|
shouldForwardProp: (prop) => !["size"].includes(prop)
|
|
502
502
|
})`
|
|
503
503
|
position: relative;
|
|
504
|
-
${(props) => cssMediaRules.cssMediaRules([props.size], ([size =
|
|
504
|
+
${(props) => cssMediaRules.cssMediaRules([props.size], ([size = next.Sizes.MEDIUM]) => styled.css`
|
|
505
505
|
height: ${getSizeHeight(size)}px;
|
|
506
506
|
width: ${getSizeHeight(size)}px;
|
|
507
507
|
`)}
|
|
@@ -516,7 +516,7 @@ const FakeCheckbox = styled__default["default"].div.withConfig({
|
|
|
516
516
|
border-radius: 4px;
|
|
517
517
|
pointer-events: none;
|
|
518
518
|
border-width: 1px;
|
|
519
|
-
${(props) => cssMediaRules.cssMediaRules([props.contrast], ([contrast =
|
|
519
|
+
${(props) => cssMediaRules.cssMediaRules([props.contrast], ([contrast = next.Contrasts.LIGHT]) => styled.css`
|
|
520
520
|
border-color: ${getContrastBorderColor(contrast, props.error)};
|
|
521
521
|
background-color: ${getContrastBackgroundColor(contrast)};
|
|
522
522
|
`)}
|
|
@@ -547,7 +547,7 @@ const HiddenCheckbox = styled__default["default"].input.withConfig({
|
|
|
547
547
|
},
|
|
548
548
|
alpha = 1
|
|
549
549
|
} = {}]) => styled.css`
|
|
550
|
-
background-color: ${
|
|
550
|
+
background-color: ${next.colorToString({
|
|
551
551
|
swatch,
|
|
552
552
|
alpha
|
|
553
553
|
})};
|
|
@@ -560,7 +560,7 @@ const HiddenCheckbox = styled__default["default"].input.withConfig({
|
|
|
560
560
|
box-sizing: content-box;
|
|
561
561
|
width: 25%;
|
|
562
562
|
height: 50%;
|
|
563
|
-
${(props) => cssMediaRules.cssMediaRules([props.size], ([size =
|
|
563
|
+
${(props) => cssMediaRules.cssMediaRules([props.size], ([size = next.Sizes.MEDIUM]) => styled.css`
|
|
564
564
|
border-width: ${getSizeHeight(size) * 0.1}px;
|
|
565
565
|
border-left: 0;
|
|
566
566
|
border-top: 0;
|
|
@@ -593,14 +593,14 @@ const HiddenCheckbox = styled__default["default"].input.withConfig({
|
|
|
593
593
|
},
|
|
594
594
|
alpha: 1
|
|
595
595
|
}]) => styled.css`
|
|
596
|
-
border-color: ${
|
|
596
|
+
border-color: ${next.colorToString(brandColor)};
|
|
597
597
|
`)}
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
600
|
|
|
601
601
|
&:not(:disabled):checked {
|
|
602
602
|
&:focus ~ ${FakeCheckbox} {
|
|
603
|
-
${(props) => cssMediaRules.cssMediaRules([props.contrast], ([contrast =
|
|
603
|
+
${(props) => cssMediaRules.cssMediaRules([props.contrast], ([contrast = next.Contrasts.LIGHT]) => styled.css`
|
|
604
604
|
border-color: ${getContrastBorderColor(contrast, props.error)};
|
|
605
605
|
`)}
|
|
606
606
|
}
|
|
@@ -622,7 +622,7 @@ var Checkbox = React.forwardRef(function Checkbox2(_i, ref) {
|
|
|
622
622
|
size,
|
|
623
623
|
contrast,
|
|
624
624
|
brandColor
|
|
625
|
-
} =
|
|
625
|
+
} = next.useFormContext();
|
|
626
626
|
return /* @__PURE__ */ jsxRuntime.jsxs(Container$2, {
|
|
627
627
|
size,
|
|
628
628
|
children: [/* @__PURE__ */ jsxRuntime.jsx(HiddenCheckbox, __spreadProps(__spreadValues({}, restOfProps), {
|
|
@@ -644,7 +644,7 @@ const StyledLabel$2 = styled__default["default"](Label$1)`
|
|
|
644
644
|
display: flex;
|
|
645
645
|
align-items: center;
|
|
646
646
|
margin: 0;
|
|
647
|
-
${(props) => cssMediaRules.cssMediaRules([props.size], ([size =
|
|
647
|
+
${(props) => cssMediaRules.cssMediaRules([props.size], ([size = next.Sizes.MEDIUM]) => styled.css`
|
|
648
648
|
min-height: ${getSizeHeight$1(size)}px;
|
|
649
649
|
max-height: ${getSizeHeight$1(size)}px;
|
|
650
650
|
`)}
|
|
@@ -670,7 +670,7 @@ var CheckboxTableField = React.forwardRef(function CheckboxTableField2(_k, ref)
|
|
|
670
670
|
]);
|
|
671
671
|
const {
|
|
672
672
|
size
|
|
673
|
-
} =
|
|
673
|
+
} = next.useFormContext();
|
|
674
674
|
function handleChange(event) {
|
|
675
675
|
form.setFieldValue(name, event.currentTarget.checked);
|
|
676
676
|
}
|
|
@@ -770,7 +770,7 @@ const Container$1 = styled__default["default"].div.withConfig({
|
|
|
770
770
|
shouldForwardProp: (prop) => !["size"].includes(prop.toString())
|
|
771
771
|
})`
|
|
772
772
|
position: relative;
|
|
773
|
-
${(props) => cssMediaRules.cssMediaRules([props.size], ([size =
|
|
773
|
+
${(props) => cssMediaRules.cssMediaRules([props.size], ([size = next.Sizes.MEDIUM]) => styled.css`
|
|
774
774
|
height: ${getSizeHeight(size)}px;
|
|
775
775
|
width: ${getSizeHeight(size)}px;
|
|
776
776
|
`)}
|
|
@@ -785,7 +785,7 @@ const FakeRadioButton = styled__default["default"].div.withConfig({
|
|
|
785
785
|
border-radius: 50%;
|
|
786
786
|
pointer-events: none;
|
|
787
787
|
border-width: 1px;
|
|
788
|
-
${(props) => cssMediaRules.cssMediaRules([props.contrast], ([contrast =
|
|
788
|
+
${(props) => cssMediaRules.cssMediaRules([props.contrast], ([contrast = next.Contrasts.LIGHT]) => styled.css`
|
|
789
789
|
border-color: ${getContrastBorderColor(contrast, props.error)};
|
|
790
790
|
background-color: ${getContrastBackgroundColor(contrast)};
|
|
791
791
|
`)}
|
|
@@ -818,7 +818,7 @@ const HiddenRadioButton = styled__default["default"].input.withConfig({
|
|
|
818
818
|
},
|
|
819
819
|
alpha: 1
|
|
820
820
|
}]) => styled.css`
|
|
821
|
-
background-color: ${
|
|
821
|
+
background-color: ${next.colorToString(brandColor)};
|
|
822
822
|
`)}
|
|
823
823
|
border-color: transparent;
|
|
824
824
|
|
|
@@ -855,14 +855,14 @@ const HiddenRadioButton = styled__default["default"].input.withConfig({
|
|
|
855
855
|
},
|
|
856
856
|
alpha: 1
|
|
857
857
|
}]) => styled.css`
|
|
858
|
-
border-color: ${
|
|
858
|
+
border-color: ${next.colorToString(brandColor)};
|
|
859
859
|
`)}
|
|
860
860
|
}
|
|
861
861
|
}
|
|
862
862
|
|
|
863
863
|
&:not(:disabled):checked {
|
|
864
864
|
&:focus ~ ${FakeRadioButton} {
|
|
865
|
-
${(props) => cssMediaRules.cssMediaRules([props.contrast], ([contrast =
|
|
865
|
+
${(props) => cssMediaRules.cssMediaRules([props.contrast], ([contrast = next.Contrasts.LIGHT]) => styled.css`
|
|
866
866
|
border-color: ${getContrastBorderColor(contrast, props.error)};
|
|
867
867
|
`)}
|
|
868
868
|
}
|
|
@@ -884,7 +884,7 @@ var RadioButton = React.forwardRef(function RadioButton2(_o, ref) {
|
|
|
884
884
|
size,
|
|
885
885
|
contrast,
|
|
886
886
|
brandColor
|
|
887
|
-
} =
|
|
887
|
+
} = next.useFormContext();
|
|
888
888
|
return /* @__PURE__ */ jsxRuntime.jsxs(Container$1, {
|
|
889
889
|
size,
|
|
890
890
|
children: [/* @__PURE__ */ jsxRuntime.jsx(HiddenRadioButton, __spreadProps(__spreadValues({}, restOfProps), {
|
|
@@ -972,7 +972,7 @@ const Container = styled__default["default"].div.withConfig({
|
|
|
972
972
|
border-color: #e54e7f;
|
|
973
973
|
}
|
|
974
974
|
|
|
975
|
-
${(props) => cssMediaRules.cssMediaRules([props.size, props.contrast], ([size =
|
|
975
|
+
${(props) => cssMediaRules.cssMediaRules([props.size, props.contrast], ([size = next.Sizes.MEDIUM, contrast = next.Contrasts.LIGHT]) => styled.css`
|
|
976
976
|
min-height: ${getSizeHeight$2(size)}px;
|
|
977
977
|
max-height: ${getSizeHeight$2(size)}px;
|
|
978
978
|
|
|
@@ -1019,7 +1019,7 @@ var TableColumnSingleSelect = React.forwardRef(function TableColumnSingleSelect2
|
|
|
1019
1019
|
size,
|
|
1020
1020
|
contrast,
|
|
1021
1021
|
brandColor
|
|
1022
|
-
} =
|
|
1022
|
+
} = next.useFormContext();
|
|
1023
1023
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1024
1024
|
children: [!hideLabel && /* @__PURE__ */ jsxRuntime.jsx(Label$1, {
|
|
1025
1025
|
htmlFor: id,
|
|
@@ -1181,7 +1181,7 @@ const Label = styled__default["default"].div.withConfig({
|
|
|
1181
1181
|
border-radius: 2px;
|
|
1182
1182
|
background-color: #5f49f4;
|
|
1183
1183
|
opacity: 0.4;
|
|
1184
|
-
${(props) => cssMediaRules.cssMediaRules([props.size], ([size =
|
|
1184
|
+
${(props) => cssMediaRules.cssMediaRules([props.size], ([size = next.Sizes.MEDIUM]) => styled.css`
|
|
1185
1185
|
margin: calc(0.25 * ${getSizeHeight(size)}px + 2px) 0;
|
|
1186
1186
|
min-height: ${0.5 * getSizeHeight(size)}px;
|
|
1187
1187
|
max-height: ${0.5 * getSizeHeight(size)}px;
|
|
@@ -1196,7 +1196,7 @@ const Input = styled__default["default"].div.withConfig({
|
|
|
1196
1196
|
border-style: solid;
|
|
1197
1197
|
border-color: #5f49f4;
|
|
1198
1198
|
opacity: 0.4;
|
|
1199
|
-
${(props) => cssMediaRules.cssMediaRules([props.shape, props.size], ([shape =
|
|
1199
|
+
${(props) => cssMediaRules.cssMediaRules([props.shape, props.size], ([shape = next.Shapes.ROUNDED, size = next.Sizes.MEDIUM]) => styled.css`
|
|
1200
1200
|
min-height: ${getSizeHeight$1(size)}px;
|
|
1201
1201
|
max-height: ${getSizeHeight$1(size)}px;
|
|
1202
1202
|
border-radius: ${getShapeBorderRadius(shape)}px;
|
|
@@ -1206,7 +1206,7 @@ function PlaceholderTableField() {
|
|
|
1206
1206
|
const {
|
|
1207
1207
|
size,
|
|
1208
1208
|
shape
|
|
1209
|
-
} =
|
|
1209
|
+
} = next.useFormContext();
|
|
1210
1210
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1211
1211
|
children: [/* @__PURE__ */ jsxRuntime.jsx(Label, {
|
|
1212
1212
|
size
|
|
@@ -1363,7 +1363,7 @@ function Spinner() {
|
|
|
1363
1363
|
function useTableFormFieldRefs(propController, { fieldsCount }) {
|
|
1364
1364
|
const [container, setContainer] = React.useState(null);
|
|
1365
1365
|
const [items, setItems] = React.useState(Array(fieldsCount + 1).fill(null));
|
|
1366
|
-
const isInBuilder =
|
|
1366
|
+
const isInBuilder = next.useIsInBuilder();
|
|
1367
1367
|
React.useEffect(() => {
|
|
1368
1368
|
if (!isInBuilder)
|
|
1369
1369
|
return;
|
|
@@ -1392,11 +1392,11 @@ function useTableFormFieldRefs(propController, { fieldsCount }) {
|
|
|
1392
1392
|
const LOCAL_STORAGE_NAMESPACE = "@@makeswift/components/form";
|
|
1393
1393
|
function getSizeFontSize(size) {
|
|
1394
1394
|
switch (size) {
|
|
1395
|
-
case
|
|
1395
|
+
case next.Sizes.SMALL:
|
|
1396
1396
|
return 12;
|
|
1397
|
-
case
|
|
1397
|
+
case next.Sizes.MEDIUM:
|
|
1398
1398
|
return 14;
|
|
1399
|
-
case
|
|
1399
|
+
case next.Sizes.LARGE:
|
|
1400
1400
|
return 18;
|
|
1401
1401
|
default:
|
|
1402
1402
|
throw new Error(`Invalid form size "${size}"`);
|
|
@@ -1408,7 +1408,7 @@ const GridForm = styled__default["default"].form.withConfig({
|
|
|
1408
1408
|
display: flex;
|
|
1409
1409
|
flex-wrap: wrap;
|
|
1410
1410
|
width: 100%;
|
|
1411
|
-
${(props) => cssMediaRules.cssMediaRules([props.size], ([size =
|
|
1411
|
+
${(props) => cssMediaRules.cssMediaRules([props.size], ([size = next.Sizes.MEDIUM]) => styled.css`
|
|
1412
1412
|
font-size: ${getSizeFontSize(size)}px;
|
|
1413
1413
|
`)}
|
|
1414
1414
|
${cssMediaRules.cssWidth()}
|
|
@@ -1423,9 +1423,9 @@ const GridItem = styled__default["default"].div.withConfig({
|
|
|
1423
1423
|
`;
|
|
1424
1424
|
function getAlignmentMargin(alignment) {
|
|
1425
1425
|
switch (alignment) {
|
|
1426
|
-
case
|
|
1426
|
+
case next.Alignments.LEFT:
|
|
1427
1427
|
return "0 auto 0 0";
|
|
1428
|
-
case
|
|
1428
|
+
case next.Alignments.RIGHT:
|
|
1429
1429
|
return "0 0 0 auto";
|
|
1430
1430
|
default:
|
|
1431
1431
|
return "0 auto";
|
|
@@ -1439,7 +1439,7 @@ const StyledButton = styled__default["default"]((props) => /* @__PURE__ */ jsxRu
|
|
|
1439
1439
|
display: flex;
|
|
1440
1440
|
align-items: center;
|
|
1441
1441
|
justify-content: center;
|
|
1442
|
-
${(props) => cssMediaRules.cssMediaRules([props.size, props.alignment], ([size =
|
|
1442
|
+
${(props) => cssMediaRules.cssMediaRules([props.size, props.alignment], ([size = next.Sizes.MEDIUM, alignment = next.Alignments.CENTER]) => styled.css`
|
|
1443
1443
|
min-height: ${getSizeHeight$1(size)}px;
|
|
1444
1444
|
max-height: ${getSizeHeight$1(size)}px;
|
|
1445
1445
|
margin: ${getAlignmentMargin(alignment)};
|
|
@@ -1520,13 +1520,13 @@ const Form = React.forwardRef(function Form2({
|
|
|
1520
1520
|
data: {
|
|
1521
1521
|
table
|
|
1522
1522
|
} = {}
|
|
1523
|
-
} =
|
|
1523
|
+
} = next.useQuery(next.TABLE_BY_ID, {
|
|
1524
1524
|
skip: tableId == null,
|
|
1525
1525
|
variables: {
|
|
1526
1526
|
id: tableId
|
|
1527
1527
|
}
|
|
1528
1528
|
});
|
|
1529
|
-
const [createTableRecord] =
|
|
1529
|
+
const [createTableRecord] = next.useMutation(CREATE_TABLE_RECORD);
|
|
1530
1530
|
const [refEl, setRefEl] = React.useState(null);
|
|
1531
1531
|
const [propControllers, setPropControllers] = React.useState(null);
|
|
1532
1532
|
const [initialValues, setInitialValues] = React.useState(() => fields.reduce((acc, formField) => {
|
|
@@ -1638,7 +1638,7 @@ const Form = React.forwardRef(function Form2({
|
|
|
1638
1638
|
return acc;
|
|
1639
1639
|
}, __spreadValues({}, prev)));
|
|
1640
1640
|
}, [fields, table]);
|
|
1641
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1641
|
+
return /* @__PURE__ */ jsxRuntime.jsx(next.Provider, {
|
|
1642
1642
|
value: {
|
|
1643
1643
|
shape,
|
|
1644
1644
|
size,
|
|
@@ -1716,7 +1716,7 @@ const Form = React.forwardRef(function Form2({
|
|
|
1716
1716
|
})]
|
|
1717
1717
|
})]
|
|
1718
1718
|
})]
|
|
1719
|
-
}), submitLink != null && /* @__PURE__ */ jsxRuntime.jsx(index
|
|
1719
|
+
}), submitLink != null && /* @__PURE__ */ jsxRuntime.jsx(index.Link, {
|
|
1720
1720
|
ref: linkRef,
|
|
1721
1721
|
hidden: true,
|
|
1722
1722
|
link: submitLink
|