@koobiq/react-components 0.0.1-beta.1 → 0.0.1-beta.10
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/README.md +14 -31
- package/dist/components/Alert/Alert.js +1 -1
- package/dist/components/Alert/components/AlertIcon/utils.js +1 -1
- package/dist/components/Alert/intl.json.js +2 -6
- package/dist/components/AnimatedIcon/AnimatedIcon.d.ts +4 -0
- package/dist/components/AnimatedIcon/AnimatedIcon.js +50 -0
- package/dist/components/AnimatedIcon/AnimatedIcon.module.css.js +11 -0
- package/dist/components/AnimatedIcon/index.d.ts +2 -0
- package/dist/components/AnimatedIcon/types.d.ts +19 -0
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.module.css.js +2 -2
- package/dist/components/Checkbox/Checkbox.js +18 -8
- package/dist/components/Container/Container.js +2 -1
- package/dist/components/Container/utils.d.ts +1 -1
- package/dist/components/Dialog/DialogContext.js +1 -1
- package/dist/components/Dialog/components/DialogContent.js +1 -1
- package/dist/components/Dialog/intl.json.js +2 -6
- package/dist/components/FieldComponents/FieldInputGroup/FieldInputGroup.d.ts +8 -2
- package/dist/components/FieldComponents/FieldInputGroup/FieldInputGroup.js +32 -30
- package/dist/components/FieldComponents/FieldSelect/FieldSelect.d.ts +12 -0
- package/dist/components/FieldComponents/FieldSelect/FieldSelect.js +37 -0
- package/dist/components/FieldComponents/FieldSelect/FieldSelect.module.css.js +20 -0
- package/dist/components/FieldComponents/FieldSelect/index.d.ts +1 -0
- package/dist/components/FieldComponents/index.d.ts +1 -0
- package/dist/components/FlexBox/FlexBox.d.ts +4 -0
- package/dist/components/FlexBox/FlexBox.js +47 -0
- package/dist/components/FlexBox/index.d.ts +2 -0
- package/dist/components/FlexBox/types.d.ts +27 -0
- package/dist/components/Input/Input.d.ts +1 -0
- package/dist/components/Input/Input.js +11 -11
- package/dist/components/Input/types.d.ts +2 -1
- package/dist/components/Link/Link.js +13 -15
- package/dist/components/List/List.d.ts +9 -0
- package/dist/components/List/List.js +46 -0
- package/dist/components/List/List.module.css.js +11 -0
- package/dist/components/List/ListItem.d.ts +6 -0
- package/dist/components/List/ListItem.js +11 -0
- package/dist/components/List/ListSection.d.ts +16 -0
- package/dist/components/List/ListSection.js +11 -0
- package/dist/components/List/components/ListItemText/ListItemText.d.ts +16 -0
- package/dist/components/List/components/ListItemText/index.d.ts +1 -0
- package/dist/components/List/components/ListOption/ListOption.d.ts +5 -0
- package/dist/components/List/components/ListOption/ListOption.js +44 -0
- package/dist/components/List/components/ListOption/ListOption.module.css.js +23 -0
- package/dist/components/List/components/ListOption/index.d.ts +1 -0
- package/dist/components/List/components/ListSection/ListSection.d.ts +5 -0
- package/dist/components/List/components/ListSection/ListSection.js +33 -0
- package/dist/components/List/components/ListSection/ListSection.module.css.js +11 -0
- package/dist/components/List/components/ListSection/index.d.ts +1 -0
- package/dist/components/List/components/index.d.ts +3 -0
- package/dist/components/List/index.d.ts +4 -0
- package/dist/components/List/types.d.ts +57 -0
- package/dist/components/List/types.js +4 -0
- package/dist/components/Modal/Modal.js +14 -12
- package/dist/components/Modal/types.d.ts +7 -0
- package/dist/components/Popover/Popover.d.ts +4 -2
- package/dist/components/Popover/Popover.js +137 -127
- package/dist/components/Popover/Popover.module.css.js +3 -0
- package/dist/components/Popover/types.d.ts +25 -3
- package/dist/components/ProgressBar/ProgressBar.module.css.js +1 -2
- package/dist/components/ProgressSpinner/ProgressSpinner.module.css.js +1 -2
- package/dist/components/Provider/BreakpointsProvider.d.ts +2 -1
- package/dist/components/Provider/BreakpointsProvider.js +8 -1
- package/dist/components/Provider/Provider.d.ts +1 -1
- package/dist/components/Provider/Provider.js +9 -1
- package/dist/components/Provider/types.d.ts +5 -0
- package/dist/components/Provider/utils/useBreakpoints.d.ts +2 -1
- package/dist/components/Provider/utils/useBreakpoints.js +2 -2
- package/dist/components/RadioGroup/RadioContext.js +1 -0
- package/dist/components/RadioGroup/RadioGroup.js +2 -1
- package/dist/components/RadioGroup/components/Radio/Radio.js +3 -2
- package/dist/components/RadioGroup/components/Radio/Radio.module.css.js +3 -0
- package/dist/components/Select/Select.d.ts +2 -0
- package/dist/components/Select/Select.js +172 -0
- package/dist/components/Select/Select.module.css.js +20 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Select/types.d.ts +87 -0
- package/dist/components/SidePanel/SidePanel.js +17 -15
- package/dist/components/SidePanel/types.d.ts +7 -0
- package/dist/components/SkeletonBlock/SkeletonBlock.module.css.js +0 -1
- package/dist/components/SkeletonTypography/utils.js +3 -0
- package/dist/components/Toggle/Toggle.js +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +2 -1
- package/dist/components/Tooltip/Tooltip.js +9 -8
- package/dist/components/Tooltip/types.d.ts +9 -4
- package/dist/components/Typography/Typography.js +2 -2
- package/dist/components/Typography/Typography.module.css.js +2 -1
- package/dist/components/Typography/types.d.ts +1 -1
- package/dist/components/Typography/types.js +2 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/layout/flex/flex.d.ts +15 -4
- package/dist/components/layout/flex/flex.js +6 -1
- package/dist/components/layout/flex/flex.module.css.js +78 -39
- package/dist/index.d.ts +2 -1
- package/dist/index.js +16 -1
- package/dist/style.css +482 -223
- package/dist/styles/utility.js +0 -1
- package/dist/styles/utility.module.css.js +0 -1
- package/dist/types.d.ts +1 -0
- package/package.json +6 -6
- package/dist/components/Input/components/FieldAddon/FieldAddon.d.ts +0 -10
- package/dist/components/Input/components/FieldAddon/index.d.ts +0 -1
- package/dist/components/Input/components/FieldCaption/FieldCaption.d.ts +0 -6
- package/dist/components/Input/components/FieldCaption/index.d.ts +0 -1
- package/dist/components/Input/components/FieldControl/FieldControl.d.ts +0 -9
- package/dist/components/Input/components/FieldControl/index.d.ts +0 -1
- package/dist/components/Input/components/FieldError/FieldError.d.ts +0 -7
- package/dist/components/Input/components/FieldError/index.d.ts +0 -1
- package/dist/components/Input/components/FieldInput/FieldInput.d.ts +0 -9
- package/dist/components/Input/components/FieldInput/index.d.ts +0 -1
- package/dist/components/Input/components/FieldInputGroup/FieldInputGroup.d.ts +0 -7
- package/dist/components/Input/components/FieldInputGroup/index.d.ts +0 -1
- package/dist/components/Input/components/FieldLabel/FieldLabel.d.ts +0 -9
- package/dist/components/Input/components/FieldLabel/index.d.ts +0 -1
- package/dist/components/Input/components/index.d.ts +0 -7
package/README.md
CHANGED
|
@@ -1,43 +1,26 @@
|
|
|
1
1
|
# @koobiq/react-components
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Koobiq React is an open-source design system for designers and developers, focused on designing products related to information security.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
pnpm add @koobiq/design-tokens @koobiq/react-components
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
### Usage
|
|
7
|
+
Depending on your preference, run one of the following in your terminal:
|
|
12
8
|
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import '@koobiq/design-tokens/web/css-tokens-dark.css';
|
|
17
|
-
import '@koobiq/react-components/style.css';
|
|
9
|
+
```sh
|
|
10
|
+
# With npm
|
|
11
|
+
npm install @koobiq/react-components
|
|
18
12
|
|
|
19
|
-
|
|
13
|
+
# With yarn
|
|
14
|
+
yarn add @koobiq/react-components
|
|
20
15
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
16
|
+
# With pnpm
|
|
17
|
+
yarn add @koobiq/react-components
|
|
24
18
|
```
|
|
25
19
|
|
|
26
|
-
##
|
|
27
|
-
|
|
28
|
-
[Check compatible browsers](https://browsersl.ist/#q=defaults+and+supports+es6-module%2C%0A++++chrome+%3E+88%2C%0A++++safari+%3E+14%2C%0A++++firefox+%3E+78%2C%0A++++opera+%3E+75%2C%0A++++edge+%3E+88)
|
|
20
|
+
## Usage
|
|
29
21
|
|
|
30
|
-
|
|
22
|
+
To get started with the library, read [the documentation](https://react.koobiq.io/).
|
|
31
23
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- Clone the repository and navigate to the created directory.
|
|
35
|
-
- Run the command `pnpm dev` in the terminal.
|
|
36
|
-
|
|
37
|
-
Documentation will be available at [http://localhost:6006](http://localhost:6006).
|
|
38
|
-
All development is conducted there. For convenience, you can go directly to the page of the component you are working on.
|
|
39
|
-
|
|
40
|
-
### Prerequisites
|
|
24
|
+
## Browser Support
|
|
41
25
|
|
|
42
|
-
|
|
43
|
-
- pnpm v9
|
|
26
|
+
[Check compatible browsers](https://browsersl.ist/#q=defaults+and+supports+es6-module%2C%0A++++chrome+%3E+105%2C%0A++++safari+%3E+15.4%2C%0A++++firefox+%3E+121%2C%0A++++opera+%3E+91%2C%0A++++edge+%3E+105)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
-
import { polymorphicForwardRef, mergeProps,
|
|
3
|
+
import { polymorphicForwardRef, mergeProps, isNotNil, clsx } from "@koobiq/react-core";
|
|
4
4
|
import { IconXmark16 } from "@koobiq/react-icons";
|
|
5
5
|
import { useLocalizedStringFormatter } from "@koobiq/react-primitives";
|
|
6
6
|
import s from "./Alert.module.css.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { IconExclamationTriangle16, IconCheckCircle16, IconInfoCircle16, IconCheck16 } from "@koobiq/react-icons";
|
|
3
3
|
const iconProps = {
|
|
4
4
|
focusable: false,
|
|
5
5
|
"aria-hidden": true
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, ElementType } from 'react';
|
|
2
|
+
import type { AnimatedIconBaseProps } from './index';
|
|
3
|
+
export declare const AnimatedIcon: import("@koobiq/react-core").PolyForwardComponent<"span", AnimatedIconBaseProps, ElementType>;
|
|
4
|
+
export type AnimatedIconProps<As extends ElementType = 'span'> = ComponentPropsWithRef<typeof AnimatedIcon<As>>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { polymorphicForwardRef, useRefs, clsx } from "@koobiq/react-core";
|
|
4
|
+
import { Transition } from "react-transition-group";
|
|
5
|
+
import s from "./AnimatedIcon.module.css.js";
|
|
6
|
+
const AnimatedIcon = polymorphicForwardRef((props, ref) => {
|
|
7
|
+
const {
|
|
8
|
+
transition = 300,
|
|
9
|
+
as: Tag = "span",
|
|
10
|
+
activeIndex = 0,
|
|
11
|
+
directions,
|
|
12
|
+
className,
|
|
13
|
+
icons = [],
|
|
14
|
+
style: styleProp,
|
|
15
|
+
...other
|
|
16
|
+
} = props;
|
|
17
|
+
const refs = useRefs(icons.length);
|
|
18
|
+
const singleIcon = icons?.[0];
|
|
19
|
+
const innerRender = icons.length === 1 ? singleIcon : icons.map((icon, index) => /* @__PURE__ */ jsx(
|
|
20
|
+
Transition,
|
|
21
|
+
{
|
|
22
|
+
in: activeIndex === index,
|
|
23
|
+
timeout: transition,
|
|
24
|
+
nodeRef: refs[index],
|
|
25
|
+
unmountOnExit: true,
|
|
26
|
+
children: (transition2) => /* @__PURE__ */ jsx(
|
|
27
|
+
"span",
|
|
28
|
+
{
|
|
29
|
+
className: s.icon,
|
|
30
|
+
"data-index": index,
|
|
31
|
+
ref: refs[index],
|
|
32
|
+
"data-transition": transition2,
|
|
33
|
+
children: icon
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
},
|
|
37
|
+
index
|
|
38
|
+
));
|
|
39
|
+
const style = {
|
|
40
|
+
...styleProp,
|
|
41
|
+
"--animated-icon-transition": `${transition}ms`,
|
|
42
|
+
...typeof directions?.[activeIndex] === "number" && {
|
|
43
|
+
"--animated-icon-direction": `rotate(${directions[activeIndex]}deg)`
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
return /* @__PURE__ */ jsx(Tag, { ...other, className: clsx(s.base, className), style, ref, children: innerRender });
|
|
47
|
+
});
|
|
48
|
+
export {
|
|
49
|
+
AnimatedIcon
|
|
50
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ComponentRef, CSSProperties, ReactNode } from 'react';
|
|
2
|
+
export type AnimatedIconBaseProps = {
|
|
3
|
+
/** A list of icons. */
|
|
4
|
+
icons?: ReactNode[];
|
|
5
|
+
/** A list of directions for the icons. */
|
|
6
|
+
directions?: number[];
|
|
7
|
+
/**
|
|
8
|
+
* Animation duration in milliseconds.
|
|
9
|
+
* @default 300
|
|
10
|
+
* */
|
|
11
|
+
transition?: number;
|
|
12
|
+
/** Index of the active icon. */
|
|
13
|
+
activeIndex?: number;
|
|
14
|
+
/** Additional CSS-classes. */
|
|
15
|
+
className?: string;
|
|
16
|
+
/** Inline styles. */
|
|
17
|
+
style?: CSSProperties;
|
|
18
|
+
};
|
|
19
|
+
export type AnimatedIconRef = ComponentRef<'span'>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs,
|
|
2
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { polymorphicForwardRef, clsx } from "@koobiq/react-core";
|
|
4
4
|
import { Button as Button$1 } from "@koobiq/react-primitives";
|
|
5
5
|
import s from "./Button.module.css.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const base = "kbq-button-d95067";
|
|
2
2
|
const hovered = "kbq-button-hovered-037da3";
|
|
3
|
+
const progress = "kbq-button-progress-f454f0";
|
|
3
4
|
const pressed = "kbq-button-pressed-508d5d";
|
|
4
5
|
const focusVisible = "kbq-button-focusVisible-e63c2b";
|
|
5
|
-
const progress = "kbq-button-progress-f454f0";
|
|
6
6
|
const disabled = "kbq-button-disabled-1df5f6";
|
|
7
7
|
const fullWidth = "kbq-button-fullWidth-c149b8";
|
|
8
8
|
const onlyIcon = "kbq-button-onlyIcon-e1268c";
|
|
@@ -12,9 +12,9 @@ const label = "kbq-button-label-9f6f6b";
|
|
|
12
12
|
const s = {
|
|
13
13
|
base,
|
|
14
14
|
hovered,
|
|
15
|
+
progress,
|
|
15
16
|
pressed,
|
|
16
17
|
focusVisible,
|
|
17
|
-
progress,
|
|
18
18
|
disabled,
|
|
19
19
|
fullWidth,
|
|
20
20
|
onlyIcon,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { mergeProps, clsx, isNotNil } from "@koobiq/react-core";
|
|
5
5
|
import { IconCheckS16, IconMinusS16 } from "@koobiq/react-icons";
|
|
6
6
|
import { Checkbox as Checkbox$1 } from "@koobiq/react-primitives";
|
|
7
7
|
import s from "./Checkbox.module.css.js";
|
|
8
|
+
import { AnimatedIcon } from "../AnimatedIcon/AnimatedIcon.js";
|
|
8
9
|
const Checkbox = forwardRef(
|
|
9
10
|
(props, ref) => {
|
|
10
11
|
const {
|
|
@@ -47,13 +48,22 @@ const Checkbox = forwardRef(
|
|
|
47
48
|
"data-indeterminate": indeterminate,
|
|
48
49
|
...commonProps,
|
|
49
50
|
ref,
|
|
50
|
-
children: ({ checked, indeterminate: indeterminate2 }) =>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
children: ({ checked, indeterminate: indeterminate2 }) => {
|
|
52
|
+
const activeIndex = indeterminate2 ? 1 : Number(Boolean(checked)) - 1;
|
|
53
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54
|
+
/* @__PURE__ */ jsx("span", { ...boxProps, children: /* @__PURE__ */ jsx(
|
|
55
|
+
AnimatedIcon,
|
|
56
|
+
{
|
|
57
|
+
icons: [
|
|
58
|
+
/* @__PURE__ */ jsx(IconCheckS16, {}, "checked"),
|
|
59
|
+
/* @__PURE__ */ jsx(IconMinusS16, {}, "indeterminate")
|
|
60
|
+
],
|
|
61
|
+
activeIndex
|
|
62
|
+
}
|
|
63
|
+
) }),
|
|
64
|
+
isNotNil(children) && /* @__PURE__ */ jsx("span", { ...labelProps, children })
|
|
65
|
+
] });
|
|
66
|
+
}
|
|
57
67
|
}
|
|
58
68
|
);
|
|
59
69
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx } from "react/jsx-runtime";
|
|
2
3
|
import { polymorphicForwardRef, clsx } from "@koobiq/react-core";
|
|
3
4
|
import s from "./Container.module.css.js";
|
|
4
|
-
import { normalizeMaxInlineSize, normalizePosition
|
|
5
|
+
import { normalizeMargins, normalizeMaxInlineSize, normalizePosition } from "./utils.js";
|
|
5
6
|
import { useMatchedBreakpoints } from "../Provider/BreakpointsContext.js";
|
|
6
7
|
import { getResponsiveValue } from "../../utils/getResponsiveValue/getResponsiveValue.js";
|
|
7
8
|
const Container = polymorphicForwardRef(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ContainerMarginsProp, ContainerMaxInlineSizeProp, ContainerPositionProp } from './types';
|
|
2
2
|
export declare const normalizeMargins: (value: ContainerMarginsProp | undefined) => string | 0 | undefined;
|
|
3
3
|
export declare const normalizeMaxInlineSize: (value: ContainerMaxInlineSizeProp | undefined) => string | undefined;
|
|
4
|
-
export declare const normalizePosition: (value: ContainerPositionProp | undefined) => "
|
|
4
|
+
export declare const normalizePosition: (value: ContainerPositionProp | undefined) => "auto" | "0 auto" | "auto 0";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { clsx, useMultiRef } from "@koobiq/react-core";
|
|
5
5
|
import { utilClasses } from "../../../styles/utility.js";
|
|
6
6
|
import s from "../Dialog.module.css.js";
|
|
7
7
|
import { useDialogProvider } from "../DialogContext.js";
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type ExtendableComponentPropsWithRef } from '@koobiq/react-core';
|
|
3
|
-
|
|
3
|
+
import { type FieldAddonProps } from '../FieldAddon';
|
|
4
|
+
export type FieldInputGroupProps = ExtendableComponentPropsWithRef<{
|
|
4
5
|
children?: ReactNode;
|
|
5
6
|
startAddon?: ReactNode;
|
|
6
7
|
endAddon?: ReactNode;
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
className?: string;
|
|
9
10
|
error?: boolean;
|
|
11
|
+
/** The props used for each slot inside. */
|
|
12
|
+
slotProps?: {
|
|
13
|
+
start?: FieldAddonProps;
|
|
14
|
+
end?: FieldAddonProps;
|
|
15
|
+
};
|
|
10
16
|
}, 'div'>;
|
|
11
|
-
export declare const FieldInputGroup: import("react").ForwardRefExoticComponent<Omit<
|
|
17
|
+
export declare const FieldInputGroup: import("react").ForwardRefExoticComponent<Omit<FieldInputGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -5,36 +5,38 @@ import { useInputContext, Group } from "@koobiq/react-primitives";
|
|
|
5
5
|
import s from "./FieldInputGroup.module.css.js";
|
|
6
6
|
import { FieldInputGroupContext } from "./FieldInputGroupContext.js";
|
|
7
7
|
import { FieldAddon } from "../FieldAddon/FieldAddon.js";
|
|
8
|
-
const FieldInputGroup = forwardRef(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
8
|
+
const FieldInputGroup = forwardRef(
|
|
9
|
+
({ children, className, startAddon, endAddon, error, slotProps, ...other }, ref) => {
|
|
10
|
+
const { value } = useInputContext();
|
|
11
|
+
const hasStartAddon = !!startAddon;
|
|
12
|
+
const hasEndAddon = !!endAddon;
|
|
13
|
+
const hasValue = isNotNil(value);
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
Group,
|
|
16
|
+
{
|
|
17
|
+
className: clsx(
|
|
18
|
+
s.base,
|
|
19
|
+
hasStartAddon && s.hasStartAddon,
|
|
20
|
+
hasEndAddon && s.hasEndAddon,
|
|
21
|
+
className
|
|
22
|
+
),
|
|
23
|
+
...other,
|
|
24
|
+
ref,
|
|
25
|
+
children: ({ hovered, focusWithin, disabled }) => /* @__PURE__ */ jsxs(
|
|
26
|
+
FieldInputGroupContext.Provider,
|
|
27
|
+
{
|
|
28
|
+
value: { disabled, hovered, hasValue, focusWithin },
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ jsx(FieldAddon, { placement: "start", error, ...slotProps?.start, children: startAddon }),
|
|
31
|
+
children,
|
|
32
|
+
/* @__PURE__ */ jsx(FieldAddon, { placement: "end", error, ...slotProps?.end, children: endAddon })
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
);
|
|
38
40
|
FieldInputGroup.displayName = "FieldInputGroup";
|
|
39
41
|
export {
|
|
40
42
|
FieldInputGroup
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { InputPropVariant } from '../../Input';
|
|
3
|
+
export type FieldSelectProps = {
|
|
4
|
+
error?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
'data-testid'?: string;
|
|
9
|
+
variant?: InputPropVariant;
|
|
10
|
+
placeholder?: string | number;
|
|
11
|
+
};
|
|
12
|
+
export declare const FieldSelect: import("react").ForwardRefExoticComponent<FieldSelectProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { clsx, isNotNil } from "@koobiq/react-core";
|
|
4
|
+
import { Button } from "@koobiq/react-primitives";
|
|
5
|
+
import s from "./FieldSelect.module.css.js";
|
|
6
|
+
const FieldSelect = forwardRef(
|
|
7
|
+
({
|
|
8
|
+
error = false,
|
|
9
|
+
disabled = false,
|
|
10
|
+
variant = "filled",
|
|
11
|
+
placeholder,
|
|
12
|
+
children,
|
|
13
|
+
className,
|
|
14
|
+
...other
|
|
15
|
+
}, ref) => /* @__PURE__ */ jsx(
|
|
16
|
+
Button,
|
|
17
|
+
{
|
|
18
|
+
...other,
|
|
19
|
+
disabled,
|
|
20
|
+
"data-slot": "select-value",
|
|
21
|
+
className: clsx(
|
|
22
|
+
s.base,
|
|
23
|
+
s[variant],
|
|
24
|
+
error && s.error,
|
|
25
|
+
disabled && s.disabled,
|
|
26
|
+
!isNotNil(children) && s.hasPlaceholder,
|
|
27
|
+
className
|
|
28
|
+
),
|
|
29
|
+
ref,
|
|
30
|
+
children: /* @__PURE__ */ jsx("span", { className: s.content, children: children ?? placeholder })
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
);
|
|
34
|
+
FieldSelect.displayName = "FieldSelect";
|
|
35
|
+
export {
|
|
36
|
+
FieldSelect
|
|
37
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const base = "kbq-fieldselect-0f0f5e";
|
|
2
|
+
const content = "kbq-fieldselect-content-c36142";
|
|
3
|
+
const error = "kbq-fieldselect-error-0cac4a";
|
|
4
|
+
const disabled = "kbq-fieldselect-disabled-f0efd4";
|
|
5
|
+
const hasPlaceholder = "kbq-fieldselect-hasPlaceholder-7b7518";
|
|
6
|
+
const s = {
|
|
7
|
+
base,
|
|
8
|
+
content,
|
|
9
|
+
error,
|
|
10
|
+
disabled,
|
|
11
|
+
hasPlaceholder
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
base,
|
|
15
|
+
content,
|
|
16
|
+
s as default,
|
|
17
|
+
disabled,
|
|
18
|
+
error,
|
|
19
|
+
hasPlaceholder
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FieldSelect';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, ElementType } from 'react';
|
|
2
|
+
import type { FlexBoxBaseProps } from './index';
|
|
3
|
+
export declare const FlexBox: import("@koobiq/react-core").PolyForwardComponent<"div", FlexBoxBaseProps, ElementType>;
|
|
4
|
+
export type FlexBoxProps<As extends ElementType = 'div'> = ComponentPropsWithRef<typeof FlexBox<As>>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { polymorphicForwardRef, clsx } from "@koobiq/react-core";
|
|
4
|
+
import { useMatchedBreakpoints } from "../Provider/BreakpointsContext.js";
|
|
5
|
+
import { getResponsiveValue } from "../../utils/getResponsiveValue/getResponsiveValue.js";
|
|
6
|
+
import { flex } from "../layout/flex/flex.js";
|
|
7
|
+
const FlexBox = polymorphicForwardRef(
|
|
8
|
+
({
|
|
9
|
+
as: Tag = "div",
|
|
10
|
+
gap: gapProp,
|
|
11
|
+
wrap: wrapProp,
|
|
12
|
+
flex: flexProp,
|
|
13
|
+
colGap: colGapProp,
|
|
14
|
+
rowGap: rowGapProp,
|
|
15
|
+
direction: directionProp,
|
|
16
|
+
alignItems: alignItemsProp,
|
|
17
|
+
justifyContent: justifyContentProp,
|
|
18
|
+
children,
|
|
19
|
+
className,
|
|
20
|
+
...other
|
|
21
|
+
}, ref) => {
|
|
22
|
+
const breakpoints = useMatchedBreakpoints();
|
|
23
|
+
const flex$1 = getResponsiveValue(flexProp, breakpoints);
|
|
24
|
+
const gap = getResponsiveValue(gapProp, breakpoints);
|
|
25
|
+
const colGap = getResponsiveValue(colGapProp, breakpoints);
|
|
26
|
+
const rowGap = getResponsiveValue(rowGapProp, breakpoints);
|
|
27
|
+
const wrap = getResponsiveValue(wrapProp, breakpoints);
|
|
28
|
+
const alignItems = getResponsiveValue(alignItemsProp, breakpoints);
|
|
29
|
+
const direction = getResponsiveValue(directionProp, breakpoints);
|
|
30
|
+
const justifyContent = getResponsiveValue(justifyContentProp, breakpoints);
|
|
31
|
+
const flexCn = flex({
|
|
32
|
+
gap,
|
|
33
|
+
flex: flex$1,
|
|
34
|
+
wrap,
|
|
35
|
+
colGap,
|
|
36
|
+
rowGap,
|
|
37
|
+
direction,
|
|
38
|
+
alignItems,
|
|
39
|
+
justifyContent
|
|
40
|
+
});
|
|
41
|
+
return /* @__PURE__ */ jsx(Tag, { className: clsx(flexCn, className), ...other, ref, children });
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
FlexBox.displayName = "FlexBox";
|
|
45
|
+
export {
|
|
46
|
+
FlexBox
|
|
47
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import type { ResponsiveValue } from '../../utils';
|
|
3
|
+
import type { FlexPropGap, FlexPropWrap, FlexPropFlex, FlexPropDirection, FlexPropAlignItems, FlexPropJustifyContent } from '../layout';
|
|
4
|
+
export type FlexBoxBaseProps = {
|
|
5
|
+
/** Defines the `display` property with `flex` or `inline-flex` value. */
|
|
6
|
+
flex?: FlexPropFlex | ResponsiveValue<FlexPropFlex>;
|
|
7
|
+
/** Defines the `flex-wrap` property. */
|
|
8
|
+
wrap?: FlexPropWrap | ResponsiveValue<FlexPropWrap>;
|
|
9
|
+
/** Defines the `flex-direction` property. */
|
|
10
|
+
direction?: FlexPropDirection | ResponsiveValue<FlexPropDirection>;
|
|
11
|
+
/** Defines the `gap` property. */
|
|
12
|
+
gap?: FlexPropGap | ResponsiveValue<FlexPropGap>;
|
|
13
|
+
/** Defines the `column-gap` property. */
|
|
14
|
+
colGap?: FlexPropGap | ResponsiveValue<FlexPropGap>;
|
|
15
|
+
/** Defines the `row-gap` property. */
|
|
16
|
+
rowGap?: FlexPropGap | ResponsiveValue<FlexPropGap>;
|
|
17
|
+
/** Defines the `justify-content` property. */
|
|
18
|
+
justifyContent?: FlexPropJustifyContent | ResponsiveValue<FlexPropJustifyContent>;
|
|
19
|
+
/** Defines the `align-items` property. */
|
|
20
|
+
alignItems?: FlexPropAlignItems | ResponsiveValue<FlexPropAlignItems>;
|
|
21
|
+
/** Additional CSS-classes. */
|
|
22
|
+
className?: string;
|
|
23
|
+
/** The content of the component. */
|
|
24
|
+
children?: ReactNode;
|
|
25
|
+
/** Inline styles. */
|
|
26
|
+
style?: CSSProperties;
|
|
27
|
+
};
|
|
@@ -17,6 +17,7 @@ export declare const Input: import("react").ForwardRefExoticComponent<Omit<Omit<
|
|
|
17
17
|
label?: import("../FieldComponents").FieldLabelProps;
|
|
18
18
|
input?: import("../FieldComponents").FieldInputProps;
|
|
19
19
|
caption?: import("../FieldComponents").FieldCaptionProps;
|
|
20
|
+
group?: import("../FieldComponents").FieldInputGroupProps;
|
|
20
21
|
errorMessage?: import("../FieldComponents").FieldErrorProps;
|
|
21
22
|
};
|
|
22
23
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -21,7 +21,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
21
21
|
caption,
|
|
22
22
|
...other
|
|
23
23
|
} = props;
|
|
24
|
-
const
|
|
24
|
+
const inputRef = useDOMRef(ref);
|
|
25
25
|
const rootProps = mergeProps(
|
|
26
26
|
{
|
|
27
27
|
label,
|
|
@@ -42,23 +42,23 @@ const Input = forwardRef((props, ref) => {
|
|
|
42
42
|
error,
|
|
43
43
|
variant,
|
|
44
44
|
disabled,
|
|
45
|
-
ref:
|
|
45
|
+
ref: inputRef
|
|
46
46
|
},
|
|
47
47
|
slotProps?.input
|
|
48
48
|
);
|
|
49
|
+
const groupProps = mergeProps(
|
|
50
|
+
{
|
|
51
|
+
error,
|
|
52
|
+
endAddon,
|
|
53
|
+
startAddon
|
|
54
|
+
},
|
|
55
|
+
slotProps?.group
|
|
56
|
+
);
|
|
49
57
|
const captionProps = slotProps?.caption;
|
|
50
58
|
const errorProps = mergeProps({ error }, slotProps?.errorMessage);
|
|
51
59
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
52
60
|
/* @__PURE__ */ jsx(FieldLabel, { ...labelProps, children: labelProps?.children || label }),
|
|
53
|
-
/* @__PURE__ */ jsx(
|
|
54
|
-
FieldInputGroup,
|
|
55
|
-
{
|
|
56
|
-
error,
|
|
57
|
-
endAddon,
|
|
58
|
-
startAddon,
|
|
59
|
-
children: /* @__PURE__ */ jsx(FieldInput, { ...inputProps })
|
|
60
|
-
}
|
|
61
|
-
),
|
|
61
|
+
/* @__PURE__ */ jsx(FieldInputGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldInput, { ...inputProps }) }),
|
|
62
62
|
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps, children: captionProps?.children || caption }),
|
|
63
63
|
/* @__PURE__ */ jsx(FieldError, { ...errorProps, children: errorProps.children || errorMessage })
|
|
64
64
|
] });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ComponentRef, CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import type { ExtendableProps } from '@koobiq/react-core';
|
|
3
3
|
import type { UseTextFieldProps } from '@koobiq/react-primitives';
|
|
4
|
-
import type { FieldCaptionProps, FieldErrorProps, FieldInputProps, FieldLabelProps } from '../FieldComponents';
|
|
4
|
+
import type { FieldCaptionProps, FieldErrorProps, FieldInputProps, FieldLabelProps, FieldInputGroupProps } from '../FieldComponents';
|
|
5
5
|
export declare const inputPropVariant: readonly ["filled", "transparent"];
|
|
6
6
|
export type InputPropVariant = (typeof inputPropVariant)[number];
|
|
7
7
|
export type InputProps = ExtendableProps<{
|
|
@@ -56,6 +56,7 @@ export type InputProps = ExtendableProps<{
|
|
|
56
56
|
label?: FieldLabelProps;
|
|
57
57
|
input?: FieldInputProps;
|
|
58
58
|
caption?: FieldCaptionProps;
|
|
59
|
+
group?: FieldInputGroupProps;
|
|
59
60
|
errorMessage?: FieldErrorProps;
|
|
60
61
|
};
|
|
61
62
|
}, Omit<UseTextFieldProps, 'inputElementType'>>;
|