@onesy/ui-react 1.0.132 → 1.0.134

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.
@@ -39,7 +39,6 @@ const IconMaterialDone = exports.IconMaterialDone = /*#__PURE__*/_react.default.
39
39
  const useStyle = (0, _styleReact.style)(theme => ({
40
40
  root: {
41
41
  position: 'relative',
42
- borderRadius: theme.methods.shape.radius.value('xl', 'px'),
43
42
  maxWidth: '100%'
44
43
  },
45
44
  orientation_horizontal_size_small: {
@@ -66,26 +65,6 @@ const useStyle = (0, _styleReact.style)(theme => ({
66
65
  width: '100% !important'
67
66
  }
68
67
  },
69
- // Size
70
- size_small: {
71
- borderRadius: `${theme.shape.radius.unit * 2}px`
72
- },
73
- size_regular: {
74
- borderRadius: `${theme.shape.radius.unit * 2.5}px`
75
- },
76
- size_large: {
77
- borderRadius: `${theme.shape.radius.unit * 3.5}px`
78
- },
79
- // Size
80
- chip_size_small: {
81
- borderRadius: `${theme.shape.radius.unit - theme.shape.radius.unit / 4}px`
82
- },
83
- chip_size_regular: {
84
- borderRadius: `${theme.shape.radius.unit}px`
85
- },
86
- chip_size_large: {
87
- borderRadius: `${theme.shape.radius.unit + theme.shape.radius.unit / 4}px`
88
- },
89
68
  // Shadows
90
69
  elevation: {
91
70
  boxShadow: theme.shadows.values.neutral[1],
@@ -348,7 +327,7 @@ const Buttons = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
348
327
  gap: 0,
349
328
  direction: "row",
350
329
  display: "inline-flex",
351
- className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Buttons', theme) && ['onesy-Buttons-root', `onesy-Buttons-version-${version}`, `onesy-Buttons-size-${size}`, disabled && `onesy-Buttons-disabled`], className, classes.root, classes[`size_${size}`], chip && classes[`chip_size_${size}`], classes[`orientation_${orientation}`], classes[`orientation_${orientation}_size_${size}`], fullWidth && classes.fullWidth, elevation && !disabled && ['filled', 'tonal'].includes(version) && classes.elevation, disabled && classes.disabled])
330
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('Buttons', theme) && ['onesy-Buttons-root', `onesy-Buttons-version-${version}`, `onesy-Buttons-size-${size}`, disabled && `onesy-Buttons-disabled`], className, classes.root, classes[`orientation_${orientation}`], classes[`orientation_${orientation}_size_${size}`], fullWidth && classes.fullWidth, elevation && !disabled && ['filled', 'tonal'].includes(version) && classes.elevation, disabled && classes.disabled])
352
331
  }, other), children);
353
332
  });
354
333
  Buttons.displayName = 'onesy-Buttons';
@@ -67,7 +67,9 @@ const useStyle = (0, _styleReact.style)(theme => ({
67
67
  },
68
68
  sticky: {
69
69
  position: 'sticky',
70
- zIndex: '14',
70
+ zIndex: '14'
71
+ },
72
+ sticky_left: {
71
73
  '&::after': {
72
74
  content: "''",
73
75
  position: 'absolute',
@@ -79,11 +81,28 @@ const useStyle = (0, _styleReact.style)(theme => ({
79
81
  pointerEvents: 'none'
80
82
  }
81
83
  },
82
- stickyActive: {
84
+ sticky_right: {
85
+ '&::after': {
86
+ content: "''",
87
+ position: 'absolute',
88
+ top: '0',
89
+ left: '-24px',
90
+ bottom: '0',
91
+ width: '24px',
92
+ transition: theme.methods.transitions.make('box-shadow'),
93
+ pointerEvents: 'none'
94
+ }
95
+ },
96
+ stickyActive_left: {
83
97
  '&::after': {
84
98
  boxShadow: `inset 11px 0 7px -7px ${theme.palette.light ? 'rgba(0, 0, 0, 0.04)' : 'rgba(255, 255, 255, 0.14)'}`
85
99
  }
86
100
  },
101
+ stickyActive_right: {
102
+ '&::after': {
103
+ boxShadow: `inset -11px 0 7px -7px ${theme.palette.light ? 'rgba(0, 0, 0, 0.04)' : 'rgba(255, 255, 255, 0.14)'}`
104
+ }
105
+ },
87
106
  sort: {
88
107
  cursor: 'pointer',
89
108
  borderRadius: 2,
@@ -195,15 +214,22 @@ const TableCell = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
195
214
  _react.default.useEffect(() => {
196
215
  if (sticky) {
197
216
  if (root) {
198
- const parentOverflow = (0, _utils2.getOverflowParent)(root);
199
- const offsetPrevious = stickyPosition === 'left' ? root.offsetLeft : window.innerWidth - root.getBoundingClientRect().right;
217
+ const parentOverflow = (0, _utils2.getOverflowParent)(root.parentElement, false);
218
+ root.style.position = 'unset';
219
+ const offsetOriginal = root.offsetLeft;
220
+ root.style.position = 'sticky';
200
221
  const method = () => {
201
- const offsetNew = stickyPosition === 'left' ? root.offsetLeft : window.innerWidth - root.getBoundingClientRect().right;
202
- setStickyActive(offsetPrevious !== offsetNew);
222
+ const offsetNew = root.offsetLeft;
223
+ setStickyActive(offsetOriginal !== offsetNew);
203
224
  };
204
- if (parentOverflow) parentOverflow.addEventListener('scroll', method, {
205
- passive: false
206
- });
225
+ if (parentOverflow) {
226
+ parentOverflow.addEventListener('scroll', method, {
227
+ passive: false
228
+ });
229
+
230
+ // initial
231
+ method();
232
+ }
207
233
  return () => {
208
234
  parentOverflow.removeEventListener('scroll', method);
209
235
  };
@@ -233,7 +259,7 @@ const TableCell = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
233
259
  setRoot(item);
234
260
  },
235
261
  role: "cell",
236
- className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TableCell', theme) && [`onesy-TableCell-root`, `onesy-TableCell-size-${size}`, sticky && `onesy-TableCell-sticky`, stickyPosition && `onesy-TableCell-sticky-position-${stickyPosition}`, stickyActive && `onesy-TableHead-sticky-active`], className, classes.root, position === 'head' ? classes.head : classes.body, noWeight && classes.noWeight, sticky && classes.sticky, stickyActive && classes.stickyActive]),
262
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('TableCell', theme) && [`onesy-TableCell-root`, `onesy-TableCell-size-${size}`, sticky && `onesy-TableCell-sticky`, stickyPosition && `onesy-TableCell-sticky-position-${stickyPosition}`, stickyActive && `onesy-TableHead-sticky-active`], className, classes.root, position === 'head' ? classes.head : classes.body, noWeight && classes.noWeight, sticky && [classes.sticky, classes[`sticky_${stickyPosition}`]], stickyActive && classes[`stickyActive_${stickyPosition}`]]),
237
263
  style: _objectSpread(_objectSpread({}, style), stylesOther)
238
264
  }, other), /*#__PURE__*/_react.default.createElement(Line, {
239
265
  gap: 0,
@@ -32,7 +32,6 @@ export const IconMaterialDone = /*#__PURE__*/React.forwardRef((props, ref) => {
32
32
  const useStyle = styleMethod(theme => ({
33
33
  root: {
34
34
  position: 'relative',
35
- borderRadius: theme.methods.shape.radius.value('xl', 'px'),
36
35
  maxWidth: '100%'
37
36
  },
38
37
  orientation_horizontal_size_small: {
@@ -59,26 +58,6 @@ const useStyle = styleMethod(theme => ({
59
58
  width: '100% !important'
60
59
  }
61
60
  },
62
- // Size
63
- size_small: {
64
- borderRadius: `${theme.shape.radius.unit * 2}px`
65
- },
66
- size_regular: {
67
- borderRadius: `${theme.shape.radius.unit * 2.5}px`
68
- },
69
- size_large: {
70
- borderRadius: `${theme.shape.radius.unit * 3.5}px`
71
- },
72
- // Size
73
- chip_size_small: {
74
- borderRadius: `${theme.shape.radius.unit - theme.shape.radius.unit / 4}px`
75
- },
76
- chip_size_regular: {
77
- borderRadius: `${theme.shape.radius.unit}px`
78
- },
79
- chip_size_large: {
80
- borderRadius: `${theme.shape.radius.unit + theme.shape.radius.unit / 4}px`
81
- },
82
61
  // Shadows
83
62
  elevation: {
84
63
  boxShadow: theme.shadows.values.neutral[1],
@@ -328,7 +307,7 @@ const Buttons = /*#__PURE__*/React.forwardRef((props_, ref) => {
328
307
  gap: 0,
329
308
  direction: "row",
330
309
  display: "inline-flex",
331
- className: classNames([staticClassName('Buttons', theme) && ['onesy-Buttons-root', `onesy-Buttons-version-${version}`, `onesy-Buttons-size-${size}`, disabled && `onesy-Buttons-disabled`], className, classes.root, classes[`size_${size}`], chip && classes[`chip_size_${size}`], classes[`orientation_${orientation}`], classes[`orientation_${orientation}_size_${size}`], fullWidth && classes.fullWidth, elevation && !disabled && ['filled', 'tonal'].includes(version) && classes.elevation, disabled && classes.disabled])
310
+ className: classNames([staticClassName('Buttons', theme) && ['onesy-Buttons-root', `onesy-Buttons-version-${version}`, `onesy-Buttons-size-${size}`, disabled && `onesy-Buttons-disabled`], className, classes.root, classes[`orientation_${orientation}`], classes[`orientation_${orientation}_size_${size}`], fullWidth && classes.fullWidth, elevation && !disabled && ['filled', 'tonal'].includes(version) && classes.elevation, disabled && classes.disabled])
332
311
  }, other), children);
333
312
  });
334
313
  Buttons.displayName = 'onesy-Buttons';
@@ -60,7 +60,9 @@ const useStyle = styleMethod(theme => ({
60
60
  },
61
61
  sticky: {
62
62
  position: 'sticky',
63
- zIndex: '14',
63
+ zIndex: '14'
64
+ },
65
+ sticky_left: {
64
66
  '&::after': {
65
67
  content: "''",
66
68
  position: 'absolute',
@@ -72,11 +74,28 @@ const useStyle = styleMethod(theme => ({
72
74
  pointerEvents: 'none'
73
75
  }
74
76
  },
75
- stickyActive: {
77
+ sticky_right: {
78
+ '&::after': {
79
+ content: "''",
80
+ position: 'absolute',
81
+ top: '0',
82
+ left: '-24px',
83
+ bottom: '0',
84
+ width: '24px',
85
+ transition: theme.methods.transitions.make('box-shadow'),
86
+ pointerEvents: 'none'
87
+ }
88
+ },
89
+ stickyActive_left: {
76
90
  '&::after': {
77
91
  boxShadow: `inset 11px 0 7px -7px ${theme.palette.light ? 'rgba(0, 0, 0, 0.04)' : 'rgba(255, 255, 255, 0.14)'}`
78
92
  }
79
93
  },
94
+ stickyActive_right: {
95
+ '&::after': {
96
+ boxShadow: `inset -11px 0 7px -7px ${theme.palette.light ? 'rgba(0, 0, 0, 0.04)' : 'rgba(255, 255, 255, 0.14)'}`
97
+ }
98
+ },
80
99
  sort: {
81
100
  cursor: 'pointer',
82
101
  borderRadius: 2,
@@ -172,15 +191,22 @@ const TableCell = /*#__PURE__*/React.forwardRef((props_, ref) => {
172
191
  React.useEffect(() => {
173
192
  if (sticky) {
174
193
  if (root) {
175
- const parentOverflow = getOverflowParent(root);
176
- const offsetPrevious = stickyPosition === 'left' ? root.offsetLeft : window.innerWidth - root.getBoundingClientRect().right;
194
+ const parentOverflow = getOverflowParent(root.parentElement, false);
195
+ root.style.position = 'unset';
196
+ const offsetOriginal = root.offsetLeft;
197
+ root.style.position = 'sticky';
177
198
  const method = () => {
178
- const offsetNew = stickyPosition === 'left' ? root.offsetLeft : window.innerWidth - root.getBoundingClientRect().right;
179
- setStickyActive(offsetPrevious !== offsetNew);
199
+ const offsetNew = root.offsetLeft;
200
+ setStickyActive(offsetOriginal !== offsetNew);
180
201
  };
181
- if (parentOverflow) parentOverflow.addEventListener('scroll', method, {
182
- passive: false
183
- });
202
+ if (parentOverflow) {
203
+ parentOverflow.addEventListener('scroll', method, {
204
+ passive: false
205
+ });
206
+
207
+ // initial
208
+ method();
209
+ }
184
210
  return () => {
185
211
  parentOverflow.removeEventListener('scroll', method);
186
212
  };
@@ -210,7 +236,7 @@ const TableCell = /*#__PURE__*/React.forwardRef((props_, ref) => {
210
236
  setRoot(item);
211
237
  },
212
238
  role: "cell",
213
- className: classNames([staticClassName('TableCell', theme) && [`onesy-TableCell-root`, `onesy-TableCell-size-${size}`, sticky && `onesy-TableCell-sticky`, stickyPosition && `onesy-TableCell-sticky-position-${stickyPosition}`, stickyActive && `onesy-TableHead-sticky-active`], className, classes.root, position === 'head' ? classes.head : classes.body, noWeight && classes.noWeight, sticky && classes.sticky, stickyActive && classes.stickyActive]),
239
+ className: classNames([staticClassName('TableCell', theme) && [`onesy-TableCell-root`, `onesy-TableCell-size-${size}`, sticky && `onesy-TableCell-sticky`, stickyPosition && `onesy-TableCell-sticky-position-${stickyPosition}`, stickyActive && `onesy-TableHead-sticky-active`], className, classes.root, position === 'head' ? classes.head : classes.body, noWeight && classes.noWeight, sticky && [classes.sticky, classes[`sticky_${stickyPosition}`]], stickyActive && classes[`stickyActive_${stickyPosition}`]]),
214
240
  style: _objectSpread(_objectSpread({}, style), stylesOther)
215
241
  }, other), /*#__PURE__*/React.createElement(Line, {
216
242
  gap: 0,
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license UiReact v1.0.131
1
+ /** @license UiReact v1.0.133
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/esm/utils.js CHANGED
@@ -208,10 +208,15 @@ export const importIframeStyles = iframeDocument => {
208
208
  iframeDocument.head.append(style);
209
209
  }
210
210
  };
211
- export const getOverflowParent = element => {
211
+ export const getOverflowParent = (element, vertical = true) => {
212
212
  if (!element) return;
213
- if (element.scrollHeight > element.clientHeight) return element;
214
- return getOverflowParent(element.parentElement);
213
+
214
+ // height
215
+ if (vertical && element.scrollHeight > element.clientHeight) return element;
216
+
217
+ // width
218
+ if (!vertical && element.scrollWidth > element.clientWidth) return element;
219
+ return getOverflowParent(element.parentElement, vertical);
215
220
  };
216
221
  export const keyboardStandardCommands = ['a', 'c', 'v', 'y', 'z'];
217
222
  export const keyboardStyleCommands = ['b', 'i', 'u'];
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license UiReact v1.0.131
1
+ /** @license UiReact v1.0.133
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onesy/ui-react",
3
- "version": "1.0.132",
3
+ "version": "1.0.134",
4
4
  "description": "UI for React",
5
5
  "repository": "https://github.com/onesy-me/onesy.git",
6
6
  "author": "Lazar Erić <lazareric1@proton.me>",
package/utils.d.ts CHANGED
@@ -26,7 +26,7 @@ export declare const minMaxBetweenNumbers: (value?: number, min?: number, max?:
26
26
  export declare const sanitize: (value: string) => string;
27
27
  export declare const replace: (value: string, split: string, join: string) => string;
28
28
  export declare const importIframeStyles: (iframeDocument: Document) => void;
29
- export declare const getOverflowParent: (element: HTMLElement) => HTMLElement;
29
+ export declare const getOverflowParent: (element: HTMLElement, vertical?: boolean) => any;
30
30
  export declare const keyboardStandardCommands: string[];
31
31
  export declare const keyboardStyleCommands: string[];
32
32
  export declare const caret: any;
package/utils.js CHANGED
@@ -238,10 +238,15 @@ const importIframeStyles = iframeDocument => {
238
238
  }
239
239
  };
240
240
  exports.importIframeStyles = importIframeStyles;
241
- const getOverflowParent = element => {
241
+ const getOverflowParent = (element, vertical = true) => {
242
242
  if (!element) return;
243
- if (element.scrollHeight > element.clientHeight) return element;
244
- return getOverflowParent(element.parentElement);
243
+
244
+ // height
245
+ if (vertical && element.scrollHeight > element.clientHeight) return element;
246
+
247
+ // width
248
+ if (!vertical && element.scrollWidth > element.clientWidth) return element;
249
+ return getOverflowParent(element.parentElement, vertical);
245
250
  };
246
251
  exports.getOverflowParent = getOverflowParent;
247
252
  const keyboardStandardCommands = exports.keyboardStandardCommands = ['a', 'c', 'v', 'y', 'z'];