@unicom-cloud/ui 0.8.113 → 0.8.114

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 (320) hide show
  1. package/Affix.js +2 -2
  2. package/Alert.js +2 -2
  3. package/AutoComplete.js +1 -1
  4. package/BackTop.js +3 -3
  5. package/Badge.js +2 -2
  6. package/Breadcrumb.js +2 -2
  7. package/Button.js +1 -1
  8. package/Calendar.js +1 -1
  9. package/Card.js +1 -1
  10. package/Carousel.js +1 -1
  11. package/Cascader.js +1 -1
  12. package/Checkbox.js +1 -1
  13. package/ColorPicker.js +1 -1
  14. package/Comment.js +1 -1
  15. package/ConfigProvider.js +1 -1
  16. package/Copy.js +1 -1
  17. package/Countdown.js +4 -4
  18. package/DatePicker.js +1 -1
  19. package/Descriptions.js +1 -1
  20. package/Details.js +4 -4
  21. package/Development.js +1 -1
  22. package/Divider.js +1 -1
  23. package/Draggable.js +1 -1
  24. package/Dropdown.js +2 -2
  25. package/Empty.js +1 -1
  26. package/Flex.js +4 -4
  27. package/Form.js +1 -1
  28. package/Icon.js +1 -1
  29. package/IconHover.js +1 -1
  30. package/Image.js +1 -1
  31. package/InputNumber.js +1 -1
  32. package/Layout.js +1 -1
  33. package/Link.js +1 -1
  34. package/LiquidFill.js +4 -4
  35. package/List.js +1 -1
  36. package/Loading.js +4 -4
  37. package/Marquee.js +7 -6
  38. package/Mentions.js +1 -1
  39. package/Menu.js +1 -1
  40. package/Message.js +2 -2
  41. package/Modal.js +1 -1
  42. package/Notice.js +4 -4
  43. package/Notification.js +2 -2
  44. package/OverflowEllipsis.js +1 -1
  45. package/PageHeader.js +1 -1
  46. package/Popconfirm.js +1 -1
  47. package/Popover.js +1 -1
  48. package/Progress.js +1 -1
  49. package/QrCode.js +7 -7
  50. package/Radio.js +1 -1
  51. package/Rate.js +1 -1
  52. package/ResizeBox.js +2 -2
  53. package/Result.js +1 -1
  54. package/RichText.js +1 -1
  55. package/Segmented.js +4 -4
  56. package/Skeleton.js +1 -1
  57. package/Slider.js +2 -2
  58. package/Space.js +4 -4
  59. package/Spin.js +1 -1
  60. package/Statistic.js +1 -1
  61. package/Steps.js +1 -1
  62. package/Switch.js +2 -2
  63. package/Table.js +1 -1
  64. package/Tabs.js +1 -1
  65. package/Tag.js +1 -1
  66. package/Tooltip.js +1 -1
  67. package/Tour.js +4 -4
  68. package/Transfer.js +1 -1
  69. package/Tree.js +1 -1
  70. package/TreeSelect.js +1 -1
  71. package/Trigger.js +3 -3
  72. package/affix/index.js +2 -2
  73. package/alert/index.js +2 -2
  74. package/anchor/Anchor.js +2 -2
  75. package/anchor/Link.js +1 -1
  76. package/app/App.js +2 -2
  77. package/auto-complete/index.js +1 -1
  78. package/avatar/Avatar.js +1 -1
  79. package/avatar/Group.js +1 -1
  80. package/back-top/index.js +3 -3
  81. package/badge/Count.js +1 -1
  82. package/badge/index.js +2 -2
  83. package/breadcrumb/index.js +2 -2
  84. package/button/Group.js +1 -1
  85. package/button/index.js +1 -1
  86. package/calendar/index.js +2 -2
  87. package/card/Grid.js +1 -1
  88. package/card/Meta.js +1 -1
  89. package/card/index.js +1 -1
  90. package/carousel/Arrow.js +1 -1
  91. package/carousel/Indicator.js +1 -1
  92. package/carousel/index.js +1 -1
  93. package/cascader/Cascader.js +2 -2
  94. package/cascader/index.js +1 -1
  95. package/cascader/util.js +1 -1
  96. package/checkbox/Checkbox.js +2 -2
  97. package/checkbox/Group.js +2 -2
  98. package/checkbox/GroupBlock.js +2 -2
  99. package/checkbox/index.js +2 -2
  100. package/chunk/{D0dVE1v1.js → BGb_jT2S.js} +417 -416
  101. package/chunk/{C6A94b7f.js → BcWPf1id.js} +1 -1
  102. package/chunk/BcdTSJks.js +48 -0
  103. package/chunk/{RjJoagzL.js → CEAeR6xB.js} +1 -1
  104. package/chunk/{yWKJUe_w.js → CKojyqln.js} +4 -4
  105. package/chunk/{DrYaod6k.js → CRgtPpMG.js} +1 -1
  106. package/chunk/{3t4FwEoB.js → CVjWKHBo.js} +1 -1
  107. package/chunk/{DB0hUIM1.js → CYPFoLks.js} +4 -4
  108. package/chunk/{Bzx5BueA.js → Ch4iApRQ.js} +2 -2
  109. package/chunk/{CbXCgtzv.js → Cs9GrNJa.js} +5 -5
  110. package/chunk/CxbF1opI.js +231 -0
  111. package/chunk/{CRdegvoa.js → D3F0iWPu.js} +1 -1
  112. package/chunk/{DzlfiVe2.js → D6I1_o6O.js} +1 -1
  113. package/chunk/{DA5AMZwY.js → DPDyV8yt.js} +3 -3
  114. package/chunk/{B--6x-RL.js → DQ8_XXrH.js} +1 -1
  115. package/chunk/{hc_ufgVf.js → DmHIX8hU.js} +166 -121
  116. package/chunk/{CYDaUML7.js → DstheLSK.js} +4 -4
  117. package/chunk/{BHAu6wbC.js → HFPyZ48d.js} +37 -35
  118. package/chunk/{Bcl7dWlJ.js → efH9HX0H.js} +3 -3
  119. package/chunk/exc7v_Hl.js +53 -0
  120. package/collapse/Collapse.js +2 -2
  121. package/collapse/Item.js +2 -2
  122. package/color-picker/ControlBar.js +1 -1
  123. package/color-picker/InputAlpha.js +1 -1
  124. package/color-picker/InputHex.js +1 -1
  125. package/color-picker/InputRgb.js +1 -1
  126. package/color-picker/Palette.js +1 -1
  127. package/color-picker/Panel.js +2 -2
  128. package/color-picker/index.js +1 -1
  129. package/comment/index.js +1 -1
  130. package/config-provider/ConfigProvider.js +1 -1
  131. package/config-provider/context.js +1 -1
  132. package/config-provider/index.js +2 -2
  133. package/copy/index.js +1 -1
  134. package/countdown/index.js +4 -4
  135. package/date-picker/Picker.js +1 -1
  136. package/date-picker/RangePicker.js +2 -2
  137. package/date-picker/index.js +1 -1
  138. package/descriptions/index.js +1 -1
  139. package/details/index.js +4 -4
  140. package/development/index.js +1 -1
  141. package/divider/index.js +1 -1
  142. package/draggable/index.js +1 -1
  143. package/drawer/Drawer.js +89 -93
  144. package/dropdown/Button.js +1 -1
  145. package/dropdown/index.js +2 -2
  146. package/empty/index.js +1 -1
  147. package/flex/index.js +4 -4
  148. package/form/Control.js +115 -103
  149. package/form/Form.js +2 -2
  150. package/form/FormItem.js +2 -2
  151. package/form/index.js +1 -1
  152. package/form/promisify.js +10 -19
  153. package/form/store.js +3 -3
  154. package/form/util.js +62 -52
  155. package/grid/Grid.js +1 -1
  156. package/grid/Item.js +1 -1
  157. package/hooks/index.js +3 -3
  158. package/hooks/useInView.js +1 -1
  159. package/hooks/useIntersectionObserver.js +1 -1
  160. package/hooks/useOverrideRef.js +1 -1
  161. package/hooks/useWatermark.js +1 -1
  162. package/icon/addFromIconFontCn.js +1 -1
  163. package/icon/index.js +2 -2
  164. package/icon-hover/index.js +1 -1
  165. package/icons/file.js +1 -1
  166. package/image/Image.js +3 -3
  167. package/image/ImagePreview.js +6 -6
  168. package/image/ImagePreviewArrow.js +1 -1
  169. package/image/ImagePreviewGroup.js +1 -1
  170. package/image/index.js +1 -1
  171. package/index.js +701 -689
  172. package/input/Button.js +1 -1
  173. package/input/Group.js +1 -1
  174. package/input/Input.js +2 -2
  175. package/input/InputElement.js +1 -1
  176. package/input/Password.js +1 -1
  177. package/input/Search.js +1 -1
  178. package/input/Textarea.js +1 -1
  179. package/input/autoSizeTextAreaHeight.js +29 -20
  180. package/input-number/index.js +1 -1
  181. package/input-tag/InputTag.js +2 -2
  182. package/layout/Content.js +1 -1
  183. package/layout/Footer.js +1 -1
  184. package/layout/Header.js +1 -1
  185. package/layout/Sider.js +1 -1
  186. package/layout/index.js +1 -1
  187. package/link/index.js +1 -1
  188. package/liquid-fill/index.js +4 -4
  189. package/list/Item.js +1 -1
  190. package/list/Meta.js +1 -1
  191. package/list/index.js +1 -1
  192. package/loading/index.js +4 -4
  193. package/locale/en-US.js +5 -3
  194. package/locale/tr-TR.js +5 -3
  195. package/marquee/index.js +7 -6
  196. package/marquee-/index.js +7 -6
  197. package/mentions/index.js +1 -1
  198. package/menu/Menu.js +2 -2
  199. package/menu/OverflowWrap.js +1 -1
  200. package/menu/index.js +2 -2
  201. package/message/index.js +2 -2
  202. package/message/useMessage.js +1 -1
  203. package/modal/Confirm.js +2 -2
  204. package/modal/Modal.js +5 -5
  205. package/modal/index.js +2 -2
  206. package/notice/index.js +4 -4
  207. package/notification/index.js +2 -2
  208. package/notification/useNotification.js +1 -1
  209. package/overflow-ellipsis/OverflowItem.js +1 -1
  210. package/overflow-ellipsis/index.js +1 -1
  211. package/package.json +1 -1
  212. package/page-header/index.js +1 -1
  213. package/pagination/PageItem.js +1 -1
  214. package/pagination/PageJumper.js +1 -1
  215. package/pagination/PageOption.js +1 -1
  216. package/pagination/Pagination.js +1 -1
  217. package/picker/Input.js +1 -1
  218. package/picker/InputRange.js +1 -1
  219. package/popconfirm/index.js +1 -1
  220. package/popover/index.js +1 -1
  221. package/progress/index.js +1 -1
  222. package/qr-code/index.js +1233 -45
  223. package/radio/Group.js +2 -2
  224. package/radio/GroupBlock.js +2 -2
  225. package/radio/Radio.js +2 -2
  226. package/radio/index.js +2 -2
  227. package/rate/index.js +1 -1
  228. package/resize-box/ResizeTrigger.js +1 -1
  229. package/resize-box/Split.js +2 -2
  230. package/resize-box/SplitGroup.js +2 -2
  231. package/resize-box/index.js +2 -2
  232. package/result/index.js +1 -1
  233. package/rich-text/index.js +1 -1
  234. package/row-col/Col-.js +1 -1
  235. package/row-col/Col.js +1 -1
  236. package/row-col/Row.js +1 -1
  237. package/segmented/index.js +21 -21
  238. package/select/Option.js +1 -1
  239. package/select/Select.js +2 -2
  240. package/select-view/Core.js +1 -1
  241. package/skeleton/index.js +1 -1
  242. package/slider/Button.js +2 -2
  243. package/slider/index.js +2 -2
  244. package/space/index.js +4 -4
  245. package/spin/DotLoading.js +1 -1
  246. package/spin/index.js +1 -1
  247. package/splitter/Panel.js +1 -1
  248. package/splitter/SplitBar.js +2 -2
  249. package/splitter/Splitter.js +2 -2
  250. package/statistic/index.js +1 -1
  251. package/steps/index.js +1 -1
  252. package/style.css +1 -1
  253. package/switch/index.js +2 -2
  254. package/table/Table.js +3 -3
  255. package/table/index.js +4 -4
  256. package/tabs/Tab.js +2 -2
  257. package/tabs/TabContent.js +2 -2
  258. package/tabs/TabPane.js +1 -1
  259. package/tabs/index.js +2 -2
  260. package/tag/index.js +1 -1
  261. package/time-picker/Picker.js +1 -1
  262. package/time-picker/TimePicker.js +1 -1
  263. package/timeline/Item.js +1 -1
  264. package/timeline/Timeline.js +1 -1
  265. package/tooltip/index.js +1 -1
  266. package/tour/index.js +4 -4
  267. package/transfer/Item.js +2 -2
  268. package/transfer/List.js +2 -2
  269. package/transfer/index.js +1 -1
  270. package/tree/Animation.js +3 -3
  271. package/tree/Node.js +3 -3
  272. package/tree/NodeList.js +1 -1
  273. package/tree/Tree.js +2 -2
  274. package/tree/index.js +1 -1
  275. package/tree-select/Select.js +2 -2
  276. package/tree-select/index.js +1 -1
  277. package/trigger/getPopupStyle.js +1 -1
  278. package/trigger/index.js +145 -145
  279. package/types/common/hooks/useWindowSize.d.ts +4 -4
  280. package/types/common/utils/dom.d.ts +1 -1
  281. package/types/common/utils/lodash.d.ts +2 -1
  282. package/types/common/utils/reactDOM.d.ts +10 -1
  283. package/types/common/utils/validate.d.ts +2 -0
  284. package/types/pc/form/interface.d.ts +6 -1
  285. package/types/pc/form/promisify.d.ts +5 -0
  286. package/types/pc/form/store.d.ts +1 -1
  287. package/types/pc/form/util.d.ts +1 -1
  288. package/types/pc/input/autoSizeTextAreaHeight.d.ts +4 -2
  289. package/types/pc/qr-code/examples/demo.d.ts +1 -0
  290. package/types/pc/qr-code/examples/download.d.ts +2 -0
  291. package/types/pc/qr-code/examples/full.d.ts +2 -0
  292. package/types/pc/qr-code/examples/image.d.ts +2 -0
  293. package/types/pc/qr-code/index.d.ts +2 -0
  294. package/types/pc/qr-code/src/index.d.ts +116 -0
  295. package/types/pc/qr-code/src/qrcodegen.d.ts +95 -0
  296. package/types/pc/qr-code/src/qrcodegen2.d.ts +325 -0
  297. package/types/pc/utils/validate.d.ts +1 -1
  298. package/typography/Base.js +1 -1
  299. package/typography/Ellipsis.js +2 -2
  300. package/typography/Paragraph.js +1 -1
  301. package/typography/Typography.js +1 -1
  302. package/upload/TriggerNode.js +1 -1
  303. package/upload/Upload.js +2 -2
  304. package/upload/Uploader.js +1 -1
  305. package/upload/request_.js +1972 -41
  306. package/utils/PqbCSSTransition.js +1 -1
  307. package/utils/contextHolder.js +1 -1
  308. package/utils/dom.js +1 -1
  309. package/utils/index.js +247 -235
  310. package/utils/lodash.js +33 -32
  311. package/utils/react19Adapter.js +1 -1
  312. package/utils/reactDOM.js +1 -1
  313. package/utils/validate.js +15 -5
  314. package/verification-code/VerificationCode.js +1 -1
  315. package/version/index.js +1 -1
  316. package/virtual-list/VirtualList.js +1 -1
  317. package/watermark/Watermark.js +1 -1
  318. package/chunk/CXrVhA6-.js +0 -54
  319. package/chunk/De8RLlOK.js +0 -231
  320. package/chunk/d1c9z8T1.js +0 -49
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * 获取页面视口宽高大小,并在页面有 resize 时更新大小
3
3
  * @desc {en} Get the width and height of the page viewport, and update the size when the page is resized
4
- * @param needListen 是否开启resize事件监听
5
- * @param needListen {en} Whether to enable resize event monitoring
6
- * @returns 页面宽高,{ windowWidth, windowHeight }
4
+ * @param debounceFlag 是否开启防抖处理
5
+ * @param resizeCallback 回调函数
6
+ * @returns 页面宽高,{ width, height }
7
7
  * @example
8
8
  * ```
9
9
  * import { useWindowSize } from './hooks';
10
10
  *
11
- * const { windowHeight, windowWidth } = useWindowSize();
11
+ * const { width, height } = useWindowSize();
12
12
  * ```
13
13
  */
14
14
  declare function useWindowSize(debounceFlag: boolean | undefined, resizeCallback: any): {
@@ -2,7 +2,7 @@ export declare const isServerRendering: boolean;
2
2
  export declare const on: (element: EventTarget | null, event: string, handler: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void;
3
3
  export declare const off: (element: EventTarget | null, event: string, handler: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void;
4
4
  export declare const contains: (root: HTMLElement, ele: any) => boolean;
5
- export declare function isScrollElement(element: any): boolean;
5
+ export declare function isScrollElement(element: HTMLElement): boolean;
6
6
  /**
7
7
  * 从当前节点向上查找所有的滚动元素
8
8
  * @param container 当前节点
@@ -2,6 +2,7 @@ import camelCase from 'lodash/camelCase';
2
2
  import capitalize from 'lodash/capitalize';
3
3
  import cloneDeep from 'lodash/cloneDeep';
4
4
  import debounce from 'lodash/debounce';
5
+ import defaultsDeep from 'lodash/defaultsDeep';
5
6
  import get from 'lodash/get';
6
7
  import has from 'lodash/has';
7
8
  import kebabCase from 'lodash/kebabCase';
@@ -14,4 +15,4 @@ import startCase from 'lodash/startCase';
14
15
  import throttle from 'lodash/throttle';
15
16
  import uniq from 'lodash/uniq';
16
17
  import upperFirst from 'lodash/upperFirst';
17
- export { camelCase, capitalize, cloneDeep, debounce, get, has, kebabCase, merge, mergeWith, set, setWith, snakeCase, startCase, throttle, uniq, upperFirst, };
18
+ export { camelCase, capitalize, cloneDeep, debounce, defaultsDeep, get, has, kebabCase, merge, mergeWith, set, setWith, snakeCase, startCase, throttle, uniq, upperFirst, };
@@ -7,13 +7,22 @@ type RenderResult = {
7
7
  render: (element: ReactElement) => void;
8
8
  _unmount: () => void;
9
9
  };
10
+ type ElementLike = {
11
+ dom?: Element;
12
+ current?: Element;
13
+ props?: {
14
+ ref?: RefObject<Element> | ((instance: Element | null) => void);
15
+ };
16
+ ref?: RefObject<Element> | ((instance: Element | null) => void);
17
+ getRootDOMNode?: () => Element | null;
18
+ };
10
19
  /**
11
20
  *
12
21
  * @param element
13
22
  * @param instance 兜底 findDOMNode 查找,一般都是 this
14
23
  * @returns
15
24
  */
16
- export declare function findDOMNode_(element: unknown, instance?: ReactInstance): Element | null;
25
+ export declare function findDOMNode_(element: ElementLike, instance?: ReactInstance): Element | null;
17
26
  export declare function callbackOriginRef(children: {
18
27
  ref?: RefObject<Element> | ((instance: Element | null) => void);
19
28
  props?: {
@@ -0,0 +1,2 @@
1
+ export { ArrayValidator, BooleanValidator, CustomValidator, defaultValidateLocale, DefaultValidateMessage, enUSValidateLocale, mergeTemplate, NumberValidator, ObjectValidator, Schema, StringValidator, TypeValidator, default as validate, zhCNValidateLocale, } from '@unicom-cloud/validate';
2
+ export type { CustomValidatorType, GlobalConfig, InnerValidateOptions, RuleType, SchemaRuleType, SchemaType, ValidateMessagesTemplateType, ValidateMessagesType, ValidateOptions, ValidatorError, } from '@unicom-cloud/validate';
@@ -1,9 +1,9 @@
1
1
  import { Options as ScrollIntoViewOptions } from '@unicom-cloud/scroll-into-view-if-needed';
2
- import { ValidateMessagesTemplateType } from '@unicom-cloud/validate/types';
3
2
  import React, { CSSProperties, FormHTMLAttributes, HTMLAttributes, ReactElement, ReactNode } from 'react';
4
3
  import { JSX } from 'react/jsx-runtime';
5
4
  import type { ColProps } from '../row-col/interface';
6
5
  import { TooltipProps } from '../tooltip/interface';
6
+ import type { ValidateOptions as SchemaOptions, ValidateMessagesTemplateType } from '../utils/validate';
7
7
  import Store from './store';
8
8
  export type IndexedObject = {
9
9
  [key: string]: any;
@@ -139,6 +139,10 @@ export interface FormProps<FormData = any, FieldValue = FormData[keyof FormData]
139
139
  label: any;
140
140
  }) => any)>>;
141
141
  }>;
142
+ /**
143
+ * @zh 校验信息配置
144
+ */
145
+ schemaOptions?: SchemaOptions;
142
146
  /**
143
147
  * @zh 数据验证成功后回调事件
144
148
  * @en Callback when submit data
@@ -444,6 +448,7 @@ export type FormContextProps<FormData = any, FieldValue = FormData[keyof FormDat
444
448
  };
445
449
  export type FormItemContextProps<FormData = any, FieldValue = FormData[keyof FormData], FieldKey extends KeyType = keyof FormData> = FormContextProps<FormData, FieldValue, FieldKey> & {
446
450
  validateMessages?: FormProps['validateMessages'];
451
+ schemaOptions?: SchemaOptions;
447
452
  updateFormItem?: (field: string, params: {
448
453
  errors?: FieldError<FieldValue>;
449
454
  warnings?: ReactNode[];
@@ -1,2 +1,7 @@
1
+ /**
2
+ * 将回调风格的函数转换为 Promise 风格
3
+ * @param fn 需要转换的回调风格函数
4
+ * @returns 返回 Promise 风格的函数
5
+ */
1
6
  declare function promisify<T = any>(fn: (...args: any[]) => any): () => Promise<T>;
2
7
  export default promisify;
@@ -89,8 +89,8 @@ declare class Store<FormData = unknown, FieldValue = FormData[keyof FormData], F
89
89
  setInitialValue: (field: FieldKey, value: FieldValue) => void;
90
90
  resetFields: (fieldKeys?: FieldKey | FieldKey[]) => void;
91
91
  validate: FormValidateFn<FormData, FieldValue, FieldKey>;
92
- private toggleSubmitStatus;
93
92
  submit: () => void;
93
+ private toggleSubmitStatus;
94
94
  getFieldsState: (fields?: FieldKey[]) => { [key in FieldKey]?: FieldState<FieldValue>; };
95
95
  clearFields: (fieldKeys?: FieldKey | FieldKey[]) => void;
96
96
  }
@@ -9,6 +9,6 @@ export declare const formatValidateMsg: (validateMessages: FormProps["validateMe
9
9
  export declare function set<T extends IndexedObject>(target: T, field: PropertyPath, value: any): T;
10
10
  export declare function iterativelyGetKeys(_obj: any, _prefix?: string): any;
11
11
  export declare function isSyntheticEvent(e: any): boolean;
12
- export declare function schemaValidate(field: any, value: any, _rules: RulesProps[], validateMessages: any): Promise<unknown>;
12
+ export declare function schemaValidate(field: any, value: any, _rules: RulesProps[], validateMessages: any, schemaOptions: any): Promise<unknown>;
13
13
  export declare function isFieldMatch(field: any, fields: any): any;
14
14
  export declare const ID_INPUT_SUFFIX = "_input";
@@ -1,5 +1,7 @@
1
- declare function autoSizeTextAreaHeight(autoSize?: boolean | {
1
+ import type { CSSProperties } from 'react';
2
+ type AutoSizeType = {
2
3
  minRows?: number;
3
4
  maxRows?: number;
4
- }, node?: HTMLTextAreaElement): any;
5
+ };
6
+ declare function autoSizeTextAreaHeight(autoSize?: boolean | AutoSizeType, node?: HTMLTextAreaElement): CSSProperties | undefined;
5
7
  export default autoSizeTextAreaHeight;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ declare function DownloadDemo(): import("react/jsx-runtime").JSX.Element;
2
+ export { DownloadDemo };
@@ -0,0 +1,2 @@
1
+ declare function FullDemo(): import("react/jsx-runtime").JSX.Element;
2
+ export { FullDemo };
@@ -0,0 +1,2 @@
1
+ declare function ImageDemo(): import("react/jsx-runtime").JSX.Element;
2
+ export { ImageDemo };
@@ -1,4 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { QRCodeProps } from './interface';
3
+ import qrcodegen from './src/qrcodegen';
3
4
  declare const QRCode: React.FC<QRCodeProps>;
5
+ export { qrcodegen };
4
6
  export default QRCode;
@@ -0,0 +1,116 @@
1
+ /**
2
+ * @license qrcode.react
3
+ * Copyright (c) Paul O'Shannessy
4
+ * SPDX-License-Identifier: ISC
5
+ */
6
+ import React from 'react';
7
+ import qrcodegen from './qrcodegen';
8
+ type ErrorCorrectionLevel = 'L' | 'M' | 'Q' | 'H';
9
+ type CrossOrigin = 'anonymous' | 'use-credentials' | '' | undefined;
10
+ type ImageSettings = {
11
+ /**
12
+ * The URI of the embedded image.
13
+ */
14
+ src: string;
15
+ /**
16
+ * The height, in pixels, of the image.
17
+ */
18
+ height: number;
19
+ /**
20
+ * The width, in pixels, of the image.
21
+ */
22
+ width: number;
23
+ /**
24
+ * Whether or not to "excavate" the modules around the embedded image. This
25
+ * means that any modules the embedded image overlaps will use the background
26
+ * color.
27
+ */
28
+ excavate: boolean;
29
+ /**
30
+ * The horiztonal offset of the embedded image, starting from the top left corner.
31
+ * Will center if not specified.
32
+ */
33
+ x?: number;
34
+ /**
35
+ * The vertical offset of the embedded image, starting from the top left corner.
36
+ * Will center if not specified.
37
+ */
38
+ y?: number;
39
+ /**
40
+ * The opacity of the embedded image in the range of 0-1.
41
+ * @defaultValue 1
42
+ */
43
+ opacity?: number;
44
+ /**
45
+ * The cross-origin value to use when loading the image. This is used to
46
+ * ensure compatibility with CORS, particularly when extracting image data
47
+ * from QRCodeCanvas.
48
+ * Note: `undefined` is treated differently than the seemingly equivalent
49
+ * empty string. This is intended to align with HTML behavior where omitting
50
+ * the attribute behaves differently than the empty string.
51
+ */
52
+ crossOrigin?: CrossOrigin;
53
+ };
54
+ type QRProps = {
55
+ /**
56
+ * The value to encode into the QR Code. An array of strings can be passed in
57
+ * to represent multiple segments to further optimize the QR Code.
58
+ */
59
+ value: string | string[];
60
+ /**
61
+ * The size, in pixels, to render the QR Code.
62
+ * @defaultValue 128
63
+ */
64
+ size?: number;
65
+ /**
66
+ * The Error Correction Level to use.
67
+ * @see https://www.qrcode.com/en/about/error_correction.html
68
+ * @defaultValue L
69
+ */
70
+ level?: ErrorCorrectionLevel;
71
+ /**
72
+ * The background color used to render the QR Code.
73
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
74
+ * @defaultValue #FFFFFF
75
+ */
76
+ bgColor?: string;
77
+ /**
78
+ * The foreground color used to render the QR Code.
79
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
80
+ * @defaultValue #000000
81
+ */
82
+ fgColor?: string;
83
+ /**
84
+ * The number of _modules_ to use for margin. The QR Code specification
85
+ * requires `4`, however you can specify any number. Values will be turned to
86
+ * integers with `Math.floor`.
87
+ * @defaultValue 0
88
+ */
89
+ marginSize?: number;
90
+ /**
91
+ * The title to assign to the QR Code. Used for accessibility reasons.
92
+ */
93
+ title?: string;
94
+ /**
95
+ * The minimum version used when encoding the QR Code. Valid values are 1-40
96
+ * with higher values resulting in more complex QR Codes. The optimal
97
+ * (lowest) version is determined for the `value` provided, using `minVersion`
98
+ * as the lower bound.
99
+ * @defaultValue 1
100
+ */
101
+ minVersion?: number;
102
+ /**
103
+ * If enabled, the Error Correction Level of the result may be higher than
104
+ * the specified Error Correction Level option if it can be done without
105
+ * increasing the version.
106
+ * @defaultValue true
107
+ */
108
+ boostLevel?: boolean;
109
+ /**
110
+ * The settings for the embedded image.
111
+ */
112
+ imageSettings?: ImageSettings;
113
+ };
114
+ declare const QRCodeCanvas: React.ForwardRefExoticComponent<QRProps & React.CanvasHTMLAttributes<HTMLCanvasElement> & React.RefAttributes<HTMLCanvasElement>>;
115
+ declare const QRCodeSVG: React.ForwardRefExoticComponent<QRProps & React.SVGAttributes<SVGSVGElement> & React.RefAttributes<SVGSVGElement>>;
116
+ export { QRCodeCanvas, qrcodegen, QRCodeSVG };
@@ -0,0 +1,95 @@
1
+ declare namespace qrcodegen {
2
+ type bit = number;
3
+ type byte = number;
4
+ type int = number;
5
+ export class QrCode {
6
+ readonly version: int;
7
+ readonly errorCorrectionLevel: QrCode.Ecc;
8
+ static encodeText(text: string, ecl: QrCode.Ecc): QrCode;
9
+ static encodeBinary(data: Readonly<Array<byte>>, ecl: QrCode.Ecc): QrCode;
10
+ static encodeSegments(segs: Readonly<Array<QrSegment>>, ecl: QrCode.Ecc, minVersion?: int, maxVersion?: int, mask?: int, boostEcl?: boolean): QrCode;
11
+ readonly size: int;
12
+ readonly mask: int;
13
+ private readonly modules;
14
+ private readonly isFunction;
15
+ constructor(version: int, errorCorrectionLevel: QrCode.Ecc, dataCodewords: Readonly<Array<byte>>, msk: int);
16
+ getModule(x: int, y: int): boolean;
17
+ getModules(): boolean[][];
18
+ private drawFunctionPatterns;
19
+ private drawFormatBits;
20
+ private drawVersion;
21
+ private drawFinderPattern;
22
+ private drawAlignmentPattern;
23
+ private setFunctionModule;
24
+ private addEccAndInterleave;
25
+ private drawCodewords;
26
+ private applyMask;
27
+ private getPenaltyScore;
28
+ private getAlignmentPatternPositions;
29
+ private static getNumRawDataModules;
30
+ private static getNumDataCodewords;
31
+ private static reedSolomonComputeDivisor;
32
+ private static reedSolomonComputeRemainder;
33
+ private static reedSolomonMultiply;
34
+ private finderPenaltyCountPatterns;
35
+ private finderPenaltyTerminateAndCount;
36
+ private finderPenaltyAddHistory;
37
+ static readonly MIN_VERSION: int;
38
+ static readonly MAX_VERSION: int;
39
+ private static readonly PENALTY_N1;
40
+ private static readonly PENALTY_N2;
41
+ private static readonly PENALTY_N3;
42
+ private static readonly PENALTY_N4;
43
+ private static readonly ECC_CODEWORDS_PER_BLOCK;
44
+ private static readonly NUM_ERROR_CORRECTION_BLOCKS;
45
+ }
46
+ export class QrSegment {
47
+ readonly mode: QrSegment.Mode;
48
+ readonly numChars: int;
49
+ private readonly bitData;
50
+ static makeBytes(data: Readonly<Array<byte>>): QrSegment;
51
+ static makeNumeric(digits: string): QrSegment;
52
+ static makeAlphanumeric(text: string): QrSegment;
53
+ static makeSegments(text: string): Array<QrSegment>;
54
+ static makeEci(assignVal: int): QrSegment;
55
+ static isNumeric(text: string): boolean;
56
+ static isAlphanumeric(text: string): boolean;
57
+ constructor(mode: QrSegment.Mode, numChars: int, bitData: Array<bit>);
58
+ getData(): Array<bit>;
59
+ static getTotalBits(segs: Readonly<Array<QrSegment>>, version: int): number;
60
+ private static toUtf8ByteArray;
61
+ private static readonly NUMERIC_REGEX;
62
+ private static readonly ALPHANUMERIC_REGEX;
63
+ private static readonly ALPHANUMERIC_CHARSET;
64
+ }
65
+ export {};
66
+ }
67
+ declare namespace qrcodegen.QrCode {
68
+ type int = number;
69
+ export class Ecc {
70
+ readonly ordinal: int;
71
+ readonly formatBits: int;
72
+ static readonly LOW: Ecc;
73
+ static readonly MEDIUM: Ecc;
74
+ static readonly QUARTILE: Ecc;
75
+ static readonly HIGH: Ecc;
76
+ private constructor();
77
+ }
78
+ export {};
79
+ }
80
+ declare namespace qrcodegen.QrSegment {
81
+ type int = number;
82
+ export class Mode {
83
+ readonly modeBits: int;
84
+ private readonly numBitsCharCount;
85
+ static readonly NUMERIC: Mode;
86
+ static readonly ALPHANUMERIC: Mode;
87
+ static readonly BYTE: Mode;
88
+ static readonly KANJI: Mode;
89
+ static readonly ECI: Mode;
90
+ private constructor();
91
+ numCharCountBits(ver: int): int;
92
+ }
93
+ export {};
94
+ }
95
+ export default qrcodegen;