idea-react 3.0.0-rc.0 → 3.0.0-rc.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/AGENTS.md +12 -15
- package/dist/index.d.mts +48 -12
- package/dist/index.d.ts +48 -12
- package/dist/index.js +16 -16
- package/dist/index.mjs +15 -15
- package/package.json +2 -8
- 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/index.ts +1 -0
- package/source/Content/Figure.tsx +26 -0
- 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 +1 -1
- 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/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