se-design 1.0.87-dev.1 → 1.0.87-dev.2

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.
package/dist/index4.js CHANGED
@@ -1,20 +1,20 @@
1
- import o, { forwardRef as F, useRef as G, useEffect as H } from "react";
2
- import { getA11yNameAttributes as J } from "./index81.js";
3
- import { useAccessiblePress as K } from "./index67.js";
1
+ import o, { forwardRef as G, useRef as H, useEffect as J } from "react";
2
+ import { getA11yNameAttributes as K } from "./index81.js";
3
+ import { useAccessiblePress as L } from "./index67.js";
4
4
  import "./index72.js";
5
- import { announce as L } from "./index75.js";
6
- import { Icon as y } from "./index6.js";
5
+ import { announce as M } from "./index75.js";
6
+ import { Icon as w } from "./index6.js";
7
7
  /* empty css */
8
- function u() {
9
- return u = Object.assign ? Object.assign.bind() : function(n) {
8
+ function p() {
9
+ return p = Object.assign ? Object.assign.bind() : function(n) {
10
10
  for (var s = 1; s < arguments.length; s++) {
11
11
  var r = arguments[s];
12
12
  for (var t in r) ({}).hasOwnProperty.call(r, t) && (n[t] = r[t]);
13
13
  }
14
14
  return n;
15
- }, u.apply(null, arguments);
15
+ }, p.apply(null, arguments);
16
16
  }
17
- const a = "focus-outline", M = {
17
+ const a = "focus-outline", Q = {
18
18
  primary: "primary-btn disabled-btn pointer-events-none cursor-not-allowed",
19
19
  secondary: "secondary-btn disabled-btn pointer-events-none cursor-not-allowed",
20
20
  ghost: "ghost-btn disabled-btn pointer-events-none cursor-not-allowed",
@@ -26,7 +26,7 @@ const a = "focus-outline", M = {
26
26
  // padding: 8px, 12px
27
27
  lg: "py-3 px-4 large"
28
28
  // padding: 12px, 16px
29
- }, h = {
29
+ }, g = {
30
30
  primary: `primary-btn ${a}`,
31
31
  secondary: `secondary-btn ${a}`,
32
32
  ghost: `ghost-btn ${a}`,
@@ -38,83 +38,88 @@ const a = "focus-outline", M = {
38
38
  // padding: 8px, 12px
39
39
  lg: "py-3 px-4 large"
40
40
  // padding: 12px, 16px
41
- }, Q = {
41
+ }, S = {
42
42
  blue: "theme-blue",
43
43
  red: "theme-red",
44
44
  yellow: "theme-yellow",
45
45
  green: "theme-green",
46
46
  ai: "theme-ai",
47
47
  white: "theme-white"
48
- }, S = /* @__PURE__ */ F(({
48
+ }, V = /* @__PURE__ */ G(({
49
49
  type: n = "primary",
50
50
  theme: s = "blue",
51
51
  size: r = "md",
52
52
  label: t = "",
53
- iconPosition: p = "left",
54
- disabled: w = !1,
53
+ iconPosition: b = "left",
54
+ disabled: N = !1,
55
55
  loading: e = !1,
56
56
  loadingLabel: l,
57
- className: g = "",
58
- iconProps: m = {
57
+ className: x = "",
58
+ iconProps: c = {
59
59
  name: ""
60
60
  },
61
- automationId: v = "",
62
- autoFocus: N = !1,
63
- ariaLabel: x,
64
- ariaLabelledBy: k,
65
- ariaDescribedBy: C,
66
- isPressed: E,
67
- onClick: $,
68
- onKeyboardActivate: P,
69
- onPointerDown: R,
70
- onMouseDown: j,
71
- onTouchStart: A,
72
- ...B
73
- }, O) => {
74
- const c = n === "unstyled", b = e && l ? l : t, f = G(e);
75
- H(() => {
76
- e && !f.current && L(l || (t ? `${t}, loading` : "Loading"), {
61
+ automationId: k = "",
62
+ autoFocus: C = !1,
63
+ ariaLabel: E,
64
+ ariaLabelledBy: $,
65
+ ariaDescribedBy: P,
66
+ isPressed: R,
67
+ onClick: j,
68
+ onKeyboardActivate: A,
69
+ onPointerDown: B,
70
+ onMouseDown: O,
71
+ onTouchStart: _,
72
+ tabIndex: f,
73
+ ...I
74
+ }, z) => {
75
+ const d = n === "unstyled", y = f !== void 0, h = e && l ? l : t, v = H(e);
76
+ J(() => {
77
+ e && !v.current && M(l || (t ? `${t}, loading` : "Loading"), {
77
78
  delay: 300
78
- }), f.current = e;
79
+ }), v.current = e;
79
80
  }, [e, t, l]);
80
81
  const {
81
- pressProps: _,
82
- isDisabled: d
83
- } = K({
84
- disabled: w,
82
+ pressProps: D,
83
+ isDisabled: i
84
+ } = L({
85
+ disabled: N,
85
86
  loading: e,
86
87
  isNative: !0,
87
88
  // native <button> => hook does NOT add Enter/Space onKeyDown
88
- pressed: E,
89
- onClick: $,
90
- onKeyboardActivate: P,
91
- onPointerDown: R,
92
- onMouseDown: j,
93
- onTouchStart: A
94
- }), I = !c && n !== "link" ? h[r] : "", z = c ? "" : Q[s], D = d ? M[n] : h[n], i = m?.name ? {
95
- ...m,
96
- stroke: d ? "var(--color-gray-600)" : m.stroke
97
- } : void 0, U = ["se-design-button", z, I, D, g, c ? "" : "rounded-[6px] inline-flex gap-1 items-center min-w-fit"].filter(Boolean).join(" "), q = J({
98
- ariaLabel: x,
99
- ariaLabelledBy: k,
100
- ariaDescribedBy: C
89
+ pressed: R,
90
+ onClick: j,
91
+ onKeyboardActivate: A,
92
+ onPointerDown: B,
93
+ onMouseDown: O,
94
+ onTouchStart: _
95
+ }), T = !d && n !== "link" ? g[r] : "", U = d ? "" : S[s];
96
+ let u = i ? Q[n] : g[n];
97
+ i && y && (u = u.replace("pointer-events-none ", ""));
98
+ const m = c?.name ? {
99
+ ...c,
100
+ stroke: i ? "var(--color-gray-600)" : c.stroke
101
+ } : void 0, q = ["se-design-button", U, T, u, x, d ? "" : "rounded-[6px] inline-flex gap-1 items-center min-w-fit"].filter(Boolean).join(" "), F = K({
102
+ ariaLabel: E,
103
+ ariaLabelledBy: $,
104
+ ariaDescribedBy: P
101
105
  });
102
- return /* @__PURE__ */ o.createElement("button", u({
103
- ref: O,
106
+ return /* @__PURE__ */ o.createElement("button", p({
107
+ ref: z,
104
108
  type: "button",
105
- className: U,
106
- disabled: d,
107
- autoFocus: N,
108
- "data-automation-id": v
109
- }, B, _, q), e && /* @__PURE__ */ o.createElement("div", {
109
+ className: q,
110
+ disabled: i && !y,
111
+ tabIndex: f,
112
+ autoFocus: C,
113
+ "data-automation-id": k
114
+ }, I, D, F), e && /* @__PURE__ */ o.createElement("div", {
110
115
  "aria-hidden": "true",
111
116
  className: "animate-spin w-4 h-4 border-2 border-current border-t-transparent rounded-full"
112
- }), !e && i?.name && p === "left" && /* @__PURE__ */ o.createElement(y, i), b && /* @__PURE__ */ o.createElement("span", {
117
+ }), !e && m?.name && b === "left" && /* @__PURE__ */ o.createElement(w, m), h && /* @__PURE__ */ o.createElement("span", {
113
118
  className: "button-label [font-weight:inherit]"
114
- }, b), !e && i?.name && p === "right" && /* @__PURE__ */ o.createElement(y, i));
119
+ }, h), !e && m?.name && b === "right" && /* @__PURE__ */ o.createElement(w, m));
115
120
  });
116
- S.displayName = "Button";
121
+ V.displayName = "Button";
117
122
  export {
118
- S as Button
123
+ V as Button
119
124
  };
120
125
  //# sourceMappingURL=index4.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index4.js","sources":["../src/components/Button/index.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef } from 'react';\nimport { Map } from '../../utils/common.types';\nimport { useAccessiblePress, getA11yNameAttributes } from '../../utils/a11y';\nimport { announce } from '../../utils/a11y/liveAnnouncer';\nimport { Icon, IconProps } from '../Icon';\nimport './style.scss';\n\n/**\n * Allows native button attributes (aria-*, data-*, etc.) to be passed through,\n * but keeps our own onClick/disabled/type typing AND aria-label/aria-labelledby/aria-describedby.\n * Note: We omit 'type' because we use it for button variant, not HTML type attribute.\n * The HTML type is always set to 'button' internally.\n */\ntype NativeButtonProps = Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'onClick' | 'disabled' | 'type' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-pressed'\n>;\n\nexport interface ButtonProps extends NativeButtonProps {\n /**\n * Type of the button. \n */\n type?: 'primary' | 'secondary' | 'ghost' | 'link' | 'unstyled';\n /**\n * Color pallet of the button\n */\n theme?: 'blue' | 'red' | 'yellow' | 'green' | 'ai' | 'white';\n /**\n * Size of the button\n */\n size?: 'sm' | 'md' | 'lg';\n /**\n * Button contents\n */\n label: string | '';\n /**\n * Icon props\n */\n iconProps?: IconProps;\n /**\n * Icon position\n */\n iconPosition?: 'left' | 'right';\n /**\n * Disabled state\n */\n disabled?: boolean;\n /**\n * Loading state - will disable button and show spinner\n */\n loading?: boolean;\n /**\n * Custom label shown (both visually and announced to screen readers) when loading is true.\n * When omitted, the original label remains visible and SR announcement is \"${label}, loading\".\n */\n loadingLabel?: string;\n /**\n * Optional click handler (called for pointer/mouse activations)\n */\n onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Optional keyboard activation handler\n * Called when button is activated via keyboard (Enter/Space) or assistive technology virtual activation.\n * Use when you want to have different behavior for keyboard and pointer activations.\n * If not provided, onClick will be called for all activations.\n */\n onKeyboardActivate?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Custom class name\n */\n className?: string;\n /**\n * Automation ID for testing\n */\n automationId?: string;\n /**\n * If true, button will be focused on mount.\n * For programmatic focus control, use ref with .focus() instead.\n */\n autoFocus?: boolean;\n /**\n * Accessible name for the button. Use when there's no visible label (e.g., icon-only buttons).\n * Prefer ariaLabelledBy when a visible label exists.\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label this button.\n * Preferred over ariaLabel when a visible label exists (keeps SR and visual text in sync).\n */\n ariaLabelledBy?: string;\n /**\n * ID(s) of element(s) that describe this button.\n * Provides additional context announced after the accessible name.\n */\n ariaDescribedBy?: string;\n /**\n * When true, sets aria-pressed for toggle/pressed state \n */\n isPressed?: boolean;\n}\n\nconst focusClass = 'focus-outline';\nconst disabledClassNames: Map = {\n primary: 'primary-btn disabled-btn pointer-events-none cursor-not-allowed',\n secondary: 'secondary-btn disabled-btn pointer-events-none cursor-not-allowed',\n ghost: 'ghost-btn disabled-btn pointer-events-none cursor-not-allowed',\n link: 'link-btn w-fit disabled-btn pointer-events-none cursor-not-allowed',\n unstyled: 'unstyled-btn disabled-btn pointer-events-none cursor-not-allowed',\n sm: 'py-1 px-3 small', // padding: 4px, 12px\n md: 'py-2 px-3 medium', // padding: 8px, 12px\n lg: 'py-3 px-4 large' // padding: 12px, 16px\n};\nconst classNames: Map = {\n primary: `primary-btn ${focusClass}`,\n secondary: `secondary-btn ${focusClass}`,\n ghost: `ghost-btn ${focusClass}`,\n link: `link-btn w-fit ${focusClass}`,\n unstyled: `unstyled-btn ${focusClass}`,\n sm: 'py-1 px-3 small', // padding: 4px, 12px\n md: 'py-2 px-3 medium', // padding: 8px, 12px\n lg: 'py-3 px-4 large' // padding: 12px, 16px\n};\n\nconst colorPalletClassNames: Map = {\n blue: 'theme-blue',\n red: 'theme-red',\n yellow: 'theme-yellow',\n green: 'theme-green',\n ai: 'theme-ai',\n white: 'theme-white'\n};\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n type = 'primary',\n theme = 'blue',\n size = 'md',\n label = '',\n iconPosition = 'left',\n disabled = false,\n loading = false,\n loadingLabel,\n className = '',\n iconProps = { name: '' },\n automationId = '',\n autoFocus = false,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n isPressed,\n onClick,\n onKeyboardActivate,\n onPointerDown,\n onMouseDown,\n onTouchStart,\n ...props\n },\n ref\n ) => {\n const isUnstyled = type === 'unstyled';\n const visibleLabel = loading && loadingLabel ? loadingLabel : label;\n const prevLoadingRef = useRef(loading);\n\n useEffect(() => {\n if (loading && !prevLoadingRef.current) {\n announce(loadingLabel || (label ? `${label}, loading` : 'Loading'), { delay: 300 });\n }\n prevLoadingRef.current = loading;\n }, [loading, label, loadingLabel]);\n\n // Use shared hook for activation handling (pointer vs keyboard/virtual click routing)\n const { pressProps, isDisabled } = useAccessiblePress({\n disabled,\n loading,\n isNative: true, // native <button> => hook does NOT add Enter/Space onKeyDown\n pressed: isPressed,\n onClick: onClick as (e: React.MouseEvent<HTMLElement>) => void,\n onKeyboardActivate: onKeyboardActivate as (e: React.MouseEvent<HTMLElement>) => void,\n onPointerDown: onPointerDown as (e: React.PointerEvent<HTMLElement>) => void,\n onMouseDown: onMouseDown as (e: React.MouseEvent<HTMLElement>) => void,\n onTouchStart: onTouchStart as (e: React.TouchEvent<HTMLElement>) => void\n });\n\n // Skip size/color classes for unstyled variant\n const sizeClassName = !isUnstyled && type !== 'link' ? classNames[size] : '';\n const colorPalletClassName = !isUnstyled ? colorPalletClassNames[theme] : '';\n const typeClassName = isDisabled ? disabledClassNames[type] : classNames[type];\n\n // Avoid mutating incoming iconProps\n const computedIconProps: IconProps | undefined = iconProps?.name\n ? {\n ...iconProps,\n stroke: isDisabled ? 'var(--color-gray-600)' : iconProps.stroke\n }\n : undefined;\n\n const buttonClassName = [\n 'se-design-button',\n colorPalletClassName,\n sizeClassName,\n typeClassName,\n className,\n !isUnstyled ? 'rounded-[6px] inline-flex gap-1 items-center min-w-fit' : ''\n ]\n .filter(Boolean)\n .join(' ');\n\n // Compute accessible name/description props with correct precedence\n const accessibleNameProps = getA11yNameAttributes({\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy\n });\n\n return (\n <button\n ref={ref}\n type=\"button\"\n className={buttonClassName}\n disabled={isDisabled}\n autoFocus={autoFocus}\n data-automation-id={automationId}\n {...props}\n {...(pressProps as React.ButtonHTMLAttributes<HTMLButtonElement>)}\n {...accessibleNameProps}\n >\n {loading && (\n <div\n aria-hidden=\"true\"\n className=\"animate-spin w-4 h-4 border-2 border-current border-t-transparent rounded-full\"\n />\n )}\n {!loading && computedIconProps?.name && iconPosition === 'left' && (\n <Icon {...computedIconProps} />\n )}\n {visibleLabel && (\n <span className=\"button-label [font-weight:inherit]\">{visibleLabel}</span>\n )}\n {!loading && computedIconProps?.name && iconPosition === 'right' && (\n <Icon {...computedIconProps} />\n )}\n </button>\n );\n }\n);\n\nButton.displayName = 'Button';\n"],"names":["focusClass","disabledClassNames","primary","secondary","ghost","link","unstyled","sm","md","lg","classNames","colorPalletClassNames","blue","red","yellow","green","ai","white","Button","type","theme","size","label","iconPosition","disabled","loading","loadingLabel","className","iconProps","name","automationId","autoFocus","ariaLabel","ariaLabelledBy","ariaDescribedBy","isPressed","onClick","onKeyboardActivate","onPointerDown","onMouseDown","onTouchStart","props","ref","isUnstyled","visibleLabel","prevLoadingRef","useRef","useEffect","current","announce","delay","pressProps","isDisabled","useAccessiblePress","isNative","pressed","sizeClassName","colorPalletClassName","typeClassName","computedIconProps","stroke","undefined","buttonClassName","filter","Boolean","join","accessibleNameProps","getA11yNameAttributes","React","createElement","_extends","Icon","displayName"],"mappings":";;;;;;;;;;;;;;;;AAqGA,MAAMA,IAAa,iBACbC,IAA0B;AAAA,EAC9BC,SAAS;AAAA,EACTC,WAAW;AAAA,EACXC,OAAO;AAAA,EACPC,MAAM;AAAA,EACNC,UAAU;AAAA,EACVC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AACN,GACMC,IAAkB;AAAA,EACtBR,SAAS,eAAeF,CAAU;AAAA,EAClCG,WAAW,iBAAiBH,CAAU;AAAA,EACtCI,OAAO,aAAaJ,CAAU;AAAA,EAC9BK,MAAM,kBAAkBL,CAAU;AAAA,EAClCM,UAAU,gBAAgBN,CAAU;AAAA,EACpCO,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AACN,GAEME,IAA6B;AAAA,EACjCC,MAAM;AAAA,EACNC,KAAK;AAAA,EACLC,QAAQ;AAAA,EACRC,OAAO;AAAA,EACPC,IAAI;AAAA,EACJC,OAAO;AACT,GAEaC,sBACX,CACE;AAAA,EACEC,MAAAA,IAAO;AAAA,EACPC,OAAAA,IAAQ;AAAA,EACRC,MAAAA,IAAO;AAAA,EACPC,OAAAA,IAAQ;AAAA,EACRC,cAAAA,IAAe;AAAA,EACfC,UAAAA,IAAW;AAAA,EACXC,SAAAA,IAAU;AAAA,EACVC,cAAAA;AAAAA,EACAC,WAAAA,IAAY;AAAA,EACZC,WAAAA,IAAY;AAAA,IAAEC,MAAM;AAAA,EAAA;AAAA,EACpBC,cAAAA,IAAe;AAAA,EACfC,WAAAA,IAAY;AAAA,EACZC,WAAAA;AAAAA,EACAC,gBAAAA;AAAAA,EACAC,iBA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WAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,iBAAAA;AAAAA,EAAAA,CACD;AAED,SACEkC,gBAAAA,EAAAC,cAAA,UAAAC,EAAA;AAAA,IACE5B,KAAAA;AAAAA,IACAvB,MAAK;AAAA,IACLQ,WAAWmC;AAAAA,IACXtC,UAAU4B;AAAAA,IACVrB,WAAAA;AAAAA,IACA,sBAAoBD;AAAAA,EAAAA,GAChBW,GACCU,GACDe,CAAmB,GAEtBzC,KACC2C,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IACE,eAAY;AAAA,IACZ1C,WAAU;AAAA,EAAA,CACX,GAEF,CAACF,KAAWkC,GAAmB9B,QAAQN,MAAiB,UACvD6C,gBAAAA,EAAAC,cAACE,GAASZ,CAAoB,GAE/Bf,KACCwB,gBAAAA,EAAAC,cAAA,QAAA;AAAA,IAAM1C,WAAU;AAAA,EAAA,GAAsCiB,CAAmB,GAE1E,CAACnB,KAAWkC,GAAmB9B,QAAQN,MAAiB,WACvD6C,gBAAAA,EAAAC,cAACE,GAASZ,CAAoB,CAE1B;AAEV,CACF;AAEAzC,EAAOsD,cAAc;"}
1
+ {"version":3,"file":"index4.js","sources":["../src/components/Button/index.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef } from 'react';\nimport { Map } from '../../utils/common.types';\nimport { useAccessiblePress, getA11yNameAttributes } from '../../utils/a11y';\nimport { announce } from '../../utils/a11y/liveAnnouncer';\nimport { Icon, IconProps } from '../Icon';\nimport './style.scss';\n\n/**\n * Allows native button attributes (aria-*, data-*, etc.) to be passed through,\n * but keeps our own onClick/disabled/type typing AND aria-label/aria-labelledby/aria-describedby.\n * Note: We omit 'type' because we use it for button variant, not HTML type attribute.\n * The HTML type is always set to 'button' internally.\n */\ntype NativeButtonProps = Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'onClick' | 'disabled' | 'type' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-pressed'\n>;\n\nexport interface ButtonProps extends NativeButtonProps {\n /**\n * Type of the button. \n */\n type?: 'primary' | 'secondary' | 'ghost' | 'link' | 'unstyled';\n /**\n * Color pallet of the button\n */\n theme?: 'blue' | 'red' | 'yellow' | 'green' | 'ai' | 'white';\n /**\n * Size of the button\n */\n size?: 'sm' | 'md' | 'lg';\n /**\n * Button contents\n */\n label: string | '';\n /**\n * Icon props\n */\n iconProps?: IconProps;\n /**\n * Icon position\n */\n iconPosition?: 'left' | 'right';\n /**\n * Disabled state\n */\n disabled?: boolean;\n /**\n * Loading state - will disable button and show spinner\n */\n loading?: boolean;\n /**\n * Custom label shown (both visually and announced to screen readers) when loading is true.\n * When omitted, the original label remains visible and SR announcement is \"${label}, loading\".\n */\n loadingLabel?: string;\n /**\n * Optional click handler (called for pointer/mouse activations)\n */\n onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Optional keyboard activation handler\n * Called when button is activated via keyboard (Enter/Space) or assistive technology virtual activation.\n * Use when you want to have different behavior for keyboard and pointer activations.\n * If not provided, onClick will be called for all activations.\n */\n onKeyboardActivate?: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /**\n * Custom class name\n */\n className?: string;\n /**\n * Automation ID for testing\n */\n automationId?: string;\n /**\n * If true, button will be focused on mount.\n * For programmatic focus control, use ref with .focus() instead.\n */\n autoFocus?: boolean;\n /**\n * Accessible name for the button. Use when there's no visible label (e.g., icon-only buttons).\n * Prefer ariaLabelledBy when a visible label exists.\n */\n ariaLabel?: string;\n /**\n * ID(s) of element(s) that label this button.\n * Preferred over ariaLabel when a visible label exists (keeps SR and visual text in sync).\n */\n ariaLabelledBy?: string;\n /**\n * ID(s) of element(s) that describe this button.\n * Provides additional context announced after the accessible name.\n */\n ariaDescribedBy?: string;\n /**\n * When true, sets aria-pressed for toggle/pressed state \n */\n isPressed?: boolean;\n}\n\nconst focusClass = 'focus-outline';\nconst disabledClassNames: Map = {\n primary: 'primary-btn disabled-btn pointer-events-none cursor-not-allowed',\n secondary: 'secondary-btn disabled-btn pointer-events-none cursor-not-allowed',\n ghost: 'ghost-btn disabled-btn pointer-events-none cursor-not-allowed',\n link: 'link-btn w-fit disabled-btn pointer-events-none cursor-not-allowed',\n unstyled: 'unstyled-btn disabled-btn pointer-events-none cursor-not-allowed',\n sm: 'py-1 px-3 small', // padding: 4px, 12px\n md: 'py-2 px-3 medium', // padding: 8px, 12px\n lg: 'py-3 px-4 large' // padding: 12px, 16px\n};\nconst classNames: Map = {\n primary: `primary-btn ${focusClass}`,\n secondary: `secondary-btn ${focusClass}`,\n ghost: `ghost-btn ${focusClass}`,\n link: `link-btn w-fit ${focusClass}`,\n unstyled: `unstyled-btn ${focusClass}`,\n sm: 'py-1 px-3 small', // padding: 4px, 12px\n md: 'py-2 px-3 medium', // padding: 8px, 12px\n lg: 'py-3 px-4 large' // padding: 12px, 16px\n};\n\nconst colorPalletClassNames: Map = {\n blue: 'theme-blue',\n red: 'theme-red',\n yellow: 'theme-yellow',\n green: 'theme-green',\n ai: 'theme-ai',\n white: 'theme-white'\n};\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n type = 'primary',\n theme = 'blue',\n size = 'md',\n label = '',\n iconPosition = 'left',\n disabled = false,\n loading = false,\n loadingLabel,\n className = '',\n iconProps = { name: '' },\n automationId = '',\n autoFocus = false,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n isPressed,\n onClick,\n onKeyboardActivate,\n onPointerDown,\n onMouseDown,\n onTouchStart,\n tabIndex,\n ...props\n },\n ref\n ) => {\n const isUnstyled = type === 'unstyled';\n const hasTabIndex = tabIndex !== undefined;\n const visibleLabel = loading && loadingLabel ? loadingLabel : label;\n const prevLoadingRef = useRef(loading);\n\n useEffect(() => {\n if (loading && !prevLoadingRef.current) {\n announce(loadingLabel || (label ? `${label}, loading` : 'Loading'), { delay: 300 });\n }\n prevLoadingRef.current = loading;\n }, [loading, label, loadingLabel]);\n\n // Use shared hook for activation handling (pointer vs keyboard/virtual click routing)\n const { pressProps, isDisabled } = useAccessiblePress({\n disabled,\n loading,\n isNative: true, // native <button> => hook does NOT add Enter/Space onKeyDown\n pressed: isPressed,\n onClick: onClick as (e: React.MouseEvent<HTMLElement>) => void,\n onKeyboardActivate: onKeyboardActivate as (e: React.MouseEvent<HTMLElement>) => void,\n onPointerDown: onPointerDown as (e: React.PointerEvent<HTMLElement>) => void,\n onMouseDown: onMouseDown as (e: React.MouseEvent<HTMLElement>) => void,\n onTouchStart: onTouchStart as (e: React.TouchEvent<HTMLElement>) => void\n });\n\n // Skip size/color classes for unstyled variant\n const sizeClassName = !isUnstyled && type !== 'link' ? classNames[size] : '';\n const colorPalletClassName = !isUnstyled ? colorPalletClassNames[theme] : '';\n let typeClassName = isDisabled ? disabledClassNames[type] : classNames[type];\n if (isDisabled && hasTabIndex) {\n typeClassName = typeClassName.replace('pointer-events-none ', '');\n }\n\n // Avoid mutating incoming iconProps\n const computedIconProps: IconProps | undefined = iconProps?.name\n ? {\n ...iconProps,\n stroke: isDisabled ? 'var(--color-gray-600)' : iconProps.stroke\n }\n : undefined;\n\n const buttonClassName = [\n 'se-design-button',\n colorPalletClassName,\n sizeClassName,\n typeClassName,\n className,\n !isUnstyled ? 'rounded-[6px] inline-flex gap-1 items-center min-w-fit' : ''\n ]\n .filter(Boolean)\n .join(' ');\n\n // Compute accessible name/description props with correct precedence\n const accessibleNameProps = getA11yNameAttributes({\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy\n });\n\n return (\n <button\n ref={ref}\n type=\"button\"\n className={buttonClassName}\n disabled={isDisabled && !hasTabIndex}\n tabIndex={tabIndex}\n autoFocus={autoFocus}\n data-automation-id={automationId}\n {...props}\n {...(pressProps as React.ButtonHTMLAttributes<HTMLButtonElement>)}\n {...accessibleNameProps}\n >\n {loading && (\n <div\n aria-hidden=\"true\"\n className=\"animate-spin w-4 h-4 border-2 border-current border-t-transparent rounded-full\"\n />\n )}\n {!loading && computedIconProps?.name && iconPosition === 'left' && (\n <Icon {...computedIconProps} />\n )}\n {visibleLabel && (\n <span className=\"button-label [font-weight:inherit]\">{visibleLabel}</span>\n )}\n {!loading && computedIconProps?.name && iconPosition === 'right' && (\n <Icon {...computedIconProps} />\n )}\n </button>\n );\n }\n);\n\nButton.displayName = 'Button';\n"],"names":["focusClass","disabledClassNames","primary","secondary","ghost","link","unstyled","sm","md","lg","classNames","colorPalletClassNames","blue","red","yellow","green","ai","white","Button","type","theme","size","label","iconPosition","disabled","loading","loadingLabel","className","iconProps","name","automationId","autoFocus","ariaLabel","ariaLabelledBy","ariaDescribedBy","isPressed","onClick","onKeyboardActivate","onPointerDown","onMouseDown","onTouchStart","tabIndex","props","ref","isUnstyled","hasTabIndex","undefined","visibleLabel","prevLoadingRef","useRef","useEffect","current","announce","delay","pressProps","isDisabled","useAccessiblePress","isNative","pressed","sizeClassName","colorPalletClassName","typeClassName","replace","computedIconProps","stroke","buttonClassName","filter","Boolean","join","accessibleNameProps","getA11yNameAttributes","React","createElement","_extends","Icon","displayName"],"mappings":";;;;;;;;;;;;;;;;AAqGA,MAAMA,IAAa,iBACbC,IAA0B;AAAA,EAC9BC,SAAS;AAAA,EACTC,WAAW;AAAA,EACXC,OAAO;AAAA,EACPC,MAAM;AAAA,EACNC,UAAU;AAAA,EACVC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AACN,GACMC,IAAkB;AAAA,EACtBR,SAAS,eAAeF,CAAU;AAAA,EAClCG,WAAW,iBAAiBH,CAAU;AAAA,EACtCI,OAAO,aAAaJ,CAAU;AAAA,EAC9BK,MAAM,kBAAkBL,CAAU;AAAA,EAClCM,UAAU,gBAAgBN,CAAU;AAAA,EACpCO,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AAAA,EACJC,IAAI;AAAA;AACN,GAEME,IAA6B;AAAA,EACjCC,MAAM;AAAA,EACNC,KAAK;AAAA,EACLC,QAAQ;AAAA,EACRC,OAAO;AAAA,EACPC,IAAI;AAAA,EACJC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