@moneyforward/mfui-components 4.6.0 → 4.8.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/dist/src/DataTable/DataTable.d.ts +1 -1
- package/dist/src/DataTable/DataTable.js +59 -6
- package/dist/src/DataTable/DataTable.types.d.ts +101 -0
- package/dist/src/DataTable/DataTableBody/DataTableBody.d.ts +2 -1
- package/dist/src/DataTable/DataTableBody/DataTableBody.js +72 -8
- package/dist/src/DataTable/DataTableBody/DataTableBody.types.d.ts +81 -1
- package/dist/src/DataTable/DataTableBody/hooks/useVirtualizedRows.d.ts +64 -0
- package/dist/src/DataTable/DataTableBody/hooks/useVirtualizedRows.js +53 -0
- package/dist/src/DataTable/DataTableBody/index.d.ts +1 -1
- package/dist/src/DataTable/DataTableHeader/DataTableHeader.js +13 -2
- package/dist/src/DataTable/DataTableHeaderCell/DataTableHeaderCell.js +5 -2
- package/dist/src/DataTable/DataTableHeaderRow/DataTableHeaderRow.js +35 -16
- package/dist/src/DataTable/DataTableHeaderRow/DataTableHeaderRow.types.d.ts +9 -0
- package/dist/src/DataTable/DataTableProvider.d.ts +45 -3
- package/dist/src/DataTable/DataTableProvider.js +30 -3
- package/dist/src/DataTable/DataTableRow/DataTableRow.js +21 -12
- package/dist/src/DataTable/hooks/useVirtualizedColumns.d.ts +73 -0
- package/dist/src/DataTable/hooks/useVirtualizedColumns.js +109 -0
- package/dist/src/DataTable/index.d.ts +2 -2
- package/dist/src/DataTable/shared/commonStyles.d.ts +11 -0
- package/dist/src/DataTable/shared/commonStyles.js +11 -0
- package/dist/src/DataTable/utils/renderVirtualizedColumns.d.ts +42 -0
- package/dist/src/DataTable/utils/renderVirtualizedColumns.js +40 -0
- package/dist/src/DataTable/utils/resolveColumnWidths.d.ts +28 -0
- package/dist/src/DataTable/utils/resolveColumnWidths.js +41 -0
- package/dist/src/MultipleSelectBox/MultipleSelectBox.d.ts +1 -1
- package/dist/src/MultipleSelectBox/MultipleSelectBox.js +20 -8
- package/dist/src/MultipleSelectBox/MultipleSelectBox.types.d.ts +33 -0
- package/dist/src/MultipleSelectBox/hooks/useOptionKeyboardNavigation.d.ts +1 -0
- package/dist/src/MultipleSelectBox/hooks/useOptionKeyboardNavigation.js +23 -16
- package/dist/src/SelectBox/SelectBox.js +18 -7
- package/dist/src/SelectBox/SelectBox.types.d.ts +33 -0
- package/dist/src/SelectBox/SelectBoxOption.d.ts +5 -1
- package/dist/src/SelectBox/SelectBoxOption.js +3 -4
- package/dist/src/SelectBox/SelectBoxOptionGroup.d.ts +5 -1
- package/dist/src/SelectBox/SelectBoxOptionGroup.js +2 -2
- package/dist/src/SelectBox/hooks/useKeyboardNavigation.d.ts +1 -0
- package/dist/src/SelectBox/hooks/useKeyboardNavigation.js +29 -14
- package/dist/src/Tooltip/Tooltip.d.ts +6 -0
- package/dist/src/Tooltip/Tooltip.js +6 -0
- package/dist/src/shared/OptionLabel/OptionLabel.d.ts +45 -0
- package/dist/src/shared/OptionLabel/OptionLabel.js +9 -0
- package/dist/src/shared/OptionLabel/index.d.ts +1 -0
- package/dist/src/shared/OptionLabel/index.js +1 -0
- package/dist/styled-system/recipes/data-table-body-slot-recipe.d.ts +1 -1
- package/dist/styled-system/recipes/data-table-body-slot-recipe.js +4 -0
- package/dist/styled-system/recipes/data-table-slot-recipe.d.ts +5 -1
- package/dist/styled-system/recipes/data-table-slot-recipe.js +19 -1
- package/dist/styled-system/tokens/index.js +4 -0
- package/dist/styled-system/tokens/tokens.d.ts +1 -1
- package/dist/styles.css +40 -4
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The state of an option passed to the function that renders its label slot.
|
|
4
|
+
*/
|
|
5
|
+
export type OptionLabelSlotState = {
|
|
6
|
+
/**
|
|
7
|
+
* Whether the option is currently selected.
|
|
8
|
+
*/
|
|
9
|
+
isSelected: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The function that renders the label slot of an option, replacing its label text.
|
|
13
|
+
*/
|
|
14
|
+
export type RenderOptionLabelSlot<Option> = (option: Option, state: OptionLabelSlotState) => ReactNode;
|
|
15
|
+
type OptionLabelProps<Option extends {
|
|
16
|
+
label: string;
|
|
17
|
+
}> = {
|
|
18
|
+
/**
|
|
19
|
+
* The option whose label is rendered.
|
|
20
|
+
*/
|
|
21
|
+
option: Option;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the option is currently selected.
|
|
24
|
+
*/
|
|
25
|
+
isSelected: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The function that renders the label slot. The label text is rendered when it is omitted.
|
|
28
|
+
*/
|
|
29
|
+
renderOptionLabelSlot?: RenderOptionLabelSlot<Option>;
|
|
30
|
+
/**
|
|
31
|
+
* The `data-mfui-content` value of the slot wrapper, prefixed with the component name so that the
|
|
32
|
+
* component styles can target it.
|
|
33
|
+
*/
|
|
34
|
+
slotContentName: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Renders the label of an option in an option list, or the label slot that replaces it.
|
|
38
|
+
*
|
|
39
|
+
* The slot is wrapped so that it keeps the default text style and an icon returned by it is not
|
|
40
|
+
* styled as the selected mark of the option (`& > svg`). A `div` because the slot may return block content.
|
|
41
|
+
*/
|
|
42
|
+
export declare const OptionLabel: <Option extends {
|
|
43
|
+
label: string;
|
|
44
|
+
}>({ option, isSelected, renderOptionLabelSlot, slotContentName, }: OptionLabelProps<Option>) => import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Typography } from '../../Typography';
|
|
3
|
+
/**
|
|
4
|
+
* Renders the label of an option in an option list, or the label slot that replaces it.
|
|
5
|
+
*
|
|
6
|
+
* The slot is wrapped so that it keeps the default text style and an icon returned by it is not
|
|
7
|
+
* styled as the selected mark of the option (`& > svg`). A `div` because the slot may return block content.
|
|
8
|
+
*/
|
|
9
|
+
export const OptionLabel = ({ option, isSelected, renderOptionLabelSlot, slotContentName, }) => renderOptionLabelSlot ? (_jsx(Typography, { as: "div", variant: "body", "data-mfui-content": slotContentName, children: renderOptionLabelSlot(option, { isSelected }) })) : (_jsx(Typography, { variant: "body", children: option.label }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './OptionLabel';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './OptionLabel';
|
|
@@ -10,7 +10,7 @@ type DataTableBodySlotRecipeVariantMap = {
|
|
|
10
10
|
[key in keyof DataTableBodySlotRecipeVariant]: Array<DataTableBodySlotRecipeVariant[key]>
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
type DataTableBodySlotRecipeSlot = "root"
|
|
13
|
+
type DataTableBodySlotRecipeSlot = "root" | "spacer"
|
|
14
14
|
|
|
15
15
|
export type DataTableBodySlotRecipeVariantProps = {
|
|
16
16
|
[key in keyof DataTableBodySlotRecipeVariant]?: ConditionalValue<DataTableBodySlotRecipeVariant[key]> | undefined
|
|
@@ -6,6 +6,10 @@ const dataTableBodySlotRecipeSlotNames = [
|
|
|
6
6
|
[
|
|
7
7
|
"root",
|
|
8
8
|
"DataTableBody__root"
|
|
9
|
+
],
|
|
10
|
+
[
|
|
11
|
+
"spacer",
|
|
12
|
+
"DataTableBody__spacer"
|
|
9
13
|
]
|
|
10
14
|
];
|
|
11
15
|
const dataTableBodySlotRecipeSlotFns = /* @__PURE__ */ dataTableBodySlotRecipeSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, dataTableBodySlotRecipeDefaultVariants, getSlotCompoundVariant(dataTableBodySlotRecipeCompoundVariants, slotName))]);
|
|
@@ -4,6 +4,10 @@ import type { DistributiveOmit, Pretty } from '../types/system-types';
|
|
|
4
4
|
|
|
5
5
|
interface DataTableSlotRecipeVariant {
|
|
6
6
|
/**
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
columnVirtualization: boolean
|
|
10
|
+
/**
|
|
7
11
|
* @default "default"
|
|
8
12
|
*/
|
|
9
13
|
layout: "default" | "edge-to-edge"
|
|
@@ -13,7 +17,7 @@ type DataTableSlotRecipeVariantMap = {
|
|
|
13
17
|
[key in keyof DataTableSlotRecipeVariant]: Array<DataTableSlotRecipeVariant[key]>
|
|
14
18
|
}
|
|
15
19
|
|
|
16
|
-
type DataTableSlotRecipeSlot = "wrapper" | "table" | "emptyState"
|
|
20
|
+
type DataTableSlotRecipeSlot = "wrapper" | "table" | "emptyState" | "columnSpacer" | "headerColumnSpacer" | "selectionColumn"
|
|
17
21
|
|
|
18
22
|
export type DataTableSlotRecipeVariantProps = {
|
|
19
23
|
[key in keyof DataTableSlotRecipeVariant]?: ConditionalValue<DataTableSlotRecipeVariant[key]> | undefined
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { compact, getSlotCompoundVariant, memo, splitProps } from '../helpers.js';
|
|
2
2
|
import { createRecipe } from './create-recipe.js';
|
|
3
3
|
const dataTableSlotRecipeDefaultVariants = {
|
|
4
|
-
"layout": "default"
|
|
4
|
+
"layout": "default",
|
|
5
|
+
"columnVirtualization": false
|
|
5
6
|
};
|
|
6
7
|
const dataTableSlotRecipeCompoundVariants = [];
|
|
7
8
|
const dataTableSlotRecipeSlotNames = [
|
|
@@ -16,6 +17,18 @@ const dataTableSlotRecipeSlotNames = [
|
|
|
16
17
|
[
|
|
17
18
|
"emptyState",
|
|
18
19
|
"DataTable__emptyState"
|
|
20
|
+
],
|
|
21
|
+
[
|
|
22
|
+
"columnSpacer",
|
|
23
|
+
"DataTable__columnSpacer"
|
|
24
|
+
],
|
|
25
|
+
[
|
|
26
|
+
"headerColumnSpacer",
|
|
27
|
+
"DataTable__headerColumnSpacer"
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
"selectionColumn",
|
|
31
|
+
"DataTable__selectionColumn"
|
|
19
32
|
]
|
|
20
33
|
];
|
|
21
34
|
const dataTableSlotRecipeSlotFns = /* @__PURE__ */ dataTableSlotRecipeSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, dataTableSlotRecipeDefaultVariants, getSlotCompoundVariant(dataTableSlotRecipeCompoundVariants, slotName))]);
|
|
@@ -23,6 +36,7 @@ const dataTableSlotRecipeFn = memo((props = {}) => {
|
|
|
23
36
|
return Object.fromEntries(dataTableSlotRecipeSlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]));
|
|
24
37
|
});
|
|
25
38
|
const dataTableSlotRecipeVariantKeys = [
|
|
39
|
+
"columnVirtualization",
|
|
26
40
|
"layout"
|
|
27
41
|
];
|
|
28
42
|
const getVariantProps = (variants) => ({ ...dataTableSlotRecipeDefaultVariants, ...compact(variants) });
|
|
@@ -33,6 +47,10 @@ export const dataTableSlotRecipe = /* @__PURE__ */ Object.assign(dataTableSlotRe
|
|
|
33
47
|
classNameMap: {},
|
|
34
48
|
variantKeys: dataTableSlotRecipeVariantKeys,
|
|
35
49
|
variantMap: {
|
|
50
|
+
"columnVirtualization": [
|
|
51
|
+
"true",
|
|
52
|
+
"false"
|
|
53
|
+
],
|
|
36
54
|
"layout": [
|
|
37
55
|
"default",
|
|
38
56
|
"edge-to-edge"
|
|
@@ -5667,6 +5667,10 @@ const tokens = {
|
|
|
5667
5667
|
"value": 1000,
|
|
5668
5668
|
"variable": "var(--mfui-z-index-toast-item)"
|
|
5669
5669
|
},
|
|
5670
|
+
"zIndex.tooltip": {
|
|
5671
|
+
"value": 10000,
|
|
5672
|
+
"variable": "var(--mfui-z-index-tooltip)"
|
|
5673
|
+
},
|
|
5670
5674
|
"breakpoints.sm": {
|
|
5671
5675
|
"value": "600px",
|
|
5672
5676
|
"variable": "var(--mfui-breakpoints-sm)"
|
|
@@ -15,7 +15,7 @@ export type DurationToken = "mfui.core.transition.duration.none" | "mfui.core.tr
|
|
|
15
15
|
|
|
16
16
|
export type EasingToken = "mfui.core.transition.easing.linear" | "mfui.core.transition.easing.ease-in-out" | "mfui.transition.easing.side-pane.in" | "mfui.transition.easing.side-pane.out" | "mfui.transition.easing.split-view.in" | "mfui.transition.easing.split-view.out"
|
|
17
17
|
|
|
18
|
-
export type ZIndexToken = "dialog" | "toast.container" | "toast.item"
|
|
18
|
+
export type ZIndexToken = "dialog" | "toast.container" | "toast.item" | "tooltip"
|
|
19
19
|
|
|
20
20
|
export type BreakpointToken = "sm" | "lg"
|
|
21
21
|
|
package/dist/styles.css
CHANGED
|
@@ -153,6 +153,7 @@
|
|
|
153
153
|
--mfui-z-index-dialog: 5000;
|
|
154
154
|
--mfui-z-index-toast-container: 9999;
|
|
155
155
|
--mfui-z-index-toast-item: 1000;
|
|
156
|
+
--mfui-z-index-tooltip: 10000;
|
|
156
157
|
--mfui-colors-mfui\.color\.base\.content\.none: #262626ff;
|
|
157
158
|
--mfui-colors-mfui\.color\.base\.content\.hovered: #111111ff;
|
|
158
159
|
--mfui-colors-mfui\.color\.base\.content\.pressed: #000000ff;
|
|
@@ -1444,6 +1445,7 @@
|
|
|
1444
1445
|
padding-inline: var(--mfui-spacing-mfui\.size\.padding\.control\.horizontal\.comfort);
|
|
1445
1446
|
border-radius: var(--mfui-radii-mfui\.size\.radius\.indicator-component\.comfort);
|
|
1446
1447
|
position: fixed;
|
|
1448
|
+
z-index: var(--mfui-z-index-tooltip);
|
|
1447
1449
|
background-color: var(--mfui-colors-mfui\.color\.neutral\.background\.none);
|
|
1448
1450
|
color: var(--mfui-colors-mfui\.color\.base\.inverted-content\.none);
|
|
1449
1451
|
box-shadow: var(--mfui-shadows-mfui\.elevation\.plus-1\.shadow-1);
|
|
@@ -1632,6 +1634,11 @@
|
|
|
1632
1634
|
min-width: var(--mfui-sizes-mfui\.size\.dimension\.icon\.square\.comfort);
|
|
1633
1635
|
}
|
|
1634
1636
|
|
|
1637
|
+
.mfui-fmdPwh > [data-mfui-content="select-box-option-label-slot"] {
|
|
1638
|
+
flex-grow: 1;
|
|
1639
|
+
min-width: 0px;
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1635
1642
|
.mfui-fmdPwh[data-mfui-skeleton="true"] > .mfui-Skeleton {
|
|
1636
1643
|
flex-grow: 1;
|
|
1637
1644
|
height: 1.25rem;
|
|
@@ -2977,6 +2984,11 @@
|
|
|
2977
2984
|
top: 50%;
|
|
2978
2985
|
}
|
|
2979
2986
|
|
|
2987
|
+
.mfui-kWseNH {
|
|
2988
|
+
padding: 0;
|
|
2989
|
+
border: 0;
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2980
2992
|
.mfui-dDOVnx {
|
|
2981
2993
|
vertical-align: top;
|
|
2982
2994
|
}
|
|
@@ -3085,6 +3097,23 @@
|
|
|
3085
3097
|
width: 100%;
|
|
3086
3098
|
}
|
|
3087
3099
|
|
|
3100
|
+
.mfui-chNDct {
|
|
3101
|
+
padding: 0;
|
|
3102
|
+
border: 0;
|
|
3103
|
+
}
|
|
3104
|
+
|
|
3105
|
+
.mfui-djixCu {
|
|
3106
|
+
padding: 0;
|
|
3107
|
+
background-color: var(--mfui-colors-mfui\.color\.neutral\.sub-background\.none);
|
|
3108
|
+
border-block-end-style: solid;
|
|
3109
|
+
border-block-end-width: var(--mfui-border-widths-mfui\.size\.border\.base\.width\.comfort);
|
|
3110
|
+
border-block-end-color: var(--mfui-colors-mfui\.color\.neutral\.sub-border\.none);
|
|
3111
|
+
}
|
|
3112
|
+
|
|
3113
|
+
.mfui-cHcPnP {
|
|
3114
|
+
width: calc(var(--mfui-sizes-mfui\.size\.dimension\.icon\.square\.comfort) + var(--mfui-spacing-mfui\.size\.padding\.data-table-cell\.horizontal\.comfort) * 2 + var(--mfui-spacing-mfui\.size\.padding\.container\.horizontal\.comfort));
|
|
3115
|
+
}
|
|
3116
|
+
|
|
3088
3117
|
.mfui-jMpBJi {
|
|
3089
3118
|
border-color: var(--mfui-colors-mfui\.color\.neutral\.sub-border\.none);
|
|
3090
3119
|
background-color: var(--mfui-colors-mfui\.color\.neutral\.sub-background\.none);
|
|
@@ -3748,6 +3777,11 @@
|
|
|
3748
3777
|
min-width: var(--mfui-sizes-mfui\.size\.dimension\.icon\.square\.comfort);
|
|
3749
3778
|
}
|
|
3750
3779
|
|
|
3780
|
+
.mfui-hBoLjB > [data-mfui-content="multiple-select-box-option-label-slot"] {
|
|
3781
|
+
flex-grow: 1;
|
|
3782
|
+
min-width: 0px;
|
|
3783
|
+
}
|
|
3784
|
+
|
|
3751
3785
|
.mfui-hBoLjB[aria-disabled="true"] {
|
|
3752
3786
|
color: var(--mfui-colors-mfui\.color\.disabled\.content);
|
|
3753
3787
|
background-color: var(--mfui-colors-mfui\.color\.base\.background\.none);
|
|
@@ -7793,9 +7827,7 @@ li:last-child > .mfui-cXGJls {
|
|
|
7793
7827
|
}
|
|
7794
7828
|
|
|
7795
7829
|
.mfui-coGcRr {
|
|
7796
|
-
width:
|
|
7797
|
-
min-width: 32px;
|
|
7798
|
-
max-width: 32px;
|
|
7830
|
+
width: calc(var(--mfui-sizes-mfui\.size\.dimension\.icon\.square\.comfort) + var(--mfui-spacing-mfui\.size\.padding\.data-table-cell\.horizontal\.comfort) * 2 + var(--mfui-spacing-mfui\.size\.padding\.container\.horizontal\.comfort));
|
|
7799
7831
|
}
|
|
7800
7832
|
|
|
7801
7833
|
.mfui-jqZsnQ:not(:disabled, [disabled], [data-disabled]):not(:has(input:disabled)) {
|
|
@@ -7926,6 +7958,10 @@ li:last-child > .mfui-cXGJls {
|
|
|
7926
7958
|
border-radius: var(--mfui-radii-mfui\.size\.radius\.control-component\.comfort);
|
|
7927
7959
|
}
|
|
7928
7960
|
|
|
7961
|
+
.mfui-gwKOSv {
|
|
7962
|
+
table-layout: fixed;
|
|
7963
|
+
}
|
|
7964
|
+
|
|
7929
7965
|
.mfui-hUuodk {
|
|
7930
7966
|
border-block-style: solid;
|
|
7931
7967
|
border-block-width: var(--mfui-border-widths-mfui\.size\.border\.base\.width\.comfort);
|
|
@@ -8001,7 +8037,7 @@ li:last-child > .mfui-cXGJls {
|
|
|
8001
8037
|
}
|
|
8002
8038
|
|
|
8003
8039
|
.mfui-hdkeDU {
|
|
8004
|
-
width:
|
|
8040
|
+
width: calc(var(--mfui-sizes-mfui\.size\.dimension\.icon\.square\.comfort) + var(--mfui-spacing-mfui\.size\.padding\.data-table-cell\.horizontal\.comfort) * 2 + var(--mfui-spacing-mfui\.size\.padding\.container\.horizontal\.comfort));
|
|
8005
8041
|
}
|
|
8006
8042
|
|
|
8007
8043
|
.mfui-dQChFX:not(:disabled, [disabled], [data-disabled]) {
|