@bifrostui/react 1.3.2 → 1.4.0-beta.0

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 (280) hide show
  1. package/dist/ActionSheet/ActionSheet.css +6 -3
  2. package/dist/ActionSheet/ActionSheetItem.css +10 -6
  3. package/dist/Alert/index.css +14 -8
  4. package/dist/Avatar/Avatar.css +13 -9
  5. package/dist/Avatar/AvatarGroup.css +15 -8
  6. package/dist/Backdrop/Backdrop.css +2 -1
  7. package/dist/Badge/Badge.css +27 -17
  8. package/dist/Breadcrumb/Breadcrumb.css +34 -0
  9. package/dist/Breadcrumb/Breadcrumb.d.ts +5 -0
  10. package/dist/Breadcrumb/Breadcrumb.js +128 -0
  11. package/dist/Breadcrumb/Breadcrumb.types.d.ts +49 -0
  12. package/dist/Breadcrumb/Breadcrumb.types.js +15 -0
  13. package/dist/Breadcrumb/BreadcrumbItem.d.ts +4 -0
  14. package/dist/Breadcrumb/BreadcrumbItem.js +78 -0
  15. package/dist/Breadcrumb/index.d.ts +4 -0
  16. package/dist/Breadcrumb/index.js +45 -0
  17. package/dist/Button/Button.css +37 -25
  18. package/dist/Calendar/Calendar.css +33 -18
  19. package/dist/Calendar/Calendar.d.ts +1 -1
  20. package/dist/Calendar/Calendar.js +38 -17
  21. package/dist/Calendar/Calendar.types.d.ts +21 -0
  22. package/dist/Card/CardFooter.css +2 -1
  23. package/dist/Card/CardHeader.css +3 -1
  24. package/dist/Checkbox/Checkbox.css +7 -5
  25. package/dist/CitySelector/CitySelector.css +29 -15
  26. package/dist/CitySelector/CitySelectorCore.js +25 -16
  27. package/dist/CitySelector/Selector/index.css +4 -4
  28. package/dist/Collapse/Collapse.css +6 -0
  29. package/dist/Collapse/Collapse.d.ts +5 -0
  30. package/dist/Collapse/Collapse.js +165 -0
  31. package/dist/Collapse/Collapse.types.d.ts +16 -0
  32. package/dist/Collapse/Collapse.types.js +15 -0
  33. package/dist/Collapse/index.d.ts +2 -0
  34. package/dist/Collapse/index.js +41 -0
  35. package/dist/CollapsePanel/CollapsePanel.css +32 -0
  36. package/dist/CollapsePanel/CollapsePanel.d.ts +5 -0
  37. package/dist/CollapsePanel/CollapsePanel.js +159 -0
  38. package/dist/CollapsePanel/CollapsePanel.types.d.ts +64 -0
  39. package/dist/CollapsePanel/CollapsePanel.types.js +15 -0
  40. package/dist/CollapsePanel/CollapsePanelItem.d.ts +4 -0
  41. package/dist/CollapsePanel/CollapsePanelItem.js +112 -0
  42. package/dist/CollapsePanel/index.d.ts +4 -0
  43. package/dist/CollapsePanel/index.js +45 -0
  44. package/dist/Countdown/Countdown.css +2 -1
  45. package/dist/Dialog/Dialog.d.ts +2 -2
  46. package/dist/Dialog/Dialog.js +20 -8
  47. package/dist/Dialog/Dialog.types.d.ts +12 -1
  48. package/dist/Dialog/FunctionalDialog.js +38 -2
  49. package/dist/Dialog/index.css +27 -18
  50. package/dist/Divider/Divider.css +6 -4
  51. package/dist/IconButton/IconButton.css +9 -7
  52. package/dist/Image/index.css +2 -1
  53. package/dist/Input/Input.css +14 -7
  54. package/dist/List/List.css +3 -0
  55. package/dist/List/ListItem.css +3 -3
  56. package/dist/List/ListItemContent.css +1 -1
  57. package/dist/Loading/Loading.css +4 -2
  58. package/dist/NavBar/NavBar.css +9 -5
  59. package/dist/Picker/Picker.css +25 -29
  60. package/dist/Picker/Picker.js +31 -11
  61. package/dist/Picker/Picker.types.d.ts +4 -0
  62. package/dist/Picker/PickerPanel.css +8 -8
  63. package/dist/Picker/PickerPanel.js +14 -8
  64. package/dist/Picker/utils.d.ts +16 -0
  65. package/dist/Picker/utils.js +32 -2
  66. package/dist/Popover/Popover.css +97 -0
  67. package/dist/Popover/Popover.d.ts +5 -0
  68. package/dist/Popover/Popover.js +195 -0
  69. package/dist/Popover/Popover.types.d.ts +58 -0
  70. package/dist/Popover/Popover.types.js +15 -0
  71. package/dist/Popover/index.d.ts +2 -0
  72. package/dist/Popover/index.js +41 -0
  73. package/dist/Portal/Portal.types.d.ts +4 -0
  74. package/dist/Portal/PortalCore.js +8 -1
  75. package/dist/Progress/Progress.css +9 -7
  76. package/dist/Radio/Radio.css +5 -4
  77. package/dist/Rating/Rating.css +8 -4
  78. package/dist/Select/Select.css +21 -10
  79. package/dist/Select/Select.js +1 -1
  80. package/dist/Select/SelectOption.js +3 -0
  81. package/dist/Skeleton/Skeleton.css +5 -5
  82. package/dist/Slider/Slider.css +29 -18
  83. package/dist/Steps/Step.css +13 -13
  84. package/dist/Steps/Steps.css +14 -7
  85. package/dist/Swiper/Swiper.css +2 -1
  86. package/dist/Switch/Switch.css +31 -16
  87. package/dist/TabBar/TabBar.css +7 -3
  88. package/dist/TabBar/TabBarItem.css +0 -1
  89. package/dist/Tabs/Tab.css +6 -10
  90. package/dist/Tabs/Tabs.css +10 -9
  91. package/dist/Tag/Tag.css +7 -10
  92. package/dist/Tag/TagGroup.css +9 -1
  93. package/dist/TextArea/TextArea.css +23 -13
  94. package/dist/ThemeProvider/ThemeProvider.d.ts +4 -0
  95. package/dist/ThemeProvider/ThemeProvider.js +91 -0
  96. package/dist/ThemeProvider/ThemeProvider.types.d.ts +127 -0
  97. package/dist/ThemeProvider/ThemeProvider.types.js +27 -0
  98. package/dist/ThemeProvider/hooks/ThemeContext.d.ts +4 -0
  99. package/dist/ThemeProvider/hooks/ThemeContext.js +35 -0
  100. package/dist/ThemeProvider/hooks/createTheme.d.ts +2 -0
  101. package/dist/ThemeProvider/hooks/createTheme.js +55 -0
  102. package/dist/ThemeProvider/hooks/index.d.ts +4 -0
  103. package/dist/ThemeProvider/hooks/index.js +43 -0
  104. package/dist/ThemeProvider/hooks/useTheme.d.ts +1 -0
  105. package/dist/ThemeProvider/hooks/useTheme.js +39 -0
  106. package/dist/ThemeProvider/index.d.ts +4 -0
  107. package/dist/ThemeProvider/index.js +45 -0
  108. package/dist/ThemeProvider/utils/constants.d.ts +38 -0
  109. package/dist/ThemeProvider/utils/constants.js +65 -0
  110. package/dist/ThemeProvider/utils/index.d.ts +2 -0
  111. package/dist/ThemeProvider/utils/index.js +23 -0
  112. package/dist/ThemeProvider/utils/mountTokens.d.ts +26 -0
  113. package/dist/ThemeProvider/utils/mountTokens.js +123 -0
  114. package/dist/Toast/FunctionalToast.js +18 -0
  115. package/dist/Toast/Toast.css +18 -20
  116. package/dist/Toast/Toast.d.ts +2 -2
  117. package/dist/Toast/Toast.js +52 -48
  118. package/dist/Toast/Toast.types.d.ts +15 -1
  119. package/dist/Tooltip/Tooltip.css +91 -0
  120. package/dist/Tooltip/Tooltip.d.ts +5 -0
  121. package/dist/Tooltip/Tooltip.js +184 -0
  122. package/dist/Tooltip/Tooltip.types.d.ts +49 -0
  123. package/dist/Tooltip/Tooltip.types.js +15 -0
  124. package/dist/Tooltip/index.d.ts +2 -0
  125. package/dist/Tooltip/index.js +41 -0
  126. package/dist/index.d.ts +7 -0
  127. package/dist/index.js +15 -1
  128. package/dist/locales/base.d.ts +40 -0
  129. package/dist/locales/base.js +15 -0
  130. package/dist/locales/en-US.d.ts +3 -0
  131. package/dist/locales/en-US.js +69 -0
  132. package/dist/locales/hooks/useLocaleText.d.ts +3 -0
  133. package/dist/locales/hooks/useLocaleText.js +43 -0
  134. package/dist/locales/index.d.ts +5 -0
  135. package/dist/locales/index.js +49 -0
  136. package/dist/locales/zh-CN.d.ts +3 -0
  137. package/dist/locales/zh-CN.js +51 -0
  138. package/dist/locales/zh-TW.d.ts +3 -0
  139. package/dist/locales/zh-TW.js +51 -0
  140. package/es/ActionSheet/ActionSheet.css +6 -3
  141. package/es/ActionSheet/ActionSheetItem.css +10 -6
  142. package/es/Alert/index.css +14 -8
  143. package/es/Avatar/Avatar.css +13 -9
  144. package/es/Avatar/AvatarGroup.css +15 -8
  145. package/es/Backdrop/Backdrop.css +2 -1
  146. package/es/Badge/Badge.css +27 -17
  147. package/es/Breadcrumb/Breadcrumb.css +34 -0
  148. package/es/Breadcrumb/Breadcrumb.d.ts +5 -0
  149. package/es/Breadcrumb/Breadcrumb.js +101 -0
  150. package/es/Breadcrumb/Breadcrumb.types.d.ts +49 -0
  151. package/es/Breadcrumb/Breadcrumb.types.js +1 -0
  152. package/es/Breadcrumb/BreadcrumbItem.d.ts +4 -0
  153. package/es/Breadcrumb/BreadcrumbItem.js +51 -0
  154. package/es/Breadcrumb/index.d.ts +4 -0
  155. package/es/Breadcrumb/index.js +9 -0
  156. package/es/Button/Button.css +37 -25
  157. package/es/Calendar/Calendar.css +33 -18
  158. package/es/Calendar/Calendar.d.ts +1 -1
  159. package/es/Calendar/Calendar.js +38 -17
  160. package/es/Calendar/Calendar.types.d.ts +21 -0
  161. package/es/Card/CardFooter.css +2 -1
  162. package/es/Card/CardHeader.css +3 -1
  163. package/es/Checkbox/Checkbox.css +7 -5
  164. package/es/CitySelector/CitySelector.css +29 -15
  165. package/es/CitySelector/CitySelectorCore.js +25 -16
  166. package/es/CitySelector/Selector/index.css +4 -4
  167. package/es/Collapse/Collapse.css +6 -0
  168. package/es/Collapse/Collapse.d.ts +5 -0
  169. package/es/Collapse/Collapse.js +144 -0
  170. package/es/Collapse/Collapse.types.d.ts +16 -0
  171. package/es/Collapse/Collapse.types.js +1 -0
  172. package/es/Collapse/index.d.ts +2 -0
  173. package/es/Collapse/index.js +6 -0
  174. package/es/CollapsePanel/CollapsePanel.css +32 -0
  175. package/es/CollapsePanel/CollapsePanel.d.ts +5 -0
  176. package/es/CollapsePanel/CollapsePanel.js +132 -0
  177. package/es/CollapsePanel/CollapsePanel.types.d.ts +64 -0
  178. package/es/CollapsePanel/CollapsePanel.types.js +1 -0
  179. package/es/CollapsePanel/CollapsePanelItem.d.ts +4 -0
  180. package/es/CollapsePanel/CollapsePanelItem.js +85 -0
  181. package/es/CollapsePanel/index.d.ts +4 -0
  182. package/es/CollapsePanel/index.js +9 -0
  183. package/es/Countdown/Countdown.css +2 -1
  184. package/es/Dialog/Dialog.d.ts +2 -2
  185. package/es/Dialog/Dialog.js +20 -8
  186. package/es/Dialog/Dialog.types.d.ts +12 -1
  187. package/es/Dialog/FunctionalDialog.js +38 -2
  188. package/es/Dialog/index.css +27 -18
  189. package/es/Divider/Divider.css +6 -4
  190. package/es/IconButton/IconButton.css +9 -7
  191. package/es/Image/index.css +2 -1
  192. package/es/Input/Input.css +14 -7
  193. package/es/List/List.css +3 -0
  194. package/es/List/ListItem.css +3 -3
  195. package/es/List/ListItemContent.css +1 -1
  196. package/es/Loading/Loading.css +4 -2
  197. package/es/Modal/Modal.miniapp.d.ts +1 -1
  198. package/es/NavBar/NavBar.css +9 -5
  199. package/es/Picker/Picker.css +25 -29
  200. package/es/Picker/Picker.js +32 -12
  201. package/es/Picker/Picker.types.d.ts +4 -0
  202. package/es/Picker/PickerPanel.css +8 -8
  203. package/es/Picker/PickerPanel.js +14 -8
  204. package/es/Picker/utils.d.ts +16 -0
  205. package/es/Picker/utils.js +29 -1
  206. package/es/Popover/Popover.css +97 -0
  207. package/es/Popover/Popover.d.ts +5 -0
  208. package/es/Popover/Popover.js +172 -0
  209. package/es/Popover/Popover.types.d.ts +58 -0
  210. package/es/Popover/Popover.types.js +1 -0
  211. package/es/Popover/index.d.ts +2 -0
  212. package/es/Popover/index.js +6 -0
  213. package/es/Portal/Portal.types.d.ts +4 -0
  214. package/es/Portal/PortalCore.js +8 -1
  215. package/es/Progress/Progress.css +9 -7
  216. package/es/Radio/Radio.css +5 -4
  217. package/es/Rating/Rating.css +8 -4
  218. package/es/Select/Select.css +21 -10
  219. package/es/Select/Select.js +1 -1
  220. package/es/Select/SelectOption.js +3 -0
  221. package/es/Skeleton/Skeleton.css +5 -5
  222. package/es/Slider/Slider.css +29 -18
  223. package/es/Steps/Step.css +13 -13
  224. package/es/Steps/Steps.css +14 -7
  225. package/es/Swiper/Swiper.css +2 -1
  226. package/es/Switch/Switch.css +31 -16
  227. package/es/TabBar/TabBar.css +7 -3
  228. package/es/TabBar/TabBarItem.css +0 -1
  229. package/es/Tabs/Tab.css +6 -10
  230. package/es/Tabs/Tabs.css +10 -9
  231. package/es/Tag/Tag.css +7 -10
  232. package/es/Tag/TagGroup.css +9 -1
  233. package/es/TextArea/TextArea.css +23 -13
  234. package/es/ThemeProvider/ThemeProvider.d.ts +4 -0
  235. package/es/ThemeProvider/ThemeProvider.js +62 -0
  236. package/es/ThemeProvider/ThemeProvider.types.d.ts +127 -0
  237. package/es/ThemeProvider/ThemeProvider.types.js +1 -0
  238. package/es/ThemeProvider/hooks/ThemeContext.d.ts +4 -0
  239. package/es/ThemeProvider/hooks/ThemeContext.js +6 -0
  240. package/es/ThemeProvider/hooks/createTheme.d.ts +2 -0
  241. package/es/ThemeProvider/hooks/createTheme.js +38 -0
  242. package/es/ThemeProvider/hooks/index.d.ts +4 -0
  243. package/es/ThemeProvider/hooks/index.js +8 -0
  244. package/es/ThemeProvider/hooks/useTheme.d.ts +1 -0
  245. package/es/ThemeProvider/hooks/useTheme.js +10 -0
  246. package/es/ThemeProvider/index.d.ts +4 -0
  247. package/es/ThemeProvider/index.js +8 -0
  248. package/es/ThemeProvider/utils/constants.d.ts +38 -0
  249. package/es/ThemeProvider/utils/constants.js +40 -0
  250. package/es/ThemeProvider/utils/index.d.ts +2 -0
  251. package/es/ThemeProvider/utils/index.js +2 -0
  252. package/es/ThemeProvider/utils/mountTokens.d.ts +26 -0
  253. package/es/ThemeProvider/utils/mountTokens.js +88 -0
  254. package/es/Toast/FunctionalToast.js +18 -0
  255. package/es/Toast/Toast.css +18 -20
  256. package/es/Toast/Toast.d.ts +2 -2
  257. package/es/Toast/Toast.js +53 -49
  258. package/es/Toast/Toast.types.d.ts +15 -1
  259. package/es/Tooltip/Tooltip.css +91 -0
  260. package/es/Tooltip/Tooltip.d.ts +5 -0
  261. package/es/Tooltip/Tooltip.js +161 -0
  262. package/es/Tooltip/Tooltip.types.d.ts +49 -0
  263. package/es/Tooltip/Tooltip.types.js +1 -0
  264. package/es/Tooltip/index.d.ts +2 -0
  265. package/es/Tooltip/index.js +6 -0
  266. package/es/index.d.ts +7 -0
  267. package/es/index.js +7 -0
  268. package/es/locales/base.d.ts +40 -0
  269. package/es/locales/base.js +0 -0
  270. package/es/locales/en-US.d.ts +3 -0
  271. package/es/locales/en-US.js +50 -0
  272. package/es/locales/hooks/useLocaleText.d.ts +3 -0
  273. package/es/locales/hooks/useLocaleText.js +26 -0
  274. package/es/locales/index.d.ts +5 -0
  275. package/es/locales/index.js +11 -0
  276. package/es/locales/zh-CN.d.ts +3 -0
  277. package/es/locales/zh-CN.js +32 -0
  278. package/es/locales/zh-TW.d.ts +3 -0
  279. package/es/locales/zh-TW.js +32 -0
  280. package/package.json +5 -5
@@ -59,34 +59,31 @@ module.exports = __toCommonJS(CitySelectorCore_exports);
59
59
  var import_react = __toESM(require("react"));
60
60
  var import_clsx = __toESM(require("clsx"));
61
61
  var import_utils = require("@bifrostui/utils");
62
+ var import_locales = require("../locales");
62
63
  var import_ScrollView = __toESM(require("../ScrollView"));
63
64
  var import_Selector = __toESM(require("./Selector"));
64
65
  var import_CitySelector2 = require("./CitySelector.css");
65
66
  const DEVIATION_HEIGHT = "6vmin";
66
- const GPS_TYPE = {
67
- title: "\u5B9A\u4F4D",
68
- code: "GPS"
69
- };
70
- const CURRENT_TYPE = {
71
- title: "\u5F53\u524D",
72
- code: "CRRT"
73
- };
74
- const HOT_CITY_TYPE = {
75
- title: "\u70ED\u95E8",
76
- code: "HOT"
77
- };
78
67
  const prefixCls = "bui-city-selector";
79
68
  const CitySelector = /* @__PURE__ */ import_react.default.forwardRef(
80
69
  (props, ref) => {
70
+ const {
71
+ selectedCityGroupName: selectedCityGroupLocaleName,
72
+ currentCityGroupName: currentCityGroupLocaleName,
73
+ hotCitiesGroupName: hotCitiesGroupLocaleName,
74
+ located,
75
+ current,
76
+ hot
77
+ } = (0, import_locales.useLocaleText)("citySelector");
81
78
  const _a = props, {
82
79
  className,
83
80
  title: pageTitle,
84
81
  selectedCity,
85
- selectedCityGroupName = "\u5F53\u524D\u57CE\u5E02",
82
+ selectedCityGroupName = selectedCityGroupLocaleName,
86
83
  currentCity,
87
- currentCityGroupName = "\u5B9A\u4F4D\u57CE\u5E02",
84
+ currentCityGroupName = currentCityGroupLocaleName,
88
85
  hotCities,
89
- hotCitiesGroupName = "\u70ED\u95E8\u57CE\u5E02",
86
+ hotCitiesGroupName = hotCitiesGroupLocaleName,
90
87
  cities,
91
88
  disableIndex,
92
89
  touchHandler,
@@ -109,6 +106,18 @@ const CitySelector = /* @__PURE__ */ import_react.default.forwardRef(
109
106
  "onSelect",
110
107
  "onClose"
111
108
  ]);
109
+ const GPS_TYPE = {
110
+ title: located,
111
+ code: "GPS"
112
+ };
113
+ const CURRENT_TYPE = {
114
+ title: current,
115
+ code: "CRRT"
116
+ };
117
+ const HOT_CITY_TYPE = {
118
+ title: hot,
119
+ code: "HOT"
120
+ };
112
121
  const cityRef = (0, import_react.useRef)(null);
113
122
  const nodeRef = (0, import_utils.useForkRef)(ref, cityRef);
114
123
  (0, import_utils.useTouchEmulator)(cityRef.current);
@@ -167,7 +176,7 @@ const CitySelector = /* @__PURE__ */ import_react.default.forwardRef(
167
176
  };
168
177
  const renderTitile = (title, titleCode) => {
169
178
  const parseTitle = (titleCode || title).toUpperCase();
170
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "select-city-title", id: disableIndex ? "" : parseTitle }, title.toUpperCase());
179
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "select-city-title", id: disableIndex ? "" : parseTitle }, title == null ? void 0 : title.toUpperCase());
171
180
  };
172
181
  const renderCity = (citys, title, titleCode) => {
173
182
  return /* @__PURE__ */ import_react.default.createElement("div", null, renderTitile(title, titleCode), /* @__PURE__ */ import_react.default.createElement("div", { className: "select-city-buttons" }, citys.map((city, index) => {
@@ -1,11 +1,11 @@
1
1
  .bui-city-selector-item {
2
- width: 111px;
3
- height: 36px;
2
+ width: var(--select-item-width);
3
+ height: var(--select-item-height);
4
4
  display: inline-flex;
5
5
  justify-content: center;
6
6
  align-items: center;
7
- border-radius: 20px;
8
- margin: 4.5px 0 4.5px 9px;
7
+ border-radius: var(--select-item-border-radius);
8
+ margin: var(--select-item-margin);
9
9
  background-color: var(--bui-color-bg-default);
10
10
  font-size: var(--bui-text-size-2);
11
11
  }
@@ -0,0 +1,6 @@
1
+ .bui-collapse {
2
+ overflow: hidden;
3
+ white-space: nowrap;
4
+ height: fit-content;
5
+ width: fit-content;
6
+ }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { CollapseProps } from './Collapse.types';
3
+ import './Collapse.less';
4
+ declare const Collapse: React.ForwardRefExoticComponent<CollapseProps & React.RefAttributes<unknown>>;
5
+ export default Collapse;
@@ -0,0 +1,165 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __objRest = (source, exclude) => {
25
+ var target = {};
26
+ for (var prop in source)
27
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
28
+ target[prop] = source[prop];
29
+ if (source != null && __getOwnPropSymbols)
30
+ for (var prop of __getOwnPropSymbols(source)) {
31
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
32
+ target[prop] = source[prop];
33
+ }
34
+ return target;
35
+ };
36
+ var __export = (target, all) => {
37
+ for (var name in all)
38
+ __defProp(target, name, { get: all[name], enumerable: true });
39
+ };
40
+ var __copyProps = (to, from, except, desc) => {
41
+ if (from && typeof from === "object" || typeof from === "function") {
42
+ for (let key of __getOwnPropNames(from))
43
+ if (!__hasOwnProp.call(to, key) && key !== except)
44
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
45
+ }
46
+ return to;
47
+ };
48
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
49
+ // If the importer is in node compatibility mode or this is not an ESM
50
+ // file that has been converted to a CommonJS file using a Babel-
51
+ // compatible transform (i.e. "__esModule" has not been set), then set
52
+ // "default" to the CommonJS "module.exports" for node compatibility.
53
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
54
+ mod
55
+ ));
56
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
57
+ var Collapse_exports = {};
58
+ __export(Collapse_exports, {
59
+ default: () => Collapse_default
60
+ });
61
+ module.exports = __toCommonJS(Collapse_exports);
62
+ var import_react = __toESM(require("react"));
63
+ var import_utils = require("@bifrostui/utils");
64
+ var import_Transition = require("../Transition");
65
+ var import_Collapse2 = require("./Collapse.css");
66
+ const defaultEasing = {
67
+ enter: import_utils.easing.easeOut,
68
+ exit: import_utils.easing.sharp
69
+ };
70
+ const defaultTimeout = {
71
+ enter: import_utils.duration.enteringScreen,
72
+ exit: import_utils.duration.leavingScreen
73
+ };
74
+ const Collapse = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
75
+ const _a = props, {
76
+ appear = false,
77
+ in: inProp,
78
+ easing: easingProp = defaultEasing,
79
+ direction = "vertical",
80
+ timeout = defaultTimeout,
81
+ delay = 0,
82
+ collapsedSize: collapsedSizeProp = 0,
83
+ style,
84
+ className,
85
+ children
86
+ } = _a, other = __objRest(_a, [
87
+ "appear",
88
+ "in",
89
+ "easing",
90
+ "direction",
91
+ "timeout",
92
+ "delay",
93
+ "collapsedSize",
94
+ "style",
95
+ "className",
96
+ "children"
97
+ ]);
98
+ const nodeRef = (0, import_utils.useForkRef)(ref);
99
+ const wrapperRef = (0, import_react.useRef)(null);
100
+ const collapseRef = (0, import_utils.useForkRef)(wrapperRef, ref);
101
+ const transitions = (0, import_utils.createTransitions)();
102
+ const isHorizontal = direction === "horizontal";
103
+ const collapsedSize = typeof collapsedSizeProp === "number" ? `${collapsedSizeProp}px` : collapsedSizeProp;
104
+ const size = isHorizontal ? "width" : "height";
105
+ const getCollapseWrapperSize = (reactNode) => {
106
+ return reactNode ? `${reactNode[isHorizontal ? "clientWidth" : "clientHeight"]}px` : "fit-content";
107
+ };
108
+ (0, import_react.useEffect)(() => {
109
+ var _a2, _b, _c, _d;
110
+ if (appear === false && inProp === true && ((_b = (_a2 = wrapperRef.current) == null ? void 0 : _a2.style) == null ? void 0 : _b[size]) === "fit-content") {
111
+ wrapperRef.current.style[size] = getCollapseWrapperSize(
112
+ (_d = (_c = wrapperRef.current) == null ? void 0 : _c.children) == null ? void 0 : _d[0]
113
+ );
114
+ }
115
+ }, [appear, inProp]);
116
+ if (!children)
117
+ return null;
118
+ return /* @__PURE__ */ import_react.default.createElement(
119
+ import_Transition.Transition,
120
+ __spreadProps(__spreadValues({}, other), {
121
+ ref: nodeRef,
122
+ in: inProp,
123
+ timeout,
124
+ delay,
125
+ appear
126
+ }),
127
+ (state, childProps) => {
128
+ var _a2;
129
+ const transition = transitions.create(
130
+ size,
131
+ (0, import_utils.getTransitionProps)(
132
+ { timeout, style, easing: easingProp, delay },
133
+ { mode: state }
134
+ )
135
+ );
136
+ const wrapperSize = () => {
137
+ var _a3, _b;
138
+ const collapseWrapperSize = state === "entering" || state === "entered" ? getCollapseWrapperSize((_b = (_a3 = wrapperRef.current) == null ? void 0 : _a3.children) == null ? void 0 : _b[0]) : collapsedSize;
139
+ return isHorizontal ? {
140
+ width: collapseWrapperSize,
141
+ WebKitWidth: collapseWrapperSize
142
+ } : {
143
+ height: collapseWrapperSize,
144
+ WebKitHeight: collapseWrapperSize
145
+ };
146
+ };
147
+ return import_react.default.createElement(
148
+ "div",
149
+ {
150
+ className: `bui-collapse ${className}`,
151
+ style: __spreadValues(__spreadProps(__spreadValues({}, style), {
152
+ transition,
153
+ WebkitTransition: transition
154
+ }), wrapperSize()),
155
+ ref: collapseRef
156
+ },
157
+ import_react.default.cloneElement(children, __spreadValues({
158
+ style: __spreadValues({}, (_a2 = children.props) == null ? void 0 : _a2.style)
159
+ }, childProps))
160
+ );
161
+ }
162
+ );
163
+ });
164
+ Collapse.displayName = "BuiCollapse";
165
+ var Collapse_default = Collapse;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { TransitionProps } from '../Transition';
3
+ export interface CollapseProps extends Omit<TransitionProps, 'children'> {
4
+ easing?: string | {
5
+ enter?: string;
6
+ exit?: string;
7
+ };
8
+ children?: React.ReactElement;
9
+ /**
10
+ * 折叠的方向
11
+ * horizontal - 水平方向
12
+ * vertical - 垂直方向
13
+ */
14
+ direction?: 'horizontal' | 'vertical';
15
+ collapsedSize?: string | number;
16
+ }
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var Collapse_types_exports = {};
15
+ module.exports = __toCommonJS(Collapse_types_exports);
@@ -0,0 +1,2 @@
1
+ export { default, default as Collapse } from './Collapse';
2
+ export * from './Collapse.types';
@@ -0,0 +1,41 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var Collapse_exports = {};
30
+ __export(Collapse_exports, {
31
+ Collapse: () => import_Collapse.default,
32
+ default: () => import_Collapse.default
33
+ });
34
+ module.exports = __toCommonJS(Collapse_exports);
35
+ var import_Collapse = __toESM(require("./Collapse"));
36
+ __reExport(Collapse_exports, require("./Collapse.types"), module.exports);
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ Collapse,
40
+ ...require("./Collapse.types")
41
+ });
@@ -0,0 +1,32 @@
1
+ .bui-collapse-panel {
2
+ --width: var(--bui-collapse-panel-width, 100%);
3
+ --header-padding: var(--bui-collapse-panel-header-padding, var(--bui-spacing-lg) 0);
4
+ --content-padding: var(--bui-collapse-panel-content-padding, var(--bui-spacing-lg) 0);
5
+ width: var(--width);
6
+ background-color: var(--bui-color-bg-view);
7
+ color: var(--bui-color-fg-default);
8
+ }
9
+ .bui-collapse-panel-item-header {
10
+ display: flex;
11
+ align-items: center;
12
+ justify-content: space-between;
13
+ border-bottom: solid 1px #eee;
14
+ cursor: pointer;
15
+ }
16
+ .bui-collapse-panel-item-header-label {
17
+ padding: var(--header-padding);
18
+ font-size: var(--bui-title-size-2);
19
+ }
20
+ .bui-collapse-panel-item-header-icon-arrow {
21
+ transform: rotate(0deg);
22
+ transition: all 0.3s ease;
23
+ }
24
+ .bui-collapse-panel-item-header-icon-arrow-active {
25
+ transform: rotate(-180deg);
26
+ }
27
+ .bui-collapse-panel-item-content {
28
+ padding: var(--content-padding);
29
+ font-size: var(--bui-text-size-1);
30
+ transition: height 0.5s ease;
31
+ overflow: hidden;
32
+ }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { CollapsePanelProps } from './CollapsePanel.types';
3
+ import './CollapsePanel.less';
4
+ declare const CollapsePanel: React.ForwardRefExoticComponent<Omit<CollapsePanelProps<"div", {}>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
+ export default CollapsePanel;
@@ -0,0 +1,159 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __objRest = (source, exclude) => {
25
+ var target = {};
26
+ for (var prop in source)
27
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
28
+ target[prop] = source[prop];
29
+ if (source != null && __getOwnPropSymbols)
30
+ for (var prop of __getOwnPropSymbols(source)) {
31
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
32
+ target[prop] = source[prop];
33
+ }
34
+ return target;
35
+ };
36
+ var __export = (target, all) => {
37
+ for (var name in all)
38
+ __defProp(target, name, { get: all[name], enumerable: true });
39
+ };
40
+ var __copyProps = (to, from, except, desc) => {
41
+ if (from && typeof from === "object" || typeof from === "function") {
42
+ for (let key of __getOwnPropNames(from))
43
+ if (!__hasOwnProp.call(to, key) && key !== except)
44
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
45
+ }
46
+ return to;
47
+ };
48
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
49
+ // If the importer is in node compatibility mode or this is not an ESM
50
+ // file that has been converted to a CommonJS file using a Babel-
51
+ // compatible transform (i.e. "__esModule" has not been set), then set
52
+ // "default" to the CommonJS "module.exports" for node compatibility.
53
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
54
+ mod
55
+ ));
56
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
57
+ var CollapsePanel_exports = {};
58
+ __export(CollapsePanel_exports, {
59
+ default: () => CollapsePanel_default
60
+ });
61
+ module.exports = __toCommonJS(CollapsePanel_exports);
62
+ var import_react = __toESM(require("react"));
63
+ var import_clsx = __toESM(require("clsx"));
64
+ var import_icons = require("@bifrostui/icons");
65
+ var import_utils = require("@bifrostui/utils");
66
+ var import_CollapsePanelItem = __toESM(require("./CollapsePanelItem"));
67
+ var import_CollapsePanel2 = require("./CollapsePanel.css");
68
+ const prefixCls = "bui-collapse-panel";
69
+ const CollapsePanel = /* @__PURE__ */ import_react.default.forwardRef(
70
+ (props, ref) => {
71
+ const _a = props, {
72
+ className,
73
+ style,
74
+ accordion = false,
75
+ activeKeys,
76
+ defaultActiveKeys,
77
+ items,
78
+ children,
79
+ arrowIcon,
80
+ onChange
81
+ } = _a, others = __objRest(_a, [
82
+ "className",
83
+ "style",
84
+ "accordion",
85
+ "activeKeys",
86
+ "defaultActiveKeys",
87
+ "items",
88
+ "children",
89
+ "arrowIcon",
90
+ "onChange"
91
+ ]);
92
+ const [openKeys, setOpenKeys] = (0, import_utils.useValue)({
93
+ defaultValue: defaultActiveKeys || [],
94
+ value: activeKeys
95
+ });
96
+ const handleClick = (event, target) => {
97
+ var _a2;
98
+ const targetKey = target == null ? void 0 : target.key;
99
+ let newOpenKeys = [];
100
+ if (accordion) {
101
+ newOpenKeys = openKeys.includes(targetKey) ? [] : [targetKey];
102
+ } else {
103
+ newOpenKeys = openKeys.includes(targetKey) ? openKeys.filter((k) => k !== targetKey) : [targetKey, ...openKeys];
104
+ }
105
+ setOpenKeys(event, newOpenKeys);
106
+ onChange == null ? void 0 : onChange(event, { activeKeys: newOpenKeys });
107
+ (_a2 = target == null ? void 0 : target.onClick) == null ? void 0 : _a2.call(target, event);
108
+ };
109
+ const getArrowIcon = () => {
110
+ if (arrowIcon) {
111
+ return arrowIcon;
112
+ }
113
+ return /* @__PURE__ */ import_react.default.createElement(import_icons.ArrowDownwardLargeIcon, null);
114
+ };
115
+ const renderList = () => {
116
+ if (Array.isArray(items)) {
117
+ return items.map((item) => {
118
+ const _a2 = item, { key } = _a2, otherProps = __objRest(_a2, ["key"]);
119
+ return /* @__PURE__ */ import_react.default.createElement(
120
+ import_CollapsePanelItem.default,
121
+ __spreadProps(__spreadValues({
122
+ key,
123
+ icon: getArrowIcon(),
124
+ active: openKeys.includes(item.key)
125
+ }, otherProps), {
126
+ onClick: (e) => handleClick(e, item)
127
+ })
128
+ );
129
+ });
130
+ }
131
+ const enhancedChildren = import_react.default.Children.map(children, (child) => {
132
+ if (import_react.default.isValidElement(child)) {
133
+ const newProps = {
134
+ icon: getArrowIcon(),
135
+ active: openKeys.includes(child.key),
136
+ onClick: (e) => handleClick(e, child)
137
+ };
138
+ return import_react.default.cloneElement(child, newProps);
139
+ }
140
+ return child;
141
+ });
142
+ return enhancedChildren;
143
+ };
144
+ if (items == null && children == null) {
145
+ return null;
146
+ }
147
+ return /* @__PURE__ */ import_react.default.createElement(
148
+ "div",
149
+ __spreadValues({
150
+ className: (0, import_clsx.default)(prefixCls, className),
151
+ style,
152
+ ref
153
+ }, others),
154
+ /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-list` }, renderList())
155
+ );
156
+ }
157
+ );
158
+ CollapsePanel.displayName = "BuiCollapsePanel";
159
+ var CollapsePanel_default = CollapsePanel;
@@ -0,0 +1,64 @@
1
+ import { OverrideProps } from '@bifrostui/types';
2
+ import React from 'react';
3
+ export type CollapsePanelItemProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
4
+ props: P & {
5
+ /**
6
+ * 唯一标识,对应 activeKey
7
+ */
8
+ key?: string | number;
9
+ /**
10
+ * 面板标题
11
+ */
12
+ label?: React.ReactNode;
13
+ /**
14
+ * 自定义 icon
15
+ */
16
+ icon?: React.ReactNode | ((active: boolean) => React.ReactNode);
17
+ /**
18
+ * 是否展开
19
+ * @default false
20
+ */
21
+ active?: boolean;
22
+ /**
23
+ * body 区域内容
24
+ */
25
+ children?: React.ReactNode;
26
+ };
27
+ defaultComponent: D;
28
+ }, D>;
29
+ export type CollapsePanelProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
30
+ props: P & {
31
+ /**
32
+ * 是否开启手风琴模式
33
+ * @default false
34
+ */
35
+ accordion?: boolean;
36
+ /**
37
+ * 当前激活面板的 key
38
+ */
39
+ activeKeys?: (number | string)[];
40
+ /**
41
+ * 默认展开面板的 key
42
+ */
43
+ defaultActiveKeys?: (number | string)[];
44
+ /**
45
+ * 折叠项目内容
46
+ */
47
+ items?: Array<CollapsePanelItemProps>;
48
+ /**
49
+ * body 区域内容,使用 CollapseItem 进行渲染
50
+ */
51
+ children?: React.ReactNode;
52
+ /**
53
+ * 自定义箭头图标
54
+ */
55
+ arrowIcon?: React.ReactNode | ((active: boolean) => React.ReactNode);
56
+ /**
57
+ * 切换面板时触发
58
+ */
59
+ onChange?: (e: React.SyntheticEvent, params: {
60
+ activeKeys: (number | string)[];
61
+ }) => void;
62
+ };
63
+ defaultComponent: D;
64
+ }, D>;
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var CollapsePanel_types_exports = {};
15
+ module.exports = __toCommonJS(CollapsePanel_types_exports);
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { CollapsePanelItemProps } from './CollapsePanel.types';
3
+ declare const CollapsePanelItem: React.ForwardRefExoticComponent<Omit<CollapsePanelItemProps<"div", {}>, "ref"> & React.RefAttributes<HTMLDivElement>>;
4
+ export default CollapsePanelItem;