@dloizides/ui-tables 3.0.0 → 3.0.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/CHANGELOG.md +40 -0
- package/README.md +15 -0
- package/dist/index.js +22 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
|
5
5
|
import { useReducedMotion, FadeIn } from '@dloizides/ui-motion';
|
|
6
6
|
import { Z_INDEX } from '@dloizides/design-tokens';
|
|
7
7
|
import { createPortal } from 'react-dom';
|
|
8
|
-
import { DateRangeControl, Field, controlStyles,
|
|
8
|
+
import { DateRangeControl, DateInput, Field, controlStyles, TypeaheadControl, DEFAULT_TYPEAHEAD_MIN_CHARS, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, SelectControl } from '@dloizides/ui-forms';
|
|
9
9
|
export { DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, isUnmatched, suggestOptions } from '@dloizides/ui-forms';
|
|
10
10
|
import { useA11y } from '@dloizides/a11y';
|
|
11
11
|
|
|
@@ -555,7 +555,8 @@ function DataTableRow({
|
|
|
555
555
|
...selectable ? { "aria-selected": isSelected } : null,
|
|
556
556
|
// A navigable table is a real grid, so its rows are grid rows — selectable or not.
|
|
557
557
|
// `role` wins over `accessibilityRole` on RNW.
|
|
558
|
-
...keyboardNavigation ? { role: "row" } : null
|
|
558
|
+
...keyboardNavigation ? { role: "row" } : null,
|
|
559
|
+
...!keyboardNavigation && onRowPress ? { role: "group" } : null
|
|
559
560
|
};
|
|
560
561
|
const rowNode = /* @__PURE__ */ jsx(
|
|
561
562
|
TableRow,
|
|
@@ -1665,21 +1666,6 @@ function SelectField({ field, barTestID, value, onChange, placeholder, dropdownH
|
|
|
1665
1666
|
}
|
|
1666
1667
|
);
|
|
1667
1668
|
}
|
|
1668
|
-
var NO_HINT = "";
|
|
1669
|
-
function SingleDateField({ field, barTestID, value, onChange, onSubmit, containerStyle }) {
|
|
1670
|
-
const testID = field.testID ?? fieldTestID(barTestID, field.key);
|
|
1671
|
-
return /* @__PURE__ */ jsx(View, { style: containerStyle, testID, children: /* @__PURE__ */ jsx(
|
|
1672
|
-
DateField,
|
|
1673
|
-
{
|
|
1674
|
-
accessibilityHint: field.accessibilityHint ?? NO_HINT,
|
|
1675
|
-
label: field.label,
|
|
1676
|
-
testID: `${testID}-input`,
|
|
1677
|
-
value,
|
|
1678
|
-
onChange,
|
|
1679
|
-
onSubmit
|
|
1680
|
-
}
|
|
1681
|
-
) });
|
|
1682
|
-
}
|
|
1683
1669
|
function TextField({ field, barTestID, value, onChange, onSubmit }) {
|
|
1684
1670
|
const { theme } = useUi();
|
|
1685
1671
|
const { colors } = theme;
|
|
@@ -1731,6 +1717,7 @@ function clampedMinWidth(minWidth) {
|
|
|
1731
1717
|
}
|
|
1732
1718
|
var EMPTY_RANGE = { from: "", to: "" };
|
|
1733
1719
|
var GROW_FLEX = 1;
|
|
1720
|
+
var NO_HINT = "";
|
|
1734
1721
|
function asString(value) {
|
|
1735
1722
|
return typeof value === "string" ? value : "";
|
|
1736
1723
|
}
|
|
@@ -1752,21 +1739,26 @@ function FilterFieldView({ field, barTestID, values, setField, onSubmit, strings
|
|
|
1752
1739
|
return /* @__PURE__ */ jsx(BooleanField, { field, barTestID, value: asBool(raw), onChange: (v) => setField(field.key, v) });
|
|
1753
1740
|
}
|
|
1754
1741
|
const containerStyle = fieldContainerStyle(field);
|
|
1755
|
-
|
|
1756
|
-
return /* @__PURE__ */ jsx(
|
|
1757
|
-
SingleDateField,
|
|
1758
|
-
{
|
|
1759
|
-
barTestID,
|
|
1760
|
-
containerStyle,
|
|
1761
|
-
field,
|
|
1762
|
-
value: asString(raw),
|
|
1763
|
-
onChange: (v) => setField(field.key, v),
|
|
1764
|
-
onSubmit
|
|
1765
|
-
}
|
|
1766
|
-
);
|
|
1767
|
-
}
|
|
1742
|
+
const testID = field.testID ?? fieldTestID(barTestID, field.key);
|
|
1768
1743
|
const body = (() => {
|
|
1769
1744
|
switch (field.kind) {
|
|
1745
|
+
case "date":
|
|
1746
|
+
return function renderDateInput(context) {
|
|
1747
|
+
return /* @__PURE__ */ jsx(
|
|
1748
|
+
DateInput,
|
|
1749
|
+
{
|
|
1750
|
+
context,
|
|
1751
|
+
fieldProps: {
|
|
1752
|
+
accessibilityHint: field.accessibilityHint ?? NO_HINT,
|
|
1753
|
+
label: field.label,
|
|
1754
|
+
testID: `${testID}-input`,
|
|
1755
|
+
value: asString(raw),
|
|
1756
|
+
onChange: (v) => setField(field.key, v),
|
|
1757
|
+
onSubmit
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
);
|
|
1761
|
+
};
|
|
1770
1762
|
case "select":
|
|
1771
1763
|
if (renderSelect !== void 0) {
|
|
1772
1764
|
return renderSelect({
|
|
@@ -1832,7 +1824,7 @@ function FilterFieldView({ field, barTestID, values, setField, onSubmit, strings
|
|
|
1832
1824
|
containerStyle,
|
|
1833
1825
|
label: field.label,
|
|
1834
1826
|
labelVariant: "control",
|
|
1835
|
-
testID
|
|
1827
|
+
testID,
|
|
1836
1828
|
children: body
|
|
1837
1829
|
}
|
|
1838
1830
|
);
|