@oliasoft-open-source/react-ui-library 10.8.1-beta-1 → 10.9.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/dist/global.css CHANGED
@@ -741,6 +741,59 @@ a {
741
741
  ._chevron_dd6mn_1._expanded_dd6mn_9 {
742
742
  transform: rotate(90deg);
743
743
  }
744
+ ._wrapper_j7tws_1 {
745
+ display: inline-flex;
746
+ position: relative;
747
+ }
748
+ ._badge_j7tws_5 {
749
+ --size-badge: var(--line-height);
750
+ background: var(--color-background-primary);
751
+ display: inline-block;
752
+ position: static;
753
+ }
754
+ ._badge_j7tws_5._label_j7tws_11 {
755
+ line-height: var(--size-badge);
756
+ min-width: var(--size-badge);
757
+ padding: 0 var(--padding-xxs);
758
+ font-size: var(--font-size-sm);
759
+ font-weight: 400;
760
+ text-align: center;
761
+ white-space: nowrap;
762
+ border-radius: calc(var(--size-badge) / 2);
763
+ font-weight: bold;
764
+ letter-spacing: normal;
765
+ }
766
+ ._badge_j7tws_5._small_j7tws_23 {
767
+ --size-badge: var(--font-size-sm);
768
+ font-size: calc(var(--size-badge) * 0.8);
769
+ }
770
+ ._badge_j7tws_5._bordered_j7tws_27 {
771
+ border-width: 1px;
772
+ border-style: solid;
773
+ }
774
+ ._badge_j7tws_5._dot_j7tws_31 {
775
+ width: 6px;
776
+ height: 6px;
777
+ border-radius: 100%;
778
+ min-width: 0;
779
+ }
780
+ ._badge_j7tws_5._hasChildren_j7tws_37 {
781
+ position: absolute;
782
+ z-index: 3;
783
+ }
784
+ ._badge_j7tws_5._hasChildren_j7tws_37[data-placement='top-right'] {
785
+ right: 0;
786
+ top: 0;
787
+ transform: translate(50%, -50%);
788
+ transform-origin: 100% 0%;
789
+ }
790
+ ._badge_j7tws_5._hasChildren_j7tws_37[data-placement='bottom-right'] {
791
+ top: auto;
792
+ right: 0;
793
+ bottom: 0;
794
+ transform: translate(50%, 50%);
795
+ transform-origin: 100% 100%;
796
+ }
744
797
  ._wrapper_18w09_1 {
745
798
  color: inherit;
746
799
  fill: inherit;
@@ -1805,50 +1858,6 @@ html[data-theme='dark'] {
1805
1858
  ._menuItem_1f0i9_210[data-selected][data-hovered] {
1806
1859
  background-color: var(--color-background-listitem-active-hover);
1807
1860
  }
1808
- ._wrapper_1ivg9_1 {
1809
- display: inline-flex;
1810
- position: relative;
1811
- }
1812
- ._badge_1ivg9_5 {
1813
- --size-badge: var(--line-height);
1814
- background: var(--color-background-primary);
1815
- display: inline-block;
1816
- position: static;
1817
- }
1818
- ._badge_1ivg9_5._label_1ivg9_11 {
1819
- line-height: var(--size-badge);
1820
- min-width: var(--size-badge);
1821
- padding: 0 var(--padding-xxs);
1822
- font-size: var(--font-size-sm);
1823
- font-weight: 400;
1824
- text-align: center;
1825
- white-space: nowrap;
1826
- border-radius: calc(var(--size-badge) / 2);
1827
- font-weight: bold;
1828
- letter-spacing: normal;
1829
- }
1830
- ._badge_1ivg9_5._small_1ivg9_23 {
1831
- --size-badge: var(--font-size-sm);
1832
- font-size: calc(var(--size-badge) * 0.8);
1833
- }
1834
- ._badge_1ivg9_5._bordered_1ivg9_27 {
1835
- border-width: 1px;
1836
- border-style: solid;
1837
- }
1838
- ._badge_1ivg9_5._dot_1ivg9_31 {
1839
- width: 6px;
1840
- height: 6px;
1841
- border-radius: 100%;
1842
- min-width: 0;
1843
- }
1844
- ._badge_1ivg9_5._hasChildren_1ivg9_37 {
1845
- position: absolute;
1846
- right: 0;
1847
- top: 0;
1848
- transform: translate(50%, -50%);
1849
- transform-origin: 100% 0%;
1850
- z-index: 3;
1851
- }
1852
1861
  ._breadcrumb_7x1qb_1 {
1853
1862
  display: flex;
1854
1863
  flex-wrap: wrap;
package/dist/index.d.ts CHANGED
@@ -56,7 +56,7 @@ export declare interface AuditLogItem {
56
56
 
57
57
  export declare type AuditLogOperation = 'Created' | 'Cloned' | 'Reverted' | 'Restored' | 'Imported' | 'Updated';
58
58
 
59
- export declare const Badge: ({ children, color, textColor: textColorProp, title, dot, margin, small, borderColor, borderRadius, minWidth, }: IBadgeProps) => JSX.Element;
59
+ export declare const Badge: ({ children, color, textColor: textColorProp, title, dot, margin, small, borderColor, borderRadius, minWidth, placement, }: IBadgeProps) => JSX.Element;
60
60
 
61
61
  export declare const Breadcrumb: ({ links, small }: IBreadcrumbProps) => JSX.Element;
62
62
 
@@ -268,6 +268,7 @@ export declare interface IBadgeProps {
268
268
  borderColor?: string;
269
269
  borderRadius?: TStringOrNumber;
270
270
  minWidth?: TStringOrNumber;
271
+ placement?: TBadgePlacement;
271
272
  }
272
273
 
273
274
  export declare interface IBreadcrumbProps {
@@ -423,7 +424,7 @@ export declare interface IColorInputProps extends Omit<IColorInputPopoverProps,
423
424
  * - react-icons
424
425
  * - SVG (for special cases)
425
426
  */
426
- export declare const Icon: ({ icon, onClick, clickable, color, size, testId }: IconProps) => JSX.Element;
427
+ export declare const Icon: ({ icon, onClick, clickable, color, size, testId, status }: IconProps) => JSX.Element;
427
428
 
428
429
  /**
429
430
  * Configuration object for initializing the React GUI library.
@@ -444,6 +445,7 @@ export declare interface IconProps {
444
445
  color?: string;
445
446
  size?: TStringOrNumber;
446
447
  testId?: string;
448
+ status?: 'success' | 'warning' | 'error';
447
449
  }
448
450
 
449
451
  export declare enum IconType {
@@ -2233,6 +2235,8 @@ export declare type TAlign = 'left' | 'right' | 'center';
2233
2235
 
2234
2236
  declare type TAxis = 'x' | 'y';
2235
2237
 
2238
+ export declare type TBadgePlacement = 'top-right' | 'bottom-right';
2239
+
2236
2240
  declare type TBaseElementProps = {
2237
2241
  label?: string | null;
2238
2242
  icon?: ReactNode;
package/dist/index.js CHANGED
@@ -138,6 +138,47 @@ var chevron_module_default = {
138
138
  //#endregion
139
139
  //#region src/helpers/disabled-context.ts
140
140
  var DisabledContext = React.createContext(false);
141
+ var badge_module_default = {
142
+ wrapper: "_wrapper_j7tws_1",
143
+ badge: "_badge_j7tws_5",
144
+ label: "_label_j7tws_11",
145
+ small: "_small_j7tws_23",
146
+ bordered: "_bordered_j7tws_27",
147
+ dot: "_dot_j7tws_31",
148
+ hasChildren: "_hasChildren_j7tws_37"
149
+ };
150
+ //#endregion
151
+ //#region src/components/badge/badge.tsx
152
+ var isDark = (hexColor) => {
153
+ const c = hexColor.substring(1);
154
+ const rgb = parseInt(c, 16);
155
+ const r = rgb >> 16 & 255;
156
+ const g = rgb >> 8 & 255;
157
+ const b = rgb >> 0 & 255;
158
+ return .2126 * r + .7152 * g + .0722 * b < 128;
159
+ };
160
+ var Badge = ({ children, color = "", textColor: textColorProp = "", title = null, dot = false, margin = null, small = false, borderColor = "", borderRadius = void 0, minWidth = void 0, placement = "top-right" }) => {
161
+ const visible = !(title === null && dot === false);
162
+ const textColor = textColorProp || (isDark(color) ? "#fff" : "rgba(0, 0, 0, 0.6)");
163
+ const useRing = Boolean(dot && borderColor);
164
+ return /* @__PURE__ */ jsxs("div", {
165
+ className: badge_module_default.wrapper,
166
+ children: [visible && /* @__PURE__ */ jsx("sup", {
167
+ className: cx(badge_module_default.badge, title !== null ? badge_module_default.label : badge_module_default.dot, small ? badge_module_default.small : "", borderColor && !useRing ? badge_module_default.bordered : "", children ? badge_module_default.hasChildren : ""),
168
+ "data-placement": children ? placement : void 0,
169
+ style: {
170
+ background: color || void 0,
171
+ margin: margin || void 0,
172
+ color: textColor,
173
+ borderColor: borderColor && !useRing ? borderColor : void 0,
174
+ boxShadow: useRing ? `0 0 0 1px ${borderColor}` : void 0,
175
+ borderRadius,
176
+ minWidth
177
+ },
178
+ children: title
179
+ }), children]
180
+ });
181
+ };
141
182
  var icon_module_default = {
142
183
  wrapper: "_wrapper_18w09_1",
143
184
  customSvg: "_customSvg_18w09_8",
@@ -339,13 +380,18 @@ var NamedIcon = ({ icon }) => {
339
380
  };
340
381
  //#endregion
341
382
  //#region src/components/icon/icon.tsx
383
+ var STATUS_COLOR = {
384
+ success: "var(--color-background-success)",
385
+ warning: "var(--color-background-warning)",
386
+ error: "var(--color-background-error)"
387
+ };
342
388
  /**
343
389
  * Icon wrapper component to support different icon formats:
344
390
  * - string names (default recommendation)
345
391
  * - react-icons
346
392
  * - SVG (for special cases)
347
393
  */
348
- var Icon = ({ icon, onClick, clickable = false, color, size, testId }) => {
394
+ var Icon = ({ icon, onClick, clickable = false, color, size, testId, status }) => {
349
395
  const disabledContext = useContext(DisabledContext);
350
396
  const style = {
351
397
  color,
@@ -354,7 +400,7 @@ var Icon = ({ icon, onClick, clickable = false, color, size, testId }) => {
354
400
  width: size || "auto",
355
401
  height: size || "auto"
356
402
  };
357
- return /* @__PURE__ */ jsx("div", {
403
+ const content = /* @__PURE__ */ jsx("div", {
358
404
  className: cx(icon_module_default.wrapper, (clickable || onClick) && !disabledContext ? icon_module_default.clickable : ""),
359
405
  style,
360
406
  onClick: (evt) => onClick && !disabledContext ? onClick(evt) : void 0,
@@ -368,6 +414,15 @@ var Icon = ({ icon, onClick, clickable = false, color, size, testId }) => {
368
414
  src: icon
369
415
  }) : typeof icon === "string" ? /* @__PURE__ */ jsx(NamedIcon, { icon }) : null
370
416
  });
417
+ if (!status) return content;
418
+ return /* @__PURE__ */ jsx(Badge, {
419
+ dot: true,
420
+ color: STATUS_COLOR[status],
421
+ borderColor: "var(--color-background-layer)",
422
+ placement: "bottom-right",
423
+ margin: "3px",
424
+ children: content
425
+ });
371
426
  };
372
427
  //#endregion
373
428
  //#region src/components/accordion/chevron/chevron.tsx
@@ -1371,44 +1426,6 @@ var isStringNumberOrNode = (value) => {
1371
1426
  var getType = (item) => {
1372
1427
  return Array.isArray(item) ? "array" : typeof item;
1373
1428
  };
1374
- var badge_module_default = {
1375
- wrapper: "_wrapper_1ivg9_1",
1376
- badge: "_badge_1ivg9_5",
1377
- label: "_label_1ivg9_11",
1378
- small: "_small_1ivg9_23",
1379
- bordered: "_bordered_1ivg9_27",
1380
- dot: "_dot_1ivg9_31",
1381
- hasChildren: "_hasChildren_1ivg9_37"
1382
- };
1383
- //#endregion
1384
- //#region src/components/badge/badge.tsx
1385
- var isDark = (hexColor) => {
1386
- const c = hexColor.substring(1);
1387
- const rgb = parseInt(c, 16);
1388
- const r = rgb >> 16 & 255;
1389
- const g = rgb >> 8 & 255;
1390
- const b = rgb >> 0 & 255;
1391
- return .2126 * r + .7152 * g + .0722 * b < 128;
1392
- };
1393
- var Badge = ({ children, color = "", textColor: textColorProp = "", title = null, dot = false, margin = null, small = false, borderColor = "", borderRadius = void 0, minWidth = void 0 }) => {
1394
- const visible = !(title === null && dot === false);
1395
- const textColor = textColorProp || (isDark(color) ? "#fff" : "rgba(0, 0, 0, 0.6)");
1396
- return /* @__PURE__ */ jsxs("div", {
1397
- className: badge_module_default.wrapper,
1398
- children: [visible && /* @__PURE__ */ jsx("sup", {
1399
- className: cx(badge_module_default.badge, title !== null ? badge_module_default.label : badge_module_default.dot, small ? badge_module_default.small : "", borderColor ? badge_module_default.bordered : "", children ? badge_module_default.hasChildren : ""),
1400
- style: {
1401
- background: color || void 0,
1402
- margin: margin || void 0,
1403
- color: textColor,
1404
- borderColor: borderColor || void 0,
1405
- borderRadius,
1406
- minWidth
1407
- },
1408
- children: title
1409
- }), children]
1410
- });
1411
- };
1412
1429
  //#endregion
1413
1430
  //#region src/components/menu/trigger/button.tsx
1414
1431
  var Button$1 = React.forwardRef(({ trigger, label, colored, basic, small, width, disabled, groupOrder, loading, error, warning, active, tabIndex, testId, ...domProps }, ref) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "10.8.1-beta-1",
3
+ "version": "10.9.0",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {