funuicss 2.5.6 → 2.5.8
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/css/fun.css +189 -132
- package/index.d.ts +1 -0
- package/index.js +3 -1
- package/index.tsx +1 -0
- package/package.json +5 -3
- package/tsconfig.json +17 -8
- package/tsconfig.tsbuildinfo +1 -1
- package/ui/appbar/AppBar.js +24 -5
- package/ui/appbar/AppBar.tsx +24 -11
- package/ui/appbar/Hamburger.d.ts +7 -0
- package/ui/appbar/Hamburger.js +45 -0
- package/ui/appbar/Hamburger.tsx +30 -0
- package/ui/breadcrumb/BreadCrumb.js +6 -14
- package/ui/breadcrumb/BreadCrumb.tsx +5 -15
- package/ui/drop/Dropdown.d.ts +18 -0
- package/ui/drop/Dropdown.js +55 -0
- package/ui/drop/Dropdown.tsx +89 -0
|
@@ -8,12 +8,10 @@ interface BreadCrumbProps {
|
|
|
8
8
|
|
|
9
9
|
export default function BreadCrumb({ type, funcss, color }: BreadCrumbProps) {
|
|
10
10
|
return (
|
|
11
|
-
<span>
|
|
11
|
+
<span >
|
|
12
12
|
{type === 'slash' && (
|
|
13
13
|
<span
|
|
14
|
-
|
|
15
|
-
margin: '0 0.2rem',
|
|
16
|
-
}}
|
|
14
|
+
style={{lineHeight:"0"}}
|
|
17
15
|
className={` ${funcss ? funcss : ''} ${color ? 'text-' + color : ''}`}
|
|
18
16
|
>
|
|
19
17
|
{' / '}
|
|
@@ -21,32 +19,24 @@ export default function BreadCrumb({ type, funcss, color }: BreadCrumbProps) {
|
|
|
21
19
|
)}
|
|
22
20
|
{type === 'greater' && (
|
|
23
21
|
<span
|
|
24
|
-
style={{
|
|
25
|
-
margin: '0 0.2rem',
|
|
26
|
-
}}
|
|
27
22
|
className={` ${funcss ? funcss : ''} ${color ? 'text-' + color : ''}`}
|
|
28
23
|
>
|
|
29
|
-
<span className={`${color ? `text-${color}` : ''}`}>
|
|
24
|
+
<span style={{lineHeight:"0"}} className={`${color ? `text-${color}` : ''}`}>
|
|
30
25
|
<PiCaretRight />
|
|
31
26
|
</span>
|
|
32
27
|
</span>
|
|
33
28
|
)}
|
|
34
29
|
{type === 'less' && (
|
|
35
30
|
<span
|
|
36
|
-
style={{
|
|
37
|
-
margin: '0 0.2rem',
|
|
38
|
-
}}
|
|
39
31
|
className={` ${funcss ? funcss : ''} ${color ? 'text-' + color : ''}`}
|
|
40
|
-
> <span className={`${color ? `text-${color}` : ''}`}>
|
|
32
|
+
> <span style={{lineHeight:"0"}} className={`${color ? `text-${color}` : ''}`}>
|
|
41
33
|
<PiCaretLeft />
|
|
42
34
|
</span>
|
|
43
35
|
</span>
|
|
44
36
|
)}
|
|
45
37
|
{type === 'straight' && (
|
|
46
38
|
<span
|
|
47
|
-
|
|
48
|
-
margin: '0 0.2rem',
|
|
49
|
-
}}
|
|
39
|
+
style={{lineHeight:"0"}}
|
|
50
40
|
className={` ${funcss ? funcss : ''} ${color ? 'text-' + color : ''}`}
|
|
51
41
|
>
|
|
52
42
|
{' | '}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type Position = 'left' | 'right';
|
|
3
|
+
type Direction = 'dropdown' | 'dropup';
|
|
4
|
+
interface DropdownItem {
|
|
5
|
+
label: React.ReactNode;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
}
|
|
8
|
+
interface DropdownProps {
|
|
9
|
+
direction?: Direction;
|
|
10
|
+
position?: Position;
|
|
11
|
+
button: React.ReactNode;
|
|
12
|
+
items: DropdownItem[];
|
|
13
|
+
hoverable?: boolean;
|
|
14
|
+
openOnHover?: boolean;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
declare const Dropdown: React.FC<DropdownProps>;
|
|
18
|
+
export default Dropdown;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
var react_1 = __importStar(require("react"));
|
|
28
|
+
var Dropdown = function (_a) {
|
|
29
|
+
var _b = _a.direction, direction = _b === void 0 ? 'dropdown' : _b, _c = _a.position, position = _c === void 0 ? 'left' : _c, button = _a.button, items = _a.items, _d = _a.hoverable, hoverable = _d === void 0 ? true : _d, _e = _a.openOnHover, openOnHover = _e === void 0 ? true : _e, _f = _a.className, className = _f === void 0 ? '' : _f;
|
|
30
|
+
var containerRef = (0, react_1.useRef)(null);
|
|
31
|
+
var _g = (0, react_1.useState)(false), open = _g[0], setOpen = _g[1];
|
|
32
|
+
var containerClass = "".concat(direction, " ").concat(position, " ").concat(className).trim();
|
|
33
|
+
var menuClass = "drop-menu".concat(hoverable ? ' item-hoverable' : '');
|
|
34
|
+
(0, react_1.useEffect)(function () {
|
|
35
|
+
if (openOnHover)
|
|
36
|
+
return;
|
|
37
|
+
var handleClickOutside = function (event) {
|
|
38
|
+
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
39
|
+
setOpen(false);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
43
|
+
return function () { return document.removeEventListener('mousedown', handleClickOutside); };
|
|
44
|
+
}, [openOnHover]);
|
|
45
|
+
var showMenu = openOnHover || open;
|
|
46
|
+
return (react_1.default.createElement("div", { ref: containerRef, className: containerClass, onMouseEnter: function () { return openOnHover && setOpen(true); }, onMouseLeave: function () { return openOnHover && setOpen(false); } },
|
|
47
|
+
react_1.default.createElement("div", { className: "drop-button", onClick: function () { return !openOnHover && setOpen(!open); }, style: { cursor: !openOnHover ? 'pointer' : undefined } }, button),
|
|
48
|
+
react_1.default.createElement("div", { className: menuClass, style: { display: showMenu ? 'block' : 'none' } }, items.map(function (item, index) { return (react_1.default.createElement("div", { key: index, className: "drop-item", onClick: function () {
|
|
49
|
+
var _a;
|
|
50
|
+
(_a = item.onClick) === null || _a === void 0 ? void 0 : _a.call(item);
|
|
51
|
+
if (!openOnHover)
|
|
52
|
+
setOpen(false);
|
|
53
|
+
} }, item.label)); }))));
|
|
54
|
+
};
|
|
55
|
+
exports.default = Dropdown;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
4
|
+
|
|
5
|
+
type Position = 'left' | 'right';
|
|
6
|
+
type Direction = 'dropdown' | 'dropup';
|
|
7
|
+
|
|
8
|
+
interface DropdownItem {
|
|
9
|
+
label: React.ReactNode;
|
|
10
|
+
onClick?: () => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface DropdownProps {
|
|
14
|
+
direction?: Direction;
|
|
15
|
+
position?: Position;
|
|
16
|
+
button: React.ReactNode;
|
|
17
|
+
items: DropdownItem[];
|
|
18
|
+
hoverable?: boolean;
|
|
19
|
+
openOnHover?: boolean;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const Dropdown: React.FC<DropdownProps> = ({
|
|
24
|
+
direction = 'dropdown',
|
|
25
|
+
position = 'left',
|
|
26
|
+
button,
|
|
27
|
+
items,
|
|
28
|
+
hoverable = true,
|
|
29
|
+
openOnHover = true,
|
|
30
|
+
className = '',
|
|
31
|
+
}) => {
|
|
32
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
33
|
+
const [open, setOpen] = useState(false);
|
|
34
|
+
|
|
35
|
+
const containerClass = `${direction} ${position} ${className}`.trim();
|
|
36
|
+
const menuClass = `drop-menu${hoverable ? ' item-hoverable' : ''}`;
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (openOnHover) return;
|
|
40
|
+
|
|
41
|
+
const handleClickOutside = (event: MouseEvent) => {
|
|
42
|
+
if (containerRef.current && !containerRef.current.contains(event.target as Node)) {
|
|
43
|
+
setOpen(false);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
48
|
+
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
49
|
+
}, [openOnHover]);
|
|
50
|
+
|
|
51
|
+
const showMenu = openOnHover || open;
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<div
|
|
55
|
+
ref={containerRef}
|
|
56
|
+
className={containerClass}
|
|
57
|
+
onMouseEnter={() => openOnHover && setOpen(true)}
|
|
58
|
+
onMouseLeave={() => openOnHover && setOpen(false)}
|
|
59
|
+
>
|
|
60
|
+
<div
|
|
61
|
+
className="drop-button"
|
|
62
|
+
onClick={() => !openOnHover && setOpen(!open)}
|
|
63
|
+
style={{ cursor: !openOnHover ? 'pointer' : undefined }}
|
|
64
|
+
>
|
|
65
|
+
{button}
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<div
|
|
69
|
+
className={menuClass}
|
|
70
|
+
style={{ display: showMenu ? 'block' : 'none' }}
|
|
71
|
+
>
|
|
72
|
+
{items.map((item, index) => (
|
|
73
|
+
<div
|
|
74
|
+
key={index}
|
|
75
|
+
className="drop-item"
|
|
76
|
+
onClick={() => {
|
|
77
|
+
item.onClick?.();
|
|
78
|
+
if (!openOnHover) setOpen(false);
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
{item.label}
|
|
82
|
+
</div>
|
|
83
|
+
))}
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export default Dropdown;
|