@bccampus/ui-components 0.4.2 → 0.5.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/_chunks/CompositeDataItem.js +204 -0
- package/dist/_chunks/createLucideIcon.js +103 -0
- package/dist/_chunks/index.js +125 -0
- package/dist/_chunks/index2.js +44 -0
- package/dist/_chunks/index3.js +533 -0
- package/dist/{utils-CRiPKpXj.js → _chunks/utils.js} +754 -526
- package/dist/components/index.d.ts +16 -0
- package/dist/components/index.js +84 -0
- package/dist/components/ui/banner.d.ts +10 -0
- package/dist/components/ui/banner.js +45 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/{button.js → components/ui/button.js} +11 -10
- package/dist/components/ui/card.d.ts +27 -0
- package/dist/components/ui/card.js +109 -0
- package/dist/components/ui/composite/CompositeData.d.ts +20 -0
- package/dist/components/ui/composite/CompositeData.js +89 -0
- package/dist/components/ui/composite/CompositeDataItem.d.ts +28 -0
- package/dist/components/ui/composite/CompositeDataItem.js +5 -0
- package/dist/components/ui/composite/FocusProvider/AbstractFocusProvider.d.ts +41 -0
- package/dist/components/ui/composite/FocusProvider/AbstractFocusProvider.js +35 -0
- package/dist/components/ui/composite/FocusProvider/ListboxFocusProvider.d.ts +16 -0
- package/dist/components/ui/composite/FocusProvider/ListboxFocusProvider.js +67 -0
- package/dist/components/ui/composite/FocusProvider/index.d.ts +2 -0
- package/dist/components/ui/composite/FocusProvider/index.js +6 -0
- package/dist/components/ui/composite/SelectionProvider/AbstractSelectionProvider.d.ts +23 -0
- package/dist/components/ui/composite/SelectionProvider/AbstractSelectionProvider.js +20 -0
- package/dist/components/ui/composite/SelectionProvider/MultipleSelectionProvider.d.ts +9 -0
- package/dist/components/ui/composite/SelectionProvider/MultipleSelectionProvider.js +20 -0
- package/dist/components/ui/composite/SelectionProvider/SingleSelectionProvider.d.ts +9 -0
- package/dist/components/ui/composite/SelectionProvider/SingleSelectionProvider.js +25 -0
- package/dist/components/ui/composite/SelectionProvider/index.d.ts +3 -0
- package/dist/components/ui/composite/SelectionProvider/index.js +8 -0
- package/dist/components/ui/composite/composite-component-item.d.ts +2 -0
- package/dist/components/ui/composite/composite-component-item.js +74 -0
- package/dist/components/ui/composite/composite-component.d.ts +2 -0
- package/dist/components/ui/composite/composite-component.js +66 -0
- package/dist/components/ui/composite/index.d.ts +7 -0
- package/dist/components/ui/composite/index.js +22 -0
- package/dist/components/ui/composite/listbox.d.ts +2 -0
- package/dist/components/ui/composite/listbox.js +58 -0
- package/dist/components/ui/composite/types.d.ts +82 -0
- package/dist/components/ui/composite/types.js +1 -0
- package/dist/components/ui/horizontal-list.d.ts +10 -0
- package/dist/components/ui/horizontal-list.js +82 -0
- package/dist/components/ui/icon-generator/generate-tiles.d.ts +4 -0
- package/dist/components/ui/icon-generator/generate-tiles.js +223 -0
- package/dist/components/ui/icon-generator/icon-generator.d.ts +3 -0
- package/dist/components/ui/icon-generator/icon-generator.js +82 -0
- package/dist/components/ui/icon-generator/index.d.ts +4 -0
- package/dist/components/ui/icon-generator/index.js +11 -0
- package/dist/components/ui/icon-generator/masked-image-generator.d.ts +3 -0
- package/dist/components/ui/icon-generator/masked-image-generator.js +31 -0
- package/dist/{masked-image-generator.d.ts → components/ui/icon-generator/types.d.ts} +48 -58
- package/dist/components/ui/icon-generator/types.js +30 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/{input.js → components/ui/input.js} +8 -8
- package/dist/components/ui/navigation-menu.d.ts +16 -0
- package/dist/components/ui/navigation-menu.js +1041 -0
- package/dist/components/ui/overlay.d.ts +7 -0
- package/dist/{overlay.js → components/ui/overlay.js} +7 -7
- package/dist/components/ui/page-header.d.ts +5 -0
- package/dist/{page-header.js → components/ui/page-header.js} +189 -181
- package/dist/components/ui/page-section.d.ts +8 -0
- package/dist/{page-section.js → components/ui/page-section.js} +7 -7
- package/dist/components/ui/page.d.ts +3 -0
- package/dist/components/ui/page.js +8 -0
- package/dist/components/ui/popover.d.ts +7 -0
- package/dist/components/ui/popover.js +3532 -0
- package/dist/components/ui/search-input.d.ts +3 -0
- package/dist/components/ui/search-input.js +24 -0
- package/dist/components/ui/tag.d.ts +10 -0
- package/dist/{tag.js → components/ui/tag.js} +10 -9
- package/dist/components/ui/typography/caption.d.ts +8 -0
- package/dist/components/ui/typography/caption.js +28 -0
- package/dist/components/ui/typography/index.d.ts +1 -0
- package/dist/components/ui/typography/index.js +5 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +9 -0
- package/dist/hooks/use-effect-after-mount.d.ts +2 -0
- package/dist/hooks/use-effect-after-mount.js +24 -0
- package/dist/hooks/use-id.d.ts +1 -0
- package/dist/hooks/use-id.js +7 -0
- package/dist/hooks/use-keyboard-event.d.ts +59 -0
- package/dist/hooks/use-keyboard-event.js +52 -0
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.js +16 -0
- package/dist/lib/object.d.ts +5 -0
- package/dist/lib/object.js +38 -0
- package/dist/lib/set-operations.d.ts +5 -0
- package/dist/lib/set-operations.js +51 -0
- package/dist/{utils.d.ts → lib/utils.d.ts} +2 -5
- package/dist/lib/utils.js +4 -0
- package/package.json +9 -76
- package/src/components/index.ts +17 -0
- package/src/components/ui/composite/FocusProvider/index.ts +2 -0
- package/src/components/ui/composite/SelectionProvider/MultipleSelectionProvider.ts +1 -1
- package/src/components/ui/composite/SelectionProvider/index.ts +3 -0
- package/src/components/ui/composite/index.ts +5 -5
- package/src/components/ui/icon-generator/index.ts +2 -0
- package/src/components/ui/typography/index.ts +1 -0
- package/src/hooks/index.ts +3 -0
- package/src/index.ts +3 -0
- package/src/lib/index.ts +3 -0
- package/tsconfig.lib.json +44 -0
- package/vite.config.ts +28 -31
- package/dist/AbstractFocusProvider-CxvlcEki.js +0 -29
- package/dist/AbstractSelectionProvider-BtaROstC.js +0 -30
- package/dist/CompositeDataItem-DuHOHCWy.js +0 -158
- package/dist/ListboxFocusProvider.d.ts +0 -149
- package/dist/ListboxFocusProvider.js +0 -53
- package/dist/MultipleSelectionProvider.d.ts +0 -141
- package/dist/MultipleSelectionProvider.js +0 -19
- package/dist/SingleSelectionProvider.d.ts +0 -141
- package/dist/SingleSelectionProvider.js +0 -23
- package/dist/banner.d.ts +0 -16
- package/dist/banner.js +0 -42
- package/dist/button.d.ts +0 -17
- package/dist/caption.d.ts +0 -13
- package/dist/caption.js +0 -27
- package/dist/card.d.ts +0 -46
- package/dist/card.js +0 -108
- package/dist/composite-component-DSUbd1XS.js +0 -122
- package/dist/composite.d.ts +0 -208
- package/dist/composite.js +0 -82
- package/dist/createLucideIcon-CzehbSja.js +0 -94
- package/dist/generate-tiles-DuagGD1d.js +0 -244
- package/dist/generate-tiles.d.ts +0 -43
- package/dist/generate-tiles.js +0 -7
- package/dist/horizontal-list.d.ts +0 -16
- package/dist/horizontal-list.js +0 -77
- package/dist/icon-generator-tuhuqdpL.js +0 -76
- package/dist/icon-generator.d.ts +0 -58
- package/dist/icon-generator.js +0 -6
- package/dist/index-CQhYMnjT.js +0 -34
- package/dist/index-U7DVCmS_.js +0 -76
- package/dist/input.d.ts +0 -7
- package/dist/listbox.d.ts +0 -171
- package/dist/listbox.js +0 -76
- package/dist/masked-image-generator.js +0 -29
- package/dist/navigation-menu.d.ts +0 -27
- package/dist/navigation-menu.js +0 -1139
- package/dist/overlay.d.ts +0 -13
- package/dist/page-header.d.ts +0 -9
- package/dist/page-section.d.ts +0 -14
- package/dist/page.d.ts +0 -7
- package/dist/page.js +0 -8
- package/dist/search-input.d.ts +0 -7
- package/dist/search-input.js +0 -23
- package/dist/tag.d.ts +0 -16
- package/dist/ui-components.d.ts +0 -215
- package/dist/ui-components.js +0 -54
- package/dist/utils.js +0 -4
- package/src/assets/icons/icon_01.svg +0 -6
- package/src/assets/icons/icon_02.svg +0 -6
- package/src/assets/icons/icon_03.svg +0 -6
- package/src/assets/icons/icon_04.svg +0 -6
- package/src/assets/icons/icon_05.svg +0 -4
- package/src/assets/icons/icon_06.svg +0 -4
- package/src/assets/images/image_01.jpg +0 -0
- package/src/assets/images/image_02.jpg +0 -0
- package/src/assets/images/image_03.webp +0 -0
- package/src/assets/images/image_04.png +0 -0
- package/src/assets/images/image_05.jpg +0 -0
- package/src/assets/images/image_06.jpg +0 -0
- package/src/components/ui/index.ts +0 -15
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c as cn } from "../../_chunks/utils.js";
|
|
3
|
+
import { Input } from "./input.js";
|
|
4
|
+
import { c as createLucideIcon } from "../../_chunks/createLucideIcon.js";
|
|
5
|
+
/**
|
|
6
|
+
* @license lucide-react v0.544.0 - ISC
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the ISC license.
|
|
9
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/
|
|
11
|
+
const __iconNode = [
|
|
12
|
+
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
13
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
14
|
+
];
|
|
15
|
+
const Search = createLucideIcon("search", __iconNode);
|
|
16
|
+
function SearchInput({ className, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
|
|
18
|
+
/* @__PURE__ */ jsx(Input, { ...props }),
|
|
19
|
+
/* @__PURE__ */ jsx(Search, { className: "absolute size-4 top-1/2 right-3 -translate-y-1/2 pointer-events-none text-primary" })
|
|
20
|
+
] });
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
SearchInput
|
|
24
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
declare const tagVariants: (props?: ({
|
|
3
|
+
variant?: "button" | "default" | null | undefined;
|
|
4
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/dist/types').ClassProp) | undefined) => string;
|
|
6
|
+
export interface TagProps extends VariantProps<typeof tagVariants>, React.ComponentProps<"div"> {
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare function Tag({ className, size, variant, asChild, ...props }: TagProps): import("react").JSX.Element;
|
|
10
|
+
export { Tag, tagVariants };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { S as
|
|
3
|
-
import { c as
|
|
4
|
-
import { c as
|
|
5
|
-
const
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { S as Slot } from "../../_chunks/index.js";
|
|
3
|
+
import { c as cva } from "../../_chunks/index2.js";
|
|
4
|
+
import { c as cn } from "../../_chunks/utils.js";
|
|
5
|
+
const tagVariants = cva(
|
|
6
6
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm bg-complement-3 text-white [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0",
|
|
7
7
|
{
|
|
8
8
|
variants: {
|
|
@@ -23,10 +23,11 @@ const p = o(
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
);
|
|
26
|
-
function
|
|
27
|
-
|
|
26
|
+
function Tag({ className, size, variant, asChild = false, ...props }) {
|
|
27
|
+
const Comp = asChild ? Slot : "div";
|
|
28
|
+
return /* @__PURE__ */ jsx(Comp, { "data-slot": "tag", className: cn(tagVariants({ variant, size }), className), ...props });
|
|
28
29
|
}
|
|
29
30
|
export {
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
Tag,
|
|
32
|
+
tagVariants
|
|
32
33
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
declare const captionVariants: (props?: ({
|
|
3
|
+
variant?: "default" | "light" | null | undefined;
|
|
4
|
+
} & import('class-variance-authority/dist/types').ClassProp) | undefined) => string;
|
|
5
|
+
declare function Caption({ className, variant, asChild, ...props }: React.ComponentProps<"div"> & VariantProps<typeof captionVariants> & {
|
|
6
|
+
asChild?: boolean;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
|
+
export { Caption, captionVariants };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { S as Slot } from "../../../_chunks/index.js";
|
|
3
|
+
import { c as cva } from "../../../_chunks/index2.js";
|
|
4
|
+
import { c as cn } from "../../../_chunks/utils.js";
|
|
5
|
+
const captionVariants = cva("tracking-tight text-balance", {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: "scroll-mr-5 text-lg/5 font-bold text-secondary dark:text-foreground",
|
|
9
|
+
light: "scroll-mr-4 text-sm/4 font-normal text-primary"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
defaultVariants: {
|
|
13
|
+
variant: "default"
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
function Caption({
|
|
17
|
+
className,
|
|
18
|
+
variant,
|
|
19
|
+
asChild = false,
|
|
20
|
+
...props
|
|
21
|
+
}) {
|
|
22
|
+
const Comp = asChild ? Slot : "div";
|
|
23
|
+
return /* @__PURE__ */ jsx(Comp, { className: cn(captionVariants({ variant, className })), ...props });
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
Caption,
|
|
27
|
+
captionVariants
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './caption.tsx';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useEffectAfterMount } from "./use-effect-after-mount.js";
|
|
2
|
+
import { useId } from "./use-id.js";
|
|
3
|
+
import { keyboardEventHandler, useKeyboardEvent } from "./use-keyboard-event.js";
|
|
4
|
+
export {
|
|
5
|
+
keyboardEventHandler,
|
|
6
|
+
useEffectAfterMount,
|
|
7
|
+
useId,
|
|
8
|
+
useKeyboardEvent
|
|
9
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useRef, useEffect } from "react";
|
|
2
|
+
function useEffectAfterMount(fn, dependencies) {
|
|
3
|
+
const mounted = useRef(false);
|
|
4
|
+
useEffect(
|
|
5
|
+
() => () => {
|
|
6
|
+
mounted.current = false;
|
|
7
|
+
},
|
|
8
|
+
[]
|
|
9
|
+
);
|
|
10
|
+
useEffect(
|
|
11
|
+
() => {
|
|
12
|
+
if (mounted.current) {
|
|
13
|
+
return fn();
|
|
14
|
+
}
|
|
15
|
+
mounted.current = true;
|
|
16
|
+
return void 0;
|
|
17
|
+
},
|
|
18
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19
|
+
dependencies
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
useEffectAfterMount
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useId(id?: string): string;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { KeyboardEvent, KeyboardEventHandler } from 'react';
|
|
2
|
+
interface KeyBindings {
|
|
3
|
+
[sequence: string]: (event: KeyboardEvent) => void;
|
|
4
|
+
}
|
|
5
|
+
interface UseKeyboardEventOptions {
|
|
6
|
+
eventKeyProp: 'key' | 'code';
|
|
7
|
+
}
|
|
8
|
+
export declare function keyboardEventHandler(bindings: KeyBindings, options?: UseKeyboardEventOptions): KeyboardEventHandler;
|
|
9
|
+
/**
|
|
10
|
+
* Returns a `KeyboardEventHandler`
|
|
11
|
+
* that checks the defined key sequences against a keyboard event
|
|
12
|
+
* and executes the handler of the first matched key binding.
|
|
13
|
+
*
|
|
14
|
+
* Key Sequence Rules:
|
|
15
|
+
* - Multiple key must be seperated by `+`
|
|
16
|
+
* - Only the following modifier key values as allowed: ctrl, shift, alt, meta
|
|
17
|
+
* - Modifier key must followed by a key
|
|
18
|
+
* - Space character (` `) cannot be used in the key sequences. Use the `space` keyword instead.
|
|
19
|
+
* - Plus character (`+`) cannot be used in the key sequences. Use the `shit + =` sequence instead.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```
|
|
23
|
+
* export function Input({ value, onChange }: Props) {
|
|
24
|
+
* const [inputValue, setInputValue] = useState<string>('');
|
|
25
|
+
*
|
|
26
|
+
* const clearInput = () => {
|
|
27
|
+
* setInputValue('');
|
|
28
|
+
* };
|
|
29
|
+
*
|
|
30
|
+
* const addItem = () => {
|
|
31
|
+
* if (inputValue) {
|
|
32
|
+
* onChange([...value, inputValue]);
|
|
33
|
+
* clearInput();
|
|
34
|
+
* }
|
|
35
|
+
* };
|
|
36
|
+
*
|
|
37
|
+
* const deleteAll = () => {
|
|
38
|
+
* onChange([]);
|
|
39
|
+
* clearInput();
|
|
40
|
+
* };
|
|
41
|
+
*
|
|
42
|
+
* const handleKeyDown = useKeyboardEvent({
|
|
43
|
+
* 'enter': addItem,
|
|
44
|
+
* 'escape': clearInput,
|
|
45
|
+
* 'ctrl+c': clearInput,
|
|
46
|
+
* 'ctrl + shift + c': deleteAll,
|
|
47
|
+
* });
|
|
48
|
+
*
|
|
49
|
+
* return (
|
|
50
|
+
* <input
|
|
51
|
+
* value={inputValue}
|
|
52
|
+
* onChange={event => setInputValue(event.target.value)}
|
|
53
|
+
* onKeyDown={handleKeyDown}
|
|
54
|
+
* />;
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function useKeyboardEvent(bindings: KeyBindings, options?: UseKeyboardEventOptions): KeyboardEventHandler;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
const MODIFIER_KEYS = /* @__PURE__ */ new Set(["ctrl", "shift", "alt", "meta"]);
|
|
3
|
+
const KEY_MAPPINGS = {
|
|
4
|
+
" ": "space"
|
|
5
|
+
};
|
|
6
|
+
function parseKeybindings(bindings) {
|
|
7
|
+
const parsedKeybindings = [];
|
|
8
|
+
for (const [sequence, handler] of Object.entries(bindings)) {
|
|
9
|
+
const parsedSequence = sequence.toLowerCase().trim().split(/\s*\+\s*/g);
|
|
10
|
+
if (parsedSequence.length === 1 && MODIFIER_KEYS.has(parsedSequence[0])) {
|
|
11
|
+
console.error(`[useKeyboardEvent] '${sequence}': A key sequence cannot be only a modifier key.`);
|
|
12
|
+
} else if (parsedSequence.includes("")) {
|
|
13
|
+
console.error(`[useKeyboardEvent] '${sequence}': Invalid key sequence defined in the sequence.`);
|
|
14
|
+
} else {
|
|
15
|
+
parsedKeybindings.push({
|
|
16
|
+
sequence: new RegExp("^" + parsedSequence.join("\\+") + "$"),
|
|
17
|
+
handler
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return parsedKeybindings;
|
|
22
|
+
}
|
|
23
|
+
const defaultOptions = {
|
|
24
|
+
eventKeyProp: "key"
|
|
25
|
+
};
|
|
26
|
+
function keyboardEventHandler(bindings, options = defaultOptions) {
|
|
27
|
+
const _options = { ...options, ...defaultOptions };
|
|
28
|
+
const keyBindings = parseKeybindings(bindings);
|
|
29
|
+
return (event) => {
|
|
30
|
+
const eventKey = event[_options.eventKeyProp];
|
|
31
|
+
const keySequence = [];
|
|
32
|
+
if (event.ctrlKey) keySequence.push("ctrl");
|
|
33
|
+
if (event.shiftKey) keySequence.push("shift");
|
|
34
|
+
if (event.altKey) keySequence.push("alt");
|
|
35
|
+
if (event.metaKey) keySequence.push("meta");
|
|
36
|
+
if (!KEY_MAPPINGS[eventKey]) keySequence.push(eventKey.toLowerCase());
|
|
37
|
+
else keySequence.push(KEY_MAPPINGS[eventKey]);
|
|
38
|
+
const matchedSequence = keyBindings.find((keyBinding) => keyBinding.sequence.test(keySequence.join("+")));
|
|
39
|
+
if (matchedSequence) {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
event.stopPropagation();
|
|
42
|
+
matchedSequence.handler(event);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function useKeyboardEvent(bindings, options) {
|
|
47
|
+
return useMemo(() => keyboardEventHandler(bindings, options), [bindings, options]);
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
keyboardEventHandler,
|
|
51
|
+
useKeyboardEvent
|
|
52
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { get, isObject, omit, pick, set } from "./object.js";
|
|
2
|
+
import { difference, intersection, isSuperset, symmetricDifference, union } from "./set-operations.js";
|
|
3
|
+
import { c } from "../_chunks/utils.js";
|
|
4
|
+
export {
|
|
5
|
+
c as cn,
|
|
6
|
+
difference,
|
|
7
|
+
get,
|
|
8
|
+
intersection,
|
|
9
|
+
isObject,
|
|
10
|
+
isSuperset,
|
|
11
|
+
omit,
|
|
12
|
+
pick,
|
|
13
|
+
set,
|
|
14
|
+
symmetricDifference,
|
|
15
|
+
union
|
|
16
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const get: <T extends object>(object: T, prop: string) => any;
|
|
2
|
+
export declare const set: <T extends object, V>(object: T, prop: string, value: V) => T;
|
|
3
|
+
export declare const pick: <T extends object>(object: T, props: string[]) => Partial<T>;
|
|
4
|
+
export declare const omit: <T extends object>(object: T, props: string[]) => Partial<T>;
|
|
5
|
+
export declare const isObject: (object: unknown) => boolean;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const get = (object, prop) => prop.split(".").reduce((reducedObject, key) => reducedObject && key in reducedObject ? reducedObject[key] : void 0, object);
|
|
2
|
+
const set = (object, prop, value) => {
|
|
3
|
+
const propChunks = prop.split(".");
|
|
4
|
+
const lastChunk = propChunks.pop();
|
|
5
|
+
if (!lastChunk) return object;
|
|
6
|
+
const ref = propChunks.reduce((reducedObject, key) => {
|
|
7
|
+
reducedObject[key] = {};
|
|
8
|
+
return reducedObject[key];
|
|
9
|
+
}, object);
|
|
10
|
+
ref[lastChunk] = value;
|
|
11
|
+
return object;
|
|
12
|
+
};
|
|
13
|
+
const pick = (object, props) => {
|
|
14
|
+
return props.reduce((result, key) => {
|
|
15
|
+
set(result, key, get(object, key));
|
|
16
|
+
return result;
|
|
17
|
+
}, {});
|
|
18
|
+
};
|
|
19
|
+
const omit = (object, props) => {
|
|
20
|
+
const result = { ...object };
|
|
21
|
+
props.forEach((prop) => {
|
|
22
|
+
const propChunks = prop.split(".");
|
|
23
|
+
const lastChunk = propChunks.pop();
|
|
24
|
+
if (lastChunk) {
|
|
25
|
+
const ref = propChunks.reduce((reducedObject, key) => reducedObject && key in reducedObject ? reducedObject[key] : void 0, result);
|
|
26
|
+
if (ref && lastChunk in ref) delete ref[lastChunk];
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return result;
|
|
30
|
+
};
|
|
31
|
+
const isObject = (object) => typeof object === "object" && !Array.isArray(object) && object !== null;
|
|
32
|
+
export {
|
|
33
|
+
get,
|
|
34
|
+
isObject,
|
|
35
|
+
omit,
|
|
36
|
+
pick,
|
|
37
|
+
set
|
|
38
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function isSuperset(set: Iterable<any>, subset: Iterable<any>): boolean;
|
|
2
|
+
export declare function union(setA: Iterable<any>, setB: Iterable<any>): Set<any>;
|
|
3
|
+
export declare function intersection(setA: Iterable<any>, setB: Iterable<any>): Set<unknown>;
|
|
4
|
+
export declare function symmetricDifference(setA: Iterable<any>, setB: Iterable<any>): Set<any>;
|
|
5
|
+
export declare function difference(setA: Iterable<any>, setB: Iterable<any>): Set<any>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
function isSuperset(set, subset) {
|
|
2
|
+
const _set = set instanceof Set ? set : new Set(set);
|
|
3
|
+
for (const elem of subset) {
|
|
4
|
+
if (!_set.has(elem)) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
function union(setA, setB) {
|
|
11
|
+
const _union = new Set(setA);
|
|
12
|
+
for (const elem of setB) {
|
|
13
|
+
_union.add(elem);
|
|
14
|
+
}
|
|
15
|
+
return _union;
|
|
16
|
+
}
|
|
17
|
+
function intersection(setA, setB) {
|
|
18
|
+
const _setA = setA instanceof Set ? setA : new Set(setA);
|
|
19
|
+
const _intersection = /* @__PURE__ */ new Set();
|
|
20
|
+
for (const elem of setB) {
|
|
21
|
+
if (_setA.has(elem)) {
|
|
22
|
+
_intersection.add(elem);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return _intersection;
|
|
26
|
+
}
|
|
27
|
+
function symmetricDifference(setA, setB) {
|
|
28
|
+
const _difference = new Set(setA);
|
|
29
|
+
for (const elem of setB) {
|
|
30
|
+
if (_difference.has(elem)) {
|
|
31
|
+
_difference.delete(elem);
|
|
32
|
+
} else {
|
|
33
|
+
_difference.add(elem);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return _difference;
|
|
37
|
+
}
|
|
38
|
+
function difference(setA, setB) {
|
|
39
|
+
const _difference = new Set(setA);
|
|
40
|
+
for (const elem of setB) {
|
|
41
|
+
_difference.delete(elem);
|
|
42
|
+
}
|
|
43
|
+
return _difference;
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
difference,
|
|
47
|
+
intersection,
|
|
48
|
+
isSuperset,
|
|
49
|
+
symmetricDifference,
|
|
50
|
+
union
|
|
51
|
+
};
|
package/package.json
CHANGED
|
@@ -1,88 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bccampus/ui-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"packageManager": "yarn@4.10.3",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
|
-
"types": "./dist/
|
|
9
|
-
"import": "./dist/
|
|
8
|
+
"types": "./dist/components/index.d.ts",
|
|
9
|
+
"import": "./dist/components/index.js"
|
|
10
10
|
},
|
|
11
|
-
"./
|
|
12
|
-
"types": "./dist/
|
|
13
|
-
"import": "./dist/
|
|
14
|
-
},
|
|
15
|
-
"./listbox": {
|
|
16
|
-
"types": "./dist/listbox.d.ts",
|
|
17
|
-
"import": "./dist/listbox.js"
|
|
18
|
-
},
|
|
19
|
-
"./icon-generator": {
|
|
20
|
-
"types": "./dist/icon-generator.d.ts",
|
|
21
|
-
"import": "./dist/icon-generator.js"
|
|
22
|
-
},
|
|
23
|
-
"./generate-tiles": {
|
|
24
|
-
"types": "./dist/generate-tiles.d.ts",
|
|
25
|
-
"import": "./dist/generate-tiles.js"
|
|
26
|
-
},
|
|
27
|
-
"./masked-image-generator": {
|
|
28
|
-
"types": "./dist/masked-image-generator.d.ts",
|
|
29
|
-
"import": "./dist/masked-image-generator.js"
|
|
30
|
-
},
|
|
31
|
-
"./caption": {
|
|
32
|
-
"types": "./dist/caption.d.ts",
|
|
33
|
-
"import": "./dist/caption.js"
|
|
34
|
-
},
|
|
35
|
-
"./banner": {
|
|
36
|
-
"types": "./dist/banner.d.ts",
|
|
37
|
-
"import": "./dist/banner.js"
|
|
38
|
-
},
|
|
39
|
-
"./button": {
|
|
40
|
-
"types": "./dist/button.d.ts",
|
|
41
|
-
"import": "./dist/button.js"
|
|
42
|
-
},
|
|
43
|
-
"./card": {
|
|
44
|
-
"types": "./dist/card.d.ts",
|
|
45
|
-
"import": "./dist/card.js"
|
|
46
|
-
},
|
|
47
|
-
"./horizontal-list": {
|
|
48
|
-
"types": "./dist/horizontal-list.d.ts",
|
|
49
|
-
"import": "./dist/horizontal-list.js"
|
|
50
|
-
},
|
|
51
|
-
"./input": {
|
|
52
|
-
"types": "./dist/input.d.ts",
|
|
53
|
-
"import": "./dist/input.js"
|
|
54
|
-
},
|
|
55
|
-
"./navigation-menu": {
|
|
56
|
-
"types": "./dist/navigation-menu.d.ts",
|
|
57
|
-
"import": "./dist/navigation-menu.js"
|
|
58
|
-
},
|
|
59
|
-
"./overlay": {
|
|
60
|
-
"types": "./dist/overlay.d.ts",
|
|
61
|
-
"import": "./dist/overlay.js"
|
|
62
|
-
},
|
|
63
|
-
"./page-header": {
|
|
64
|
-
"types": "./dist/page-header.d.ts",
|
|
65
|
-
"import": "./dist/page-header.js"
|
|
66
|
-
},
|
|
67
|
-
"./page-section": {
|
|
68
|
-
"types": "./dist/page-section.d.ts",
|
|
69
|
-
"import": "./dist/page-section.js"
|
|
70
|
-
},
|
|
71
|
-
"./page": {
|
|
72
|
-
"types": "./dist/page.d.ts",
|
|
73
|
-
"import": "./dist/page.js"
|
|
74
|
-
},
|
|
75
|
-
"./search-input": {
|
|
76
|
-
"types": "./dist/search-input.d.ts",
|
|
77
|
-
"import": "./dist/search-input.js"
|
|
78
|
-
},
|
|
79
|
-
"./tag": {
|
|
80
|
-
"types": "./dist/tag.d.ts",
|
|
81
|
-
"import": "./dist/tag.js"
|
|
11
|
+
"./hooks": {
|
|
12
|
+
"types": "./dist/hooks/index.d.ts",
|
|
13
|
+
"import": "./dist/hooks/index.js"
|
|
82
14
|
},
|
|
83
15
|
"./utils": {
|
|
84
|
-
"types": "./dist/
|
|
85
|
-
"import": "./dist/
|
|
16
|
+
"types": "./dist/lib/index.d.ts",
|
|
17
|
+
"import": "./dist/lib/index.js"
|
|
86
18
|
},
|
|
87
19
|
"./all.css": "./src/styles/all.css",
|
|
88
20
|
"./colors.css": "./src/styles/colors.css",
|
|
@@ -125,6 +57,7 @@
|
|
|
125
57
|
"eslint": "^9.35.0",
|
|
126
58
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
127
59
|
"eslint-plugin-react-refresh": "^0.4.20",
|
|
60
|
+
"glob": "^13.0.0",
|
|
128
61
|
"globals": "^16.4.0",
|
|
129
62
|
"typescript": "~5.8.3",
|
|
130
63
|
"typescript-eslint": "^8.43.0",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from '@/components/ui/composite'
|
|
2
|
+
export * from '@/components/ui/icon-generator'
|
|
3
|
+
export * from '@/components/ui/typography'
|
|
4
|
+
|
|
5
|
+
export * from '@/components/ui/banner.tsx'
|
|
6
|
+
export * from '@/components/ui/button.tsx'
|
|
7
|
+
export * from '@/components/ui/card.tsx'
|
|
8
|
+
export * from '@/components/ui/horizontal-list.tsx'
|
|
9
|
+
export * from '@/components/ui/input.tsx'
|
|
10
|
+
export * from '@/components/ui/navigation-menu.tsx'
|
|
11
|
+
export * from '@/components/ui/overlay.tsx'
|
|
12
|
+
export * from '@/components/ui/page-header.tsx'
|
|
13
|
+
export * from '@/components/ui/page-section.tsx'
|
|
14
|
+
export * from '@/components/ui/page.tsx'
|
|
15
|
+
export * from '@/components/ui/popover.tsx'
|
|
16
|
+
export * from '@/components/ui/search-input.tsx'
|
|
17
|
+
export * from '@/components/ui/tag.tsx'
|
|
@@ -3,7 +3,7 @@ import type { CompositeItemKey } from '../types';
|
|
|
3
3
|
import { AbstractSelectionProvider } from './AbstractSelectionProvider';
|
|
4
4
|
import { difference, union } from "@/lib/set-operations";
|
|
5
5
|
|
|
6
|
-
export class
|
|
6
|
+
export class MultipleSelectionProvider<T extends object> extends AbstractSelectionProvider<T> {
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
select(itemKey: CompositeItemKey, recursive?: boolean): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './composite-component.tsx'
|
|
2
|
-
export * from './composite-component-item.tsx'
|
|
3
1
|
export * from './CompositeData.ts'
|
|
4
2
|
export * from './CompositeDataItem.ts'
|
|
5
|
-
export * from './FocusProvider
|
|
6
|
-
export * from './SelectionProvider
|
|
7
|
-
export * from './
|
|
3
|
+
export * from './FocusProvider'
|
|
4
|
+
export * from './SelectionProvider'
|
|
5
|
+
export * from './composite-component.tsx'
|
|
6
|
+
export * from './composite-component-item.tsx'
|
|
7
|
+
export * from './listbox.tsx'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './caption.tsx'
|
package/src/index.ts
ADDED
package/src/lib/index.ts
ADDED