@galaxy-io/dls 1.4.6 → 1.4.8

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.
@@ -10,8 +10,9 @@ export interface ButtonProps {
10
10
  isLoading?: boolean;
11
11
  isDisabled?: boolean;
12
12
  isIconTrailing?: boolean;
13
- fillWidth?: boolean;
13
+ isIconFilled?: boolean;
14
14
  isEllipsis?: boolean;
15
+ fillWidth?: boolean;
15
16
  cursor?: React.CSSProperties["cursor"];
16
17
  /** Accessible name — required when the button renders an icon with no label. */
17
18
  ariaLabel?: string;
@@ -32,5 +33,5 @@ export declare enum ButtonSize {
32
33
  MEDIUM = "MEDIUM",
33
34
  LARGE = "LARGE"
34
35
  }
35
- declare const Button: ({ label, icon, variant, size, onClick, onMouseEnter, onMouseLeave, fillWidth, isLoading, isDisabled, isIconTrailing, isEllipsis, cursor, ariaLabel, ariaExpanded, ariaControls, ariaHasPopup, }: ButtonProps) => import("react").JSX.Element;
36
+ declare const Button: ({ label, icon, variant, size, onClick, onMouseEnter, onMouseLeave, fillWidth, isLoading, isDisabled, isIconTrailing, isIconFilled, isEllipsis, cursor, ariaLabel, ariaExpanded, ariaControls, ariaHasPopup, }: ButtonProps) => import("react").JSX.Element;
36
37
  export default Button;
@@ -2,7 +2,7 @@ import { GalaxyTheme } from "../theme/constants.js";
2
2
  import { useGalaxyTheme, withTheme } from "../theme/GalaxyTheme.js";
3
3
  import Text, { TextSize, TextVariant, TextWeight } from "../text/Text.js";
4
4
  import FlexItem from "../containers/FlexItem.js";
5
- import Icon, { IconVariant } from "../icons/Icon.js";
5
+ import Icon, { IconVariant, IconWeight } from "../icons/Icon.js";
6
6
  /* empty css */
7
7
  import { styled } from "@linaria/react";
8
8
  import { match } from "ts-pattern";
@@ -98,7 +98,7 @@ var BUTTON_SIZE_TO_ICON_SIZE_MAP = {
98
98
  ["MEDIUM"]: 14,
99
99
  ["LARGE"]: 16
100
100
  };
101
- var Button = ({ label, icon, variant = "PRIMARY", size = "MEDIUM", onClick, onMouseEnter, onMouseLeave, fillWidth, isLoading, isDisabled, isIconTrailing, isEllipsis, cursor, ariaLabel, ariaExpanded, ariaControls, ariaHasPopup }) => {
101
+ var Button = ({ label, icon, variant = "PRIMARY", size = "MEDIUM", onClick, onMouseEnter, onMouseLeave, fillWidth, isLoading, isDisabled, isIconTrailing, isIconFilled, isEllipsis, cursor, ariaLabel, ariaExpanded, ariaControls, ariaHasPopup }) => {
102
102
  const { activeTheme } = useGalaxyTheme();
103
103
  const handleClick = useCallback((e) => {
104
104
  if (isDisabled || isLoading) return;
@@ -116,13 +116,15 @@ var Button = ({ label, icon, variant = "PRIMARY", size = "MEDIUM", onClick, onMo
116
116
  children: /* @__PURE__ */ jsx(Icon, {
117
117
  component: icon,
118
118
  variant: getIconVariant(variant, activeTheme),
119
- size: BUTTON_SIZE_TO_ICON_SIZE_MAP[size]
119
+ size: BUTTON_SIZE_TO_ICON_SIZE_MAP[size],
120
+ weight: isIconFilled ? IconWeight.FILL : IconWeight.BOLD
120
121
  })
121
122
  });
122
123
  }, [
123
124
  icon,
124
125
  variant,
125
126
  size,
127
+ isIconFilled,
126
128
  activeTheme
127
129
  ]);
128
130
  const renderLabel = useCallback(() => {
@@ -1,11 +1,13 @@
1
+ import { InputSize } from "./Input";
1
2
  export interface SwitcherInputItem {
2
3
  id: string;
3
4
  label: string;
4
5
  onClick: () => void;
5
6
  }
6
7
  interface SwitcherInputProps {
8
+ size?: InputSize;
7
9
  items: SwitcherInputItem[];
8
10
  selectedId: string;
9
11
  }
10
- declare const SwitcherInput: ({ items, selectedId }: SwitcherInputProps) => import("react").JSX.Element;
12
+ declare const SwitcherInput: ({ size, items, selectedId }: SwitcherInputProps) => import("react").JSX.Element;
11
13
  export default SwitcherInput;
@@ -1,41 +1,59 @@
1
1
  import { withTheme } from "../theme/GalaxyTheme.js";
2
2
  import Text, { TextWeight } from "../text/Text.js";
3
+ import { InputSize } from "./Input.js";
3
4
  /* empty css */
4
5
  import { styled } from "@linaria/react";
6
+ import { match } from "ts-pattern";
5
7
  import { jsx } from "react/jsx-runtime";
6
8
  //#region src/inputs/SwitcherInput.tsx
7
9
  var _exp = () => ({ theme }) => theme.color.background.primary;
8
10
  var _exp2 = () => ({ theme }) => theme.color.border.primary;
11
+ var _exp3 = () => ({ $size }) => {
12
+ return match($size).with(InputSize.SMALL, () => "0 1.5px").with(InputSize.MEDIUM, () => "1px 2px").with(InputSize.LARGE, () => "2px 2px").exhaustive();
13
+ };
14
+ var _exp4 = () => ({ $size }) => {
15
+ return match($size).with(InputSize.SMALL, () => "24px").with(InputSize.MEDIUM, () => "28px").with(InputSize.LARGE, () => "32px").exhaustive();
16
+ };
9
17
  var StyledSwitcherInput = withTheme(/*#__PURE__*/ styled("div")({
10
18
  name: "StyledSwitcherInput",
11
19
  class: "sx2momv",
12
20
  propsAsIs: false,
13
21
  vars: {
14
22
  "sx2momv-0": [_exp()],
15
- "sx2momv-1": [_exp2()]
23
+ "sx2momv-1": [_exp2()],
24
+ "sx2momv-2": [_exp3()],
25
+ "sx2momv-3": [_exp4()]
16
26
  }
17
27
  }));
18
- var _exp3 = () => ({ theme, $isSelected }) => $isSelected ? theme.color.background.secondary : "transparent";
19
- var _exp4 = () => ({ theme, $isSelected }) => $isSelected ? theme.color.border.primary : "transparent";
28
+ var _exp5 = () => ({ $size }) => {
29
+ return match($size).with(InputSize.SMALL, () => "2px 8px").with(InputSize.MEDIUM, () => "3px 10px").with(InputSize.LARGE, () => "5px 12px").exhaustive();
30
+ };
31
+ var _exp6 = () => ({ theme, $isSelected }) => $isSelected ? theme.color.background.secondary : "transparent";
32
+ var _exp7 = () => ({ theme, $isSelected }) => $isSelected ? theme.color.border.primary : "transparent";
20
33
  var StyledSwitcherInputItem = withTheme(/*#__PURE__*/ styled("div")({
21
34
  name: "StyledSwitcherInputItem",
22
35
  class: "s1pe4aqp",
23
36
  propsAsIs: false,
24
37
  vars: {
25
- "s1pe4aqp-0": [_exp3()],
26
- "s1pe4aqp-1": [_exp4()]
38
+ "s1pe4aqp-0": [_exp5()],
39
+ "s1pe4aqp-1": [_exp6()],
40
+ "s1pe4aqp-2": [_exp7()]
27
41
  }
28
42
  }));
29
- var SwitcherInput = ({ items, selectedId }) => {
30
- return /* @__PURE__ */ jsx(StyledSwitcherInput, { children: items.map((item) => /* @__PURE__ */ jsx(StyledSwitcherInputItem, {
31
- onClick: item.onClick,
32
- $isSelected: item.id === selectedId,
33
- children: /* @__PURE__ */ jsx(Text, {
34
- weight: item.id === selectedId ? TextWeight.MEDIUM : TextWeight.REGULAR,
35
- cursor: "pointer",
36
- children: item.label
37
- })
38
- }, item.label)) });
43
+ var SwitcherInput = ({ size = InputSize.MEDIUM, items, selectedId }) => {
44
+ return /* @__PURE__ */ jsx(StyledSwitcherInput, {
45
+ $size: size,
46
+ children: items.map((item) => /* @__PURE__ */ jsx(StyledSwitcherInputItem, {
47
+ onClick: item.onClick,
48
+ $isSelected: item.id === selectedId,
49
+ $size: size,
50
+ children: /* @__PURE__ */ jsx(Text, {
51
+ weight: item.id === selectedId ? TextWeight.MEDIUM : TextWeight.REGULAR,
52
+ cursor: "pointer",
53
+ children: item.label
54
+ })
55
+ }, item.label))
56
+ });
39
57
  };
40
58
  //#endregion
41
59
  export { SwitcherInput as default };
package/dist/styles.css CHANGED
@@ -116,8 +116,8 @@
116
116
  .s1b59sw7{position:absolute;left:0;top:0;height:100%;background:var(--s1b59sw7-0);border-radius:200px;z-index:1;}
117
117
  .salrebx{position:absolute;left:var(--salrebx-0);top:50%;-webkit-transform:translate(-50%, -50%);-moz-transform:translate(-50%, -50%);-ms-transform:translate(-50%, -50%);transform:translate(-50%, -50%);width:8px;height:8px;background:var(--salrebx-1);border-radius:50%;cursor:var(--salrebx-2);-webkit-transition:var(--salrebx-3);transition:var(--salrebx-3);z-index:3;pointer-events:var(--salrebx-4);}.salrebx:active{cursor:var(--salrebx-5);-webkit-transform:translate(-50%, -50%) scale(1.1);-moz-transform:translate(-50%, -50%) scale(1.1);-ms-transform:translate(-50%, -50%) scale(1.1);transform:translate(-50%, -50%) scale(1.1);}.salrebx:hover{-webkit-transform:var(--salrebx-6);-moz-transform:var(--salrebx-6);-ms-transform:var(--salrebx-6);transform:var(--salrebx-6);}
118
118
  .h1trli0w{position:absolute;opacity:0;width:100%;height:100%;margin:0;padding:0;cursor:pointer;z-index:2;}
119
- .sx2momv{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background:var(--sx2momv-0);border:0.5px solid var(--sx2momv-1);border-radius:5px;padding:0 3px;height:28px;}
120
- .s1pe4aqp{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:8px;padding:3px 8px;background:var(--s1pe4aqp-0);cursor:pointer;border:0.5px solid var(--s1pe4aqp-1);border-radius:4px;}
119
+ .sx2momv{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background:var(--sx2momv-0);border:0.5px solid var(--sx2momv-1);border-radius:5px;padding:var(--sx2momv-2);height:var(--sx2momv-3);}
120
+ .s1pe4aqp{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:8px;padding:var(--s1pe4aqp-0);background:var(--s1pe4aqp-1);cursor:pointer;border:0.5px solid var(--s1pe4aqp-2);border-radius:4px;}
121
121
  .s1jhbbpd{outline:none;resize:none;min-height:var(--s1jhbbpd-0);width:var(--s1jhbbpd-1);height:var(--s1jhbbpd-2);-webkit-flex:var(--s1jhbbpd-3);-ms-flex:var(--s1jhbbpd-3);flex:var(--s1jhbbpd-3);background-color:var(--s1jhbbpd-4);border:0.5px solid var(--s1jhbbpd-5);border-radius:4px;color:var(--s1jhbbpd-6);font-size:var(--s1jhbbpd-7);line-height:var(--s1jhbbpd-8);font-weight:var(--s1jhbbpd-9);font-family:var(--s1jhbbpd-10);padding:var(--s1jhbbpd-11);-webkit-transition:border-color 0.075s ease-in-out;transition:border-color 0.075s ease-in-out;}.s1jhbbpd:hover:not(:disabled, :focus){border-color:var(--s1jhbbpd-12);}.s1jhbbpd:focus{border-color:var(--s1jhbbpd-13);}.s1jhbbpd:disabled{cursor:not-allowed;opacity:0.6;}.s1jhbbpd::-webkit-input-placeholder{color:var(--s1jhbbpd-14);}.s1jhbbpd::-moz-placeholder{color:var(--s1jhbbpd-14);}.s1jhbbpd:-ms-input-placeholder{color:var(--s1jhbbpd-14);}.s1jhbbpd::placeholder{color:var(--s1jhbbpd-14);}
122
122
  .tu0hnok{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;width:var(--tu0hnok-0);height:var(--tu0hnok-1);}
123
123
  .l48iv0n{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:4px;min-height:var(--l48iv0n-0);width:var(--l48iv0n-1);height:var(--l48iv0n-2);-webkit-flex:var(--l48iv0n-3);-ms-flex:var(--l48iv0n-3);flex:var(--l48iv0n-3);background-color:var(--l48iv0n-4);border:0.5px solid var(--l48iv0n-5);border-radius:4px;padding:var(--l48iv0n-6);}
@@ -17,7 +17,7 @@ var _exp4 = () => ({ theme, $weight }) => {
17
17
  return match($weight).with(TextWeight.REGULAR, () => theme.font.sans.weight.regular).with(TextWeight.MEDIUM, () => theme.font.sans.weight.medium).exhaustive();
18
18
  };
19
19
  var _exp5 = () => ({ theme, $size }) => {
20
- return match($size).with(TextSize.CAPTION, () => theme.font.sans.height.caption).with(TextSize.BODY_SM, () => theme.font.sans.height.body_sm).with(TextSize.BODY_MD, () => theme.font.sans.height.body_md).with(TextSize.BODY_LG, () => theme.font.sans.height.body_lg).with(TextSize.HEADING_SM, () => theme.font.sans.height.heading_sm).with(TextSize.HEADING_MD, () => theme.font.sans.height.heading_md).with(TextSize.HEADING_LG, () => theme.font.sans.height.heading_lg).exhaustive();
20
+ return match($size).with(TextSize.CAPTION, () => `calc(${theme.font.sans.height.caption} * 1.25)`).with(TextSize.BODY_SM, () => `calc(${theme.font.sans.height.body_sm} * 1.25)`).with(TextSize.BODY_MD, () => `calc(${theme.font.sans.height.body_md} * 1.25)`).with(TextSize.BODY_LG, () => `calc(${theme.font.sans.height.body_lg} * 1.25)`).with(TextSize.HEADING_SM, () => `calc(${theme.font.sans.height.heading_sm} * 1.25)`).with(TextSize.HEADING_MD, () => `calc(${theme.font.sans.height.heading_md} * 1.25)`).with(TextSize.HEADING_LG, () => `calc(${theme.font.sans.height.heading_lg} * 1.25)`).exhaustive();
21
21
  };
22
22
  var _exp6 = () => ({ theme, $size }) => {
23
23
  return match($size).with(TextSize.CAPTION, () => theme.font.sans.spacing.caption).with(TextSize.BODY_SM, () => theme.font.sans.spacing.body_sm).with(TextSize.BODY_MD, () => theme.font.sans.spacing.body_md).with(TextSize.BODY_LG, () => theme.font.sans.spacing.body_lg).with(TextSize.HEADING_SM, () => theme.font.sans.spacing.heading_sm).with(TextSize.HEADING_MD, () => theme.font.sans.spacing.heading_md).with(TextSize.HEADING_LG, () => theme.font.sans.spacing.heading_lg).exhaustive();
@@ -2,12 +2,22 @@ import type { PropsWithChildren } from "react";
2
2
  export declare enum WidgetVariant {
3
3
  BASE = "BASE",
4
4
  PRIMARY = "PRIMARY",
5
+ PRIMARY_ALT = "PRIMARY_ALT",
5
6
  SECONDARY = "SECONDARY",
7
+ SECONDARY_ALT = "SECONDARY_ALT",
6
8
  TERTIARY = "TERTIARY",
9
+ TERTIARY_ALT = "TERTIARY_ALT",
7
10
  SUCCESS = "SUCCESS",
8
- WARNING = "WARNING",
9
11
  ERROR = "ERROR",
10
- DISABLED = "DISABLED"
12
+ WARNING = "WARNING",
13
+ DISABLED = "DISABLED",
14
+ BLUE = "BLUE",
15
+ LIME = "LIME",
16
+ TEAL = "TEAL",
17
+ YELLOW = "YELLOW",
18
+ ORANGE = "ORANGE",
19
+ PURPLE = "PURPLE",
20
+ PINK = "PINK"
11
21
  }
12
22
  interface WidgetProps {
13
23
  header?: string;
@@ -8,21 +8,31 @@ import { jsx } from "react/jsx-runtime";
8
8
  var WidgetVariant = /* @__PURE__ */ function(WidgetVariant) {
9
9
  WidgetVariant["BASE"] = "BASE";
10
10
  WidgetVariant["PRIMARY"] = "PRIMARY";
11
+ WidgetVariant["PRIMARY_ALT"] = "PRIMARY_ALT";
11
12
  WidgetVariant["SECONDARY"] = "SECONDARY";
13
+ WidgetVariant["SECONDARY_ALT"] = "SECONDARY_ALT";
12
14
  WidgetVariant["TERTIARY"] = "TERTIARY";
15
+ WidgetVariant["TERTIARY_ALT"] = "TERTIARY_ALT";
13
16
  WidgetVariant["SUCCESS"] = "SUCCESS";
14
- WidgetVariant["WARNING"] = "WARNING";
15
17
  WidgetVariant["ERROR"] = "ERROR";
18
+ WidgetVariant["WARNING"] = "WARNING";
16
19
  WidgetVariant["DISABLED"] = "DISABLED";
20
+ WidgetVariant["BLUE"] = "BLUE";
21
+ WidgetVariant["LIME"] = "LIME";
22
+ WidgetVariant["TEAL"] = "TEAL";
23
+ WidgetVariant["YELLOW"] = "YELLOW";
24
+ WidgetVariant["ORANGE"] = "ORANGE";
25
+ WidgetVariant["PURPLE"] = "PURPLE";
26
+ WidgetVariant["PINK"] = "PINK";
17
27
  return WidgetVariant;
18
28
  }({});
19
29
  var _exp = () => ({ theme, $variant }) => {
20
- return match($variant).with("BASE", () => theme.color.background.base).with("PRIMARY", () => theme.color.background.primary).with("SECONDARY", () => theme.color.background.secondary).with("TERTIARY", () => theme.color.background.tertiary).with("SUCCESS", () => theme.color.background.success).with("WARNING", () => theme.color.background.warning).with("ERROR", () => theme.color.background.error).with("DISABLED", () => theme.color.background.primary).exhaustive();
30
+ return match($variant).with("BASE", () => theme.color.background.base).with("PRIMARY", () => theme.color.background.primary).with("PRIMARY_ALT", () => theme.color.background.primaryAlt).with("SECONDARY", () => theme.color.background.secondary).with("SECONDARY_ALT", () => theme.color.background.secondaryAlt).with("TERTIARY", () => theme.color.background.tertiary).with("TERTIARY_ALT", () => theme.color.background.tertiaryAlt).with("SUCCESS", () => theme.color.background.success).with("WARNING", () => theme.color.background.warning).with("ERROR", () => theme.color.background.error).with("DISABLED", () => theme.color.background.disabled).with("BLUE", () => theme.color.background.blue).with("LIME", () => theme.color.background.lime).with("TEAL", () => theme.color.background.teal).with("YELLOW", () => theme.color.background.yellow).with("ORANGE", () => theme.color.background.orange).with("PURPLE", () => theme.color.background.purple).with("PINK", () => theme.color.background.pink).exhaustive();
21
31
  };
22
32
  var _exp2 = () => ({ theme, $noBorder, $isSelected, $variant }) => {
23
33
  if ($noBorder) return "transparent";
24
34
  if ($isSelected) return theme.color.border.selected;
25
- return match($variant).with("BASE", () => theme.color.border.primary).with("PRIMARY", () => theme.color.border.primary).with("SECONDARY", () => theme.color.border.primary).with("TERTIARY", () => theme.color.border.primary).with("SUCCESS", () => theme.color.border.success).with("WARNING", () => theme.color.border.warning).with("ERROR", () => theme.color.border.error).with("DISABLED", () => theme.color.border.primary).exhaustive();
35
+ return match($variant).with("BASE", () => theme.color.border.primary).with("PRIMARY", () => theme.color.border.primary).with("PRIMARY_ALT", () => theme.color.border.selected).with("SECONDARY", () => theme.color.border.primary).with("SECONDARY_ALT", () => theme.color.border.selected).with("TERTIARY", () => theme.color.border.primary).with("TERTIARY_ALT", () => theme.color.border.selected).with("SUCCESS", () => theme.color.border.success).with("WARNING", () => theme.color.border.warning).with("ERROR", () => theme.color.border.error).with("DISABLED", () => theme.color.border.disabled).with("BLUE", () => theme.color.border.blue).with("LIME", () => theme.color.border.lime).with("TEAL", () => theme.color.border.teal).with("YELLOW", () => theme.color.border.yellow).with("ORANGE", () => theme.color.border.orange).with("PURPLE", () => theme.color.border.purple).with("PINK", () => theme.color.border.pink).exhaustive();
26
36
  };
27
37
  var _exp3 = () => ({ $padding, $noPadding }) => $padding ?? ($noPadding ? "0" : "12px");
28
38
  var _exp4 = () => ({ $fillWidth }) => $fillWidth ? "100%" : "auto";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galaxy-io/dls",
3
- "version": "1.4.6",
3
+ "version": "1.4.8",
4
4
  "description": "Galaxy Design Language System",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",