idea-react 3.0.0-rc.0 → 3.0.0-rc.2
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/AGENTS.md +12 -15
- package/dist/index.d.mts +57 -22
- package/dist/index.d.ts +57 -22
- package/dist/index.js +16 -16
- package/dist/index.mjs +15 -15
- package/package.json +5 -11
- package/source/Base/Accordion.tsx +1 -1
- package/source/Base/Breadcrumb.tsx +15 -3
- package/source/Base/Button.tsx +5 -1
- package/source/Base/Carousel/index.tsx +2 -12
- package/source/Base/Collapse.tsx +17 -2
- package/source/Base/Fade.tsx +15 -0
- package/source/Base/ListGroup.tsx +12 -2
- package/source/Base/Menu.tsx +1 -7
- package/source/Base/Nav.tsx +3 -1
- package/source/Base/NavOverflow/index.tsx +1 -1
- package/source/Base/Navbar.tsx +19 -13
- package/source/Base/Placeholder.tsx +8 -22
- package/source/Base/index.ts +1 -0
- package/source/Content/Figure.tsx +26 -0
- package/source/Content/Tables.tsx +21 -7
- package/source/Content/index.ts +1 -0
- package/source/Extension/Icon.tsx +15 -2
- package/source/Extension/ScrollNav/index.tsx +4 -2
- package/source/Extension/UserRank/index.tsx +6 -5
- package/source/Form/Chip.tsx +5 -17
- package/source/Form/ChipInput.tsx +1 -1
- package/source/Form/Combobox.tsx +3 -7
- package/source/Form/DatePicker.tsx +1 -1
- package/source/Form/Primitives.tsx +0 -8
- package/source/Form/Radio.tsx +13 -3
- package/source/Layout/Grid.tsx +35 -25
- package/source/Layout/Ratio.tsx +29 -0
- package/source/Layout/index.ts +1 -0
- package/source/types.d.ts +4 -0
package/source/Form/Chip.tsx
CHANGED
|
@@ -5,18 +5,19 @@ import { ComponentTheme } from '../Base/Button';
|
|
|
5
5
|
import { Icon, IconProps } from '../Extension/Icon';
|
|
6
6
|
import { polymorphic } from '../Helper/Polymorphic';
|
|
7
7
|
|
|
8
|
-
export type ChipProps = ComponentPropsWithRef<'
|
|
8
|
+
export type ChipProps = ComponentPropsWithRef<'span'> & {
|
|
9
9
|
active?: boolean;
|
|
10
10
|
theme?: ComponentTheme;
|
|
11
|
+
type?: ComponentPropsWithRef<'button'>['type'];
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
export const Chip = polymorphic<ChipProps>(
|
|
14
|
-
({ as: Root = '
|
|
15
|
+
({ as: Root = 'span', className, active, theme, type = 'button', ...props }) => (
|
|
15
16
|
<Root
|
|
16
17
|
{...props}
|
|
17
18
|
className={classNames('chip', { active }, theme && `theme-${theme}`, className)}
|
|
18
19
|
type={Root === 'button' ? type : undefined}
|
|
19
|
-
aria-pressed={active}
|
|
20
|
+
aria-pressed={Root === 'button' ? active : undefined}
|
|
20
21
|
/>
|
|
21
22
|
)
|
|
22
23
|
);
|
|
@@ -44,21 +45,8 @@ export const ChipDismiss = polymorphic<ComponentPropsWithRef<'button'>>(
|
|
|
44
45
|
aria-label={label}
|
|
45
46
|
className={classNames('chip-dismiss', className)}
|
|
46
47
|
>
|
|
47
|
-
{children ?? <Icon name="x-lg"
|
|
48
|
+
{children ?? <Icon name="x-lg" />}
|
|
48
49
|
</Root>
|
|
49
50
|
)
|
|
50
51
|
);
|
|
51
52
|
ChipDismiss.displayName = 'ChipDismiss';
|
|
52
|
-
|
|
53
|
-
export type ChipTokenProps = ComponentPropsWithRef<'span'> & Pick<ChipProps, 'active' | 'theme'>;
|
|
54
|
-
|
|
55
|
-
export const ChipToken = polymorphic<ChipTokenProps>(
|
|
56
|
-
({ as: Root = 'span', className, active, theme, ...props }) => (
|
|
57
|
-
<Root
|
|
58
|
-
{...props}
|
|
59
|
-
tabIndex={props.tabIndex ?? 0}
|
|
60
|
-
className={classNames('chip', { active }, theme && `theme-${theme}`, className)}
|
|
61
|
-
/>
|
|
62
|
-
)
|
|
63
|
-
);
|
|
64
|
-
ChipToken.displayName = 'ChipToken';
|
|
@@ -58,7 +58,7 @@ class ChipInputComponent extends FormPlugin<ChipInputComponentProps, Pick<Chips,
|
|
|
58
58
|
createOnBlur,
|
|
59
59
|
dismissible,
|
|
60
60
|
placeholder,
|
|
61
|
-
dismissIcon: renderToStaticMarkup(<Icon name="x-lg"
|
|
61
|
+
dismissIcon: renderToStaticMarkup(<Icon name="x-lg" />)
|
|
62
62
|
});
|
|
63
63
|
element.addEventListener('change.bs.chips', this.handleValuesChange);
|
|
64
64
|
|
package/source/Form/Combobox.tsx
CHANGED
|
@@ -53,7 +53,7 @@ export const ComboboxOption = polymorphic<ComboboxOptionProps>(
|
|
|
53
53
|
data-label={optionText(children)}
|
|
54
54
|
data-option-hidden={props.hidden || undefined}
|
|
55
55
|
>
|
|
56
|
-
{icon && <Icon name={icon} className="menu-item-icon"
|
|
56
|
+
{icon && <Icon name={icon} className="menu-item-icon" />}
|
|
57
57
|
{description ? (
|
|
58
58
|
<MenuItemContent>
|
|
59
59
|
{children}
|
|
@@ -62,7 +62,7 @@ export const ComboboxOption = polymorphic<ComboboxOptionProps>(
|
|
|
62
62
|
) : (
|
|
63
63
|
children
|
|
64
64
|
)}
|
|
65
|
-
{checkedIcon && <Icon name="check-lg" className="menu-item-check"
|
|
65
|
+
{checkedIcon && <Icon name="check-lg" className="menu-item-check" />}
|
|
66
66
|
</Root>
|
|
67
67
|
)
|
|
68
68
|
);
|
|
@@ -335,11 +335,7 @@ export class Combobox<T extends ElementType | undefined = 'div'> extends Compone
|
|
|
335
335
|
>
|
|
336
336
|
{hasSelection ? label : placeholder}
|
|
337
337
|
</span>
|
|
338
|
-
<Icon
|
|
339
|
-
name="chevron-down"
|
|
340
|
-
className="combobox-caret"
|
|
341
|
-
aria-hidden="true"
|
|
342
|
-
/>
|
|
338
|
+
<Icon name="chevron-down" className="combobox-caret" />
|
|
343
339
|
</>
|
|
344
340
|
}
|
|
345
341
|
toggleProps={{
|
|
@@ -163,7 +163,7 @@ class DatePickerComponent extends FormPlugin<
|
|
|
163
163
|
|
|
164
164
|
return (
|
|
165
165
|
<Button as={as} {...buttonProps} {...attributes} ref={this.setRef}>
|
|
166
|
-
{leadingIcon && <Icon name={leadingIcon}
|
|
166
|
+
{leadingIcon && <Icon name={leadingIcon} />}
|
|
167
167
|
<span data-bs-datepicker-display="">{children}</span>
|
|
168
168
|
</Button>
|
|
169
169
|
);
|
|
@@ -14,14 +14,6 @@ export const Form = polymorphic<FormProps>(
|
|
|
14
14
|
);
|
|
15
15
|
Form.displayName = 'Form';
|
|
16
16
|
|
|
17
|
-
export type FormFieldsetProps = ComponentPropsWithRef<'fieldset'>;
|
|
18
|
-
|
|
19
|
-
export const FormFieldset = polymorphic<FormFieldsetProps>(
|
|
20
|
-
({ as: Root = 'fieldset', ...props }) => <Root {...props} />
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
FormFieldset.displayName = 'FormFieldset';
|
|
24
|
-
|
|
25
17
|
export type FormFieldProps = ComponentPropsWithRef<'div'> & {
|
|
26
18
|
card?: boolean;
|
|
27
19
|
};
|
package/source/Form/Radio.tsx
CHANGED
|
@@ -33,14 +33,24 @@ Radio.displayName = 'Radio';
|
|
|
33
33
|
export type FormCheckProps = CheckboxProps &
|
|
34
34
|
Pick<ComponentPropsWithRef<'input'>, 'ref'> & {
|
|
35
35
|
type?: 'checkbox' | 'radio';
|
|
36
|
+
listGroup?: boolean;
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
export const FormCheck = polymorphic<FormCheckProps>(
|
|
39
|
-
({ as: RootAs, type = 'checkbox', indeterminate, ...props }) =>
|
|
40
|
+
({ as: RootAs, type = 'checkbox', indeterminate, listGroup, className, ...props }) =>
|
|
40
41
|
type === 'checkbox' ? (
|
|
41
|
-
<Checkbox
|
|
42
|
+
<Checkbox
|
|
43
|
+
as={RootAs}
|
|
44
|
+
{...props}
|
|
45
|
+
className={classNames(listGroup && 'list-group-item-check', className)}
|
|
46
|
+
indeterminate={indeterminate}
|
|
47
|
+
/>
|
|
42
48
|
) : (
|
|
43
|
-
<Radio
|
|
49
|
+
<Radio
|
|
50
|
+
as={RootAs}
|
|
51
|
+
{...props}
|
|
52
|
+
className={classNames(listGroup && 'list-group-item-check', className)}
|
|
53
|
+
/>
|
|
44
54
|
)
|
|
45
55
|
);
|
|
46
56
|
FormCheck.displayName = 'FormCheck';
|
package/source/Layout/Grid.tsx
CHANGED
|
@@ -64,42 +64,52 @@ export const Row = polymorphic<RowProps>(
|
|
|
64
64
|
Row.displayName = 'Row';
|
|
65
65
|
|
|
66
66
|
export interface ColProps extends ComponentPropsWithRef<'div'> {
|
|
67
|
-
xs?:
|
|
68
|
-
sm?:
|
|
69
|
-
md?:
|
|
70
|
-
lg?:
|
|
71
|
-
xl?:
|
|
72
|
-
'2xl'?:
|
|
67
|
+
xs?: ColBreakpoint;
|
|
68
|
+
sm?: ColBreakpoint;
|
|
69
|
+
md?: ColBreakpoint;
|
|
70
|
+
lg?: ColBreakpoint;
|
|
71
|
+
xl?: ColBreakpoint;
|
|
72
|
+
'2xl'?: ColBreakpoint;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
export type ColOrder = number | 'first' | 'last';
|
|
76
|
+
|
|
77
|
+
export interface ColBreakpointOptions {
|
|
78
|
+
span?: BreakpointColSize;
|
|
79
|
+
offset?: number;
|
|
80
|
+
order?: ColOrder;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export type ColBreakpoint = BreakpointColSize | ColBreakpointOptions;
|
|
84
|
+
|
|
75
85
|
export const Col = polymorphic<ColProps>(
|
|
76
86
|
({ as: Root = 'div', xs, sm, md, lg, xl, '2xl': xxl, className, ...props }) => {
|
|
77
|
-
const sizes: [Breakpoint,
|
|
87
|
+
const sizes: [Breakpoint | undefined, ColBreakpoint | undefined][] = [
|
|
88
|
+
[undefined, xs],
|
|
78
89
|
['sm', sm],
|
|
79
90
|
['md', md],
|
|
80
91
|
['lg', lg],
|
|
81
92
|
['xl', xl],
|
|
82
93
|
['2xl', xxl]
|
|
83
94
|
];
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
return (
|
|
87
|
-
<Root
|
|
88
|
-
{...props}
|
|
89
|
-
className={classNames(
|
|
90
|
-
{
|
|
91
|
-
col: (xs === undefined && !sized) || xs === true,
|
|
92
|
-
[`col-${xs}`]: xs !== undefined && xs !== true
|
|
93
|
-
},
|
|
94
|
-
sizes.map(
|
|
95
|
-
([breakpoint, size]) =>
|
|
96
|
-
size !== undefined &&
|
|
97
|
-
(size === true ? `${breakpoint}:col` : `${breakpoint}:col-${size}`)
|
|
98
|
-
),
|
|
99
|
-
className
|
|
100
|
-
)}
|
|
101
|
-
/>
|
|
95
|
+
const hasSpan = sizes.some(([, options]) =>
|
|
96
|
+
typeof options === 'object' ? options.span !== undefined : options !== undefined
|
|
102
97
|
);
|
|
98
|
+
const classes = sizes.map(([breakpoint, options]) => {
|
|
99
|
+
if (options === undefined) return [];
|
|
100
|
+
|
|
101
|
+
const prefix = breakpoint ? `${breakpoint}:` : '';
|
|
102
|
+
const { span, offset, order } =
|
|
103
|
+
typeof options === 'object' ? options : { span: options };
|
|
104
|
+
|
|
105
|
+
return [
|
|
106
|
+
span !== undefined && `${prefix}col${span === true ? '' : `-${span}`}`,
|
|
107
|
+
offset !== undefined && `${prefix}offset-${offset}`,
|
|
108
|
+
order !== undefined && `${prefix}order-${order}`
|
|
109
|
+
];
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
return <Root {...props} className={classNames(!hasSpan && 'col', classes, className)} />;
|
|
103
113
|
}
|
|
104
114
|
);
|
|
105
115
|
Col.displayName = 'Col';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { ComponentPropsWithRef, CSSProperties } from 'react';
|
|
3
|
+
|
|
4
|
+
import { polymorphic } from '../Helper/Polymorphic';
|
|
5
|
+
|
|
6
|
+
export type AspectRatio = 'auto' | '1x1' | '4x3' | '16x9' | '21x9';
|
|
7
|
+
export type CustomAspectRatio = `${number} / ${number}`;
|
|
8
|
+
|
|
9
|
+
export type RatioProps = ComponentPropsWithRef<'div'> & {
|
|
10
|
+
aspectRatio?: AspectRatio | CustomAspectRatio;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const Ratio = polymorphic<RatioProps>(
|
|
14
|
+
({ as: Root = 'div', aspectRatio = '1x1', className, style, ...props }) => {
|
|
15
|
+
const preset = /^(auto|1x1|4x3|16x9|21x9)$/.test(aspectRatio);
|
|
16
|
+
const ratioStyle: CSSProperties & { '--bs-ratio'?: string } = preset
|
|
17
|
+
? (style ?? {})
|
|
18
|
+
: { ...style, '--bs-ratio': aspectRatio };
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Root
|
|
22
|
+
{...props}
|
|
23
|
+
className={classNames(`ratio-${preset ? aspectRatio : 'auto'}`, className)}
|
|
24
|
+
style={ratioStyle}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
Ratio.displayName = 'Ratio';
|
package/source/Layout/index.ts
CHANGED
package/source/types.d.ts
CHANGED