lucentia-ui 1.2.0 → 1.4.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/components/Calendar/ArrowLeftIcon.d.ts +8 -0
- package/dist/components/Calendar/ArrowLeftIcon.js +5 -0
- package/dist/components/Calendar/ArrowRightIcon.d.ts +8 -0
- package/dist/components/Calendar/ArrowRightIcon.js +5 -0
- package/dist/components/Calendar/Calendar.d.ts +6 -0
- package/dist/components/Calendar/Calendar.js +48 -0
- package/dist/components/Calendar/Calendar.module.css +75 -0
- package/dist/components/Calendar/index.d.ts +2 -0
- package/dist/components/Calendar/index.js +1 -0
- package/dist/components/Calendar/types.d.ts +6 -0
- package/dist/components/Calendar/types.js +1 -0
- package/dist/components/Chart/BarChart/Bar.d.ts +11 -0
- package/dist/components/Chart/BarChart/Bar.js +4 -0
- package/dist/components/Chart/BarChart/Bar.module.css +0 -0
- package/dist/components/Chart/BarChart/BarChart.d.ts +2 -0
- package/dist/components/Chart/BarChart/BarChart.js +22 -0
- package/dist/components/Chart/BarChart/BarSeries.d.ts +10 -0
- package/dist/components/Chart/BarChart/BarSeries.js +27 -0
- package/dist/components/Chart/BarChart/types.d.ts +10 -0
- package/dist/components/Chart/BarChart/types.js +1 -0
- package/dist/components/Chart/BarChart/utils.d.ts +3 -0
- package/dist/components/Chart/BarChart/utils.js +26 -0
- package/dist/components/Chart/ChartAxis.d.ts +6 -0
- package/dist/components/Chart/ChartAxis.js +6 -0
- package/dist/components/Chart/ChartContainer.d.ts +11 -0
- package/dist/components/Chart/ChartContainer.js +22 -0
- package/dist/components/Chart/ChartContainer.module.css +51 -0
- package/dist/components/Chart/ChartContext.d.ts +7 -0
- package/dist/components/Chart/ChartContext.js +9 -0
- package/dist/components/Chart/ChartGrid.d.ts +6 -0
- package/dist/components/Chart/ChartGrid.js +19 -0
- package/dist/components/Chart/ChartLegend.d.ts +9 -0
- package/dist/components/Chart/ChartLegend.js +19 -0
- package/dist/components/Chart/ChartTooltip.d.ts +8 -0
- package/dist/components/Chart/ChartTooltip.js +35 -0
- package/dist/components/Chart/ChartXAxis.d.ts +5 -0
- package/dist/components/Chart/ChartXAxis.js +16 -0
- package/dist/components/Chart/ChartYAxis.d.ts +6 -0
- package/dist/components/Chart/ChartYAxis.js +11 -0
- package/dist/components/Chart/LineChart/LineChart.d.ts +2 -0
- package/dist/components/Chart/LineChart/LineChart.js +27 -0
- package/dist/components/Chart/LineChart/LinePath.d.ts +9 -0
- package/dist/components/Chart/LineChart/LinePath.js +7 -0
- package/dist/components/Chart/LineChart/LinePoint.d.ts +9 -0
- package/dist/components/Chart/LineChart/LinePoint.js +4 -0
- package/dist/components/Chart/LineChart/LineSeries.d.ts +9 -0
- package/dist/components/Chart/LineChart/LineSeries.js +24 -0
- package/dist/components/Chart/LineChart/types.d.ts +9 -0
- package/dist/components/Chart/LineChart/types.js +1 -0
- package/dist/components/Chart/PieChart/PieChart.d.ts +2 -0
- package/dist/components/Chart/PieChart/PieChart.js +9 -0
- package/dist/components/Chart/PieChart/PieSeries.d.ts +2 -0
- package/dist/components/Chart/PieChart/PieSeries.js +40 -0
- package/dist/components/Chart/PieChart/PieSlice.d.ts +12 -0
- package/dist/components/Chart/PieChart/PieSlice.js +8 -0
- package/dist/components/Chart/PieChart/types.d.ts +18 -0
- package/dist/components/Chart/PieChart/types.js +1 -0
- package/dist/components/Chart/PieChart/utils.d.ts +5 -0
- package/dist/components/Chart/PieChart/utils.js +27 -0
- package/dist/components/Chart/RadarChart/RadarAxis.d.ts +4 -0
- package/dist/components/Chart/RadarChart/RadarAxis.js +16 -0
- package/dist/components/Chart/RadarChart/RadarChart.d.ts +2 -0
- package/dist/components/Chart/RadarChart/RadarChart.js +11 -0
- package/dist/components/Chart/RadarChart/RadarGrid.d.ts +5 -0
- package/dist/components/Chart/RadarChart/RadarGrid.js +20 -0
- package/dist/components/Chart/RadarChart/RadarSeries.d.ts +2 -0
- package/dist/components/Chart/RadarChart/RadarSeries.js +33 -0
- package/dist/components/Chart/RadarChart/types.d.ts +22 -0
- package/dist/components/Chart/RadarChart/types.js +1 -0
- package/dist/components/Chart/RadarChart/utils.d.ts +5 -0
- package/dist/components/Chart/RadarChart/utils.js +16 -0
- package/dist/components/Chart/index.d.ts +15 -0
- package/dist/components/Chart/index.js +18 -0
- package/dist/components/Chart/utils/getNiceTicks.d.ts +1 -0
- package/dist/components/Chart/utils/getNiceTicks.js +20 -0
- package/dist/components/DatePicker/CalendarIcon.d.ts +8 -0
- package/dist/components/DatePicker/CalendarIcon.js +5 -0
- package/dist/components/DatePicker/DatePicker.d.ts +2 -0
- package/dist/components/DatePicker/DatePicker.js +32 -0
- package/dist/components/DatePicker/DatePicker.module.css +52 -0
- package/dist/components/DatePicker/index.d.ts +2 -0
- package/dist/components/DatePicker/index.js +1 -0
- package/dist/components/DatePicker/types.d.ts +6 -0
- package/dist/components/DatePicker/types.js +1 -0
- package/dist/components/Feedback/Modal/Modal.module.css +1 -1
- package/dist/components/Feedback/Popover/Popover.d.ts +3 -0
- package/dist/components/Feedback/Popover/Popover.js +22 -0
- package/dist/components/Feedback/Popover/PopoverContent.d.ts +2 -0
- package/dist/components/Feedback/Popover/PopoverContent.js +62 -0
- package/dist/components/Feedback/Popover/PopoverTrigger.d.ts +2 -0
- package/dist/components/Feedback/Popover/PopoverTrigger.js +21 -0
- package/dist/components/Feedback/Popover/popover.module.css +14 -0
- package/dist/components/Feedback/Popover/types.d.ts +19 -0
- package/dist/components/Feedback/Popover/types.js +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -0
- package/dist/styles/tokens.css +28 -4
- package/dist/utils/date/generateCalendar.d.ts +5 -0
- package/dist/utils/date/generateCalendar.js +36 -0
- package/package.json +5 -3
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useContext, useEffect, useState } from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
import { PopoverContext } from "./Popover";
|
|
6
|
+
import styles from "./popover.module.css";
|
|
7
|
+
import { useFloating, offset, flip, shift, autoUpdate, } from "@floating-ui/react";
|
|
8
|
+
export const PopoverContent = ({ children }) => {
|
|
9
|
+
const context = useContext(PopoverContext);
|
|
10
|
+
if (!context) {
|
|
11
|
+
throw new Error("PopoverContent must be used within Popover");
|
|
12
|
+
}
|
|
13
|
+
const { open, setOpen, referenceRef } = context;
|
|
14
|
+
const [mounted, setMounted] = useState(false);
|
|
15
|
+
// SSR対策(Next.js)
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
setMounted(true);
|
|
18
|
+
}, []);
|
|
19
|
+
const { x, y, strategy, refs } = useFloating({
|
|
20
|
+
placement: "bottom-start",
|
|
21
|
+
middleware: [offset(8), flip(), shift()],
|
|
22
|
+
whileElementsMounted: autoUpdate,
|
|
23
|
+
});
|
|
24
|
+
// reference接続
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (referenceRef.current) {
|
|
27
|
+
refs.setReference(referenceRef.current);
|
|
28
|
+
}
|
|
29
|
+
}, [referenceRef, refs]);
|
|
30
|
+
// outside click + Escape
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const handleClickOutside = (event) => {
|
|
33
|
+
const target = event.target;
|
|
34
|
+
if (refs.floating.current &&
|
|
35
|
+
!refs.floating.current.contains(target) &&
|
|
36
|
+
referenceRef.current &&
|
|
37
|
+
!referenceRef.current.contains(target)) {
|
|
38
|
+
setOpen(false);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const handleKeyDown = (event) => {
|
|
42
|
+
if (event.key === "Escape") {
|
|
43
|
+
setOpen(false);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
if (open) {
|
|
47
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
48
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
49
|
+
}
|
|
50
|
+
return () => {
|
|
51
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
52
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
53
|
+
};
|
|
54
|
+
}, [open, setOpen, refs, referenceRef]);
|
|
55
|
+
if (!open || !mounted)
|
|
56
|
+
return null;
|
|
57
|
+
return createPortal(_jsx("div", { ref: refs.setFloating, className: styles.content, style: {
|
|
58
|
+
position: strategy,
|
|
59
|
+
top: y !== null && y !== void 0 ? y : 0,
|
|
60
|
+
left: x !== null && x !== void 0 ? x : 0,
|
|
61
|
+
}, children: children }), document.body);
|
|
62
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cloneElement, useContext } from "react";
|
|
4
|
+
import { PopoverContext } from "./Popover";
|
|
5
|
+
export const PopoverTrigger = ({ children, asChild }) => {
|
|
6
|
+
const context = useContext(PopoverContext);
|
|
7
|
+
if (!context) {
|
|
8
|
+
throw new Error("PopoverTrigger must be used within Popover");
|
|
9
|
+
}
|
|
10
|
+
const { open, setOpen, referenceRef } = context;
|
|
11
|
+
const handleClick = () => {
|
|
12
|
+
setOpen(!open);
|
|
13
|
+
};
|
|
14
|
+
if (asChild) {
|
|
15
|
+
return cloneElement(children, {
|
|
16
|
+
ref: referenceRef,
|
|
17
|
+
onClick: handleClick,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return (_jsx("button", { ref: referenceRef, onClick: handleClick, children: children }));
|
|
21
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode, ReactElement } from "react";
|
|
2
|
+
export type PopoverProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
open?: boolean;
|
|
5
|
+
onOpenChange?: (open: boolean) => void;
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type PopoverContextType = {
|
|
9
|
+
open: boolean;
|
|
10
|
+
setOpen: (open: boolean) => void;
|
|
11
|
+
referenceRef: React.RefObject<HTMLElement | null>;
|
|
12
|
+
};
|
|
13
|
+
export type PopoverTriggerProps = {
|
|
14
|
+
children: ReactElement;
|
|
15
|
+
asChild?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export type PopoverContentProps = {
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -12,3 +12,7 @@ export * from "./components/Typography";
|
|
|
12
12
|
export * from "./components/Select";
|
|
13
13
|
export * from "./components/Switch";
|
|
14
14
|
export * from "./components/Feedback/Modal";
|
|
15
|
+
export * from "./components/DatePicker";
|
|
16
|
+
export * from "./components/Calendar";
|
|
17
|
+
export * from "./components/Chart";
|
|
18
|
+
export * from "./components/Extra/Clock";
|
package/dist/index.js
CHANGED
|
@@ -13,3 +13,9 @@ export * from "./components/Typography";
|
|
|
13
13
|
export * from "./components/Select";
|
|
14
14
|
export * from "./components/Switch";
|
|
15
15
|
export * from "./components/Feedback/Modal";
|
|
16
|
+
export * from "./components/DatePicker";
|
|
17
|
+
export * from "./components/Calendar";
|
|
18
|
+
/* ===== Chart ===== */
|
|
19
|
+
export * from "./components/Chart";
|
|
20
|
+
/* ===== Extra ===== */
|
|
21
|
+
export * from "./components/Extra/Clock";
|
package/dist/styles/tokens.css
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
--line-tight: 1.2;
|
|
15
15
|
--line-snug: 1.35;
|
|
16
|
+
--line-normal: 1.5;
|
|
16
17
|
--line-comfort: 1.7;
|
|
17
18
|
|
|
18
19
|
--font-weight-regular: 400;
|
|
@@ -63,8 +64,19 @@
|
|
|
63
64
|
--color-surface-container: #e9efeebf;
|
|
64
65
|
|
|
65
66
|
--color-border: #bbcccc;
|
|
66
|
-
--color-scrim: rgba(129, 129, 129, 0.25);
|
|
67
67
|
|
|
68
|
+
--chart-color-1: #99cccc;
|
|
69
|
+
--chart-color-2: #66b2b2;
|
|
70
|
+
--chart-color-3: #4da6a6;
|
|
71
|
+
--chart-color-4: #339999;
|
|
72
|
+
--chart-color-5: #008b8b;
|
|
73
|
+
--chart-color-6: #007a7a;
|
|
74
|
+
--chart-color-7: #006666;
|
|
75
|
+
--chart-color-8: #005252;
|
|
76
|
+
--chart-color-9: #004545;
|
|
77
|
+
--chart-color-10: #003333;
|
|
78
|
+
|
|
79
|
+
--color-scrim: rgba(129, 129, 129, 0.25);
|
|
68
80
|
--color-shadow-l: rgba(255, 255, 255, 1);
|
|
69
81
|
--color-shadow-d: rgba(0, 0, 0, 0.2);
|
|
70
82
|
|
|
@@ -91,7 +103,8 @@
|
|
|
91
103
|
-4px -4px 16px 8px var(--color-shadow-l),
|
|
92
104
|
4px 4px 16px 8px var(--color-shadow-d);
|
|
93
105
|
|
|
94
|
-
--shadow-
|
|
106
|
+
--shadow-overlay-md: 0px 2px 8px 2px var(--color-shadow-d);
|
|
107
|
+
--shadow-overlay-lg: 0px 4px 16px 8px var(--color-shadow-d);
|
|
95
108
|
}
|
|
96
109
|
|
|
97
110
|
html[data-theme="dark"] {
|
|
@@ -116,11 +129,22 @@ html[data-theme="dark"] {
|
|
|
116
129
|
--color-surface: #1e2927bf;
|
|
117
130
|
--color-on-surface: #c3cbca;
|
|
118
131
|
--color-on-surface-variant: #dde4e380;
|
|
119
|
-
--color-surface-container: #
|
|
132
|
+
--color-surface-container: #262d2dbf;
|
|
120
133
|
|
|
121
134
|
--color-border: #889392;
|
|
122
|
-
--color-scrim: rgba(0, 0, 0, 0.25);
|
|
123
135
|
|
|
136
|
+
--chart-color-1: #80d5d4;
|
|
137
|
+
--chart-color-2: #6bc2c1;
|
|
138
|
+
--chart-color-3: #57afae;
|
|
139
|
+
--chart-color-4: #439d9c;
|
|
140
|
+
--chart-color-5: #308b8b;
|
|
141
|
+
--chart-color-6: #1c797a;
|
|
142
|
+
--chart-color-7: #09686a;
|
|
143
|
+
--chart-color-8: #005759;
|
|
144
|
+
--chart-color-9: #004749;
|
|
145
|
+
--chart-color-10: #00383a;
|
|
146
|
+
|
|
147
|
+
--color-scrim: rgba(0, 0, 0, 0.25);
|
|
124
148
|
--color-shadow-l: rgba(255, 255, 255, 0.25);
|
|
125
149
|
--color-shadow-d: rgba(0, 0, 0, 1);
|
|
126
150
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export const generateCalendar = (baseDate) => {
|
|
2
|
+
const year = baseDate.getFullYear();
|
|
3
|
+
const month = baseDate.getMonth();
|
|
4
|
+
// 月初
|
|
5
|
+
const firstDayOfMonth = new Date(year, month, 1);
|
|
6
|
+
// 月初の曜日(0=日)
|
|
7
|
+
const startDay = firstDayOfMonth.getDay();
|
|
8
|
+
// 今月の日数
|
|
9
|
+
const daysInMonth = new Date(year, month + 1, 0).getDate();
|
|
10
|
+
// 先月の日数
|
|
11
|
+
const daysInPrevMonth = new Date(year, month, 0).getDate();
|
|
12
|
+
const days = [];
|
|
13
|
+
// ① 前月
|
|
14
|
+
for (let i = startDay - 1; i >= 0; i--) {
|
|
15
|
+
days.push({
|
|
16
|
+
date: new Date(year, month - 1, daysInPrevMonth - i),
|
|
17
|
+
isCurrentMonth: false,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
// ② 当月
|
|
21
|
+
for (let i = 1; i <= daysInMonth; i++) {
|
|
22
|
+
days.push({
|
|
23
|
+
date: new Date(year, month, i),
|
|
24
|
+
isCurrentMonth: true,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
// ③ 次月
|
|
28
|
+
const remaining = 42 - days.length;
|
|
29
|
+
for (let i = 1; i <= remaining; i++) {
|
|
30
|
+
days.push({
|
|
31
|
+
date: new Date(year, month + 1, i),
|
|
32
|
+
isCurrentMonth: false,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return days;
|
|
36
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lucentia-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "React UI design token and component system based on neumorphism, featuring two color themes: light and dark.",
|
|
5
5
|
"homepage": "https://lucentia.rikiyamatsuda.com/en",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"**/*.css"
|
|
24
24
|
],
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"react": ">=18"
|
|
26
|
+
"react": ">=18",
|
|
27
|
+
"react-dom": ">=18"
|
|
27
28
|
},
|
|
28
29
|
"scripts": {
|
|
29
30
|
"build": "tsc -p tsconfig.json && npm run copy:assets",
|
|
@@ -32,9 +33,10 @@
|
|
|
32
33
|
},
|
|
33
34
|
"license": "MIT",
|
|
34
35
|
"dependencies": {
|
|
36
|
+
"@floating-ui/react": "^0.27.0",
|
|
35
37
|
"clsx": "^2.1.1"
|
|
36
38
|
},
|
|
37
39
|
"devDependencies": {
|
|
38
40
|
"cpy-cli": "^6.0.0"
|
|
39
41
|
}
|
|
40
|
-
}
|
|
42
|
+
}
|