@bouku/core 0.0.2 → 0.0.3
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/assets/icons/chevron-up.svg +6 -0
- package/dist/components/accordion/index.d.ts +6 -0
- package/dist/components/accordion/index.js +12 -0
- package/dist/components/accordion/tab.d.ts +4 -0
- package/dist/components/accordion/tab.js +35 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -7
- package/package.json +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" width="1em" height="1em">
|
|
2
|
+
<path
|
|
3
|
+
d="M297.4 169.4C309.9 156.9 330.2 156.9 342.7 169.4L534.7 361.4C547.2 373.9 547.2 394.2 534.7 406.7C522.2 419.2 501.9 419.2 489.4 406.7L320 237.3L150.6 406.6C138.1 419.1 117.8 419.1 105.3 406.6C92.8 394.1 92.8 373.8 105.3 361.3L297.3 169.3z"
|
|
4
|
+
fill="currentColor"
|
|
5
|
+
/>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Accordion = Accordion;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const flex_1 = require("../layout/flex");
|
|
8
|
+
const tab_1 = require("./tab");
|
|
9
|
+
function Accordion({ items }) {
|
|
10
|
+
const [activeItem, setActiveItem] = (0, react_1.useState)(0);
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(flex_1.ColumnBox, { style: "gap-5 overflow-y-auto scrollbar-none", children: items.map(({ label, content }, i) => ((0, jsx_runtime_1.jsxs)(flex_1.ColumnBox, { style: "gap-5", children: [(0, jsx_runtime_1.jsx)("div", { onClick: () => setActiveItem(i === activeItem ? null : i), children: (0, jsx_runtime_1.jsx)(tab_1.SectionHeader, { isActive: i === activeItem, label: label }) }), i === activeItem && ((0, jsx_runtime_1.jsx)(flex_1.RowBox, { style: "w-full", center: true, children: content }))] }, i))) }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.SectionHeader = SectionHeader;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const chevron_up_svg_1 = __importDefault(require("@/assets/icons/chevron-up.svg"));
|
|
10
|
+
const tailwind_variants_1 = require("tailwind-variants");
|
|
11
|
+
function SectionHeader({ isActive, label }) {
|
|
12
|
+
const s = getStyles({ isActive });
|
|
13
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: s.container(), children: [(0, jsx_runtime_1.jsx)("span", { className: s.label(), children: label }), (0, jsx_runtime_1.jsx)(chevron_up_svg_1.default, { className: s.chevron() })] }));
|
|
14
|
+
}
|
|
15
|
+
const getStyles = (0, tailwind_variants_1.tv)({
|
|
16
|
+
slots: {
|
|
17
|
+
container: "flex justify-between items-center gap-8 px-3 py-2 border rounded duration-200 cursor-pointer",
|
|
18
|
+
label: "font-bold",
|
|
19
|
+
chevron: "duration-200"
|
|
20
|
+
},
|
|
21
|
+
variants: {
|
|
22
|
+
isActive: {
|
|
23
|
+
true: {
|
|
24
|
+
container: "bg-surface-light border-border-light",
|
|
25
|
+
label: "text-primary",
|
|
26
|
+
chevron: "text-accent rotate-180"
|
|
27
|
+
},
|
|
28
|
+
false: {
|
|
29
|
+
container: "bg-surface hover:bg-surface-light border-border",
|
|
30
|
+
label: "text-primary-dark",
|
|
31
|
+
chevron: "text-primary-dark"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
package/dist/components/index.js
CHANGED
|
@@ -18,6 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.Dropdown = exports.Section = exports.Pagination = exports.AbsoluteBox = exports.FadeBox = exports.Separator = void 0;
|
|
21
|
+
__exportStar(require("./accordion"), exports);
|
|
21
22
|
var separator_1 = require("./layout/separator");
|
|
22
23
|
Object.defineProperty(exports, "Separator", { enumerable: true, get: function () { return __importDefault(separator_1).default; } });
|
|
23
24
|
var fade_1 = require("./layout/fade");
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,12 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.mountApp = mountApp;
|
|
18
|
-
const client_1 = require("react-dom/client");
|
|
19
17
|
__exportStar(require("./components"), exports);
|
|
20
18
|
__exportStar(require("./utils"), exports);
|
|
21
|
-
function mountApp(app) {
|
|
22
|
-
const element = document.getElementById("root");
|
|
23
|
-
const root = (0, client_1.createRoot)(element);
|
|
24
|
-
root.render(app);
|
|
25
|
-
}
|