@clickhouse/click-ui 0.0.140 → 0.0.142

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.
@@ -2281,7 +2281,7 @@ const FormElementContainer = styled.div.withConfig({
2281
2281
  })(["display:flex;flex-direction:column;align-items:flex-start;width:100%;width:-webkit-fill-available;width:fill-available;width:stretch;gap:", ";"], ({
2282
2282
  theme: theme2
2283
2283
  }) => theme2.click.field.space.gap);
2284
- const EllipsisContainer$2 = styled.span.withConfig({
2284
+ styled.span.withConfig({
2285
2285
  componentId: "sc-1sddmxu-8"
2286
2286
  })(["display:flex;white-space:nowrap;overflow:hidden;justify-content:flex-end;gap:inherit;& > *:not(button){overflow:hidden;text-overflow:ellipsis;}"]);
2287
2287
  const FlagList = {
@@ -9903,7 +9903,7 @@ const SvgContainer = styled.svg.withConfig({
9903
9903
  height: ${theme2.click.badge.icon[$size].size.height};
9904
9904
  width: ${theme2.click.badge.icon[$size].size.width};
9905
9905
  `);
9906
- const BadgeContent = styled(EllipsisContainer$2).withConfig({
9906
+ const BadgeContent = styled.div.withConfig({
9907
9907
  componentId: "sc-471xo0-3"
9908
9908
  })(["width:auto;overflow:hidden;svg{", "}"], ({
9909
9909
  $state = "default",
@@ -10291,6 +10291,26 @@ const CardSecondary = ({
10291
10291
  ] })
10292
10292
  ] });
10293
10293
  };
10294
+ const TopBadgeWrapper = styled.div.withConfig({
10295
+ componentId: "sc-1d5pqpo-0"
10296
+ })(["position:relative;width:100%;max-width:100%;"]);
10297
+ const CardPrimaryTopBadge = styled(Badge).withConfig({
10298
+ componentId: "sc-1d5pqpo-1"
10299
+ })(["position:absolute;top:0;left:50%;transform:translate(-50%,-50%);", " div:active + &{border-color:", ";}"], ({
10300
+ $isSelected,
10301
+ theme: theme2
10302
+ }) => $isSelected ? `border-color: ${theme2.click.button.basic.color.primary.stroke.active};` : "", ({
10303
+ theme: theme2
10304
+ }) => theme2.click.button.basic.color.primary.stroke.active);
10305
+ const withTopBadge = (Component2) => ({
10306
+ topBadgeText,
10307
+ ...props
10308
+ }) => {
10309
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(TopBadgeWrapper, { children: [
10310
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...props }),
10311
+ topBadgeText && /* @__PURE__ */ jsxRuntimeExports.jsx(CardPrimaryTopBadge, { "data-testid": "card-top-badge", text: topBadgeText, $isSelected: props.isSelected || false })
10312
+ ] });
10313
+ };
10294
10314
  const Wrapper$9 = styled.div.withConfig({
10295
10315
  componentId: "sc-2dguvi-0"
10296
10316
  })(["background-color:", ";border-radius:", ";border:", ";display:flex;width:100%;max-width:100%;text-align:", ";flex-direction:column;padding:", ";gap:", ";box-shadow:", ";&:hover,&:focus{background-color:", ";cursor:pointer;button{background-color:", ";border-color:", ";&:active{background-color:", ";border-color:", ";}}}&:active{border-color:", ';}&[aria-disabled="true"],&[aria-disabled="true"]:hover,&[aria-disabled="true"]:focus,&[aria-disabled="true"]:active{', "}", ""], ({
@@ -10372,7 +10392,7 @@ const convertCardAlignToTextAlign = (align) => {
10372
10392
  }
10373
10393
  return align === "start" ? "left" : "right";
10374
10394
  };
10375
- const CardPrimary = ({
10395
+ const Card = ({
10376
10396
  alignContent,
10377
10397
  title,
10378
10398
  icon,
@@ -10409,6 +10429,7 @@ const CardPrimary = ({
10409
10429
  infoText && /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { onClick: handleClick, disabled, children: infoText })
10410
10430
  ] });
10411
10431
  };
10432
+ const CardPrimary = withTopBadge(Card);
10412
10433
  const Header$2 = styled.div.withConfig({
10413
10434
  componentId: "sc-1qnbjoa-0"
10414
10435
  })(["display:flex;flex-direction:column;align-items:center;width:fit-content;max-width:100%;gap:inherit;"]);
@@ -37474,7 +37495,7 @@ const CollapsipleTrigger = ({
37474
37495
  }
37475
37496
  onOpenChange();
37476
37497
  };
37477
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(CollapsipleTriggerButton, { onClick, $indicatorDir: indicatorDir, ...props, children: [
37498
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(CollapsipleTriggerButton, { onClick, $indicatorDir: indicatorDir, "aria-label": "trigger children", ...props, children: [
37478
37499
  indicatorDir === "start" && /* @__PURE__ */ jsxRuntimeExports.jsx(SvgImage, { "data-trigger-icon": true, name: "chevron-right", "data-open": open2.toString(), size: "sm" }),
37479
37500
  children && /* @__PURE__ */ jsxRuntimeExports.jsx(IconWrapper, { icon, iconDir, children }),
37480
37501
  indicatorDir === "end" && /* @__PURE__ */ jsxRuntimeExports.jsx(SvgImage, { "data-trigger-icon": true, name: "chevron-right", "data-open": open2.toString(), size: "sm" })
@@ -2298,7 +2298,7 @@ var __publicField = (obj, key, value) => {
2298
2298
  })(["display:flex;flex-direction:column;align-items:flex-start;width:100%;width:-webkit-fill-available;width:fill-available;width:stretch;gap:", ";"], ({
2299
2299
  theme: theme2
2300
2300
  }) => theme2.click.field.space.gap);
2301
- const EllipsisContainer$2 = styled.span.withConfig({
2301
+ styled.span.withConfig({
2302
2302
  componentId: "sc-1sddmxu-8"
2303
2303
  })(["display:flex;white-space:nowrap;overflow:hidden;justify-content:flex-end;gap:inherit;& > *:not(button){overflow:hidden;text-overflow:ellipsis;}"]);
2304
2304
  const FlagList = {
@@ -9920,7 +9920,7 @@ var __publicField = (obj, key, value) => {
9920
9920
  height: ${theme2.click.badge.icon[$size].size.height};
9921
9921
  width: ${theme2.click.badge.icon[$size].size.width};
9922
9922
  `);
9923
- const BadgeContent = styled(EllipsisContainer$2).withConfig({
9923
+ const BadgeContent = styled.div.withConfig({
9924
9924
  componentId: "sc-471xo0-3"
9925
9925
  })(["width:auto;overflow:hidden;svg{", "}"], ({
9926
9926
  $state = "default",
@@ -10308,6 +10308,26 @@ var __publicField = (obj, key, value) => {
10308
10308
  ] })
10309
10309
  ] });
10310
10310
  };
10311
+ const TopBadgeWrapper = styled.div.withConfig({
10312
+ componentId: "sc-1d5pqpo-0"
10313
+ })(["position:relative;width:100%;max-width:100%;"]);
10314
+ const CardPrimaryTopBadge = styled(Badge).withConfig({
10315
+ componentId: "sc-1d5pqpo-1"
10316
+ })(["position:absolute;top:0;left:50%;transform:translate(-50%,-50%);", " div:active + &{border-color:", ";}"], ({
10317
+ $isSelected,
10318
+ theme: theme2
10319
+ }) => $isSelected ? `border-color: ${theme2.click.button.basic.color.primary.stroke.active};` : "", ({
10320
+ theme: theme2
10321
+ }) => theme2.click.button.basic.color.primary.stroke.active);
10322
+ const withTopBadge = (Component) => ({
10323
+ topBadgeText,
10324
+ ...props
10325
+ }) => {
10326
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(TopBadgeWrapper, { children: [
10327
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Component, { ...props }),
10328
+ topBadgeText && /* @__PURE__ */ jsxRuntimeExports.jsx(CardPrimaryTopBadge, { "data-testid": "card-top-badge", text: topBadgeText, $isSelected: props.isSelected || false })
10329
+ ] });
10330
+ };
10311
10331
  const Wrapper$9 = styled.div.withConfig({
10312
10332
  componentId: "sc-2dguvi-0"
10313
10333
  })(["background-color:", ";border-radius:", ";border:", ";display:flex;width:100%;max-width:100%;text-align:", ";flex-direction:column;padding:", ";gap:", ";box-shadow:", ";&:hover,&:focus{background-color:", ";cursor:pointer;button{background-color:", ";border-color:", ";&:active{background-color:", ";border-color:", ";}}}&:active{border-color:", ';}&[aria-disabled="true"],&[aria-disabled="true"]:hover,&[aria-disabled="true"]:focus,&[aria-disabled="true"]:active{', "}", ""], ({
@@ -10389,7 +10409,7 @@ var __publicField = (obj, key, value) => {
10389
10409
  }
10390
10410
  return align === "start" ? "left" : "right";
10391
10411
  };
10392
- const CardPrimary = ({
10412
+ const Card = ({
10393
10413
  alignContent,
10394
10414
  title,
10395
10415
  icon,
@@ -10426,6 +10446,7 @@ var __publicField = (obj, key, value) => {
10426
10446
  infoText && /* @__PURE__ */ jsxRuntimeExports.jsx(Component, { onClick: handleClick, disabled, children: infoText })
10427
10447
  ] });
10428
10448
  };
10449
+ const CardPrimary = withTopBadge(Card);
10429
10450
  const Header$2 = styled.div.withConfig({
10430
10451
  componentId: "sc-1qnbjoa-0"
10431
10452
  })(["display:flex;flex-direction:column;align-items:center;width:fit-content;max-width:100%;gap:inherit;"]);
@@ -37491,7 +37512,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
37491
37512
  }
37492
37513
  onOpenChange();
37493
37514
  };
37494
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(CollapsipleTriggerButton, { onClick, $indicatorDir: indicatorDir, ...props, children: [
37515
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(CollapsipleTriggerButton, { onClick, $indicatorDir: indicatorDir, "aria-label": "trigger children", ...props, children: [
37495
37516
  indicatorDir === "start" && /* @__PURE__ */ jsxRuntimeExports.jsx(SvgImage, { "data-trigger-icon": true, name: "chevron-right", "data-open": open2.toString(), size: "sm" }),
37496
37517
  children && /* @__PURE__ */ jsxRuntimeExports.jsx(IconWrapper, { icon, iconDir, children }),
37497
37518
  indicatorDir === "end" && /* @__PURE__ */ jsxRuntimeExports.jsx(SvgImage, { "data-trigger-icon": true, name: "chevron-right", "data-open": open2.toString(), size: "sm" })
@@ -1,5 +1,6 @@
1
- import { HorizontalDirection, IconName } from '..';
1
+ import { HorizontalDirection } from '..';
2
2
  import { HTMLAttributes, MouseEvent, ReactNode } from 'react';
3
+ import { IconName } from '../Icon/types';
3
4
 
4
5
  export type BadgeState = "default" | "success" | "neutral" | "danger" | "disabled" | "warning" | "info";
5
6
  export type BadgeSize = "sm" | "md";
@@ -1,9 +1,10 @@
1
1
  import { IconName } from '..';
2
2
  import { HTMLAttributes, MouseEventHandler, ReactNode } from 'react';
3
+ import { WithTopBadgeProps } from './withTopBadge';
3
4
 
4
5
  export type CardPrimarySize = "sm" | "md";
5
6
  type ContentAlignment = "start" | "center" | "end";
6
- export interface CardPrimaryProps extends HTMLAttributes<HTMLDivElement> {
7
+ export interface CardPrimaryProps extends HTMLAttributes<HTMLDivElement>, WithTopBadgeProps {
7
8
  title?: string;
8
9
  icon?: IconName;
9
10
  hasShadow?: boolean;
@@ -17,5 +18,5 @@ export interface CardPrimaryProps extends HTMLAttributes<HTMLDivElement> {
17
18
  alignContent?: ContentAlignment;
18
19
  onButtonClick?: MouseEventHandler<HTMLElement>;
19
20
  }
20
- export declare const CardPrimary: ({ alignContent, title, icon, hasShadow, description, infoUrl, infoText, size, disabled, onButtonClick, isSelected, children, ...props }: CardPrimaryProps) => import("react/jsx-runtime").JSX.Element;
21
+ export declare const CardPrimary: import('react').FC<CardPrimaryProps & WithTopBadgeProps>;
21
22
  export {};
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare const TopBadgeWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
+ export declare const CardPrimaryTopBadge: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('../Badge/Badge').DismissibleBadge | import('../Badge/Badge').NonDismissibleBadge, {
4
+ $isSelected?: boolean | undefined;
5
+ }>> & string & Omit<({ icon, iconDir, text, state, size, dismissible, onClose, ...props }: import('../Badge/Badge').BadgeProps) => import("react/jsx-runtime").JSX.Element, keyof import('react').Component<any, {}, any>>;
@@ -0,0 +1,7 @@
1
+ import { ComponentType, FC } from 'react';
2
+
3
+ export interface WithTopBadgeProps {
4
+ topBadgeText?: string;
5
+ isSelected?: boolean;
6
+ }
7
+ export declare const withTopBadge: <P extends object>(Component: ComponentType<P>) => FC<P & WithTopBadgeProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickhouse/click-ui",
3
- "version": "0.0.140",
3
+ "version": "0.0.142",
4
4
  "description": "Official ClickHouse design system react library",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",