musae 0.2.6 → 0.2.7

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 (127) hide show
  1. package/dist/components/avatar/avatar.js +1 -1
  2. package/dist/components/breadcrumb/breadcrumb.js +1 -1
  3. package/dist/components/breadcrumb/item.js +1 -1
  4. package/dist/components/button/button.js +13 -16
  5. package/dist/components/calendar/calendar.js +1 -1
  6. package/dist/components/calendar/hooks.js +1 -1
  7. package/dist/components/checkbox/checkbox.d.ts +1 -1
  8. package/dist/components/checkbox/checkbox.js +203 -143
  9. package/dist/components/checkbox/group.d.ts +1 -1
  10. package/dist/components/checkbox/group.js +20 -19
  11. package/dist/components/checkbox/index.d.ts +2 -2
  12. package/dist/components/checkbox/types.d.ts +22 -1
  13. package/dist/components/clock/column.js +1 -1
  14. package/dist/components/collapse/collapse.js +1 -1
  15. package/dist/components/collapse/item.js +14 -8
  16. package/dist/components/date-picker/date-picker.js +1 -1
  17. package/dist/components/dialog/dialog.js +1 -1
  18. package/dist/components/dialog/popup.js +2 -2
  19. package/dist/components/divider/divider.js +1 -1
  20. package/dist/components/drawer/drawer.js +1 -1
  21. package/dist/components/drawer/popup.js +2 -2
  22. package/dist/components/empty/empty.js +1 -1
  23. package/dist/components/floating-action-button/floatable.d.ts +4 -0
  24. package/dist/components/floating-action-button/floatable.js +83 -0
  25. package/dist/components/floating-action-button/floating-action-button.d.ts +4 -0
  26. package/dist/components/floating-action-button/floating-action-button.js +26 -0
  27. package/dist/components/floating-action-button/index.d.ts +2 -0
  28. package/dist/components/floating-action-button/types.d.ts +44 -0
  29. package/dist/components/form/field/error.d.ts +2 -2
  30. package/dist/components/form/field/error.js +36 -22
  31. package/dist/components/form/field/field.js +6 -21
  32. package/dist/components/form/field/layout.js +1 -1
  33. package/dist/components/grid/col.js +1 -1
  34. package/dist/components/grid/row.js +1 -1
  35. package/dist/components/icon/icon.d.ts +1 -1
  36. package/dist/components/icon/icon.js +5 -3
  37. package/dist/components/icon/types.d.ts +6 -1
  38. package/dist/components/image/preview/operations.js +2 -2
  39. package/dist/components/image/preview/preview.js +1 -1
  40. package/dist/components/input/input.d.ts +6 -6
  41. package/dist/components/input/input.js +9 -15
  42. package/dist/components/layout/header.js +1 -1
  43. package/dist/components/layout/layout.js +1 -1
  44. package/dist/components/loading/loading.js +1 -1
  45. package/dist/components/menu/group.js +14 -8
  46. package/dist/components/menu/hooks.js +1 -1
  47. package/dist/components/menu/item.js +1 -1
  48. package/dist/components/notification/holder.js +2 -3
  49. package/dist/components/notification/notification.js +1 -1
  50. package/dist/components/otp-input/otp-input.js +1 -1
  51. package/dist/components/pagination/hooks.d.ts +4 -2
  52. package/dist/components/pagination/hooks.js +9 -4
  53. package/dist/components/pagination/item.js +6 -8
  54. package/dist/components/pagination/pagination.d.ts +1 -1
  55. package/dist/components/pagination/pagination.js +37 -9
  56. package/dist/components/pagination/types.d.ts +6 -0
  57. package/dist/components/picker/picker.js +2 -2
  58. package/dist/components/popover/popover.js +1 -1
  59. package/dist/components/popper/dropdown.js +1 -1
  60. package/dist/components/popper/popper.js +1 -1
  61. package/dist/components/portal/portal.js +6 -2
  62. package/dist/components/portal/types.d.ts +6 -0
  63. package/dist/components/progress/circular.js +1 -1
  64. package/dist/components/progress/linear.js +1 -1
  65. package/dist/components/radio/radio.js +1 -1
  66. package/dist/components/rate/rate.js +1 -1
  67. package/dist/components/rate/star.js +1 -1
  68. package/dist/components/ripple/ripple.js +1 -1
  69. package/dist/components/select/hooks.d.ts +1 -1
  70. package/dist/components/select/select.d.ts +1 -1
  71. package/dist/components/select/select.js +5 -5
  72. package/dist/components/select/selector.d.ts +3 -6
  73. package/dist/components/select/selector.js +16 -10
  74. package/dist/components/select/types.d.ts +3 -1
  75. package/dist/components/space/space.js +1 -1
  76. package/dist/components/steps/item.d.ts +1 -1
  77. package/dist/components/steps/item.js +46 -31
  78. package/dist/components/steps/steps.d.ts +1 -1
  79. package/dist/components/steps/steps.js +6 -4
  80. package/dist/components/steps/types.d.ts +15 -0
  81. package/dist/components/switch/switch.js +1 -1
  82. package/dist/components/table/body.js +1 -1
  83. package/dist/components/table/header/cell.js +1 -1
  84. package/dist/components/table/header/header.js +1 -1
  85. package/dist/components/tabs/hooks.js +5 -5
  86. package/dist/components/tabs/navigation.js +1 -1
  87. package/dist/components/tabs/panels.js +1 -1
  88. package/dist/components/tag/tag.js +1 -1
  89. package/dist/components/theme/tokens.stylex.d.ts +1 -0
  90. package/dist/components/time-picker/panel.js +1 -1
  91. package/dist/components/time-picker/time-picker.js +1 -1
  92. package/dist/components/timeline/item.js +30 -14
  93. package/dist/components/timeline/timeline.d.ts +1 -1
  94. package/dist/components/timeline/timeline.js +5 -3
  95. package/dist/components/timeline/types.d.ts +10 -0
  96. package/dist/components/tour/tour.js +3 -2
  97. package/dist/components/transfer/context.d.ts +6 -0
  98. package/dist/components/transfer/context.js +11 -0
  99. package/dist/components/transfer/hooks.d.ts +19 -0
  100. package/dist/components/transfer/hooks.js +49 -0
  101. package/dist/components/transfer/index.d.ts +2 -0
  102. package/dist/components/transfer/item.d.ts +4 -0
  103. package/dist/components/transfer/item.js +25 -0
  104. package/dist/components/transfer/list.d.ts +4 -0
  105. package/dist/components/transfer/list.js +122 -0
  106. package/dist/components/transfer/transfer.d.ts +4 -0
  107. package/dist/components/transfer/transfer.js +82 -0
  108. package/dist/components/transfer/types.d.ts +83 -0
  109. package/dist/components/tree/list.js +14 -7
  110. package/dist/components/tree/node.js +1 -1
  111. package/dist/components/waterfall/sequential.js +1 -1
  112. package/dist/components/waterfall/waterfall.js +1 -1
  113. package/dist/hooks/use-class-names.d.ts +17 -1
  114. package/dist/hooks/use-container.d.ts +11 -0
  115. package/dist/hooks/use-container.js +23 -0
  116. package/dist/hooks/use-expandable.d.ts +11 -0
  117. package/dist/hooks/use-expandable.js +37 -0
  118. package/dist/index.d.ts +2 -0
  119. package/dist/index.js +2 -0
  120. package/dist/stylex.css +20 -15
  121. package/dist/utils/class-name.d.ts +59 -10
  122. package/dist/utils/class-name.js +40 -6
  123. package/package.json +13 -5
  124. package/dist/hooks/use-expand-effect.d.ts +0 -12
  125. package/dist/hooks/use-expand-effect.js +0 -34
  126. /package/dist/node_modules/.pnpm/{@aiszlab_relax@1.2.56_react-dom@18.3.1_react@18.3.1 → @aiszlab_relax@1.2.59_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/@aiszlab/relax/dist/dom/contains.js +0 -0
  127. /package/dist/node_modules/.pnpm/{@stylexjs_stylex@0.7.4 → @stylexjs_stylex@0.7.5}/node_modules/@stylexjs/stylex/lib/es/stylex.js +0 -0
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import type { TransferItemProps } from "./types";
3
+ declare const Item: ({ value, label }: TransferItemProps) => React.JSX.Element;
4
+ export default Item;
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { Checkbox } from '../checkbox/index.js';
3
+ import { useClassNames } from '../../hooks/use-class-names.js';
4
+ import { ComponentToken, TransferClassToken } from '../../utils/class-name.js';
5
+ import clsx from 'clsx';
6
+
7
+ const Item = ({
8
+ value,
9
+ label
10
+ }) => {
11
+ const classNames = useClassNames(ComponentToken.Transfer);
12
+ const styled = {
13
+ item: {
14
+ className: "musae-78zum5 musae-6s0dn4 musae-gj1dgu musae-ovjknk musae-vbka3v"
15
+ }
16
+ };
17
+ return React.createElement("li", {
18
+ className: clsx(classNames[TransferClassToken.Item], styled.item.className),
19
+ style: styled.item.style
20
+ }, React.createElement(Checkbox, {
21
+ value: value
22
+ }), label);
23
+ };
24
+
25
+ export { Item as default };
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import type { TransferListProps } from "./types";
3
+ declare const List: ({ options, title, onChange, value }: TransferListProps) => React.JSX.Element;
4
+ export default List;
@@ -0,0 +1,122 @@
1
+ import React, { useContext } from 'react';
2
+ import _stylex from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
3
+ import { useTheme } from '../theme/hooks.js';
4
+ import { ColorToken } from '../../utils/colors.js';
5
+ import Item from './item.js';
6
+ import { Checkbox } from '../checkbox/index.js';
7
+ import { Context } from './context.js';
8
+ import { useClassNames } from '../../hooks/use-class-names.js';
9
+ import { ComponentToken, TransferClassToken } from '../../utils/class-name.js';
10
+ import clsx from 'clsx';
11
+ import { typography } from '../theme/theme.js';
12
+
13
+ const styles = {
14
+ list: props => [{
15
+ width: "musae-fx4e2q",
16
+ height: "musae-1ajdkb8",
17
+ borderWidth: "musae-1i8jmgv",
18
+ borderInlineWidth: null,
19
+ borderInlineStartWidth: null,
20
+ borderLeftWidth: null,
21
+ borderInlineEndWidth: null,
22
+ borderRightWidth: null,
23
+ borderBlockWidth: null,
24
+ borderTopWidth: null,
25
+ borderBottomWidth: null,
26
+ borderColor: "musae-eqt46j",
27
+ borderInlineColor: null,
28
+ borderInlineStartColor: null,
29
+ borderLeftColor: null,
30
+ borderInlineEndColor: null,
31
+ borderRightColor: null,
32
+ borderBlockColor: null,
33
+ borderTopColor: null,
34
+ borderBottomColor: null,
35
+ borderStyle: "musae-1y0btm7",
36
+ borderInlineStyle: null,
37
+ borderInlineStartStyle: null,
38
+ borderLeftStyle: null,
39
+ borderInlineEndStyle: null,
40
+ borderRightStyle: null,
41
+ borderBlockStyle: null,
42
+ borderTopStyle: null,
43
+ borderBottomStyle: null,
44
+ borderRadius: "musae-1h268bu",
45
+ borderStartStartRadius: null,
46
+ borderStartEndRadius: null,
47
+ borderEndStartRadius: null,
48
+ borderEndEndRadius: null,
49
+ borderTopLeftRadius: null,
50
+ borderTopRightRadius: null,
51
+ borderBottomLeftRadius: null,
52
+ borderBottomRightRadius: null,
53
+ $$css: true
54
+ }, {
55
+ "--borderColor": props.outlineColor != null ? props.outlineColor : "initial"
56
+ }],
57
+ header: props => [{
58
+ display: "musae-78zum5",
59
+ alignItems: "musae-6s0dn4",
60
+ paddingBlock: "musae-mcngwa",
61
+ paddingTop: null,
62
+ paddingBottom: null,
63
+ paddingInline: "musae-gj1dgu",
64
+ paddingStart: null,
65
+ paddingLeft: null,
66
+ paddingEnd: null,
67
+ paddingRight: null,
68
+ borderBottomWidth: "musae-lntmim",
69
+ borderBottomColor: "musae-43481e",
70
+ borderBottomStyle: "musae-1q0q8m5",
71
+ $$css: true
72
+ }, {
73
+ "--borderBottomColor": props.outlineColor != null ? props.outlineColor : "initial"
74
+ }]
75
+ };
76
+ const List = ({
77
+ options,
78
+ title,
79
+ onChange,
80
+ value
81
+ }) => {
82
+ const theme = useTheme();
83
+ const {
84
+ disabled
85
+ } = useContext(Context);
86
+ const classNames = useClassNames(ComponentToken.Transfer);
87
+ const styled = {
88
+ list: _stylex.props(styles.list({
89
+ outlineColor: theme.colors[ColorToken.Outline]
90
+ })),
91
+ header: _stylex.props(styles.header({
92
+ outlineColor: theme.colors[ColorToken.Outline]
93
+ }), typography.body.medium),
94
+ title: {
95
+ className: "musae-b3r6kr musae-p4054r musae-1isitws"
96
+ }
97
+ };
98
+ return React.createElement("div", {
99
+ className: clsx(classNames[TransferClassToken.List], styled.list.className),
100
+ style: styled.list.style
101
+ }, React.createElement("div", {
102
+ className: clsx(classNames[TransferClassToken.Header], styled.header.className),
103
+ style: styled.header.style
104
+ }, React.createElement("span", null, options.length, "\u9879"), React.createElement("span", {
105
+ className: clsx(classNames[TransferClassToken.Title], styled.title.className),
106
+ style: styled.title.style
107
+ }, title)), React.createElement(Checkbox.Group, {
108
+ value: value,
109
+ onChange: onChange,
110
+ disabled: disabled
111
+ }, React.createElement("ul", {
112
+ className: classNames[TransferClassToken.Body]
113
+ }, options.map(option => {
114
+ return React.createElement(Item, {
115
+ key: option.value,
116
+ label: option.label,
117
+ value: option.value
118
+ });
119
+ }))));
120
+ };
121
+
122
+ export { List as default };
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import type { TransferProps } from "./types";
3
+ declare const Transfer: ({ options, value, titles, disabled, className, style }: TransferProps) => React.JSX.Element;
4
+ export default Transfer;
@@ -0,0 +1,82 @@
1
+ import React, { useMemo } from 'react';
2
+ import { useTransfer } from './hooks.js';
3
+ import List from './list.js';
4
+ import Button from '../button/button.js';
5
+ import { Context } from './context.js';
6
+ import { useClassNames } from '../../hooks/use-class-names.js';
7
+ import { ComponentToken, TransferClassToken } from '../../utils/class-name.js';
8
+ import clsx from 'clsx';
9
+ import KeyboardArrowRight from '../icon/icons/hardware/keyboard-arrow-right.js';
10
+ import KeyboardArrowLeft from '../icon/icons/hardware/keyboard-arrow-left.js';
11
+
12
+ const Transfer = ({
13
+ options,
14
+ value,
15
+ titles = [null, null],
16
+ disabled = false,
17
+ className,
18
+ style
19
+ }) => {
20
+ const {
21
+ transferred,
22
+ untransferred,
23
+ transfer,
24
+ untransfer,
25
+ transferKeys,
26
+ untransferKeys,
27
+ setTransferKeys,
28
+ setUntransferKeys
29
+ } = useTransfer({
30
+ options,
31
+ value
32
+ });
33
+ const classNames = useClassNames(ComponentToken.Transfer);
34
+ const styled = {
35
+ transfer: {
36
+ className: "musae-78zum5 musae-1q0g3np musae-6s0dn4 musae-vbka3v"
37
+ },
38
+ operation: {
39
+ className: "musae-78zum5 musae-dt5ytf musae-vbka3v"
40
+ }
41
+ };
42
+ const contextValue = useMemo(() => {
43
+ return {
44
+ disabled
45
+ };
46
+ }, [disabled]);
47
+ return React.createElement(Context.Provider, {
48
+ value: contextValue
49
+ }, React.createElement("div", {
50
+ className: clsx(classNames[TransferClassToken.Transfer], className, styled.transfer.className),
51
+ style: {
52
+ ...styled.transfer.style,
53
+ ...style
54
+ }
55
+ }, React.createElement(List, {
56
+ options: Array.from(untransferred.values()),
57
+ title: titles[0],
58
+ value: transferKeys,
59
+ onChange: setTransferKeys
60
+ }), React.createElement("div", {
61
+ className: clsx(classNames[TransferClassToken.Operation], styled.operation.className),
62
+ style: styled.operation.style
63
+ }, React.createElement(Button, {
64
+ shape: "circular",
65
+ size: "small",
66
+ onClick: transfer,
67
+ disabled: disabled || transferKeys.length === 0
68
+ }, React.createElement(KeyboardArrowRight, null)), React.createElement(Button, {
69
+ shape: "circular",
70
+ size: "small",
71
+ onClick: untransfer,
72
+ disabled: disabled || untransferKeys.length === 0
73
+ }, React.createElement(KeyboardArrowLeft, null))), React.createElement(List, {
74
+ options: Array.from(transferred.values()),
75
+ title: titles[1],
76
+ value: untransferKeys,
77
+ onChange: setUntransferKeys
78
+ })));
79
+ };
80
+ var Transfer$1 = Transfer;
81
+
82
+ export { Transfer$1 as default };
@@ -0,0 +1,83 @@
1
+ import type { Key, ReactNode } from "react";
2
+ import type { Option } from "../../types/option";
3
+ import { ComponentProps } from "../../types/element";
4
+ export type TransferOption = Omit<Option, "children">;
5
+ /**
6
+ * @description
7
+ * transfer props
8
+ */
9
+ export type TransferProps = ComponentProps & {
10
+ /**
11
+ * @description
12
+ * options
13
+ */
14
+ options: TransferOption[];
15
+ /**
16
+ * @description
17
+ * value
18
+ */
19
+ value?: Key[];
20
+ /**
21
+ * @description
22
+ * titles
23
+ */
24
+ titles?: [ReactNode, ReactNode];
25
+ /**
26
+ * @description
27
+ * disabled
28
+ */
29
+ disabled?: boolean;
30
+ };
31
+ /**
32
+ * @description
33
+ * transfer list props
34
+ */
35
+ export type TransferListProps = {
36
+ /**
37
+ * @description
38
+ * value
39
+ */
40
+ value: Key[];
41
+ /**
42
+ * @description
43
+ * options
44
+ */
45
+ options: TransferOption[];
46
+ /**
47
+ * @description
48
+ * title
49
+ */
50
+ title?: ReactNode;
51
+ /**
52
+ * @description
53
+ * change handler
54
+ */
55
+ onChange: (keys: Key[]) => void;
56
+ };
57
+ /**
58
+ * @description
59
+ * transfer item props
60
+ */
61
+ export type TransferItemProps = {
62
+ /**
63
+ * @description
64
+ * value
65
+ */
66
+ value: Key;
67
+ /**
68
+ * @description
69
+ * label
70
+ */
71
+ label: ReactNode;
72
+ };
73
+ /**
74
+ * @description
75
+ * context value
76
+ */
77
+ export type ContextValue = {
78
+ /**
79
+ * @description
80
+ * disabled
81
+ */
82
+ disabled: boolean;
83
+ };
@@ -1,4 +1,4 @@
1
- import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.4/node_modules/@stylexjs/stylex/lib/es/stylex.js';
1
+ import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
2
2
  import React, { useContext } from 'react';
3
3
  import Node from './node.js';
4
4
  import clsx from 'clsx';
@@ -6,7 +6,8 @@ import { useAnimate } from 'framer-motion';
6
6
  import Context from './context.js';
7
7
  import { useClassNames } from '../../hooks/use-class-names.js';
8
8
  import { ComponentToken, TreeClassToken } from '../../utils/class-name.js';
9
- import { useExpandEffect } from '../../hooks/use-expand-effect.js';
9
+ import { useExpandable } from '../../hooks/use-expandable.js';
10
+ import { useUpdateEffect } from '@aiszlab/relax';
10
11
 
11
12
  const styles = {
12
13
  list: {
@@ -33,11 +34,17 @@ const List = ({
33
34
  onExpand
34
35
  } = useContext(Context);
35
36
  const classNames = useClassNames(ComponentToken.Tree);
36
- useExpandEffect({
37
- animate,
38
- target: scope,
39
- expanded
40
- });
37
+ const {
38
+ expand,
39
+ collapse
40
+ } = useExpandable();
41
+ useUpdateEffect(async () => {
42
+ if (expanded) {
43
+ await expand([scope, animate]);
44
+ return;
45
+ }
46
+ await collapse([scope, animate]);
47
+ }, [expanded]);
41
48
  const styled = props(styles.list, !expanded && styles.hidden);
42
49
  return React.createElement("ul", {
43
50
  className: clsx({
@@ -3,7 +3,7 @@ import { useClassNames } from '../../hooks/use-class-names.js';
3
3
  import { ComponentToken, TreeClassToken } from '../../utils/class-name.js';
4
4
  import Context from './context.js';
5
5
  import { Checkbox } from '../checkbox/index.js';
6
- import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.4/node_modules/@stylexjs/stylex/lib/es/stylex.js';
6
+ import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
7
7
  import clsx from 'clsx';
8
8
  import { useTheme } from '../theme/hooks.js';
9
9
  import { ColorToken } from '../../utils/colors.js';
@@ -1,5 +1,5 @@
1
1
  import React, { useMemo } from 'react';
2
- import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.4/node_modules/@stylexjs/stylex/lib/es/stylex.js';
2
+ import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
3
3
 
4
4
  const styles = {
5
5
  column: props => [{
@@ -1,4 +1,4 @@
1
- import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.4/node_modules/@stylexjs/stylex/lib/es/stylex.js';
1
+ import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.7.5/node_modules/@stylexjs/stylex/lib/es/stylex.js';
2
2
  import React from 'react';
3
3
  import { useRepaint } from './hooks.js';
4
4
  import clsx from 'clsx';
@@ -135,6 +135,7 @@ export declare const useClassNames: <T extends ComponentToken>(token: T) => {
135
135
  };
136
136
  24: {
137
137
  0: string;
138
+ 1: string;
138
139
  };
139
140
  25: {
140
141
  0: string;
@@ -160,16 +161,22 @@ export declare const useClassNames: <T extends ComponentToken>(token: T) => {
160
161
  28: {
161
162
  0: string;
162
163
  1: string;
163
- 5: string;
164
164
  6: string;
165
165
  7: string;
166
+ 8: string;
166
167
  2: string;
167
168
  3: string;
168
169
  4: string;
170
+ 5: string;
169
171
  };
170
172
  29: {
171
173
  0: string;
172
174
  1: string;
175
+ 2: string;
176
+ 3: string;
177
+ 4: string;
178
+ 5: string;
179
+ 6: string;
173
180
  };
174
181
  30: {
175
182
  0: string;
@@ -217,4 +224,13 @@ export declare const useClassNames: <T extends ComponentToken>(token: T) => {
217
224
  0: string;
218
225
  1: string;
219
226
  };
227
+ 39: {
228
+ 0: string;
229
+ 6: string;
230
+ 1: string;
231
+ 3: string;
232
+ 5: string;
233
+ 2: string;
234
+ 4: string;
235
+ };
220
236
  }[T];
@@ -0,0 +1,11 @@
1
+ import { PortalProps } from "../components/portal/types";
2
+ /**
3
+ * @description
4
+ * container
5
+ */
6
+ export declare const useContainer: ({ container }: {
7
+ container: PortalProps["container"];
8
+ }) => {
9
+ container: import("@aiszlab/relax/types").Voidable<HTMLElement>;
10
+ isDocumentBody: boolean;
11
+ };
@@ -0,0 +1,23 @@
1
+ import { isFunction, isDomUsable } from '@aiszlab/relax';
2
+ import { useMemo } from 'react';
3
+
4
+ /**
5
+ * @description
6
+ * container
7
+ */
8
+ const useContainer = ({ container }) => {
9
+ const _container = useMemo(() => {
10
+ if (!isFunction(container))
11
+ return container ?? (isDomUsable() ? document.body : null);
12
+ return container();
13
+ }, [container]);
14
+ const isDocumentBody = useMemo(() => {
15
+ return isDomUsable() && _container === document.body;
16
+ }, [_container]);
17
+ return {
18
+ container: _container,
19
+ isDocumentBody,
20
+ };
21
+ };
22
+
23
+ export { useContainer };
@@ -0,0 +1,11 @@
1
+ import { useAnimate } from "framer-motion";
2
+ type UsedAnimate = ReturnType<typeof useAnimate<HTMLElement>>;
3
+ /**
4
+ * @description
5
+ * expand handler
6
+ */
7
+ export declare const useExpandable: () => {
8
+ expand: ([element, animate]: UsedAnimate) => Promise<void>;
9
+ collapse: ([element, animate]: UsedAnimate) => Promise<void>;
10
+ };
11
+ export {};
@@ -0,0 +1,37 @@
1
+ import { useEvent } from '@aiszlab/relax';
2
+
3
+ /**
4
+ * @description
5
+ * expand handler
6
+ */
7
+ const useExpandable = () => {
8
+ const expand = useEvent(async ([element, animate]) => {
9
+ // style play like display: none
10
+ element.current.style.height = "0";
11
+ element.current.style.overflow = "hidden";
12
+ element.current.style.display = "inherit";
13
+ await animate(element.current, {
14
+ height: "auto",
15
+ });
16
+ element.current.style.height = "";
17
+ element.current.style.overflow = "";
18
+ element.current.style.display = "";
19
+ });
20
+ const collapse = useEvent(async ([element, animate]) => {
21
+ element.current.style.overflow = "hidden";
22
+ element.current.style.height = "auto";
23
+ element.current.style.display = "inherit";
24
+ await animate(element.current, {
25
+ height: 0,
26
+ });
27
+ element.current.style.height = "";
28
+ element.current.style.overflow = "";
29
+ element.current.style.display = "none";
30
+ });
31
+ return {
32
+ expand,
33
+ collapse,
34
+ };
35
+ };
36
+
37
+ export { useExpandable };
package/dist/index.d.ts CHANGED
@@ -48,6 +48,8 @@ export { Progress } from "./components/progress";
48
48
  export { Popover } from "./components/popover";
49
49
  export { Watermark } from "./components/watermark";
50
50
  export { Collapse } from "./components/collapse";
51
+ export { FloatingActionButton } from "./components/floating-action-button";
52
+ export { Transfer } from "./components/transfer";
51
53
  /**
52
54
  * @description
53
55
  * hooks
package/dist/index.js CHANGED
@@ -45,6 +45,8 @@ export { default as Progress } from './components/progress/progress.js';
45
45
  export { default as Popover } from './components/popover/popover.js';
46
46
  export { default as Watermark } from './components/watermark/watermark.js';
47
47
  export { default as Collapse } from './components/collapse/collapse.js';
48
+ export { default as FloatingActionButton } from './components/floating-action-button/floating-action-button.js';
49
+ export { default as Transfer } from './components/transfer/transfer.js';
48
50
  export { useMessage } from './components/message/hooks.js';
49
51
  export { useNotification } from './components/notification/hooks.js';
50
52
  export { useTheme } from './components/theme/hooks.js';