@stella-source/stellasource-dsl 3.3.0 → 3.4.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,12 @@
1
+ import React from "react";
2
+ export interface SelectorChipProps {
3
+ id?: string;
4
+ className?: string;
5
+ label: string;
6
+ selected?: boolean;
7
+ disabled?: boolean;
8
+ onClick?: () => void;
9
+ onClose?: () => void;
10
+ }
11
+ declare const SelectorChip: ({ id, className, label, selected, disabled, onClick, onClose, }: SelectorChipProps) => React.JSX.Element;
12
+ export default SelectorChip;
@@ -0,0 +1,14 @@
1
+ declare const _default: {
2
+ title: string;
3
+ component: ({ id, className, label, selected, disabled, onClick, onClose, }: import("./SelectorChip").SelectorChipProps) => import("react").JSX.Element;
4
+ tags: string[];
5
+ args: {
6
+ label: string;
7
+ selected: boolean;
8
+ disabled: boolean;
9
+ onClick: () => void;
10
+ onClose: () => void;
11
+ };
12
+ };
13
+ export default _default;
14
+ export declare const SelectorChip: {};
@@ -0,0 +1,7 @@
1
+ interface SelectorChipStyleProps {
2
+ $selected?: boolean;
3
+ }
4
+ export declare const SelectorChipComponent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "$selected"> & SelectorChipStyleProps, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "$selected"> & SelectorChipStyleProps, never>>> & string;
5
+ export declare const SelectorChipLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>> & string;
6
+ export declare const SelectorChipClose: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>>> & string;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ export interface SelectorChipProps {
2
+ id?: string;
3
+ className?: string;
4
+ label: string;
5
+ selected?: boolean;
6
+ disabled?: boolean;
7
+ onClick?: () => void;
8
+ onClose?: () => void;
9
+ }
@@ -7,7 +7,7 @@ interface TabProps {
7
7
  htmlProps?: HTMLAttributes<HTMLButtonElement>;
8
8
  active?: boolean;
9
9
  variant?: `${TabsVariant}`;
10
- notifications?: number;
10
+ notifications?: number | string;
11
11
  label: string;
12
12
  }
13
13
  declare const Tab: ({ id, className, onClick, htmlProps, label, variant, active, notifications, }: TabProps) => React.JSX.Element;
@@ -16,6 +16,7 @@ import Sync from "./components/Sync/Sync";
16
16
  import TableUnitsAndTotals from "./components/TableUnitsAndTotals/TableUnitsAndTotals";
17
17
  import PaymentStatus from "./components/PaymentStatus/PaymentStatus";
18
18
  import Tabs from "./components/Tabs/Tabs";
19
+ import SelectorChip from "./components/SelectorChip/SelectorChip";
19
20
  /** Types */
20
21
  import { StellaButtonVariant } from "./components/StellaButton/types";
21
22
  /** Tokens */
@@ -25,4 +26,4 @@ import OrderStatus from "./components/OrderStatus/OrderStatus";
25
26
  /**Exports */
26
27
  export type { StellaIconDefinition } from "./components/StellaIcon/types";
27
28
  export type { CustomColumnMeta } from "./components/Table/types";
28
- export { Tabs, Label, StellaButton, IconButton, Loader, HelperText, Tooltip, StellaIcon, TextInput, PasswordInput, NumberInput, Table, Pagination, Sync, TableUnitsAndTotals, StellaButtonVariant, PaymentStatus, OrderStatus, Styles, };
29
+ export { Tabs, Label, StellaButton, IconButton, Loader, HelperText, Tooltip, StellaIcon, TextInput, PasswordInput, NumberInput, Table, Pagination, Sync, TableUnitsAndTotals, StellaButtonVariant, PaymentStatus, OrderStatus, SelectorChip, Styles, };
@@ -23047,9 +23047,12 @@ const NotificationBubble = styled.span `
23047
23047
  `;
23048
23048
 
23049
23049
  const Tab = ({ id, className, onClick, htmlProps, label, variant = "light", active = false, notifications, }) => {
23050
+ const notificationText = typeof notifications === "number" && notifications <= 0
23051
+ ? undefined
23052
+ : notifications;
23050
23053
  return (a__default.createElement(TabButton, { id: id, "$variant": variant, className: `${className} ${active && "active"}`, onClick: () => onClick?.(label), ...htmlProps },
23051
23054
  label,
23052
- !!(notifications && notifications > 0) && (a__default.createElement(NotificationBubble, { "$isActive": active }, notifications))));
23055
+ !!notificationText && (a__default.createElement(NotificationBubble, { "$isActive": active }, notificationText))));
23053
23056
  };
23054
23057
 
23055
23058
  const Tabs = ({ id, className, tabs, htmlProps, onTabClick, defaultActiveTab, variant = "light", isPill, }) => {
@@ -23061,6 +23064,70 @@ const Tabs = ({ id, className, tabs, htmlProps, onTabClick, defaultActiveTab, va
23061
23064
  return (a__default.createElement(TabsBar, { "$variant": variant, "$isPill": isPill, id: id, className: className, ...htmlProps }, tabs.map((tab) => (a__default.createElement(Tab, { key: `${id}-${tab.label}`, id: `${id}-${tab.label}`, label: tab.label, active: tab.label === activeTab, variant: variant, onClick: () => handleClick(tab.label), notifications: tab.notifications })))));
23062
23065
  };
23063
23066
 
23067
+ const SelectorChipComponent = styled.button `
23068
+ display: inline-flex;
23069
+ align-items: center;
23070
+ justify-content: center;
23071
+ gap: 5px;
23072
+ height: 24px;
23073
+ padding: 2px 8px;
23074
+ border-radius: 4px;
23075
+ border: 1px solid var(--grey200);
23076
+ font-size: 14px;
23077
+ line-height: 1;
23078
+ font-weight: 500;
23079
+ font-family: "inter";
23080
+ cursor: pointer;
23081
+ transition: 0.15s ease;
23082
+ background-color: var(--white);
23083
+ color: var(--charcoal);
23084
+
23085
+ ${({ $selected }) => $selected
23086
+ ? css `
23087
+ background-color: var(--grey700);
23088
+ border-color: var(--grey700);
23089
+ color: var(--white);
23090
+ `
23091
+ : css `
23092
+ &:hover {
23093
+ background: var(--grey50);
23094
+ }
23095
+ `}
23096
+
23097
+ &:disabled {
23098
+ background-color: var(--light-grey);
23099
+ border-color: var(--light-grey);
23100
+ color: var(--smoke);
23101
+ cursor: not-allowed;
23102
+ }
23103
+ `;
23104
+ const SelectorChipLabel = styled.span `
23105
+ display: flex;
23106
+ align-items: center;
23107
+ `;
23108
+ const SelectorChipClose = styled.button `
23109
+ display: flex;
23110
+ align-items: center;
23111
+ justify-content: center;
23112
+
23113
+ border: none;
23114
+ background: transparent;
23115
+ padding: 0;
23116
+
23117
+ cursor: pointer;
23118
+ color: inherit;
23119
+ `;
23120
+
23121
+ const SelectorChip = ({ id, className, label, selected = false, disabled = false, onClick, onClose, }) => {
23122
+ return (a__default.createElement(SelectorChipComponent, { id: id, className: className, "$selected": selected, disabled: disabled, onClick: onClick },
23123
+ a__default.createElement(SelectorChipLabel, null, label),
23124
+ selected && (a__default.createElement(SelectorChipClose, { type: "button", "aria-label": "Remove chip", disabled: disabled, onClick: (e) => {
23125
+ e.stopPropagation();
23126
+ onClose?.();
23127
+ } },
23128
+ a__default.createElement(e, { size: 16 })))));
23129
+ };
23130
+
23064
23131
  const OrderStatusComponent = styled.div `
23065
23132
  display: flex;
23066
23133
  align-items: center;
@@ -23137,5 +23204,5 @@ const OrderStatus = ({ variant, id, className, isPurchaser, }) => {
23137
23204
  a__default.createElement(OrderStatusLabel, null, label)));
23138
23205
  };
23139
23206
 
23140
- export { HelperText, IconButton, Label, Loader, NumberInput, OrderStatus, Pagination, PasswordInput, PaymentStatus, StellaButton, StellaButtonVariant, StellaIcon, Styles, Sync, Table, TableUnitsAndTotals, Tabs, TextInput, Tooltip };
23207
+ export { HelperText, IconButton, Label, Loader, NumberInput, OrderStatus, Pagination, PasswordInput, PaymentStatus, SelectorChip, StellaButton, StellaButtonVariant, StellaIcon, Styles, Sync, Table, TableUnitsAndTotals, Tabs, TextInput, Tooltip };
23141
23208
  //# sourceMappingURL=index.esm.js.map