@fluidattacks/design 11.10.0 → 11.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/inputs/fields/combobox/field/index.js +164 -160
- package/dist/components/inputs/fields/combobox/index.stories.d.ts +3 -1
- package/dist/components/inputs/fields/combobox/option/index.d.ts +1 -1
- package/dist/components/inputs/fields/combobox/option/index.js +103 -87
- package/dist/components/inputs/fields/combobox/styles.js +44 -26
- package/dist/components/inputs/fields/combobox/types.d.ts +6 -1
- package/dist/components/inputs/fields/month/index.d.ts +5 -0
- package/dist/components/inputs/fields/month/index.js +81 -0
- package/dist/components/inputs/fields/month/index.stories.d.ts +7 -0
- package/dist/components/inputs/fields/month/index.test.d.ts +1 -0
- package/dist/components/inputs/fields/month/panel.js +104 -0
- package/dist/components/inputs/fields/month/styles.d.ts +3 -1
- package/dist/components/inputs/fields/month/styles.js +109 -0
- package/dist/components/inputs/fields/month/types.d.ts +11 -0
- package/dist/components/inputs/fields/month/utils.js +34 -0
- package/dist/components/inputs/index.d.ts +2 -1
- package/dist/components/inputs/index.js +14 -12
- package/dist/index.js +232 -230
- package/package.json +1 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { styled as a } from "styled-components";
|
|
2
|
+
const o = a.button`
|
|
3
|
+
${({ theme: t }) => `
|
|
4
|
+
align-items: center;
|
|
5
|
+
background: ${t.palette.white};
|
|
6
|
+
border: 1px solid ${t.palette.gray[300]};
|
|
7
|
+
border-radius: ${t.spacing[0.5]};
|
|
8
|
+
color: ${t.palette.gray[800]};
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
display: flex;
|
|
11
|
+
font-family: ${t.typography.type.primary};
|
|
12
|
+
font-size: ${t.typography.text.md};
|
|
13
|
+
gap: ${t.spacing[0.5]};
|
|
14
|
+
height: 40px;
|
|
15
|
+
padding: 0 ${t.spacing[0.75]};
|
|
16
|
+
width: 100%;
|
|
17
|
+
|
|
18
|
+
&:hover:not(:disabled) {
|
|
19
|
+
border-color: ${t.palette.gray[600]};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&:focus-visible,
|
|
23
|
+
&[aria-expanded="true"] {
|
|
24
|
+
border-color: ${t.palette.black};
|
|
25
|
+
box-shadow: 0 0 0 1px ${t.palette.black};
|
|
26
|
+
outline: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&:disabled {
|
|
30
|
+
background: ${t.palette.gray[100]};
|
|
31
|
+
color: ${t.palette.gray[400]};
|
|
32
|
+
cursor: not-allowed;
|
|
33
|
+
}
|
|
34
|
+
`}
|
|
35
|
+
`, p = a.span`
|
|
36
|
+
flex: 1;
|
|
37
|
+
text-align: left;
|
|
38
|
+
`, i = a.div`
|
|
39
|
+
${({ theme: t }) => `
|
|
40
|
+
align-items: center;
|
|
41
|
+
color: ${t.palette.gray[800]};
|
|
42
|
+
display: flex;
|
|
43
|
+
font-family: ${t.typography.type.primary};
|
|
44
|
+
font-size: ${t.typography.text.md};
|
|
45
|
+
font-weight: ${t.typography.weight.bold};
|
|
46
|
+
justify-content: space-between;
|
|
47
|
+
width: 100%;
|
|
48
|
+
|
|
49
|
+
> button {
|
|
50
|
+
height: 40px;
|
|
51
|
+
width: 40px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
> span {
|
|
55
|
+
text-align: center;
|
|
56
|
+
width: 200px;
|
|
57
|
+
}
|
|
58
|
+
`}
|
|
59
|
+
`, n = a.div`
|
|
60
|
+
display: grid;
|
|
61
|
+
grid-template-columns: repeat(4, 1fr);
|
|
62
|
+
width: 100%;
|
|
63
|
+
`, e = a.button`
|
|
64
|
+
${({ theme: t }) => `
|
|
65
|
+
background: none;
|
|
66
|
+
border: none;
|
|
67
|
+
color: ${t.palette.gray[800]};
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
font-family: ${t.typography.type.primary};
|
|
70
|
+
font-size: ${t.typography.text.md};
|
|
71
|
+
height: 40px;
|
|
72
|
+
|
|
73
|
+
&:hover:not(:disabled, [aria-pressed="true"]) {
|
|
74
|
+
background: ${t.palette.gray[100]};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&[aria-pressed="true"] {
|
|
78
|
+
background: ${t.palette.primary[500]};
|
|
79
|
+
color: ${t.palette.white};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&:disabled {
|
|
83
|
+
color: ${t.palette.gray[400]};
|
|
84
|
+
cursor: auto;
|
|
85
|
+
}
|
|
86
|
+
`}
|
|
87
|
+
`, d = a.div`
|
|
88
|
+
${({ theme: t }) => `
|
|
89
|
+
align-items: center;
|
|
90
|
+
border-top: 1px solid ${t.palette.gray[200]};
|
|
91
|
+
display: flex;
|
|
92
|
+
justify-content: space-between;
|
|
93
|
+
padding: ${t.spacing[0.25]} 0;
|
|
94
|
+
width: 100%;
|
|
95
|
+
|
|
96
|
+
> button {
|
|
97
|
+
--btn-padding-x: ${t.spacing[0.5]};
|
|
98
|
+
--btn-padding-y: ${t.spacing[0.625]};
|
|
99
|
+
}
|
|
100
|
+
`}
|
|
101
|
+
`;
|
|
102
|
+
export {
|
|
103
|
+
d as Footer,
|
|
104
|
+
n as MonthGrid,
|
|
105
|
+
e as MonthItem,
|
|
106
|
+
p as PeriodText,
|
|
107
|
+
o as TriggerButton,
|
|
108
|
+
i as YearBar
|
|
109
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Props of the month picker; `value`, `minValue` and `maxValue` are `MM/YYYY`. */
|
|
2
|
+
interface IMonthPickerProps {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
label?: string;
|
|
5
|
+
maxValue?: string;
|
|
6
|
+
minValue?: string;
|
|
7
|
+
name: string;
|
|
8
|
+
onChange: (value: string) => void;
|
|
9
|
+
value: string;
|
|
10
|
+
}
|
|
11
|
+
export type { IMonthPickerProps };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const v = [
|
|
2
|
+
"Jan",
|
|
3
|
+
"Feb",
|
|
4
|
+
"Mar",
|
|
5
|
+
"Apr",
|
|
6
|
+
"May",
|
|
7
|
+
"Jun",
|
|
8
|
+
"Jul",
|
|
9
|
+
"Aug",
|
|
10
|
+
"Sep",
|
|
11
|
+
"Oct",
|
|
12
|
+
"Nov",
|
|
13
|
+
"Dec"
|
|
14
|
+
];
|
|
15
|
+
const i = ({ month: t, year: o }) => o * 12 + t, N = (t, o) => `${String(o + 1).padStart(2, "0")}/${t}`, c = (t) => {
|
|
16
|
+
const o = /^(\d{2})\/(\d{4})$/u.exec(t);
|
|
17
|
+
if (o === null)
|
|
18
|
+
return;
|
|
19
|
+
const n = Number(o[1]);
|
|
20
|
+
return n >= 1 && n <= 12 ? { month: n - 1, year: Number(o[2]) } : void 0;
|
|
21
|
+
}, P = (t) => {
|
|
22
|
+
const o = c(t);
|
|
23
|
+
return o === void 0 ? "" : `${v[o.month]} ${o.year}`;
|
|
24
|
+
}, u = (t, o, n, r) => {
|
|
25
|
+
const d = i({ month: o, year: t }), s = n === void 0 ? void 0 : c(n), e = r === void 0 ? void 0 : c(r);
|
|
26
|
+
return n !== void 0 && (s === void 0 || d < i(s)) || r !== void 0 && (e === void 0 || d > i(e));
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
v as MONTHS,
|
|
30
|
+
P as formatPeriod,
|
|
31
|
+
c as fromPeriod,
|
|
32
|
+
u as isOutOfRange,
|
|
33
|
+
N as toPeriod
|
|
34
|
+
};
|
|
@@ -7,6 +7,7 @@ import { InputArray } from './fields/input-array';
|
|
|
7
7
|
import { InputFile } from './fields/input-file';
|
|
8
8
|
import { IInputSectionProps, InputSection } from './fields/input-section';
|
|
9
9
|
import { InputTags } from './fields/input-tags';
|
|
10
|
+
import { IMonthPickerProps, MonthPicker } from './fields/month';
|
|
10
11
|
import { InputNumber } from './fields/number';
|
|
11
12
|
import { InputNumberRange } from './fields/number-range';
|
|
12
13
|
import { PhoneInput } from './fields/phone';
|
|
@@ -14,4 +15,4 @@ import { TextArea } from './fields/text-area';
|
|
|
14
15
|
import { TextInput } from './fields/text-input';
|
|
15
16
|
import { OutlineContainer } from './outline-container';
|
|
16
17
|
import { ErrorMessage } from './styles';
|
|
17
|
-
export { type IComboBoxProps, type IItem, type IInputSectionProps, OutlineContainer, PhoneInput, ComboBox, ErrorMessage, TextInput, InputArray, InputDate, InputDateRange, InputDateTime, InputFile, InputNumber, InputSection, InputTags, InputNumberRange, TextArea, Editable, };
|
|
18
|
+
export { type IComboBoxProps, type IItem, type IInputSectionProps, type IMonthPickerProps, MonthPicker, OutlineContainer, PhoneInput, ComboBox, ErrorMessage, TextInput, InputArray, InputDate, InputDateRange, InputDateTime, InputFile, InputNumber, InputSection, InputTags, InputNumberRange, TextArea, Editable, };
|
|
@@ -7,28 +7,30 @@ import { InputArray as i } from "./fields/input-array/index.js";
|
|
|
7
7
|
import { InputFile as g } from "./fields/input-file/index.js";
|
|
8
8
|
import { InputSection as l } from "./fields/input-section/index.js";
|
|
9
9
|
import { InputTags as D } from "./fields/input-tags/index.js";
|
|
10
|
+
import { MonthPicker as h } from "./fields/month/index.js";
|
|
10
11
|
import { InputNumber as C } from "./fields/number/index.js";
|
|
11
|
-
import { InputNumberRange as
|
|
12
|
-
import { PhoneInput as
|
|
13
|
-
import { TextArea as
|
|
14
|
-
import { TextInput as
|
|
15
|
-
import { OutlineContainer as
|
|
16
|
-
import { ErrorMessage as
|
|
12
|
+
import { InputNumberRange as M } from "./fields/number-range/index.js";
|
|
13
|
+
import { PhoneInput as P } from "./fields/phone/index.js";
|
|
14
|
+
import { TextArea as d } from "./fields/text-area/index.js";
|
|
15
|
+
import { TextInput as y } from "./fields/text-input/index.js";
|
|
16
|
+
import { OutlineContainer as F } from "./outline-container/index.js";
|
|
17
|
+
import { ErrorMessage as S } from "./styles.js";
|
|
17
18
|
export {
|
|
18
19
|
t as ComboBox,
|
|
19
20
|
a as Editable,
|
|
20
|
-
|
|
21
|
+
S as ErrorMessage,
|
|
21
22
|
i as InputArray,
|
|
22
23
|
p as InputDate,
|
|
23
24
|
x as InputDateRange,
|
|
24
25
|
f as InputDateTime,
|
|
25
26
|
g as InputFile,
|
|
26
27
|
C as InputNumber,
|
|
27
|
-
|
|
28
|
+
M as InputNumberRange,
|
|
28
29
|
l as InputSection,
|
|
29
30
|
D as InputTags,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
h as MonthPicker,
|
|
32
|
+
F as OutlineContainer,
|
|
33
|
+
P as PhoneInput,
|
|
34
|
+
d as TextArea,
|
|
35
|
+
y as TextInput
|
|
34
36
|
};
|