@octaviaflow/core 3.1.0-beta.58 → 3.1.0-beta.59
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/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Switch/Switch.d.ts.map +1 -1
- package/dist/index.cjs +19 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -4
- package/dist/index.js.map +1 -1
- package/dist/utils/a11y.d.ts +8 -0
- package/dist/utils/a11y.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2233,6 +2233,16 @@ function hasRenderableText(node) {
|
|
|
2233
2233
|
}
|
|
2234
2234
|
return false;
|
|
2235
2235
|
}
|
|
2236
|
+
function getRenderableText(node) {
|
|
2237
|
+
if (node === null || node === void 0 || typeof node === "boolean") return "";
|
|
2238
|
+
if (typeof node === "string") return node;
|
|
2239
|
+
if (typeof node === "number") return String(node);
|
|
2240
|
+
if (Array.isArray(node)) return node.map(getRenderableText).join("");
|
|
2241
|
+
if (isValidElement2(node)) {
|
|
2242
|
+
return getRenderableText(node.props.children);
|
|
2243
|
+
}
|
|
2244
|
+
return "";
|
|
2245
|
+
}
|
|
2236
2246
|
function resolveAccessibleName(input) {
|
|
2237
2247
|
if (input.ariaLabelledby) {
|
|
2238
2248
|
return { "aria-labelledby": input.ariaLabelledby };
|
|
@@ -4728,12 +4738,13 @@ function Option({
|
|
|
4728
4738
|
}
|
|
4729
4739
|
);
|
|
4730
4740
|
}
|
|
4741
|
+
var DEFAULT_SELECT_PLACEHOLDER = "Select an option...";
|
|
4731
4742
|
var Select = forwardRef14(function Select2({
|
|
4732
4743
|
options,
|
|
4733
4744
|
value,
|
|
4734
4745
|
defaultValue,
|
|
4735
4746
|
onChange,
|
|
4736
|
-
placeholder =
|
|
4747
|
+
placeholder = DEFAULT_SELECT_PLACEHOLDER,
|
|
4737
4748
|
searchable = false,
|
|
4738
4749
|
label,
|
|
4739
4750
|
error = false,
|
|
@@ -4783,9 +4794,12 @@ var Select = forwardRef14(function Select2({
|
|
|
4783
4794
|
label,
|
|
4784
4795
|
ariaLabel,
|
|
4785
4796
|
ariaLabelledby: ariaLabelledBy,
|
|
4786
|
-
componentName: "Select"
|
|
4797
|
+
componentName: "Select",
|
|
4798
|
+
fallbacks: [
|
|
4799
|
+
placeholder && placeholder !== DEFAULT_SELECT_PLACEHOLDER ? placeholder : void 0
|
|
4800
|
+
]
|
|
4787
4801
|
}),
|
|
4788
|
-
[label, ariaLabel, ariaLabelledBy]
|
|
4802
|
+
[label, ariaLabel, ariaLabelledBy, placeholder]
|
|
4789
4803
|
);
|
|
4790
4804
|
const ariaProps = useMemo4(() => {
|
|
4791
4805
|
const items = filteredOptions.map((o) => ({
|
|
@@ -28963,8 +28977,9 @@ var Switch = forwardRef106(function Switch2({
|
|
|
28963
28977
|
defaultSelected: defaultChecked,
|
|
28964
28978
|
onChange
|
|
28965
28979
|
});
|
|
28980
|
+
const labelText = getRenderableText(label).trim();
|
|
28966
28981
|
const ariaNameProps = resolveAccessibleName({
|
|
28967
|
-
label:
|
|
28982
|
+
label: labelText || void 0,
|
|
28968
28983
|
ariaLabel: props["aria-label"],
|
|
28969
28984
|
ariaLabelledby: props["aria-labelledby"],
|
|
28970
28985
|
componentName: "Switch"
|