@ssa-ui-kit/core 3.5.0 → 3.7.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.
@@ -0,0 +1,60 @@
1
+ import { CounterProps } from './types';
2
+ /**
3
+ * Counter - Compact numeric indicator for displaying counts or notification badges.
4
+ *
5
+ * ### Sizing
6
+ * Accepts `'small' | 'medium' | 'large'` via the `size` prop (default `'medium'`).
7
+ * When `count` is omitted the counter shrinks to a small dot (`dot` size) — useful
8
+ * as a presence indicator with no number shown.
9
+ *
10
+ * ### Color
11
+ * Background is driven by `theme.palette[variant].main` for the five semantic variants.
12
+ * Pass `color` to override: a `theme.colors` key resolves to the design token value,
13
+ * any other string is used as a raw CSS color.
14
+ *
15
+ * ### CSS override
16
+ * Pass `css` to apply one-off Emotion styles on top of all internal styles
17
+ * (size → variant → color → css). Useful for margins, positioning, or shape tweaks.
18
+ *
19
+ * ### Overflow
20
+ * Values above 99 are automatically clamped to `"99+"`.
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * // Basic usage — primary variant, medium size
25
+ * <Counter count={5} />
26
+ * ```
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * // Overflow label
31
+ * <Counter count={120} variant={CounterVariants.error} size="large" />
32
+ * // renders "99+"
33
+ * ```
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * // Raw hex color override
38
+ * <Counter count={3} color="#F7931A" />
39
+ * ```
40
+ *
41
+ * @example
42
+ * ```tsx
43
+ * // theme.colors key as color
44
+ * <Counter count={7} color="purple" />
45
+ * ```
46
+ *
47
+ * @example
48
+ * ```tsx
49
+ * // Empty dot indicator (no count)
50
+ * <Counter variant={CounterVariants.error} />
51
+ * ```
52
+ *
53
+ * @example
54
+ * ```tsx
55
+ * // CSS override for layout / shape
56
+ * <Counter count={3} css={{ marginLeft: 8, borderRadius: 4 }} />
57
+ * ```
58
+ */
59
+ export declare const Counter: ({ count, variant, size, color, className, css, ref, }: CounterProps) => import("@emotion/react/jsx-runtime").JSX.Element;
60
+ export default Counter;
@@ -0,0 +1 @@
1
+ export * from './Counter';
@@ -0,0 +1,15 @@
1
+ import { VariantStyle, CounterSizes } from './types';
2
+ import { Theme, SerializedStyles } from '@emotion/react';
3
+ import { ColorsKeys } from '../../types/emotion';
4
+ export declare const variantStyles: VariantStyle;
5
+ export declare const sizeStyles: CounterSizes;
6
+ /**
7
+ * Builds a background override from a `color` string.
8
+ * If `color` matches a key in `theme.colors` the design token is used;
9
+ * otherwise the value is passed through as a raw CSS color string.
10
+ */
11
+ export declare const makeColorOverride: (theme: Theme, color: ColorsKeys | string) => SerializedStyles;
12
+ export declare const CounterBase: import("@emotion/styled").StyledComponent<{
13
+ theme?: Theme;
14
+ as?: React.ElementType;
15
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import { MainSizes } from '../../types/global';
3
+ import { ColorsKeys } from '../../types/emotion';
4
+ import { Interpolation, SerializedStyles, Theme } from '@emotion/react';
5
+ export declare enum CounterVariants {
6
+ primary = "primary",
7
+ secondary = "secondary",
8
+ error = "error",
9
+ warning = "warning",
10
+ success = "success"
11
+ }
12
+ export type VariantStyle = {
13
+ [k in CounterVariants]: (theme: Theme) => SerializedStyles;
14
+ };
15
+ /**
16
+ * Extends `MainSizes` with a `dot` slot used internally when `count` is
17
+ * undefined — renders a small dot with no label as a presence indicator.
18
+ */
19
+ export type CounterSizes = MainSizes & {
20
+ dot: SerializedStyles;
21
+ };
22
+ export type CounterProps = {
23
+ /**
24
+ * The numeric value to display. Values above 99 are clamped to `"99+"`.
25
+ * When omitted, the counter renders as a dot with no label.
26
+ */
27
+ count?: number;
28
+ /**
29
+ * Visual style variant. Drives the background color from `theme.palette`.
30
+ * @default CounterVariants.primary
31
+ */
32
+ variant?: CounterVariants;
33
+ /**
34
+ * Size of the counter.
35
+ * Ignored when `count` is undefined — the component uses `dot` automatically.
36
+ * @default 'medium'
37
+ */
38
+ size?: keyof MainSizes;
39
+ /**
40
+ * Optional color override. Accepts a `theme.colors` key or any valid CSS color string.
41
+ * When provided, overrides the variant background.
42
+ */
43
+ color?: ColorsKeys | string;
44
+ /**
45
+ * Custom CSS class name.
46
+ */
47
+ className?: string;
48
+ /**
49
+ * Emotion CSS override applied after all internal styles.
50
+ * Use for one-off layout adjustments (e.g. margins, positioning).
51
+ */
52
+ css?: Interpolation<Theme>;
53
+ /**
54
+ * Ref forwarded to the root `<div>` element.
55
+ */
56
+ ref?: React.Ref<HTMLDivElement>;
57
+ };
@@ -9,7 +9,8 @@ import { HistoryProps } from './types';
9
9
  * - `item.color` overrides the marker color for a specific row
10
10
  * - `defaultColor` is used when `item.color` is not provided
11
11
  * - fallback default marker color: `theme.palette.primary.main`
12
- * - fallback connector color: `theme.colors.greyLighter`
12
+ * - fallback connector color: `theme.colors.greyFocused`
13
+ * - `lineWidth` controls the connector line thickness in pixels (default `2`)
13
14
  *
14
15
  * ### Alignment behavior
15
16
  * The marker is vertically aligned to the first text line and adapts when
@@ -28,4 +29,4 @@ import { HistoryProps } from './types';
28
29
  * />
29
30
  * ```
30
31
  */
31
- export declare const History: ({ items, defaultColor, lineColor, dateWidth, circleSize, sx, }: HistoryProps) => import("@emotion/react/jsx-runtime").JSX.Element;
32
+ export declare const History: ({ items, defaultColor, lineColor, lineWidth, dateWidth, circleSize, sx, }: HistoryProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -4,6 +4,6 @@ export declare const container: import("@emotion/react").SerializedStyles;
4
4
  export declare const row: import("@emotion/react").SerializedStyles;
5
5
  export declare const leftColumn: (width: number) => import("@emotion/react").SerializedStyles;
6
6
  export declare const circle: (color: string, size: number, topOffset: number) => import("@emotion/react").SerializedStyles;
7
- export declare const connector: (color: string, circleTopOffset: number, circleSize: number) => import("@emotion/react").SerializedStyles;
7
+ export declare const connector: (color: string, circleTopOffset: number, circleSize: number, lineWidth: number) => import("@emotion/react").SerializedStyles;
8
8
  export declare const dateColumn: (width: number) => import("@emotion/react").SerializedStyles;
9
9
  export declare const contentColumn: import("@emotion/react").SerializedStyles;
@@ -36,9 +36,14 @@ export interface HistoryProps {
36
36
  defaultColor?: string;
37
37
  /**
38
38
  * Connector line color between markers.
39
- * Falls back to `theme.colors.greyLighter`.
39
+ * Falls back to `theme.colors.greyFocused`.
40
40
  */
41
41
  lineColor?: string;
42
+ /**
43
+ * Connector line width in pixels.
44
+ * @default 2
45
+ */
46
+ lineWidth?: number;
42
47
  /**
43
48
  * Width of the date column in pixels.
44
49
  * @default 120
@@ -70,6 +70,8 @@ export * from './Typography';
70
70
  export type * from './Typography/types';
71
71
  export { default as Badge } from './Badge';
72
72
  export type * from './Badge/types';
73
+ export * from './Counter';
74
+ export type * from './Counter/types';
73
75
  export { default as Tag } from './Tag';
74
76
  export * from './Tag';
75
77
  export type * from './Tag/types';
package/dist/index.js CHANGED
@@ -7980,6 +7980,7 @@ __webpack_require__.d(__webpack_exports__, {
7980
7980
  CollapsibleNavBarItemProvider: () => (/* reexport */ CollapsibleNavBarItemProvider),
7981
7981
  CollapsibleNavBarProvider: () => (/* reexport */ CollapsibleNavBarProvider),
7982
7982
  ColorPicker: () => (/* reexport */ ColorPicker),
7983
+ Counter: () => (/* reexport */ Counter),
7983
7984
  DEFAULT_EUROPEAN_MASK_FORMAT: () => (/* reexport */ DEFAULT_EUROPEAN_MASK_FORMAT),
7984
7985
  DEFAULT_MASK_FORMAT: () => (/* reexport */ constants_DEFAULT_MASK_FORMAT),
7985
7986
  DEFAULT_MONTH_MASK_FORMAT: () => (/* reexport */ constants_DEFAULT_MONTH_MASK_FORMAT),
@@ -15239,7 +15240,7 @@ const TextareaBase = /*#__PURE__*/base_default()('textarea', true ? {
15239
15240
  status = 'basic'
15240
15241
  }) => getStatusBoxShadow(theme, status, 'rest'), ";color:", ({
15241
15242
  theme
15242
- }) => theme.colors.greyDarker, ";width:100%;max-width:100%;box-sizing:border-box;min-height:114px;padding:14px;font-weight:400;font-size:0.875rem;line-height:1rem;&::placeholder{color:", ({
15243
+ }) => theme.colors.greyDarker, ";width:100%;max-width:100%;max-height:100%;box-sizing:border-box;min-height:114px;padding:14px;font-weight:400;font-size:0.875rem;line-height:1rem;&::placeholder{color:", ({
15243
15244
  theme
15244
15245
  }) => theme.colors.greyDarker60, ";}&[readonly]{cursor:default;}&:disabled{color:", ({
15245
15246
  theme
@@ -28540,6 +28541,154 @@ const CardList = ({
28540
28541
  ;// ./src/components/CardList/index.ts
28541
28542
 
28542
28543
 
28544
+ ;// ./src/components/Counter/types.ts
28545
+ let CounterVariants = /*#__PURE__*/function (CounterVariants) {
28546
+ CounterVariants["primary"] = "primary";
28547
+ CounterVariants["secondary"] = "secondary";
28548
+ CounterVariants["error"] = "error";
28549
+ CounterVariants["warning"] = "warning";
28550
+ CounterVariants["success"] = "success";
28551
+ return CounterVariants;
28552
+ }({});
28553
+
28554
+ /**
28555
+ * Extends `MainSizes` with a `dot` slot used internally when `count` is
28556
+ * undefined — renders a small dot with no label as a presence indicator.
28557
+ */
28558
+ ;// ./src/components/Counter/styles.tsx
28559
+
28560
+ function Counter_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
28561
+
28562
+
28563
+ /** Resolves a variant key to its `theme.palette` background + white text. */
28564
+ const makeVariantStyle = (theme, key) => /*#__PURE__*/(0,react_namespaceObject.css)("color:", theme.colors.white, ";background:", theme.palette[key].main, ";" + ( true ? "" : 0), true ? "" : 0);
28565
+ const styles_variantStyles = {
28566
+ primary: theme => makeVariantStyle(theme, CounterVariants.primary),
28567
+ secondary: theme => makeVariantStyle(theme, CounterVariants.secondary),
28568
+ error: theme => makeVariantStyle(theme, CounterVariants.error),
28569
+ warning: theme => makeVariantStyle(theme, CounterVariants.warning),
28570
+ success: theme => makeVariantStyle(theme, CounterVariants.success)
28571
+ };
28572
+ const styles_sizeStyles = {
28573
+ dot: true ? {
28574
+ name: "9e7m57",
28575
+ styles: "width:8px;height:8px"
28576
+ } : 0,
28577
+ small: true ? {
28578
+ name: "14h28tx",
28579
+ styles: "height:24px;font-size:12px;padding:4px 9px"
28580
+ } : 0,
28581
+ medium: true ? {
28582
+ name: "fy8gxb",
28583
+ styles: "padding:4px 13px;height:32px;font-size:14px"
28584
+ } : 0,
28585
+ large: true ? {
28586
+ name: "irp62o",
28587
+ styles: "font-size:16px;height:44px;padding:4px 19px"
28588
+ } : 0
28589
+ };
28590
+
28591
+ /**
28592
+ * Builds a background override from a `color` string.
28593
+ * If `color` matches a key in `theme.colors` the design token is used;
28594
+ * otherwise the value is passed through as a raw CSS color string.
28595
+ */
28596
+ const makeColorOverride = (theme, color) => /*#__PURE__*/(0,react_namespaceObject.css)("background:", color in theme.colors ? theme.colors[color] : color, ";" + ( true ? "" : 0), true ? "" : 0);
28597
+ const CounterBase = /*#__PURE__*/base_default()("div", true ? {
28598
+ target: "eg7ht9z0"
28599
+ } : 0)( true ? {
28600
+ name: "1tmyl78",
28601
+ styles: "display:flex;align-items:center;justify-content:center;border:none;font:inherit;border-radius:50px;font-family:Manrope,sans-serif;width:min-content;font-style:normal;font-weight:700"
28602
+ } : 0);
28603
+ ;// ./src/components/Counter/Counter.tsx
28604
+
28605
+
28606
+
28607
+
28608
+ const MAX_COUNT = 99;
28609
+
28610
+ /**
28611
+ * Counter - Compact numeric indicator for displaying counts or notification badges.
28612
+ *
28613
+ * ### Sizing
28614
+ * Accepts `'small' | 'medium' | 'large'` via the `size` prop (default `'medium'`).
28615
+ * When `count` is omitted the counter shrinks to a small dot (`dot` size) — useful
28616
+ * as a presence indicator with no number shown.
28617
+ *
28618
+ * ### Color
28619
+ * Background is driven by `theme.palette[variant].main` for the five semantic variants.
28620
+ * Pass `color` to override: a `theme.colors` key resolves to the design token value,
28621
+ * any other string is used as a raw CSS color.
28622
+ *
28623
+ * ### CSS override
28624
+ * Pass `css` to apply one-off Emotion styles on top of all internal styles
28625
+ * (size → variant → color → css). Useful for margins, positioning, or shape tweaks.
28626
+ *
28627
+ * ### Overflow
28628
+ * Values above 99 are automatically clamped to `"99+"`.
28629
+ *
28630
+ * @example
28631
+ * ```tsx
28632
+ * // Basic usage — primary variant, medium size
28633
+ * <Counter count={5} />
28634
+ * ```
28635
+ *
28636
+ * @example
28637
+ * ```tsx
28638
+ * // Overflow label
28639
+ * <Counter count={120} variant={CounterVariants.error} size="large" />
28640
+ * // renders "99+"
28641
+ * ```
28642
+ *
28643
+ * @example
28644
+ * ```tsx
28645
+ * // Raw hex color override
28646
+ * <Counter count={3} color="#F7931A" />
28647
+ * ```
28648
+ *
28649
+ * @example
28650
+ * ```tsx
28651
+ * // theme.colors key as color
28652
+ * <Counter count={7} color="purple" />
28653
+ * ```
28654
+ *
28655
+ * @example
28656
+ * ```tsx
28657
+ * // Empty dot indicator (no count)
28658
+ * <Counter variant={CounterVariants.error} />
28659
+ * ```
28660
+ *
28661
+ * @example
28662
+ * ```tsx
28663
+ * // CSS override for layout / shape
28664
+ * <Counter count={3} css={{ marginLeft: 8, borderRadius: 4 }} />
28665
+ * ```
28666
+ */
28667
+ const Counter = ({
28668
+ count,
28669
+ variant = CounterVariants.primary,
28670
+ size = 'medium',
28671
+ color,
28672
+ className,
28673
+ css,
28674
+ ref
28675
+ }) => {
28676
+ const theme = (0,react_namespaceObject.useTheme)();
28677
+ const isEmpty = count === undefined;
28678
+ const label = !isEmpty && count > MAX_COUNT ? `${MAX_COUNT}+` : count;
28679
+ const appliedVariantStyle = styles_variantStyles[variant](theme);
28680
+ const appliedSizeStyle = styles_sizeStyles[!isEmpty ? size : 'dot'];
28681
+ const colorOverride = color ? makeColorOverride(theme, color) : undefined;
28682
+ return (0,jsx_runtime_namespaceObject.jsx)(CounterBase, {
28683
+ ref: ref,
28684
+ css: [appliedSizeStyle, appliedVariantStyle, colorOverride, css, true ? "" : 0, true ? "" : 0],
28685
+ className: className,
28686
+ children: label
28687
+ });
28688
+ };
28689
+ /* harmony default export */ const Counter_Counter = ((/* unused pure expression or super */ null && (Counter)));
28690
+ ;// ./src/components/Counter/index.ts
28691
+
28543
28692
  ;// ./src/components/Tag/styles.ts
28544
28693
 
28545
28694
 
@@ -49336,7 +49485,7 @@ const row = true ? {
49336
49485
  } : 0;
49337
49486
  const leftColumn = width => /*#__PURE__*/(0,react_namespaceObject.css)("position:relative;flex-shrink:0;width:", width, "px;" + ( true ? "" : 0), true ? "" : 0);
49338
49487
  const circle = (color, size, topOffset) => /*#__PURE__*/(0,react_namespaceObject.css)("position:absolute;top:", topOffset, "px;left:50%;transform:translateX(-50%);width:", size, "px;height:", size, "px;border-radius:50%;background-color:", color, ";z-index:1;" + ( true ? "" : 0), true ? "" : 0);
49339
- const connector = (color, circleTopOffset, circleSize) => /*#__PURE__*/(0,react_namespaceObject.css)("position:absolute;left:50%;transform:translateX(-50%);top:", circleTopOffset + circleSize / 2, "px;bottom:-", circleTopOffset + circleSize / 2, "px;width:1px;background-color:", color, ";" + ( true ? "" : 0), true ? "" : 0);
49488
+ const connector = (color, circleTopOffset, circleSize, lineWidth) => /*#__PURE__*/(0,react_namespaceObject.css)("position:absolute;left:50%;transform:translateX(-50%);top:", circleTopOffset + circleSize / 2, "px;bottom:-", circleTopOffset + circleSize / 2, "px;width:", lineWidth, "px;background-color:", color, ";" + ( true ? "" : 0), true ? "" : 0);
49340
49489
  const dateColumn = width => /*#__PURE__*/(0,react_namespaceObject.css)("width:", width, "px;flex-shrink:0;padding-top:", FIRST_LINE_TOP_PADDING, "px;padding-bottom:20px;font-size:14px;line-height:", FIRST_LINE_HEIGHT, "px;" + ( true ? "" : 0), true ? "" : 0);
49341
49490
  const contentColumn = /*#__PURE__*/(0,react_namespaceObject.css)("flex:1;padding-top:", FIRST_LINE_TOP_PADDING, "px;padding-bottom:20px;" + ( true ? "" : 0), true ? "" : 0);
49342
49491
  ;// ./src/components/History/History.tsx
@@ -49345,6 +49494,7 @@ const contentColumn = /*#__PURE__*/(0,react_namespaceObject.css)("flex:1;padding
49345
49494
 
49346
49495
  const DEFAULT_CIRCLE_SIZE = 12;
49347
49496
  const DEFAULT_DATE_WIDTH = 120;
49497
+ const DEFAULT_LINE_WIDTH = 2;
49348
49498
  const LEFT_COLUMN_MARGIN_RIGHT = 16;
49349
49499
 
49350
49500
  /**
@@ -49357,7 +49507,8 @@ const LEFT_COLUMN_MARGIN_RIGHT = 16;
49357
49507
  * - `item.color` overrides the marker color for a specific row
49358
49508
  * - `defaultColor` is used when `item.color` is not provided
49359
49509
  * - fallback default marker color: `theme.palette.primary.main`
49360
- * - fallback connector color: `theme.colors.greyLighter`
49510
+ * - fallback connector color: `theme.colors.greyFocused`
49511
+ * - `lineWidth` controls the connector line thickness in pixels (default `2`)
49361
49512
  *
49362
49513
  * ### Alignment behavior
49363
49514
  * The marker is vertically aligned to the first text line and adapts when
@@ -49380,13 +49531,14 @@ const History = ({
49380
49531
  items,
49381
49532
  defaultColor,
49382
49533
  lineColor,
49534
+ lineWidth = DEFAULT_LINE_WIDTH,
49383
49535
  dateWidth = DEFAULT_DATE_WIDTH,
49384
49536
  circleSize = DEFAULT_CIRCLE_SIZE,
49385
49537
  sx
49386
49538
  }) => {
49387
49539
  const theme = (0,react_namespaceObject.useTheme)();
49388
49540
  const resolvedDefaultColor = defaultColor ?? theme.palette.primary.main;
49389
- const resolvedLineColor = lineColor ?? theme.colors.greyLighter;
49541
+ const resolvedLineColor = lineColor ?? theme.colors.greyFocused;
49390
49542
  const circleTopOffset = Math.max(0, FIRST_LINE_TOP_PADDING + (FIRST_LINE_HEIGHT - circleSize) / 2);
49391
49543
  return (0,jsx_runtime_namespaceObject.jsx)("div", {
49392
49544
  "data-testid": "history",
@@ -49405,7 +49557,7 @@ const History = ({
49405
49557
  children: [(0,jsx_runtime_namespaceObject.jsx)("div", {
49406
49558
  css: circle(color, circleSize, circleTopOffset)
49407
49559
  }), !isLast && (0,jsx_runtime_namespaceObject.jsx)("div", {
49408
- css: connector(resolvedLineColor, circleTopOffset, circleSize)
49560
+ css: connector(resolvedLineColor, circleTopOffset, circleSize, lineWidth)
49409
49561
  })]
49410
49562
  }), (0,jsx_runtime_namespaceObject.jsx)("div", {
49411
49563
  css: dateColumn(dateWidth),
@@ -51248,7 +51400,7 @@ const ValueWithCounter = /*#__PURE__*/base_default()("div", true ? {
51248
51400
  name: "1j5vobt",
51249
51401
  styles: "display:flex;align-items:center;gap:4px"
51250
51402
  } : 0);
51251
- const Counter = /*#__PURE__*/base_default()(TextBase.withComponent('span', true ? {
51403
+ const styles_Counter = /*#__PURE__*/base_default()(TextBase.withComponent('span', true ? {
51252
51404
  target: "ej2kihb16"
51253
51405
  } : 0), true ? {
51254
51406
  target: "ej2kihb7"
@@ -51507,7 +51659,7 @@ const PersonInfoCounter = ({
51507
51659
  children: user.name
51508
51660
  }, user.id))
51509
51661
  });
51510
- const counterNode = (0,jsx_runtime_namespaceObject.jsx)(Counter, {
51662
+ const counterNode = (0,jsx_runtime_namespaceObject.jsx)(styles_Counter, {
51511
51663
  css: css,
51512
51664
  "data-testid": "person-info-counter",
51513
51665
  children: counterValue
@@ -51956,6 +52108,7 @@ const UserProfile = ({
51956
52108
 
51957
52109
 
51958
52110
 
52111
+
51959
52112
 
51960
52113
 
51961
52114
  // ============================================================================