@stella-source/stellasource-dsl 3.3.1 → 3.5.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.
@@ -8,7 +8,7 @@ declare const _default: {
8
8
  control: {
9
9
  type: string;
10
10
  };
11
- options: (OrderStatusVariant | null)[];
11
+ options: string[];
12
12
  };
13
13
  };
14
14
  args: {
@@ -1,2 +1,2 @@
1
1
  import { OrderStatusVariant } from "./types";
2
- export declare const getOrderStatusLabel: (variant: OrderStatusVariant | null, isPurchaser?: boolean) => string;
2
+ export declare const getOrderStatusLabel: (variant?: `${OrderStatusVariant}` | string, isPurchaser?: boolean) => string;
@@ -15,6 +15,6 @@ export declare enum OrderStatusVariant {
15
15
  export interface OrderStatusProps {
16
16
  id?: string;
17
17
  className?: string;
18
- variant: OrderStatusVariant | null;
18
+ variant?: `${OrderStatusVariant}` | string;
19
19
  isPurchaser?: boolean;
20
20
  }
@@ -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
+ }
@@ -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, };
@@ -23064,6 +23064,70 @@ const Tabs = ({ id, className, tabs, htmlProps, onTabClick, defaultActiveTab, va
23064
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 })))));
23065
23065
  };
23066
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
+
23067
23131
  const OrderStatusComponent = styled.div `
23068
23132
  display: flex;
23069
23133
  align-items: center;
@@ -23083,6 +23147,9 @@ const OrderStatusLabel = styled.span `
23083
23147
  overflow: hidden;
23084
23148
  `;
23085
23149
 
23150
+ // This is used as a dictionary of all of the mapped strings to icons and labels.
23151
+ // It isn't being enforced because of the string type.
23152
+ // Still, any new status mappings need to be added here as it affects the tests and stories.
23086
23153
  var OrderStatusVariant;
23087
23154
  (function (OrderStatusVariant) {
23088
23155
  OrderStatusVariant["COMPLETED"] = "Completed";
@@ -23118,7 +23185,7 @@ const getOrderStatusLabel = (variant, isPurchaser) => {
23118
23185
  }
23119
23186
  };
23120
23187
 
23121
- const OrderStatus = ({ variant, id, className, isPurchaser, }) => {
23188
+ const OrderStatus = ({ variant = "", id, className, isPurchaser, }) => {
23122
23189
  const STATUS_ICON_MAP = {
23123
23190
  InfoNeeded: "warning",
23124
23191
  ViewPricing: "eye",
@@ -23137,8 +23204,9 @@ const OrderStatus = ({ variant, id, className, isPurchaser, }) => {
23137
23204
  const label = getOrderStatusLabel(variant, isPurchaser);
23138
23205
  return (a__default.createElement(OrderStatusComponent, { id: id, className: className },
23139
23206
  iconName && a__default.createElement(OrderStatusIcon, { iconName: iconName, size: 16 }),
23207
+ !iconName && label !== "--" && (a__default.createElement(OrderStatusIcon, { iconName: "warning", size: 16 })),
23140
23208
  a__default.createElement(OrderStatusLabel, null, label)));
23141
23209
  };
23142
23210
 
23143
- export { HelperText, IconButton, Label, Loader, NumberInput, OrderStatus, Pagination, PasswordInput, PaymentStatus, StellaButton, StellaButtonVariant, StellaIcon, Styles, Sync, Table, TableUnitsAndTotals, Tabs, TextInput, Tooltip };
23211
+ export { HelperText, IconButton, Label, Loader, NumberInput, OrderStatus, Pagination, PasswordInput, PaymentStatus, SelectorChip, StellaButton, StellaButtonVariant, StellaIcon, Styles, Sync, Table, TableUnitsAndTotals, Tabs, TextInput, Tooltip };
23144
23212
  //# sourceMappingURL=index.esm.js.map