@rango-dev/ui 0.39.1-next.7 → 0.39.1-next.9

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.
Files changed (31) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/index.js.map +3 -3
  3. package/dist/translations/de.d.ts.map +1 -1
  4. package/dist/translations/el.d.ts.map +1 -1
  5. package/dist/translations/en.d.ts.map +1 -1
  6. package/dist/translations/es.d.ts.map +1 -1
  7. package/dist/translations/fi.d.ts.map +1 -1
  8. package/dist/translations/fr.d.ts.map +1 -1
  9. package/dist/translations/it.d.ts.map +1 -1
  10. package/dist/translations/ja.d.ts.map +1 -1
  11. package/dist/translations/nl.d.ts.map +1 -1
  12. package/dist/translations/pl.d.ts.map +1 -1
  13. package/dist/translations/pt.d.ts.map +1 -1
  14. package/dist/translations/ru.d.ts.map +1 -1
  15. package/dist/translations/sv.d.ts.map +1 -1
  16. package/dist/translations/uk.d.ts.map +1 -1
  17. package/dist/translations/zh.d.ts.map +1 -1
  18. package/dist/ui.build.json +1 -1
  19. package/dist/widget/ui/src/components/IconButton/IconButton.types.d.ts +1 -0
  20. package/dist/widget/ui/src/components/IconButton/IconButton.types.d.ts.map +1 -1
  21. package/dist/widget/ui/src/components/ListItem/ListItem.types.d.ts +2 -0
  22. package/dist/widget/ui/src/components/ListItem/ListItem.types.d.ts.map +1 -1
  23. package/dist/widget/ui/src/components/ListItemButton/ListItemButton.d.ts.map +1 -1
  24. package/dist/widget/ui/src/components/Tabs/Tabs.d.ts.map +1 -1
  25. package/package.json +2 -2
  26. package/readme.md +1 -1
  27. package/src/components/IconButton/IconButton.types.ts +1 -0
  28. package/src/components/List/List.tsx +1 -1
  29. package/src/components/ListItem/ListItem.types.ts +2 -0
  30. package/src/components/ListItemButton/ListItemButton.tsx +1 -0
  31. package/src/components/Tabs/Tabs.tsx +52 -47
@@ -1,6 +1,7 @@
1
1
  import type { ButtonPropTypes } from '../Button/Button.types.js';
2
2
  import type { CSSProperties } from 'react';
3
3
  export type IconButtonPropTypes = {
4
+ id?: ButtonPropTypes['id'];
4
5
  size?: ButtonPropTypes['size'];
5
6
  type?: ButtonPropTypes['type'];
6
7
  variant?: ButtonPropTypes['variant'];
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton.types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/IconButton/IconButton.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACrC,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACrC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC"}
1
+ {"version":3,"file":"IconButton.types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/IconButton/IconButton.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACrC,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACrC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  export type ListItemPropTypes = {
3
+ id?: string;
3
4
  title?: string | React.ReactElement;
4
5
  description?: string | React.ReactElement;
5
6
  start?: React.ReactNode;
@@ -9,5 +10,6 @@ export type ListItemPropTypes = {
9
10
  onKeyUp?: React.KeyboardEventHandler<HTMLLIElement>;
10
11
  hasDivider?: boolean;
11
12
  tabIndex?: number;
13
+ className?: string;
12
14
  };
13
15
  //# sourceMappingURL=ListItem.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ListItem.types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ListItem/ListItem.types.ts"],"names":[],"mappings":";AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC;IAC1C,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,EAAE,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
1
+ {"version":3,"file":"ListItem.types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ListItem/ListItem.types.ts"],"names":[],"mappings":";AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC;IAC1C,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,EAAE,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ListItemButton.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ListItemButton/ListItemButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,iBAAS,cAAc,CAAC,KAAK,EAAE,mBAAmB,qBAoBjD;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"ListItemButton.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ListItemButton/ListItemButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,iBAAS,cAAc,CAAC,KAAK,EAAE,mBAAmB,qBAqBjD;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAsC,MAAM,OAAO,CAAC;AAgB3D,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,qBAyMjD"}
1
+ {"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAsC,MAAM,OAAO,CAAC;AAgB3D,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,qBA8MjD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/ui",
3
- "version": "0.39.1-next.7",
3
+ "version": "0.39.1-next.9",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -62,4 +62,4 @@
62
62
  "publishConfig": {
63
63
  "access": "public"
64
64
  }
65
- }
65
+ }
package/readme.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @rango-dev/ui
2
2
 
3
- Rango UI design system components
3
+ Rango UI design system components.
4
4
 
5
5
  ### Icons
6
6
 
@@ -2,6 +2,7 @@ import type { ButtonPropTypes } from '../Button/Button.types.js';
2
2
  import type { CSSProperties } from 'react';
3
3
 
4
4
  export type IconButtonPropTypes = {
5
+ id?: ButtonPropTypes['id'];
5
6
  size?: ButtonPropTypes['size'];
6
7
  type?: ButtonPropTypes['type'];
7
8
  variant?: ButtonPropTypes['variant'];
@@ -20,7 +20,7 @@ function List(props: ListPropTypes) {
20
20
  id,
21
21
  });
22
22
  }
23
- return <ListItem key={id} {...itemProps} />;
23
+ return <ListItem key={id} id={id} {...itemProps} />;
24
24
  })}
25
25
  </BaseList>
26
26
  );
@@ -1,4 +1,5 @@
1
1
  export type ListItemPropTypes = {
2
+ id?: string;
2
3
  title?: string | React.ReactElement;
3
4
  description?: string | React.ReactElement;
4
5
  start?: React.ReactNode;
@@ -8,4 +9,5 @@ export type ListItemPropTypes = {
8
9
  onKeyUp?: React.KeyboardEventHandler<HTMLLIElement>;
9
10
  hasDivider?: boolean;
10
11
  tabIndex?: number;
12
+ className?: string;
11
13
  };
@@ -15,6 +15,7 @@ function ListItemButton(props: ListItemButtonProps) {
15
15
  return (
16
16
  <BaseListItemButton
17
17
  onClick={onClickWithKey}
18
+ id={id}
18
19
  aria-label="button"
19
20
  selected={selected}
20
21
  onKeyUp={(e: { key: string }) => {
@@ -61,14 +61,12 @@ export function TabsComponent(props: TabsPropTypes) {
61
61
  }
62
62
  };
63
63
 
64
- const updateIndicator = (currentIndex: number) => {
64
+ const updateIndicator = () => {
65
65
  if (tabRef.current && containerRef.current) {
66
66
  const tabRect = tabRef.current.getBoundingClientRect();
67
67
  const containerRect = containerRef.current.getBoundingClientRect();
68
68
  setTabWidth(tabRect.width);
69
- setTransformPosition(
70
- scrollable ? tabRef.current.offsetLeft : currentIndex * tabWidth
71
- );
69
+ setTransformPosition(tabRef.current.offsetLeft);
72
70
  const itemPartiallyVisibleOnLeft = tabRect.left < containerRect.left;
73
71
  const itemPartiallyVisibleOnRight = tabRect.right > containerRect.right;
74
72
 
@@ -96,7 +94,7 @@ export function TabsComponent(props: TabsPropTypes) {
96
94
  }, []);
97
95
 
98
96
  useEffect(() => {
99
- updateIndicator(currentIndex);
97
+ updateIndicator();
100
98
 
101
99
  const updateArrowsVisibility = () => {
102
100
  if (scrollable && containerRef.current) {
@@ -119,20 +117,23 @@ export function TabsComponent(props: TabsPropTypes) {
119
117
  };
120
118
 
121
119
  const resizeHandler: ResizeObserverCallback = (event) => {
122
- if (scrollable && containerRef.current) {
123
- const TOTAL_WIDTH_OF_ARROWS = 64;
124
- updateIndicator(currentIndex);
125
- updateArrowsVisibility();
126
- const element = event[0].target;
127
- if (showArrows) {
128
- const tabsContainerOverflown =
129
- element.scrollWidth - TOTAL_WIDTH_OF_ARROWS > element.clientWidth;
130
- if (!tabsContainerOverflown) {
131
- setShowArrows(false);
132
- }
133
- } else if (element.scrollWidth > element.clientWidth) {
134
- setShowArrows(true);
135
- }
120
+ updateIndicator();
121
+
122
+ if (!containerRef.current || !scrollable || !scrollButtons) {
123
+ return;
124
+ }
125
+
126
+ updateArrowsVisibility();
127
+
128
+ const TOTAL_WIDTH_OF_ARROWS = 64;
129
+ const element = event[0].target;
130
+ const tabsContainerOverflown =
131
+ element.scrollWidth - TOTAL_WIDTH_OF_ARROWS > element.clientWidth;
132
+
133
+ if (showArrows && !tabsContainerOverflown) {
134
+ setShowArrows(false);
135
+ } else if (element.scrollWidth > element.clientWidth) {
136
+ setShowArrows(true);
136
137
  }
137
138
  };
138
139
 
@@ -177,34 +178,38 @@ export function TabsComponent(props: TabsPropTypes) {
177
178
  type={type}
178
179
  borderRadius={borderRadius}
179
180
  scrollable={scrollable}>
180
- {tabItems.map((item, index) => (
181
- <Tooltip
182
- key={item.id}
183
- styles={{ root: { width: '100%' } }}
184
- container={container}
185
- side="bottom"
186
- sideOffset={2}
187
- content={item.tooltip}
188
- open={!item.tooltip ? false : undefined}>
189
- <Tab
190
- className="_tab"
191
- ref={index === currentIndex ? tabRef : null}
192
- type={type}
193
- fullWidth={scrollable ? false : true}
194
- disableRipple={true}
195
- borderRadius={borderRadius}
196
- onClick={() => onChange(item)}
197
- size="small"
198
- isActive={item.id === value}
199
- variant="default">
200
- {item.icon}
201
- {!!item.icon && !!item.title && (
202
- <Divider direction="horizontal" size="2" />
203
- )}
204
- {item.title}
205
- </Tab>
206
- </Tooltip>
207
- ))}
181
+ {tabItems.map((item, index) => {
182
+ const isActive = item.id === value;
183
+ return (
184
+ <Tooltip
185
+ key={item.id}
186
+ styles={{ root: { width: '100%' } }}
187
+ container={container}
188
+ side="bottom"
189
+ sideOffset={2}
190
+ content={item.tooltip}
191
+ open={!item.tooltip ? false : undefined}>
192
+ <Tab
193
+ className="_tab"
194
+ ref={index === currentIndex ? tabRef : null}
195
+ type={type}
196
+ fullWidth={scrollable ? false : true}
197
+ disableRipple={true}
198
+ borderRadius={borderRadius}
199
+ onClick={() => onChange(item)}
200
+ size="small"
201
+ isActive={isActive}
202
+ data-active={isActive}
203
+ variant="default">
204
+ {item.icon}
205
+ {!!item.icon && !!item.title && (
206
+ <Divider direction="horizontal" size="2" />
207
+ )}
208
+ {item.title}
209
+ </Tab>
210
+ </Tooltip>
211
+ );
212
+ })}
208
213
  <BackdropTab
209
214
  type={type}
210
215
  borderRadius={borderRadius}