@bolttech/atoms-button 0.28.2 → 0.29.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/index.cjs.js CHANGED
@@ -1114,7 +1114,7 @@ var SizeVariant;
1114
1114
  const Container = /*#__PURE__*/styled__default.default.div.withConfig({
1115
1115
  displayName: "atoms-buttonstyles__Container",
1116
1116
  componentId: "sc-i4bzba-0"
1117
- })(["display:flex;align-items:center;gap:", ";white-space:nowrap;cursor:pointer;.left-img-btn,.right-img-btn{display:flex;label{font-size:", ";}}*{cursor:pointer;}"], ({
1117
+ })(["display:flex;align-items:center;gap:", ";white-space:nowrap;cursor:pointer;.left-img-btn,.right-img-btn{display:flex;span,label{font-size:", ";}}*{cursor:pointer;}"], ({
1118
1118
  theme,
1119
1119
  $size
1120
1120
  }) => theme.components.button[$size].generic.gap, ({
@@ -1124,7 +1124,7 @@ const Container = /*#__PURE__*/styled__default.default.div.withConfig({
1124
1124
  const Button$1 = /*#__PURE__*/styled__default.default.button.withConfig({
1125
1125
  displayName: "atoms-buttonstyles__Button",
1126
1126
  componentId: "sc-i4bzba-1"
1127
- })(["height:fit-content;background-color:", ";border-radius:", ";border:", " solid ", ";box-shadow:", ";color:", ";padding:", ";label.material-symbols-sharp{color:", ";}&:disabled{background-color:", ";border:", ";color:", ";label.material-symbols-sharp{color:", ";}}&:active:enabled{background-color:", ";border:", ";color:", ";label.material-symbols-sharp{color:", ";}}&:hover:enabled{background-color:", ";border:", ";color:", ";label.material-symbols-sharp{color:", ";}}", ""], ({
1127
+ })(["height:fit-content;background-color:", ";border-radius:", ";border:", " solid ", ";box-shadow:", ";color:", ";padding:", ";&:focus-visible{outline:2px solid #000;outline-offset:2px;}label.material-symbols-sharp,span.material-symbols-sharp{color:", ";}&:disabled{background-color:", ";border:", ";color:", ";label.material-symbols-sharp,span.material-symbols-sharp{color:", ";}}&:active:enabled{background-color:", ";border:", ";color:", ";label.material-symbols-sharp,span.material-symbols-sharp{color:", ";}}&:hover:enabled{background-color:", ";border:", ";color:", ";label.material-symbols-sharp,span.material-symbols-sharp{color:", ";}}", ""], ({
1128
1128
  theme,
1129
1129
  $variant
1130
1130
  }) => theme.components.button[$variant].container.color.default, ({
@@ -1239,9 +1239,11 @@ const Button = /*#__PURE__*/react.forwardRef((_a, ref) => {
1239
1239
  iconLeft,
1240
1240
  fullWidth = false,
1241
1241
  type = 'button',
1242
+ ariaLabel = "",
1242
1243
  onClick
1243
1244
  } = _a,
1244
- props = __rest(_a, ["id", "dataTestId", "disabled", "title", "variant", "size", "iconRight", "iconLeft", "fullWidth", "type", "onClick"]);
1245
+ props = __rest(_a, ["id", "dataTestId", "disabled", "title", "variant", "size", "iconRight", "iconLeft", "fullWidth", "type", "ariaLabel", "onClick"]);
1246
+ const iconId = react.useId();
1245
1247
  return jsxRuntime.jsx(Button$1, Object.assign({
1246
1248
  id: id,
1247
1249
  "data-testid": dataTestId,
@@ -1254,14 +1256,20 @@ const Button = /*#__PURE__*/react.forwardRef((_a, ref) => {
1254
1256
  "$fullWidth": fullWidth,
1255
1257
  onClick: event => !disabled && onClick && onClick(event),
1256
1258
  ref: ref
1257
- }, uiUtils.applyDataAttributes(props), {
1259
+ }, disabled ? {
1260
+ 'aria-disabled': disabled
1261
+ } : {}, ariaLabel ? {
1262
+ 'aria-label': ariaLabel
1263
+ } : {}, uiUtils.applyDataAttributes(props), {
1258
1264
  children: jsxRuntime.jsxs(Container, {
1259
1265
  "$size": size,
1260
1266
  children: [iconLeft && jsxRuntime.jsx("div", {
1261
1267
  className: "left-img-btn",
1262
1268
  "data-testid": `left-img-btn-${iconLeft}`,
1263
1269
  children: jsxRuntime.jsx(atomsIcon.Icon, Object.assign({
1270
+ id: `buttonIcon-${iconId}-${iconLeft}`,
1264
1271
  dataTestId: `buttonIcon-${iconLeft}`,
1272
+ ariaHidden: title || ariaLabel ? true : undefined,
1265
1273
  icon: iconLeft
1266
1274
  }, uiUtils.applyDataAttributes(props, 'icon-left')))
1267
1275
  }), title && jsxRuntime.jsx(ButtonTitle, Object.assign({
@@ -1273,7 +1281,9 @@ const Button = /*#__PURE__*/react.forwardRef((_a, ref) => {
1273
1281
  className: "right-img-btn",
1274
1282
  "data-testid": `left-img-btn-${iconRight}`,
1275
1283
  children: jsxRuntime.jsx(atomsIcon.Icon, Object.assign({
1284
+ id: `buttonIcon-${iconId}-${iconRight}`,
1276
1285
  dataTestId: `buttonIcon-${iconRight}`,
1286
+ ariaHidden: title || ariaLabel ? true : undefined,
1277
1287
  icon: iconRight
1278
1288
  }, uiUtils.applyDataAttributes(props, 'icon-right')))
1279
1289
  })]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bolttech/atoms-button",
3
- "version": "0.28.2",
3
+ "version": "0.29.2",
4
4
  "dependencies": {
5
5
  "styled-components": "6.1.1",
6
6
  "react": "19.1.2",
@@ -10,6 +10,7 @@ export declare const Button: React.ForwardRefExoticComponent<import("@bolttech/u
10
10
  iconLeft?: string;
11
11
  type?: import("./atoms-button.type").ButtonTypes;
12
12
  fullWidth?: boolean;
13
+ ariaLabel?: string;
13
14
  onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
14
15
  } & React.RefAttributes<HTMLButtonElement>>;
15
16
  export default Button;
@@ -23,5 +23,6 @@ export type ButtonProps = DefaultProps & {
23
23
  iconLeft?: string;
24
24
  type?: ButtonTypes;
25
25
  fullWidth?: boolean;
26
+ ariaLabel?: string;
26
27
  onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
27
28
  };