kahuna-base-react-components 0.2.10 → 0.2.12
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/KDropdown/KDropdown.d.ts +4 -1
- package/dist/components/KSelectDate/KSelectDate.d.ts +9 -0
- package/dist/components/KSelectDate/index.d.ts +1 -0
- package/dist/components/KSpan/KSpan.d.ts +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +16 -38
- package/package.json +4 -2
- package/removeUseClient.js +22 -0
- package/rollup.config.js +2 -0
- package/src/assets/calendar-hovered.svg +3 -0
- package/src/assets/calendar.svg +3 -0
- package/src/assets/separator.svg +3 -0
- package/src/components/KDropdown/KDropdown.stories.tsx +18 -6
- package/src/components/KDropdown/KDropdown.tsx +25 -4
- package/src/components/KSelectDate/CalendarCustom.css +235 -0
- package/src/components/KSelectDate/KSelectDate.stories.tsx +54 -0
- package/src/components/KSelectDate/KSelectDate.tsx +314 -0
- package/src/components/KSelectDate/index.ts +1 -0
- package/src/components/KSpan/KSpan.tsx +6 -2
- package/src/index.ts +2 -2
- package/src/components/KDropdownToggle/KDropdownToggle.stories.tsx +0 -70
- package/src/components/KDropdownToggle/KDropdownToggle.tsx +0 -186
- package/src/components/KDropdownToggle/index.ts +0 -1
package/dist/types.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ interface KSpanProps {
|
|
|
33
33
|
hoverTextColor?: string;
|
|
34
34
|
hoverStyle?: CSSProperties;
|
|
35
35
|
textDecoration?: string;
|
|
36
|
+
ellipsis?: boolean;
|
|
36
37
|
}
|
|
37
38
|
declare const KSpan: React.FC<KSpanProps>;
|
|
38
39
|
|
|
@@ -86,7 +87,7 @@ interface KInputProps {
|
|
|
86
87
|
}
|
|
87
88
|
declare const KInput: React.FC<KInputProps>;
|
|
88
89
|
|
|
89
|
-
interface KSelectOption
|
|
90
|
+
interface KSelectOption {
|
|
90
91
|
label: string;
|
|
91
92
|
value: number;
|
|
92
93
|
type?: string;
|
|
@@ -94,11 +95,12 @@ interface KSelectOption$1 {
|
|
|
94
95
|
value2?: string;
|
|
95
96
|
icon?: string;
|
|
96
97
|
}
|
|
97
|
-
interface KDropdownProps
|
|
98
|
-
defaultValue?: KSelectOption
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
interface KDropdownProps {
|
|
99
|
+
defaultValue?: KSelectOption | MultiValue<KSelectOption>;
|
|
100
|
+
defaultValuePrimitive?: string | number;
|
|
101
|
+
selected?: KSelectOption | MultiValue<KSelectOption>;
|
|
102
|
+
onSelect: (selected: KSelectOption | MultiValue<KSelectOption> | undefined) => void;
|
|
103
|
+
options: KSelectOption[];
|
|
102
104
|
width?: number;
|
|
103
105
|
height?: number;
|
|
104
106
|
leftIcon?: string;
|
|
@@ -115,8 +117,10 @@ interface KDropdownProps$1 {
|
|
|
115
117
|
padding?: string;
|
|
116
118
|
gap?: string;
|
|
117
119
|
hideChosenOptionIcon?: boolean;
|
|
120
|
+
isClearable?: boolean;
|
|
121
|
+
isEllipsis?: boolean;
|
|
118
122
|
}
|
|
119
|
-
declare const KDropdown: React.FC<KDropdownProps
|
|
123
|
+
declare const KDropdown: React.FC<KDropdownProps>;
|
|
120
124
|
|
|
121
125
|
interface SliderOption {
|
|
122
126
|
label: string;
|
|
@@ -131,36 +135,10 @@ interface KSliderProps {
|
|
|
131
135
|
}
|
|
132
136
|
declare const KSlider: React.FC<KSliderProps>;
|
|
133
137
|
|
|
134
|
-
interface
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
type?: string;
|
|
138
|
-
label2?: string;
|
|
139
|
-
value2?: string;
|
|
140
|
-
icon?: string;
|
|
141
|
-
}
|
|
142
|
-
interface KDropdownProps {
|
|
143
|
-
defaultValue?: KSelectOption | MultiValue<KSelectOption>;
|
|
144
|
-
selected?: KSelectOption | MultiValue<KSelectOption>;
|
|
145
|
-
onSelect: (selected: KSelectOption | MultiValue<KSelectOption>) => void;
|
|
146
|
-
options: KSelectOption[];
|
|
147
|
-
width?: number;
|
|
148
|
-
height?: number;
|
|
149
|
-
leftIcon?: string;
|
|
150
|
-
rightIcon?: string;
|
|
151
|
-
background?: string;
|
|
152
|
-
activeBackground?: string;
|
|
153
|
-
borderRadius?: number;
|
|
154
|
-
placeholder?: string;
|
|
155
|
-
isMulti?: boolean;
|
|
156
|
-
label?: string;
|
|
157
|
-
textColor?: string;
|
|
158
|
-
shadowDisabled?: boolean;
|
|
159
|
-
menuBackground?: string;
|
|
160
|
-
padding?: string;
|
|
161
|
-
gap?: string;
|
|
162
|
-
hideChosenOptionIcon?: boolean;
|
|
138
|
+
interface KSelectDateProps {
|
|
139
|
+
value: Date | undefined;
|
|
140
|
+
onChange: (date: Date | undefined) => void;
|
|
163
141
|
}
|
|
164
|
-
declare const
|
|
142
|
+
declare const KSelectDate: React.FC<KSelectDateProps>;
|
|
165
143
|
|
|
166
|
-
export { KButton, KDropdown,
|
|
144
|
+
export { KButton, KDropdown, KInput, KLogo, KSelectDate, KSlider, KSpan, KTitleSpan };
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kahuna-base-react-components",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "Kahuna Base React Components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
10
|
+
"prebuild": "node removeUseClient.js",
|
|
10
11
|
"build": "rollup -c --bundleConfigAsCjs && npm run remove-stories",
|
|
11
12
|
"remove-stories": "find dist/ -name '*.stories.*' -type f -delete",
|
|
12
13
|
"storybook": "storybook dev -p 6006",
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
"typescript": "^5.4.2"
|
|
65
66
|
},
|
|
66
67
|
"dependencies": {
|
|
68
|
+
"react-date-picker": "^11.0.0",
|
|
67
69
|
"react-select": "^5.8.0"
|
|
68
70
|
}
|
|
69
|
-
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
|
|
4
|
+
// Function to remove "use client" directive from a file
|
|
5
|
+
const removeUseClientDirective = (filePath) => {
|
|
6
|
+
const content = fs.readFileSync(filePath, 'utf8')
|
|
7
|
+
const updatedContent = content.replace(/^['"]use client['"];/, '')
|
|
8
|
+
fs.writeFileSync(filePath, updatedContent, 'utf8')
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// Specify the paths to the files that contain "use client"
|
|
12
|
+
const reactCalendarPath = path.resolve(__dirname, 'node_modules', 'react-calendar', 'dist', 'esm')
|
|
13
|
+
const filesToUpdate = [
|
|
14
|
+
path.join(reactCalendarPath, 'Calendar.js'),
|
|
15
|
+
path.join(reactCalendarPath, 'Calendar', 'Navigation.js'),
|
|
16
|
+
// Add any other necessary files
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
// Remove the directive from each file
|
|
20
|
+
filesToUpdate.forEach(removeUseClientDirective)
|
|
21
|
+
|
|
22
|
+
console.log('Removed "use client" directives from react-calendar.')
|
package/rollup.config.js
CHANGED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
2
|
+
<path d="M13.75 3.25H16.75C16.9489 3.25 17.1397 3.32902 17.2803 3.46967C17.421 3.61032 17.5 3.80109 17.5 4V16C17.5 16.1989 17.421 16.3897 17.2803 16.5303C17.1397 16.671 16.9489 16.75 16.75 16.75H3.25C3.05109 16.75 2.86032 16.671 2.71967 16.5303C2.57902 16.3897 2.5 16.1989 2.5 16V4C2.5 3.80109 2.57902 3.61032 2.71967 3.46967C2.86032 3.32902 3.05109 3.25 3.25 3.25H6.25V1.75H7.75V3.25H12.25V1.75H13.75V3.25ZM12.25 4.75H7.75V6.25H6.25V4.75H4V7.75H16V4.75H13.75V6.25H12.25V4.75ZM16 9.25H4V15.25H16V9.25Z" fill="#434345"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
2
|
+
<path d="M13.75 3.25H16.75C16.9489 3.25 17.1397 3.32902 17.2803 3.46967C17.421 3.61032 17.5 3.80109 17.5 4V16C17.5 16.1989 17.421 16.3897 17.2803 16.5303C17.1397 16.671 16.9489 16.75 16.75 16.75H3.25C3.05109 16.75 2.86032 16.671 2.71967 16.5303C2.57902 16.3897 2.5 16.1989 2.5 16V4C2.5 3.80109 2.57902 3.61032 2.71967 3.46967C2.86032 3.32902 3.05109 3.25 3.25 3.25H6.25V1.75H7.75V3.25H12.25V1.75H13.75V3.25ZM12.25 4.75H7.75V6.25H6.25V4.75H4V7.75H16V4.75H13.75V6.25H12.25V4.75ZM16 9.25H4V15.25H16V9.25Z" fill="#111111"/>
|
|
3
|
+
</svg>
|
|
@@ -16,9 +16,19 @@ const Template: StoryFn<typeof KDropdown> = (args) => <KDropdown {...args} />
|
|
|
16
16
|
|
|
17
17
|
export const KDropdownSingle = Template.bind({})
|
|
18
18
|
KDropdownSingle.args = {
|
|
19
|
-
onSelect: (value: KSelectOption | MultiValue<KSelectOption>) => {
|
|
19
|
+
onSelect: (value: KSelectOption | MultiValue<KSelectOption> | undefined) => {
|
|
20
|
+
if (value === undefined) {
|
|
21
|
+
console.log("our value is undefined, deleting process can be performed")
|
|
22
|
+
} else {
|
|
23
|
+
console.log("update process can be performed")
|
|
24
|
+
}
|
|
25
|
+
},
|
|
20
26
|
width: 250,
|
|
21
27
|
placeholder: "Select single...",
|
|
28
|
+
isClearable: true,
|
|
29
|
+
isEllipsis: true,
|
|
30
|
+
// defaultValue: { label: "Label 1", value: 1, icon: TracksIcon },
|
|
31
|
+
defaultValuePrimitive: 7,
|
|
22
32
|
options: [
|
|
23
33
|
{ label: "Label 1", value: 1, icon: TracksIcon },
|
|
24
34
|
{ label: "Label 4", value: 2, icon: TracksIcon },
|
|
@@ -27,13 +37,15 @@ KDropdownSingle.args = {
|
|
|
27
37
|
{ label: "R&B", value: 5 },
|
|
28
38
|
{ label: "Çınar", value: 6 },
|
|
29
39
|
{ label: "ELEKTRONIC ", value: 7 },
|
|
30
|
-
{ label: "TANIK", value: 8 }
|
|
40
|
+
{ label: "TANIK", value: 8 },
|
|
41
|
+
{ label: "Very very very very very long content.", value: 9 },
|
|
42
|
+
{ label: "TANIK", value: 10 }
|
|
31
43
|
]
|
|
32
44
|
}
|
|
33
45
|
|
|
34
46
|
export const KDropdownMulti = Template.bind({})
|
|
35
47
|
KDropdownMulti.args = {
|
|
36
|
-
onSelect: (value: KSelectOption | MultiValue<KSelectOption>) => {},
|
|
48
|
+
onSelect: (value: KSelectOption | MultiValue<KSelectOption> | undefined) => {},
|
|
37
49
|
width: 250,
|
|
38
50
|
placeholder: "Multi...",
|
|
39
51
|
options: [
|
|
@@ -46,14 +58,14 @@ KDropdownMulti.args = {
|
|
|
46
58
|
|
|
47
59
|
export const KDropdownLeftIcon = Template.bind({})
|
|
48
60
|
KDropdownLeftIcon.args = {
|
|
49
|
-
onSelect: (value: KSelectOption | MultiValue<KSelectOption>) => {},
|
|
61
|
+
onSelect: (value: KSelectOption | MultiValue<KSelectOption> | undefined) => {},
|
|
50
62
|
placeholder: "Placeholder...",
|
|
51
63
|
leftIcon: TracksIcon
|
|
52
64
|
}
|
|
53
65
|
|
|
54
66
|
export const KDropdownRightIcon = Template.bind({})
|
|
55
67
|
KDropdownRightIcon.args = {
|
|
56
|
-
onSelect: (value: KSelectOption | MultiValue<KSelectOption>) => {},
|
|
68
|
+
onSelect: (value: KSelectOption | MultiValue<KSelectOption> | undefined) => {},
|
|
57
69
|
placeholder: "Placeholder...",
|
|
58
70
|
rightIcon: TracksIcon,
|
|
59
71
|
width: 250,
|
|
@@ -71,7 +83,7 @@ KDropdownRightIcon.args = {
|
|
|
71
83
|
|
|
72
84
|
export const KDropdownLeftRightIcon = Template.bind({})
|
|
73
85
|
KDropdownLeftRightIcon.args = {
|
|
74
|
-
onSelect: (value: KSelectOption | MultiValue<KSelectOption>) => {},
|
|
86
|
+
onSelect: (value: KSelectOption | MultiValue<KSelectOption> | undefined) => {},
|
|
75
87
|
placeholder: "Placeholder...",
|
|
76
88
|
leftIcon: TracksIcon,
|
|
77
89
|
rightIcon: TracksIcon
|
|
@@ -17,8 +17,9 @@ export interface KSelectOption {
|
|
|
17
17
|
|
|
18
18
|
export interface KDropdownProps {
|
|
19
19
|
defaultValue?: KSelectOption | MultiValue<KSelectOption>
|
|
20
|
+
defaultValuePrimitive?: string | number
|
|
20
21
|
selected?: KSelectOption | MultiValue<KSelectOption>
|
|
21
|
-
onSelect: (selected: KSelectOption | MultiValue<KSelectOption>) => void
|
|
22
|
+
onSelect: (selected: KSelectOption | MultiValue<KSelectOption> | undefined) => void
|
|
22
23
|
options: KSelectOption[]
|
|
23
24
|
width?: number
|
|
24
25
|
height?: number
|
|
@@ -36,6 +37,8 @@ export interface KDropdownProps {
|
|
|
36
37
|
padding?: string
|
|
37
38
|
gap?: string
|
|
38
39
|
hideChosenOptionIcon?: boolean
|
|
40
|
+
isClearable?: boolean
|
|
41
|
+
isEllipsis?: boolean
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
const KDropdown: React.FC<KDropdownProps> = (props) => {
|
|
@@ -60,6 +63,15 @@ const KDropdown: React.FC<KDropdownProps> = (props) => {
|
|
|
60
63
|
const padding = props.padding || "8px"
|
|
61
64
|
const gap = props.gap || "4px"
|
|
62
65
|
const hideIcon = props.hideChosenOptionIcon || false
|
|
66
|
+
const isClearable = props.isClearable || false
|
|
67
|
+
const isEllipsis = props.isEllipsis || false
|
|
68
|
+
|
|
69
|
+
let defaultValue = props.defaultValue
|
|
70
|
+
if (!defaultValue && props.defaultValuePrimitive) {
|
|
71
|
+
defaultValue = props.options.find(
|
|
72
|
+
(option) => option.value === props.defaultValuePrimitive || option.value2 === props.defaultValuePrimitive
|
|
73
|
+
)
|
|
74
|
+
}
|
|
63
75
|
|
|
64
76
|
const customFilterOption = (option: FilterOptionOption<KSelectOption>, inputValue: string) => {
|
|
65
77
|
return option.data.label.toLocaleLowerCase("en").includes(inputValue.toLocaleLowerCase("en"))
|
|
@@ -87,13 +99,14 @@ const KDropdown: React.FC<KDropdownProps> = (props) => {
|
|
|
87
99
|
{props.leftIcon && <img src={props.leftIcon} width={20} alt={"l-icon"} />}
|
|
88
100
|
|
|
89
101
|
<Select
|
|
90
|
-
defaultValue={
|
|
102
|
+
defaultValue={defaultValue}
|
|
91
103
|
isMulti={isMulti}
|
|
92
104
|
name={props.label || ""}
|
|
93
105
|
placeholder={props.placeholder || ""}
|
|
94
106
|
options={props.options}
|
|
95
107
|
className={"k-dropdown"}
|
|
96
108
|
filterOption={customFilterOption}
|
|
109
|
+
isClearable={isClearable}
|
|
97
110
|
styles={{
|
|
98
111
|
control: (baseStyles, state) => ({
|
|
99
112
|
...baseStyles,
|
|
@@ -149,20 +162,28 @@ const KDropdown: React.FC<KDropdownProps> = (props) => {
|
|
|
149
162
|
placeholder: (base) => ({
|
|
150
163
|
...base,
|
|
151
164
|
margin: 0
|
|
165
|
+
}),
|
|
166
|
+
clearIndicator: (base) => ({
|
|
167
|
+
...base,
|
|
168
|
+
padding: 0
|
|
152
169
|
})
|
|
153
170
|
}}
|
|
154
171
|
components={{
|
|
155
172
|
IndicatorSeparator: () => null,
|
|
156
173
|
DropdownIndicator: () => null,
|
|
157
174
|
SingleValue: ({ data, ...props }) => (
|
|
158
|
-
<div className=
|
|
175
|
+
<div className={`flex ${isEllipsis ? "w-full" : ""}`} style={{ position: "absolute" }}>
|
|
159
176
|
{data.icon && !hideIcon && <img src={data.icon} className="mr-2" width={20} alt={"data-icon"} />}
|
|
160
|
-
<KSpan text={data.label} color="#111" />
|
|
177
|
+
<KSpan text={data.label} color="#111" ellipsis={isEllipsis} />
|
|
161
178
|
</div>
|
|
162
179
|
)
|
|
163
180
|
}}
|
|
164
181
|
onChange={(event) => {
|
|
165
182
|
if (!event) {
|
|
183
|
+
if (props.isClearable) {
|
|
184
|
+
setSelectedOption(undefined)
|
|
185
|
+
props.onSelect(undefined)
|
|
186
|
+
}
|
|
166
187
|
return
|
|
167
188
|
}
|
|
168
189
|
setSelectedOption(event)
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
.react-calendar {
|
|
2
|
+
width: 350px;
|
|
3
|
+
max-width: 100%;
|
|
4
|
+
background: white;
|
|
5
|
+
border: 1px solid #E7E7E7;
|
|
6
|
+
font-family: Inter;
|
|
7
|
+
line-height: 1.125em;
|
|
8
|
+
border-top-left-radius: 16px;
|
|
9
|
+
border-top-right-radius: 16px;
|
|
10
|
+
padding: 20px;
|
|
11
|
+
font-size: 14px;
|
|
12
|
+
color: #1F1F1F;
|
|
13
|
+
font-weight: 500;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.react-calendar--doubleView {
|
|
17
|
+
width: 700px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.react-calendar--doubleView .react-calendar__viewContainer {
|
|
21
|
+
display: flex;
|
|
22
|
+
margin: -0.5em;
|
|
23
|
+
border-radius: 16px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.react-calendar--doubleView .react-calendar__viewContainer>* {
|
|
27
|
+
width: 50%;
|
|
28
|
+
margin: 0.5em;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.react-calendar,
|
|
32
|
+
.react-calendar *,
|
|
33
|
+
.react-calendar *:before,
|
|
34
|
+
.react-calendar *:after {
|
|
35
|
+
-moz-box-sizing: border-box;
|
|
36
|
+
-webkit-box-sizing: border-box;
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.react-calendar button {
|
|
41
|
+
margin: 0;
|
|
42
|
+
border: 0;
|
|
43
|
+
outline: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.react-calendar button:enabled:hover {
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.react-calendar__navigation {
|
|
51
|
+
display: flex;
|
|
52
|
+
height: 36px;
|
|
53
|
+
align-items: center;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.react-calendar__navigation button {
|
|
57
|
+
width: 44px;
|
|
58
|
+
color: #111;
|
|
59
|
+
font-weight: 500;
|
|
60
|
+
line-height: 24px;
|
|
61
|
+
letter-spacing: -0.176px;
|
|
62
|
+
background: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
.react-calendar__navigation button:disabled {
|
|
67
|
+
background-color: #f0f0f0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.react-calendar__navigation button:enabled:hover,
|
|
71
|
+
.react-calendar__navigation button:enabled:focus {
|
|
72
|
+
background-color: #F0F0F0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.react-calendar__month-view__weekdays {
|
|
76
|
+
text-align: center;
|
|
77
|
+
text-transform: uppercase;
|
|
78
|
+
font: inherit;
|
|
79
|
+
font-size: 0.75em;
|
|
80
|
+
font-weight: bold;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.react-calendar__month-view__weekdays__weekday {
|
|
84
|
+
font-family: Inter;
|
|
85
|
+
font-size: 14px;
|
|
86
|
+
font-style: normal;
|
|
87
|
+
font-weight: 500;
|
|
88
|
+
line-height: 20px;
|
|
89
|
+
letter-spacing: -0.084px;
|
|
90
|
+
width: 40px;
|
|
91
|
+
height: 40px;
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.react-calendar__month-view__weekNumbers .react-calendar__tile {
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
font: inherit;
|
|
102
|
+
font-size: 0.75em;
|
|
103
|
+
font-weight: bold;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.react-calendar__month-view__days {
|
|
107
|
+
justify-content: space-between;
|
|
108
|
+
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.react-calendar__month-view__days__day {
|
|
112
|
+
flex-basis: auto !important;
|
|
113
|
+
border-radius: 20px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.react-calendar__month-view__days__day--weekend {
|
|
117
|
+
font-size: 14px;
|
|
118
|
+
font-style: normal;
|
|
119
|
+
font-weight: 500;
|
|
120
|
+
line-height: 20px;
|
|
121
|
+
/* 142.857% */
|
|
122
|
+
letter-spacing: -0.084px;
|
|
123
|
+
color: #1F1F1F;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.react-calendar__month-view__days__day--neighboringMonth,
|
|
127
|
+
.react-calendar__decade-view__years__year--neighboringDecade,
|
|
128
|
+
.react-calendar__century-view__decades__decade--neighboringCentury {
|
|
129
|
+
color: #D6D6D6;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.react-calendar__year-view .react-calendar__tile,
|
|
133
|
+
.react-calendar__decade-view .react-calendar__tile,
|
|
134
|
+
.react-calendar__century-view .react-calendar__tile {
|
|
135
|
+
padding: 0;
|
|
136
|
+
/*old value : 2em 0.5em*/
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.react-calendar__navigation__arrow {
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
justify-content: center;
|
|
143
|
+
width: 24px !important;
|
|
144
|
+
height: 24px;
|
|
145
|
+
border-radius: 12px;
|
|
146
|
+
;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.react-calendar__tile {
|
|
150
|
+
height: 40px;
|
|
151
|
+
width: 40px !important;
|
|
152
|
+
background: none;
|
|
153
|
+
text-align: center;
|
|
154
|
+
font: inherit;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.react-calendar__tile:disabled {
|
|
158
|
+
background-color: #f0f0f0;
|
|
159
|
+
color: #ababab;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.react-calendar__month-view__days__day--neighboringMonth:disabled,
|
|
163
|
+
.react-calendar__decade-view__years__year--neighboringDecade:disabled,
|
|
164
|
+
.react-calendar__century-view__decades__decade--neighboringCentury:disabled {
|
|
165
|
+
color: #cdcdcd;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.react-calendar__tile:enabled:hover,
|
|
169
|
+
.react-calendar__tile:enabled:focus {
|
|
170
|
+
background-color: #F0F0F0;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.react-calendar__tile--now {
|
|
174
|
+
background: #F2FE67
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.react-calendar__tile--now:enabled:hover,
|
|
178
|
+
.react-calendar__tile--now:enabled:focus {
|
|
179
|
+
background: #ffffa9;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.react-calendar__tile--hasActive {
|
|
183
|
+
background: #111111;
|
|
184
|
+
/*76baff*/
|
|
185
|
+
color: #FFFFFF;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.react-calendar__tile--hasActive:enabled:hover,
|
|
189
|
+
.react-calendar__tile--hasActive:enabled:focus {
|
|
190
|
+
background: #111111;
|
|
191
|
+
/*old value: #a9d4ff*/
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.react-calendar__tile--active {
|
|
195
|
+
background: #111;
|
|
196
|
+
color: white;
|
|
197
|
+
border-radius: 999px;
|
|
198
|
+
height: 40px;
|
|
199
|
+
width: 40px !important;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.react-calendar__tile--active:enabled:hover,
|
|
203
|
+
.react-calendar__tile--active:enabled:focus {
|
|
204
|
+
background: #111111;
|
|
205
|
+
/*old value: 1087ff*/
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.react-calendar--selectRange .react-calendar__tile--hover {
|
|
209
|
+
background-color: #F0F0F0;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.react-calendar__month-view__weekdays__weekday {
|
|
213
|
+
text-decoration: none !important;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.react-calendar__month-view__weekdays__weekday--weekend {
|
|
217
|
+
text-decoration: none;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
abbr:where([title]) {
|
|
221
|
+
text-decoration: none !important;
|
|
222
|
+
color: #3D3D3D;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.react-calendar__navigation__label__labelText {
|
|
226
|
+
color: #111;
|
|
227
|
+
font-size: 16px;
|
|
228
|
+
font-weight: 500 !important;
|
|
229
|
+
line-height: 24px;
|
|
230
|
+
letter-spacing: -0.176px;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.react-calendar__year-view__months__month {
|
|
234
|
+
padding: 0 !important;
|
|
235
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Meta, StoryFn } from "@storybook/react"
|
|
2
|
+
import KSelectDate, { KSelectDateProps } from "./KSelectDate"
|
|
3
|
+
import { useEffect, useState } from "react"
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "ReactComponentLibrary/KSelectDate",
|
|
7
|
+
component: KSelectDate,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "centered"
|
|
10
|
+
}
|
|
11
|
+
} as Meta<typeof KSelectDate>
|
|
12
|
+
|
|
13
|
+
const KSelectDateWrapper: React.FC<KSelectDateProps> = (args) => {
|
|
14
|
+
|
|
15
|
+
const [selectedDate, setSelectedDate] = useState<Date | undefined>(undefined)
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
console.log("selectedDate: ", selectedDate)
|
|
18
|
+
}, [selectedDate])
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<KSelectDate
|
|
22
|
+
{...args}
|
|
23
|
+
value={selectedDate}
|
|
24
|
+
onChange={(date) => {
|
|
25
|
+
console.log("date: ", date)
|
|
26
|
+
if (date) {
|
|
27
|
+
setSelectedDate(date)
|
|
28
|
+
console.log("updating is completed: ", date)
|
|
29
|
+
console.log("updating is completed date.toISOString(): ", date?.toISOString())
|
|
30
|
+
} else {
|
|
31
|
+
setSelectedDate(undefined)
|
|
32
|
+
console.log("Deleting is completed")
|
|
33
|
+
}
|
|
34
|
+
}}
|
|
35
|
+
/>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const Template: StoryFn<typeof KSelectDateWrapper> = (args) => <KSelectDateWrapper {...args} />
|
|
40
|
+
|
|
41
|
+
export const KSelectDatePrimary = Template.bind({})
|
|
42
|
+
KSelectDatePrimary.args = {
|
|
43
|
+
value: undefined,
|
|
44
|
+
onChange: (value) => {
|
|
45
|
+
if (value) {
|
|
46
|
+
console.log("value is updated using this value:", value)
|
|
47
|
+
} else {
|
|
48
|
+
console.log("value is deleted, because it is: ", value)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const KSelectDateHoverText = Template.bind({})
|
|
54
|
+
KSelectDateHoverText.args = {}
|