@koobiq/react-components 0.2.2 → 0.3.1
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/Button/Button.js +4 -0
- package/dist/components/FieldComponents/FieldSelect/FieldSelect.d.ts +2 -2
- package/dist/components/FieldComponents/FieldSelect/FieldSelect.js +28 -24
- package/dist/components/FieldComponents/FieldSelect/FieldSelect.module.css.js +7 -1
- package/dist/components/FieldComponents/FieldSelect/utils.d.ts +2 -0
- package/dist/components/FieldComponents/FieldSelect/utils.js +4 -0
- package/dist/components/IconButton/IconButton.js +3 -0
- package/dist/components/List/components/ListItemText/ListItemText.d.ts +2 -16
- package/dist/components/List/components/ListItemText/ListItemText.js +1 -1
- package/dist/components/List/components/ListItemText/index.d.ts +1 -0
- package/dist/components/List/components/ListItemText/types.d.ts +15 -0
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Select/Select.module.css.js +3 -0
- package/dist/components/Select/types.d.ts +2 -2
- package/dist/components/TagGroup/components/Tag/Tag.js +3 -6
- package/dist/style.css +24 -6
- package/package.json +5 -5
- package/dist/components/TagGroup/intl.json.js +0 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef, ElementType } from 'react';
|
|
2
2
|
import type { FieldSelectBaseProps } from './index';
|
|
3
|
-
export declare const FieldSelect: import("@koobiq/react-core").PolyForwardComponent<"
|
|
4
|
-
export type FieldSelectProps<As extends ElementType = '
|
|
3
|
+
export declare const FieldSelect: import("@koobiq/react-core").PolyForwardComponent<"div", FieldSelectBaseProps, ElementType>;
|
|
4
|
+
export type FieldSelectProps<As extends ElementType = 'div'> = ComponentPropsWithRef<typeof FieldSelect<As>>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { polymorphicForwardRef, clsx,
|
|
2
|
+
import { polymorphicForwardRef, clsx, isNotNil } from "@koobiq/react-core";
|
|
3
3
|
import { Button } from "@koobiq/react-primitives";
|
|
4
4
|
import s from "./FieldSelect.module.css.js";
|
|
5
|
+
import { isPrimitiveNode } from "./utils.js";
|
|
5
6
|
const FieldSelect = polymorphicForwardRef(
|
|
6
7
|
({
|
|
7
|
-
as = "
|
|
8
|
+
as = "div",
|
|
8
9
|
isInvalid = false,
|
|
9
10
|
isDisabled = false,
|
|
10
11
|
variant = "filled",
|
|
@@ -12,28 +13,31 @@ const FieldSelect = polymorphicForwardRef(
|
|
|
12
13
|
children,
|
|
13
14
|
className,
|
|
14
15
|
...other
|
|
15
|
-
}, ref) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
16
|
+
}, ref) => {
|
|
17
|
+
const content = children ?? placeholder;
|
|
18
|
+
return /* @__PURE__ */ jsxs(
|
|
19
|
+
Button,
|
|
20
|
+
{
|
|
21
|
+
...other,
|
|
22
|
+
as,
|
|
23
|
+
isDisabled,
|
|
24
|
+
"data-slot": "select-value",
|
|
25
|
+
className: clsx(
|
|
26
|
+
s.base,
|
|
27
|
+
s[variant],
|
|
28
|
+
isInvalid && s.invalid,
|
|
29
|
+
isDisabled && s.disabled,
|
|
30
|
+
!isNotNil(children) && s.hasPlaceholder,
|
|
31
|
+
className
|
|
32
|
+
),
|
|
33
|
+
ref,
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsx("span", { className: s.hiddenPlaceholder, "aria-hidden": true, children: placeholder }),
|
|
36
|
+
/* @__PURE__ */ jsx("div", { className: s.container, children: isPrimitiveNode(content) ? /* @__PURE__ */ jsx("span", { className: s.content, children: content }) : children })
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
37
41
|
);
|
|
38
42
|
FieldSelect.displayName = "FieldSelect";
|
|
39
43
|
export {
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
const base = "kbq-fieldselect-0f0f5e";
|
|
2
|
+
const container = "kbq-fieldselect-container-422b17";
|
|
2
3
|
const content = "kbq-fieldselect-content-c36142";
|
|
3
4
|
const invalid = "kbq-fieldselect-invalid-db8152";
|
|
4
5
|
const disabled = "kbq-fieldselect-disabled-f0efd4";
|
|
5
6
|
const hasPlaceholder = "kbq-fieldselect-hasPlaceholder-7b7518";
|
|
7
|
+
const hiddenPlaceholder = "kbq-fieldselect-hiddenPlaceholder-a3a36d";
|
|
6
8
|
const s = {
|
|
7
9
|
base,
|
|
10
|
+
container,
|
|
8
11
|
content,
|
|
9
12
|
invalid,
|
|
10
13
|
disabled,
|
|
11
|
-
hasPlaceholder
|
|
14
|
+
hasPlaceholder,
|
|
15
|
+
hiddenPlaceholder
|
|
12
16
|
};
|
|
13
17
|
export {
|
|
14
18
|
base,
|
|
19
|
+
container,
|
|
15
20
|
content,
|
|
16
21
|
s as default,
|
|
17
22
|
disabled,
|
|
18
23
|
hasPlaceholder,
|
|
24
|
+
hiddenPlaceholder,
|
|
19
25
|
invalid
|
|
20
26
|
};
|
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
import type { TypographyProps } from '../../../Typography';
|
|
4
|
-
export type ListItemTextRef = ComponentRef<'div'>;
|
|
5
|
-
export type ListItemTextProps = ExtendableComponentPropsWithRef<{
|
|
6
|
-
/** The content of the component. */
|
|
7
|
-
children?: ReactNode;
|
|
8
|
-
/** The helper text content. */
|
|
9
|
-
caption?: ReactNode;
|
|
10
|
-
/** The props used for each slot inside. */
|
|
11
|
-
slotProps?: {
|
|
12
|
-
text?: TypographyProps;
|
|
13
|
-
caption?: TypographyProps;
|
|
14
|
-
};
|
|
15
|
-
} & DataAttributeProps, 'div'>;
|
|
16
|
-
export declare const ListItemText: import("react").ForwardRefExoticComponent<Omit<ListItemTextProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
1
|
+
import type { ListItemTextProps } from './types';
|
|
2
|
+
export declare const ListItemText: import("react").ForwardRefExoticComponent<Omit<ListItemTextProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
@@ -5,7 +5,7 @@ import { isNotNil, clsx } from "@koobiq/react-core";
|
|
|
5
5
|
import s from "./ListItemText.module.css.js";
|
|
6
6
|
import { Typography } from "../../../Typography/Typography.js";
|
|
7
7
|
const ListItemText = forwardRef(
|
|
8
|
-
({ className, children, caption, slotProps, ...other }, ref) => /* @__PURE__ */ jsxs("
|
|
8
|
+
({ className, children, caption, slotProps, ...other }, ref) => /* @__PURE__ */ jsxs("span", { className: clsx(s.base, className), ...other, ref, children: [
|
|
9
9
|
/* @__PURE__ */ jsx(Typography, { as: "span", align: "start", ellipsis: true, ...slotProps?.text, children }),
|
|
10
10
|
isNotNil(caption) && /* @__PURE__ */ jsx(
|
|
11
11
|
Typography,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ComponentRef, ReactNode } from 'react';
|
|
2
|
+
import type { DataAttributeProps, ExtendableComponentPropsWithRef } from '@koobiq/react-core';
|
|
3
|
+
import type { TypographyProps } from '../../../Typography';
|
|
4
|
+
export type ListItemTextRef = ComponentRef<'span'>;
|
|
5
|
+
export type ListItemTextProps = ExtendableComponentPropsWithRef<{
|
|
6
|
+
/** The content of the component. */
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/** The helper text content. */
|
|
9
|
+
caption?: ReactNode;
|
|
10
|
+
/** The props used for each slot inside. */
|
|
11
|
+
slotProps?: {
|
|
12
|
+
text?: TypographyProps;
|
|
13
|
+
caption?: TypographyProps;
|
|
14
|
+
};
|
|
15
|
+
} & DataAttributeProps, 'span'>;
|
|
@@ -128,7 +128,7 @@ function SelectRender(props, ref) {
|
|
|
128
128
|
startAddon,
|
|
129
129
|
endAddon: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
130
130
|
endAddon,
|
|
131
|
-
/* @__PURE__ */ jsx(IconChevronDownS16, {})
|
|
131
|
+
/* @__PURE__ */ jsx(IconChevronDownS16, { className: s.chevron })
|
|
132
132
|
] }),
|
|
133
133
|
isInvalid,
|
|
134
134
|
isDisabled,
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
const base = "kbq-select-6d31ad";
|
|
2
2
|
const fullWidth = "kbq-select-fullWidth-1dfc13";
|
|
3
3
|
const addon = "kbq-select-addon-cbc524";
|
|
4
|
+
const chevron = "kbq-select-chevron-0b4fa3";
|
|
4
5
|
const popover = "kbq-select-popover-79fc05";
|
|
5
6
|
const list = "kbq-select-list-8ffac0";
|
|
6
7
|
const s = {
|
|
7
8
|
base,
|
|
8
9
|
fullWidth,
|
|
9
10
|
addon,
|
|
11
|
+
chevron,
|
|
10
12
|
popover,
|
|
11
13
|
list
|
|
12
14
|
};
|
|
13
15
|
export {
|
|
14
16
|
addon,
|
|
15
17
|
base,
|
|
18
|
+
chevron,
|
|
16
19
|
s as default,
|
|
17
20
|
fullWidth,
|
|
18
21
|
list,
|
|
@@ -67,7 +67,7 @@ export type SelectProps<T> = ExtendableProps<{
|
|
|
67
67
|
/** Unique identifier for testing purposes. */
|
|
68
68
|
'data-testid'?: string | number;
|
|
69
69
|
/** Ref to the control */
|
|
70
|
-
ref?: Ref<
|
|
70
|
+
ref?: Ref<HTMLDivElement>;
|
|
71
71
|
/** A render function for displaying the selected value. */
|
|
72
72
|
renderValue?: (props: Node<T> | null) => ReactElement;
|
|
73
73
|
/** The props used for each slot inside. */
|
|
@@ -82,5 +82,5 @@ export type SelectProps<T> = ExtendableProps<{
|
|
|
82
82
|
};
|
|
83
83
|
} & SelectDeprecatedProps, Omit<AriaSelectProps<T>, 'description' | 'validationState'>>;
|
|
84
84
|
export type SelectComponent = <T>(props: SelectProps<T>) => ReactElement | null;
|
|
85
|
-
export type SelectRef = ComponentRef<'
|
|
85
|
+
export type SelectRef = ComponentRef<'div'>;
|
|
86
86
|
export {};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useRef } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { useFocusRing, useHover, mergeProps, clsx, isNotNil } from "@koobiq/react-core";
|
|
4
4
|
import { IconXmarkS16 } from "@koobiq/react-icons";
|
|
5
5
|
import { useTag } from "@koobiq/react-primitives";
|
|
6
6
|
import { utilClasses } from "../../../../styles/utility.js";
|
|
7
|
-
import intlMessages from "../../intl.json.js";
|
|
8
7
|
import s from "./Tag.module.css.js";
|
|
9
8
|
import { matchVariantToCloseButton } from "./utils.js";
|
|
10
9
|
import { IconButton } from "../../../IconButton/IconButton.js";
|
|
@@ -13,7 +12,6 @@ function Tag(props) {
|
|
|
13
12
|
const { item, state, variant = "theme-fade" } = props;
|
|
14
13
|
const { slotProps, icon, className, style } = item.props;
|
|
15
14
|
const ref = useRef(null);
|
|
16
|
-
const stringFormatter = useLocalizedStringFormatter(intlMessages);
|
|
17
15
|
const { focusProps, isFocusVisible, isFocused } = useFocusRing({
|
|
18
16
|
within: false
|
|
19
17
|
});
|
|
@@ -53,12 +51,11 @@ function Tag(props) {
|
|
|
53
51
|
);
|
|
54
52
|
const removeButtonProps = mergeProps(
|
|
55
53
|
{
|
|
54
|
+
isDisabled,
|
|
56
55
|
tabIndex: -1,
|
|
57
56
|
isCompact: true,
|
|
58
|
-
isDisabled,
|
|
59
57
|
className: s.cancelIcon,
|
|
60
|
-
variant: matchVariantToCloseButton[variant]
|
|
61
|
-
"aria-label": stringFormatter.format("close")
|
|
58
|
+
variant: matchVariantToCloseButton[variant]
|
|
62
59
|
},
|
|
63
60
|
removeButtonPropsAria,
|
|
64
61
|
slotProps?.removeIcon
|
package/dist/style.css
CHANGED
|
@@ -3104,6 +3104,10 @@
|
|
|
3104
3104
|
pointer-events: none;
|
|
3105
3105
|
}
|
|
3106
3106
|
|
|
3107
|
+
.kbq-select-addon-cbc524 > :not(.kbq-select-chevron-0b4fa3) {
|
|
3108
|
+
pointer-events: all;
|
|
3109
|
+
}
|
|
3110
|
+
|
|
3107
3111
|
.kbq-select-popover-79fc05 {
|
|
3108
3112
|
border-radius: var(--kbq-size-s);
|
|
3109
3113
|
opacity: 0;
|
|
@@ -3128,7 +3132,6 @@
|
|
|
3128
3132
|
--field-input-color: var(--kbq-foreground-contrast);
|
|
3129
3133
|
--field-input-bg-color: var(--kbq-background-bg);
|
|
3130
3134
|
--field-input-placeholder-color: var(--kbq-foreground-contrast-tertiary);
|
|
3131
|
-
gap: var(--kbq-size-s);
|
|
3132
3135
|
cursor: pointer;
|
|
3133
3136
|
box-sizing: border-box;
|
|
3134
3137
|
border-radius: inherit;
|
|
@@ -3136,7 +3139,6 @@
|
|
|
3136
3139
|
color: var(--field-input-color);
|
|
3137
3140
|
background: var(--field-input-bg-color);
|
|
3138
3141
|
min-block-size: var(--field-control-size-height);
|
|
3139
|
-
padding-block: 0;
|
|
3140
3142
|
padding-inline: var(--field-input-padding-inline-start) var(--field-input-padding-inline-end);
|
|
3141
3143
|
transition: color var(--kbq-transition-default), background-color var(--kbq-transition-default);
|
|
3142
3144
|
font-size: var(--kbq-typography-text-normal-font-size);
|
|
@@ -3150,12 +3152,19 @@
|
|
|
3150
3152
|
text-underline-offset: calc(( var(--kbq-typography-text-normal-line-height) - var(--kbq-typography-text-normal-font-size)) / 2);
|
|
3151
3153
|
border: none;
|
|
3152
3154
|
outline: none;
|
|
3155
|
+
flex-direction: column;
|
|
3156
|
+
display: flex;
|
|
3157
|
+
}
|
|
3158
|
+
|
|
3159
|
+
.kbq-fieldselect-container-422b17 {
|
|
3153
3160
|
align-items: center;
|
|
3161
|
+
gap: var(--kbq-size-xs);
|
|
3162
|
+
block-size: 100%;
|
|
3154
3163
|
display: flex;
|
|
3155
3164
|
}
|
|
3156
3165
|
|
|
3157
3166
|
.kbq-fieldselect-content-c36142 {
|
|
3158
|
-
|
|
3167
|
+
padding-block: var(--kbq-size-xs);
|
|
3159
3168
|
white-space: nowrap;
|
|
3160
3169
|
text-overflow: ellipsis;
|
|
3161
3170
|
overflow: hidden;
|
|
@@ -3176,6 +3185,15 @@
|
|
|
3176
3185
|
.kbq-fieldselect-hasPlaceholder-7b7518 {
|
|
3177
3186
|
--field-input-color: var(--field-input-placeholder-color);
|
|
3178
3187
|
}
|
|
3188
|
+
|
|
3189
|
+
.kbq-fieldselect-hiddenPlaceholder-a3a36d {
|
|
3190
|
+
text-align: start;
|
|
3191
|
+
visibility: hidden;
|
|
3192
|
+
white-space: nowrap;
|
|
3193
|
+
text-overflow: ellipsis;
|
|
3194
|
+
block-size: 0;
|
|
3195
|
+
overflow: hidden;
|
|
3196
|
+
}
|
|
3179
3197
|
.kbq-divider-16da20 {
|
|
3180
3198
|
border-style: solid;
|
|
3181
3199
|
border-color: var(--kbq-line-contrast-less);
|
|
@@ -3401,15 +3419,14 @@
|
|
|
3401
3419
|
--tag-outline-width: var(--kbq-size-3xs);
|
|
3402
3420
|
cursor: default;
|
|
3403
3421
|
vertical-align: top;
|
|
3404
|
-
white-space: nowrap;
|
|
3405
3422
|
box-sizing: border-box;
|
|
3423
|
+
max-inline-size: 100%;
|
|
3406
3424
|
color: var(--tag-color);
|
|
3407
3425
|
align-items: center;
|
|
3408
3426
|
gap: var(--kbq-size-3xs);
|
|
3409
3427
|
block-size: var(--kbq-size-xxl);
|
|
3410
3428
|
border-radius: var(--kbq-size-xxs);
|
|
3411
3429
|
padding-inline: var(--kbq-size-xxs);
|
|
3412
|
-
min-inline-size: var(--kbq-size-xxl);
|
|
3413
3430
|
background-color: var(--tag-bg-color);
|
|
3414
3431
|
outline-offset: calc(-1 * var(--tag-outline-width) / 2);
|
|
3415
3432
|
outline: var(--tag-outline-width) solid var(--tag-outline-color);
|
|
@@ -3422,13 +3439,14 @@
|
|
|
3422
3439
|
.kbq-tag-content-fe481b {
|
|
3423
3440
|
white-space: nowrap;
|
|
3424
3441
|
text-overflow: ellipsis;
|
|
3442
|
+
max-inline-size: 100%;
|
|
3425
3443
|
margin-inline: var(--kbq-size-3xs);
|
|
3426
3444
|
overflow: hidden;
|
|
3427
3445
|
}
|
|
3428
3446
|
|
|
3429
3447
|
.kbq-tag-icon-1e369b {
|
|
3430
3448
|
color: var(--tag-icon-color);
|
|
3431
|
-
flex
|
|
3449
|
+
flex: none;
|
|
3432
3450
|
justify-content: center;
|
|
3433
3451
|
align-items: center;
|
|
3434
3452
|
margin-inline-start: var(--kbq-size-3xs);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koobiq/react-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"@koobiq/design-tokens": "^3.14.0",
|
|
29
29
|
"@types/react-transition-group": "^4.4.12",
|
|
30
30
|
"react-transition-group": "^4.4.5",
|
|
31
|
-
"@koobiq/
|
|
32
|
-
"@koobiq/
|
|
33
|
-
"@koobiq/react-
|
|
34
|
-
"@koobiq/react-
|
|
31
|
+
"@koobiq/react-core": "0.3.1",
|
|
32
|
+
"@koobiq/logger": "0.3.1",
|
|
33
|
+
"@koobiq/react-icons": "0.3.1",
|
|
34
|
+
"@koobiq/react-primitives": "0.3.1"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@koobiq/design-tokens": "^3.14.0",
|