@scattered-light/loomiere-base-ui 0.7.0 → 0.7.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.
- package/README.md +2 -2
- package/dist/custom/collection/index.d.ts +7 -1
- package/dist/custom/collection/index.js +35 -17
- package/dist/custom/collection/index.js.map +1 -1
- package/dist/design-system/components/Collection/README.md +1 -1
- package/dist/design-system/components/CollectionToolbar/README.md +7 -2
- package/dist/design-system/components/DataList/preview.html +171 -171
- package/dist/design-system/components/DataTable/preview.html +168 -168
- package/dist/design-system/components/bundle.js +5 -5
- package/dist/design-system/components/styles.css +141 -58
- package/dist/styles/components/Accordion.css +1 -1
- package/dist/styles/components/AlertDialog.css +1 -1
- package/dist/styles/components/Autocomplete.css +1 -1
- package/dist/styles/components/Avatar.css +1 -1
- package/dist/styles/components/Button.css +1 -1
- package/dist/styles/components/Checkbox.css +1 -1
- package/dist/styles/components/CheckboxGroup.css +1 -1
- package/dist/styles/components/Collapsible.css +1 -1
- package/dist/styles/components/Combobox.css +1 -1
- package/dist/styles/components/ContextMenu.css +1 -1
- package/dist/styles/components/Dialog.css +1 -1
- package/dist/styles/components/Drawer.css +1 -1
- package/dist/styles/components/Field.css +1 -1
- package/dist/styles/components/Fieldset.css +1 -1
- package/dist/styles/components/Form.css +1 -1
- package/dist/styles/components/Input.css +1 -1
- package/dist/styles/components/Menu.css +1 -1
- package/dist/styles/components/Menubar.css +1 -1
- package/dist/styles/components/Meter.css +1 -1
- package/dist/styles/components/NavigationMenu.css +1 -1
- package/dist/styles/components/NumberField.css +1 -1
- package/dist/styles/components/OTPField.css +1 -1
- package/dist/styles/components/Popover.css +1 -1
- package/dist/styles/components/PreviewCard.css +1 -1
- package/dist/styles/components/Progress.css +1 -1
- package/dist/styles/components/Radio.css +1 -1
- package/dist/styles/components/ScrollArea.css +1 -1
- package/dist/styles/components/Select.css +1 -1
- package/dist/styles/components/Separator.css +1 -1
- package/dist/styles/components/Slider.css +1 -1
- package/dist/styles/components/Switch.css +1 -1
- package/dist/styles/components/Tabs.css +1 -1
- package/dist/styles/components/Toast.css +1 -1
- package/dist/styles/components/Toggle.css +1 -1
- package/dist/styles/components/ToggleGroup.css +1 -1
- package/dist/styles/components/Toolbar.css +1 -1
- package/dist/styles/components/Tooltip.css +1 -1
- package/dist/styles/custom/Badge.css +1 -1
- package/dist/styles/custom/Collection.css +2 -2
- package/dist/styles/custom/CollectionPagination.css +1 -1
- package/dist/styles/custom/CollectionToolbar.css +87 -4
- package/dist/styles/custom/DataList.css +1 -1
- package/dist/styles/custom/DataTable.css +1 -1
- package/dist/styles/custom/DatePicker.css +1 -1
- package/dist/styles/custom/EditableList.css +1 -1
- package/dist/styles/custom/EmptyState.css +1 -1
- package/dist/styles/custom/ListDetail.css +1 -1
- package/dist/styles/custom/MoneyField.css +1 -1
- package/dist/styles/custom/Splitter.css +1 -1
- package/dist/styles/custom/Table.css +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/styles/reset/accessibility.css +1 -1
- package/dist/styles/reset/reset-accessibility.css +1 -1
- package/dist/styles/reset/reset-tailwind.css +1 -1
- package/dist/styles/reset/reset.css +1 -1
- package/dist/styles/tailwind.css +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -158,9 +158,9 @@ import { EditableList } from '@scattered-light/loomiere-base-ui/custom';
|
|
|
158
158
|
|
|
159
159
|
Columns decide how a value sorts, searches, filters and totals. `rowHeader` names the row. One column may use a tabs filter. Money totals add in minor units. Search is deferred, not debounced.
|
|
160
160
|
|
|
161
|
-
The toolbar keeps the tabs and the search while rows are selected, and swaps the trailing controls for the selection bar, so the bar does not push the search down. A list sorts from the toolbar. A table sorts from its headers. Sort cycles ascending, descending, then back to the system's default.
|
|
161
|
+
The toolbar keeps the tabs and the search while rows are selected, and swaps the trailing controls for the selection bar, so the bar does not push the search down. The search grows to fill the row beside the filters and actions, and wraps to its own line before it gets narrower than `collection.search-min-width`. Its icon and its clear button sit inside the field, and that clear button is the only one: the toolbar has no Clear filters button. When nothing matches, the no-results state in the table or list offers Clear filters. A list sorts from the toolbar. A table sorts from its headers. Sort cycles ascending, descending, then back to the system's default.
|
|
162
162
|
|
|
163
|
-
Keyboard, on a table or a list, when a row can be activated: the row-header buttons are one tab stop. Up and Down move between rows. Home and End go to the first and last row on the page. Space toggles that row's checkbox. Enter activates the row. Escape clears the search when it has text. Arrow keys do nothing while focus is in a field inside a cell. This is a data table, not a grid.
|
|
163
|
+
Keyboard, on a table or a list, when a row can be activated: the row-header buttons are one tab stop. Up and Down move between rows. Home and End go to the first and last row on the page. Space toggles that row's checkbox. Enter activates the row. Escape clears the search when it has text, and so does the clear button inside the field. Arrow keys do nothing while focus is in a field inside a cell. This is a data table, not a grid.
|
|
164
164
|
|
|
165
165
|
State attributes on the view: `data-sorted`, `data-filtered`, `data-selecting`, `data-loading`, `data-grouped`, `data-view` (`table` or `list`), `data-size` (`sm` or `md`).
|
|
166
166
|
|
|
@@ -285,6 +285,7 @@ interface CollectionMessages {
|
|
|
285
285
|
noResults: string;
|
|
286
286
|
noResultsDescription: string;
|
|
287
287
|
clearFilters: string;
|
|
288
|
+
clearSearch: string;
|
|
288
289
|
nothingHere: string;
|
|
289
290
|
previous: string;
|
|
290
291
|
next: string;
|
|
@@ -486,11 +487,16 @@ declare function ToolbarTabs<T>({ collection, column }: {
|
|
|
486
487
|
collection: CollectionApi<T>;
|
|
487
488
|
column: CollectionColumn<T>;
|
|
488
489
|
}): react_jsx_runtime.JSX.Element;
|
|
489
|
-
|
|
490
|
+
/**
|
|
491
|
+
* The icon and the clear button sit inside the field. The clear button is the only clear
|
|
492
|
+
* control and shows only when there is text. Escape clears too.
|
|
493
|
+
*/
|
|
494
|
+
declare function SearchField({ label, visible, value, onChange, clearLabel }: {
|
|
490
495
|
label: string;
|
|
491
496
|
visible?: boolean;
|
|
492
497
|
value: string;
|
|
493
498
|
onChange: (value: string) => void;
|
|
499
|
+
clearLabel?: string;
|
|
494
500
|
}): react_jsx_runtime.JSX.Element;
|
|
495
501
|
declare function FilterControl<T>({ collection, column }: {
|
|
496
502
|
collection: CollectionApi<T>;
|
|
@@ -823,7 +823,8 @@ function CollectionToolbarImpl({ collection, searchLabel, searchLabelVisible, sh
|
|
|
823
823
|
label: searchLabel ?? "Search",
|
|
824
824
|
visible: searchLabelVisible,
|
|
825
825
|
value: collection.search,
|
|
826
|
-
onChange: collection.setSearch
|
|
826
|
+
onChange: collection.setSearch,
|
|
827
|
+
clearLabel: collection.messages.clearSearch
|
|
827
828
|
}
|
|
828
829
|
) : null,
|
|
829
830
|
selecting ? /* @__PURE__ */ jsxs("div", { className: "CollectionSelectionBar", role: "region", "aria-label": "Selection", children: [
|
|
@@ -848,7 +849,6 @@ function CollectionToolbarImpl({ collection, searchLabel, searchLabelVisible, sh
|
|
|
848
849
|
}
|
|
849
850
|
) : null,
|
|
850
851
|
showSort ? /* @__PURE__ */ jsx(SortControl, { collection }) : null,
|
|
851
|
-
collection.isFiltered ? /* @__PURE__ */ jsx(Button, { emphasis: "quiet", onClick: collection.clearFilters, children: "Clear filters" }) : null,
|
|
852
852
|
actions ? /* @__PURE__ */ jsx("div", { className: "CollectionToolbarActions", children: actions }) : null
|
|
853
853
|
] })
|
|
854
854
|
] }),
|
|
@@ -871,26 +871,43 @@ function ToolbarTabs({ collection, column }) {
|
|
|
871
871
|
] }, tabValue || "all");
|
|
872
872
|
}) }) });
|
|
873
873
|
}
|
|
874
|
-
function SearchField({ label, visible, value, onChange }) {
|
|
874
|
+
function SearchField({ label, visible, value, onChange, clearLabel = "Clear search" }) {
|
|
875
875
|
const id = React4.useId();
|
|
876
|
+
const input = React4.useRef(null);
|
|
876
877
|
return /* @__PURE__ */ jsxs("div", { className: "CollectionSearch", children: [
|
|
877
878
|
/* @__PURE__ */ jsx("label", { htmlFor: id, className: visible ? void 0 : "visually-hidden", children: label }),
|
|
878
|
-
/* @__PURE__ */
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
879
|
+
/* @__PURE__ */ jsxs("div", { className: "CollectionSearchField", "data-filled": value ? "" : void 0, children: [
|
|
880
|
+
/* @__PURE__ */ jsx("span", { className: "CollectionSearchIcon material-symbols-outlined", "aria-hidden": "true", children: "search" }),
|
|
881
|
+
/* @__PURE__ */ jsx(
|
|
882
|
+
Input,
|
|
883
|
+
{
|
|
884
|
+
ref: input,
|
|
885
|
+
id,
|
|
886
|
+
type: "search",
|
|
887
|
+
value,
|
|
888
|
+
onChange: (event) => onChange(event.target.value),
|
|
889
|
+
onKeyDown: (event) => {
|
|
890
|
+
if (event.key === "Escape" && value) {
|
|
891
|
+
event.preventDefault();
|
|
892
|
+
onChange("");
|
|
893
|
+
}
|
|
890
894
|
}
|
|
891
895
|
}
|
|
892
|
-
|
|
893
|
-
|
|
896
|
+
),
|
|
897
|
+
value ? /* @__PURE__ */ jsx(
|
|
898
|
+
"button",
|
|
899
|
+
{
|
|
900
|
+
type: "button",
|
|
901
|
+
className: "CollectionSearchClear",
|
|
902
|
+
"aria-label": clearLabel,
|
|
903
|
+
onClick: () => {
|
|
904
|
+
onChange("");
|
|
905
|
+
input.current?.focus();
|
|
906
|
+
},
|
|
907
|
+
children: /* @__PURE__ */ jsx("span", { className: "material-symbols-outlined", "aria-hidden": "true", children: "close" })
|
|
908
|
+
}
|
|
909
|
+
) : null
|
|
910
|
+
] })
|
|
894
911
|
] });
|
|
895
912
|
}
|
|
896
913
|
function FilterControl({ collection, column }) {
|
|
@@ -1160,6 +1177,7 @@ var defaultMessages = {
|
|
|
1160
1177
|
noResults: "No results",
|
|
1161
1178
|
noResultsDescription: "Nothing matches the current search or filters.",
|
|
1162
1179
|
clearFilters: "Clear filters",
|
|
1180
|
+
clearSearch: "Clear search",
|
|
1163
1181
|
nothingHere: "Nothing here yet",
|
|
1164
1182
|
previous: "Previous",
|
|
1165
1183
|
next: "Next",
|