@koobiq/react-components 0.21.1 → 0.23.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/Accordion/Accordion.d.ts +9 -0
- package/dist/components/Accordion/Accordion.js +89 -0
- package/dist/components/Accordion/Accordion.module.css.js +8 -0
- package/dist/components/Accordion/AccordionStateContext.d.ts +2 -0
- package/dist/components/Accordion/AccordionStateContext.js +7 -0
- package/dist/components/Accordion/components/AccordionDetails/AccordionDetails.d.ts +2 -0
- package/dist/components/Accordion/components/AccordionDetails/AccordionDetails.js +55 -0
- package/dist/components/Accordion/components/AccordionDetails/AccordionDetails.module.css.js +8 -0
- package/dist/components/Accordion/components/AccordionDetails/AccordionDetailsContext.d.ts +2 -0
- package/dist/components/Accordion/components/AccordionDetails/AccordionDetailsContext.js +7 -0
- package/dist/components/Accordion/components/AccordionDetails/index.d.ts +3 -0
- package/dist/components/Accordion/components/AccordionDetails/types.d.ts +14 -0
- package/dist/components/Accordion/components/AccordionGroup/AccordionGroup.d.ts +2 -0
- package/dist/components/Accordion/components/AccordionGroup/AccordionGroup.js +31 -0
- package/dist/components/Accordion/components/AccordionGroup/AccordionGroup.module.css.js +8 -0
- package/dist/components/Accordion/components/AccordionGroup/AccordionGroupContext.d.ts +2 -0
- package/dist/components/Accordion/components/AccordionGroup/AccordionGroupContext.js +5 -0
- package/dist/components/Accordion/components/AccordionGroup/index.d.ts +3 -0
- package/dist/components/Accordion/components/AccordionGroup/types.d.ts +7 -0
- package/dist/components/Accordion/components/AccordionSummary/AccordionSummary.d.ts +4 -0
- package/dist/components/Accordion/components/AccordionSummary/AccordionSummary.js +80 -0
- package/dist/components/Accordion/components/AccordionSummary/AccordionSummary.module.css.js +24 -0
- package/dist/components/Accordion/components/AccordionSummary/AccordionSummaryContext.d.ts +2 -0
- package/dist/components/Accordion/components/AccordionSummary/AccordionSummaryContext.js +7 -0
- package/dist/components/Accordion/components/AccordionSummary/index.d.ts +3 -0
- package/dist/components/Accordion/components/AccordionSummary/types.d.ts +25 -0
- package/dist/components/Accordion/components/index.d.ts +3 -0
- package/dist/components/Accordion/index.d.ts +4 -0
- package/dist/components/Accordion/types.d.ts +8 -0
- package/dist/components/Autocomplete/Autocomplete.js +2 -2
- package/dist/components/Button/Button.js +1 -0
- package/dist/components/Calendar/Calendar.js +9 -10
- package/dist/components/Calendar/components/CalendarCell/CalendarCell.js +11 -1
- package/dist/components/Calendar/components/CalendarGrid/CalendarGrid.d.ts +2 -6
- package/dist/components/Calendar/components/CalendarGrid/CalendarGrid.js +13 -3
- package/dist/components/Calendar/components/CalendarGrid/index.d.ts +1 -0
- package/dist/components/Calendar/components/CalendarGrid/types.d.ts +10 -0
- package/dist/components/Calendar/components/CalendarHeader/CalendarHeader.d.ts +1 -7
- package/dist/components/Calendar/components/CalendarHeader/CalendarHeader.js +13 -6
- package/dist/components/Calendar/components/CalendarHeader/index.d.ts +1 -0
- package/dist/components/Calendar/components/CalendarHeader/types.d.ts +16 -0
- package/dist/components/Calendar/components/CalendarMonthDropdown/CalendarMonthDropdown.d.ts +11 -3
- package/dist/components/Calendar/components/CalendarMonthDropdown/CalendarMonthDropdown.js +26 -15
- package/dist/components/Calendar/components/CalendarYearDropdown/CalendarYearDropdown.d.ts +11 -3
- package/dist/components/Calendar/components/CalendarYearDropdown/CalendarYearDropdown.js +26 -15
- package/dist/components/Calendar/types.d.ts +8 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.js +2 -2
- package/dist/components/ContenPanel/ContentPanel.d.ts +32 -0
- package/dist/components/ContenPanel/ContentPanel.js +157 -0
- package/dist/components/ContenPanel/ContentPanel.module.css.js +17 -0
- package/dist/components/ContenPanel/ContentPanelContext.d.ts +3 -0
- package/dist/components/ContenPanel/ContentPanelContext.js +6 -0
- package/dist/components/ContenPanel/components/ContentPanelContainer/ContentPanelContainer.d.ts +2 -0
- package/dist/components/ContenPanel/components/ContentPanelContainer/ContentPanelContainer.js +108 -0
- package/dist/components/ContenPanel/components/ContentPanelContainer/ContentPanelContainer.module.css.js +14 -0
- package/dist/components/ContenPanel/components/ContentPanelContainer/ContentPanelContainerContext.d.ts +7 -0
- package/dist/components/ContenPanel/components/ContentPanelContainer/ContentPanelContainerContext.js +8 -0
- package/dist/components/ContenPanel/components/ContentPanelContainer/index.d.ts +3 -0
- package/dist/components/ContenPanel/components/ContentPanelContainer/types.d.ts +23 -0
- package/dist/components/ContenPanel/components/index.d.ts +1 -0
- package/dist/components/ContenPanel/constants.d.ts +1 -0
- package/dist/components/ContenPanel/constants.js +4 -0
- package/dist/components/ContenPanel/hooks/index.d.ts +2 -0
- package/dist/components/ContenPanel/hooks/useContentPanelContainer/index.d.ts +1 -0
- package/dist/components/ContenPanel/hooks/useContentPanelContainer/useContentPanelContainer.d.ts +14 -0
- package/dist/components/ContenPanel/hooks/useContentPanelContainer/useContentPanelContainer.js +19 -0
- package/dist/components/ContenPanel/hooks/useContentPanelResize/index.d.ts +1 -0
- package/dist/components/ContenPanel/hooks/useContentPanelResize/intl.json.js +7 -0
- package/dist/components/ContenPanel/hooks/useContentPanelResize/useContentPanelResize.d.ts +32 -0
- package/dist/components/ContenPanel/hooks/useContentPanelResize/useContentPanelResize.js +80 -0
- package/dist/components/ContenPanel/index.d.ts +3 -0
- package/dist/components/ContenPanel/types.d.ts +53 -0
- package/dist/components/ContenPanel/utils/index.d.ts +3 -0
- package/dist/components/ContenPanel/utils/index.js +31 -0
- package/dist/components/DateInput/DateInput.js +2 -2
- package/dist/components/DatePicker/DatePicker.js +21 -21
- package/dist/components/DatePicker/types.d.ts +1 -0
- package/dist/components/Dialog/types.d.ts +1 -1
- package/dist/components/FormField/FormFieldInputDate/FormFieldInputDate.d.ts +3 -2
- package/dist/components/IconButton/IconButton.js +1 -0
- package/dist/components/Input/Input.js +2 -2
- package/dist/components/InputNumber/InputNumber.js +2 -2
- package/dist/components/Link/Link.js +0 -2
- package/dist/components/Menu/components/MenuItem/MenuItem.js +8 -1
- package/dist/components/RadioGroup/RadioGroup.js +2 -2
- package/dist/components/SearchInput/SearchInput.js +2 -2
- package/dist/components/Select/Select.js +2 -2
- package/dist/components/Select/intl.js +2 -2
- package/dist/components/Table/components/TableColumnHeader/TableColumnHeader.js +2 -2
- package/dist/components/Textarea/components/TextareaContextConsumer/TextareaContextConsumer.js +2 -2
- package/dist/components/TimePicker/TimePicker.js +2 -2
- package/dist/components/index.d.ts +2 -0
- package/dist/index.js +15 -0
- package/dist/style.css +188 -0
- package/package.json +5 -5
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AccordionDetails, AccordionSummary } from './components';
|
|
2
|
+
import type { AccordionProps } from './types';
|
|
3
|
+
export declare const AccordionComponent: import("react").ForwardRefExoticComponent<Omit<AccordionProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
|
+
type CompoundedComponent = typeof AccordionComponent & {
|
|
5
|
+
Summary: typeof AccordionSummary;
|
|
6
|
+
Details: typeof AccordionDetails;
|
|
7
|
+
};
|
|
8
|
+
export declare const Accordion: CompoundedComponent;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useContext, useRef } from "react";
|
|
4
|
+
import { useId, clsx } from "@koobiq/react-core";
|
|
5
|
+
import { useDisclosureState, useDisclosure, Provider } from "@koobiq/react-primitives";
|
|
6
|
+
import { utilClasses } from "../../styles/utility.js";
|
|
7
|
+
import s from "./Accordion.module.css.js";
|
|
8
|
+
import { AccordionSummary } from "./components/AccordionSummary/AccordionSummary.js";
|
|
9
|
+
import { AccordionDetails } from "./components/AccordionDetails/AccordionDetails.js";
|
|
10
|
+
import { AccordionGroupStateContext } from "./components/AccordionGroup/AccordionGroupContext.js";
|
|
11
|
+
import { AccordionStateContext } from "./AccordionStateContext.js";
|
|
12
|
+
import { AccordionSummaryContext } from "./components/AccordionSummary/AccordionSummaryContext.js";
|
|
13
|
+
import { AccordionDetailsContext } from "./components/AccordionDetails/AccordionDetailsContext.js";
|
|
14
|
+
const textNormal = utilClasses.typography["text-normal"];
|
|
15
|
+
const AccordionComponent = forwardRef(
|
|
16
|
+
(props, ref) => {
|
|
17
|
+
const {
|
|
18
|
+
children,
|
|
19
|
+
className,
|
|
20
|
+
id: idProp,
|
|
21
|
+
defaultExpanded,
|
|
22
|
+
onExpandedChange,
|
|
23
|
+
isDisabled: isDisabledProp,
|
|
24
|
+
isExpanded: isExpandedProp,
|
|
25
|
+
...other
|
|
26
|
+
} = props;
|
|
27
|
+
const commonProps = {
|
|
28
|
+
children,
|
|
29
|
+
onExpandedChange,
|
|
30
|
+
defaultExpanded,
|
|
31
|
+
isDisabled: isDisabledProp,
|
|
32
|
+
isExpanded: isExpandedProp
|
|
33
|
+
};
|
|
34
|
+
const defaultId = useId();
|
|
35
|
+
const id = idProp || defaultId;
|
|
36
|
+
const groupState = useContext(AccordionGroupStateContext);
|
|
37
|
+
const isExpanded = groupState ? groupState.expandedKeys?.has(id) : isExpandedProp;
|
|
38
|
+
const state = useDisclosureState({
|
|
39
|
+
...commonProps,
|
|
40
|
+
isExpanded,
|
|
41
|
+
onExpandedChange(isExpanded2) {
|
|
42
|
+
if (groupState) {
|
|
43
|
+
groupState.toggleKey(id);
|
|
44
|
+
}
|
|
45
|
+
props.onExpandedChange?.(isExpanded2);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const panelRef = useRef(null);
|
|
49
|
+
const triggerRef = useRef(null);
|
|
50
|
+
const isDisabled = isDisabledProp || groupState?.isDisabled || false;
|
|
51
|
+
const { buttonProps: triggerProps, panelProps } = useDisclosure(
|
|
52
|
+
{
|
|
53
|
+
...commonProps,
|
|
54
|
+
isExpanded,
|
|
55
|
+
isDisabled
|
|
56
|
+
},
|
|
57
|
+
state,
|
|
58
|
+
panelRef
|
|
59
|
+
);
|
|
60
|
+
return /* @__PURE__ */ jsx(
|
|
61
|
+
Provider,
|
|
62
|
+
{
|
|
63
|
+
values: [
|
|
64
|
+
[AccordionStateContext, state],
|
|
65
|
+
[AccordionSummaryContext, { ...triggerProps, ref: triggerRef }],
|
|
66
|
+
[AccordionDetailsContext, { ...panelProps, ref: panelRef }]
|
|
67
|
+
],
|
|
68
|
+
children: /* @__PURE__ */ jsx(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
className: clsx(s.base, textNormal, className),
|
|
72
|
+
id: idProp,
|
|
73
|
+
...other,
|
|
74
|
+
ref,
|
|
75
|
+
children
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
AccordionComponent.displayName = "Accordion";
|
|
83
|
+
const Accordion = AccordionComponent;
|
|
84
|
+
Accordion.Summary = AccordionSummary;
|
|
85
|
+
Accordion.Details = AccordionDetails;
|
|
86
|
+
export {
|
|
87
|
+
Accordion,
|
|
88
|
+
AccordionComponent
|
|
89
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useRef, useContext, useEffect } from "react";
|
|
4
|
+
import { useDOMRef, mergeProps, clsx } from "@koobiq/react-core";
|
|
5
|
+
import { useContextProps } from "@koobiq/react-primitives";
|
|
6
|
+
import { Transition } from "react-transition-group";
|
|
7
|
+
import s from "./AccordionDetails.module.css.js";
|
|
8
|
+
import { AccordionDetailsContext } from "./AccordionDetailsContext.js";
|
|
9
|
+
import { AccordionStateContext } from "../../AccordionStateContext.js";
|
|
10
|
+
const TRANSITION_TIMEOUT = 300;
|
|
11
|
+
const AccordionDetails = forwardRef((props, ref) => {
|
|
12
|
+
const { children, className, style, slotProps, unmountOnExit, ...other } = props;
|
|
13
|
+
const domRef = useDOMRef(ref);
|
|
14
|
+
const innerRef = useRef(null);
|
|
15
|
+
const [panelProps] = useContextProps({}, domRef, AccordionDetailsContext);
|
|
16
|
+
const { isExpanded } = useContext(AccordionStateContext);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!isExpanded) domRef?.current?.setAttribute("hidden", "until-found");
|
|
19
|
+
}, []);
|
|
20
|
+
const transitionProps = mergeProps(
|
|
21
|
+
{
|
|
22
|
+
timeout: TRANSITION_TIMEOUT,
|
|
23
|
+
onEnter: () => {
|
|
24
|
+
domRef?.current?.removeAttribute("hidden");
|
|
25
|
+
},
|
|
26
|
+
onExited: () => {
|
|
27
|
+
domRef?.current?.setAttribute("hidden", "until-found");
|
|
28
|
+
},
|
|
29
|
+
in: isExpanded,
|
|
30
|
+
nodeRef: domRef,
|
|
31
|
+
unmountOnExit
|
|
32
|
+
},
|
|
33
|
+
slotProps?.transition
|
|
34
|
+
);
|
|
35
|
+
return /* @__PURE__ */ jsx(Transition, { ...transitionProps, children: (transition) => /* @__PURE__ */ jsx(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
ref: domRef,
|
|
39
|
+
...panelProps,
|
|
40
|
+
"data-transition": transition,
|
|
41
|
+
className: clsx(s.base, className),
|
|
42
|
+
style: {
|
|
43
|
+
"--accordion-details-block-size": `${innerRef.current?.clientHeight}px`,
|
|
44
|
+
"--accordion-details-duration": `${TRANSITION_TIMEOUT}ms`,
|
|
45
|
+
...style
|
|
46
|
+
},
|
|
47
|
+
...other,
|
|
48
|
+
children: /* @__PURE__ */ jsx("p", { ref: innerRef, children })
|
|
49
|
+
}
|
|
50
|
+
) });
|
|
51
|
+
});
|
|
52
|
+
AccordionDetails.displayName = "AccordionDetails";
|
|
53
|
+
export {
|
|
54
|
+
AccordionDetails
|
|
55
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ComponentRef, ReactNode } from 'react';
|
|
2
|
+
import type { ExtendableComponentPropsWithRef } from '@koobiq/react-core';
|
|
3
|
+
import type { TransitionProps } from 'react-transition-group/Transition';
|
|
4
|
+
export type AccordionDetailsRef = ComponentRef<'div'>;
|
|
5
|
+
export type AccordionDetailsProps = ExtendableComponentPropsWithRef<{
|
|
6
|
+
/** The content of the component. */
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/** If `true`, unmounts the content when collapsed. */
|
|
9
|
+
unmountOnExit?: boolean;
|
|
10
|
+
/** The props used for each slot inside. */
|
|
11
|
+
slotProps?: {
|
|
12
|
+
transition?: Partial<TransitionProps<HTMLElement>>;
|
|
13
|
+
};
|
|
14
|
+
}, 'div'>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { clsx } from "@koobiq/react-core";
|
|
5
|
+
import { useDisclosureGroupState } from "@koobiq/react-primitives";
|
|
6
|
+
import s from "./AccordionGroup.module.css.js";
|
|
7
|
+
import { AccordionGroupStateContext } from "./AccordionGroupContext.js";
|
|
8
|
+
const AccordionGroup = forwardRef((props, ref) => {
|
|
9
|
+
const {
|
|
10
|
+
children,
|
|
11
|
+
className,
|
|
12
|
+
isDisabled,
|
|
13
|
+
expandedKeys,
|
|
14
|
+
onExpandedChange,
|
|
15
|
+
defaultExpandedKeys,
|
|
16
|
+
allowsMultipleExpanded,
|
|
17
|
+
...other
|
|
18
|
+
} = props;
|
|
19
|
+
const state = useDisclosureGroupState({
|
|
20
|
+
isDisabled,
|
|
21
|
+
expandedKeys,
|
|
22
|
+
onExpandedChange,
|
|
23
|
+
defaultExpandedKeys,
|
|
24
|
+
allowsMultipleExpanded
|
|
25
|
+
});
|
|
26
|
+
return /* @__PURE__ */ jsx("div", { className: clsx(s.base, className), ...other, ref, children: /* @__PURE__ */ jsx(AccordionGroupStateContext.Provider, { value: state, children }) });
|
|
27
|
+
});
|
|
28
|
+
AccordionGroup.displayName = "AccordionGroup";
|
|
29
|
+
export {
|
|
30
|
+
AccordionGroup
|
|
31
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentRef, ReactNode } from 'react';
|
|
2
|
+
import type { ExtendableComponentPropsWithRef } from '@koobiq/react-core';
|
|
3
|
+
import type { DisclosureGroupProps as AriaDisclosureGroupProps } from '@koobiq/react-primitives';
|
|
4
|
+
export type AccordionGroupProps = ExtendableComponentPropsWithRef<AriaDisclosureGroupProps & {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}, 'div'>;
|
|
7
|
+
export type AccordionGroupRef = ComponentRef<'div'>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ComponentPropsWithRef, type ElementType } from 'react';
|
|
2
|
+
import { type AccordionSummaryProps } from './index';
|
|
3
|
+
export declare const AccordionSummary: import("@koobiq/react-core").PolyForwardComponent<"h3", AccordionSummaryProps, ElementType>;
|
|
4
|
+
export type DisclosureTriggerProps<As extends ElementType = 'h3'> = ComponentPropsWithRef<typeof AccordionSummary<As>>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
import { polymorphicForwardRef, mergeProps, clsx } from "@koobiq/react-core";
|
|
5
|
+
import { IconChevronRight16 } from "@koobiq/react-icons";
|
|
6
|
+
import { useContextProps, Button } from "@koobiq/react-primitives";
|
|
7
|
+
import { utilClasses } from "../../../../styles/utility.js";
|
|
8
|
+
import { AccordionStateContext } from "../../AccordionStateContext.js";
|
|
9
|
+
import s from "./AccordionSummary.module.css.js";
|
|
10
|
+
import { AccordionSummaryContext } from "./AccordionSummaryContext.js";
|
|
11
|
+
import { AnimatedIcon } from "../../../AnimatedIcon/AnimatedIcon.js";
|
|
12
|
+
const textBig = utilClasses.typography["text-big"];
|
|
13
|
+
const AccordionSummary = polymorphicForwardRef((props, ref) => {
|
|
14
|
+
const {
|
|
15
|
+
className,
|
|
16
|
+
children,
|
|
17
|
+
as: Tag = "h3",
|
|
18
|
+
expandIcon: expandIconProp,
|
|
19
|
+
expandIconPlacement = "before-content",
|
|
20
|
+
hideExpandIcon,
|
|
21
|
+
slotProps,
|
|
22
|
+
...other
|
|
23
|
+
} = props;
|
|
24
|
+
const { isExpanded } = useContext(AccordionStateContext);
|
|
25
|
+
const [triggerPropsAria, triggerRef] = useContextProps(
|
|
26
|
+
{ children },
|
|
27
|
+
void 0,
|
|
28
|
+
AccordionSummaryContext
|
|
29
|
+
);
|
|
30
|
+
const expandIconProps = mergeProps(
|
|
31
|
+
{
|
|
32
|
+
className: s.expandIcon,
|
|
33
|
+
"data-expanded": isExpanded || void 0,
|
|
34
|
+
"aria-hidden": "true"
|
|
35
|
+
},
|
|
36
|
+
slotProps?.expandIcon
|
|
37
|
+
);
|
|
38
|
+
const triggerProps = mergeProps(
|
|
39
|
+
triggerPropsAria,
|
|
40
|
+
{
|
|
41
|
+
"data-slot": "trigger",
|
|
42
|
+
className: ({ isHovered, isDisabled }) => clsx(
|
|
43
|
+
s.trigger,
|
|
44
|
+
isHovered && s.hovered,
|
|
45
|
+
isDisabled && s.disabled,
|
|
46
|
+
s[expandIconPlacement]
|
|
47
|
+
),
|
|
48
|
+
ref: triggerRef
|
|
49
|
+
},
|
|
50
|
+
slotProps?.trigger
|
|
51
|
+
);
|
|
52
|
+
const expandIconDefault = /* @__PURE__ */ jsx(
|
|
53
|
+
AnimatedIcon,
|
|
54
|
+
{
|
|
55
|
+
icons: [/* @__PURE__ */ jsx(IconChevronRight16, {}, "expand-icon")],
|
|
56
|
+
directions: [0, 90],
|
|
57
|
+
activeIndex: +isExpanded
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
const expandIcon = hideExpandIcon ? null : /* @__PURE__ */ jsx("span", { ...expandIconProps, children: expandIconProp?.(isExpanded) ?? expandIconDefault });
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
Tag,
|
|
63
|
+
{
|
|
64
|
+
className: clsx(s.base, textBig, className),
|
|
65
|
+
"data-expanded": isExpanded || void 0,
|
|
66
|
+
"data-expand-icon-placement": expandIconPlacement,
|
|
67
|
+
...other,
|
|
68
|
+
ref,
|
|
69
|
+
children: /* @__PURE__ */ jsxs(Button, { ...triggerProps, children: [
|
|
70
|
+
expandIconPlacement === "before-content" && expandIcon,
|
|
71
|
+
triggerProps?.children,
|
|
72
|
+
expandIconPlacement !== "before-content" && expandIcon
|
|
73
|
+
] })
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
AccordionSummary.displayName = "AccordionSummary";
|
|
78
|
+
export {
|
|
79
|
+
AccordionSummary
|
|
80
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const base = "kbq-accordionsummary-17bfb5";
|
|
2
|
+
const trigger = "kbq-accordionsummary-trigger-8096e7";
|
|
3
|
+
const hovered = "kbq-accordionsummary-hovered-3a99cb";
|
|
4
|
+
const disabled = "kbq-accordionsummary-disabled-5a76af";
|
|
5
|
+
const separately = "kbq-accordionsummary-separately-f6c597";
|
|
6
|
+
const expandIcon = "kbq-accordionsummary-expandIcon-54a6fc";
|
|
7
|
+
const s = {
|
|
8
|
+
base,
|
|
9
|
+
trigger,
|
|
10
|
+
hovered,
|
|
11
|
+
disabled,
|
|
12
|
+
"after-content": "kbq-accordionsummary-after-content-58ad40",
|
|
13
|
+
separately,
|
|
14
|
+
expandIcon
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
base,
|
|
18
|
+
s as default,
|
|
19
|
+
disabled,
|
|
20
|
+
expandIcon,
|
|
21
|
+
hovered,
|
|
22
|
+
separately,
|
|
23
|
+
trigger
|
|
24
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ComponentRef, ReactNode, ReactElement, ComponentPropsWithRef } from 'react';
|
|
2
|
+
import type { ButtonProps } from '@koobiq/react-primitives';
|
|
3
|
+
export type AccordionSummaryRef = ComponentRef<'h3'>;
|
|
4
|
+
export declare const accordionSummaryPropExpandIconPlacement: readonly ["before-content", "after-content", "separately"];
|
|
5
|
+
export type AccordionSummaryPropExpandIconPlacement = (typeof accordionSummaryPropExpandIconPlacement)[number];
|
|
6
|
+
export type AccordionSummaryProps = {
|
|
7
|
+
/** The content of the component. */
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
/** Additional CSS-classes. */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Renders a custom expand icon. Receives the current expanded state. */
|
|
12
|
+
expandIcon?: (isExpanded: boolean) => ReactElement;
|
|
13
|
+
/**
|
|
14
|
+
* Controls where the expand icon is placed relative to the content.
|
|
15
|
+
* @default 'before-content'
|
|
16
|
+
*/
|
|
17
|
+
expandIconPlacement?: AccordionSummaryPropExpandIconPlacement;
|
|
18
|
+
/** If `true`, hides the expand icon. */
|
|
19
|
+
hideExpandIcon?: boolean;
|
|
20
|
+
/** The props used for each slot inside. */
|
|
21
|
+
slotProps?: {
|
|
22
|
+
trigger?: Omit<ButtonProps, 'children'>;
|
|
23
|
+
expandIcon?: ComponentPropsWithRef<'span'>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ComponentRef, ReactNode } from 'react';
|
|
2
|
+
import type { ExtendableComponentPropsWithRef } from '@koobiq/react-core';
|
|
3
|
+
import type { AriaDisclosureProps } from '@koobiq/react-primitives';
|
|
4
|
+
export type AccordionProps = ExtendableComponentPropsWithRef<AriaDisclosureProps & {
|
|
5
|
+
/** The content of the component. */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}, 'div'>;
|
|
8
|
+
export type AccordionRef = ComponentRef<'div'>;
|
|
@@ -204,8 +204,8 @@ function AutocompleteRender(props, ref) {
|
|
|
204
204
|
/* @__PURE__ */ jsx(FormField.Label, { ...labelProps }),
|
|
205
205
|
/* @__PURE__ */ jsxs("div", { className: s.body, children: [
|
|
206
206
|
/* @__PURE__ */ jsx(FormField.ControlGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FormField.Input, { ...inputProps }) }),
|
|
207
|
-
/* @__PURE__ */ jsx(FormField.
|
|
208
|
-
/* @__PURE__ */ jsx(
|
|
207
|
+
/* @__PURE__ */ jsx(FieldErrorContext.Provider, { value: validation, children: /* @__PURE__ */ jsx(FormField.Error, { ...errorProps }) }),
|
|
208
|
+
/* @__PURE__ */ jsx(FormField.Caption, { ...captionProps })
|
|
209
209
|
] }),
|
|
210
210
|
/* @__PURE__ */ jsx(PopoverInner, { ...popoverProps, children: /* @__PURE__ */ jsx(ListInner, { ...listProps }) })
|
|
211
211
|
] });
|
|
@@ -9,7 +9,7 @@ import { CalendarHeader } from "./components/CalendarHeader/CalendarHeader.js";
|
|
|
9
9
|
import { CalendarGrid } from "./components/CalendarGrid/CalendarGrid.js";
|
|
10
10
|
const textNormal = utilClasses.typography["text-normal"];
|
|
11
11
|
function CalendarRender(props, ref) {
|
|
12
|
-
const { style, className } = props;
|
|
12
|
+
const { style, className, slotProps } = props;
|
|
13
13
|
const { locale } = useLocale();
|
|
14
14
|
const state = useCalendarState({
|
|
15
15
|
createCalendar,
|
|
@@ -22,18 +22,17 @@ function CalendarRender(props, ref) {
|
|
|
22
22
|
);
|
|
23
23
|
const rootProps = mergeProps(
|
|
24
24
|
{ className: clsx(s.base, textNormal, className), style, ref },
|
|
25
|
+
slotProps?.root,
|
|
25
26
|
calendarProps
|
|
26
27
|
);
|
|
28
|
+
const headerProps = mergeProps(
|
|
29
|
+
{ state, prevButtonProps, nextButtonProps },
|
|
30
|
+
slotProps?.header
|
|
31
|
+
);
|
|
32
|
+
const gridProps = mergeProps({ state }, slotProps?.grid);
|
|
27
33
|
return /* @__PURE__ */ jsxs("div", { ...rootProps, children: [
|
|
28
|
-
/* @__PURE__ */ jsx(
|
|
29
|
-
|
|
30
|
-
{
|
|
31
|
-
state,
|
|
32
|
-
prevButtonProps,
|
|
33
|
-
nextButtonProps
|
|
34
|
-
}
|
|
35
|
-
),
|
|
36
|
-
/* @__PURE__ */ jsx(CalendarGrid, { state })
|
|
34
|
+
/* @__PURE__ */ jsx(CalendarHeader, { ...headerProps }),
|
|
35
|
+
/* @__PURE__ */ jsx(CalendarGrid, { ...gridProps })
|
|
37
36
|
] });
|
|
38
37
|
}
|
|
39
38
|
const Calendar = forwardRef(CalendarRender);
|
|
@@ -23,12 +23,22 @@ function CalendarCell({ state, date }) {
|
|
|
23
23
|
const { hoverProps, isHovered } = useHover({
|
|
24
24
|
isDisabled: isDisabled || isUnavailable
|
|
25
25
|
});
|
|
26
|
-
const { focusProps, isFocusVisible } = useFocusRing({});
|
|
26
|
+
const { focusProps, isFocusVisible, isFocused } = useFocusRing({});
|
|
27
27
|
return /* @__PURE__ */ jsx("td", { ...cellProps, children: /* @__PURE__ */ jsx(
|
|
28
28
|
"div",
|
|
29
29
|
{
|
|
30
30
|
...mergeProps(hoverProps, focusProps, buttonProps),
|
|
31
31
|
ref,
|
|
32
|
+
"data-slot": "calendar-cell",
|
|
33
|
+
"data-today": isToday || void 0,
|
|
34
|
+
"data-focused": isFocused || void 0,
|
|
35
|
+
"data-pressed": isPressed || void 0,
|
|
36
|
+
"data-hovered": isHovered || void 0,
|
|
37
|
+
"data-invalid": isInvalid || void 0,
|
|
38
|
+
"data-disabled": isDisabled || void 0,
|
|
39
|
+
"data-selected": isSelected || void 0,
|
|
40
|
+
"data-unavailable": isUnavailable || void 0,
|
|
41
|
+
"data-focus-visible": isFocusVisible || void 0,
|
|
32
42
|
className: clsx(
|
|
33
43
|
s.base,
|
|
34
44
|
isToday && s.today,
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
state: CalendarState;
|
|
4
|
-
} & AriaCalendarGridProps;
|
|
5
|
-
export declare function CalendarGrid({ state, ...props }: CalendarGridProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export {};
|
|
1
|
+
import type { CalendarGridProps } from './index';
|
|
2
|
+
export declare function CalendarGrid({ state, slotProps, ...props }: CalendarGridProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo, useRef, useEffect, createRef } from "react";
|
|
4
|
-
import { useLocale, getWeeksInMonth, clsx } from "@koobiq/react-core";
|
|
4
|
+
import { useLocale, getWeeksInMonth, mergeProps, clsx } from "@koobiq/react-core";
|
|
5
5
|
import { useCalendarGrid } from "@koobiq/react-primitives";
|
|
6
6
|
import { TransitionGroup, CSSTransition } from "react-transition-group";
|
|
7
7
|
import { utilClasses } from "../../../../styles/utility.js";
|
|
@@ -9,7 +9,11 @@ import s from "./CalendarGrid.module.css.js";
|
|
|
9
9
|
import { monthIndex } from "./utils.js";
|
|
10
10
|
import { CalendarCell } from "../CalendarCell/CalendarCell.js";
|
|
11
11
|
const textNormal = utilClasses.typography["text-normal"];
|
|
12
|
-
function CalendarGrid({
|
|
12
|
+
function CalendarGrid({
|
|
13
|
+
state,
|
|
14
|
+
slotProps,
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
13
17
|
const { locale } = useLocale();
|
|
14
18
|
const { gridProps, headerProps, weekDays } = useCalendarGrid(
|
|
15
19
|
{ ...props, weekdayStyle: "short" },
|
|
@@ -40,7 +44,13 @@ function CalendarGrid({ state, ...props }) {
|
|
|
40
44
|
nodeRefs.current.set(k, createRef());
|
|
41
45
|
}
|
|
42
46
|
const tbodyRef = nodeRefs.current.get(k);
|
|
43
|
-
|
|
47
|
+
const rootProps = mergeProps({ className: s.container }, slotProps?.root);
|
|
48
|
+
const tableProps = mergeProps(
|
|
49
|
+
{ className: clsx(s.base, s[dir], textNormal) },
|
|
50
|
+
slotProps?.table,
|
|
51
|
+
gridProps
|
|
52
|
+
);
|
|
53
|
+
return /* @__PURE__ */ jsx("div", { ...rootProps, children: /* @__PURE__ */ jsxs("table", { ...tableProps, children: [
|
|
44
54
|
/* @__PURE__ */ jsxs("thead", { ...headerProps, children: [
|
|
45
55
|
/* @__PURE__ */ jsx("tr", { children: weekDays.map((day, i) => /* @__PURE__ */ jsx("th", { className: clsx(s.weekDay, textNormal), children: day }, i)) }),
|
|
46
56
|
/* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("th", { colSpan: 7, className: s.divider }) })
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef } from 'react';
|
|
2
|
+
import type { AriaCalendarGridProps, CalendarState } from '@koobiq/react-primitives';
|
|
3
|
+
export type CalendarGridProps = {
|
|
4
|
+
state: CalendarState;
|
|
5
|
+
/** The props used for each slot inside. */
|
|
6
|
+
slotProps?: {
|
|
7
|
+
root?: ComponentPropsWithRef<'div'>;
|
|
8
|
+
table?: ComponentPropsWithRef<'table'>;
|
|
9
|
+
};
|
|
10
|
+
} & AriaCalendarGridProps;
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
type CalendarHeaderProps = {
|
|
3
|
-
prevButtonProps: CalendarAria['prevButtonProps'];
|
|
4
|
-
nextButtonProps: CalendarAria['nextButtonProps'];
|
|
5
|
-
state: CalendarState;
|
|
6
|
-
};
|
|
1
|
+
import type { CalendarHeaderProps } from './types';
|
|
7
2
|
export declare const CalendarHeader: (props: CalendarHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|