@flipdish/ui-library 0.68.0 → 0.70.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.
- package/README.md +2 -2
- package/dist/components/atoms/Buttons/Button/hooks/useLoadingLinkPress.d.ts +1 -1
- package/dist/components/atoms/LiveStatus/index.cjs +18 -0
- package/dist/components/atoms/LiveStatus/index.cjs.map +1 -0
- package/dist/components/atoms/LiveStatus/index.d.ts +17 -0
- package/dist/components/atoms/LiveStatus/index.d.ts.map +1 -0
- package/dist/components/atoms/LiveStatus/index.js +16 -0
- package/dist/components/atoms/LiveStatus/index.js.map +1 -0
- package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.cjs +10 -4
- package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.cjs.map +1 -1
- package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.d.ts +3 -3
- package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.d.ts.map +1 -1
- package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.js +11 -5
- package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.js.map +1 -1
- package/dist/components/atoms/PhoneInput/utilities/phoneEntry.utils.cjs +13 -0
- package/dist/components/atoms/PhoneInput/utilities/phoneEntry.utils.cjs.map +1 -1
- package/dist/components/atoms/PhoneInput/utilities/phoneEntry.utils.d.ts +9 -0
- package/dist/components/atoms/PhoneInput/utilities/phoneEntry.utils.d.ts.map +1 -1
- package/dist/components/atoms/PhoneInput/utilities/phoneEntry.utils.js +14 -2
- package/dist/components/atoms/PhoneInput/utilities/phoneEntry.utils.js.map +1 -1
- package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.cjs +51 -16
- package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.cjs.map +1 -1
- package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.d.ts +19 -6
- package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.d.ts.map +1 -1
- package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.js +51 -17
- package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.js.map +1 -1
- package/dist/components/forms/Form/index.cjs +5 -3
- package/dist/components/forms/Form/index.cjs.map +1 -1
- package/dist/components/forms/Form/index.d.ts +8 -2
- package/dist/components/forms/Form/index.d.ts.map +1 -1
- package/dist/components/forms/Form/index.js +5 -3
- package/dist/components/forms/Form/index.js.map +1 -1
- package/dist/components/molecules/Dropdown/index.d.ts +2 -2
- package/dist/components/molecules/Tags/TagGroup/TagGroup.d.ts +1 -1
- package/dist/components/molecules/Tags/TagGroup/TagGroup.d.ts.map +1 -1
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.cjs +2 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.cjs.map +1 -1
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.d.ts +10 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.d.ts.map +1 -1
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.js +2 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.js.map +1 -1
- package/dist/components/organisms/Table/Table.styles.cjs +29 -0
- package/dist/components/organisms/Table/Table.styles.cjs.map +1 -0
- package/dist/components/organisms/Table/Table.styles.d.ts +16 -0
- package/dist/components/organisms/Table/Table.styles.d.ts.map +1 -0
- package/dist/components/organisms/Table/Table.styles.js +27 -0
- package/dist/components/organisms/Table/Table.styles.js.map +1 -0
- package/dist/components/organisms/Table/components/TableCardRow.cjs +2 -1
- package/dist/components/organisms/Table/components/TableCardRow.cjs.map +1 -1
- package/dist/components/organisms/Table/components/TableCardRow.d.ts.map +1 -1
- package/dist/components/organisms/Table/components/TableCardRow.js +2 -1
- package/dist/components/organisms/Table/components/TableCardRow.js.map +1 -1
- package/dist/components/organisms/Table/components/TableCardsSelectAll.cjs +2 -2
- package/dist/components/organisms/Table/components/TableCardsSelectAll.cjs.map +1 -1
- package/dist/components/organisms/Table/components/TableCardsSelectAll.d.ts +3 -1
- package/dist/components/organisms/Table/components/TableCardsSelectAll.d.ts.map +1 -1
- package/dist/components/organisms/Table/components/TableCardsSelectAll.js +2 -2
- package/dist/components/organisms/Table/components/TableCardsSelectAll.js.map +1 -1
- package/dist/components/organisms/Table/components/TableRowCard.cjs +3 -2
- package/dist/components/organisms/Table/components/TableRowCard.cjs.map +1 -1
- package/dist/components/organisms/Table/components/TableRowCard.d.ts +1 -1
- package/dist/components/organisms/Table/components/TableRowCard.d.ts.map +1 -1
- package/dist/components/organisms/Table/components/TableRowCard.js +3 -2
- package/dist/components/organisms/Table/components/TableRowCard.js.map +1 -1
- package/dist/components/organisms/Table/components/TableSortMenu.cjs +4 -4
- package/dist/components/organisms/Table/components/TableSortMenu.cjs.map +1 -1
- package/dist/components/organisms/Table/components/TableSortMenu.d.ts +5 -5
- package/dist/components/organisms/Table/components/TableSortMenu.d.ts.map +1 -1
- package/dist/components/organisms/Table/components/TableSortMenu.js +4 -4
- package/dist/components/organisms/Table/components/TableSortMenu.js.map +1 -1
- package/dist/components/organisms/Table/hooks/useBusyCount.cjs +22 -0
- package/dist/components/organisms/Table/hooks/useBusyCount.cjs.map +1 -0
- package/dist/components/organisms/Table/hooks/useBusyCount.d.ts +12 -0
- package/dist/components/organisms/Table/hooks/useBusyCount.d.ts.map +1 -0
- package/dist/components/organisms/Table/hooks/useBusyCount.js +20 -0
- package/dist/components/organisms/Table/hooks/useBusyCount.js.map +1 -0
- package/dist/components/organisms/Table/hooks/useIsPlaceholderPage.cjs +42 -0
- package/dist/components/organisms/Table/hooks/useIsPlaceholderPage.cjs.map +1 -0
- package/dist/components/organisms/Table/hooks/useIsPlaceholderPage.d.ts +14 -0
- package/dist/components/organisms/Table/hooks/useIsPlaceholderPage.d.ts.map +1 -0
- package/dist/components/organisms/Table/hooks/useIsPlaceholderPage.js +40 -0
- package/dist/components/organisms/Table/hooks/useIsPlaceholderPage.js.map +1 -0
- package/dist/components/organisms/Table/hooks/usePlaceholderRows.cjs +8 -11
- package/dist/components/organisms/Table/hooks/usePlaceholderRows.cjs.map +1 -1
- package/dist/components/organisms/Table/hooks/usePlaceholderRows.d.ts +9 -2
- package/dist/components/organisms/Table/hooks/usePlaceholderRows.d.ts.map +1 -1
- package/dist/components/organisms/Table/hooks/usePlaceholderRows.js +9 -12
- package/dist/components/organisms/Table/hooks/usePlaceholderRows.js.map +1 -1
- package/dist/components/organisms/Table/hooks/useTableSelection.cjs +12 -4
- package/dist/components/organisms/Table/hooks/useTableSelection.cjs.map +1 -1
- package/dist/components/organisms/Table/hooks/useTableSelection.d.ts +4 -2
- package/dist/components/organisms/Table/hooks/useTableSelection.d.ts.map +1 -1
- package/dist/components/organisms/Table/hooks/useTableSelection.js +12 -4
- package/dist/components/organisms/Table/hooks/useTableSelection.js.map +1 -1
- package/dist/components/organisms/Table/index.cjs +65 -24
- package/dist/components/organisms/Table/index.cjs.map +1 -1
- package/dist/components/organisms/Table/index.d.ts +17 -3
- package/dist/components/organisms/Table/index.d.ts.map +1 -1
- package/dist/components/organisms/Table/index.js +67 -26
- package/dist/components/organisms/Table/index.js.map +1 -1
- package/dist/components/organisms/Table/providers/Table.context.cjs.map +1 -1
- package/dist/components/organisms/Table/providers/Table.context.d.ts +11 -2
- package/dist/components/organisms/Table/providers/Table.context.d.ts.map +1 -1
- package/dist/components/organisms/Table/providers/Table.context.js.map +1 -1
- package/dist/components/organisms/Table/table.types.d.ts +9 -1
- package/dist/components/organisms/Table/table.types.d.ts.map +1 -1
- package/dist/components/organisms/Table/utilities/tableCard.utils.cjs.map +1 -1
- package/dist/components/organisms/Table/utilities/tableCard.utils.d.ts +1 -1
- package/dist/components/organisms/Table/utilities/tableCard.utils.d.ts.map +1 -1
- package/dist/components/organisms/Table/utilities/tableCard.utils.js.map +1 -1
- package/dist/components/organisms/Table/utilities/tableChildren.utils.cjs +7 -4
- package/dist/components/organisms/Table/utilities/tableChildren.utils.cjs.map +1 -1
- package/dist/components/organisms/Table/utilities/tableChildren.utils.d.ts +4 -2
- package/dist/components/organisms/Table/utilities/tableChildren.utils.d.ts.map +1 -1
- package/dist/components/organisms/Table/utilities/tableChildren.utils.js +7 -4
- package/dist/components/organisms/Table/utilities/tableChildren.utils.js.map +1 -1
- package/dist/components/organisms/Table/utilities/tableIterable.utils.cjs +23 -0
- package/dist/components/organisms/Table/utilities/tableIterable.utils.cjs.map +1 -0
- package/dist/components/organisms/Table/utilities/tableIterable.utils.d.ts +8 -0
- package/dist/components/organisms/Table/utilities/tableIterable.utils.d.ts.map +1 -0
- package/dist/components/organisms/Table/utilities/tableIterable.utils.js +21 -0
- package/dist/components/organisms/Table/utilities/tableIterable.utils.js.map +1 -0
- package/dist/components/organisms/Table/utilities/tableLoading.utils.cjs +57 -0
- package/dist/components/organisms/Table/utilities/tableLoading.utils.cjs.map +1 -0
- package/dist/components/organisms/Table/utilities/tableLoading.utils.d.ts +66 -0
- package/dist/components/organisms/Table/utilities/tableLoading.utils.d.ts.map +1 -0
- package/dist/components/organisms/Table/utilities/tableLoading.utils.js +52 -0
- package/dist/components/organisms/Table/utilities/tableLoading.utils.js.map +1 -0
- package/dist/components/organisms/Table/utilities/tableSelection.utils.cjs +21 -21
- package/dist/components/organisms/Table/utilities/tableSelection.utils.cjs.map +1 -1
- package/dist/components/organisms/Table/utilities/tableSelection.utils.d.ts +29 -19
- package/dist/components/organisms/Table/utilities/tableSelection.utils.d.ts.map +1 -1
- package/dist/components/organisms/Table/utilities/tableSelection.utils.js +20 -21
- package/dist/components/organisms/Table/utilities/tableSelection.utils.js.map +1 -1
- package/dist/components/organisms/Table/utilities/tableSort.utils.cjs +1 -1
- package/dist/components/organisms/Table/utilities/tableSort.utils.d.ts +1 -1
- package/dist/components/organisms/Table/utilities/tableSort.utils.js +1 -1
- package/dist/hooks/__internal__/useReturnFocus/useReturnFocus.cjs +2 -2
- package/dist/hooks/__internal__/useReturnFocus/useReturnFocus.d.ts +2 -2
- package/dist/hooks/__internal__/useReturnFocus/useReturnFocus.js +2 -2
- package/dist/hooks/useFocusAfterRetry/index.cjs +21 -19
- package/dist/hooks/useFocusAfterRetry/index.cjs.map +1 -1
- package/dist/hooks/useFocusAfterRetry/index.d.ts +15 -5
- package/dist/hooks/useFocusAfterRetry/index.d.ts.map +1 -1
- package/dist/hooks/useFocusAfterRetry/index.js +21 -19
- package/dist/hooks/useFocusAfterRetry/index.js.map +1 -1
- package/dist/hooks/useFocusHandOff/index.cjs +67 -0
- package/dist/hooks/useFocusHandOff/index.cjs.map +1 -0
- package/dist/hooks/useFocusHandOff/index.d.ts +17 -0
- package/dist/hooks/useFocusHandOff/index.d.ts.map +1 -0
- package/dist/hooks/useFocusHandOff/index.js +65 -0
- package/dist/hooks/useFocusHandOff/index.js.map +1 -0
- package/dist/native/components/atoms/LiveStatus/index.d.ts +12 -0
- package/dist/native/hooks/useFocusHandOff/index.d.ts +12 -0
- package/dist/styles.css +12 -0
- package/dist/utilities/__internal__/focusUtils/focusFromCode.utils.cjs +56 -0
- package/dist/utilities/__internal__/focusUtils/focusFromCode.utils.cjs.map +1 -0
- package/dist/utilities/__internal__/focusUtils/focusFromCode.utils.d.ts +20 -0
- package/dist/utilities/__internal__/focusUtils/focusFromCode.utils.d.ts.map +1 -0
- package/dist/utilities/__internal__/focusUtils/focusFromCode.utils.js +53 -0
- package/dist/utilities/__internal__/focusUtils/focusFromCode.utils.js.map +1 -0
- package/package.json +8 -8
- package/dist/components/organisms/Table/components/TableFocusGuard.cjs +0 -23
- package/dist/components/organisms/Table/components/TableFocusGuard.cjs.map +0 -1
- package/dist/components/organisms/Table/components/TableFocusGuard.d.ts +0 -2
- package/dist/components/organisms/Table/components/TableFocusGuard.d.ts.map +0 -1
- package/dist/components/organisms/Table/components/TableFocusGuard.js +0 -21
- package/dist/components/organisms/Table/components/TableFocusGuard.js.map +0 -1
|
@@ -5,9 +5,11 @@ interface TableCardsSelectAllProps {
|
|
|
5
5
|
selectedKeys: 'all' | Iterable<Key>;
|
|
6
6
|
onSelectionChange: (selection: Selection) => void;
|
|
7
7
|
disabledKeys?: Iterable<Key>;
|
|
8
|
+
/** The table's page is placeholders, as the header's select all reads it, so this one is off at once too. */
|
|
9
|
+
isPlaceholderPage?: boolean;
|
|
8
10
|
disallowEmptySelection?: boolean;
|
|
9
11
|
'data-testid'?: string;
|
|
10
12
|
}
|
|
11
|
-
export declare const TableCardsSelectAll: ({ registry, selectedKeys, onSelectionChange, disabledKeys, disallowEmptySelection, "data-testid": dataTestId, }: TableCardsSelectAllProps) => import("react").JSX.Element;
|
|
13
|
+
export declare const TableCardsSelectAll: ({ registry, selectedKeys, onSelectionChange, disabledKeys, isPlaceholderPage, disallowEmptySelection, "data-testid": dataTestId, }: TableCardsSelectAllProps) => import("react").JSX.Element;
|
|
12
14
|
export {};
|
|
13
15
|
//# sourceMappingURL=TableCardsSelectAll.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCardsSelectAll.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Table/components/TableCardsSelectAll.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAG/E,UAAU,wBAAwB;IAChC,QAAQ,EAAE,qBAAqB,CAAC;IAChC,YAAY,EAAE,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IACpC,iBAAiB,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IAClD,YAAY,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC7B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAGD,eAAO,MAAM,mBAAmB,GAAI,
|
|
1
|
+
{"version":3,"file":"TableCardsSelectAll.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Table/components/TableCardsSelectAll.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAG/E,UAAU,wBAAwB;IAChC,QAAQ,EAAE,qBAAqB,CAAC;IAChC,YAAY,EAAE,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IACpC,iBAAiB,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IAClD,YAAY,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC7B,6GAA6G;IAC7G,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAGD,eAAO,MAAM,mBAAmB,GAAI,oIAQjC,wBAAwB,gCAwB1B,CAAC"}
|
|
@@ -4,10 +4,10 @@ import { useSyncExternalStore } from 'react';
|
|
|
4
4
|
import { selectAllStateOf, selectAllToggleOf } from '../utilities/tableSelection.utils.js';
|
|
5
5
|
|
|
6
6
|
// A card list has no header row, so `Table` draws the header's select-all checkbox above the cards itself.
|
|
7
|
-
const TableCardsSelectAll = ({ registry, selectedKeys, onSelectionChange, disabledKeys, disallowEmptySelection, 'data-testid': dataTestId, }) => {
|
|
7
|
+
const TableCardsSelectAll = ({ registry, selectedKeys, onSelectionChange, disabledKeys, isPlaceholderPage, disallowEmptySelection, 'data-testid': dataTestId, }) => {
|
|
8
8
|
// Re-renders as rows join or leave, which changes what "all" covers.
|
|
9
9
|
useSyncExternalStore(registry.subscribe, registry.getVersion, registry.getVersion);
|
|
10
|
-
const { isSelected, isIndeterminate, isDisabled } = selectAllStateOf(selectedKeys, registry.rowIds.current, disabledKeys);
|
|
10
|
+
const { isSelected, isIndeterminate, isDisabled } = selectAllStateOf(selectedKeys, registry.rowIds.current, disabledKeys, isPlaceholderPage);
|
|
11
11
|
const toggleAll = () => {
|
|
12
12
|
const selection = selectAllToggleOf(isSelected, disallowEmptySelection);
|
|
13
13
|
if (selection)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCardsSelectAll.js","sources":["../../../../../src/components/organisms/Table/components/TableCardsSelectAll.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"TableCardsSelectAll.js","sources":["../../../../../src/components/organisms/Table/components/TableCardsSelectAll.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;AAmBA;MACa,mBAAmB,GAAG,CAAC,EAClC,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,aAAa,EAAE,UAAU,GACA,KAAI;;AAE7B,IAAA,oBAAoB,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC;IAClF,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,GAAG,gBAAgB,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,YAAY,EAAE,iBAAiB,CAAC;IAE5I,MAAM,SAAS,GAAG,MAAK;QACrB,MAAM,SAAS,GAAG,iBAAiB,CAAC,UAAU,EAAE,sBAAsB,CAAC;AACvE,QAAA,IAAI,SAAS;YAAE,iBAAiB,CAAC,SAAS,CAAC;AAC7C,IAAA,CAAC;IAED;;AAEE,IAAAA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,6BAA6B,EAAA,QAAA,EAC1CA,IAAC,QAAQ,EAAA,EACP,IAAI,EAAC,IAAI,EACT,KAAK,EAAC,YAAY,EAClB,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,eAAe,EAChC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,SAAS,EAAA,aAAA,EACN,UAAU,EAAA,CACvB,EAAA,CACE;AAEV;;"}
|
|
@@ -10,6 +10,7 @@ var React = require('react');
|
|
|
10
10
|
var children_utils = require('../../../../utilities/__internal__/childrenUtils/children.utils.cjs');
|
|
11
11
|
var log_utils = require('../../../../utilities/__internal__/logUtils/log.utils.cjs');
|
|
12
12
|
var Table_context = require('../providers/Table.context.cjs');
|
|
13
|
+
var Table_styles = require('../Table.styles.cjs');
|
|
13
14
|
var tableCard_utils = require('../utilities/tableCard.utils.cjs');
|
|
14
15
|
|
|
15
16
|
// The row's own selection checkbox, react-aria's `selection` slot, centred on the title's 20px line.
|
|
@@ -39,8 +40,8 @@ const TableRowCard = ({ children, className, 'data-testid': dataTestId }) => {
|
|
|
39
40
|
return (jsxRuntime.jsx(Table_context.TableRowCardSurfaceContext.Provider, { value: true, children: jsxRuntime.jsxs("div", { "data-testid": dataTestId ?? (row.testId ? testIdUtils.joinTestId(row.testId, 'card') : undefined), className: cx.cx(
|
|
40
41
|
// `flex-1` fills a row of cards to the height of the tallest.
|
|
41
42
|
'flex flex-1 flex-col overflow-hidden rounded-xl border border-secondary bg-primary text-left outline-focus-ring transition-colors duration-100 ease-linear', row.isInteractive ? 'cursor-pointer' : 'cursor-default',
|
|
42
|
-
// Before the states, so a tinted card still shows hover, press and highlight.
|
|
43
|
-
className, row.isHovered && 'bg-primary_hover', row.isPressed && 'bg-secondary_hover',
|
|
43
|
+
// Before the states, so a tinted card still shows hover, press and highlight; the row's tint goes first, so a class wins over it.
|
|
44
|
+
row.color && Table_styles.styles.rowColors[row.color], row.color && Table_styles.styles.cardBorders[row.color], className, row.isHovered && 'bg-primary_hover', row.isPressed && 'bg-secondary_hover',
|
|
44
45
|
// `_alt` is brand-50 in light, like `bg-brand-primary`, and stays a surface in dark, where `bg-brand-primary` is solid brand-500.
|
|
45
46
|
row.isHighlighted && 'border-brand bg-brand-primary_alt', row.isFocusVisible && 'outline-2 outline-offset-2'), children: [row.showsSelection && headerIndex === -1 && (jsxRuntime.jsx("div", { className: "flex px-4 pt-4 last:pb-4", children: jsxRuntime.jsx(TableRowCardSelectionCheckbox, { rowTestId: row.testId, isPlaceholder: row.isPlaceholder }) })), parts.map(renderPart)] }) }));
|
|
46
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableRowCard.cjs","sources":["../../../../../src/components/organisms/Table/components/TableRowCard.tsx"],"sourcesContent":[null],"names":["_jsx","Skeleton","Checkbox","joinTestId","useContext","TableContext","TableRowCardContext","TableRowCardSurfaceContext","useEffect","isProductionBuild","warnOnce","flattenChildren","isValidElement","TableRowCardHeaderCheckboxContext","_jsxs","cx","isSlotShown"],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableRowCard.cjs","sources":["../../../../../src/components/organisms/Table/components/TableRowCard.tsx"],"sourcesContent":[null],"names":["_jsx","Skeleton","Checkbox","joinTestId","useContext","TableContext","TableRowCardContext","TableRowCardSurfaceContext","useEffect","isProductionBuild","warnOnce","flattenChildren","isValidElement","TableRowCardHeaderCheckboxContext","_jsxs","cx","styles","isSlotShown"],"mappings":";;;;;;;;;;;;;;;AAcA;AACA,MAAM,6BAA6B,GAAG,CAAC,EAAE,SAAS,EAAE,aAAa,EAAmD,MAClHA,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,gCAAgC,YAC5C,aAAa;;AAEZ,IAAAA,cAAA,CAACC,iBAAQ,EAAA,EAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAC,IAAI,GAAG;;AAG/C,IAAAD,cAAA,CAACE,mBAAQ,EAAA,EAAC,IAAI,EAAC,WAAW,EAAC,IAAI,EAAC,IAAI,EAAC,SAAS,EAAC,UAAU,iBAAc,SAAS,GAAGC,sBAAU,CAAC,SAAS,EAAE,WAAW,CAAC,GAAG,SAAS,EAAA,CAAI,CACtI,EAAA,CACG,CACP;AAWD;AACO,MAAM,YAAY,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAA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AAEA,cAAA,CAACC,iBAAQ,IAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAC,IAAI,GAAG,EAAE,GAAG,EAAED,cAAA,CAACC,iBAAQ,EAAA,EAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAC,IAAI,EAAA,CAAG,EAAA,CAAI,IACpI,CACJ,EAAA,CACY;AAEjB,oBAAoB,CAAC,WAAW,GAAG,sBAAsB;AAEzD;;;;AAIG;MACU,gBAAgB,GAAG,CAAC,OAAqB,KAAK,OAAO,CAAC,IAAI,KAAK,YAAY,IAAI,OAAO,CAAC,IAAI,KAAK;;;;;;;"}
|
|
@@ -2,7 +2,7 @@ import { type ReactElement, type ReactNode } from 'react';
|
|
|
2
2
|
export interface TableRowCardProps {
|
|
3
3
|
/** The card's parts: `Table.RowCard.Header`, `Table.RowCard.Content` and `Table.RowCard.Footer`, in that order. */
|
|
4
4
|
children: ReactNode;
|
|
5
|
-
/** Classes for the card's surface. A row's own `className` never reaches its card, so a tinted row
|
|
5
|
+
/** Classes for the card's surface. A row's own `className` never reaches its card; its `color` does, so a tinted row needs nothing here. */
|
|
6
6
|
className?: string;
|
|
7
7
|
/** Overrides the derived `data-testid` (defaults to `<row>--card`). */
|
|
8
8
|
'data-testid'?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableRowCard.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Table/components/TableRowCard.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAkB,KAAK,YAAY,EAAE,KAAK,SAAS,EAAyB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TableRowCard.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Table/components/TableRowCard.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAkB,KAAK,YAAY,EAAE,KAAK,SAAS,EAAyB,MAAM,OAAO,CAAC;AAoBjG,MAAM,WAAW,iB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gBAAgB,GAAI,SAAS,YAAY,YAA2E,CAAC"}
|
|
@@ -8,6 +8,7 @@ import { useContext, useEffect, isValidElement } from 'react';
|
|
|
8
8
|
import { flattenChildren } from '../../../../utilities/__internal__/childrenUtils/children.utils.js';
|
|
9
9
|
import { warnOnce } from '../../../../utilities/__internal__/logUtils/log.utils.js';
|
|
10
10
|
import { TableContext, TableRowCardContext, TableRowCardSurfaceContext, TableRowCardHeaderCheckboxContext } from '../providers/Table.context.js';
|
|
11
|
+
import { styles } from '../Table.styles.js';
|
|
11
12
|
import { isSlotShown } from '../utilities/tableCard.utils.js';
|
|
12
13
|
|
|
13
14
|
// The row's own selection checkbox, react-aria's `selection` slot, centred on the title's 20px line.
|
|
@@ -37,8 +38,8 @@ const TableRowCard = ({ children, className, 'data-testid': dataTestId }) => {
|
|
|
37
38
|
return (jsx(TableRowCardSurfaceContext.Provider, { value: true, children: jsxs("div", { "data-testid": dataTestId ?? (row.testId ? joinTestId(row.testId, 'card') : undefined), className: cx(
|
|
38
39
|
// `flex-1` fills a row of cards to the height of the tallest.
|
|
39
40
|
'flex flex-1 flex-col overflow-hidden rounded-xl border border-secondary bg-primary text-left outline-focus-ring transition-colors duration-100 ease-linear', row.isInteractive ? 'cursor-pointer' : 'cursor-default',
|
|
40
|
-
// Before the states, so a tinted card still shows hover, press and highlight.
|
|
41
|
-
className, row.isHovered && 'bg-primary_hover', row.isPressed && 'bg-secondary_hover',
|
|
41
|
+
// Before the states, so a tinted card still shows hover, press and highlight; the row's tint goes first, so a class wins over it.
|
|
42
|
+
row.color && styles.rowColors[row.color], row.color && styles.cardBorders[row.color], className, row.isHovered && 'bg-primary_hover', row.isPressed && 'bg-secondary_hover',
|
|
42
43
|
// `_alt` is brand-50 in light, like `bg-brand-primary`, and stays a surface in dark, where `bg-brand-primary` is solid brand-500.
|
|
43
44
|
row.isHighlighted && 'border-brand bg-brand-primary_alt', row.isFocusVisible && 'outline-2 outline-offset-2'), children: [row.showsSelection && headerIndex === -1 && (jsx("div", { className: "flex px-4 pt-4 last:pb-4", children: jsx(TableRowCardSelectionCheckbox, { rowTestId: row.testId, isPlaceholder: row.isPlaceholder }) })), parts.map(renderPart)] }) }));
|
|
44
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableRowCard.js","sources":["../../../../../src/components/organisms/Table/components/TableRowCard.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs"],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableRowCard.js","sources":["../../../../../src/components/organisms/Table/components/TableRowCard.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;AAcA;AACA,MAAM,6BAA6B,GAAG,CAAC,EAAE,SAAS,EAAE,aAAa,EAAmD,MAClHA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,gCAAgC,YAC5C,aAAa;;AAEZ,IAAAA,GAAA,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAC,IAAI,GAAG;;AAG/C,IAAAA,GAAA,CAAC,QAAQ,EAAA,EAAC,IAAI,EAAC,WAAW,EAAC,IAAI,EAAC,IAAI,EAAC,SAAS,EAAC,UAAU,iBAAc,SAAS,GAAG,UAAU,CAAC,SAAS,EAAE,WAAW,CAAC,GAAG,SAAS,EAAA,CAAI,CACtI,EAAA,CACG,CACP;AAWD;AACO,MAAM,YAAY,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAqB,KAAI;IACpG,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC;AAC3C,IAAA,MAAM,GAAG,GAAG,UAAU,CAAC,mBAAmB,CAAC;;AAE3C,IAAA,MAAM,QAAQ,GAAG,UAAU,CAAC,0BAA0B,CAAC;AACvD,IAAA,MAAM,WAAW,GAAG,MAAM,KAAK,OAAO,IAAI,QAAQ;IAElD,SAAS,CAAC,M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AAC,OAAqB,KAAK,OAAO,CAAC,IAAI,KAAK,YAAY,IAAI,OAAO,CAAC,IAAI,KAAK;;"}
|
|
@@ -11,7 +11,7 @@ var tableCard_utils = require('../utilities/tableCard.utils.cjs');
|
|
|
11
11
|
var tableSort_utils = require('../utilities/tableSort.utils.cjs');
|
|
12
12
|
|
|
13
13
|
const firstKeyOf = (selection) => (selection === 'all' ? undefined : [...selection][0]);
|
|
14
|
-
/** A "Sort by" menu of a table's sortable columns, both directions and "
|
|
14
|
+
/** A "Sort by" menu of a table's sortable columns, both directions and "Reset sort", shown while the table shows cards; icon-only below `md`. */
|
|
15
15
|
const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortChange, mobileLayout = 'cards', desktopLayout = 'table', size = 'md', className, 'data-testid': dataTestId, }) => {
|
|
16
16
|
const rootTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'table-sort-menu', rootName: 'table-sort-menu' });
|
|
17
17
|
// Icon-only on the server and while hydrating too, so the two renders agree; the label comes once the viewport is known.
|
|
@@ -19,7 +19,7 @@ const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortC
|
|
|
19
19
|
const isIconOnly = !isAtLeastMd;
|
|
20
20
|
const sortedColumn = sortDescriptor ? columns.find((column) => column.id === sortDescriptor.column) : undefined;
|
|
21
21
|
const sortName = sortedColumn && sortDescriptor ? `Sort by ${sortedColumn.label}, ${sortDescriptor.direction}` : undefined;
|
|
22
|
-
// The order differs from the one the page rests at, so there is something to
|
|
22
|
+
// The order differs from the one the page rests at, so there is something to reset and the icon marks it.
|
|
23
23
|
const isAwayFromRest = !tableSort_utils.isSameSort(sortDescriptor, defaultSortDescriptor);
|
|
24
24
|
const chooseColumn = (selection) => {
|
|
25
25
|
const column = tableSort_utils.columnOfSortMenuKey(columns, firstKeyOf(selection));
|
|
@@ -31,7 +31,7 @@ const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortC
|
|
|
31
31
|
if (direction === 'ascending' || direction === 'descending')
|
|
32
32
|
onSortChange(tableSort_utils.sortOfDirectionChoice(sortDescriptor, direction));
|
|
33
33
|
};
|
|
34
|
-
const
|
|
34
|
+
const resetSort = () => onSortChange(defaultSortDescriptor);
|
|
35
35
|
const renderColumnItem = (column) => (jsxRuntime.jsx(Dropdown.Dropdown.Item, { id: tableSort_utils.sortMenuColumnKeyOf(column.id), label: column.label }, tableSort_utils.sortMenuColumnKeyOf(column.id)));
|
|
36
36
|
// Read as the table reads it, so the two always agree, on the server and while hydrating too.
|
|
37
37
|
if (tableCard_utils.tableLayoutOf(isAtLeastMd, mobileLayout, desktopLayout) === 'table')
|
|
@@ -40,7 +40,7 @@ const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortC
|
|
|
40
40
|
// A decorative dot while the sort differs from the resting one; the name already states what the sort is.
|
|
41
41
|
isAwayFromRest && "after:absolute after:top-1 after:right-1 after:size-2 after:rounded-full after:bg-brand-solid after:content-['']", className), "aria-label": sortName ?? 'Sort by', "data-testid": testIdUtils.joinTestId(rootTestId, 'trigger') })) : (jsxRuntime.jsxs(Buttons.Button, { color: "secondary", size: size, iconLeading: uiIcons.SwitchVertical01,
|
|
42
42
|
// The label truncates, so the trigger never grows wider than the space it is given.
|
|
43
|
-
className: cx.cx('max-w-full min-w-0 *:data-text:min-w-0 *:data-text:truncate', className), "aria-label": sortName, "data-testid": testIdUtils.joinTestId(rootTestId, 'trigger'), children: ["Sort by", sortedColumn && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [' ', jsxRuntime.jsx("span", { className: "text-tertiary", children: sortedColumn.label })] }))] })), jsxRuntime.jsx(Dropdown.Dropdown.Popover, { children: jsxRuntime.jsxs(Dropdown.Dropdown.Menu, { "aria-label": "Sort by", children: [jsxRuntime.jsx(Dropdown.Dropdown.Section, { "aria-label": "Column", selectionMode: "single", disallowEmptySelection: true, selectedKeys: sortedColumn ? [tableSort_utils.sortMenuColumnKeyOf(sortedColumn.id)] : [], onSelectionChange: chooseColumn, children: columns.map(renderColumnItem) }), jsxRuntime.jsx(Dropdown.Dropdown.Separator, {}), jsxRuntime.jsxs(Dropdown.Dropdown.Section, { "aria-label": "Direction", selectionMode: "single", disallowEmptySelection: true, selectedKeys: sortedColumn && sortDescriptor ? [sortDescriptor.direction] : [], onSelectionChange: chooseDirection, children: [jsxRuntime.jsx(Dropdown.Dropdown.Item, { id: "ascending", label: "Ascending", isDisabled: !sortedColumn }), jsxRuntime.jsx(Dropdown.Dropdown.Item, { id: "descending", label: "Descending", isDisabled: !sortedColumn })] }), isAwayFromRest && jsxRuntime.jsx(Dropdown.Dropdown.Separator, {}), isAwayFromRest && jsxRuntime.jsx(Dropdown.Dropdown.Item, { id: "clear", label: "
|
|
43
|
+
className: cx.cx('max-w-full min-w-0 *:data-text:min-w-0 *:data-text:truncate', className), "aria-label": sortName, "data-testid": testIdUtils.joinTestId(rootTestId, 'trigger'), children: ["Sort by", sortedColumn && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [' ', jsxRuntime.jsx("span", { className: "text-tertiary", children: sortedColumn.label })] }))] })), jsxRuntime.jsx(Dropdown.Dropdown.Popover, { children: jsxRuntime.jsxs(Dropdown.Dropdown.Menu, { "aria-label": "Sort by", children: [jsxRuntime.jsx(Dropdown.Dropdown.Section, { "aria-label": "Column", selectionMode: "single", disallowEmptySelection: true, selectedKeys: sortedColumn ? [tableSort_utils.sortMenuColumnKeyOf(sortedColumn.id)] : [], onSelectionChange: chooseColumn, children: columns.map(renderColumnItem) }), jsxRuntime.jsx(Dropdown.Dropdown.Separator, {}), jsxRuntime.jsxs(Dropdown.Dropdown.Section, { "aria-label": "Direction", selectionMode: "single", disallowEmptySelection: true, selectedKeys: sortedColumn && sortDescriptor ? [sortDescriptor.direction] : [], onSelectionChange: chooseDirection, children: [jsxRuntime.jsx(Dropdown.Dropdown.Item, { id: "ascending", label: "Ascending", isDisabled: !sortedColumn }), jsxRuntime.jsx(Dropdown.Dropdown.Item, { id: "descending", label: "Descending", isDisabled: !sortedColumn })] }), isAwayFromRest && jsxRuntime.jsx(Dropdown.Dropdown.Separator, {}), isAwayFromRest && jsxRuntime.jsx(Dropdown.Dropdown.Item, { id: "clear", label: "Reset sort", onAction: resetSort })] }) })] }));
|
|
44
44
|
};
|
|
45
45
|
TableSortMenu.displayName = 'TableSortMenu';
|
|
46
46
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableSortMenu.cjs","sources":["../../../../../src/components/organisms/Table/components/TableSortMenu.tsx"],"sourcesContent":[null],"names":["useResolvedTestId","useIsAtLeastMd","isSameSort","columnOfSortMenuKey","sortOfColumnChoice","sortOfDirectionChoice","_jsx","Dropdown","sortMenuColumnKeyOf","tableLayoutOf","_jsxs","Button","SwitchVertical01","cx","joinTestId","_Fragment"],"mappings":";;;;;;;;;;;;AAsCA,MAAM,UAAU,GAAG,CAAC,SAAoB,MAAuB,SAAS,KAAK,KAAK,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnH;AACO,MAAM,aAAa,GAAG,CAAC,EAC5B,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,YAAY,GAAG,OAAO,EACtB,aAAa,GAAG,OAAO,EACvB,IAAI,GAAG,IAAI,EACX,SAAS,EACT,aAAa,EAAE,UAAU,GACN,KAAI;AACvB,IAAA,MAAM,UAAU,GAAGA,6BAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;;AAErH,IAAA,MAAM,WAAW,GAAGC,6BAAc,EAAE;AACpC,IAAA,MAAM,UAAU,GAAG,CAAC,WAAW;IAC/B,MAAM,YAAY,GAAG,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,EAAE,KAAK,cAAc,CAAC,MAAM,CAAC,GAAG,SAAS;IAC/G,MAAM,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AAA,CAAG,EACtBG,eAAA,CAACH,iBAAQ,CAAC,OAAO,EAAA,EAAA,YAAA,EACJ,WAAW,EACtB,aAAa,EAAC,QAAQ,EACtB,sBAAsB,EAAA,IAAA,EACtB,YAAY,EAAE,YAAY,IAAI,cAAc,GAAG,CAAC,cAAc,CAAC,SAAS,CAAC,GAAG,EAAE,EAC9E,iBAAiB,EAAE,eAAe,EAAA,QAAA,EAAA,CAGlCD,eAACC,iBAAQ,CAAC,IAAI,EAAA,EAAC,EAAE,EAAC,WAAW,EAAC,KAAK,EAAC,WAAW,EAAC,UAAU,EAAE,CAAC,YAAY,EAAA,CAAI,EAC7ED,cAAA,CAACC,iBAAQ,CAAC,IAAI,IAAC,EAAE,EAAC,YAAY,EAAC,KAAK,EAAC,YAAY,EAAC,UAAU,EAAE,CAAC,YAAY,GAAI,CAAA,EAAA,CAC9D,EAClB,cAAc,IAAID,cAAA,CAACC,iBAAQ,CAAC,SAAS,EAAA,EAAA,CAAG,
|
|
1
|
+
{"version":3,"file":"TableSortMenu.cjs","sources":["../../../../../src/components/organisms/Table/components/TableSortMenu.tsx"],"sourcesContent":[null],"names":["useResolvedTestId","useIsAtLeastMd","isSameSort","columnOfSortMenuKey","sortOfColumnChoice","sortOfDirectionChoice","_jsx","Dropdown","sortMenuColumnKeyOf","tableLayoutOf","_jsxs","Button","SwitchVertical01","cx","joinTestId","_Fragment"],"mappings":";;;;;;;;;;;;AAsCA,MAAM,UAAU,GAAG,CAAC,SAAoB,MAAuB,SAAS,KAAK,KAAK,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnH;AACO,MAAM,aAAa,GAAG,CAAC,EAC5B,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,YAAY,GAAG,OAAO,EACtB,aAAa,GAAG,OAAO,EACvB,IAAI,GAAG,IAAI,EACX,SAAS,EACT,aAAa,EAAE,UAAU,GACN,KAAI;AACvB,IAAA,MAAM,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
|
9
9
|
/** The table's current sort; unset while nothing is sorted. */
|
|
10
10
|
sortDescriptor?: SortDescriptor;
|
|
11
11
|
/**
|
|
12
|
-
* What "
|
|
13
|
-
* `sortDescriptor` from. While the sort matches it the icon-only trigger has no dot and the menu no "
|
|
14
|
-
* a
|
|
12
|
+
* What "Reset sort" reports, the table's own `defaultSortDescriptor`: the page's resting sort, which the page starts its
|
|
13
|
+
* `sortDescriptor` from. While the sort matches it the icon-only trigger has no dot and the menu no "Reset sort". Omitted,
|
|
14
|
+
* a reset reports `undefined`.
|
|
15
15
|
*/
|
|
16
16
|
defaultSortDescriptor?: SortDescriptor;
|
|
17
|
-
/** Called with the sort the user picks, or `defaultSortDescriptor` from "
|
|
17
|
+
/** Called with the sort the user picks, or `defaultSortDescriptor` from "Reset sort"; pass the handler the table's `onSortChange` gets. */
|
|
18
18
|
onSortChange: (descriptor: SortDescriptor | undefined) => void;
|
|
19
19
|
/** The table's `mobileLayout`: the menu renders nothing below `md` while that is the table, which its headers sort. */
|
|
20
20
|
mobileLayout?: TableLayout;
|
|
@@ -27,7 +27,7 @@ export interface TableSortMenuProps {
|
|
|
27
27
|
/** Overrides the root `data-testid` (defaults to `fd-table-sort-menu`); the trigger derives `<root>--trigger` and each item `<root>--item-<key>`. */
|
|
28
28
|
'data-testid'?: string;
|
|
29
29
|
}
|
|
30
|
-
/** A "Sort by" menu of a table's sortable columns, both directions and "
|
|
30
|
+
/** A "Sort by" menu of a table's sortable columns, both directions and "Reset sort", shown while the table shows cards; icon-only below `md`. */
|
|
31
31
|
export declare const TableSortMenu: {
|
|
32
32
|
({ columns, sortDescriptor, defaultSortDescriptor, onSortChange, mobileLayout, desktopLayout, size, className, "data-testid": dataTestId, }: TableSortMenuProps): import("react").JSX.Element | null;
|
|
33
33
|
displayName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableSortMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Table/components/TableSortMenu.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,GAAG,EAAa,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,MAAM,WAAW,kBAAkB;IACjC,6HAA6H;IAC7H,OAAO,EAAE,SAAS;QAAE,EAAE,EAAE,GAAG,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/C,+DAA+D;IAC/D,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,cAAc,CAAC;IACvC,2IAA2I;IAC3I,YAAY,EAAE,CAAC,UAAU,EAAE,cAAc,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/D,uHAAuH;IACvH,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,uHAAuH;IACvH,aAAa,CAAC,EAAE,WAAW,CAAC;IAC5B,2CAA2C;IAC3C,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qJAAqJ;IACrJ,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAID,iJAAiJ;AACjJ,eAAO,MAAM,aAAa;iJAUvB,kBAAkB;;
|
|
1
|
+
{"version":3,"file":"TableSortMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Table/components/TableSortMenu.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,GAAG,EAAa,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,MAAM,WAAW,kBAAkB;IACjC,6HAA6H;IAC7H,OAAO,EAAE,SAAS;QAAE,EAAE,EAAE,GAAG,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/C,+DAA+D;IAC/D,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,cAAc,CAAC;IACvC,2IAA2I;IAC3I,YAAY,EAAE,CAAC,UAAU,EAAE,cAAc,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/D,uHAAuH;IACvH,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,uHAAuH;IACvH,aAAa,CAAC,EAAE,WAAW,CAAC;IAC5B,2CAA2C;IAC3C,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qJAAqJ;IACrJ,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAID,iJAAiJ;AACjJ,eAAO,MAAM,aAAa;iJAUvB,kBAAkB;;CA4FpB,CAAC"}
|
|
@@ -9,7 +9,7 @@ import { tableLayoutOf } from '../utilities/tableCard.utils.js';
|
|
|
9
9
|
import { isSameSort, sortMenuColumnKeyOf, columnOfSortMenuKey, sortOfColumnChoice, sortOfDirectionChoice } from '../utilities/tableSort.utils.js';
|
|
10
10
|
|
|
11
11
|
const firstKeyOf = (selection) => (selection === 'all' ? undefined : [...selection][0]);
|
|
12
|
-
/** A "Sort by" menu of a table's sortable columns, both directions and "
|
|
12
|
+
/** A "Sort by" menu of a table's sortable columns, both directions and "Reset sort", shown while the table shows cards; icon-only below `md`. */
|
|
13
13
|
const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortChange, mobileLayout = 'cards', desktopLayout = 'table', size = 'md', className, 'data-testid': dataTestId, }) => {
|
|
14
14
|
const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'table-sort-menu', rootName: 'table-sort-menu' });
|
|
15
15
|
// Icon-only on the server and while hydrating too, so the two renders agree; the label comes once the viewport is known.
|
|
@@ -17,7 +17,7 @@ const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortC
|
|
|
17
17
|
const isIconOnly = !isAtLeastMd;
|
|
18
18
|
const sortedColumn = sortDescriptor ? columns.find((column) => column.id === sortDescriptor.column) : undefined;
|
|
19
19
|
const sortName = sortedColumn && sortDescriptor ? `Sort by ${sortedColumn.label}, ${sortDescriptor.direction}` : undefined;
|
|
20
|
-
// The order differs from the one the page rests at, so there is something to
|
|
20
|
+
// The order differs from the one the page rests at, so there is something to reset and the icon marks it.
|
|
21
21
|
const isAwayFromRest = !isSameSort(sortDescriptor, defaultSortDescriptor);
|
|
22
22
|
const chooseColumn = (selection) => {
|
|
23
23
|
const column = columnOfSortMenuKey(columns, firstKeyOf(selection));
|
|
@@ -29,7 +29,7 @@ const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortC
|
|
|
29
29
|
if (direction === 'ascending' || direction === 'descending')
|
|
30
30
|
onSortChange(sortOfDirectionChoice(sortDescriptor, direction));
|
|
31
31
|
};
|
|
32
|
-
const
|
|
32
|
+
const resetSort = () => onSortChange(defaultSortDescriptor);
|
|
33
33
|
const renderColumnItem = (column) => (jsx(Dropdown.Item, { id: sortMenuColumnKeyOf(column.id), label: column.label }, sortMenuColumnKeyOf(column.id)));
|
|
34
34
|
// Read as the table reads it, so the two always agree, on the server and while hydrating too.
|
|
35
35
|
if (tableLayoutOf(isAtLeastMd, mobileLayout, desktopLayout) === 'table')
|
|
@@ -38,7 +38,7 @@ const TableSortMenu = ({ columns, sortDescriptor, defaultSortDescriptor, onSortC
|
|
|
38
38
|
// A decorative dot while the sort differs from the resting one; the name already states what the sort is.
|
|
39
39
|
isAwayFromRest && "after:absolute after:top-1 after:right-1 after:size-2 after:rounded-full after:bg-brand-solid after:content-['']", className), "aria-label": sortName ?? 'Sort by', "data-testid": joinTestId(rootTestId, 'trigger') })) : (jsxs(Button, { color: "secondary", size: size, iconLeading: SwitchVertical01,
|
|
40
40
|
// The label truncates, so the trigger never grows wider than the space it is given.
|
|
41
|
-
className: cx('max-w-full min-w-0 *:data-text:min-w-0 *:data-text:truncate', className), "aria-label": sortName, "data-testid": joinTestId(rootTestId, 'trigger'), children: ["Sort by", sortedColumn && (jsxs(Fragment, { children: [' ', jsx("span", { className: "text-tertiary", children: sortedColumn.label })] }))] })), jsx(Dropdown.Popover, { children: jsxs(Dropdown.Menu, { "aria-label": "Sort by", children: [jsx(Dropdown.Section, { "aria-label": "Column", selectionMode: "single", disallowEmptySelection: true, selectedKeys: sortedColumn ? [sortMenuColumnKeyOf(sortedColumn.id)] : [], onSelectionChange: chooseColumn, children: columns.map(renderColumnItem) }), jsx(Dropdown.Separator, {}), jsxs(Dropdown.Section, { "aria-label": "Direction", selectionMode: "single", disallowEmptySelection: true, selectedKeys: sortedColumn && sortDescriptor ? [sortDescriptor.direction] : [], onSelectionChange: chooseDirection, children: [jsx(Dropdown.Item, { id: "ascending", label: "Ascending", isDisabled: !sortedColumn }), jsx(Dropdown.Item, { id: "descending", label: "Descending", isDisabled: !sortedColumn })] }), isAwayFromRest && jsx(Dropdown.Separator, {}), isAwayFromRest && jsx(Dropdown.Item, { id: "clear", label: "
|
|
41
|
+
className: cx('max-w-full min-w-0 *:data-text:min-w-0 *:data-text:truncate', className), "aria-label": sortName, "data-testid": joinTestId(rootTestId, 'trigger'), children: ["Sort by", sortedColumn && (jsxs(Fragment, { children: [' ', jsx("span", { className: "text-tertiary", children: sortedColumn.label })] }))] })), jsx(Dropdown.Popover, { children: jsxs(Dropdown.Menu, { "aria-label": "Sort by", children: [jsx(Dropdown.Section, { "aria-label": "Column", selectionMode: "single", disallowEmptySelection: true, selectedKeys: sortedColumn ? [sortMenuColumnKeyOf(sortedColumn.id)] : [], onSelectionChange: chooseColumn, children: columns.map(renderColumnItem) }), jsx(Dropdown.Separator, {}), jsxs(Dropdown.Section, { "aria-label": "Direction", selectionMode: "single", disallowEmptySelection: true, selectedKeys: sortedColumn && sortDescriptor ? [sortDescriptor.direction] : [], onSelectionChange: chooseDirection, children: [jsx(Dropdown.Item, { id: "ascending", label: "Ascending", isDisabled: !sortedColumn }), jsx(Dropdown.Item, { id: "descending", label: "Descending", isDisabled: !sortedColumn })] }), isAwayFromRest && jsx(Dropdown.Separator, {}), isAwayFromRest && jsx(Dropdown.Item, { id: "clear", label: "Reset sort", onAction: resetSort })] }) })] }));
|
|
42
42
|
};
|
|
43
43
|
TableSortMenu.displayName = 'TableSortMenu';
|
|
44
44
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableSortMenu.js","sources":["../../../../../src/components/organisms/Table/components/TableSortMenu.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;;AAsCA,MAAM,UAAU,GAAG,CAAC,SAAoB,MAAuB,SAAS,KAAK,KAAK,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnH;AACO,MAAM,aAAa,GAAG,CAAC,EAC5B,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,YAAY,GAAG,OAAO,EACtB,aAAa,GAAG,OAAO,EACvB,IAAI,GAAG,IAAI,EACX,SAAS,EACT,aAAa,EAAE,UAAU,GACN,KAAI;AACvB,IAAA,MAAM,UAAU,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;;AAErH,IAAA,MAAM,WAAW,GAAG,cAAc,EAAE;AACpC,IAAA,MAAM,UAAU,GAAG,CAAC,WAAW;IAC/B,MAAM,YAAY,GAAG,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,EAAE,KAAK,cAAc,CAAC,MAAM,CAAC,GAAG,SAAS;IAC/G,MAAM,QAAQ,GAAG,YAAY,IAAI,cAAc,GAAG,CAAA,QAAA,EAAW,YAAY,CAAC,KAAK,CAAA,EAAA,EAAK,cAAc,CAAC,SAAS,EAAE,GAAG,SAAS;;IAE1H,MAAM,cAAc,GAAG,CAAC,UAAU,CAAC,cAAc,EAAE,q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E,EAC9E,iBAAiB,EAAE,eAAe,EAAA,QAAA,EAAA,CAGlCD,IAAC,QAAQ,CAAC,IAAI,EAAA,EAAC,EAAE,EAAC,WAAW,EAAC,KAAK,EAAC,WAAW,EAAC,UAAU,EAAE,CAAC,YAAY,EAAA,CAAI,EAC7EA,GAAA,CAAC,QAAQ,CAAC,IAAI,IAAC,EAAE,EAAC,YAAY,EAAC,KAAK,EAAC,YAAY,EAAC,UAAU,EAAE,CAAC,YAAY,GAAI,CAAA,EAAA,CAC9D,EAClB,cAAc,IAAIA,GAAA,CAAC,QAAQ,CAAC,SAAS,EAAA,EAAA,CAAG,
|
|
1
|
+
{"version":3,"file":"TableSortMenu.js","sources":["../../../../../src/components/organisms/Table/components/TableSortMenu.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;;AAsCA,MAAM,UAAU,GAAG,CAAC,SAAoB,MAAuB,SAAS,KAAK,KAAK,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnH;AACO,MAAM,aAAa,GAAG,CAAC,EAC5B,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,YAAY,GAAG,OAAO,EACtB,aAAa,GAAG,OAAO,EACvB,IAAI,GAAG,IAAI,EACX,SAAS,EACT,aAAa,EAAE,UAAU,GACN,KAAI;AACvB,IAAA,MAAM,UAAU,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;;AAErH,IAAA,MAAM,WAAW,GAAG,cAAc,EAAE;AACpC,IAAA,MAAM,UAAU,GAAG,CAAC,WAAW;IAC/B,MAAM,YAAY,GAAG,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,EAAE,KAAK,cAAc,CAAC,MAAM,CAAC,GAAG,SAAS;IAC/G,MAAM,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C,QAAQ,CAAC,OAAO,EAAA,EAAA,YAAA,EACJ,WAAW,EACtB,aAAa,EAAC,QAAQ,EACtB,sBAAsB,EAAA,IAAA,EACtB,YAAY,EAAE,YAAY,IAAI,cAAc,GAAG,CAAC,cAAc,CAAC,SAAS,CAAC,GAAG,EAAE,EAC9E,iBAAiB,EAAE,eAAe,EAAA,QAAA,EAAA,CAGlCD,IAAC,QAAQ,CAAC,IAAI,EAAA,EAAC,EAAE,EAAC,WAAW,EAAC,KAAK,EAAC,WAAW,EAAC,UAAU,EAAE,CAAC,YAAY,EAAA,CAAI,EAC7EA,GAAA,CAAC,QAAQ,CAAC,IAAI,IAAC,EAAE,EAAC,YAAY,EAAC,KAAK,EAAC,YAAY,EAAC,UAAU,EAAE,CAAC,YAAY,GAAI,CAAA,EAAA,CAC9D,EAClB,cAAc,IAAIA,GAAA,CAAC,QAAQ,CAAC,SAAS,EAAA,EAAA,CAAG,EAExC,cAAc,IAAIA,IAAC,QAAQ,CAAC,IAAI,EAAA,EAAC,EAAE,EAAC,OAAO,EAAC,KAAK,EAAC,YAAY,EAAC,QAAQ,EAAE,SAAS,GAAI,CAAA,EAAA,CACzE,EAAA,CACC,CAAA,EAAA,CACL;AAEpB;AACA,aAAa,CAAC,WAAW,GAAG,eAAe;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Counts the tables loading inside one `TableCard.Root`, so the card stays busy until the last of them is done, whichever
|
|
7
|
+
* order they finish in.
|
|
8
|
+
*
|
|
9
|
+
* @returns `isBusy`, `true` while any table is registered, and `registerBusy`, which a loading table calls and whose
|
|
10
|
+
* cleanup lets it go.
|
|
11
|
+
*/
|
|
12
|
+
const useBusyCount = () => {
|
|
13
|
+
const [count, setCount] = React.useState(0);
|
|
14
|
+
const registerBusy = React.useCallback(() => {
|
|
15
|
+
setCount((current) => current + 1);
|
|
16
|
+
return () => setCount((current) => current - 1);
|
|
17
|
+
}, []);
|
|
18
|
+
return { isBusy: count > 0, registerBusy };
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.useBusyCount = useBusyCount;
|
|
22
|
+
//# sourceMappingURL=useBusyCount.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBusyCount.cjs","sources":["../../../../../src/components/organisms/Table/hooks/useBusyCount.ts"],"sourcesContent":[null],"names":["useState","useCallback"],"mappings":";;;;AAIA;;;;;;AAMG;AACI,MAAM,YAAY,GAAG,MAAK;IAC/B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAGA,cAAQ,CAAC,CAAC,CAAC;AAErC,IAAA,MAAM,YAAY,GAAGC,iBAAW,CAAC,MAAK;QACpC,QAAQ,CAAC,CAAC,OAAO,KAAK,OAAO,GAAG,CAAC,CAAC;AAClC,QAAA,OAAO,MAAM,QAAQ,CAAC,CAAC,OAAO,KAAK,OAAO,GAAG,CAAC,CAAC;IACjD,CAAC,EAAE,EAAE,CAAC;IAEN,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,YAAY,EAAE;AAC5C;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Counts the tables loading inside one `TableCard.Root`, so the card stays busy until the last of them is done, whichever
|
|
3
|
+
* order they finish in.
|
|
4
|
+
*
|
|
5
|
+
* @returns `isBusy`, `true` while any table is registered, and `registerBusy`, which a loading table calls and whose
|
|
6
|
+
* cleanup lets it go.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useBusyCount: () => {
|
|
9
|
+
isBusy: boolean;
|
|
10
|
+
registerBusy: () => () => void;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useBusyCount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBusyCount.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Table/hooks/useBusyCount.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;;;CASxB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useState, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Counts the tables loading inside one `TableCard.Root`, so the card stays busy until the last of them is done, whichever
|
|
5
|
+
* order they finish in.
|
|
6
|
+
*
|
|
7
|
+
* @returns `isBusy`, `true` while any table is registered, and `registerBusy`, which a loading table calls and whose
|
|
8
|
+
* cleanup lets it go.
|
|
9
|
+
*/
|
|
10
|
+
const useBusyCount = () => {
|
|
11
|
+
const [count, setCount] = useState(0);
|
|
12
|
+
const registerBusy = useCallback(() => {
|
|
13
|
+
setCount((current) => current + 1);
|
|
14
|
+
return () => setCount((current) => current - 1);
|
|
15
|
+
}, []);
|
|
16
|
+
return { isBusy: count > 0, registerBusy };
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { useBusyCount };
|
|
20
|
+
//# sourceMappingURL=useBusyCount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBusyCount.js","sources":["../../../../../src/components/organisms/Table/hooks/useBusyCount.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAIA;;;;;;AAMG;AACI,MAAM,YAAY,GAAG,MAAK;IAC/B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;AAErC,IAAA,MAAM,YAAY,GAAG,WAAW,CAAC,MAAK;QACpC,QAAQ,CAAC,CAAC,OAAO,KAAK,OAAO,GAAG,CAAC,CAAC;AAClC,QAAA,OAAO,MAAM,QAAQ,CAAC,CAAC,OAAO,KAAK,OAAO,GAAG,CAAC,CAAC;IACjD,CAAC,EAAE,EAAE,CAAC;IAEN,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,YAAY,EAAE;AAC5C;;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var tableIterable_utils = require('../utilities/tableIterable.utils.cjs');
|
|
5
|
+
var tableSelection_utils = require('../utilities/tableSelection.utils.cjs');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Reports whether the table's page is placeholders, as `isPlaceholderPage` decides, updating as rows join or leave. Select
|
|
9
|
+
* all reads it in both layouts: on such a page it is off, and a select all from the keyboard is ignored.
|
|
10
|
+
*
|
|
11
|
+
* @param isLoading The table's `isLoading`, which answers on the first render, before any row has registered.
|
|
12
|
+
* @param rows The table's selectable-row registry.
|
|
13
|
+
* @param placeholders The table's placeholder-row registry, from `usePlaceholderRows`.
|
|
14
|
+
* @param disabledKeys Rows the table disables.
|
|
15
|
+
* @returns `true` only for a page of placeholders; `false` before any row registers, and on the server unless loading.
|
|
16
|
+
*/
|
|
17
|
+
const useIsPlaceholderPage = (isLoading, rows, placeholders, disabledKeys) => {
|
|
18
|
+
const { subscribe: subscribeToRows } = rows;
|
|
19
|
+
const { subscribe: subscribeToPlaceholders } = placeholders;
|
|
20
|
+
const subscribe = React.useCallback((listener) => {
|
|
21
|
+
const stopRows = subscribeToRows(listener);
|
|
22
|
+
const stopPlaceholders = subscribeToPlaceholders(listener);
|
|
23
|
+
return () => {
|
|
24
|
+
stopRows();
|
|
25
|
+
stopPlaceholders();
|
|
26
|
+
};
|
|
27
|
+
}, [subscribeToRows, subscribeToPlaceholders]);
|
|
28
|
+
// Read on every snapshot, of which React takes several, so a one-shot iterator is read once and every snapshot agrees.
|
|
29
|
+
const reusableDisabledKeys = tableIterable_utils.reusableIterableOf(disabledKeys);
|
|
30
|
+
// A boolean, so the table re-renders only when the answer flips, not on every row that joins.
|
|
31
|
+
const getSnapshot = () => tableSelection_utils.isPlaceholderPage({
|
|
32
|
+
isLoading,
|
|
33
|
+
rowKeys: rows.rowIds.current,
|
|
34
|
+
placeholderKeys: placeholders.rowIds.current,
|
|
35
|
+
disabledKeys: reusableDisabledKeys,
|
|
36
|
+
});
|
|
37
|
+
const getServerSnapshot = () => isLoading;
|
|
38
|
+
return React.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.useIsPlaceholderPage = useIsPlaceholderPage;
|
|
42
|
+
//# sourceMappingURL=useIsPlaceholderPage.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsPlaceholderPage.cjs","sources":["../../../../../src/components/organisms/Table/hooks/useIsPlaceholderPage.ts"],"sourcesContent":[null],"names":["useCallback","reusableIterableOf","isPlaceholderPage","useSyncExternalStore"],"mappings":";;;;;;AAQA;;;;;;;;;AASG;AACI,MAAM,oBAAoB,GAAG,CAClC,SAAkB,EAClB,IAA2B,EAC3B,YAAmC,EACnC,YAA8B,KAC5B;AACF,IAAA,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,IAAI;AAC3C,IAAA,MAAM,EAAE,SAAS,EAAE,uBAAuB,EAAE,GAAG,YAAY;AAC3D,IAAA,MAAM,SAAS,GAAGA,iBAAW,CAC3B,CAAC,QAAoB,KAAI;AACvB,QAAA,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC;AAC1C,QAAA,MAAM,gBAAgB,GAAG,uBAAuB,CAAC,QAAQ,CAAC;AAC1D,QAAA,OAAO,MAAK;AACV,YAAA,QAAQ,EAAE;AACV,YAAA,gBAAgB,EAAE;AACpB,QAAA,CAAC;AACH,IAAA,CAAC,EACD,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAC3C;;AAED,IAAA,MAAM,oBAAoB,GAAGC,sCAAkB,CAAC,YAAY,CAAC;;AAE7D,IAAA,MAAM,WAAW,GAAG,MAClBC,sCAAiB,CAAC;QAChB,SAAS;AACT,QAAA,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;AAC5B,QAAA,eAAe,EAAE,YAAY,CAAC,MAAM,CAAC,OAAO;AAC5C,QAAA,YAAY,EAAE,oBAAoB;AACnC,KAAA,CAAC;AACJ,IAAA,MAAM,iBAAiB,GAAG,MAAM,SAAS;IAEzC,OAAOC,0BAAoB,CAAC,SAAS,EAAE,WAAW,EAAE,iBAAiB,CAAC;AACxE;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { RowId } from '../table.types';
|
|
2
|
+
import type { SelectableRowRegistry } from './useSelectableRowRegistry';
|
|
3
|
+
/**
|
|
4
|
+
* Reports whether the table's page is placeholders, as `isPlaceholderPage` decides, updating as rows join or leave. Select
|
|
5
|
+
* all reads it in both layouts: on such a page it is off, and a select all from the keyboard is ignored.
|
|
6
|
+
*
|
|
7
|
+
* @param isLoading The table's `isLoading`, which answers on the first render, before any row has registered.
|
|
8
|
+
* @param rows The table's selectable-row registry.
|
|
9
|
+
* @param placeholders The table's placeholder-row registry, from `usePlaceholderRows`.
|
|
10
|
+
* @param disabledKeys Rows the table disables.
|
|
11
|
+
* @returns `true` only for a page of placeholders; `false` before any row registers, and on the server unless loading.
|
|
12
|
+
*/
|
|
13
|
+
export declare const useIsPlaceholderPage: (isLoading: boolean, rows: SelectableRowRegistry, placeholders: SelectableRowRegistry, disabledKeys?: Iterable<RowId>) => boolean;
|
|
14
|
+
//# sourceMappingURL=useIsPlaceholderPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsPlaceholderPage.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Table/hooks/useIsPlaceholderPage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAG5C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,GAC/B,WAAW,OAAO,EAClB,MAAM,qBAAqB,EAC3B,cAAc,qBAAqB,EACnC,eAAe,QAAQ,CAAC,KAAK,CAAC,YA4B/B,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useCallback, useSyncExternalStore } from 'react';
|
|
2
|
+
import { reusableIterableOf } from '../utilities/tableIterable.utils.js';
|
|
3
|
+
import { isPlaceholderPage } from '../utilities/tableSelection.utils.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Reports whether the table's page is placeholders, as `isPlaceholderPage` decides, updating as rows join or leave. Select
|
|
7
|
+
* all reads it in both layouts: on such a page it is off, and a select all from the keyboard is ignored.
|
|
8
|
+
*
|
|
9
|
+
* @param isLoading The table's `isLoading`, which answers on the first render, before any row has registered.
|
|
10
|
+
* @param rows The table's selectable-row registry.
|
|
11
|
+
* @param placeholders The table's placeholder-row registry, from `usePlaceholderRows`.
|
|
12
|
+
* @param disabledKeys Rows the table disables.
|
|
13
|
+
* @returns `true` only for a page of placeholders; `false` before any row registers, and on the server unless loading.
|
|
14
|
+
*/
|
|
15
|
+
const useIsPlaceholderPage = (isLoading, rows, placeholders, disabledKeys) => {
|
|
16
|
+
const { subscribe: subscribeToRows } = rows;
|
|
17
|
+
const { subscribe: subscribeToPlaceholders } = placeholders;
|
|
18
|
+
const subscribe = useCallback((listener) => {
|
|
19
|
+
const stopRows = subscribeToRows(listener);
|
|
20
|
+
const stopPlaceholders = subscribeToPlaceholders(listener);
|
|
21
|
+
return () => {
|
|
22
|
+
stopRows();
|
|
23
|
+
stopPlaceholders();
|
|
24
|
+
};
|
|
25
|
+
}, [subscribeToRows, subscribeToPlaceholders]);
|
|
26
|
+
// Read on every snapshot, of which React takes several, so a one-shot iterator is read once and every snapshot agrees.
|
|
27
|
+
const reusableDisabledKeys = reusableIterableOf(disabledKeys);
|
|
28
|
+
// A boolean, so the table re-renders only when the answer flips, not on every row that joins.
|
|
29
|
+
const getSnapshot = () => isPlaceholderPage({
|
|
30
|
+
isLoading,
|
|
31
|
+
rowKeys: rows.rowIds.current,
|
|
32
|
+
placeholderKeys: placeholders.rowIds.current,
|
|
33
|
+
disabledKeys: reusableDisabledKeys,
|
|
34
|
+
});
|
|
35
|
+
const getServerSnapshot = () => isLoading;
|
|
36
|
+
return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { useIsPlaceholderPage };
|
|
40
|
+
//# sourceMappingURL=useIsPlaceholderPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsPlaceholderPage.js","sources":["../../../../../src/components/organisms/Table/hooks/useIsPlaceholderPage.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAQA;;;;;;;;;AASG;AACI,MAAM,oBAAoB,GAAG,CAClC,SAAkB,EAClB,IAA2B,EAC3B,YAAmC,EACnC,YAA8B,KAC5B;AACF,IAAA,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,IAAI;AAC3C,IAAA,MAAM,EAAE,SAAS,EAAE,uBAAuB,EAAE,GAAG,YAAY;AAC3D,IAAA,MAAM,SAAS,GAAG,WAAW,CAC3B,CAAC,QAAoB,KAAI;AACvB,QAAA,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC;AAC1C,QAAA,MAAM,gBAAgB,GAAG,uBAAuB,CAAC,QAAQ,CAAC;AAC1D,QAAA,OAAO,MAAK;AACV,YAAA,QAAQ,EAAE;AACV,YAAA,gBAAgB,EAAE;AACpB,QAAA,CAAC;AACH,IAAA,CAAC,EACD,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAC3C;;AAED,IAAA,MAAM,oBAAoB,GAAG,kBAAkB,CAAC,YAAY,CAAC;;AAE7D,IAAA,MAAM,WAAW,GAAG,MAClB,iBAAiB,CAAC;QAChB,SAAS;AACT,QAAA,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;AAC5B,QAAA,eAAe,EAAE,YAAY,CAAC,MAAM,CAAC,OAAO;AAC5C,QAAA,YAAY,EAAE,oBAAoB;AACnC,KAAA,CAAC;AACJ,IAAA,MAAM,iBAAiB,GAAG,MAAM,SAAS;IAEzC,OAAO,oBAAoB,CAAC,SAAS,EAAE,WAAW,EAAE,iBAAiB,CAAC;AACxE;;"}
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
+
var useSelectableRowRegistry = require('./useSelectableRowRegistry.cjs');
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Keeps the table's row action off placeholder rows. A placeholder row is disabled, but `disabledBehavior="selection"`
|
|
7
8
|
* leaves a disabled row's action on, so the card list's `onAction` checks this set as well.
|
|
8
9
|
*
|
|
9
10
|
* @param onRowAction The table's `onRowAction`, or `undefined` when it has none.
|
|
10
|
-
* @returns `register`, which a placeholder row calls with its id and whose cleanup drops it
|
|
11
|
-
*
|
|
11
|
+
* @returns `register`, which a placeholder row calls with its id and whose cleanup drops it; `onAction`, the row action to
|
|
12
|
+
* give the card list, which skips a registered placeholder and is `undefined` when the table has no row action; and
|
|
13
|
+
* `registry`, the placeholders' ids with a subscription, for a part that must follow them as they join or leave.
|
|
12
14
|
*/
|
|
13
15
|
const usePlaceholderRows = (onRowAction) => {
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
placeholderIds.current.add(id);
|
|
17
|
-
return () => {
|
|
18
|
-
placeholderIds.current.delete(id);
|
|
19
|
-
};
|
|
20
|
-
}, []);
|
|
16
|
+
// The same id registry selectable rows use, so select all can subscribe to placeholders too.
|
|
17
|
+
const registry = useSelectableRowRegistry.useSelectableRowRegistry();
|
|
21
18
|
const onAction = onRowAction
|
|
22
19
|
? (key) => {
|
|
23
|
-
if (!
|
|
20
|
+
if (!registry.rowIds.current.has(key))
|
|
24
21
|
onRowAction(key);
|
|
25
22
|
}
|
|
26
23
|
: undefined;
|
|
27
|
-
return { register, onAction };
|
|
24
|
+
return { register: registry.register, onAction, registry };
|
|
28
25
|
};
|
|
29
26
|
/**
|
|
30
27
|
* Joins one placeholder row to the table's placeholder set while it carries `Table.RowCard.Skeleton`, in either layout.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePlaceholderRows.cjs","sources":["../../../../../src/components/organisms/Table/hooks/usePlaceholderRows.ts"],"sourcesContent":[null],"names":["
|
|
1
|
+
{"version":3,"file":"usePlaceholderRows.cjs","sources":["../../../../../src/components/organisms/Table/hooks/usePlaceholderRows.ts"],"sourcesContent":[null],"names":["useSelectableRowRegistry","useEffect"],"mappings":";;;;;AAMA;;;;;;;;AAQG;AACI,MAAM,kBAAkB,GAAG,CAAC,WAA+C,KAAI;;AAEpF,IAAA,MAAM,QAAQ,GAAGA,iDAAwB,EAAE;IAE3C,MAAM,QAAQ,GAAG;AACf,UAAE,CAAC,GAAU,KAAI;YACb,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,WAAW,CAAC,GAAG,CAAC;QACzD;UACA,SAAS;IAEb,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE;AAC5D;AAEA;;;;;;;AAOG;AACI,MAAM,yBAAyB,GAAG,CAAC,QAAiD,EAAE,EAAqB,EAAE,aAAsB,KAAI;AAC5I,IAAAC,eAAS,CAAC,OAAO,aAAa,IAAI,EAAE,KAAK,SAAS,GAAG,QAAQ,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,EAAE,aAAa,CAAC,CAAC;AAClH;;;"}
|
|
@@ -4,12 +4,19 @@ import type { RowId } from '../table.types';
|
|
|
4
4
|
* leaves a disabled row's action on, so the card list's `onAction` checks this set as well.
|
|
5
5
|
*
|
|
6
6
|
* @param onRowAction The table's `onRowAction`, or `undefined` when it has none.
|
|
7
|
-
* @returns `register`, which a placeholder row calls with its id and whose cleanup drops it
|
|
8
|
-
*
|
|
7
|
+
* @returns `register`, which a placeholder row calls with its id and whose cleanup drops it; `onAction`, the row action to
|
|
8
|
+
* give the card list, which skips a registered placeholder and is `undefined` when the table has no row action; and
|
|
9
|
+
* `registry`, the placeholders' ids with a subscription, for a part that must follow them as they join or leave.
|
|
9
10
|
*/
|
|
10
11
|
export declare const usePlaceholderRows: (onRowAction: ((key: RowId) => void) | undefined) => {
|
|
11
12
|
register: (id: RowId) => () => void;
|
|
12
13
|
onAction: ((key: RowId) => void) | undefined;
|
|
14
|
+
registry: {
|
|
15
|
+
register: (id: RowId) => () => void;
|
|
16
|
+
rowIds: import("react").RefObject<Set<RowId>>;
|
|
17
|
+
subscribe: (listener: () => void) => () => void;
|
|
18
|
+
getVersion: () => number;
|
|
19
|
+
};
|
|
13
20
|
};
|
|
14
21
|
/**
|
|
15
22
|
* Joins one placeholder row to the table's placeholder set while it carries `Table.RowCard.Skeleton`, in either layout.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePlaceholderRows.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Table/hooks/usePlaceholderRows.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"usePlaceholderRows.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/Table/hooks/usePlaceholderRows.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAG5C;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,GAAI,aAAa,CAAC,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG,SAAS;;qBAKtE,KAAK;;;;;;;CAMhB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,GAAI,UAAU,CAAC,CAAC,EAAE,EAAE,KAAK,KAAK,MAAM,IAAI,CAAC,GAAG,SAAS,EAAE,IAAI,KAAK,GAAG,SAAS,EAAE,eAAe,OAAO,SAEzI,CAAC"}
|