@ftdata/ui 0.0.16 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/IconButton/index.d.ts +15 -0
- package/dist/components/IconButton/index.js +37 -0
- package/dist/components/IconButton/modifiers/color.d.ts +36 -0
- package/dist/components/IconButton/modifiers/color.js +38 -0
- package/dist/components/IconButton/styles.d.ts +10 -0
- package/dist/components/IconButton/styles.js +32 -0
- package/dist/components/Input/index.d.ts +1 -0
- package/dist/components/Input/index.js +12 -26
- package/dist/components/Input/styles.js +1 -1
- package/dist/components/Modal/index.d.ts +25 -0
- package/dist/components/Modal/index.js +69 -0
- package/dist/components/Modal/styles.d.ts +8 -0
- package/dist/components/Modal/styles.js +81 -0
- package/dist/components/MultiSelect/components/Badge/index.d.ts +2 -1
- package/dist/components/MultiSelect/components/Badge/index.js +5 -2
- package/dist/components/MultiSelect/components/Badge/styles.d.ts +5 -1
- package/dist/components/MultiSelect/components/Badge/styles.js +2 -1
- package/dist/components/MultiSelect/components/MultiSelectList/Row/index.d.ts +3 -2
- package/dist/components/MultiSelect/components/MultiSelectList/Row/index.js +21 -10
- package/dist/components/MultiSelect/components/MultiSelectList/Row/style.js +0 -1
- package/dist/components/MultiSelect/components/MultiSelectList/index.d.ts +3 -3
- package/dist/components/MultiSelect/components/MultiSelectList/index.js +8 -11
- package/dist/components/MultiSelect/components/MultiSelectList/style.d.ts +1 -1
- package/dist/components/MultiSelect/components/MultiSelectList/style.js +21 -3
- package/dist/components/MultiSelect/helpers/addOption.d.ts +3 -3
- package/dist/components/MultiSelect/helpers/computeUnselected.d.ts +1 -1
- package/dist/components/MultiSelect/helpers/computeUnselected.js +1 -1
- package/dist/components/MultiSelect/helpers/feedbackText.d.ts +1 -1
- package/dist/components/MultiSelect/helpers/feedbackText.js +9 -9
- package/dist/components/MultiSelect/helpers/filterOptions.d.ts +1 -1
- package/dist/components/MultiSelect/helpers/removeOptions.d.ts +3 -3
- package/dist/components/MultiSelect/index.d.ts +37 -19
- package/dist/components/MultiSelect/index.js +92 -135
- package/dist/components/MultiSelect/styles.js +8 -23
- package/dist/components/Select/index.d.ts +2 -1
- package/dist/components/Select/index.js +12 -24
- package/dist/components/Select/styles.js +1 -1
- package/dist/components/Texts/paragraphs.d.ts +12 -0
- package/dist/components/Texts/paragraphs.js +14 -0
- package/dist/components/Texts/text.d.ts +17 -0
- package/dist/components/Texts/text.js +21 -0
- package/dist/components/Texts/titles.d.ts +7 -0
- package/dist/components/Texts/titles.js +37 -0
- package/dist/components/fields/components/HelpText/index.js +18 -13
- package/dist/components/fields/components/HelpText/modifiers/colors.js +2 -2
- package/dist/components/fields/components/HelpText/styles.js +5 -0
- package/dist/components/fields/components/Label/index.js +1 -1
- package/dist/components/fields/components/Label/styles.js +11 -4
- package/dist/components/fields/modifiers/selectColorModifier.d.ts +1 -1
- package/dist/components/fields/modifiers/selectColorModifier.js +7 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +4 -2
- package/package.json +2 -2
- package/dist/components/MultiSelect/helpers/arraysEqual.d.ts +0 -2
- package/dist/components/MultiSelect/helpers/arraysEqual.js +0 -5
- package/dist/components/MultiSelect/helpers/computeSelected.d.ts +0 -2
- package/dist/components/MultiSelect/helpers/computeSelected.js +0 -2
- package/dist/components/MultiSelect/helpers/getChangedFieds.d.ts +0 -2
- package/dist/components/MultiSelect/helpers/getChangedFieds.js +0 -17
- package/dist/components/MultiSelect/hooks/useMultiSelect.d.ts +0 -10
- package/dist/components/MultiSelect/hooks/useMultiSelect.js +0 -44
- package/dist/components/MultiSelect/interfaces/actions.d.ts +0 -4
- package/dist/components/MultiSelect/interfaces/actions.js +0 -0
- package/dist/components/MultiSelect/interfaces/config.d.ts +0 -17
- package/dist/components/MultiSelect/interfaces/config.js +0 -0
- package/dist/components/MultiSelect/interfaces/state.d.ts +0 -10
- package/dist/components/MultiSelect/interfaces/state.js +0 -0
- package/dist/components/MultiSelect/reducers/stateReducer.d.ts +0 -21
- package/dist/components/MultiSelect/reducers/stateReducer.js +0 -44
- package/dist/components/Text/Paragraph/Paragraph.stories.d.ts +0 -29
- package/dist/components/Text/Paragraph/Paragraph.stories.js +0 -124
- package/dist/components/Text/Title/Title.stories.d.ts +0 -41
- package/dist/components/Text/Title/Title.stories.js +0 -106
|
@@ -2,6 +2,7 @@ import styled_components from "styled-components";
|
|
|
2
2
|
import { COLOR_ACCENT_MEDIUM, COLOR_DANGER_MEDIUM, COLOR_NEUTRAL_DARK, COLOR_NEUTRAL_DARKER, COLOR_NEUTRAL_DAY, COLOR_NEUTRAL_DUSK, COLOR_NEUTRAL_LIGHTER, COLOR_NEUTRAL_MEDIUM, COLOR_SUCCESS_MEDIUM, FONT_WEIGHT_BOLD, FONT_WEIGHT_MEDIUM } from "@ftdata/f-tokens";
|
|
3
3
|
const SelectContainer = styled_components.div`
|
|
4
4
|
display: flex;
|
|
5
|
+
gap: 0.5rem;
|
|
5
6
|
flex-direction: column;
|
|
6
7
|
`;
|
|
7
8
|
const StyledLabel = styled_components.label`
|
|
@@ -68,7 +69,6 @@ const HelpText = styled_components.div`
|
|
|
68
69
|
color: ${({ isError, isSuccess })=>isError ? COLOR_DANGER_MEDIUM : isSuccess ? COLOR_SUCCESS_MEDIUM : COLOR_NEUTRAL_DARK};
|
|
69
70
|
display: flex;
|
|
70
71
|
gap: 0.25rem;
|
|
71
|
-
margin-top: 0.5rem;
|
|
72
72
|
|
|
73
73
|
span {
|
|
74
74
|
font-size: 0.875rem;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const PARAGRAPH_SIZES: {
|
|
2
|
+
readonly body: "1rem";
|
|
3
|
+
readonly small: "0.875rem";
|
|
4
|
+
readonly caption: "0.75rem";
|
|
5
|
+
};
|
|
6
|
+
type ParagraphSize = keyof typeof PARAGRAPH_SIZES;
|
|
7
|
+
interface ParagraphProps {
|
|
8
|
+
size?: ParagraphSize;
|
|
9
|
+
color?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const Paragraph: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, ParagraphProps>> & string;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import styled_components from "styled-components";
|
|
2
|
+
import { COLOR_NEUTRAL_DUSK } from "@ftdata/f-tokens";
|
|
3
|
+
const PARAGRAPH_SIZES = {
|
|
4
|
+
body: '1rem',
|
|
5
|
+
small: '0.875rem',
|
|
6
|
+
caption: '0.75rem'
|
|
7
|
+
};
|
|
8
|
+
const Paragraph = styled_components.span`
|
|
9
|
+
color: ${({ color })=>color ?? COLOR_NEUTRAL_DUSK};
|
|
10
|
+
line-height: 1.5;
|
|
11
|
+
font-weight: 500;
|
|
12
|
+
font-size: ${({ size = 'body' })=>PARAGRAPH_SIZES[size]};
|
|
13
|
+
`;
|
|
14
|
+
export { Paragraph };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare const FONT_SIZES: {
|
|
2
|
+
readonly xxs: string;
|
|
3
|
+
readonly xs: string;
|
|
4
|
+
readonly sm: string;
|
|
5
|
+
readonly md: string;
|
|
6
|
+
readonly lg: string;
|
|
7
|
+
readonly xl: string;
|
|
8
|
+
readonly xxl: string;
|
|
9
|
+
readonly xxxl: string;
|
|
10
|
+
readonly megadisplay: string;
|
|
11
|
+
};
|
|
12
|
+
type TextSize = keyof typeof FONT_SIZES;
|
|
13
|
+
interface TextProps {
|
|
14
|
+
size?: TextSize;
|
|
15
|
+
}
|
|
16
|
+
export declare const Text: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, TextProps>> & string;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import styled_components from "styled-components";
|
|
2
|
+
import { COLOR_NEUTRAL_DUSK, FONT_RELATIVE_SIZE_LG, FONT_RELATIVE_SIZE_MD, FONT_RELATIVE_SIZE_MEGADISPLAY, FONT_RELATIVE_SIZE_SM, FONT_RELATIVE_SIZE_XL, FONT_RELATIVE_SIZE_XS, FONT_RELATIVE_SIZE_XXL, FONT_RELATIVE_SIZE_XXS, FONT_RELATIVE_SIZE_XXXL } from "@ftdata/f-tokens";
|
|
3
|
+
const FONT_SIZES = {
|
|
4
|
+
xxs: FONT_RELATIVE_SIZE_XXS,
|
|
5
|
+
xs: FONT_RELATIVE_SIZE_XS,
|
|
6
|
+
sm: FONT_RELATIVE_SIZE_SM,
|
|
7
|
+
md: FONT_RELATIVE_SIZE_MD,
|
|
8
|
+
lg: FONT_RELATIVE_SIZE_LG,
|
|
9
|
+
xl: FONT_RELATIVE_SIZE_XL,
|
|
10
|
+
xxl: FONT_RELATIVE_SIZE_XXL,
|
|
11
|
+
xxxl: FONT_RELATIVE_SIZE_XXXL,
|
|
12
|
+
megadisplay: FONT_RELATIVE_SIZE_MEGADISPLAY
|
|
13
|
+
};
|
|
14
|
+
const Text = styled_components.span`
|
|
15
|
+
color: ${({ color })=>color ?? COLOR_NEUTRAL_DUSK};
|
|
16
|
+
line-height: 1.2;
|
|
17
|
+
font-weight: 600;
|
|
18
|
+
|
|
19
|
+
font-size: ${({ size = 'md' })=>FONT_SIZES[size]};
|
|
20
|
+
`;
|
|
21
|
+
export { Text };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type TitleVariant = 'huge' | 'standard' | 'section' | 'heading' | 'smallHeading' | 'subheading';
|
|
2
|
+
interface TitleProps {
|
|
3
|
+
size?: TitleVariant;
|
|
4
|
+
color?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const Title: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, TitleProps>> & string;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import styled_components from "styled-components";
|
|
2
|
+
import { COLOR_NEUTRAL_DUSK } from "@ftdata/f-tokens";
|
|
3
|
+
const TITLE_VARIANTS = {
|
|
4
|
+
huge: {
|
|
5
|
+
size: '1.875rem',
|
|
6
|
+
spacing: '-0.03em'
|
|
7
|
+
},
|
|
8
|
+
standard: {
|
|
9
|
+
size: '1.5rem',
|
|
10
|
+
spacing: '-0.03em'
|
|
11
|
+
},
|
|
12
|
+
section: {
|
|
13
|
+
size: '1.25rem',
|
|
14
|
+
spacing: '-0.03em',
|
|
15
|
+
weight: 500
|
|
16
|
+
},
|
|
17
|
+
heading: {
|
|
18
|
+
size: '1rem'
|
|
19
|
+
},
|
|
20
|
+
smallHeading: {
|
|
21
|
+
size: '0.875rem'
|
|
22
|
+
},
|
|
23
|
+
subheading: {
|
|
24
|
+
size: '0.75rem',
|
|
25
|
+
spacing: '0.06em'
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const Title = styled_components.span`
|
|
29
|
+
color: ${({ color })=>color ?? COLOR_NEUTRAL_DUSK};
|
|
30
|
+
line-height: 1.2;
|
|
31
|
+
font-weight: 600;
|
|
32
|
+
|
|
33
|
+
font-size: ${({ size = 'standard' })=>TITLE_VARIANTS[size].size};
|
|
34
|
+
letter-spacing: ${({ size = 'standard' })=>TITLE_VARIANTS[size].spacing ?? '0'};
|
|
35
|
+
font-weight: ${({ size = 'standard' })=>TITLE_VARIANTS[size].weight ?? 600};
|
|
36
|
+
`;
|
|
37
|
+
export { Title };
|
|
@@ -1,31 +1,36 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Icon } from "@ftdata/f-icons";
|
|
3
3
|
import { HelpTextContainer } from "./styles.js";
|
|
4
4
|
const DEFAULT_ICONS = {
|
|
5
5
|
danger: "ui info-information",
|
|
6
|
-
success: "ui done-check
|
|
6
|
+
success: "ui done-check",
|
|
7
7
|
warning: "ui warning-triangle"
|
|
8
8
|
};
|
|
9
9
|
const getFeedbackIcon = (feedback)=>{
|
|
10
10
|
if ("info" === feedback || "disabled" === feedback || !feedback) return;
|
|
11
|
-
return /*#__PURE__*/ jsx(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
return /*#__PURE__*/ jsx("div", {
|
|
12
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
13
|
+
name: DEFAULT_ICONS[feedback],
|
|
14
|
+
color: "currentColor",
|
|
15
|
+
size: "1rem",
|
|
16
|
+
weight: "2.5"
|
|
17
|
+
})
|
|
16
18
|
});
|
|
17
19
|
};
|
|
18
20
|
function HelpText({ feedback, text, icon }) {
|
|
19
21
|
return /*#__PURE__*/ jsxs(HelpTextContainer, {
|
|
20
22
|
feedback: feedback,
|
|
21
23
|
children: [
|
|
22
|
-
icon && /*#__PURE__*/ jsx(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
!icon && /*#__PURE__*/ jsx(Fragment, {
|
|
25
|
+
children: getFeedbackIcon(feedback)
|
|
26
|
+
}),
|
|
27
|
+
icon && /*#__PURE__*/ jsx("div", {
|
|
28
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
29
|
+
name: icon,
|
|
30
|
+
color: "currentColor",
|
|
31
|
+
size: "1rem"
|
|
32
|
+
})
|
|
26
33
|
}),
|
|
27
|
-
" ",
|
|
28
|
-
!icon && getFeedbackIcon(feedback),
|
|
29
34
|
/*#__PURE__*/ jsx("span", {
|
|
30
35
|
children: text
|
|
31
36
|
})
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { COLOR_DANGER_MEDIUM,
|
|
1
|
+
import { COLOR_DANGER_MEDIUM, COLOR_NEUTRAL_DARK, COLOR_NEUTRAL_MEDIUM, COLOR_SUCCESS_MEDIUM, COLOR_WARNING_MEDIUM } from "@ftdata/f-tokens";
|
|
2
2
|
const HELP_TEXT_COLOR_MODIFIER = {
|
|
3
3
|
danger: COLOR_DANGER_MEDIUM,
|
|
4
4
|
warning: COLOR_WARNING_MEDIUM,
|
|
5
5
|
success: COLOR_SUCCESS_MEDIUM,
|
|
6
|
-
info:
|
|
6
|
+
info: COLOR_NEUTRAL_DARK,
|
|
7
7
|
disabled: COLOR_NEUTRAL_MEDIUM
|
|
8
8
|
};
|
|
9
9
|
export { HELP_TEXT_COLOR_MODIFIER };
|
|
@@ -7,6 +7,11 @@ const HelpTextContainer = styled_components.div`
|
|
|
7
7
|
color: ${({ feedback = "info" })=>HELP_TEXT_COLOR_MODIFIER[feedback]};
|
|
8
8
|
transition: all 0.18s ease;
|
|
9
9
|
|
|
10
|
+
div {
|
|
11
|
+
width: 1rem;
|
|
12
|
+
height: 1rem;
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
span {
|
|
11
16
|
font-size: 0.875rem;
|
|
12
17
|
line-height: 1.25rem;
|
|
@@ -13,16 +13,23 @@ const LabelContainer = styled_components.div`
|
|
|
13
13
|
font-weight: ${FONT_WEIGHT_BOLD};
|
|
14
14
|
line-height: 1rem;
|
|
15
15
|
white-space: normal;
|
|
16
|
-
word-wrap: break-word;
|
|
17
|
-
overflow-wrap: break-word;
|
|
18
16
|
}
|
|
19
17
|
|
|
20
|
-
span
|
|
18
|
+
span,
|
|
19
|
+
strong {
|
|
21
20
|
margin-left: ${({ required })=>required ? "0" : "0.5rem"};
|
|
22
|
-
color: ${
|
|
21
|
+
color: ${COLOR_NEUTRAL_DARK};
|
|
23
22
|
font-size: 0.875rem;
|
|
24
23
|
font-weight: ${FONT_WEIGHT_BOLD};
|
|
25
24
|
line-height: 1rem;
|
|
26
25
|
}
|
|
26
|
+
|
|
27
|
+
span {
|
|
28
|
+
margin-left: 0.25rem;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
strong {
|
|
32
|
+
color: ${COLOR_DANGER_MEDIUM};
|
|
33
|
+
}
|
|
27
34
|
`;
|
|
28
35
|
export { LabelContainer };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { FieldFeedbackType } from "../../../types/feedback";
|
|
2
|
-
export declare function selectColorModifier(feedback?: FieldFeedbackType, active?: boolean): "" | import("styled-components").RuleSet<object>;
|
|
2
|
+
export declare function selectColorModifier(feedback?: FieldFeedbackType, active?: boolean, disabled?: boolean): "" | import("styled-components").RuleSet<object>;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { css } from "styled-components";
|
|
2
2
|
import { FEEDBACK_COLORS } from "./color_modifiers.js";
|
|
3
|
-
|
|
3
|
+
import { COLOR_NEUTRAL_LIGHT, COLOR_NEUTRAL_LIGHTER } from "@ftdata/f-tokens";
|
|
4
|
+
function selectColorModifier(feedback, active, disabled) {
|
|
5
|
+
if (disabled) return css`
|
|
6
|
+
background-color: ${COLOR_NEUTRAL_LIGHTER};
|
|
7
|
+
box-shadow: 0 0 0 1px ${COLOR_NEUTRAL_LIGHT};
|
|
8
|
+
cursor: not-allowed;
|
|
9
|
+
`;
|
|
4
10
|
if (!feedback) return "";
|
|
5
11
|
const color = FEEDBACK_COLORS[feedback];
|
|
6
12
|
return css`
|
package/dist/index.d.ts
CHANGED
|
@@ -17,12 +17,12 @@ export type { ISelectOption } from "./components/Select";
|
|
|
17
17
|
export type { SelectProps } from "./components/Select";
|
|
18
18
|
export { default as StateAlert } from "./components/StateAlert";
|
|
19
19
|
export { default as MultiSelect } from "./components/MultiSelect";
|
|
20
|
-
export {
|
|
21
|
-
export type { MultiSelectProps } from "./components/MultiSelect";
|
|
22
|
-
export type { IMultiSelectActions } from "./components/MultiSelect/interfaces/actions";
|
|
23
|
-
export type { IMultiSelectOption, IMultiSelectState, } from "./components/MultiSelect/interfaces/state";
|
|
24
|
-
export type { IMultiSelectConfig, IMultiSelectConfigActions, IMultiSelectConfigFields, } from "./components/MultiSelect/interfaces/config";
|
|
20
|
+
export type { MultiSelectProps, IMultiSelectOption, } from "./components/MultiSelect";
|
|
25
21
|
export { default as DoubleList } from "./components/DoubleList";
|
|
26
22
|
export { default as Menu } from "./components/Menu";
|
|
27
23
|
export type { MenuItem, MenuItemData, SubMenu, SubMenuData, } from "./components/Menu/types/MenuItem";
|
|
28
24
|
export { Input } from "./components/Input";
|
|
25
|
+
export { default as IconButton } from "./components/IconButton";
|
|
26
|
+
export { default as Modal } from "./components/Modal";
|
|
27
|
+
export { ModalOverlay } from "./components/Modal/styles";
|
|
28
|
+
export type { ModalAction, ModalActions, ModalProps, ModalSizeCustom, ModalSizes, } from "./components/Modal";
|
package/dist/index.js
CHANGED
|
@@ -13,10 +13,12 @@ import UserMenu from "./components/UserMenu/index.js";
|
|
|
13
13
|
import Select from "./components/Select/index.js";
|
|
14
14
|
import StateAlert from "./components/StateAlert/index.js";
|
|
15
15
|
import MultiSelect from "./components/MultiSelect/index.js";
|
|
16
|
-
import { useMultiSelect } from "./components/MultiSelect/hooks/useMultiSelect.js";
|
|
17
16
|
import DoubleList from "./components/DoubleList/index.js";
|
|
18
17
|
import Menu from "./components/Menu/index.js";
|
|
19
18
|
import { Input } from "./components/Input/index.js";
|
|
19
|
+
import IconButton from "./components/IconButton/index.js";
|
|
20
|
+
import Modal from "./components/Modal/index.js";
|
|
21
|
+
import { ModalOverlay } from "./components/Modal/styles.js";
|
|
20
22
|
export * from "./components/Grid/index.js";
|
|
21
23
|
export * from "./components/Text/index.js";
|
|
22
|
-
export { Avatar, Breadcrumb, Button, Checkbox, Collapse, DoubleList, EmptyState, Input, Loading, Menu, MultiSelect, Radio, Select, StateAlert, Switch, TextArea, Tooltips, UserMenu, useLoading
|
|
24
|
+
export { Avatar, Breadcrumb, Button, Checkbox, Collapse, DoubleList, EmptyState, IconButton, Input, Loading, Menu, Modal, ModalOverlay, MultiSelect, Radio, Select, StateAlert, Switch, TextArea, Tooltips, UserMenu, useLoading };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ftdata/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"react-input-mask-next": "3.0.0-alpha.12",
|
|
32
32
|
"react-select": "^5.10.2",
|
|
33
33
|
"react-window": "^2.0.2",
|
|
34
|
-
"@ftdata/f-icons": "0.0.
|
|
34
|
+
"@ftdata/f-icons": "0.0.6",
|
|
35
35
|
"@ftdata/f-tokens": "0.0.1"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { arraysEqual } from "./arraysEqual.js";
|
|
2
|
-
const FIELDS = [
|
|
3
|
-
"selected",
|
|
4
|
-
"options",
|
|
5
|
-
"filtered",
|
|
6
|
-
"unselected"
|
|
7
|
-
];
|
|
8
|
-
function getChangedFields(base, compare) {
|
|
9
|
-
const changed = [];
|
|
10
|
-
FIELDS.forEach((key)=>{
|
|
11
|
-
const last = base[key] || [];
|
|
12
|
-
const next = compare[key] || [];
|
|
13
|
-
if (arraysEqual(last, next)) changed.push(key);
|
|
14
|
-
});
|
|
15
|
-
return changed;
|
|
16
|
-
}
|
|
17
|
-
export { getChangedFields };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IMultiSelectState } from "../interfaces/state";
|
|
2
|
-
import { IMultiSelectConfig } from "../interfaces/config";
|
|
3
|
-
interface UseIMultiSelectConfig {
|
|
4
|
-
config?: IMultiSelectConfig;
|
|
5
|
-
}
|
|
6
|
-
export declare function useMultiSelect({ config }: UseIMultiSelectConfig): {
|
|
7
|
-
state: IMultiSelectState;
|
|
8
|
-
updateState: (newPartial: Partial<IMultiSelectState>) => void;
|
|
9
|
-
};
|
|
10
|
-
export {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { useEffect, useReducer } from "react";
|
|
2
|
-
import { computeUnselected } from "../helpers/computeUnselected.js";
|
|
3
|
-
import { stateReducer } from "../reducers/stateReducer.js";
|
|
4
|
-
import { arraysEqual } from "../helpers/arraysEqual.js";
|
|
5
|
-
function useMultiSelect({ config }) {
|
|
6
|
-
const initial = {
|
|
7
|
-
selected: config?.fields?.externalSelected ?? [],
|
|
8
|
-
options: config?.fields?.externalOptions ?? [],
|
|
9
|
-
filtered: config?.fields?.externalFiltered ?? [],
|
|
10
|
-
unselected: computeUnselected(config?.fields?.externalOptions ?? [], config?.fields?.externalSelected ?? [])
|
|
11
|
-
};
|
|
12
|
-
const [state, dispatch] = useReducer(stateReducer, initial);
|
|
13
|
-
useEffect(()=>{
|
|
14
|
-
if (!config) return;
|
|
15
|
-
const { fields, actions } = config;
|
|
16
|
-
const payload = {};
|
|
17
|
-
if (fields?.externalSelected && !arraysEqual(fields.externalSelected, state.selected)) payload.selected = fields.externalSelected;
|
|
18
|
-
if (fields?.externalOptions && !arraysEqual(fields.externalOptions, state.options)) payload.options = fields.externalOptions;
|
|
19
|
-
if (fields?.externalFiltered && !arraysEqual(fields.externalFiltered, state.filtered)) payload.filtered = fields.externalFiltered;
|
|
20
|
-
if (fields?.externalUnselected && !arraysEqual(fields.externalUnselected, state.unselected)) payload.unselected = fields.externalUnselected;
|
|
21
|
-
if (Object.keys(payload).length) dispatch({
|
|
22
|
-
type: "SET_STATE",
|
|
23
|
-
payload
|
|
24
|
-
});
|
|
25
|
-
if (actions?.onSelectedChange) actions.onSelectedChange(state.selected);
|
|
26
|
-
if (actions?.onOptionsChange) actions.onOptionsChange(state.options);
|
|
27
|
-
if (actions?.onFilteredChange) actions.onFilteredChange(state.filtered);
|
|
28
|
-
if (actions?.onUnselectedChange) actions.onUnselectedChange(state.unselected);
|
|
29
|
-
}, [
|
|
30
|
-
state,
|
|
31
|
-
config
|
|
32
|
-
]);
|
|
33
|
-
const updateState = (newPartial)=>{
|
|
34
|
-
dispatch({
|
|
35
|
-
type: "SET_STATE",
|
|
36
|
-
payload: newPartial
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
return {
|
|
40
|
-
state,
|
|
41
|
-
updateState
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
export { useMultiSelect };
|
|
File without changes
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { IMultiSelectState, IMultiSelectOption } from "./state";
|
|
2
|
-
export interface IMultiSelectConfigFields {
|
|
3
|
-
externalSelected?: IMultiSelectOption[];
|
|
4
|
-
externalOptions?: IMultiSelectOption[];
|
|
5
|
-
externalFiltered?: IMultiSelectOption[];
|
|
6
|
-
externalUnselected?: IMultiSelectOption[];
|
|
7
|
-
}
|
|
8
|
-
export interface IMultiSelectConfigActions {
|
|
9
|
-
onSelectedChange?: (selected: IMultiSelectState["selected"]) => void;
|
|
10
|
-
onOptionsChange?: (options: IMultiSelectState["options"]) => void;
|
|
11
|
-
onFilteredChange?: (filtered: IMultiSelectState["filtered"]) => void;
|
|
12
|
-
onUnselectedChange?: (unselected: IMultiSelectState["unselected"]) => void;
|
|
13
|
-
}
|
|
14
|
-
export interface IMultiSelectConfig {
|
|
15
|
-
fields?: IMultiSelectConfigFields;
|
|
16
|
-
actions?: IMultiSelectConfigActions;
|
|
17
|
-
}
|
|
File without changes
|
|
File without changes
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { IMultiSelectOption, IMultiSelectState } from "../interfaces/state";
|
|
2
|
-
type MultiSelectAction = {
|
|
3
|
-
type: "SET_STATE";
|
|
4
|
-
payload: Partial<IMultiSelectState>;
|
|
5
|
-
} | {
|
|
6
|
-
type: "SET_OPTIONS";
|
|
7
|
-
payload: IMultiSelectOption[];
|
|
8
|
-
} | {
|
|
9
|
-
type: "SET_SELECTED";
|
|
10
|
-
payload: IMultiSelectOption[];
|
|
11
|
-
} | {
|
|
12
|
-
type: "SET_UNSELECTED";
|
|
13
|
-
payload: IMultiSelectOption[];
|
|
14
|
-
} | {
|
|
15
|
-
type: "SET_FILTERED";
|
|
16
|
-
payload: IMultiSelectOption[];
|
|
17
|
-
} | {
|
|
18
|
-
type: "CLEAR";
|
|
19
|
-
};
|
|
20
|
-
export declare function stateReducer(state: IMultiSelectState, action: MultiSelectAction): IMultiSelectState;
|
|
21
|
-
export {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { computeUnselected } from "../helpers/computeUnselected.js";
|
|
2
|
-
import { computeSelected } from "../helpers/computeSelected.js";
|
|
3
|
-
function stateReducer(state, action) {
|
|
4
|
-
switch(action.type){
|
|
5
|
-
case "SET_STATE":
|
|
6
|
-
return {
|
|
7
|
-
...state,
|
|
8
|
-
...action.payload,
|
|
9
|
-
unselected: computeUnselected(action.payload.options ?? state.options, action.payload.selected ?? state.selected)
|
|
10
|
-
};
|
|
11
|
-
case "SET_OPTIONS":
|
|
12
|
-
return {
|
|
13
|
-
...state,
|
|
14
|
-
options: action.payload,
|
|
15
|
-
unselected: computeUnselected(action.payload, state.selected)
|
|
16
|
-
};
|
|
17
|
-
case "SET_SELECTED":
|
|
18
|
-
return {
|
|
19
|
-
...state,
|
|
20
|
-
selected: action.payload,
|
|
21
|
-
unselected: computeUnselected(state.options, action.payload)
|
|
22
|
-
};
|
|
23
|
-
case "SET_UNSELECTED":
|
|
24
|
-
return {
|
|
25
|
-
...state,
|
|
26
|
-
selected: computeSelected(state.options, action.payload),
|
|
27
|
-
unselected: action.payload
|
|
28
|
-
};
|
|
29
|
-
case "SET_FILTERED":
|
|
30
|
-
return {
|
|
31
|
-
...state,
|
|
32
|
-
filtered: action.payload
|
|
33
|
-
};
|
|
34
|
-
case "CLEAR":
|
|
35
|
-
return {
|
|
36
|
-
...state,
|
|
37
|
-
selected: [],
|
|
38
|
-
unselected: state.options
|
|
39
|
-
};
|
|
40
|
-
default:
|
|
41
|
-
return state;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export { stateReducer };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Paragraph } from "../index";
|
|
3
|
-
/**
|
|
4
|
-
* Títulos são usados para mostrar textos regulares em uma página.
|
|
5
|
-
* Este componente também funciona com os atributos nativos de um HTML paragraph element.
|
|
6
|
-
*/
|
|
7
|
-
declare const meta: Meta<typeof Paragraph>;
|
|
8
|
-
export default meta;
|
|
9
|
-
type Story = StoryObj<typeof meta>;
|
|
10
|
-
/**
|
|
11
|
-
* Variação padrão do Paragraph quando apenas as propriedades obrigatórias são fornecidas.
|
|
12
|
-
*/
|
|
13
|
-
export declare const Default: Story;
|
|
14
|
-
/**
|
|
15
|
-
* Variação de tamanho caption do Paragraph.
|
|
16
|
-
*/
|
|
17
|
-
export declare const Caption: Story;
|
|
18
|
-
/**
|
|
19
|
-
* Variação de tamanho sm do Paragraph.
|
|
20
|
-
*/
|
|
21
|
-
export declare const Sm: Story;
|
|
22
|
-
/**
|
|
23
|
-
* Variação de tamanho md do Paragraph.
|
|
24
|
-
*/
|
|
25
|
-
export declare const Md: Story;
|
|
26
|
-
/**
|
|
27
|
-
* Todas as variações padrão de de tamanho do Paragraph.
|
|
28
|
-
*/
|
|
29
|
-
export declare const Sizes: Story;
|