@stenajs-webui/elements 21.42.1 → 21.43.1

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.
@@ -1,9 +1,9 @@
1
1
  import * as React from "react";
2
- import { ReactNode } from "react";
2
+ import { AriaAttributes, ReactNode } from "react";
3
3
  import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
4
- import { HeadingVariant } from "@stenajs-webui/core";
4
+ import { DivProps, HeadingVariant } from "@stenajs-webui/core";
5
5
  export type BannerVariant = "standard" | "info" | "success" | "warning" | "error";
6
- export interface BannerProps {
6
+ export interface BannerProps extends AriaAttributes {
7
7
  icon?: IconDefinition;
8
8
  headerText?: string;
9
9
  headingLevel?: HeadingVariant;
@@ -12,5 +12,10 @@ export interface BannerProps {
12
12
  contentRight?: ReactNode;
13
13
  variant?: BannerVariant;
14
14
  children?: ReactNode;
15
+ /**
16
+ * The role prop of the element, used for accessibility.
17
+ * If not set, it will default to "status" when variant is success, error or warning, otherwise not set.
18
+ */
19
+ role?: DivProps["role"];
15
20
  }
16
21
  export declare const Banner: React.FC<BannerProps>;
package/dist/index.es.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import * as y from "react";
3
3
  import { forwardRef as f, Children as t1, useState as R1, useCallback as F, useId as y1, useContext as T1, useMemo as D1 } from "react";
4
4
  import { jsx as C, jsxs as m, Fragment as B } from "react/jsx-runtime";
5
- import { Box as x, getDataProps as I, Column as _, Row as Z, Heading as J, Text as v, Space as $, Indent as s1, exhaustSwitchCaseElseThrow as w1, useForwardedRef as F1, Spacing as j1, SeparatorLine as E1, Txt as S, ScreenReaderOnlyText as O1 } from "@stenajs-webui/core";
5
+ import { Box as x, getDataProps as I, Column as z, Row as Z, Heading as J, Text as v, Space as $, Indent as s1, exhaustSwitchCaseElseThrow as w1, useForwardedRef as F1, Spacing as j1, SeparatorLine as E1, Txt as S, ScreenReaderOnlyText as O1 } from "@stenajs-webui/core";
6
6
  import { FontAwesomeIcon as V } from "@fortawesome/react-fontawesome";
7
7
  import l from "classnames";
8
8
  import { keyframes as P1, ClassNames as W1 } from "@emotion/react";
@@ -3698,8 +3698,8 @@ const X1 = ({
3698
3698
  style: r,
3699
3699
  transform: d,
3700
3700
  display: u,
3701
- ...z
3702
- }, h) {
3701
+ ...h
3702
+ }, _) {
3703
3703
  if (!o)
3704
3704
  return null;
3705
3705
  const g = typeof c == "string" ? c : c / 10 + "rem";
@@ -3714,9 +3714,9 @@ const X1 = ({
3714
3714
  rotation: t,
3715
3715
  spin: s,
3716
3716
  style: { fontSize: g, ...r },
3717
- ref: h,
3717
+ ref: _,
3718
3718
  transform: d,
3719
- ...z
3719
+ ...h
3720
3720
  }
3721
3721
  ) });
3722
3722
  }), o2 = "_banner_hmwzu_1", a2 = "_iconBackground_hmwzu_7", t2 = "_standard_hmwzu_17", s2 = "_info_hmwzu_21", c2 = "_success_hmwzu_25", r2 = "_warning_hmwzu_29", m2 = "_error_hmwzu_33", O = {
@@ -3772,42 +3772,48 @@ const X1 = ({
3772
3772
  icon: a,
3773
3773
  variant: t = "standard",
3774
3774
  loading: c = !1,
3775
- ...s
3776
- }) => /* @__PURE__ */ m(
3777
- _,
3778
- {
3779
- className: l(O.banner, O[t]),
3780
- spacing: i || n && e ? 2 : 1,
3781
- indent: 2,
3782
- ...I(s),
3783
- children: [
3784
- /* @__PURE__ */ m(Z, { justifyContent: "space-between", children: [
3785
- /* @__PURE__ */ C(Z, { flex: "none", width: x1, alignItems: "center", children: /* @__PURE__ */ C("div", { className: O.iconBackground, children: (a || p1[t] || c) && /* @__PURE__ */ C(B, { children: c ? /* @__PURE__ */ C(k1, { size: "tiny" }) : /* @__PURE__ */ C(
3786
- N,
3787
- {
3788
- icon: a ?? p1[t],
3789
- size: 20,
3790
- className: O.icon
3791
- }
3792
- ) }) }) }),
3793
- /* @__PURE__ */ m(Z, { justifyContent: "space-between", flexGrow: 1, gap: !0, children: [
3794
- /* @__PURE__ */ m(_, { justifyContent: "center", gap: !0, children: [
3795
- n && /* @__PURE__ */ C(J, { variant: "h5", as: L, children: n }),
3796
- e && /* @__PURE__ */ C(v, { children: e })
3797
- ] }),
3798
- o && /* @__PURE__ */ C(_, { justifyContent: "center", children: o })
3799
- ] })
3800
- ] }),
3801
- i && /* @__PURE__ */ m(Z, { children: [
3802
- /* @__PURE__ */ C(x, { minWidth: x1 }),
3803
- /* @__PURE__ */ m(x, { children: [
3804
- /* @__PURE__ */ C($, {}),
3805
- i
3775
+ role: s,
3776
+ ...r
3777
+ }) => {
3778
+ const d = s ?? (t === "error" || t === "warning" || t === "success" ? "status" : void 0), u = I(r), h = t === "error" ? "polite" : void 0;
3779
+ return /* @__PURE__ */ m(
3780
+ z,
3781
+ {
3782
+ className: l(O.banner, O[t]),
3783
+ spacing: i || n && e ? 2 : 1,
3784
+ indent: 2,
3785
+ role: d,
3786
+ "aria-live": h,
3787
+ ...u,
3788
+ children: [
3789
+ /* @__PURE__ */ m(Z, { justifyContent: "space-between", children: [
3790
+ /* @__PURE__ */ C(Z, { flex: "none", width: x1, alignItems: "center", children: /* @__PURE__ */ C("div", { className: O.iconBackground, children: (a || p1[t] || c) && /* @__PURE__ */ C(B, { children: c ? /* @__PURE__ */ C(k1, { size: "tiny" }) : /* @__PURE__ */ C(
3791
+ N,
3792
+ {
3793
+ icon: a ?? p1[t],
3794
+ size: 20,
3795
+ className: O.icon
3796
+ }
3797
+ ) }) }) }),
3798
+ /* @__PURE__ */ m(Z, { justifyContent: "space-between", flexGrow: 1, gap: !0, children: [
3799
+ /* @__PURE__ */ m(z, { justifyContent: "center", gap: !0, children: [
3800
+ n && /* @__PURE__ */ C(J, { variant: "h5", as: L, children: n }),
3801
+ e && /* @__PURE__ */ C(v, { children: e })
3802
+ ] }),
3803
+ o && /* @__PURE__ */ C(z, { justifyContent: "center", children: o })
3804
+ ] })
3805
+ ] }),
3806
+ i && /* @__PURE__ */ m(Z, { children: [
3807
+ /* @__PURE__ */ C(x, { minWidth: x1 }),
3808
+ /* @__PURE__ */ m(x, { children: [
3809
+ /* @__PURE__ */ C($, {}),
3810
+ i
3811
+ ] })
3806
3812
  ] })
3807
- ] })
3808
- ]
3809
- }
3810
- ), g2 = "_link_oed7a_1", b2 = "_disabled_oed7a_31", y2 = "_standard_oed7a_61", w2 = "_bold_oed7a_64", S2 = "_caption_oed7a_68", B2 = "_overline_oed7a_75", k2 = "_large_oed7a_82", v2 = "_medium_oed7a_88", A2 = "_small_oed7a_93", H2 = "_smaller_oed7a_99", W = {
3813
+ ]
3814
+ }
3815
+ );
3816
+ }, g2 = "_link_oed7a_1", b2 = "_disabled_oed7a_31", y2 = "_standard_oed7a_61", w2 = "_bold_oed7a_64", S2 = "_caption_oed7a_68", B2 = "_overline_oed7a_75", k2 = "_large_oed7a_82", v2 = "_medium_oed7a_88", A2 = "_small_oed7a_93", H2 = "_smaller_oed7a_99", W = {
3811
3817
  link: g2,
3812
3818
  disabled: b2,
3813
3819
  standard: y2,
@@ -3832,7 +3838,7 @@ const X1 = ({
3832
3838
  iconRight: r,
3833
3839
  href: d,
3834
3840
  ...u
3835
- }, z) => /* @__PURE__ */ m(
3841
+ }, h) => /* @__PURE__ */ m(
3836
3842
  "a",
3837
3843
  {
3838
3844
  tabIndex: o ? void 0 : i,
@@ -3843,7 +3849,7 @@ const X1 = ({
3843
3849
  a && W.disabled,
3844
3850
  L
3845
3851
  ),
3846
- ref: z,
3852
+ ref: h,
3847
3853
  href: a ? void 0 : d,
3848
3854
  onClick: a ? void 0 : e,
3849
3855
  ...u,
@@ -3988,17 +3994,17 @@ const X1 = ({
3988
3994
  spinnerClassName: r,
3989
3995
  leftWrapperClassName: d,
3990
3996
  rightWrapperClassName: u,
3991
- size: z = "medium",
3992
- responsiveIconOnly: h = !1
3997
+ size: h = "medium",
3998
+ responsiveIconOnly: _ = !1
3993
3999
  }) => {
3994
4000
  const g = (n || L || e || i) && /* @__PURE__ */ C(
3995
4001
  "div",
3996
4002
  {
3997
4003
  className: l(
3998
4004
  b.leftWrapper,
3999
- b[z],
4005
+ b[h],
4000
4006
  d,
4001
- h && b.responsiveIconOnly
4007
+ _ && b.responsiveIconOnly
4002
4008
  ),
4003
4009
  children: n ? /* @__PURE__ */ C(
4004
4010
  V,
@@ -4025,9 +4031,9 @@ const X1 = ({
4025
4031
  {
4026
4032
  className: l(
4027
4033
  b.rightWrapper,
4028
- b[z],
4034
+ b[h],
4029
4035
  u,
4030
- h && b.responsiveIconOnly
4036
+ _ && b.responsiveIconOnly
4031
4037
  ),
4032
4038
  children: o || (a ? /* @__PURE__ */ C(
4033
4039
  V,
@@ -4047,7 +4053,7 @@ const X1 = ({
4047
4053
  className: l(
4048
4054
  b.label,
4049
4055
  s,
4050
- h && b.responsiveIconOnly
4056
+ _ && b.responsiveIconOnly
4051
4057
  ),
4052
4058
  children: t
4053
4059
  }
@@ -4068,8 +4074,8 @@ const X1 = ({
4068
4074
  left: r,
4069
4075
  rightIcon: d,
4070
4076
  right: u,
4071
- disabled: z,
4072
- onClick: h,
4077
+ disabled: h,
4078
+ onClick: _,
4073
4079
  iconClassName: g,
4074
4080
  labelClassName: w,
4075
4081
  spinnerClassName: A,
@@ -4091,10 +4097,10 @@ const X1 = ({
4091
4097
  {
4092
4098
  ref: $1,
4093
4099
  onClick: (Y) => {
4094
- if (h) {
4095
- if (Y.stopPropagation(), Y.preventDefault(), z || t || a)
4100
+ if (_) {
4101
+ if (Y.stopPropagation(), Y.preventDefault(), h || t || a)
4096
4102
  return;
4097
- h(Y);
4103
+ _(Y);
4098
4104
  }
4099
4105
  },
4100
4106
  className: l(
@@ -4103,7 +4109,7 @@ const X1 = ({
4103
4109
  V1 && H.roundButton,
4104
4110
  e
4105
4111
  ),
4106
- disabled: z,
4112
+ disabled: h,
4107
4113
  ...H1,
4108
4114
  children: /* @__PURE__ */ C(
4109
4115
  r1,
@@ -4297,8 +4303,8 @@ const T5 = f(
4297
4303
  disabled: r,
4298
4304
  variant: d = "standard",
4299
4305
  left: u,
4300
- right: z,
4301
- success: h = !1,
4306
+ right: h,
4307
+ success: _ = !1,
4302
4308
  loading: g = !1,
4303
4309
  ...w
4304
4310
  }, A) {
@@ -4318,9 +4324,9 @@ const T5 = f(
4318
4324
  ),
4319
4325
  disabled: r,
4320
4326
  ref: A,
4321
- ...w,
4322
4327
  "aria-expanded": i ? e : void 0,
4323
4328
  "aria-controls": i ? E : void 0,
4329
+ ...w,
4324
4330
  children: [
4325
4331
  /* @__PURE__ */ C(
4326
4332
  l1,
@@ -4328,8 +4334,8 @@ const T5 = f(
4328
4334
  label: L,
4329
4335
  leftIcon: t,
4330
4336
  left: u,
4331
- right: g ? /* @__PURE__ */ C(v1, {}) : z,
4332
- rightIcon: h ? j : c,
4337
+ right: g ? /* @__PURE__ */ C(v1, {}) : h,
4338
+ rightIcon: _ ? j : c,
4333
4339
  color: "var(--current-text-color)"
4334
4340
  }
4335
4341
  ),
@@ -4406,7 +4412,7 @@ const T5 = f(
4406
4412
  (d == null ? void 0 : d.selected) && M.selected,
4407
4413
  M[o],
4408
4414
  L
4409
- ), { renderLink: z, selected: h, ...g } = t, w = ((A = r == null ? void 0 : r.renderLink) == null ? void 0 : A.call(
4415
+ ), { renderLink: h, selected: _, ...g } = t, w = ((A = r == null ? void 0 : r.renderLink) == null ? void 0 : A.call(
4410
4416
  r,
4411
4417
  {
4412
4418
  ...g,
@@ -4444,10 +4450,10 @@ const T5 = f(
4444
4450
  M.iconOnly,
4445
4451
  M[i],
4446
4452
  n
4447
- ), { renderLink: u, selected: z, ...h } = a, g = ((w = s == null ? void 0 : s.renderLink) == null ? void 0 : w.call(
4453
+ ), { renderLink: u, selected: h, ..._ } = a, g = ((w = s == null ? void 0 : s.renderLink) == null ? void 0 : w.call(
4448
4454
  s,
4449
4455
  {
4450
- ...h,
4456
+ ..._,
4451
4457
  className: d,
4452
4458
  href: e ? void 0 : o,
4453
4459
  children: c
@@ -4459,7 +4465,7 @@ const T5 = f(
4459
4465
  className: d,
4460
4466
  href: e ? void 0 : o,
4461
4467
  ref: t,
4462
- ...h,
4468
+ ..._,
4463
4469
  children: c
4464
4470
  }
4465
4471
  );
@@ -4488,8 +4494,8 @@ const T5 = f(
4488
4494
  left: r,
4489
4495
  rightIcon: d,
4490
4496
  right: u,
4491
- responsiveIconOnly: z,
4492
- ...h
4497
+ responsiveIconOnly: h,
4498
+ ..._
4493
4499
  }, g) {
4494
4500
  const w = c1(
4495
4501
  L,
@@ -4510,7 +4516,7 @@ const T5 = f(
4510
4516
  T && H.labelOnly,
4511
4517
  e
4512
4518
  ),
4513
- ...h,
4519
+ ..._,
4514
4520
  children: /* @__PURE__ */ C(
4515
4521
  r1,
4516
4522
  {
@@ -4521,7 +4527,7 @@ const T5 = f(
4521
4527
  right: u,
4522
4528
  rightIcon: d,
4523
4529
  label: w,
4524
- responsiveIconOnly: z
4530
+ responsiveIconOnly: h
4525
4531
  }
4526
4532
  )
4527
4533
  }
@@ -4569,7 +4575,7 @@ const T5 = f(
4569
4575
  onClickUp: L,
4570
4576
  iconColor: e,
4571
4577
  disabled: i
4572
- }) => /* @__PURE__ */ m(_, { className: L1.upDownButtons, children: [
4578
+ }) => /* @__PURE__ */ m(z, { className: L1.upDownButtons, children: [
4573
4579
  /* @__PURE__ */ C("button", { onClick: L, className: L1.button, disabled: i, children: /* @__PURE__ */ C(Z, { justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ C(
4574
4580
  N,
4575
4581
  {
@@ -4636,7 +4642,7 @@ const T5 = f(
4636
4642
  background: n = "white",
4637
4643
  ...L
4638
4644
  }) => /* @__PURE__ */ C(
4639
- _,
4645
+ z,
4640
4646
  {
4641
4647
  shadow: "box",
4642
4648
  background: n,
@@ -4674,7 +4680,7 @@ const T5 = f(
4674
4680
  ), TC = ({
4675
4681
  variant: n = "standard",
4676
4682
  ...L
4677
- }) => /* @__PURE__ */ C(_, { indent: 3, spacing: n === "compact" ? 1 : 3, ...L }), q5 = "_cardy_voxad_1", J5 = "_cardyIndent_voxad_12", M1 = {
4683
+ }) => /* @__PURE__ */ C(z, { indent: 3, spacing: n === "compact" ? 1 : 3, ...L }), q5 = "_cardy_voxad_1", J5 = "_cardyIndent_voxad_12", M1 = {
4678
4684
  cardy: q5,
4679
4685
  cardyIndent: J5
4680
4686
  }, DC = ({
@@ -4820,7 +4826,7 @@ const T5 = f(
4820
4826
  label: L,
4821
4827
  children: e
4822
4828
  }) => /* @__PURE__ */ m(
4823
- _,
4829
+ z,
4824
4830
  {
4825
4831
  borderRadius: "var(--swui-border-radius-large)",
4826
4832
  spacing: 2,
@@ -4929,7 +4935,7 @@ const T5 = f(
4929
4935
  trapFocus: o,
4930
4936
  className: a
4931
4937
  }) => L ? /* @__PURE__ */ C(U1, { contain: o, children: /* @__PURE__ */ m(
4932
- _,
4938
+ z,
4933
4939
  {
4934
4940
  width: e,
4935
4941
  shadow: i,
@@ -4939,7 +4945,7 @@ const T5 = f(
4939
4945
  borderRadius: "8px",
4940
4946
  children: [
4941
4947
  n,
4942
- /* @__PURE__ */ C(_, { gap: 1, children: L })
4948
+ /* @__PURE__ */ C(z, { gap: 1, children: L })
4943
4949
  ]
4944
4950
  }
4945
4951
  ) }) : null, _4 = y.createContext({}), Z1 = ({ disableCloseOnClick: n, onClick: L }, e) => {
@@ -5008,7 +5014,7 @@ const T5 = f(
5008
5014
  }, s) {
5009
5015
  const { onKeyDown: r, innerRef: d } = Z1(c, s);
5010
5016
  return /* @__PURE__ */ C(B, { children: /* @__PURE__ */ m(
5011
- _,
5017
+ z,
5012
5018
  {
5013
5019
  gap: 1,
5014
5020
  ...c,
@@ -5046,8 +5052,8 @@ const T5 = f(
5046
5052
  // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Tab_Role
5047
5053
  responsiveIconOnly: d,
5048
5054
  ...u
5049
- }, z) {
5050
- const h = c1(
5055
+ }, h) {
5056
+ const _ = c1(
5051
5057
  e,
5052
5058
  s,
5053
5059
  void 0,
@@ -5061,7 +5067,7 @@ const T5 = f(
5061
5067
  role: "tab",
5062
5068
  "aria-selected": L,
5063
5069
  tabIndex: r,
5064
- ref: z,
5070
+ ref: h,
5065
5071
  ...u,
5066
5072
  children: /* @__PURE__ */ C(
5067
5073
  r1,
@@ -5072,7 +5078,7 @@ const T5 = f(
5072
5078
  left: o,
5073
5079
  right: t,
5074
5080
  rightIcon: c,
5075
- label: h,
5081
+ label: _,
5076
5082
  responsiveIconOnly: d
5077
5083
  }
5078
5084
  )
@@ -5143,7 +5149,7 @@ const T5 = f(
5143
5149
  footer: e,
5144
5150
  disableBorder: i = !1,
5145
5151
  variant: o = "standard"
5146
- }) => /* @__PURE__ */ m(_, { children: [
5152
+ }) => /* @__PURE__ */ m(z, { children: [
5147
5153
  L && /* @__PURE__ */ C(Z, { spacing: !0, children: /* @__PURE__ */ C(J, { variant: "h5", children: L }) }),
5148
5154
  /* @__PURE__ */ C(
5149
5155
  "table",
@@ -5207,7 +5213,7 @@ const T5 = f(
5207
5213
  grid: W4
5208
5214
  }, b1 = ({ location: n, dateTime: L, originalDateTime: e, size: i }) => i === "compact" ? /* @__PURE__ */ m(Z, { gap: 2, justifyContent: "space-between", children: [
5209
5215
  /* @__PURE__ */ C(S, { size: "small", children: n }),
5210
- /* @__PURE__ */ m(_, { children: [
5216
+ /* @__PURE__ */ m(z, { children: [
5211
5217
  e && /* @__PURE__ */ C(
5212
5218
  S,
5213
5219
  {
@@ -5220,9 +5226,9 @@ const T5 = f(
5220
5226
  ),
5221
5227
  /* @__PURE__ */ C(S, { size: "small", variant: "bold", children: L })
5222
5228
  ] })
5223
- ] }) : i === "relaxed" ? /* @__PURE__ */ m(_, { gap: 0.5, children: [
5229
+ ] }) : i === "relaxed" ? /* @__PURE__ */ m(z, { gap: 0.5, children: [
5224
5230
  /* @__PURE__ */ C(S, { size: "large", variant: "bold", children: n }),
5225
- /* @__PURE__ */ m(_, { children: [
5231
+ /* @__PURE__ */ m(z, { children: [
5226
5232
  e && /* @__PURE__ */ C(
5227
5233
  S,
5228
5234
  {
@@ -5235,9 +5241,9 @@ const T5 = f(
5235
5241
  ),
5236
5242
  /* @__PURE__ */ C(S, { size: "small", variant: "bold", children: L })
5237
5243
  ] })
5238
- ] }) : /* @__PURE__ */ m(_, { gap: 0.5, children: [
5244
+ ] }) : /* @__PURE__ */ m(z, { gap: 0.5, children: [
5239
5245
  /* @__PURE__ */ C(S, { children: n }),
5240
- /* @__PURE__ */ m(_, { children: [
5246
+ /* @__PURE__ */ m(z, { children: [
5241
5247
  e && /* @__PURE__ */ C(
5242
5248
  S,
5243
5249
  {
@@ -5274,7 +5280,7 @@ const T5 = f(
5274
5280
  }
5275
5281
  ),
5276
5282
  /* @__PURE__ */ m("div", { className: n1.grid, children: [
5277
- /* @__PURE__ */ m(_, { alignItems: "center", children: [
5283
+ /* @__PURE__ */ m(z, { alignItems: "center", children: [
5278
5284
  /* @__PURE__ */ C(N, { icon: c, fixedWidth: !0, size: 20 }),
5279
5285
  /* @__PURE__ */ C($, { half: !0 }),
5280
5286
  /* @__PURE__ */ C(
@@ -5295,7 +5301,7 @@ const T5 = f(
5295
5301
  }
5296
5302
  )
5297
5303
  ] }),
5298
- /* @__PURE__ */ m(_, { gap: o === "standard" ? 3 : 2, children: [
5304
+ /* @__PURE__ */ m(z, { gap: o === "standard" ? 3 : 2, children: [
5299
5305
  /* @__PURE__ */ C(b1, { ...L, size: o }),
5300
5306
  /* @__PURE__ */ C(b1, { ...e, size: o })
5301
5307
  ] }),