idea-react 3.0.0-beta.5 → 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.
Files changed (108) hide show
  1. package/AGENTS.md +15 -16
  2. package/ReadMe.md +71 -65
  3. package/dist/index.d.mts +966 -965
  4. package/dist/index.d.ts +966 -965
  5. package/dist/index.js +16 -16
  6. package/dist/index.mjs +15 -15
  7. package/dist/style.css +2 -2
  8. package/package.json +4 -14
  9. package/source/{Accordion.tsx → Base/Accordion.tsx} +3 -3
  10. package/source/{Alert.tsx → Base/Alert.tsx} +1 -1
  11. package/source/{Avatar.tsx → Base/Avatar.tsx} +1 -1
  12. package/source/{Badge.tsx → Base/Badge.tsx} +1 -1
  13. package/source/{Breadcrumb.tsx → Base/Breadcrumb.tsx} +16 -4
  14. package/source/{Button.tsx → Base/Button.tsx} +6 -2
  15. package/source/{ButtonGroup.tsx → Base/ButtonGroup.tsx} +1 -1
  16. package/source/{Card.tsx → Base/Card.tsx} +1 -1
  17. package/source/{Carousel → Base/Carousel}/index.tsx +4 -14
  18. package/source/{CloseButton.tsx → Base/CloseButton.tsx} +1 -1
  19. package/source/{Collapse.tsx → Base/Collapse.tsx} +18 -3
  20. package/source/{Drawer.tsx → Base/Drawer.tsx} +2 -2
  21. package/source/Base/Fade.tsx +15 -0
  22. package/source/{ListGroup.tsx → Base/ListGroup.tsx} +14 -4
  23. package/source/{Menu.tsx → Base/Menu.tsx} +5 -11
  24. package/source/{NativeDialog → Base/NativeDialog}/index.tsx +2 -2
  25. package/source/{Nav.tsx → Base/Nav.tsx} +5 -2
  26. package/source/{NavOverflow → Base/NavOverflow}/index.tsx +3 -3
  27. package/source/{Navbar.tsx → Base/Navbar.tsx} +20 -14
  28. package/source/{Pagination.tsx → Base/Pagination.tsx} +1 -1
  29. package/source/{Placeholder.tsx → Base/Placeholder.tsx} +1 -1
  30. package/source/{Popover.tsx → Base/Popover.tsx} +6 -2
  31. package/source/{Progress → Base/Progress}/index.tsx +1 -1
  32. package/source/{ScrollSpy → Base/ScrollSpy}/index.tsx +1 -1
  33. package/source/{Spinner.tsx → Base/Spinner.tsx} +2 -2
  34. package/source/{Stack.tsx → Base/Stack.tsx} +1 -1
  35. package/source/{Stepper.tsx → Base/Stepper.tsx} +2 -2
  36. package/source/{Tab.tsx → Base/Tab.tsx} +60 -47
  37. package/source/{Toast.tsx → Base/Toast.tsx} +1 -1
  38. package/source/{ToggleButton.tsx → Base/ToggleButton.tsx} +2 -2
  39. package/source/{Toggler.tsx → Base/Toggler.tsx} +1 -1
  40. package/source/{Tooltip.tsx → Base/Tooltip.tsx} +6 -2
  41. package/source/Base/index.ts +32 -0
  42. package/source/Content/Figure.tsx +26 -0
  43. package/source/Content/Images.tsx +29 -0
  44. package/source/{Table.tsx → Content/Tables.tsx} +2 -2
  45. package/source/Content/index.ts +3 -0
  46. package/source/Extension/ClickBoundary.tsx +1 -1
  47. package/source/Extension/CodeBlock.tsx +1 -1
  48. package/source/Extension/Countdown.tsx +1 -1
  49. package/source/Extension/HorizontalMarquee/index.tsx +1 -1
  50. package/source/Extension/Icon.tsx +16 -3
  51. package/source/Extension/Loading.tsx +2 -2
  52. package/source/Extension/MarkdownView.tsx +23 -0
  53. package/source/Extension/MonthCalendar.tsx +4 -4
  54. package/source/Extension/Nameplate.tsx +1 -1
  55. package/source/Extension/OverlayBox.tsx +9 -4
  56. package/source/Extension/PageNav.tsx +2 -2
  57. package/source/Extension/ScrollNav/Scroller.tsx +1 -1
  58. package/source/Extension/ScrollNav/index.tsx +6 -4
  59. package/source/Extension/ShareBox.tsx +1 -1
  60. package/source/Extension/SpinnerButton.tsx +3 -3
  61. package/source/Extension/TableSpinner.tsx +2 -2
  62. package/source/Extension/TextTruncate/index.tsx +1 -1
  63. package/source/Extension/Time.tsx +1 -1
  64. package/source/Extension/TimeDistance.tsx +1 -1
  65. package/source/Extension/Timeline/index.tsx +2 -2
  66. package/source/Extension/TypeEcho/Content.tsx +1 -1
  67. package/source/Extension/TypeEcho/index.tsx +1 -1
  68. package/source/Extension/UserRank/Address.tsx +1 -1
  69. package/source/Extension/UserRank/index.tsx +11 -10
  70. package/source/Extension/VerticalMarquee/index.tsx +1 -1
  71. package/source/Extension/ZodiacBar.tsx +1 -1
  72. package/source/Extension/index.ts +1 -3
  73. package/source/Form/Adorn.tsx +1 -1
  74. package/source/Form/Checkbox.tsx +2 -2
  75. package/source/Form/{Chips.tsx → Chip.tsx} +5 -12
  76. package/source/Form/ChipInput.tsx +3 -3
  77. package/source/Form/Combobox.tsx +5 -9
  78. package/source/Form/Control.tsx +1 -1
  79. package/source/Form/DatePicker.tsx +3 -3
  80. package/source/Form/Feedback.tsx +1 -1
  81. package/source/Form/FloatingLabel.tsx +1 -1
  82. package/source/Form/InputGroup.tsx +3 -3
  83. package/source/Form/OTP.tsx +1 -1
  84. package/source/Form/Primitives.tsx +8 -9
  85. package/source/Form/Radio.tsx +15 -5
  86. package/source/Form/Range.tsx +2 -2
  87. package/source/Form/Switch.tsx +2 -2
  88. package/source/Form/index.ts +1 -1
  89. package/source/{Overlay.ts → Helper/Overlay.ts} +1 -1
  90. package/source/{color.ts → Helper/color.ts} +1 -1
  91. package/source/Helper/index.ts +4 -0
  92. package/source/{Grid.tsx → Layout/Grid.tsx} +36 -26
  93. package/source/Layout/Ratio.tsx +29 -0
  94. package/source/Layout/index.ts +2 -0
  95. package/source/index.ts +4 -38
  96. package/source/types.d.ts +4 -0
  97. package/source/Extension/Editor.tsx +0 -78
  98. package/source/Extension/EditorHTML.tsx +0 -20
  99. package/source/Extension/Select.tsx +0 -128
  100. package/source/Image.tsx +0 -19
  101. /package/source/{Carousel → Base/Carousel}/model.ts +0 -0
  102. /package/source/{Carousel → Base/Carousel}/scroll.ts +0 -0
  103. /package/source/{Carousel → Base/Carousel}/style.module.css +0 -0
  104. /package/source/{NativeDialog → Base/NativeDialog}/style.module.css +0 -0
  105. /package/source/{NavOverflow → Base/NavOverflow}/model.ts +0 -0
  106. /package/source/{ScrollSpy → Base/ScrollSpy}/model.ts +0 -0
  107. /package/source/{Polymorphic.ts → Helper/Polymorphic.ts} +0 -0
  108. /package/source/{animate.ts → Helper/animate.ts} +0 -0
@@ -1,78 +0,0 @@
1
- 'use client';
2
-
3
- import { EditorCore, WrapperProps } from '@react-editor-js/core';
4
- import classNames from 'classnames';
5
- import { action, observable } from 'mobx';
6
- import { observer } from 'mobx-react';
7
- import { Component, ComponentPropsWithRef, ElementType, FocusEvent } from 'react';
8
- import { createReactEditorJS } from 'react-editor-js';
9
-
10
- import { AsProps, PolymorphicClassProps } from '../Polymorphic';
11
-
12
- const ReactEditorJS = createReactEditorJS();
13
-
14
- export type EditorProps = WrapperProps &
15
- Pick<ComponentPropsWithRef<'input'>, 'name' | 'required'> &
16
- Pick<ComponentPropsWithRef<'div'>, 'className' | 'style' | 'tabIndex' | 'onBlur'>;
17
-
18
- @observer
19
- export class Editor<T extends ElementType | undefined = 'div'> extends Component<
20
- PolymorphicClassProps<T, EditorProps>
21
- > {
22
- declare readonly props: PolymorphicClassProps<T, EditorProps>;
23
-
24
- protected get componentProps(): Readonly<EditorProps & AsProps> {
25
- return this.props;
26
- }
27
-
28
- static displayName = 'Editor';
29
-
30
- private core?: EditorCore;
31
-
32
- @observable
33
- accessor innerValue = this.componentProps.defaultValue;
34
-
35
- setInnerValue = action((value: typeof this.innerValue) => (this.innerValue = value));
36
-
37
- handleBlur = async (event: FocusEvent<HTMLDivElement>) => {
38
- this.componentProps.onBlur?.(event);
39
-
40
- if (this.core) this.setInnerValue(await this.core.save());
41
- };
42
-
43
- initialize = (core: EditorCore) => {
44
- this.componentProps.onInitialize?.(core);
45
-
46
- this.core = core;
47
- };
48
-
49
- render() {
50
- const Root: ElementType = this.componentProps.as ?? 'div';
51
-
52
- const {
53
- as: _as,
54
- name,
55
- required,
56
- className,
57
- style,
58
- tabIndex = -1,
59
- onBlur: _onBlur,
60
- children: _children,
61
- ...editorProps
62
- } = this.componentProps,
63
- { innerValue } = this;
64
-
65
- return (
66
- <Root
67
- {...(this.componentProps.as ? editorProps : {})}
68
- className={classNames('form-control', className)}
69
- style={style}
70
- tabIndex={tabIndex}
71
- onBlur={this.handleBlur}
72
- >
73
- <input hidden {...{ name, required }} value={JSON.stringify(innerValue)} />
74
- <ReactEditorJS {...editorProps} onInitialize={this.initialize} />
75
- </Root>
76
- );
77
- }
78
- }
@@ -1,20 +0,0 @@
1
- import { OutputData } from '@editorjs/editorjs';
2
- import createParser from 'editorjs-html';
3
- import { HTMLAttributes } from 'react';
4
-
5
- import { polymorphic } from '../Polymorphic';
6
-
7
- export const parser = createParser({
8
- link: ({ data: { link } }) => `<a href="${link}">${link}</a>`
9
- });
10
-
11
- export interface EditorHTMLProps extends HTMLAttributes<HTMLDivElement> {
12
- data: OutputData;
13
- }
14
-
15
- export const EditorHTML = polymorphic<EditorHTMLProps>(
16
- ({ as: Root = 'article', data, ...props }) => (
17
- <Root {...props} dangerouslySetInnerHTML={{ __html: parser.parse(data) }} />
18
- )
19
- );
20
- EditorHTML.displayName = 'EditorHTML';
@@ -1,128 +0,0 @@
1
- 'use client';
2
-
3
- import classNames from 'classnames';
4
- import {
5
- ButtonHTMLAttributes,
6
- Children,
7
- cloneElement,
8
- Component,
9
- isValidElement,
10
- MouseEvent,
11
- ReactElement,
12
- ReactNode
13
- } from 'react';
14
-
15
- import { ButtonProps } from '../Button';
16
- import { Menu } from '../Menu';
17
- import { polymorphic } from '../Polymorphic';
18
-
19
- export interface OptionProps extends ButtonHTMLAttributes<HTMLButtonElement> {
20
- value?: string;
21
- }
22
-
23
- export const Option = polymorphic<OptionProps>(
24
- ({ as: Root = 'button', value, className, children, ...props }) => (
25
- <Root
26
- {...props}
27
- type="button"
28
- className={classNames('menu-item', className)}
29
- data-value={value}
30
- >
31
- {children}
32
- </Root>
33
- )
34
- );
35
- Option.displayName = 'Option';
36
-
37
- export type SelectProps = Pick<
38
- ButtonProps,
39
- 'className' | 'style' | 'size' | 'theme' | 'variant' | 'disabled' | 'children'
40
- > & {
41
- align?: 'start' | 'end';
42
- menuClassName?: string;
43
- value?: string;
44
- name?: string;
45
- placeholder?: ReactNode;
46
- 'aria-label'?: string;
47
- onChange?: (value: string) => unknown;
48
- valueRender?: (value: string) => ReactNode;
49
- };
50
-
51
- export class Select extends Component<SelectProps> {
52
- static displayName = 'Select';
53
-
54
- private handleSelect = ({ target, defaultPrevented }: MouseEvent<HTMLDivElement>) => {
55
- if (defaultPrevented || this.props.disabled || !(target instanceof Element)) return;
56
-
57
- const option = target.closest<HTMLButtonElement>('[data-value]');
58
-
59
- if (option && !option.disabled && option.getAttribute('aria-disabled') !== 'true')
60
- this.props.onChange?.(option.dataset.value ?? '');
61
- };
62
-
63
- private renderOption = (child: ReactNode) =>
64
- isValidElement<OptionProps>(child) && child.type === Option
65
- ? cloneElement(child, {
66
- className: classNames(
67
- child.props.className,
68
- child.props.value === this.props.value && 'selected'
69
- ),
70
- 'aria-selected': child.props.value === this.props.value
71
- })
72
- : child;
73
-
74
- render() {
75
- const {
76
- align,
77
- className,
78
- menuClassName,
79
- children,
80
- theme = 'primary',
81
- variant = 'solid',
82
- size,
83
- disabled,
84
- style,
85
- value,
86
- onChange: _onChange,
87
- valueRender,
88
- name,
89
- placeholder,
90
- 'aria-label': label
91
- } = this.props;
92
- const current = Children.toArray(children).find(
93
- node =>
94
- isValidElement<OptionProps>(node) &&
95
- node.type === Option &&
96
- node.props.value === value
97
- ) as ReactElement<OptionProps> | undefined;
98
-
99
- return (
100
- <>
101
- <Menu
102
- align={align}
103
- className="w-100"
104
- menuClassName={menuClassName}
105
- label={valueRender?.(value ?? '') ?? current?.props.children ?? placeholder}
106
- toggleProps={{
107
- className: classNames(
108
- 'w-100 d-flex justify-content-between align-items-center',
109
- className
110
- ),
111
- theme,
112
- variant,
113
- size,
114
- disabled,
115
- style,
116
- 'aria-label': label
117
- }}
118
- onClick={this.handleSelect}
119
- >
120
- {Children.map(children, this.renderOption)}
121
- </Menu>
122
- {name && (
123
- <input type="hidden" name={name} value={value ?? ''} disabled={disabled} />
124
- )}
125
- </>
126
- );
127
- }
128
- }
package/source/Image.tsx DELETED
@@ -1,19 +0,0 @@
1
- import classNames from 'classnames';
2
- import { ComponentPropsWithRef } from 'react';
3
-
4
- import { polymorphic } from './Polymorphic';
5
-
6
- export interface ImageProps extends ComponentPropsWithRef<'img'> {
7
- fluid?: boolean;
8
- thumbnail?: boolean;
9
- }
10
-
11
- export const Image = polymorphic<ImageProps>(
12
- ({ as: Root = 'img', fluid, thumbnail, className, ...props }) => (
13
- <Root
14
- {...props}
15
- className={classNames({ 'img-fluid': fluid, 'img-thumbnail': thumbnail }, className)}
16
- />
17
- )
18
- );
19
- Image.displayName = 'Image';
File without changes
File without changes
File without changes
File without changes