@bolio-ui/core 1.0.1 → 1.0.3
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/README.md +25 -7
- package/dist/avatar/index.js +6 -6
- package/dist/card/index.js +1 -1
- package/dist/index.js +499 -215
- package/dist/input/index.js +7 -7
- package/dist/table/index.js +1139 -0
- package/esm/avatar/avatar.js +6 -6
- package/esm/button/stories.js +1 -1
- package/esm/card/styles.js +1 -1
- package/esm/index.js +1 -0
- package/esm/input/input.js +7 -7
- package/esm/table/index.js +2 -0
- package/esm/table/stories.js +269 -0
- package/esm/table/table-body.js +54 -0
- package/esm/table/table-cell.js +28 -0
- package/esm/table/table-column.js +41 -0
- package/esm/table/table-context.js +9 -0
- package/esm/table/table-head.js +58 -0
- package/esm/table/table-types.js +1 -0
- package/esm/table/table.js +115 -0
- package/package.json +4 -4
package/esm/avatar/avatar.js
CHANGED
|
@@ -83,7 +83,7 @@ function AvatarComponent(_ref) {
|
|
|
83
83
|
};
|
|
84
84
|
}, [loading, showAnimation]);
|
|
85
85
|
return /*#__PURE__*/React.createElement("span", {
|
|
86
|
-
className: _JSXStyle.dynamic([["
|
|
86
|
+
className: _JSXStyle.dynamic([["2739790524", [radius, theme.palette.accents_2, SCALES.width(1.75) || SCALES.height(1.75), SCALES.height(1.75) || SCALES.width(1.75), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), marginLeft, radius, SCALES.font(1)]]]) + " " + (classes || "")
|
|
87
87
|
}, !showText && /*#__PURE__*/React.createElement(React.Fragment, null, showSkeleton && showAnimation && /*#__PURE__*/React.createElement(AvatarSkeleton, {
|
|
88
88
|
opacity: loading ? 1 : 0
|
|
89
89
|
}), /*#__PURE__*/React.createElement("img", _extends({
|
|
@@ -93,13 +93,13 @@ function AvatarComponent(_ref) {
|
|
|
93
93
|
onLoad: imageLoaded,
|
|
94
94
|
draggable: false
|
|
95
95
|
}, props, {
|
|
96
|
-
className: _JSXStyle.dynamic([["
|
|
96
|
+
className: _JSXStyle.dynamic([["2739790524", [radius, theme.palette.accents_2, SCALES.width(1.75) || SCALES.height(1.75), SCALES.height(1.75) || SCALES.width(1.75), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), marginLeft, radius, SCALES.font(1)]]]) + " " + (props && props.className != null && props.className || "avatar-img")
|
|
97
97
|
}))), showText && /*#__PURE__*/React.createElement("span", _extends({}, props, {
|
|
98
|
-
className: _JSXStyle.dynamic([["
|
|
98
|
+
className: _JSXStyle.dynamic([["2739790524", [radius, theme.palette.accents_2, SCALES.width(1.75) || SCALES.height(1.75), SCALES.height(1.75) || SCALES.width(1.75), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), marginLeft, radius, SCALES.font(1)]]]) + " " + (props && props.className != null && props.className || "avatar-text")
|
|
99
99
|
}), safeText(text)), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
100
|
-
id: "
|
|
101
|
-
dynamic: [radius, theme.palette.
|
|
102
|
-
}, ".avatar.__jsx-style-dynamic-selector{display:inline-block;position:relative;overflow:hidden;border-radius:".concat(radius, ";vertical-align:top;background-color:").concat(theme.palette.
|
|
100
|
+
id: "2739790524",
|
|
101
|
+
dynamic: [radius, theme.palette.accents_2, SCALES.width(1.75) || SCALES.height(1.75), SCALES.height(1.75) || SCALES.width(1.75), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), marginLeft, radius, SCALES.font(1)]
|
|
102
|
+
}, ".avatar.__jsx-style-dynamic-selector{display:inline-block;position:relative;overflow:hidden;border-radius:".concat(radius, ";vertical-align:top;background-color:").concat(theme.palette.accents_2, ";box-sizing:border-box;width:").concat(SCALES.width(1.75) || SCALES.height(1.75), ";height:").concat(SCALES.height(1.75) || SCALES.width(1.75), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(marginLeft, ";}.avatar-img.__jsx-style-dynamic-selector{display:inline-block;object-fit:cover;width:100%;height:100%;border-radius:").concat(radius, ";-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-align:center;}.avatar-text.__jsx-style-dynamic-selector{position:absolute;left:50%;top:50%;font-size:").concat(SCALES.font(1), ";text-align:center;-webkit-transform:translate(-50%,-50%) scale(0.65);-ms-transform:translate(-50%,-50%) scale(0.65);transform:translate(-50%,-50%) scale(0.65);white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}")));
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
AvatarComponent.displayName = 'BolioUIAvatar';
|
package/esm/button/stories.js
CHANGED
|
@@ -61,7 +61,7 @@ export var TypeColors = function TypeColors() {
|
|
|
61
61
|
}, "Error")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Button, {
|
|
62
62
|
auto: true,
|
|
63
63
|
type: "info"
|
|
64
|
-
}, "
|
|
64
|
+
}, "Info")), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Button, {
|
|
65
65
|
auto: true,
|
|
66
66
|
type: "abort"
|
|
67
67
|
}, "Abort")));
|
package/esm/card/styles.js
CHANGED
package/esm/index.js
CHANGED
|
@@ -42,6 +42,7 @@ export { default as Slider } from './slider';
|
|
|
42
42
|
export { default as Snippet } from './snippet';
|
|
43
43
|
export { default as Spacer } from './spacer';
|
|
44
44
|
export { default as Spinner } from './spinner';
|
|
45
|
+
export { default as Table } from './table';
|
|
45
46
|
export { default as Tabs } from './tabs';
|
|
46
47
|
export { default as Tag } from './tag';
|
|
47
48
|
export { default as Text } from './text';
|
package/esm/input/input.js
CHANGED
|
@@ -137,11 +137,11 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
137
137
|
var inputProps = _extends({}, props, controlledValue);
|
|
138
138
|
|
|
139
139
|
return /*#__PURE__*/React.createElement("div", {
|
|
140
|
-
className: _JSXStyle.dynamic([["
|
|
140
|
+
className: _JSXStyle.dynamic([["363116299", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), rounded ? '25px' : theme.layout.radius, backgroundColor ? backgroundColor : theme.palette.accents_2, theme.palette.accents_4, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + "with-label"
|
|
141
141
|
}, children && /*#__PURE__*/React.createElement(InputBlockLabel, null, children), /*#__PURE__*/React.createElement("div", {
|
|
142
|
-
className: _JSXStyle.dynamic([["
|
|
142
|
+
className: _JSXStyle.dynamic([["363116299", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), rounded ? '25px' : theme.layout.radius, backgroundColor ? backgroundColor : theme.palette.accents_2, theme.palette.accents_4, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + (useClasses('input-container', className) || "")
|
|
143
143
|
}, label && /*#__PURE__*/React.createElement(InputLabel, null, label), /*#__PURE__*/React.createElement("div", {
|
|
144
|
-
className: _JSXStyle.dynamic([["
|
|
144
|
+
className: _JSXStyle.dynamic([["363116299", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), rounded ? '25px' : theme.layout.radius, backgroundColor ? backgroundColor : theme.palette.accents_2, theme.palette.accents_4, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + (useClasses('input-wrapper', {
|
|
145
145
|
hover: hover,
|
|
146
146
|
disabled: disabled
|
|
147
147
|
}, labelClasses) || "")
|
|
@@ -158,7 +158,7 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
158
158
|
onChange: changeHandler,
|
|
159
159
|
autoComplete: autoComplete
|
|
160
160
|
}, inputProps, {
|
|
161
|
-
className: _JSXStyle.dynamic([["
|
|
161
|
+
className: _JSXStyle.dynamic([["363116299", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), rounded ? '25px' : theme.layout.radius, backgroundColor ? backgroundColor : theme.palette.accents_2, theme.palette.accents_4, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + (inputProps && inputProps.className != null && inputProps.className || useClasses({
|
|
162
162
|
disabled: disabled
|
|
163
163
|
}, iconClasses) || "")
|
|
164
164
|
})), clearable && /*#__PURE__*/React.createElement(InputClearIcon, {
|
|
@@ -170,9 +170,9 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
170
170
|
}, iconProps))), labelRight && /*#__PURE__*/React.createElement(InputLabel, {
|
|
171
171
|
isRight: true
|
|
172
172
|
}, labelRight)), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
173
|
-
id: "
|
|
174
|
-
dynamic: [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), rounded ? '25px' : theme.layout.radius, backgroundColor ? backgroundColor : theme.palette.accents_2, theme.palette.
|
|
175
|
-
}, ".with-label.__jsx-style-dynamic-selector{display:inline-block;box-sizing:border-box;-webkit-box-align:center;--input-height:".concat(SCALES.height(2.25), ";font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, 'initial'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.input-container.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:").concat(SCALES.width(1, 'initial'), ";height:var(--input-height);}.input-wrapper.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;vertical-align:middle;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%;-webkit-flex:1;-ms-flex:1;flex:1;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:").concat(rounded ? '25px' : theme.layout.radius, ";-webkit-transition:border 0.2s ease 0s,color 0.2s ease 0s;transition:border 0.2s ease 0s,color 0.2s ease 0s;background:").concat(backgroundColor ? backgroundColor : theme.palette.accents_2, ";}.input-wrapper.left-label.__jsx-style-dynamic-selector{border-top-left-radius:0;border-bottom-left-radius:0;}.input-wrapper.right-label.__jsx-style-dynamic-selector{border-top-right-radius:0;border-bottom-right-radius:0;}.input-wrapper.disabled.__jsx-style-dynamic-selector{background-color:").concat(theme.palette.
|
|
173
|
+
id: "363116299",
|
|
174
|
+
dynamic: [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, 'initial'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, 'initial'), rounded ? '25px' : theme.layout.radius, backgroundColor ? backgroundColor : theme.palette.accents_2, theme.palette.accents_4, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]
|
|
175
|
+
}, ".with-label.__jsx-style-dynamic-selector{display:inline-block;box-sizing:border-box;-webkit-box-align:center;--input-height:".concat(SCALES.height(2.25), ";font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, 'initial'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.input-container.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:").concat(SCALES.width(1, 'initial'), ";height:var(--input-height);}.input-wrapper.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;vertical-align:middle;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%;-webkit-flex:1;-ms-flex:1;flex:1;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:").concat(rounded ? '25px' : theme.layout.radius, ";-webkit-transition:border 0.2s ease 0s,color 0.2s ease 0s;transition:border 0.2s ease 0s,color 0.2s ease 0s;background:").concat(backgroundColor ? backgroundColor : theme.palette.accents_2, ";}.input-wrapper.left-label.__jsx-style-dynamic-selector{border-top-left-radius:0;border-bottom-left-radius:0;}.input-wrapper.right-label.__jsx-style-dynamic-selector{border-top-right-radius:0;border-bottom-right-radius:0;}.input-wrapper.disabled.__jsx-style-dynamic-selector{background-color:").concat(theme.palette.accents_4, ";cursor:not-allowed;}input.disabled.__jsx-style-dynamic-selector{cursor:not-allowed;}.input-wrapper.hover.__jsx-style-dynamic-selector{border-color:").concat(hoverBorder, ";}input.__jsx-style-dynamic-selector{margin:0.25em 0.625em;padding:0 4px;box-shadow:none;font-size:").concat(SCALES.font(0.875), ";background-color:transparent;border:none;color:").concat(color, ";outline:none;border-radius:0;width:100%;min-width:0;-webkit-appearance:none;}input.left-icon.__jsx-style-dynamic-selector{margin-left:0;}input.right-icon.__jsx-style-dynamic-selector{margin-right:0;}.__jsx-style-dynamic-selector::-webkit-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector::placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector::-ms-reveal{display:none !important;}input.__jsx-style-dynamic-selector:-webkit-autofill,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:hover,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:active,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:focus{-webkit-box-shadow:0 0 0 30px ").concat(theme.palette.background, " inset !important;-webkit-text-fill-color:").concat(color, " !important;}")));
|
|
176
176
|
});
|
|
177
177
|
InputComponent.defaultProps = defaultProps;
|
|
178
178
|
InputComponent.displayName = 'BolioUIInput';
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import Table from '.';
|
|
5
|
+
import Code from '../code';
|
|
6
|
+
import Text from '../text';
|
|
7
|
+
import Button from '../button';
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Data Display/Table',
|
|
10
|
+
component: Table
|
|
11
|
+
};
|
|
12
|
+
export var Default = function Default() {
|
|
13
|
+
var data = [{
|
|
14
|
+
property: 'type',
|
|
15
|
+
description: 'Content type',
|
|
16
|
+
type: 'secondary | warning',
|
|
17
|
+
"default": '-'
|
|
18
|
+
}, {
|
|
19
|
+
property: 'Component',
|
|
20
|
+
description: 'DOM element to use',
|
|
21
|
+
type: 'string',
|
|
22
|
+
"default": '-'
|
|
23
|
+
}, {
|
|
24
|
+
property: 'bold',
|
|
25
|
+
description: 'Bold style',
|
|
26
|
+
type: 'boolean',
|
|
27
|
+
"default": 'true'
|
|
28
|
+
}];
|
|
29
|
+
return /*#__PURE__*/React.createElement(Table, {
|
|
30
|
+
data: data
|
|
31
|
+
}, /*#__PURE__*/React.createElement(Table.Column, {
|
|
32
|
+
prop: "property",
|
|
33
|
+
label: "property"
|
|
34
|
+
}), /*#__PURE__*/React.createElement(Table.Column, {
|
|
35
|
+
prop: "description",
|
|
36
|
+
label: "description"
|
|
37
|
+
}), /*#__PURE__*/React.createElement(Table.Column, {
|
|
38
|
+
prop: "type",
|
|
39
|
+
label: "type"
|
|
40
|
+
}), /*#__PURE__*/React.createElement(Table.Column, {
|
|
41
|
+
prop: "default",
|
|
42
|
+
label: "default"
|
|
43
|
+
}));
|
|
44
|
+
};
|
|
45
|
+
export var Compose = function Compose() {
|
|
46
|
+
var data = [{
|
|
47
|
+
property: 'type',
|
|
48
|
+
description: 'Content type',
|
|
49
|
+
type: 'secondary | warning',
|
|
50
|
+
"default": '-'
|
|
51
|
+
}, {
|
|
52
|
+
property: 'Component',
|
|
53
|
+
description: 'DOM element to use',
|
|
54
|
+
type: /*#__PURE__*/React.createElement(Code, null, "string"),
|
|
55
|
+
"default": '-'
|
|
56
|
+
}, {
|
|
57
|
+
property: /*#__PURE__*/React.createElement(Text, {
|
|
58
|
+
b: true
|
|
59
|
+
}, "bold"),
|
|
60
|
+
description: 'Bold style',
|
|
61
|
+
type: /*#__PURE__*/React.createElement(Code, null, "boolean"),
|
|
62
|
+
"default": /*#__PURE__*/React.createElement(Code, null, "true")
|
|
63
|
+
}];
|
|
64
|
+
return /*#__PURE__*/React.createElement(Table, {
|
|
65
|
+
data: data
|
|
66
|
+
}, /*#__PURE__*/React.createElement(Table.Column, {
|
|
67
|
+
prop: "property",
|
|
68
|
+
label: "property"
|
|
69
|
+
}), /*#__PURE__*/React.createElement(Table.Column, {
|
|
70
|
+
prop: "description",
|
|
71
|
+
label: "description"
|
|
72
|
+
}), /*#__PURE__*/React.createElement(Table.Column, {
|
|
73
|
+
prop: "type",
|
|
74
|
+
label: "type"
|
|
75
|
+
}), /*#__PURE__*/React.createElement(Table.Column, {
|
|
76
|
+
prop: "default",
|
|
77
|
+
label: "default"
|
|
78
|
+
}));
|
|
79
|
+
};
|
|
80
|
+
export var Width = function Width() {
|
|
81
|
+
var data = [{
|
|
82
|
+
property: 'type',
|
|
83
|
+
description: 'Content type',
|
|
84
|
+
type: 'secondary | warning',
|
|
85
|
+
"default": '-'
|
|
86
|
+
}, {
|
|
87
|
+
property: 'Component',
|
|
88
|
+
description: 'DOM element to use',
|
|
89
|
+
type: /*#__PURE__*/React.createElement(Code, null, "string"),
|
|
90
|
+
"default": '-'
|
|
91
|
+
}, {
|
|
92
|
+
property: /*#__PURE__*/React.createElement(Text, {
|
|
93
|
+
b: true
|
|
94
|
+
}, "bold"),
|
|
95
|
+
description: 'Bold style',
|
|
96
|
+
type: /*#__PURE__*/React.createElement(Code, null, "boolean"),
|
|
97
|
+
"default": /*#__PURE__*/React.createElement(Code, null, "true")
|
|
98
|
+
}];
|
|
99
|
+
return /*#__PURE__*/React.createElement(Table, {
|
|
100
|
+
data: data
|
|
101
|
+
}, /*#__PURE__*/React.createElement(Table.Column, {
|
|
102
|
+
prop: "property",
|
|
103
|
+
label: "property",
|
|
104
|
+
width: 50
|
|
105
|
+
}), /*#__PURE__*/React.createElement(Table.Column, {
|
|
106
|
+
prop: "description",
|
|
107
|
+
label: "description"
|
|
108
|
+
}), /*#__PURE__*/React.createElement(Table.Column, {
|
|
109
|
+
prop: "type",
|
|
110
|
+
label: "type"
|
|
111
|
+
}), /*#__PURE__*/React.createElement(Table.Column, {
|
|
112
|
+
prop: "default",
|
|
113
|
+
label: "default"
|
|
114
|
+
}));
|
|
115
|
+
};
|
|
116
|
+
export var Actions = function Actions() {
|
|
117
|
+
var dataSource = [{
|
|
118
|
+
property: 'type',
|
|
119
|
+
description: 'Content type',
|
|
120
|
+
operation: ''
|
|
121
|
+
}, {
|
|
122
|
+
property: 'Component',
|
|
123
|
+
description: 'DOM element to use',
|
|
124
|
+
operation: ''
|
|
125
|
+
}, {
|
|
126
|
+
property: /*#__PURE__*/React.createElement(Text, {
|
|
127
|
+
b: true
|
|
128
|
+
}, "bold"),
|
|
129
|
+
description: 'Bold style',
|
|
130
|
+
operation: ''
|
|
131
|
+
}];
|
|
132
|
+
|
|
133
|
+
var _useState = useState(dataSource),
|
|
134
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
135
|
+
data = _useState2[0],
|
|
136
|
+
setData = _useState2[1];
|
|
137
|
+
|
|
138
|
+
var renderAction = function renderAction(value, rowData, index) {
|
|
139
|
+
var removeHandler = function removeHandler() {
|
|
140
|
+
setData(function (last) {
|
|
141
|
+
return last.filter(function (_, dataIndex) {
|
|
142
|
+
return dataIndex !== index;
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
148
|
+
type: "error",
|
|
149
|
+
auto: true,
|
|
150
|
+
scale: 1 / 3,
|
|
151
|
+
font: "12px",
|
|
152
|
+
onClick: removeHandler
|
|
153
|
+
}, "Remove");
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
return /*#__PURE__*/React.createElement(Table, {
|
|
157
|
+
data: data,
|
|
158
|
+
onChange: function onChange(value) {
|
|
159
|
+
return setData(value);
|
|
160
|
+
}
|
|
161
|
+
}, /*#__PURE__*/React.createElement(Table.Column, {
|
|
162
|
+
prop: "property",
|
|
163
|
+
label: "property"
|
|
164
|
+
}), /*#__PURE__*/React.createElement(Table.Column, {
|
|
165
|
+
prop: "description",
|
|
166
|
+
label: "description"
|
|
167
|
+
}), /*#__PURE__*/React.createElement(Table.Column, {
|
|
168
|
+
prop: "operation",
|
|
169
|
+
label: "operation",
|
|
170
|
+
width: 150,
|
|
171
|
+
render: renderAction
|
|
172
|
+
}));
|
|
173
|
+
};
|
|
174
|
+
export var UpdateRow = function UpdateRow() {
|
|
175
|
+
var dataSource = [{
|
|
176
|
+
property: 'type',
|
|
177
|
+
description: 'Content type',
|
|
178
|
+
operation: ''
|
|
179
|
+
}, {
|
|
180
|
+
property: 'Component',
|
|
181
|
+
description: 'DOM element to use',
|
|
182
|
+
operation: ''
|
|
183
|
+
}, {
|
|
184
|
+
property: /*#__PURE__*/React.createElement(Text, {
|
|
185
|
+
b: true
|
|
186
|
+
}, "bold"),
|
|
187
|
+
description: 'Bold style',
|
|
188
|
+
operation: ''
|
|
189
|
+
}];
|
|
190
|
+
|
|
191
|
+
var _React$useState = React.useState(dataSource),
|
|
192
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
193
|
+
data = _React$useState2[0],
|
|
194
|
+
setData = _React$useState2[1];
|
|
195
|
+
|
|
196
|
+
var renderAction = function renderAction(value, rowData, rowIndex) {
|
|
197
|
+
var updateHandler = function updateHandler() {
|
|
198
|
+
setData(function (last) {
|
|
199
|
+
return last.map(function (item, dataIndex) {
|
|
200
|
+
if (dataIndex !== rowIndex) return item;
|
|
201
|
+
return _extends({}, item, {
|
|
202
|
+
property: Math.random().toString(16).slice(-5)
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
209
|
+
type: "secondary",
|
|
210
|
+
auto: true,
|
|
211
|
+
scale: 1 / 3,
|
|
212
|
+
font: "12px",
|
|
213
|
+
onClick: updateHandler
|
|
214
|
+
}, "Update");
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
return /*#__PURE__*/React.createElement(Table, {
|
|
218
|
+
data: data,
|
|
219
|
+
onChange: function onChange(value) {
|
|
220
|
+
return setData(value);
|
|
221
|
+
}
|
|
222
|
+
}, /*#__PURE__*/React.createElement(Table.Column, {
|
|
223
|
+
prop: "property",
|
|
224
|
+
label: "property"
|
|
225
|
+
}), /*#__PURE__*/React.createElement(Table.Column, {
|
|
226
|
+
prop: "description",
|
|
227
|
+
label: "description"
|
|
228
|
+
}), /*#__PURE__*/React.createElement(Table.Column, {
|
|
229
|
+
prop: "operation",
|
|
230
|
+
label: "operation",
|
|
231
|
+
width: 150,
|
|
232
|
+
render: renderAction
|
|
233
|
+
}));
|
|
234
|
+
};
|
|
235
|
+
export var CustomHead = function CustomHead() {
|
|
236
|
+
var data = [{
|
|
237
|
+
property: 'type',
|
|
238
|
+
description: 'Content type',
|
|
239
|
+
type: 'secondary | warning',
|
|
240
|
+
"default": '-'
|
|
241
|
+
}, {
|
|
242
|
+
property: 'Component',
|
|
243
|
+
description: 'DOM element to use',
|
|
244
|
+
type: /*#__PURE__*/React.createElement(Code, null, "string"),
|
|
245
|
+
"default": '-'
|
|
246
|
+
}, {
|
|
247
|
+
property: /*#__PURE__*/React.createElement(Text, {
|
|
248
|
+
b: true
|
|
249
|
+
}, "bold"),
|
|
250
|
+
description: 'Bold style',
|
|
251
|
+
type: /*#__PURE__*/React.createElement(Code, null, "boolean"),
|
|
252
|
+
"default": /*#__PURE__*/React.createElement(Code, null, "true")
|
|
253
|
+
}];
|
|
254
|
+
return /*#__PURE__*/React.createElement(Table, {
|
|
255
|
+
data: data
|
|
256
|
+
}, /*#__PURE__*/React.createElement(Table.Column, {
|
|
257
|
+
prop: "property",
|
|
258
|
+
label: "property"
|
|
259
|
+
}), /*#__PURE__*/React.createElement(Table.Column, {
|
|
260
|
+
prop: "description",
|
|
261
|
+
label: "description"
|
|
262
|
+
}), /*#__PURE__*/React.createElement(Table.Column, {
|
|
263
|
+
prop: "type"
|
|
264
|
+
}, /*#__PURE__*/React.createElement(Code, null, "type")), /*#__PURE__*/React.createElement(Table.Column, {
|
|
265
|
+
prop: "default"
|
|
266
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
267
|
+
b: true
|
|
268
|
+
}, "default")));
|
|
269
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import useTheme from '../use-theme';
|
|
4
|
+
import TableCell from './table-cell';
|
|
5
|
+
import { useTableContext } from './table-context';
|
|
6
|
+
import useClasses from '../use-classes';
|
|
7
|
+
var defaultProps = {
|
|
8
|
+
className: ''
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
var TableBody = function TableBody(_ref) {
|
|
12
|
+
var data = _ref.data,
|
|
13
|
+
hover = _ref.hover,
|
|
14
|
+
emptyText = _ref.emptyText,
|
|
15
|
+
onRow = _ref.onRow,
|
|
16
|
+
onCell = _ref.onCell,
|
|
17
|
+
rowClassName = _ref.rowClassName;
|
|
18
|
+
var theme = useTheme();
|
|
19
|
+
|
|
20
|
+
var _useTableContext = useTableContext(),
|
|
21
|
+
columns = _useTableContext.columns;
|
|
22
|
+
|
|
23
|
+
var rowClickHandler = function rowClickHandler(row, index) {
|
|
24
|
+
onRow && onRow(row, index);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return /*#__PURE__*/React.createElement("tbody", {
|
|
28
|
+
className: _JSXStyle.dynamic([["3433300570", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]])
|
|
29
|
+
}, data.map(function (row, index) {
|
|
30
|
+
var className = rowClassName(row, index);
|
|
31
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
32
|
+
key: "tbody-row-".concat(index),
|
|
33
|
+
onClick: function onClick() {
|
|
34
|
+
return rowClickHandler(row, index);
|
|
35
|
+
},
|
|
36
|
+
className: _JSXStyle.dynamic([["3433300570", [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]]]) + " " + (useClasses({
|
|
37
|
+
hover: hover
|
|
38
|
+
}, className) || "")
|
|
39
|
+
}, /*#__PURE__*/React.createElement(TableCell, {
|
|
40
|
+
columns: columns,
|
|
41
|
+
row: row,
|
|
42
|
+
rowIndex: index,
|
|
43
|
+
emptyText: emptyText,
|
|
44
|
+
onCellClick: onCell
|
|
45
|
+
}));
|
|
46
|
+
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
47
|
+
id: "3433300570",
|
|
48
|
+
dynamic: [theme.palette.accents_1, theme.palette.border, theme.palette.accents_6]
|
|
49
|
+
}, "tr.__jsx-style-dynamic-selector{-webkit-transition:background-color 0.25s ease;transition:background-color 0.25s ease;font-size:inherit;}tr.hover.__jsx-style-dynamic-selector:hover{background-color:".concat(theme.palette.accents_1, ";}tr.__jsx-style-dynamic-selector td{padding:0 0.5em;border-bottom:1px solid ").concat(theme.palette.border, ";color:").concat(theme.palette.accents_6, ";font-size:calc(0.875 * var(--table-font-size));text-align:left;}tr.__jsx-style-dynamic-selector .cell{min-height:calc(3.125 * var(--table-font-size));display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-flex-flow:row wrap;-ms-flex-flow:row wrap;flex-flow:row wrap;}")));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
TableBody.defaultProps = defaultProps;
|
|
53
|
+
TableBody.displayName = 'BolioUITableBody';
|
|
54
|
+
export default TableBody;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
var TableCell = function TableCell(_ref) {
|
|
4
|
+
var columns = _ref.columns,
|
|
5
|
+
row = _ref.row,
|
|
6
|
+
rowIndex = _ref.rowIndex,
|
|
7
|
+
emptyText = _ref.emptyText,
|
|
8
|
+
onCellClick = _ref.onCellClick;
|
|
9
|
+
|
|
10
|
+
/* eslint-disable react/jsx-no-useless-fragment */
|
|
11
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, columns.map(function (column, index) {
|
|
12
|
+
var currentRowValue = row[column.prop];
|
|
13
|
+
var cellValue = currentRowValue || emptyText;
|
|
14
|
+
var shouldBeRenderElement = column.renderHandler(currentRowValue, row, rowIndex);
|
|
15
|
+
return /*#__PURE__*/React.createElement("td", {
|
|
16
|
+
key: "row-td-".concat(index, "-").concat(column.prop),
|
|
17
|
+
onClick: function onClick() {
|
|
18
|
+
return onCellClick && onCellClick(currentRowValue, rowIndex, index);
|
|
19
|
+
},
|
|
20
|
+
className: column.className
|
|
21
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
22
|
+
className: "cell"
|
|
23
|
+
}, shouldBeRenderElement ? shouldBeRenderElement : cellValue));
|
|
24
|
+
}));
|
|
25
|
+
/* eslint-enable */
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default TableCell;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useTableContext } from './table-context';
|
|
3
|
+
import useWarning from '../utils/use-warning';
|
|
4
|
+
var defaultProps = {
|
|
5
|
+
className: '',
|
|
6
|
+
render: function render() {}
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
var TableColumn = function TableColumn(columnProps) {
|
|
10
|
+
var _ref = columnProps,
|
|
11
|
+
children = _ref.children,
|
|
12
|
+
prop = _ref.prop,
|
|
13
|
+
label = _ref.label,
|
|
14
|
+
width = _ref.width,
|
|
15
|
+
className = _ref.className,
|
|
16
|
+
renderHandler = _ref.render;
|
|
17
|
+
|
|
18
|
+
var _useTableContext = useTableContext(),
|
|
19
|
+
updateColumn = _useTableContext.updateColumn;
|
|
20
|
+
|
|
21
|
+
var safeProp = "".concat(prop).trim();
|
|
22
|
+
|
|
23
|
+
if (!safeProp) {
|
|
24
|
+
useWarning('The props "prop" is required.', 'Table.Column');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
updateColumn({
|
|
29
|
+
label: children || label,
|
|
30
|
+
prop: safeProp,
|
|
31
|
+
width: width,
|
|
32
|
+
className: className,
|
|
33
|
+
renderHandler: renderHandler
|
|
34
|
+
});
|
|
35
|
+
}, [children, label, prop, width, className, renderHandler]);
|
|
36
|
+
return null;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
TableColumn.defaultProps = defaultProps;
|
|
40
|
+
TableColumn.displayName = 'BolioUITableColumn';
|
|
41
|
+
export default TableColumn;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
var defaultContext = {
|
|
3
|
+
columns: [],
|
|
4
|
+
updateColumn: function updateColumn() {}
|
|
5
|
+
};
|
|
6
|
+
export var TableContext = /*#__PURE__*/React.createContext(defaultContext);
|
|
7
|
+
export var useTableContext = function useTableContext() {
|
|
8
|
+
return React.useContext(TableContext);
|
|
9
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import _JSXStyle from "../styled-jsx.es.js";
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import useTheme from '../use-theme';
|
|
4
|
+
var defaultProps = {
|
|
5
|
+
className: ''
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
var makeColgroup = function makeColgroup(width, columns) {
|
|
9
|
+
var unsetWidthCount = columns.filter(function (c) {
|
|
10
|
+
return !c.width;
|
|
11
|
+
}).length;
|
|
12
|
+
var customWidthTotal = columns.reduce(function (pre, current) {
|
|
13
|
+
return current.width ? pre + current.width : pre;
|
|
14
|
+
}, 0);
|
|
15
|
+
var averageWidth = (width - customWidthTotal) / unsetWidthCount;
|
|
16
|
+
if (averageWidth <= 0) return /*#__PURE__*/React.createElement("colgroup", null);
|
|
17
|
+
return /*#__PURE__*/React.createElement("colgroup", null, columns.map(function (column, index) {
|
|
18
|
+
return /*#__PURE__*/React.createElement("col", {
|
|
19
|
+
key: "colgroup-".concat(index),
|
|
20
|
+
width: column.width || averageWidth
|
|
21
|
+
});
|
|
22
|
+
}));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
var TableHead = function TableHead(props) {
|
|
26
|
+
var theme = useTheme();
|
|
27
|
+
var _ref = props,
|
|
28
|
+
columns = _ref.columns,
|
|
29
|
+
width = _ref.width;
|
|
30
|
+
var isScalableWidth = useMemo(function () {
|
|
31
|
+
return columns.find(function (item) {
|
|
32
|
+
return !!item.width;
|
|
33
|
+
});
|
|
34
|
+
}, [columns]);
|
|
35
|
+
var colgroup = useMemo(function () {
|
|
36
|
+
if (!isScalableWidth) return /*#__PURE__*/React.createElement("colgroup", null);
|
|
37
|
+
return makeColgroup(width, columns);
|
|
38
|
+
}, [isScalableWidth, width]);
|
|
39
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, colgroup, /*#__PURE__*/React.createElement("thead", {
|
|
40
|
+
className: _JSXStyle.dynamic([["134865897", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]])
|
|
41
|
+
}, /*#__PURE__*/React.createElement("tr", {
|
|
42
|
+
className: _JSXStyle.dynamic([["134865897", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]])
|
|
43
|
+
}, columns.map(function (column, index) {
|
|
44
|
+
return /*#__PURE__*/React.createElement("th", {
|
|
45
|
+
key: "table-th-".concat(column.prop, "-").concat(index),
|
|
46
|
+
className: _JSXStyle.dynamic([["134865897", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]]) + " " + (column.className || "")
|
|
47
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: _JSXStyle.dynamic([["134865897", [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]]]) + " " + "thead-box"
|
|
49
|
+
}, column.label));
|
|
50
|
+
}))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
51
|
+
id: "134865897",
|
|
52
|
+
dynamic: [theme.palette.accents_5, theme.palette.accents_1, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius, theme.palette.border, theme.palette.border, theme.palette.border, theme.layout.radius, theme.layout.radius]
|
|
53
|
+
}, "thead.__jsx-style-dynamic-selector{border-collapse:separate;border-spacing:0;font-size:inherit;}th.__jsx-style-dynamic-selector{padding:0 0.5em;font-size:calc(0.75 * var(--table-font-size));font-weight:normal;text-align:left;-webkit-letter-spacing:0;-moz-letter-spacing:0;-ms-letter-spacing:0;letter-spacing:0;vertical-align:middle;min-height:calc(2.5 * var(--table-font-size));color:".concat(theme.palette.accents_5, ";background:").concat(theme.palette.accents_1, ";border-bottom:1px solid ").concat(theme.palette.border, ";border-top:1px solid ").concat(theme.palette.border, ";border-radius:0;}th.__jsx-style-dynamic-selector:nth-child(1){border-bottom:1px solid ").concat(theme.palette.border, ";border-left:1px solid ").concat(theme.palette.border, ";border-top:1px solid ").concat(theme.palette.border, ";border-top-left-radius:").concat(theme.layout.radius, ";border-bottom-left-radius:").concat(theme.layout.radius, ";}th.__jsx-style-dynamic-selector:last-child{border-bottom:1px solid ").concat(theme.palette.border, ";border-right:1px solid ").concat(theme.palette.border, ";border-top:1px solid ").concat(theme.palette.border, ";border-top-right-radius:").concat(theme.layout.radius, ";border-bottom-right-radius:").concat(theme.layout.radius, ";}.thead-box.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-align:center;min-height:calc(2.5 * var(--table-font-size));text-transform:uppercase;}")));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
TableHead.defaultProps = defaultProps;
|
|
57
|
+
TableHead.displayName = 'BolioUITableHead';
|
|
58
|
+
export default TableHead;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|