@micromag/element-button 0.3.829 → 0.4.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/assets/css/styles.css +1 -1
- package/es/index.d.ts +51 -0
- package/es/index.js +73 -125
- package/es/styles.css +1 -0
- package/package.json +13 -12
package/assets/css/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
.container{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;background-clip:padding-box;background-color:hsla(0,0%,100%,.1);border:0;border-radius:0;color:inherit;cursor:pointer;display:inline-block;font-family:inherit;padding:5px 10px;position:relative}.container:focus-visible{-webkit-box-shadow:0 0 2px 0 #fff!important;box-shadow:0 0 2px 0 #fff!important;-webkit-box-shadow:0 0 2px 0 var(--micromag-focus-color,#fff)!important;box-shadow:0 0 2px 0 var(--micromag-focus-color,#fff)!important;outline:2px solid #000!important}.container.disabled,.container:disabled{cursor:auto}.container.rich{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:10px}.container.rich.layoutLabelBottom{-ms-flex-direction:column;flex-direction:column}.container.rich.layoutLabelTop{-ms-flex-direction:column-reverse;flex-direction:column-reverse}.container.rich.layoutNoLabel{-ms-flex-direction:row;flex-direction:row}.container.rich.layoutLabelLeft{-ms-flex-direction:row-reverse;flex-direction:row-reverse}.container.rich.layoutLabelRight{-ms-flex-direction:row;flex-direction:row}.container.rich.layoutLabelOver{position:relative}.container.rich.layoutLabelOver .text{background:-webkit-gradient(linear,left bottom,left top,from(rgba(0,0,0,.7)),to(transparent));background:linear-gradient(0deg,rgba(0,0,0,.7),transparent);bottom:0;left:0;padding:10px;position:absolute;right:0}.container.rich.textFullWidth .text{width:100%}.emptyButton{padding:10px 5px}.border{display:block}.visual{overflow:auto;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:0;flex-shrink:0}.video{position:relative!important}
|
package/es/index.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { TextStyle, BoxStyle, TextElement, Media } from '@micromag/core';
|
|
4
|
+
|
|
5
|
+
interface ButtonProps {
|
|
6
|
+
textStyle?: TextStyle | null;
|
|
7
|
+
buttonStyle?: BoxStyle | null;
|
|
8
|
+
type?: 'button' | 'submit';
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
focusable?: boolean;
|
|
11
|
+
inline?: boolean;
|
|
12
|
+
onClick?: ((...args: unknown[]) => void) | null;
|
|
13
|
+
children?: React.ReactNode | null;
|
|
14
|
+
className?: string | null;
|
|
15
|
+
withoutExternalBorder?: boolean;
|
|
16
|
+
refButton?: ((...args: unknown[]) => void | {
|
|
17
|
+
current?: unknown;
|
|
18
|
+
}) | null;
|
|
19
|
+
style?: Record<string, unknown> | null;
|
|
20
|
+
}
|
|
21
|
+
declare function Button({ textStyle, buttonStyle, type, disabled, focusable, inline, onClick, children, className, withoutExternalBorder, refButton, style, ...buttonProps }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
22
|
+
|
|
23
|
+
interface RichButtonProps {
|
|
24
|
+
label?: TextElement | null;
|
|
25
|
+
visual?: Media | null;
|
|
26
|
+
visualWidth?: number | string | null;
|
|
27
|
+
labelBoxStyle?: BoxStyle | null;
|
|
28
|
+
textStyle?: TextStyle | null;
|
|
29
|
+
buttonStyle?: BoxStyle | null;
|
|
30
|
+
resolution?: number | null;
|
|
31
|
+
shouldLoad?: boolean;
|
|
32
|
+
layout?: 'label-bottom' | 'label-top' | 'no-label' | 'label-over' | 'label-right';
|
|
33
|
+
type?: 'button' | 'submit';
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
focusable?: boolean;
|
|
36
|
+
inline?: boolean;
|
|
37
|
+
onClick?: ((...args: unknown[]) => void) | null;
|
|
38
|
+
className?: string | null;
|
|
39
|
+
textClassName?: string | null;
|
|
40
|
+
imageClassName?: string | null;
|
|
41
|
+
videoClassName?: string | null;
|
|
42
|
+
visualClassName?: string | null;
|
|
43
|
+
withoutExternalBorder?: boolean;
|
|
44
|
+
refButton?: ((...args: unknown[]) => void | {
|
|
45
|
+
current?: unknown;
|
|
46
|
+
}) | null;
|
|
47
|
+
children?: React.ReactNode | null;
|
|
48
|
+
}
|
|
49
|
+
declare function RichButton({ label, visual, visualWidth, labelBoxStyle, textStyle, buttonStyle, resolution, shouldLoad, layout, type, disabled, focusable, inline, onClick, className, textClassName, visualClassName, imageClassName, videoClassName, withoutExternalBorder, refButton, children, ...otherProps }: RichButtonProps): react_jsx_runtime.JSX.Element;
|
|
50
|
+
|
|
51
|
+
export { RichButton, Button as default };
|
package/es/index.js
CHANGED
|
@@ -2,62 +2,42 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
2
2
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
5
|
import React, { useMemo } from 'react';
|
|
7
|
-
import { PropTypes as PropTypes$1 } from '@micromag/core';
|
|
8
6
|
import { Button as Button$1, ScreenElement } from '@micromag/core/components';
|
|
9
7
|
import { getStyleFromText, getStyleFromBox } from '@micromag/core/utils';
|
|
10
8
|
import { FormattedMessage } from 'react-intl';
|
|
11
9
|
import Text from '@micromag/element-text';
|
|
12
10
|
import Visual from '@micromag/element-visual';
|
|
13
11
|
|
|
14
|
-
var styles = {"container":"
|
|
12
|
+
var styles = {"container":"container","rich":"rich","layoutLabelBottom":"layoutLabelBottom","layoutLabelTop":"layoutLabelTop","layoutNoLabel":"layoutNoLabel","layoutLabelLeft":"layoutLabelLeft","layoutLabelRight":"layoutLabelRight","layoutLabelOver":"layoutLabelOver","text":"text","textFullWidth":"textFullWidth","emptyButton":"emptyButton","visual":"visual","video":"video"};
|
|
15
13
|
|
|
16
14
|
var _excluded$1 = ["textStyle", "buttonStyle", "type", "disabled", "focusable", "inline", "onClick", "children", "className", "withoutExternalBorder", "refButton", "style"],
|
|
17
15
|
_excluded2 = ["body"];
|
|
18
|
-
|
|
19
|
-
textStyle
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
className: null,
|
|
44
|
-
withoutExternalBorder: true,
|
|
45
|
-
refButton: null,
|
|
46
|
-
style: null
|
|
47
|
-
};
|
|
48
|
-
var Button = function Button(_ref) {
|
|
49
|
-
var textStyle = _ref.textStyle,
|
|
50
|
-
buttonStyle = _ref.buttonStyle,
|
|
51
|
-
type = _ref.type,
|
|
52
|
-
disabled = _ref.disabled,
|
|
53
|
-
focusable = _ref.focusable,
|
|
54
|
-
inline = _ref.inline,
|
|
55
|
-
onClick = _ref.onClick,
|
|
56
|
-
children = _ref.children,
|
|
57
|
-
className = _ref.className,
|
|
58
|
-
withoutExternalBorder = _ref.withoutExternalBorder,
|
|
59
|
-
refButton = _ref.refButton,
|
|
60
|
-
style = _ref.style,
|
|
16
|
+
function Button(_ref) {
|
|
17
|
+
var _ref$textStyle = _ref.textStyle,
|
|
18
|
+
textStyle = _ref$textStyle === void 0 ? null : _ref$textStyle,
|
|
19
|
+
_ref$buttonStyle = _ref.buttonStyle,
|
|
20
|
+
buttonStyle = _ref$buttonStyle === void 0 ? null : _ref$buttonStyle,
|
|
21
|
+
_ref$type = _ref.type,
|
|
22
|
+
type = _ref$type === void 0 ? 'button' : _ref$type,
|
|
23
|
+
_ref$disabled = _ref.disabled,
|
|
24
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
25
|
+
_ref$focusable = _ref.focusable,
|
|
26
|
+
focusable = _ref$focusable === void 0 ? true : _ref$focusable,
|
|
27
|
+
_ref$inline = _ref.inline,
|
|
28
|
+
inline = _ref$inline === void 0 ? false : _ref$inline,
|
|
29
|
+
_ref$onClick = _ref.onClick,
|
|
30
|
+
onClick = _ref$onClick === void 0 ? null : _ref$onClick,
|
|
31
|
+
_ref$children = _ref.children,
|
|
32
|
+
children = _ref$children === void 0 ? null : _ref$children,
|
|
33
|
+
_ref$className = _ref.className,
|
|
34
|
+
className = _ref$className === void 0 ? null : _ref$className,
|
|
35
|
+
_ref$withoutExternalB = _ref.withoutExternalBorder,
|
|
36
|
+
withoutExternalBorder = _ref$withoutExternalB === void 0 ? true : _ref$withoutExternalB,
|
|
37
|
+
_ref$refButton = _ref.refButton,
|
|
38
|
+
refButton = _ref$refButton === void 0 ? null : _ref$refButton,
|
|
39
|
+
_ref$style = _ref.style,
|
|
40
|
+
style = _ref$style === void 0 ? null : _ref$style,
|
|
61
41
|
buttonProps = _objectWithoutProperties(_ref, _excluded$1);
|
|
62
42
|
var finalStyles = style;
|
|
63
43
|
|
|
@@ -94,84 +74,54 @@ var Button = function Button(_ref) {
|
|
|
94
74
|
focusable: focusable,
|
|
95
75
|
withoutBootstrapStyles: true
|
|
96
76
|
}, otherProps), children);
|
|
97
|
-
}
|
|
98
|
-
Button.propTypes = propTypes$1;
|
|
99
|
-
Button.defaultProps = defaultProps$1;
|
|
77
|
+
}
|
|
100
78
|
|
|
101
79
|
var _excluded = ["label", "visual", "visualWidth", "labelBoxStyle", "textStyle", "buttonStyle", "resolution", "shouldLoad", "layout", "type", "disabled", "focusable", "inline", "onClick", "className", "textClassName", "visualClassName", "imageClassName", "videoClassName", "withoutExternalBorder", "refButton", "children"];
|
|
102
|
-
|
|
103
|
-
label
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
visualClassName: null,
|
|
148
|
-
withoutExternalBorder: true,
|
|
149
|
-
refButton: null,
|
|
150
|
-
children: null
|
|
151
|
-
};
|
|
152
|
-
var RichButton = function RichButton(_ref) {
|
|
153
|
-
var label = _ref.label,
|
|
154
|
-
visual = _ref.visual,
|
|
155
|
-
visualWidth = _ref.visualWidth,
|
|
156
|
-
labelBoxStyle = _ref.labelBoxStyle,
|
|
157
|
-
textStyle = _ref.textStyle,
|
|
158
|
-
buttonStyle = _ref.buttonStyle,
|
|
159
|
-
resolution = _ref.resolution,
|
|
160
|
-
shouldLoad = _ref.shouldLoad,
|
|
161
|
-
layout = _ref.layout,
|
|
162
|
-
type = _ref.type,
|
|
163
|
-
disabled = _ref.disabled,
|
|
164
|
-
focusable = _ref.focusable,
|
|
165
|
-
inline = _ref.inline,
|
|
166
|
-
onClick = _ref.onClick,
|
|
167
|
-
className = _ref.className,
|
|
168
|
-
textClassName = _ref.textClassName,
|
|
169
|
-
visualClassName = _ref.visualClassName,
|
|
170
|
-
imageClassName = _ref.imageClassName,
|
|
171
|
-
videoClassName = _ref.videoClassName,
|
|
172
|
-
withoutExternalBorder = _ref.withoutExternalBorder,
|
|
173
|
-
refButton = _ref.refButton,
|
|
174
|
-
children = _ref.children,
|
|
80
|
+
function RichButton(_ref) {
|
|
81
|
+
var _ref$label = _ref.label,
|
|
82
|
+
label = _ref$label === void 0 ? null : _ref$label,
|
|
83
|
+
_ref$visual = _ref.visual,
|
|
84
|
+
visual = _ref$visual === void 0 ? null : _ref$visual,
|
|
85
|
+
_ref$visualWidth = _ref.visualWidth,
|
|
86
|
+
visualWidth = _ref$visualWidth === void 0 ? null : _ref$visualWidth,
|
|
87
|
+
_ref$labelBoxStyle = _ref.labelBoxStyle,
|
|
88
|
+
labelBoxStyle = _ref$labelBoxStyle === void 0 ? null : _ref$labelBoxStyle,
|
|
89
|
+
_ref$textStyle = _ref.textStyle,
|
|
90
|
+
textStyle = _ref$textStyle === void 0 ? null : _ref$textStyle,
|
|
91
|
+
_ref$buttonStyle = _ref.buttonStyle,
|
|
92
|
+
buttonStyle = _ref$buttonStyle === void 0 ? null : _ref$buttonStyle,
|
|
93
|
+
_ref$resolution = _ref.resolution,
|
|
94
|
+
resolution = _ref$resolution === void 0 ? null : _ref$resolution,
|
|
95
|
+
_ref$shouldLoad = _ref.shouldLoad,
|
|
96
|
+
shouldLoad = _ref$shouldLoad === void 0 ? true : _ref$shouldLoad,
|
|
97
|
+
_ref$layout = _ref.layout,
|
|
98
|
+
layout = _ref$layout === void 0 ? 'label-bottom' : _ref$layout,
|
|
99
|
+
_ref$type = _ref.type,
|
|
100
|
+
type = _ref$type === void 0 ? 'button' : _ref$type,
|
|
101
|
+
_ref$disabled = _ref.disabled,
|
|
102
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
103
|
+
_ref$focusable = _ref.focusable,
|
|
104
|
+
focusable = _ref$focusable === void 0 ? true : _ref$focusable,
|
|
105
|
+
_ref$inline = _ref.inline,
|
|
106
|
+
inline = _ref$inline === void 0 ? false : _ref$inline,
|
|
107
|
+
_ref$onClick = _ref.onClick,
|
|
108
|
+
onClick = _ref$onClick === void 0 ? null : _ref$onClick,
|
|
109
|
+
_ref$className = _ref.className,
|
|
110
|
+
className = _ref$className === void 0 ? null : _ref$className,
|
|
111
|
+
_ref$textClassName = _ref.textClassName,
|
|
112
|
+
textClassName = _ref$textClassName === void 0 ? null : _ref$textClassName,
|
|
113
|
+
_ref$visualClassName = _ref.visualClassName,
|
|
114
|
+
visualClassName = _ref$visualClassName === void 0 ? null : _ref$visualClassName,
|
|
115
|
+
_ref$imageClassName = _ref.imageClassName,
|
|
116
|
+
imageClassName = _ref$imageClassName === void 0 ? null : _ref$imageClassName,
|
|
117
|
+
_ref$videoClassName = _ref.videoClassName,
|
|
118
|
+
videoClassName = _ref$videoClassName === void 0 ? null : _ref$videoClassName,
|
|
119
|
+
_ref$withoutExternalB = _ref.withoutExternalBorder,
|
|
120
|
+
withoutExternalBorder = _ref$withoutExternalB === void 0 ? true : _ref$withoutExternalB,
|
|
121
|
+
_ref$refButton = _ref.refButton,
|
|
122
|
+
refButton = _ref$refButton === void 0 ? null : _ref$refButton,
|
|
123
|
+
_ref$children = _ref.children,
|
|
124
|
+
children = _ref$children === void 0 ? null : _ref$children,
|
|
175
125
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
176
126
|
var Tag = useMemo(function () {
|
|
177
127
|
switch (type) {
|
|
@@ -229,8 +179,6 @@ var RichButton = function RichButton(_ref) {
|
|
|
229
179
|
body: body,
|
|
230
180
|
className: classNames([styles.text, _defineProperty({}, textClassName, textClassName !== null)])
|
|
231
181
|
}) : null, children));
|
|
232
|
-
}
|
|
233
|
-
RichButton.propTypes = propTypes;
|
|
234
|
-
RichButton.defaultProps = defaultProps;
|
|
182
|
+
}
|
|
235
183
|
|
|
236
184
|
export { RichButton, Button as default };
|
package/es/styles.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.container{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;background-clip:padding-box;background-color:hsla(0,0%,100%,.1);border:0;border-radius:0;color:inherit;cursor:pointer;display:inline-block;font-family:inherit;padding:5px 10px;position:relative}.container:focus-visible{-webkit-box-shadow:0 0 2px 0 #fff!important;box-shadow:0 0 2px 0 #fff!important;-webkit-box-shadow:0 0 2px 0 var(--micromag-focus-color,#fff)!important;box-shadow:0 0 2px 0 var(--micromag-focus-color,#fff)!important;outline:2px solid #000!important}.container.disabled,.container:disabled{cursor:auto}.container.rich{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:10px}.container.rich.layoutLabelBottom{-ms-flex-direction:column;flex-direction:column}.container.rich.layoutLabelTop{-ms-flex-direction:column-reverse;flex-direction:column-reverse}.container.rich.layoutNoLabel{-ms-flex-direction:row;flex-direction:row}.container.rich.layoutLabelLeft{-ms-flex-direction:row-reverse;flex-direction:row-reverse}.container.rich.layoutLabelRight{-ms-flex-direction:row;flex-direction:row}.container.rich.layoutLabelOver{position:relative}.container.rich.layoutLabelOver .text{background:-webkit-gradient(linear,left bottom,left top,from(rgba(0,0,0,.7)),to(transparent));background:linear-gradient(0deg,rgba(0,0,0,.7),transparent);bottom:0;left:0;padding:10px;position:absolute;right:0}.container.rich.textFullWidth .text{width:100%}.emptyButton{padding:10px 5px}.border{display:block}.visual{overflow:auto;-ms-flex-positive:1;flex-grow:1;-ms-flex-negative:0;flex-shrink:0}.video{position:relative!important}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-button",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"module": "es/index.js",
|
|
35
35
|
"exports": {
|
|
36
36
|
".": {
|
|
37
|
+
"types": "./es/index.d.ts",
|
|
37
38
|
"import": "./es/index.js"
|
|
38
39
|
},
|
|
39
40
|
"./assets/css/styles": "./assets/css/styles.css",
|
|
@@ -47,29 +48,29 @@
|
|
|
47
48
|
"scripts": {
|
|
48
49
|
"clean": "rm -rf es && rm -rf lib && rm -rf assets",
|
|
49
50
|
"prepublishOnly": "npm run build",
|
|
50
|
-
"build": "../../scripts/prepare-package.sh"
|
|
51
|
+
"build": "../../scripts/prepare-package.sh --types"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
|
-
"react": "^
|
|
54
|
-
"react-dom": "^
|
|
54
|
+
"react": "^19.2.0",
|
|
55
|
+
"react-dom": "^18.3.0 || ^19.0.0"
|
|
55
56
|
},
|
|
56
57
|
"peerDependencies": {
|
|
57
|
-
"react": "^
|
|
58
|
-
"react-dom": "^
|
|
58
|
+
"react": "^19.2.0",
|
|
59
|
+
"react-dom": "^18.3.0 || ^19.0.0"
|
|
59
60
|
},
|
|
60
61
|
"dependencies": {
|
|
61
62
|
"@babel/runtime": "^7.13.10",
|
|
62
|
-
"@micromag/core": "^0.
|
|
63
|
-
"@micromag/element-text": "^0.
|
|
64
|
-
"@micromag/element-visual": "^0.
|
|
63
|
+
"@micromag/core": "^0.4.4",
|
|
64
|
+
"@micromag/element-text": "^0.4.4",
|
|
65
|
+
"@micromag/element-visual": "^0.4.4",
|
|
65
66
|
"classnames": "^2.2.6",
|
|
66
|
-
"
|
|
67
|
-
"react-intl": "^6.6.4",
|
|
67
|
+
"react-intl": "^8.1.3",
|
|
68
68
|
"uuid": "^9.0.0"
|
|
69
69
|
},
|
|
70
70
|
"publishConfig": {
|
|
71
71
|
"access": "public",
|
|
72
72
|
"registry": "https://registry.npmjs.org/"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "04b8519c3a3ddace5a21497e22faa11865d57f6d",
|
|
75
|
+
"types": "es/index.d.ts"
|
|
75
76
|
}
|