quicksnack 3.32.0 → 3.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/bundle.min.js +909 -0
  2. package/dist/index.d.ts +4 -3
  3. package/package.json +7 -3
  4. package/dist/UiProvider.js +0 -18
  5. package/dist/UiStateProvider.js +0 -47
  6. package/dist/UiWrapper.js +0 -23
  7. package/dist/animation/SlideInFromTop/SlideInFromTop.js +0 -38
  8. package/dist/animation/SlideOpen/SlideOpen.js +0 -52
  9. package/dist/components/Alert/Alert.js +0 -27
  10. package/dist/components/AnimatedCheckmark/AnimatedCheckmark.js +0 -50
  11. package/dist/components/Box/Box.js +0 -57
  12. package/dist/components/BreadCrumbs/BreadCrumbs.js +0 -14
  13. package/dist/components/CollapsiblePanel/CollapsiblePanel.js +0 -73
  14. package/dist/components/ConfirmButton/ConfirmButton.js +0 -44
  15. package/dist/components/ConfirmModal/ConfirmModal.js +0 -16
  16. package/dist/components/ConfirmModal/hooks/useConfirmModal.js +0 -26
  17. package/dist/components/Details/Details.js +0 -49
  18. package/dist/components/Dropdown/Dropdown.js +0 -79
  19. package/dist/components/Dropzone/Dropzone.js +0 -102
  20. package/dist/components/Feedback/Feedback.js +0 -31
  21. package/dist/components/Floater/Floater.js +0 -48
  22. package/dist/components/Floater/FloaterItem.js +0 -39
  23. package/dist/components/Footer/Footer.js +0 -21
  24. package/dist/components/HorizontalScroller/HorizontalScroller.js +0 -20
  25. package/dist/components/Menu/HamburgerButton.js +0 -15
  26. package/dist/components/Menu/Menu.js +0 -48
  27. package/dist/components/Menu/MenuCloseButton.js +0 -15
  28. package/dist/components/Menu/MenuSlideOpenIndicator.js +0 -22
  29. package/dist/components/Menu/SideBar.js +0 -59
  30. package/dist/components/Menu/SideBarHeader.js +0 -48
  31. package/dist/components/Menu/useCloseSidebarOnNavigate.js +0 -15
  32. package/dist/components/Menu/useToggleMobileMenu.js +0 -30
  33. package/dist/components/Modal/Modal.js +0 -51
  34. package/dist/components/Overlay/Overlay.js +0 -34
  35. package/dist/components/Paginator/Paginator.js +0 -41
  36. package/dist/components/Panel/Panel.js +0 -54
  37. package/dist/components/Section/Section.js +0 -22
  38. package/dist/components/Statistic/Statistic.js +0 -28
  39. package/dist/components/Table/Table.js +0 -83
  40. package/dist/components/Tabs/Tab.js +0 -70
  41. package/dist/components/Tabs/TabContent.js +0 -28
  42. package/dist/components/Tabs/Tabs.js +0 -14
  43. package/dist/components/Timeline/Timeline.js +0 -39
  44. package/dist/components/TopBar/TopBar.js +0 -24
  45. package/dist/fonts.js +0 -17
  46. package/dist/form/Button/Button.js +0 -85
  47. package/dist/form/Checkbox/Checkbox.js +0 -73
  48. package/dist/form/FileField/FileField.js +0 -98
  49. package/dist/form/PasswordStrengthField/PasswordStrenghField.js +0 -86
  50. package/dist/form/ScaffoldForm/FormGrid/FormGrid.js +0 -42
  51. package/dist/form/ScaffoldForm/FormGrid/FormGridCell.js +0 -69
  52. package/dist/form/ScaffoldForm/FormGrid/FormGridWrapper.js +0 -38
  53. package/dist/form/ScaffoldForm/ScaffoldField.js +0 -67
  54. package/dist/form/ScaffoldForm/ScaffoldForm.js +0 -44
  55. package/dist/form/ScaffoldForm/ScaffoldFormProvider.js +0 -13
  56. package/dist/form/ScaffoldForm/hooks/useScaffoldFormContext.js +0 -7
  57. package/dist/form/ScaffoldForm/scaffoldFormProps.js +0 -91
  58. package/dist/form/ScaffoldForm/scaffoldPasswordProps.js +0 -22
  59. package/dist/form/ScaffoldForm/types.js +0 -2
  60. package/dist/form/ScaffoldForm/utils/FormPositioner.js +0 -102
  61. package/dist/form/ScaffoldForm/utils/Grid.js +0 -64
  62. package/dist/form/ScaffoldForm/utils/Grid.test.js +0 -40
  63. package/dist/form/ScaffoldForm/utils/assertGridIsValid.js +0 -37
  64. package/dist/form/ScaffoldForm/utils/assertGridIsValid.test.js +0 -55
  65. package/dist/form/ScaffoldForm/utils/equalColumns.js +0 -20
  66. package/dist/form/Select/Select.js +0 -51
  67. package/dist/form/TextField/TextField.js +0 -68
  68. package/dist/index.js +0 -74
  69. package/dist/layouts/BasicLayout/BasicLayout.js +0 -47
  70. package/dist/layouts/FloatingPanelLayout/FloatingPanelLayout.js +0 -45
  71. package/dist/layouts/constants.js +0 -5
  72. package/dist/responsiveness/responsiveProps.js +0 -87
  73. package/dist/responsiveness/useResponsiveBreakpoints.js +0 -24
  74. package/dist/theme.js +0 -164
  75. package/dist/typography/Fonts.js +0 -19
  76. package/dist/typography/Header/Header.js +0 -79
  77. package/dist/typography/Paragraph/Paragraph.js +0 -13
@@ -1,13 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ScaffoldFormProvider = exports.ScaffoldFormContext = void 0;
7
- var react_1 = __importDefault(require("react"));
8
- exports.ScaffoldFormContext = react_1.default.createContext({ factory: undefined });
9
- var ScaffoldFormProvider = function (_a) {
10
- var factory = _a.factory, children = _a.children;
11
- return (react_1.default.createElement(exports.ScaffoldFormContext.Provider, { value: { factory: factory } }, children));
12
- };
13
- exports.ScaffoldFormProvider = ScaffoldFormProvider;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useScaffoldFormContext = void 0;
4
- var react_1 = require("react");
5
- var ScaffoldFormProvider_1 = require("../ScaffoldFormProvider");
6
- var useScaffoldFormContext = function () { return (0, react_1.useContext)(ScaffoldFormProvider_1.ScaffoldFormContext); };
7
- exports.useScaffoldFormContext = useScaffoldFormContext;
@@ -1,91 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.scaffoldFormProps = void 0;
4
- var FormPositioner_1 = require("./utils/FormPositioner");
5
- exports.scaffoldFormProps = new FormPositioner_1.FormPositioner({
6
- firstName: {
7
- type: "TextField",
8
- props: {
9
- label: "First name",
10
- }
11
- },
12
- prefix: {
13
- type: "TextField",
14
- props: {
15
- label: "Last name",
16
- isRequired: true,
17
- hint: "Integer posuere erat a ante venenatis dapibus posuere velit aliquet.",
18
- }
19
- },
20
- lastName: {
21
- type: "TextField",
22
- props: {
23
- label: "Last name",
24
- hint: "Donec sed odio dui.",
25
- error: "Something went wrong!",
26
- }
27
- },
28
- avatar: {
29
- type: "FileField",
30
- props: {
31
- label: "Avatar",
32
- placeholder: "Please choose a file",
33
- }
34
- },
35
- description: {
36
- type: "TextField",
37
- props: {
38
- label: "Description",
39
- multiline: true
40
- }
41
- },
42
- toppings: {
43
- type: "Checkbox",
44
- props: {
45
- label: "Toppings",
46
- error: "Something went wrong!",
47
- options: {
48
- tomato: "Tomato sauce",
49
- cheese: "Cheese",
50
- pineapple: "Pineapple",
51
- pepperoni: "Pepperoni",
52
- }
53
- }
54
- },
55
- crust: {
56
- type: "Select",
57
- props: {
58
- label: "Crust",
59
- // error: "Something went wrong!",
60
- options: {
61
- plain: "Plain",
62
- wholeWheat: "Whole wheat",
63
- cheese: "Cheese",
64
- }
65
- }
66
- },
67
- terms: {
68
- type: "Checkbox",
69
- props: {
70
- options: { agree: "I agree to the terms of usage" }
71
- }
72
- },
73
- submit: {
74
- type: "Button",
75
- props: {
76
- children: "Submit",
77
- variant: "primary"
78
- }
79
- }
80
- })
81
- .setVertical('mobile')
82
- .setGrid('tablet', '1fr 1fr', [
83
- ['firstName', 'lastName'],
84
- ['description', 'avatar'],
85
- ['description', 'prefix'],
86
- ['description', 'toppings'],
87
- ['description', 'crust'],
88
- ['terms', 'terms'],
89
- ['submit']
90
- ])
91
- .getScaffoldProps();
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.scaffoldPasswordProps = void 0;
4
- var FormPositioner_1 = require("./utils/FormPositioner");
5
- exports.scaffoldPasswordProps = new FormPositioner_1.FormPositioner({
6
- password: {
7
- type: "PasswordStrengthField",
8
- props: {
9
- type: 'password',
10
- label: "Password",
11
- }
12
- },
13
- prefix: {
14
- type: "TextField",
15
- props: {
16
- type: 'password',
17
- label: "Repeat password",
18
- }
19
- },
20
- })
21
- .setVertical('mobile')
22
- .getScaffoldProps();
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,102 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FormPositioner = void 0;
7
- var immer_1 = __importDefault(require("immer"));
8
- var lodash_chunk_1 = __importDefault(require("lodash.chunk"));
9
- var Grid_1 = require("./Grid");
10
- var assertGridIsValid_1 = require("./assertGridIsValid");
11
- var responsiveProps_1 = require("../../../responsiveness/responsiveProps");
12
- var equalColumns_1 = require("./equalColumns");
13
- var FormPositioner = /** @class */ (function () {
14
- function FormPositioner(fields, columns // -> ignore property, its used to pass along internally.
15
- ) {
16
- if (columns === void 0) { columns = {}; }
17
- this.fields = fields;
18
- this.columns = columns;
19
- }
20
- /**
21
- * Position form elements responsively in a grid.
22
- * Example usage:
23
- *
24
- *
25
- * .setGrid("laptop", [ // Breakpoint from laptop to bigger
26
- * ["title", "title", "title"], // NOTE: title has a colspan of 3
27
- * ["street", "number", "city"],
28
- * ["code", "description", "description"], // NOTE: description has a colspan of 2, and a rowspan of 2
29
- * ["status", "description", "description"]
30
- * ])
31
- * .setVertical("mobileS", 1) // NOTE: align everything in a single column for mobileS until laptop
32
- *
33
- */
34
- FormPositioner.prototype.setGrid = function (breakPoint, columns, arrayGrid) {
35
- var _this = this;
36
- // We save the columns setting in a different prop.
37
- if (typeof this.columns === "object") {
38
- this.columns[breakPoint] = columns;
39
- }
40
- // Wrap array grid in a Grid object.
41
- // It has some nice utility functions to work with.
42
- var grid = new Grid_1.Grid(arrayGrid);
43
- // Make sure the given grid is a valid grid:
44
- (0, assertGridIsValid_1.assertGridIsValid)(Object.keys(this.fields), grid);
45
- // Update position attributes for the given fields:
46
- var fields = (0, immer_1.default)(this.fields, function (draftState) {
47
- Object
48
- .keys(_this.fields)
49
- .forEach(function (key) {
50
- var fieldProps = draftState[key].props;
51
- var _a = grid.getCoordinatesForValue(key), topLeft = _a.topLeft, bottomRight = _a.bottomRight;
52
- if (fieldProps.position === undefined) {
53
- fieldProps.position = {};
54
- }
55
- if (!(0, responsiveProps_1.isResponsiveObject)(fieldProps.position)) {
56
- // When there already was a position set, but it wasn't marked responsive,
57
- // We set that value to the lowest breakpoint:
58
- fieldProps.position = { mobile: fieldProps.position };
59
- }
60
- // Set values to breakpoint.
61
- // @ts-ignore
62
- fieldProps.position[breakPoint] = {
63
- column: topLeft.x,
64
- columnSpan: bottomRight.x - topLeft.x + 1,
65
- row: topLeft.y,
66
- rowSpan: bottomRight.y - topLeft.y + 1
67
- };
68
- });
69
- });
70
- // Return a new formPositioner.
71
- // It allows us to chain, while still being immutable.
72
- return new FormPositioner(fields, this.columns);
73
- };
74
- /**
75
- * Aligns all input-fields vertically.
76
- */
77
- FormPositioner.prototype.setVertical = function (breakPoint, numColumns, columns) {
78
- if (numColumns === void 0) { numColumns = 1; }
79
- return this.setGrid(breakPoint, columns !== null && columns !== void 0 ? columns : (0, equalColumns_1.equalColumns)(numColumns, false), (0, lodash_chunk_1.default)(Object.keys(this.fields), numColumns));
80
- };
81
- /**
82
- * Aligns all input-fields horizontally.
83
- */
84
- FormPositioner.prototype.setHorizontal = function (breakPoint, columns) {
85
- var keys = Object.keys(this.fields);
86
- return this.setGrid(breakPoint, columns !== null && columns !== void 0 ? columns : (0, equalColumns_1.equalColumns)(keys.length, false), [keys]);
87
- };
88
- FormPositioner.prototype.getColumns = function () {
89
- return this.columns;
90
- };
91
- FormPositioner.prototype.getFields = function () {
92
- return this.fields;
93
- };
94
- FormPositioner.prototype.getScaffoldProps = function () {
95
- return {
96
- fields: this.fields,
97
- columns: this.columns
98
- };
99
- };
100
- return FormPositioner;
101
- }());
102
- exports.FormPositioner = FormPositioner;
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Grid = void 0;
4
- /**
5
- * Two dimensional array grid.
6
- * Useful to position elements with.
7
- *
8
- * Example:
9
- *
10
- * new Grid([
11
- * [1,2,3],
12
- * [4,5,6],
13
- * [7,8,9]
14
- * ])
15
- *
16
- */
17
- var Grid = /** @class */ (function () {
18
- function Grid(grid) {
19
- this.grid = grid;
20
- }
21
- Grid.prototype.getValues = function () {
22
- return this.grid;
23
- };
24
- /**
25
- * Returns an array of distinct values in this grid
26
- */
27
- Grid.prototype.getDistinctValues = function () {
28
- var values = [];
29
- this.grid.forEach(function (row) {
30
- row.forEach(function (item) {
31
- if (!values.includes(item)) {
32
- values.push(item);
33
- }
34
- });
35
- });
36
- return values;
37
- };
38
- Grid.prototype.sliceArea = function (topLeft, bottomRight) {
39
- if (topLeft.x > bottomRight.x || topLeft.y > bottomRight.y) {
40
- throw new Error("Coordinates are mixed up. Please ensure topLeft is actually in the top-left corner. And bottomRight is actually in the bottom-right corner");
41
- }
42
- return new Grid(this.grid
43
- .slice(topLeft.y, bottomRight.y + 1)
44
- .map(function (row) { return row.slice(topLeft.x, bottomRight.x + 1); }));
45
- };
46
- Grid.prototype.getCoordinatesForValue = function (value) {
47
- var x = [];
48
- var y = [];
49
- this.grid.forEach(function (row, yIndex) {
50
- row.forEach(function (item, xIndex) {
51
- if (item === value) {
52
- x.push(xIndex);
53
- y.push(yIndex);
54
- }
55
- });
56
- });
57
- return {
58
- topLeft: { x: Math.min.apply(Math, x), y: Math.min.apply(Math, y) },
59
- bottomRight: { x: Math.max.apply(Math, x), y: Math.max.apply(Math, y) }
60
- };
61
- };
62
- return Grid;
63
- }());
64
- exports.Grid = Grid;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var Grid_1 = require("./Grid");
4
- describe("Grid", function () {
5
- var grid = new Grid_1.Grid([
6
- ["one", "two", "two"],
7
- ["three", "two", "two"],
8
- ["four", "four", "four"],
9
- ]);
10
- it("should return all distinct values", function () {
11
- expect(grid.getDistinctValues())
12
- .toEqual(["one", "two", "three", "four"]);
13
- });
14
- it("should slice a new grid based on given coordinates", function () {
15
- var twos = grid.sliceArea({ x: 1, y: 0 }, { x: 2, y: 1 });
16
- expect(twos.getValues()).toEqual([
17
- ["two", "two"],
18
- ["two", "two"],
19
- ]);
20
- var fours = grid.sliceArea({ x: 0, y: 2 }, { x: 2, y: 2 });
21
- expect(fours.getValues()).toEqual([
22
- ["four", "four", "four"],
23
- ]);
24
- var slicedArea = grid.sliceArea({ x: 0, y: 1 }, { x: 1, y: 2 });
25
- expect(slicedArea.getValues()).toEqual([
26
- ["three", "two"],
27
- ["four", "four"],
28
- ]);
29
- });
30
- it("get coordinates for values", function () {
31
- expect(grid.getCoordinatesForValue("one"))
32
- .toEqual({ topLeft: { x: 0, y: 0 }, bottomRight: { x: 0, y: 0 } });
33
- expect(grid.getCoordinatesForValue("two"))
34
- .toEqual({ topLeft: { x: 1, y: 0 }, bottomRight: { x: 2, y: 1 } });
35
- expect(grid.getCoordinatesForValue("three"))
36
- .toEqual({ topLeft: { x: 0, y: 1 }, bottomRight: { x: 0, y: 1 } });
37
- expect(grid.getCoordinatesForValue("four"))
38
- .toEqual({ topLeft: { x: 0, y: 2 }, bottomRight: { x: 2, y: 2 } });
39
- });
40
- });
@@ -1,37 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.assertGridIsValid = void 0;
7
- var lodash_difference_1 = __importDefault(require("lodash.difference"));
8
- /**
9
- * Makes sure all values in the grid have a rectangular shape.
10
- * We don't support Tetris types.
11
- */
12
- var assertGridIsValid = function (availableKeys, grid) {
13
- var distinctValues = grid.getDistinctValues();
14
- // Check if all `availableKeys` have a place in the given grid
15
- if (distinctValues.length < availableKeys.length) {
16
- throw new Error("Not all given fields are present in the grid. Please add these fields ".concat((0, lodash_difference_1.default)(distinctValues, availableKeys).map(function (_) { return "\"".concat(_, "\""); }).join(", ")));
17
- }
18
- // We don't support tetris-shaped values:
19
- // E.g:
20
- // [
21
- // [1,1,1],
22
- // [0,1,0]
23
- // ]
24
- distinctValues.forEach(function (value) {
25
- if (!availableKeys.includes(value)) {
26
- throw new Error("".concat(value, " is not an existing field. Existing fields are ").concat(availableKeys.map(function (_) { return "\"".concat(_, "\""); }).join(", "), "."));
27
- }
28
- var coordinates = grid.getCoordinatesForValue(value);
29
- var subGrid = grid.sliceArea(coordinates.topLeft, coordinates.bottomRight);
30
- var subGridDistinctValues = subGrid.getDistinctValues();
31
- if (subGridDistinctValues.length !== 1 || subGridDistinctValues[0] !== value) {
32
- throw new Error("Grid contains an unsupported shape. Please make sure \"".concat(value, "\" has a rectangular shape."));
33
- }
34
- });
35
- return true;
36
- };
37
- exports.assertGridIsValid = assertGridIsValid;
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var Grid_1 = require("./Grid");
4
- var assertGridIsValid_1 = require("./assertGridIsValid");
5
- describe("isGridValid", function () {
6
- var availableKeys = ["one", "two", "three", "four"];
7
- describe("when given a valid grid", function () {
8
- var grid = new Grid_1.Grid([
9
- ["one", "two", "two"],
10
- ["three", "two", "two"],
11
- ["four", "four", "four"],
12
- ]);
13
- it("should return true", function () {
14
- expect((0, assertGridIsValid_1.assertGridIsValid)(availableKeys, grid)).toEqual(true);
15
- });
16
- });
17
- describe("when given an empty grid", function () {
18
- // Two is not rectangular shaped:
19
- var grid = new Grid_1.Grid([]);
20
- it("should throw an error", function () {
21
- expect(function () { return (0, assertGridIsValid_1.assertGridIsValid)(availableKeys, grid); }).toThrowError(expect.anything());
22
- });
23
- });
24
- describe("when not given all available fields", function () {
25
- // Two is not rectangular shaped:
26
- var grid = new Grid_1.Grid([
27
- ["one", "two", "three"],
28
- ]);
29
- it("should throw an error", function () {
30
- expect(function () { return (0, assertGridIsValid_1.assertGridIsValid)(availableKeys, grid); }).toThrowError(expect.anything());
31
- });
32
- });
33
- describe("when given a tetris shaped area in the grid", function () {
34
- // Two is not rectangular shaped:
35
- var grid = new Grid_1.Grid([
36
- ["one", "two", "two"],
37
- ["three", "two", "five"],
38
- ["four", "four", "four"],
39
- ]);
40
- it("should throw an error", function () {
41
- expect(function () { return (0, assertGridIsValid_1.assertGridIsValid)(availableKeys, grid); }).toThrowError(expect.anything());
42
- });
43
- });
44
- describe("when given an unknown key", function () {
45
- // Two is not rectangular shaped:
46
- var grid = new Grid_1.Grid([
47
- ["one_unknown", "two", "two"],
48
- ["three", "two", "two"],
49
- ["four", "four", "four"],
50
- ]);
51
- it("should throw an error", function () {
52
- expect(function () { return (0, assertGridIsValid_1.assertGridIsValid)(availableKeys, grid); }).toThrowError(expect.anything());
53
- });
54
- });
55
- });
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
7
- }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.equalColumns = void 0;
13
- var equalColumns = function (num, buttonGutter) {
14
- var fractions = __spreadArray([], Array(num), true).map(function (_) { return "1fr"; });
15
- if (buttonGutter) {
16
- fractions.push("auto");
17
- }
18
- return fractions.join(" ");
19
- };
20
- exports.equalColumns = equalColumns;
@@ -1,51 +0,0 @@
1
- "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- var __assign = (this && this.__assign) || function () {
7
- __assign = Object.assign || function(t) {
8
- for (var s, i = 1, n = arguments.length; i < n; i++) {
9
- s = arguments[i];
10
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
- t[p] = s[p];
12
- }
13
- return t;
14
- };
15
- return __assign.apply(this, arguments);
16
- };
17
- var __rest = (this && this.__rest) || function (s, e) {
18
- var t = {};
19
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
20
- t[p] = s[p];
21
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
22
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
23
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
24
- t[p[i]] = s[p[i]];
25
- }
26
- return t;
27
- };
28
- var __importDefault = (this && this.__importDefault) || function (mod) {
29
- return (mod && mod.__esModule) ? mod : { "default": mod };
30
- };
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.Select = void 0;
33
- var react_1 = __importDefault(require("react"));
34
- var styled_components_1 = __importDefault(require("styled-components"));
35
- var is_prop_valid_1 = __importDefault(require("@emotion/is-prop-valid"));
36
- var Wrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n"], ["\n position: relative;\n"])));
37
- var StyledSelect = styled_components_1.default.select.withConfig({ shouldForwardProp: is_prop_valid_1.default })(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n\n padding: .67857143em 1em;\n line-height: 1.21428571em;\n border-radius: 4px;\n border: 1px solid rgba(34,36,38,.15); \n \n color: ", ";\n font-family: Lato, \"Helvetica Neue\", Arial, Helvetica, sans-serif;\n \n font-size: 1em;\n outline: none; \n \n appearance: none;\n \n &.error {\n background: #fff6f6;\n border-color: #e0b4b4;\n color: #9f3a38;\n }\n \n &.error~div {\n color: #9f3a38;\n } \n"], ["\n width: 100%;\n\n padding: .67857143em 1em;\n line-height: 1.21428571em;\n border-radius: 4px;\n border: 1px solid rgba(34,36,38,.15); \n \n color: ", ";\n font-family: Lato, \"Helvetica Neue\", Arial, Helvetica, sans-serif;\n \n font-size: 1em;\n outline: none; \n \n appearance: none;\n \n &.error {\n background: #fff6f6;\n border-color: #e0b4b4;\n color: #9f3a38;\n }\n \n &.error~div {\n color: #9f3a38;\n } \n"])), function (props) { return props.theme.palette.common.black; });
38
- var PaddingOverlay = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n pointer-events: none;\n padding: 0 1em;\n position:absolute; \n height: 100%;\n top: 0;\n right: 0; \n font-size: 17px;\n line-height: 40px;\n"], ["\n pointer-events: none;\n padding: 0 1em;\n position:absolute; \n height: 100%;\n top: 0;\n right: 0; \n font-size: 17px;\n line-height: 40px;\n"])));
39
- exports.Select = react_1.default.forwardRef(function (_a, ref) {
40
- var options = _a.options, props = __rest(_a, ["options"]);
41
- var optionsArray = Array.isArray(options)
42
- ? options
43
- : Object.entries(options);
44
- return (react_1.default.createElement(Wrapper, null,
45
- react_1.default.createElement(StyledSelect, __assign({ ref: ref }, props), optionsArray.map(function (_a) {
46
- var value = _a[0], label = _a[1];
47
- return (react_1.default.createElement("option", { key: value, value: value }, label));
48
- })),
49
- react_1.default.createElement(PaddingOverlay, null, "\u25BE")));
50
- });
51
- var templateObject_1, templateObject_2, templateObject_3;
@@ -1,68 +0,0 @@
1
- "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- var __assign = (this && this.__assign) || function () {
7
- __assign = Object.assign || function(t) {
8
- for (var s, i = 1, n = arguments.length; i < n; i++) {
9
- s = arguments[i];
10
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
- t[p] = s[p];
12
- }
13
- return t;
14
- };
15
- return __assign.apply(this, arguments);
16
- };
17
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- var desc = Object.getOwnPropertyDescriptor(m, k);
20
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
- desc = { enumerable: true, get: function() { return m[k]; } };
22
- }
23
- Object.defineProperty(o, k2, desc);
24
- }) : (function(o, m, k, k2) {
25
- if (k2 === undefined) k2 = k;
26
- o[k2] = m[k];
27
- }));
28
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
- Object.defineProperty(o, "default", { enumerable: true, value: v });
30
- }) : function(o, v) {
31
- o["default"] = v;
32
- });
33
- var __importStar = (this && this.__importStar) || function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- var __rest = (this && this.__rest) || function (s, e) {
41
- var t = {};
42
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
43
- t[p] = s[p];
44
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
45
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
46
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
47
- t[p[i]] = s[p[i]];
48
- }
49
- return t;
50
- };
51
- var __importDefault = (this && this.__importDefault) || function (mod) {
52
- return (mod && mod.__esModule) ? mod : { "default": mod };
53
- };
54
- Object.defineProperty(exports, "__esModule", { value: true });
55
- exports.TextField = void 0;
56
- var react_1 = __importDefault(require("react"));
57
- var styled_components_1 = __importStar(require("styled-components"));
58
- var is_prop_valid_1 = __importDefault(require("@emotion/is-prop-valid"));
59
- var sharedStyles = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: .67857143em 1em;\n line-height: 1.21428571em;\n border-radius: 4px;\n border: 1px solid rgba(34,36,38,.15); \n \n color: ", ";\n font-family: Lato, \"Helvetica Neue\", Arial, Helvetica, sans-serif;\n \n font-size: 1em;\n outline: none;\n \n &:disabled, &:read-only {\n background-color: #FAFAFA;\n }\n \n &:focus {\n color: rgba(0,0,0,.95);\n border-color: #85b7d9; \n background: #fff;\n box-shadow: 0 0 0 0 rgba(34,36,38,.35) inset;\n }\n \n &.error {\n background: #fff6f6;\n border-color: #e0b4b4;\n color: #9f3a38;\n } \n \n &.error:focus {\n background: #fff6f6;\n }\n \n &:focus::placeholder {\n color:rgba(115,115,115,.87) \n }\n \n &::placeholder {\n color:rgba(191,191,191,.87); \n }\n \n &.error::placeholder {\n color: #e7bdbc;\n }\n \n &.error:focus::placeholder {\n color: #da9796;\n } \n"], ["\n padding: .67857143em 1em;\n line-height: 1.21428571em;\n border-radius: 4px;\n border: 1px solid rgba(34,36,38,.15); \n \n color: ", ";\n font-family: Lato, \"Helvetica Neue\", Arial, Helvetica, sans-serif;\n \n font-size: 1em;\n outline: none;\n \n &:disabled, &:read-only {\n background-color: #FAFAFA;\n }\n \n &:focus {\n color: rgba(0,0,0,.95);\n border-color: #85b7d9; \n background: #fff;\n box-shadow: 0 0 0 0 rgba(34,36,38,.35) inset;\n }\n \n &.error {\n background: #fff6f6;\n border-color: #e0b4b4;\n color: #9f3a38;\n } \n \n &.error:focus {\n background: #fff6f6;\n }\n \n &:focus::placeholder {\n color:rgba(115,115,115,.87) \n }\n \n &::placeholder {\n color:rgba(191,191,191,.87); \n }\n \n &.error::placeholder {\n color: #e7bdbc;\n }\n \n &.error:focus::placeholder {\n color: #da9796;\n } \n"])), function (props) { return props.theme.palette.common.black; });
60
- var Input = styled_components_1.default.input.withConfig({ shouldForwardProp: is_prop_valid_1.default })(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), sharedStyles);
61
- var Textarea = styled_components_1.default.textarea.withConfig({ shouldForwardProp: is_prop_valid_1.default })(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n height: 100%;\n"], ["\n ", "\n height: 100%;\n"])), sharedStyles);
62
- exports.TextField = react_1.default.forwardRef(function (_a, ref) {
63
- var _b = _a.multiline, multiline = _b === void 0 ? false : _b, restProps = __rest(_a, ["multiline"]);
64
- return multiline
65
- ? react_1.default.createElement(Textarea, __assign({ ref: ref }, restProps))
66
- : react_1.default.createElement(Input, __assign({ ref: ref, type: "text" }, restProps));
67
- });
68
- var templateObject_1, templateObject_2, templateObject_3;