@edux-design/buttons 0.0.4 → 0.0.6
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/CHANGELOG.md +12 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +19 -16
- package/dist/index.mjs +8 -5
- package/package.json +1 -1
- package/src/elements/Button.jsx +1 -1
- package/src/elements/ButtonGroup.jsx +7 -5
- package/src/elements/IconButton.jsx +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -134,7 +134,8 @@ declare function MenuButton({ children, size }: {
|
|
|
134
134
|
* @typedef {Object} ButtonGroupOption
|
|
135
135
|
* @property {React.ReactNode} [label] - Main label for the option.
|
|
136
136
|
* @property {React.ReactNode} [startAdornment] - Optional leading element (icon, badge, etc.).
|
|
137
|
-
* @property {React.ReactNode} [endIcon] - Optional trailing element.
|
|
137
|
+
* @property {React.ReactNode} [endIcon] - Optional trailing element (legacy alias).
|
|
138
|
+
* @property {React.ReactNode} [endAdornment] - Optional trailing element.
|
|
138
139
|
* @property {string|number} [value] - Unique value used for selection.
|
|
139
140
|
* @property {boolean} [disabled] - Whether the option is disabled.
|
|
140
141
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -134,7 +134,8 @@ declare function MenuButton({ children, size }: {
|
|
|
134
134
|
* @typedef {Object} ButtonGroupOption
|
|
135
135
|
* @property {React.ReactNode} [label] - Main label for the option.
|
|
136
136
|
* @property {React.ReactNode} [startAdornment] - Optional leading element (icon, badge, etc.).
|
|
137
|
-
* @property {React.ReactNode} [endIcon] - Optional trailing element.
|
|
137
|
+
* @property {React.ReactNode} [endIcon] - Optional trailing element (legacy alias).
|
|
138
|
+
* @property {React.ReactNode} [endAdornment] - Optional trailing element.
|
|
138
139
|
* @property {string|number} [value] - Unique value used for selection.
|
|
139
140
|
* @property {boolean} [disabled] - Whether the option is disabled.
|
|
140
141
|
*/
|
package/dist/index.js
CHANGED
|
@@ -65,7 +65,7 @@ var IconButton = (0, import_react.forwardRef)(
|
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
const defaults = "flex justify-center items-center focus:shadow-focus focus-visible:shadow-focus outline-none transition-all duration-300 ease-in-out rounded-full";
|
|
68
|
+
const defaults = "flex justify-center items-center focus:shadow-focus focus-visible:shadow-focus outline-none transition-all duration-300 ease-in-out rounded-full cursor-pointer";
|
|
69
69
|
const sizes = {
|
|
70
70
|
small: "h-[36px] w-[36px] text-sm",
|
|
71
71
|
medium: "h-[44px] w-[44px] text-base",
|
|
@@ -124,7 +124,7 @@ var Button = (0, import_react2.forwardRef)(
|
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
const defaults = "flex justify-center items-center focus:shadow-focus focus-visible:shadow-focus outline-none transition-all duration-300 ease-in-out";
|
|
127
|
+
const defaults = "flex justify-center items-center focus:shadow-focus focus-visible:shadow-focus outline-none transition-all duration-300 ease-in-out cursor-pointer";
|
|
128
128
|
const fonts = "text-bold tracking-normal hover:underline hover:underline-offset-(--underline-offset-btn) active:underline active:underline-offset-(--underline-offset-btn)";
|
|
129
129
|
const sizes = {
|
|
130
130
|
small: "h-[36px] py-8 px-16 rounded-lg text-sm",
|
|
@@ -1953,9 +1953,11 @@ var import_jsx_runtime52 = __toESM2(require_jsx_runtime());
|
|
|
1953
1953
|
var import_jsx_runtime53 = __toESM2(require_jsx_runtime());
|
|
1954
1954
|
var import_jsx_runtime54 = __toESM2(require_jsx_runtime());
|
|
1955
1955
|
var import_jsx_runtime55 = __toESM2(require_jsx_runtime());
|
|
1956
|
+
var import_jsx_runtime56 = __toESM2(require_jsx_runtime());
|
|
1957
|
+
var import_jsx_runtime57 = __toESM2(require_jsx_runtime());
|
|
1956
1958
|
|
|
1957
1959
|
// src/elements/MenuButton.jsx
|
|
1958
|
-
var
|
|
1960
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
1959
1961
|
function MenuButton({ children, size }) {
|
|
1960
1962
|
const SPLIT_BUTTON_STYLES = (0, import_utils3.cx)(
|
|
1961
1963
|
"w-[36px] border-l-[1px] border-l-black flex flex-row justify-center items-center",
|
|
@@ -1964,16 +1966,16 @@ function MenuButton({ children, size }) {
|
|
|
1964
1966
|
"h-[40px] py-2": size === "medium" || size === void 0
|
|
1965
1967
|
}
|
|
1966
1968
|
);
|
|
1967
|
-
return /* @__PURE__ */ (0,
|
|
1968
|
-
/* @__PURE__ */ (0,
|
|
1969
|
-
/* @__PURE__ */ (0,
|
|
1969
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(MenuButtonContext.Provider, { value: true, children: [
|
|
1970
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: SPLIT_BUTTON_STYLES, children }),
|
|
1971
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Chevron_default, {})
|
|
1970
1972
|
] });
|
|
1971
1973
|
}
|
|
1972
1974
|
|
|
1973
1975
|
// src/elements/ButtonGroup.jsx
|
|
1974
1976
|
var import_react5 = __toESM(require("react"));
|
|
1975
1977
|
var import_utils4 = require("@edux-design/utils");
|
|
1976
|
-
var
|
|
1978
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
1977
1979
|
var SIZE_STYLES = {
|
|
1978
1980
|
small: {
|
|
1979
1981
|
button: "text-xs px-12 py-6 rounded-md "
|
|
@@ -2159,15 +2161,15 @@ var ButtonGroup = (0, import_react5.forwardRef)(function ButtonGroup2({
|
|
|
2159
2161
|
sizeStyles.button,
|
|
2160
2162
|
isStretched ? "flex-1" : "w-auto"
|
|
2161
2163
|
);
|
|
2162
|
-
return /* @__PURE__ */ (0,
|
|
2164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
2163
2165
|
"div",
|
|
2164
2166
|
{
|
|
2165
2167
|
...rest,
|
|
2166
2168
|
ref: setContainerRef,
|
|
2167
2169
|
role: "radiogroup",
|
|
2168
2170
|
className: rootClasses,
|
|
2169
|
-
children: /* @__PURE__ */ (0,
|
|
2170
|
-
/* @__PURE__ */ (0,
|
|
2171
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: trackClasses, children: [
|
|
2172
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
2171
2173
|
"span",
|
|
2172
2174
|
{
|
|
2173
2175
|
"aria-hidden": "true",
|
|
@@ -2227,8 +2229,9 @@ var ButtonGroup = (0, import_react5.forwardRef)(function ButtonGroup2({
|
|
|
2227
2229
|
!isActive && "hover:bg-bg-minimal-5 active:bg-bg-inactive"
|
|
2228
2230
|
);
|
|
2229
2231
|
const hasStartAdornment = option.startAdornment !== void 0 && option.startAdornment !== null;
|
|
2230
|
-
const
|
|
2231
|
-
|
|
2232
|
+
const endAdornment = option.endAdornment ?? option.endIcon;
|
|
2233
|
+
const hasEndAdornment = endAdornment !== void 0 && endAdornment !== null;
|
|
2234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
2232
2235
|
"button",
|
|
2233
2236
|
{
|
|
2234
2237
|
ref: registerButtonRef(option.value),
|
|
@@ -2241,7 +2244,7 @@ var ButtonGroup = (0, import_react5.forwardRef)(function ButtonGroup2({
|
|
|
2241
2244
|
onKeyDown: handleKeyDown,
|
|
2242
2245
|
"data-state": isActive ? "active" : "inactive",
|
|
2243
2246
|
children: [
|
|
2244
|
-
hasStartAdornment && /* @__PURE__ */ (0,
|
|
2247
|
+
hasStartAdornment && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
2245
2248
|
"span",
|
|
2246
2249
|
{
|
|
2247
2250
|
"aria-hidden": "true",
|
|
@@ -2249,13 +2252,13 @@ var ButtonGroup = (0, import_react5.forwardRef)(function ButtonGroup2({
|
|
|
2249
2252
|
children: option.startAdornment
|
|
2250
2253
|
}
|
|
2251
2254
|
),
|
|
2252
|
-
/* @__PURE__ */ (0,
|
|
2253
|
-
|
|
2255
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "flex items-center gap-1 leading-none text-current", children: option.label ?? `Option ${index + 1}` }),
|
|
2256
|
+
hasEndAdornment && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
2254
2257
|
"span",
|
|
2255
2258
|
{
|
|
2256
2259
|
"aria-hidden": "true",
|
|
2257
2260
|
className: "flex items-center text-current",
|
|
2258
|
-
children:
|
|
2261
|
+
children: endAdornment
|
|
2259
2262
|
}
|
|
2260
2263
|
)
|
|
2261
2264
|
]
|
package/dist/index.mjs
CHANGED
|
@@ -26,7 +26,7 @@ var IconButton = forwardRef(
|
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
const defaults = "flex justify-center items-center focus:shadow-focus focus-visible:shadow-focus outline-none transition-all duration-300 ease-in-out rounded-full";
|
|
29
|
+
const defaults = "flex justify-center items-center focus:shadow-focus focus-visible:shadow-focus outline-none transition-all duration-300 ease-in-out rounded-full cursor-pointer";
|
|
30
30
|
const sizes = {
|
|
31
31
|
small: "h-[36px] w-[36px] text-sm",
|
|
32
32
|
medium: "h-[44px] w-[44px] text-base",
|
|
@@ -85,7 +85,7 @@ var Button = forwardRef2(
|
|
|
85
85
|
);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
const defaults = "flex justify-center items-center focus:shadow-focus focus-visible:shadow-focus outline-none transition-all duration-300 ease-in-out";
|
|
88
|
+
const defaults = "flex justify-center items-center focus:shadow-focus focus-visible:shadow-focus outline-none transition-all duration-300 ease-in-out cursor-pointer";
|
|
89
89
|
const fonts = "text-bold tracking-normal hover:underline hover:underline-offset-(--underline-offset-btn) active:underline active:underline-offset-(--underline-offset-btn)";
|
|
90
90
|
const sizes = {
|
|
91
91
|
small: "h-[36px] py-8 px-16 rounded-lg text-sm",
|
|
@@ -1914,6 +1914,8 @@ var import_jsx_runtime52 = __toESM(require_jsx_runtime());
|
|
|
1914
1914
|
var import_jsx_runtime53 = __toESM(require_jsx_runtime());
|
|
1915
1915
|
var import_jsx_runtime54 = __toESM(require_jsx_runtime());
|
|
1916
1916
|
var import_jsx_runtime55 = __toESM(require_jsx_runtime());
|
|
1917
|
+
var import_jsx_runtime56 = __toESM(require_jsx_runtime());
|
|
1918
|
+
var import_jsx_runtime57 = __toESM(require_jsx_runtime());
|
|
1917
1919
|
|
|
1918
1920
|
// src/elements/MenuButton.jsx
|
|
1919
1921
|
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
@@ -2196,7 +2198,8 @@ var ButtonGroup = forwardRef3(function ButtonGroup2({
|
|
|
2196
2198
|
!isActive && "hover:bg-bg-minimal-5 active:bg-bg-inactive"
|
|
2197
2199
|
);
|
|
2198
2200
|
const hasStartAdornment = option.startAdornment !== void 0 && option.startAdornment !== null;
|
|
2199
|
-
const
|
|
2201
|
+
const endAdornment = option.endAdornment ?? option.endIcon;
|
|
2202
|
+
const hasEndAdornment = endAdornment !== void 0 && endAdornment !== null;
|
|
2200
2203
|
return /* @__PURE__ */ jsxs2(
|
|
2201
2204
|
"button",
|
|
2202
2205
|
{
|
|
@@ -2219,12 +2222,12 @@ var ButtonGroup = forwardRef3(function ButtonGroup2({
|
|
|
2219
2222
|
}
|
|
2220
2223
|
),
|
|
2221
2224
|
/* @__PURE__ */ jsx4("span", { className: "flex items-center gap-1 leading-none text-current", children: option.label ?? `Option ${index + 1}` }),
|
|
2222
|
-
|
|
2225
|
+
hasEndAdornment && /* @__PURE__ */ jsx4(
|
|
2223
2226
|
"span",
|
|
2224
2227
|
{
|
|
2225
2228
|
"aria-hidden": "true",
|
|
2226
2229
|
className: "flex items-center text-current",
|
|
2227
|
-
children:
|
|
2230
|
+
children: endAdornment
|
|
2228
2231
|
}
|
|
2229
2232
|
)
|
|
2230
2233
|
]
|
package/package.json
CHANGED
package/src/elements/Button.jsx
CHANGED
|
@@ -67,7 +67,7 @@ export const Button = forwardRef(
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
const defaults =
|
|
70
|
-
"flex justify-center items-center focus:shadow-focus focus-visible:shadow-focus outline-none transition-all duration-300 ease-in-out";
|
|
70
|
+
"flex justify-center items-center focus:shadow-focus focus-visible:shadow-focus outline-none transition-all duration-300 ease-in-out cursor-pointer";
|
|
71
71
|
|
|
72
72
|
const fonts =
|
|
73
73
|
"text-bold tracking-normal hover:underline hover:underline-offset-(--underline-offset-btn) active:underline active:underline-offset-(--underline-offset-btn)";
|
|
@@ -28,7 +28,8 @@ const useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;
|
|
|
28
28
|
* @typedef {Object} ButtonGroupOption
|
|
29
29
|
* @property {React.ReactNode} [label] - Main label for the option.
|
|
30
30
|
* @property {React.ReactNode} [startAdornment] - Optional leading element (icon, badge, etc.).
|
|
31
|
-
* @property {React.ReactNode} [endIcon] - Optional trailing element.
|
|
31
|
+
* @property {React.ReactNode} [endIcon] - Optional trailing element (legacy alias).
|
|
32
|
+
* @property {React.ReactNode} [endAdornment] - Optional trailing element.
|
|
32
33
|
* @property {string|number} [value] - Unique value used for selection.
|
|
33
34
|
* @property {boolean} [disabled] - Whether the option is disabled.
|
|
34
35
|
*/
|
|
@@ -340,8 +341,9 @@ export const ButtonGroup = forwardRef(function ButtonGroup(
|
|
|
340
341
|
const hasStartAdornment =
|
|
341
342
|
option.startAdornment !== undefined &&
|
|
342
343
|
option.startAdornment !== null;
|
|
343
|
-
const
|
|
344
|
-
|
|
344
|
+
const endAdornment = option.endAdornment ?? option.endIcon;
|
|
345
|
+
const hasEndAdornment =
|
|
346
|
+
endAdornment !== undefined && endAdornment !== null;
|
|
345
347
|
|
|
346
348
|
return (
|
|
347
349
|
<button
|
|
@@ -370,12 +372,12 @@ export const ButtonGroup = forwardRef(function ButtonGroup(
|
|
|
370
372
|
{option.label ?? `Option ${index + 1}`}
|
|
371
373
|
</span>
|
|
372
374
|
|
|
373
|
-
{
|
|
375
|
+
{hasEndAdornment && (
|
|
374
376
|
<span
|
|
375
377
|
aria-hidden="true"
|
|
376
378
|
className="flex items-center text-current"
|
|
377
379
|
>
|
|
378
|
-
{
|
|
380
|
+
{endAdornment}
|
|
379
381
|
</span>
|
|
380
382
|
)}
|
|
381
383
|
</button>
|
|
@@ -65,7 +65,7 @@ export const IconButton = forwardRef(
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
const defaults =
|
|
68
|
-
"flex justify-center items-center focus:shadow-focus focus-visible:shadow-focus outline-none transition-all duration-300 ease-in-out rounded-full";
|
|
68
|
+
"flex justify-center items-center focus:shadow-focus focus-visible:shadow-focus outline-none transition-all duration-300 ease-in-out rounded-full cursor-pointer";
|
|
69
69
|
|
|
70
70
|
const sizes = {
|
|
71
71
|
small: "h-[36px] w-[36px] text-sm",
|