@bigtablet/design-system 3.19.3 → 3.20.0

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.
Files changed (2) hide show
  1. package/dist/index.js +25 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2905,6 +2905,7 @@ var FieldContext = createContext(void 0);
2905
2905
  function useFieldControl() {
2906
2906
  return useContext(FieldContext);
2907
2907
  }
2908
+ var FieldControlBoundary = ({ children }) => /* @__PURE__ */ jsx(FieldContext.Provider, { value: void 0, children });
2908
2909
  var Field = ({
2909
2910
  name,
2910
2911
  label,
@@ -4539,12 +4540,13 @@ var Dropdown = (props) => {
4539
4540
  );
4540
4541
  const fieldsetClassName = cn("dropdown_fieldset", { is_open: isOpen, is_disabled: disabled });
4541
4542
  const listClassName = cn("dropdown_list", { dropdown_list_up: dropUp });
4543
+ const labelledBy = label ? `${dropdownId}_label` : field?.labelId;
4542
4544
  const listStyle = useSpringPresence({
4543
4545
  visible: isOpen,
4544
4546
  from: dropUp ? "translateY(4px)" : "translateY(-4px)"
4545
4547
  });
4546
4548
  return /* @__PURE__ */ jsxs("div", { ref: wrapperRef, className: rootClassName, children: [
4547
- label && /* @__PURE__ */ jsx("label", { htmlFor: dropdownId, className: "dropdown_label", children: label }),
4549
+ label && /* @__PURE__ */ jsx("label", { id: `${dropdownId}_label`, htmlFor: dropdownId, className: "dropdown_label", children: label }),
4548
4550
  /* @__PURE__ */ jsx("div", { className: fieldsetClassName, children: /* @__PURE__ */ jsxs(
4549
4551
  "button",
4550
4552
  {
@@ -4552,16 +4554,27 @@ var Dropdown = (props) => {
4552
4554
  id: dropdownId,
4553
4555
  type: "button",
4554
4556
  className: cn("dropdown_control", { is_disabled: disabled }),
4557
+ role: "combobox",
4558
+ "aria-labelledby": [labelledBy, `${dropdownId}_value`].filter(Boolean).join(" "),
4555
4559
  "aria-haspopup": "listbox",
4556
4560
  "aria-expanded": isOpen,
4561
+ "aria-activedescendant": !searchable && isOpen && activeIndex >= 0 && visibleOptions[activeIndex] ? `${dropdownId}_option_${activeIndex}` : void 0,
4557
4562
  "aria-describedby": field?.describedBy,
4558
4563
  "aria-invalid": field?.invalid || void 0,
4564
+ "aria-required": field?.required || void 0,
4559
4565
  "aria-controls": isOpen ? `${dropdownId}_listbox` : void 0,
4560
4566
  onClick: () => !disabled && setIsOpen((o) => !o),
4561
4567
  onKeyDown: onControlKeyDown,
4562
4568
  disabled,
4563
4569
  children: [
4564
- /* @__PURE__ */ jsx("span", { className: showValue ? "dropdown_value" : "dropdown_placeholder", children: controlText }),
4570
+ /* @__PURE__ */ jsx(
4571
+ "span",
4572
+ {
4573
+ id: `${dropdownId}_value`,
4574
+ className: showValue ? "dropdown_value" : "dropdown_placeholder",
4575
+ children: controlText
4576
+ }
4577
+ ),
4565
4578
  /* @__PURE__ */ jsx("span", { className: cn("dropdown_icon", { dropdown_icon_open: isOpen }), "aria-hidden": "true", children: /* @__PURE__ */ jsx(ChevronDown, { size: iconSize.lg }) })
4566
4579
  ]
4567
4580
  }
@@ -4608,6 +4621,7 @@ var Dropdown = (props) => {
4608
4621
  role: "combobox",
4609
4622
  "aria-autocomplete": "list",
4610
4623
  "aria-expanded": isOpen,
4624
+ "aria-required": field?.required || void 0,
4611
4625
  "aria-controls": `${dropdownId}_listbox`,
4612
4626
  "aria-activedescendant": activeIndex >= 0 && visibleOptions[activeIndex] ? `${dropdownId}_option_${activeIndex}` : void 0,
4613
4627
  value: searchText,
@@ -4834,7 +4848,7 @@ var DatePicker = ({
4834
4848
  return /* @__PURE__ */ jsxs("div", { className: rootClassName, style: containerStyle, children: [
4835
4849
  label && /* @__PURE__ */ jsx("span", { className: "date_picker_label", id: groupId, children: label }),
4836
4850
  constraintDesc && /* @__PURE__ */ jsx("span", { id: constraintId, className: "date_picker_sr_only", children: constraintDesc }),
4837
- /* @__PURE__ */ jsxs(
4851
+ /* @__PURE__ */ jsx(
4838
4852
  "div",
4839
4853
  {
4840
4854
  className: "date_picker_fields",
@@ -4842,7 +4856,7 @@ var DatePicker = ({
4842
4856
  "aria-labelledby": field?.labelId ?? (label ? groupId : void 0),
4843
4857
  "aria-describedby": [field?.describedBy, constraintDesc ? constraintId : void 0].filter(Boolean).join(" ") || void 0,
4844
4858
  "aria-invalid": field?.invalid || void 0,
4845
- children: [
4859
+ children: /* @__PURE__ */ jsxs(FieldControlBoundary, { children: [
4846
4860
  /* @__PURE__ */ jsx(
4847
4861
  Dropdown,
4848
4862
  {
@@ -4882,7 +4896,7 @@ var DatePicker = ({
4882
4896
  disabled: disabled || !month
4883
4897
  }
4884
4898
  )
4885
- ]
4899
+ ] })
4886
4900
  }
4887
4901
  )
4888
4902
  ] });
@@ -4919,7 +4933,7 @@ var DateRangePicker = ({
4919
4933
  date_range_picker_full_width: fullWidth,
4920
4934
  date_range_picker_disabled: disabled
4921
4935
  }),
4922
- children: /* @__PURE__ */ jsxs(
4936
+ children: /* @__PURE__ */ jsx(
4923
4937
  "div",
4924
4938
  {
4925
4939
  className: "date_range_picker_fields",
@@ -4927,7 +4941,7 @@ var DateRangePicker = ({
4927
4941
  "aria-labelledby": field?.labelId,
4928
4942
  "aria-describedby": field?.describedBy,
4929
4943
  "aria-invalid": field?.invalid || void 0,
4930
- children: [
4944
+ children: /* @__PURE__ */ jsxs(FieldControlBoundary, { children: [
4931
4945
  /* @__PURE__ */ jsx(
4932
4946
  DatePicker,
4933
4947
  {
@@ -4956,7 +4970,7 @@ var DateRangePicker = ({
4956
4970
  fullWidth: true
4957
4971
  }
4958
4972
  )
4959
- ]
4973
+ ] })
4960
4974
  }
4961
4975
  )
4962
4976
  }
@@ -6028,7 +6042,7 @@ var TimePicker = ({
6028
6042
  children: [
6029
6043
  label && /* @__PURE__ */ jsx("span", { className: "time_picker_label", id: groupId, children: label }),
6030
6044
  constraint && /* @__PURE__ */ jsx("span", { id: constraintId, className: "time_picker_sr_only", children: constraint }),
6031
- /* @__PURE__ */ jsxs(
6045
+ /* @__PURE__ */ jsx(
6032
6046
  "div",
6033
6047
  {
6034
6048
  className: "time_picker_fields",
@@ -6036,7 +6050,7 @@ var TimePicker = ({
6036
6050
  "aria-labelledby": field?.labelId ?? (label ? groupId : void 0),
6037
6051
  "aria-describedby": [field?.describedBy, constraint ? constraintId : void 0].filter(Boolean).join(" ") || void 0,
6038
6052
  "aria-invalid": field?.invalid || void 0,
6039
- children: [
6053
+ children: /* @__PURE__ */ jsxs(FieldControlBoundary, { children: [
6040
6054
  /* @__PURE__ */ jsx(
6041
6055
  Dropdown,
6042
6056
  {
@@ -6063,7 +6077,7 @@ var TimePicker = ({
6063
6077
  disabled: disabled || hour === null
6064
6078
  }
6065
6079
  )
6066
- ]
6080
+ ] })
6067
6081
  }
6068
6082
  )
6069
6083
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigtablet/design-system",
3
- "version": "3.19.3",
3
+ "version": "3.20.0",
4
4
  "description": "Bigtablet Design System UI Components",
5
5
  "type": "module",
6
6
  "types": "dist/index.d.ts",