@instructure/ui-editable 11.7.3 → 11.7.4-pr-snapshot-1781695314229

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.
@@ -1,181 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.InPlaceEdit = void 0;
8
- var _react = require("react");
9
- var _latest = require("@instructure/ui-flex/latest");
10
- var _latest2 = require("@instructure/ui-buttons/latest");
11
- var _uiIcons = require("@instructure/ui-icons");
12
- var _console = require("@instructure/console");
13
- var _createChainedFunction = require("@instructure/ui-utils/lib/createChainedFunction.js");
14
- var _emotion = require("@instructure/emotion");
15
- var _latest3 = require("@instructure/ui-view/latest");
16
- var _v = require("../../Editable/v1");
17
- var _styles = _interopRequireDefault(require("./styles"));
18
- var _props = require("./props");
19
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
20
- var _dec, _class;
21
- /*
22
- * The MIT License (MIT)
23
- *
24
- * Copyright (c) 2018 - present Instructure, Inc.
25
- *
26
- * Permission is hereby granted, free of charge, to any person obtaining a copy
27
- * of this software and associated documentation files (the "Software"), to deal
28
- * in the Software without restriction, including without limitation the rights
29
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
30
- * copies of the Software, and to permit persons to whom the Software is
31
- * furnished to do so, subject to the following conditions:
32
- *
33
- * The above copyright notice and this permission notice shall be included in all
34
- * copies or substantial portions of the Software.
35
- *
36
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
39
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
41
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
42
- * SOFTWARE.
43
- */
44
- /**
45
- ---
46
- category: components
47
- ---
48
- **/
49
- let InPlaceEdit = exports.InPlaceEdit = (_dec = (0, _emotion.withStyleNew)(_styles.default), _dec(_class = class InPlaceEdit extends _react.Component {
50
- static displayName = "InPlaceEdit";
51
- static componentId = 'InPlaceEdit';
52
- static allowedProps = _props.allowedProps;
53
- static defaultProps = {
54
- readOnly: false,
55
- showFocusRing: true,
56
- inline: true,
57
- editButtonPlacement: 'end'
58
- };
59
- ref = null;
60
- _editButtonRef = null;
61
- handleRef = el => {
62
- this.ref = el;
63
- };
64
- constructor(props) {
65
- super(props);
66
- (0, _console.logWarn)(props.readOnly ? props.mode === 'view' : true, '[InPlaceEdit] When readOnly is true, mode is forced to "view"');
67
- }
68
- componentDidMount() {
69
- this.props.makeStyles?.();
70
- }
71
- componentDidUpdate() {
72
- this.props.makeStyles?.();
73
- }
74
- handleEditButtonRef = el => {
75
- this._editButtonRef = el;
76
- };
77
- renderEditor({
78
- mode,
79
- onBlur,
80
- editorRef,
81
- readOnly
82
- }) {
83
- const {
84
- showFocusRing,
85
- renderEditor
86
- } = this.props;
87
- const isEditMode = !readOnly && mode === 'edit';
88
- return isEditMode ? (0, _jsxRuntime.jsx)(_latest3.View, {
89
- as: "span",
90
- display: "block",
91
- withFocusOutline: showFocusRing,
92
- position: "relative",
93
- css: this.props.styles?.inPlaceEdit,
94
- borderRadius: "medium",
95
- margin: "auto",
96
- children: renderEditor({
97
- onBlur,
98
- editorRef
99
- })
100
- }) : null;
101
- }
102
- renderViewer({
103
- readOnly,
104
- mode
105
- }) {
106
- return readOnly || mode === 'view' ? this.props.renderViewer() : null;
107
- }
108
- renderEditButton({
109
- buttonRef,
110
- ...rest
111
- }) {
112
- return this.props.renderEditButton({
113
- elementRef: (0, _createChainedFunction.createChainedFunction)(this.handleEditButtonRef, buttonRef),
114
- ...rest
115
- });
116
- }
117
-
118
- // Render a default edit button, an icon button with the edit icon
119
- // the margin makes room for the focus ring
120
- static renderDefaultEditButton = ({
121
- isVisible,
122
- readOnly,
123
- label,
124
- ...buttonProps
125
- }) => {
126
- if (readOnly) {
127
- return null;
128
- }
129
- return (0, _jsxRuntime.jsx)(_latest2.IconButton, {
130
- size: "small",
131
- screenReaderLabel: label,
132
- withBackground: false,
133
- withBorder: false,
134
- ...buttonProps,
135
- children: isVisible ? _uiIcons.PencilInstUIIcon : null
136
- });
137
- };
138
- renderAll = ({
139
- getContainerProps,
140
- getViewerProps,
141
- getEditorProps,
142
- getEditButtonProps
143
- }) => {
144
- const flexDir = this.props.editButtonPlacement === 'start' ? 'row-reverse' : 'row';
145
- const justifyItems = flexDir === 'row-reverse' ? 'end' : 'start';
146
- const buttonMargin = this.props.editButtonPlacement === 'start' ? '0 xx-small 0 0' : '0 0 0 xx-small';
147
- return (0, _jsxRuntime.jsxs)(_latest.Flex, {
148
- display: this.props.inline ? 'inline-flex' : 'flex',
149
- direction: flexDir,
150
- justifyItems: justifyItems,
151
- ...getContainerProps(),
152
- children: [(0, _jsxRuntime.jsxs)(_latest.Flex.Item, {
153
- shouldGrow: true,
154
- shouldShrink: true,
155
- children: [this.renderEditor(getEditorProps()), this.renderViewer(getViewerProps())]
156
- }), (0, _jsxRuntime.jsx)(_latest.Flex.Item, {
157
- margin: buttonMargin,
158
- children: this.renderEditButton(getEditButtonProps())
159
- })]
160
- });
161
- };
162
- render() {
163
- const {
164
- mode,
165
- value,
166
- onChange,
167
- onChangeMode,
168
- readOnly
169
- } = this.props;
170
- return (0, _jsxRuntime.jsx)(_v.Editable, {
171
- mode: mode,
172
- onChangeMode: onChangeMode,
173
- render: this.renderAll,
174
- value: value,
175
- onChange: onChange,
176
- readOnly: readOnly,
177
- elementRef: this.handleRef
178
- });
179
- }
180
- }) || _class);
181
- var _default = exports.default = InPlaceEdit;
@@ -1,31 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.allowedProps = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- const allowedProps = exports.allowedProps = ['renderViewer', 'renderEditor', 'renderEditButton', 'mode', 'onChangeMode', 'value', 'onChange', 'readOnly', 'showFocusRing', 'editButtonPlacement', 'inline'];
@@ -1,58 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- /**
32
- * ---
33
- * private: true
34
- * ---
35
- * Generates the style object from the theme and provided additional information
36
- * @return The final style object, which will be used in the component
37
- */
38
- const generateStyle = () => {
39
- return {
40
- inPlaceEdit: {
41
- label: 'inPlaceEdit',
42
- boxSizing: 'border-box',
43
- maxWidth: '100%',
44
- position: 'relative',
45
- overflow: 'visible',
46
- direction: 'inherit',
47
- margin: 0,
48
- textDecoration: 'none' /* for links styled as buttons */,
49
- textAlign: 'inherit',
50
- userSelect: 'none',
51
- touchAction: 'manipulation',
52
- background: 'transparent',
53
- border: 'none',
54
- outline: 'none'
55
- }
56
- };
57
- };
58
- var _default = exports.default = generateStyle;
package/lib/exports/a.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Editable", {
7
- enumerable: true,
8
- get: function () {
9
- return _v.Editable;
10
- }
11
- });
12
- Object.defineProperty(exports, "InPlaceEdit", {
13
- enumerable: true,
14
- get: function () {
15
- return _v2.InPlaceEdit;
16
- }
17
- });
18
- var _v = require("../Editable/v1");
19
- var _v2 = require("../InPlaceEdit/v1");
package/lib/exports/b.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Editable", {
7
- enumerable: true,
8
- get: function () {
9
- return _v.Editable;
10
- }
11
- });
12
- Object.defineProperty(exports, "InPlaceEdit", {
13
- enumerable: true,
14
- get: function () {
15
- return _v2.InPlaceEdit;
16
- }
17
- });
18
- var _v = require("../Editable/v1");
19
- var _v2 = require("../InPlaceEdit/v2");
package/lib/package.json DELETED
@@ -1 +0,0 @@
1
- {"type":"commonjs"}