@pingux/astro 1.33.1-alpha.2 → 1.34.0-alpha.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.
- package/lib/cjs/components/Icon/Icon.js +11 -6
- package/lib/cjs/components/Icon/Icon.stories.js +119 -8
- package/lib/cjs/components/Icon/Icon.test.js +27 -0
- package/lib/cjs/components/IconButton/IconButton.stories.js +277 -11
- package/lib/cjs/hooks/index.js +16 -7
- package/lib/cjs/hooks/useTShirtSize/index.js +18 -0
- package/lib/cjs/hooks/useTShirtSize/useTShirtSize.js +41 -0
- package/lib/cjs/hooks/useTShirtSize/useTShirtSize.test.js +93 -0
- package/lib/cjs/utils/devUtils/constants/tShirtSizes.js +15 -0
- package/lib/components/Icon/Icon.js +10 -6
- package/lib/components/Icon/Icon.stories.js +102 -3
- package/lib/components/Icon/Icon.test.js +21 -0
- package/lib/components/IconButton/IconButton.stories.js +259 -2
- package/lib/hooks/index.js +5 -4
- package/lib/hooks/useTShirtSize/index.js +1 -0
- package/lib/hooks/useTShirtSize/useTShirtSize.js +29 -0
- package/lib/hooks/useTShirtSize/useTShirtSize.test.js +87 -0
- package/lib/utils/devUtils/constants/tShirtSizes.js +5 -0
- package/package.json +1 -1
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
4
|
+
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
|
9
|
+
exports["default"] = void 0;
|
10
|
+
|
11
|
+
var _react = require("react");
|
12
|
+
|
13
|
+
var _tShirtSizes = require("../../utils/devUtils/constants/tShirtSizes");
|
14
|
+
|
15
|
+
/**
|
16
|
+
* A custom hook which returns the pixel value of a tShirtSize.
|
17
|
+
* @param {Object} [props] The props object
|
18
|
+
* @param {String} [props.size] The size of the svg container
|
19
|
+
* @returns {Object} `{ sizeProps: Object }`
|
20
|
+
*/
|
21
|
+
var useTShirtSize = function useTShirtSize(_ref) {
|
22
|
+
var size = _ref.size;
|
23
|
+
var value = (0, _react.useMemo)(function () {
|
24
|
+
if (size === undefined) {
|
25
|
+
// eslint-disable-next-line no-console
|
26
|
+
console.warn('useTShirtSize hook requires a size prop.');
|
27
|
+
return undefined;
|
28
|
+
}
|
29
|
+
|
30
|
+
return _tShirtSizes.tShirtSizes === null || _tShirtSizes.tShirtSizes === void 0 ? void 0 : _tShirtSizes.tShirtSizes[size];
|
31
|
+
}, [size]);
|
32
|
+
var sizeProps = {
|
33
|
+
size: value ? "".concat(value, "px") : size
|
34
|
+
};
|
35
|
+
return {
|
36
|
+
sizeProps: sizeProps
|
37
|
+
};
|
38
|
+
};
|
39
|
+
|
40
|
+
var _default = useTShirtSize;
|
41
|
+
exports["default"] = _default;
|
@@ -0,0 +1,93 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
var _reactHooks = require("@testing-library/react-hooks");
|
6
|
+
|
7
|
+
var _useTShirtSize = _interopRequireDefault(require("./useTShirtSize"));
|
8
|
+
|
9
|
+
describe('useTShirtSize', function () {
|
10
|
+
beforeEach(function () {
|
11
|
+
process.env.NODE_ENV = 'development';
|
12
|
+
|
13
|
+
global.console.warn = function () {
|
14
|
+
return jest.mock();
|
15
|
+
}; // eslint-disable-line no-console
|
16
|
+
|
17
|
+
});
|
18
|
+
afterEach(function () {
|
19
|
+
process.env.NODE_ENV = 'test';
|
20
|
+
jest.clearAllMocks();
|
21
|
+
});
|
22
|
+
test('default', function () {
|
23
|
+
var props = {};
|
24
|
+
var spy = jest.spyOn(console, 'warn');
|
25
|
+
expect(spy).toHaveBeenCalledTimes(0);
|
26
|
+
(0, _reactHooks.renderHook)(function () {
|
27
|
+
return (0, _useTShirtSize["default"])(props);
|
28
|
+
});
|
29
|
+
expect(spy).toHaveBeenCalledTimes(1);
|
30
|
+
});
|
31
|
+
});
|
32
|
+
test('does not warn if size prop does exist', function () {
|
33
|
+
var props = {
|
34
|
+
size: 15
|
35
|
+
};
|
36
|
+
var spy = jest.spyOn(console, 'warn');
|
37
|
+
expect(spy).not.toHaveBeenCalled();
|
38
|
+
(0, _reactHooks.renderHook)(function () {
|
39
|
+
return (0, _useTShirtSize["default"])(props);
|
40
|
+
});
|
41
|
+
expect(spy).not.toHaveBeenCalled();
|
42
|
+
});
|
43
|
+
test('returns size value if size is a tshirt value', function () {
|
44
|
+
var props = {
|
45
|
+
size: 'xs'
|
46
|
+
};
|
47
|
+
|
48
|
+
var _renderHook = (0, _reactHooks.renderHook)(function () {
|
49
|
+
return (0, _useTShirtSize["default"])(props);
|
50
|
+
}),
|
51
|
+
result = _renderHook.result;
|
52
|
+
|
53
|
+
var obj = {
|
54
|
+
sizeProps: {
|
55
|
+
size: '15px'
|
56
|
+
}
|
57
|
+
};
|
58
|
+
expect(result.current).toEqual(obj);
|
59
|
+
});
|
60
|
+
test('returns size value if size is a string value', function () {
|
61
|
+
var props = {
|
62
|
+
size: '20px'
|
63
|
+
};
|
64
|
+
|
65
|
+
var _renderHook2 = (0, _reactHooks.renderHook)(function () {
|
66
|
+
return (0, _useTShirtSize["default"])(props);
|
67
|
+
}),
|
68
|
+
result = _renderHook2.result;
|
69
|
+
|
70
|
+
var obj = {
|
71
|
+
sizeProps: {
|
72
|
+
size: '20px'
|
73
|
+
}
|
74
|
+
};
|
75
|
+
expect(result.current).toEqual(obj);
|
76
|
+
});
|
77
|
+
test('returns size value if size is a number value', function () {
|
78
|
+
var props = {
|
79
|
+
size: 20
|
80
|
+
};
|
81
|
+
|
82
|
+
var _renderHook3 = (0, _reactHooks.renderHook)(function () {
|
83
|
+
return (0, _useTShirtSize["default"])(props);
|
84
|
+
}),
|
85
|
+
result = _renderHook3.result;
|
86
|
+
|
87
|
+
var obj = {
|
88
|
+
sizeProps: {
|
89
|
+
size: 20
|
90
|
+
}
|
91
|
+
};
|
92
|
+
expect(result.current).toEqual(obj);
|
93
|
+
});
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
4
|
+
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
|
9
|
+
exports.tShirtSizes = void 0;
|
10
|
+
var tShirtSizes = {
|
11
|
+
xs: 15,
|
12
|
+
sm: 20,
|
13
|
+
md: 25
|
14
|
+
};
|
15
|
+
exports.tShirtSizes = tShirtSizes;
|
@@ -16,6 +16,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
16
16
|
import React, { forwardRef } from 'react';
|
17
17
|
import PropTypes from 'prop-types';
|
18
18
|
import Box from '../Box';
|
19
|
+
import { useTShirtSize } from '../../hooks';
|
19
20
|
/**
|
20
21
|
* Basic icon component.
|
21
22
|
* Icons will fill the given container, which is '1em' x '1em' by default, and will maintain their
|
@@ -33,16 +34,19 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
33
34
|
var Icon = /*#__PURE__*/forwardRef(function (props, ref) {
|
34
35
|
var color = props.color,
|
35
36
|
IconComponent = props.icon,
|
36
|
-
size = props.size,
|
37
37
|
sx = props.sx;
|
38
|
+
|
39
|
+
var _useTShirtSize = useTShirtSize(props),
|
40
|
+
sizeProps = _useTShirtSize.sizeProps;
|
41
|
+
|
38
42
|
return ___EmotionJSX(Box, _extends({
|
39
43
|
as: IconComponent,
|
40
44
|
ref: ref
|
41
45
|
}, props, {
|
46
|
+
size: sizeProps.size,
|
42
47
|
sx: _objectSpread({
|
43
48
|
fill: color,
|
44
|
-
|
45
|
-
minWidth: size
|
49
|
+
minWidth: sizeProps.size
|
46
50
|
}, sx)
|
47
51
|
}));
|
48
52
|
});
|
@@ -52,9 +56,9 @@ Icon.propTypes = {
|
|
52
56
|
|
53
57
|
/**
|
54
58
|
* The size of the icon container. If given a number value, it will be converted to pixels.
|
55
|
-
*
|
56
|
-
*/
|
57
|
-
size: PropTypes.oneOfType([PropTypes.
|
59
|
+
* Tshirt sizing is recommended and can be passed to the size prop as 'xs', 'sm' , 'md'
|
60
|
+
* rendering 15, 20, and 25 pixel svg containers. */
|
61
|
+
size: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
58
62
|
|
59
63
|
/** A theme-aware prop to set the icon's color. */
|
60
64
|
color: PropTypes.string
|
@@ -1,11 +1,17 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
3
3
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
4
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
4
5
|
import React from 'react';
|
6
|
+
import AccountIcon from 'mdi-react/AccountIcon';
|
7
|
+
import AccountGroupIcon from 'mdi-react/AccountGroupIcon';
|
8
|
+
import LockIcon from 'mdi-react/LockIcon';
|
5
9
|
import SearchIcon from 'mdi-react/SearchIcon';
|
10
|
+
import TagIcon from 'mdi-react/TagIcon';
|
6
11
|
import { v4 as uuid } from 'uuid';
|
7
|
-
import Icon from '
|
12
|
+
import { Box, Icon, Table, TableBody, TableCell, TableHead, TableRow, Text } from '../../index';
|
8
13
|
import { flatColorList } from '../../styles/colors';
|
14
|
+
import { tShirtSizes } from '../../utils/devUtils/constants/tShirtSizes';
|
9
15
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
16
|
export default {
|
11
17
|
title: 'Icon',
|
@@ -27,9 +33,10 @@ export default {
|
|
27
33
|
},
|
28
34
|
size: {
|
29
35
|
control: {
|
30
|
-
type: '
|
36
|
+
type: 'select',
|
37
|
+
options: _Object$keys(tShirtSizes)
|
31
38
|
},
|
32
|
-
description: 'The size of the icon container. If given a number value, it will be converted to pixels. ' + '
|
39
|
+
description: 'The size of the icon container. If given a number value, it will be converted to pixels. ' + 'Tshirt sizing is recommended and can be passed to the size prop as "xs", "sm" , "md" ' + 'rendering 15, 20, and 25 pixel svg containers.'
|
33
40
|
},
|
34
41
|
color: {
|
35
42
|
control: {
|
@@ -71,4 +78,96 @@ export var SVGIcons = function SVGIcons() {
|
|
71
78
|
color: "active",
|
72
79
|
size: 40
|
73
80
|
});
|
81
|
+
};
|
82
|
+
var rowHeadings = ['SVG Size', 'Code Example', 'Icon Example'];
|
83
|
+
export var Sizes = function Sizes() {
|
84
|
+
return ___EmotionJSX(Table, null, ___EmotionJSX(TableHead, null, ___EmotionJSX(TableRow, {
|
85
|
+
key: "head"
|
86
|
+
}, _mapInstanceProperty(rowHeadings).call(rowHeadings, function (head) {
|
87
|
+
return ___EmotionJSX(TableCell, {
|
88
|
+
isHeading: true,
|
89
|
+
key: head
|
90
|
+
}, head);
|
91
|
+
}))), ___EmotionJSX(TableBody, {
|
92
|
+
sx: {
|
93
|
+
borderBottom: 'unset'
|
94
|
+
}
|
95
|
+
}, ___EmotionJSX(TableRow, {
|
96
|
+
height: "45px",
|
97
|
+
bg: "transparent !important"
|
98
|
+
}, ___EmotionJSX(TableCell, null, ___EmotionJSX(Text, null, "XS | 15px")), ___EmotionJSX(TableCell, null, ___EmotionJSX(Text, {
|
99
|
+
fontFamily: "monospace"
|
100
|
+
}, '<Icon icon={SearchIcon}/> size="xs"/>')), ___EmotionJSX(TableCell, null, ___EmotionJSX(Icon, {
|
101
|
+
icon: SearchIcon,
|
102
|
+
size: "xs"
|
103
|
+
}))), ___EmotionJSX(TableRow, {
|
104
|
+
height: "45px",
|
105
|
+
bg: "transparent !important"
|
106
|
+
}, ___EmotionJSX(TableCell, null, ___EmotionJSX(Text, null, "SM | 20px")), ___EmotionJSX(TableCell, null, ___EmotionJSX(Text, {
|
107
|
+
fontFamily: "monospace"
|
108
|
+
}, '<Icon icon={SearchIcon}/> size="sm"/>')), ___EmotionJSX(TableCell, null, ___EmotionJSX(Icon, {
|
109
|
+
icon: SearchIcon,
|
110
|
+
size: "sm"
|
111
|
+
}))), ___EmotionJSX(TableRow, {
|
112
|
+
height: "45px",
|
113
|
+
bg: "transparent !important"
|
114
|
+
}, ___EmotionJSX(TableCell, null, ___EmotionJSX(Text, null, "MD | 25px")), ___EmotionJSX(TableCell, null, ___EmotionJSX(Text, {
|
115
|
+
fontFamily: "monospace"
|
116
|
+
}, '<Icon icon={SearchIcon}/> size="md"/>')), ___EmotionJSX(TableCell, null, ___EmotionJSX(Icon, {
|
117
|
+
icon: SearchIcon,
|
118
|
+
size: "md"
|
119
|
+
})))));
|
120
|
+
};
|
121
|
+
export var CommonlyUsed = function CommonlyUsed() {
|
122
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Box, {
|
123
|
+
isRow: true,
|
124
|
+
gap: "md",
|
125
|
+
mb: "xs"
|
126
|
+
}, ___EmotionJSX(Icon, {
|
127
|
+
icon: AccountIcon,
|
128
|
+
color: "accent.40",
|
129
|
+
size: "sm"
|
130
|
+
}), ___EmotionJSX(Text, {
|
131
|
+
fontFamily: "monospace"
|
132
|
+
}, "import AccountIcon from 'mdi-react/AccountIcon'; ")), ___EmotionJSX(Box, {
|
133
|
+
isRow: true,
|
134
|
+
gap: "md",
|
135
|
+
mb: "xs"
|
136
|
+
}, ___EmotionJSX(Icon, {
|
137
|
+
icon: AccountGroupIcon,
|
138
|
+
color: "accent.40",
|
139
|
+
size: "sm"
|
140
|
+
}), ___EmotionJSX(Text, {
|
141
|
+
fontFamily: "monospace"
|
142
|
+
}, "import AccountGroupIcon from 'mdi-react/AccountGroupIcon'; ")), ___EmotionJSX(Box, {
|
143
|
+
isRow: true,
|
144
|
+
gap: "md",
|
145
|
+
mb: "xs"
|
146
|
+
}, ___EmotionJSX(Icon, {
|
147
|
+
icon: LockIcon,
|
148
|
+
color: "accent.40",
|
149
|
+
size: "sm"
|
150
|
+
}), ___EmotionJSX(Text, {
|
151
|
+
fontFamily: "monospace"
|
152
|
+
}, "import LockIcon from 'mdi-react/LockIcon'; ")), ___EmotionJSX(Box, {
|
153
|
+
isRow: true,
|
154
|
+
gap: "md",
|
155
|
+
mb: "xs"
|
156
|
+
}, ___EmotionJSX(Icon, {
|
157
|
+
icon: SearchIcon,
|
158
|
+
color: "accent.40",
|
159
|
+
size: "sm"
|
160
|
+
}), ___EmotionJSX(Text, {
|
161
|
+
fontFamily: "monospace"
|
162
|
+
}, "import SearchIcon from 'mdi-react/SearchIcon'; ")), ___EmotionJSX(Box, {
|
163
|
+
isRow: true,
|
164
|
+
gap: "md",
|
165
|
+
mb: "xs"
|
166
|
+
}, ___EmotionJSX(Icon, {
|
167
|
+
icon: TagIcon,
|
168
|
+
color: "accent.40",
|
169
|
+
size: "sm"
|
170
|
+
}), ___EmotionJSX(Text, {
|
171
|
+
fontFamily: "monospace"
|
172
|
+
}, "import TagIcon from 'mdi-react/TagIcon'; ")));
|
74
173
|
};
|
@@ -23,4 +23,25 @@ test('default icon', function () {
|
|
23
23
|
var icon = screen.getByTestId(testId);
|
24
24
|
expect(icon).toBeInstanceOf(SVGSVGElement);
|
25
25
|
expect(icon).toBeInTheDocument();
|
26
|
+
});
|
27
|
+
test('icon renders correct xsmall tshirt size', function () {
|
28
|
+
getComponent({
|
29
|
+
size: 'xs'
|
30
|
+
});
|
31
|
+
var xsIcon = screen.getByTestId(testId);
|
32
|
+
expect(xsIcon).toHaveStyleRule('width', '15px');
|
33
|
+
});
|
34
|
+
test('icon renders correct small tshirt size', function () {
|
35
|
+
getComponent({
|
36
|
+
size: 'sm'
|
37
|
+
});
|
38
|
+
var smIcon = screen.getByTestId(testId);
|
39
|
+
expect(smIcon).toHaveStyleRule('width', '20px');
|
40
|
+
});
|
41
|
+
test('icon renders correct medium tshirt size', function () {
|
42
|
+
getComponent({
|
43
|
+
size: 'md'
|
44
|
+
});
|
45
|
+
var mdIcon = screen.getByTestId(testId);
|
46
|
+
expect(mdIcon).toHaveStyleRule('width', '25px');
|
26
47
|
});
|
@@ -1,8 +1,11 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import React from 'react';
|
3
3
|
import CreateIcon from 'mdi-react/CreateIcon';
|
4
|
-
import
|
5
|
-
import
|
4
|
+
import DotsVerticalIcon from 'mdi-react/DotsVerticalIcon';
|
5
|
+
import DeleteIcon from 'mdi-react/DeleteIcon';
|
6
|
+
import PlusIcon from 'mdi-react/PlusIcon';
|
7
|
+
import PencilIcon from 'mdi-react/PencilIcon';
|
8
|
+
import { Box, Icon, IconButton, Table, TableHead, TableRow, TableCell, TableBody, Text } from '../../index';
|
6
9
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
7
10
|
export default {
|
8
11
|
title: 'IconButton',
|
@@ -64,4 +67,258 @@ export var Disabled = function Disabled() {
|
|
64
67
|
}, ___EmotionJSX(Icon, {
|
65
68
|
icon: CreateIcon
|
66
69
|
}));
|
70
|
+
};
|
71
|
+
export var Sizes = function Sizes() {
|
72
|
+
return ___EmotionJSX(Table, null, ___EmotionJSX(TableHead, null, ___EmotionJSX(TableRow, {
|
73
|
+
key: "head"
|
74
|
+
}, ___EmotionJSX(TableCell, {
|
75
|
+
isHeading: true,
|
76
|
+
width: "40%"
|
77
|
+
}, "Icon & Button Size"), ___EmotionJSX(TableCell, {
|
78
|
+
isHeading: true
|
79
|
+
}, "Code Example"), ___EmotionJSX(TableCell, {
|
80
|
+
isHeading: true
|
81
|
+
}, "Icon Example"))), ___EmotionJSX(TableBody, {
|
82
|
+
sx: {
|
83
|
+
borderBottom: 'unset'
|
84
|
+
}
|
85
|
+
}, ___EmotionJSX(TableRow, {
|
86
|
+
bg: "transparent !important"
|
87
|
+
}, ___EmotionJSX(TableCell, {
|
88
|
+
width: "40%"
|
89
|
+
}, ___EmotionJSX(Text, null, "XS | 21px")), ___EmotionJSX(TableCell, null, ___EmotionJSX(Text, {
|
90
|
+
fontFamily: "monospace"
|
91
|
+
}, " ", "<IconButton aria-label='create buton' variant='inverted'/>"), ___EmotionJSX(Text, {
|
92
|
+
fontFamily: "monospace"
|
93
|
+
}, "<Icon icon={CreateIcon} size='xs'/>"), ___EmotionJSX(Text, {
|
94
|
+
fontFamily: "monospace"
|
95
|
+
}, '</IconButton>')), ___EmotionJSX(TableCell, null, ___EmotionJSX(IconButton, {
|
96
|
+
"aria-label": "create buton",
|
97
|
+
variant: "inverted",
|
98
|
+
sx: {
|
99
|
+
width: 'unset'
|
100
|
+
}
|
101
|
+
}, ___EmotionJSX(Icon, {
|
102
|
+
icon: CreateIcon,
|
103
|
+
size: "xs"
|
104
|
+
})))), ___EmotionJSX(TableRow, {
|
105
|
+
bg: "transparent !important"
|
106
|
+
}, ___EmotionJSX(TableCell, {
|
107
|
+
width: "40%"
|
108
|
+
}, ___EmotionJSX(Text, null, "SM | 26px")), ___EmotionJSX(TableCell, null, ___EmotionJSX(Text, {
|
109
|
+
fontFamily: "monospace"
|
110
|
+
}, " ", "<IconButton aria-label='create buton' variant='inverted'/>"), ___EmotionJSX(Text, {
|
111
|
+
fontFamily: "monospace"
|
112
|
+
}, "<Icon icon={CreateIcon} size='sm'/>"), ___EmotionJSX(Text, {
|
113
|
+
fontFamily: "monospace"
|
114
|
+
}, '</IconButton>')), ___EmotionJSX(TableCell, null, ___EmotionJSX(IconButton, {
|
115
|
+
"aria-label": "create buton",
|
116
|
+
variant: "inverted",
|
117
|
+
sx: {
|
118
|
+
width: 'unset'
|
119
|
+
}
|
120
|
+
}, ___EmotionJSX(Icon, {
|
121
|
+
icon: CreateIcon,
|
122
|
+
size: "sm"
|
123
|
+
})))), ___EmotionJSX(TableRow, {
|
124
|
+
bg: "transparent !important"
|
125
|
+
}, ___EmotionJSX(TableCell, {
|
126
|
+
width: "40%"
|
127
|
+
}, ___EmotionJSX(Text, null, "MD | 31px")), ___EmotionJSX(TableCell, null, ___EmotionJSX(Text, {
|
128
|
+
fontFamily: "monospace"
|
129
|
+
}, " ", "<IconButton aria-label='create buton' variant='inverted'/>"), ___EmotionJSX(Text, {
|
130
|
+
fontFamily: "monospace"
|
131
|
+
}, "<Icon icon={CreateIcon} size='md'/>"), ___EmotionJSX(Text, {
|
132
|
+
fontFamily: "monospace"
|
133
|
+
}, '</IconButton>')), ___EmotionJSX(TableCell, null, ___EmotionJSX(IconButton, {
|
134
|
+
"aria-label": "create buton",
|
135
|
+
variant: "inverted",
|
136
|
+
sx: {
|
137
|
+
width: 'unset'
|
138
|
+
}
|
139
|
+
}, ___EmotionJSX(Icon, {
|
140
|
+
icon: CreateIcon,
|
141
|
+
size: "md"
|
142
|
+
}))))));
|
143
|
+
};
|
144
|
+
export var CommonlyUsed = function CommonlyUsed() {
|
145
|
+
return (// please note these are intentionally not mapped for story transparency
|
146
|
+
___EmotionJSX(React.Fragment, null, ___EmotionJSX(Text, {
|
147
|
+
fontFamily: "monospace",
|
148
|
+
mb: "md"
|
149
|
+
}, "import DeleteIcon from 'mdi-react/DeleteIcon'; "), ___EmotionJSX(Box, {
|
150
|
+
isRow: true,
|
151
|
+
gap: "md",
|
152
|
+
mb: "md"
|
153
|
+
}, ___EmotionJSX(IconButton, {
|
154
|
+
"aria-label": "delete"
|
155
|
+
}, ___EmotionJSX(Icon, {
|
156
|
+
icon: DeleteIcon,
|
157
|
+
size: "xs"
|
158
|
+
})), ___EmotionJSX(IconButton, {
|
159
|
+
"aria-label": "delete"
|
160
|
+
}, ___EmotionJSX(Icon, {
|
161
|
+
icon: DeleteIcon,
|
162
|
+
size: "sm"
|
163
|
+
})), ___EmotionJSX(IconButton, {
|
164
|
+
"aria-label": "delete"
|
165
|
+
}, ___EmotionJSX(Icon, {
|
166
|
+
icon: DeleteIcon,
|
167
|
+
size: "md"
|
168
|
+
}))), ___EmotionJSX(Box, {
|
169
|
+
isRow: true,
|
170
|
+
gap: "md",
|
171
|
+
mb: "xl"
|
172
|
+
}, ___EmotionJSX(IconButton, {
|
173
|
+
"aria-label": "delete",
|
174
|
+
variant: "inverted"
|
175
|
+
}, ___EmotionJSX(Icon, {
|
176
|
+
icon: DeleteIcon,
|
177
|
+
size: "xs"
|
178
|
+
})), ___EmotionJSX(IconButton, {
|
179
|
+
"aria-label": "delete",
|
180
|
+
variant: "inverted"
|
181
|
+
}, ___EmotionJSX(Icon, {
|
182
|
+
icon: DeleteIcon,
|
183
|
+
size: "sm"
|
184
|
+
})), ___EmotionJSX(IconButton, {
|
185
|
+
"aria-label": "delete",
|
186
|
+
variant: "inverted"
|
187
|
+
}, ___EmotionJSX(Icon, {
|
188
|
+
icon: DeleteIcon,
|
189
|
+
size: "md"
|
190
|
+
}))), ___EmotionJSX(Text, {
|
191
|
+
fontFamily: "monospace",
|
192
|
+
mb: "md"
|
193
|
+
}, "import DotsVerticalIcon from 'mdi-react/DotsVerticalIcon'; "), ___EmotionJSX(Box, {
|
194
|
+
isRow: true,
|
195
|
+
gap: "md",
|
196
|
+
mb: "md"
|
197
|
+
}, ___EmotionJSX(IconButton, {
|
198
|
+
"aria-label": "more options"
|
199
|
+
}, ___EmotionJSX(Icon, {
|
200
|
+
icon: DotsVerticalIcon,
|
201
|
+
size: "xs"
|
202
|
+
})), ___EmotionJSX(IconButton, {
|
203
|
+
"aria-label": "more options"
|
204
|
+
}, ___EmotionJSX(Icon, {
|
205
|
+
icon: DotsVerticalIcon,
|
206
|
+
size: "sm"
|
207
|
+
})), ___EmotionJSX(IconButton, {
|
208
|
+
"aria-label": "more options"
|
209
|
+
}, ___EmotionJSX(Icon, {
|
210
|
+
icon: DotsVerticalIcon,
|
211
|
+
size: "md"
|
212
|
+
}))), ___EmotionJSX(Box, {
|
213
|
+
isRow: true,
|
214
|
+
gap: "md",
|
215
|
+
mb: "xl"
|
216
|
+
}, ___EmotionJSX(IconButton, {
|
217
|
+
"aria-label": "more options",
|
218
|
+
variant: "inverted"
|
219
|
+
}, ___EmotionJSX(Icon, {
|
220
|
+
icon: DotsVerticalIcon,
|
221
|
+
size: "xs"
|
222
|
+
})), ___EmotionJSX(IconButton, {
|
223
|
+
"aria-label": "more options",
|
224
|
+
variant: "inverted"
|
225
|
+
}, ___EmotionJSX(Icon, {
|
226
|
+
icon: DotsVerticalIcon,
|
227
|
+
size: "sm"
|
228
|
+
})), ___EmotionJSX(IconButton, {
|
229
|
+
"aria-label": "more options",
|
230
|
+
variant: "inverted"
|
231
|
+
}, ___EmotionJSX(Icon, {
|
232
|
+
icon: DotsVerticalIcon,
|
233
|
+
size: "md"
|
234
|
+
}))), ___EmotionJSX(Text, {
|
235
|
+
fontFamily: "monospace",
|
236
|
+
mb: "md"
|
237
|
+
}, "import PlusIcon from 'mdi-react/PlusIcon'; "), ___EmotionJSX(Box, {
|
238
|
+
isRow: true,
|
239
|
+
gap: "md",
|
240
|
+
mb: "md"
|
241
|
+
}, ___EmotionJSX(IconButton, {
|
242
|
+
"aria-label": "add"
|
243
|
+
}, ___EmotionJSX(Icon, {
|
244
|
+
icon: PlusIcon,
|
245
|
+
size: "xs"
|
246
|
+
})), ___EmotionJSX(IconButton, {
|
247
|
+
"aria-label": "add"
|
248
|
+
}, ___EmotionJSX(Icon, {
|
249
|
+
icon: PlusIcon,
|
250
|
+
size: "sm"
|
251
|
+
})), ___EmotionJSX(IconButton, {
|
252
|
+
"aria-label": "add"
|
253
|
+
}, ___EmotionJSX(Icon, {
|
254
|
+
icon: PlusIcon,
|
255
|
+
size: "md"
|
256
|
+
}))), ___EmotionJSX(Box, {
|
257
|
+
isRow: true,
|
258
|
+
gap: "md",
|
259
|
+
mb: "xl"
|
260
|
+
}, ___EmotionJSX(IconButton, {
|
261
|
+
"aria-label": "add",
|
262
|
+
variant: "inverted"
|
263
|
+
}, ___EmotionJSX(Icon, {
|
264
|
+
icon: PlusIcon,
|
265
|
+
size: "xs"
|
266
|
+
})), ___EmotionJSX(IconButton, {
|
267
|
+
"aria-label": "add",
|
268
|
+
variant: "inverted"
|
269
|
+
}, ___EmotionJSX(Icon, {
|
270
|
+
icon: PlusIcon,
|
271
|
+
size: "sm"
|
272
|
+
})), ___EmotionJSX(IconButton, {
|
273
|
+
"aria-label": "add",
|
274
|
+
variant: "inverted"
|
275
|
+
}, ___EmotionJSX(Icon, {
|
276
|
+
icon: PlusIcon,
|
277
|
+
size: "md"
|
278
|
+
}))), ___EmotionJSX(Text, {
|
279
|
+
fontFamily: "monospace",
|
280
|
+
mb: "md"
|
281
|
+
}, "import PencilIcon from 'mdi-react/PencilIcon'; "), ___EmotionJSX(Box, {
|
282
|
+
isRow: true,
|
283
|
+
gap: "md",
|
284
|
+
mb: "md"
|
285
|
+
}, ___EmotionJSX(IconButton, {
|
286
|
+
"aria-label": "create"
|
287
|
+
}, ___EmotionJSX(Icon, {
|
288
|
+
icon: PencilIcon,
|
289
|
+
size: "xs"
|
290
|
+
})), ___EmotionJSX(IconButton, {
|
291
|
+
"aria-label": "create"
|
292
|
+
}, ___EmotionJSX(Icon, {
|
293
|
+
icon: PencilIcon,
|
294
|
+
size: "sm"
|
295
|
+
})), ___EmotionJSX(IconButton, {
|
296
|
+
"aria-label": "create"
|
297
|
+
}, ___EmotionJSX(Icon, {
|
298
|
+
icon: PencilIcon,
|
299
|
+
size: "md"
|
300
|
+
}))), ___EmotionJSX(Box, {
|
301
|
+
isRow: true,
|
302
|
+
gap: "md",
|
303
|
+
mb: "xl"
|
304
|
+
}, ___EmotionJSX(IconButton, {
|
305
|
+
"aria-label": "create",
|
306
|
+
variant: "inverted"
|
307
|
+
}, ___EmotionJSX(Icon, {
|
308
|
+
icon: PencilIcon,
|
309
|
+
size: "xs"
|
310
|
+
})), ___EmotionJSX(IconButton, {
|
311
|
+
"aria-label": "create",
|
312
|
+
variant: "inverted"
|
313
|
+
}, ___EmotionJSX(Icon, {
|
314
|
+
icon: PencilIcon,
|
315
|
+
size: "sm"
|
316
|
+
})), ___EmotionJSX(IconButton, {
|
317
|
+
"aria-label": "create",
|
318
|
+
variant: "inverted"
|
319
|
+
}, ___EmotionJSX(Icon, {
|
320
|
+
icon: PencilIcon,
|
321
|
+
size: "md"
|
322
|
+
}))))
|
323
|
+
);
|
67
324
|
};
|
package/lib/hooks/index.js
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
export { default as useAriaLabelWarning } from './useAriaLabelWarning';
|
2
2
|
export { default as useColumnStyles } from './useColumnStyles';
|
3
|
+
export { default as useComponentToggle } from './useComponentToggle';
|
4
|
+
export { default as useDebounce } from './useDebounce';
|
3
5
|
export { default as useDeprecationWarning } from './useDeprecationWarning';
|
6
|
+
export { default as useFallbackImage } from './useFallbackImage';
|
4
7
|
export { default as useField } from './useField';
|
5
8
|
export { default as useLabelHeight } from './useLabelHeight';
|
6
9
|
export { default as useModalState } from './useModalState';
|
10
|
+
export { default as useNavBarPress } from './useNavBarPress';
|
7
11
|
export { default as useOverlayPanelState } from './useOverlayPanelState';
|
8
12
|
export { default as usePropWarning } from './usePropWarning';
|
9
13
|
export { default as useProgressiveState } from './useProgressiveState';
|
10
|
-
export { default as useComponentToggle } from './useComponentToggle';
|
11
|
-
export { default as useNavBarPress } from './useNavBarPress';
|
12
14
|
export { default as useRockerButton } from './useRockerButton';
|
13
15
|
export { default as useSelectField } from './useSelectField';
|
14
16
|
export { default as useStatusClasses } from './useStatusClasses';
|
15
|
-
export { default as
|
16
|
-
export { default as useFallbackImage } from './useFallbackImage';
|
17
|
+
export { default as useTShirtSize } from './useTShirtSize';
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './useTShirtSize';
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { useMemo } from 'react';
|
2
|
+
import { tShirtSizes } from '../../utils/devUtils/constants/tShirtSizes';
|
3
|
+
/**
|
4
|
+
* A custom hook which returns the pixel value of a tShirtSize.
|
5
|
+
* @param {Object} [props] The props object
|
6
|
+
* @param {String} [props.size] The size of the svg container
|
7
|
+
* @returns {Object} `{ sizeProps: Object }`
|
8
|
+
*/
|
9
|
+
|
10
|
+
var useTShirtSize = function useTShirtSize(_ref) {
|
11
|
+
var size = _ref.size;
|
12
|
+
var value = useMemo(function () {
|
13
|
+
if (size === undefined) {
|
14
|
+
// eslint-disable-next-line no-console
|
15
|
+
console.warn('useTShirtSize hook requires a size prop.');
|
16
|
+
return undefined;
|
17
|
+
}
|
18
|
+
|
19
|
+
return tShirtSizes === null || tShirtSizes === void 0 ? void 0 : tShirtSizes[size];
|
20
|
+
}, [size]);
|
21
|
+
var sizeProps = {
|
22
|
+
size: value ? "".concat(value, "px") : size
|
23
|
+
};
|
24
|
+
return {
|
25
|
+
sizeProps: sizeProps
|
26
|
+
};
|
27
|
+
};
|
28
|
+
|
29
|
+
export default useTShirtSize;
|