@nobak/design-system 1.0.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.
- package/LICENSE +73 -0
- package/README.md +142 -0
- package/lib/assets/icons.js +67 -0
- package/lib/components/AccountOverview/AccountOverview.js +122 -0
- package/lib/components/AdminPanel.js +58 -0
- package/lib/components/AssetExchange/AssetExchange.js +189 -0
- package/lib/components/AuthenticationFlow.js +216 -0
- package/lib/components/ConversationInterface/ConversationInterface.js +232 -0
- package/lib/components/DevFooter.js +38 -0
- package/lib/components/DevMenu.js +35 -0
- package/lib/components/DevSidebar.js +28 -0
- package/lib/components/DigitalDisplay.js +83 -0
- package/lib/components/Footer.js +45 -0
- package/lib/components/HeroContainer.js +10 -0
- package/lib/components/IntentRecognition/IntentRecognition.js +174 -0
- package/lib/components/Logo.js +259 -0
- package/lib/components/MenuBar.js +56 -0
- package/lib/components/NetworkSettings.js +223 -0
- package/lib/components/RecoverySetup/RecoverySetup.js +354 -0
- package/lib/components/RisingSun.js +122 -0
- package/lib/components/Symbol.js +226 -0
- package/lib/components/TransactionComposer/TransactionComposer.js +258 -0
- package/lib/components/TransactionConfirmation.js +184 -0
- package/lib/components/WalletMenu.js +33 -0
- package/lib/components/console/code/CodeBlock.js +150 -0
- package/lib/components/console/code/index.js +9 -0
- package/lib/components/console/data/DataTable.js +245 -0
- package/lib/components/console/data/MetricCard.js +79 -0
- package/lib/components/console/data/index.js +11 -0
- package/lib/components/console/documentation/index.js +10 -0
- package/lib/components/console/forms/APIKeyGenerator.js +261 -0
- package/lib/components/console/forms/SearchBar.js +210 -0
- package/lib/components/console/forms/index.js +10 -0
- package/lib/components/console/index.js +29 -0
- package/lib/components/console/layout/ConsoleCard.js +82 -0
- package/lib/components/console/layout/ConsoleLayout.js +86 -0
- package/lib/components/console/layout/index.js +10 -0
- package/lib/components/console/monitoring/StatusIndicator.js +128 -0
- package/lib/components/console/monitoring/index.js +9 -0
- package/lib/components/console/navigation/DevFooter.js +38 -0
- package/lib/components/console/navigation/DevMenu.js +35 -0
- package/lib/components/console/navigation/DevSidebar.js +28 -0
- package/lib/components/console/navigation/index.js +11 -0
- package/lib/components/console/settings/index.js +10 -0
- package/lib/components/index.js +12 -0
- package/lib/design/ColorPicker.stories.js +9 -0
- package/lib/design/HSLTool-V1.js +345 -0
- package/lib/design/HSLTool-V2.js +475 -0
- package/lib/design/HSLTool-V3.js +543 -0
- package/lib/design/HSLTool-V4.js +1139 -0
- package/lib/design/HSLTool.js +374 -0
- package/lib/design/OKLCHColorPicker.stories.js +24 -0
- package/lib/design/OKLCHTool.js +1014 -0
- package/lib/index.js +4 -0
- package/lib/shared/components/Avatar/Avatar.js +18 -0
- package/lib/shared/components/Avatar/index.js +1 -0
- package/lib/shared/components/Badge/Badge.js +34 -0
- package/lib/shared/components/Badge/index.js +1 -0
- package/lib/shared/components/Breadcrumb/Breadcrumb.js +13 -0
- package/lib/shared/components/Breadcrumb/index.js +1 -0
- package/lib/shared/components/Button/Button.js +184 -0
- package/lib/shared/components/Button/index.js +1 -0
- package/lib/shared/components/Calendar/Calendar.js +155 -0
- package/lib/shared/components/Calendar/CalendarDay.js +251 -0
- package/lib/shared/components/Calendar/CalendarHeader.js +88 -0
- package/lib/shared/components/Calendar/CalendarMonth.js +106 -0
- package/lib/shared/components/Calendar/CalendarWeek.js +267 -0
- package/lib/shared/components/Calendar/constants.js +73 -0
- package/lib/shared/components/Calendar/index.js +3 -0
- package/lib/shared/components/Calendar/types.d.js +0 -0
- package/lib/shared/components/Cartel/Cartel.js +44 -0
- package/lib/shared/components/Cartel/index.js +1 -0
- package/lib/shared/components/Cell/Cell.js +105 -0
- package/lib/shared/components/Cell/index.js +1 -0
- package/lib/shared/components/Checkbox/Checkbox.js +27 -0
- package/lib/shared/components/Checkbox/index.js +1 -0
- package/lib/shared/components/Clock/Clock.js +6 -0
- package/lib/shared/components/Clock/index.js +1 -0
- package/lib/shared/components/ColorChecker/ColorChecker.js +89 -0
- package/lib/shared/components/ColorChecker/index.js +2 -0
- package/lib/shared/components/ColorChecker/utils.js +159 -0
- package/lib/shared/components/Command/Command.js +95 -0
- package/lib/shared/components/Command/index.js +1 -0
- package/lib/shared/components/Container/Container.js +18 -0
- package/lib/shared/components/Container/index.js +1 -0
- package/lib/shared/components/Cover/Cover.js +17 -0
- package/lib/shared/components/Cover/index.js +1 -0
- package/lib/shared/components/DatePicker/DatePicker.js +52 -0
- package/lib/shared/components/DatePicker/components/Calendar.js +125 -0
- package/lib/shared/components/DatePicker/components/CalendarDay.js +23 -0
- package/lib/shared/components/DatePicker/components/DateWrapper.js +15 -0
- package/lib/shared/components/DatePicker/components/index.js +2 -0
- package/lib/shared/components/DatePicker/index.js +1 -0
- package/lib/shared/components/DateTime/DateTime.js +51 -0
- package/lib/shared/components/DateTime/index.js +1 -0
- package/lib/shared/components/Debug/Debug.js +12 -0
- package/lib/shared/components/Debug/index.js +1 -0
- package/lib/shared/components/Disclosure/Disclosure.js +31 -0
- package/lib/shared/components/Disclosure/index.js +1 -0
- package/lib/shared/components/Dropdown/Dropdown.js +91 -0
- package/lib/shared/components/Dropdown/index.js +1 -0
- package/lib/shared/components/EmptyState/EmptyState.js +40 -0
- package/lib/shared/components/EmptyState/index.js +1 -0
- package/lib/shared/components/Form/Form.js +41 -0
- package/lib/shared/components/Form/components/DynamicForm.js +66 -0
- package/lib/shared/components/Form/components/StepperForm.js +266 -0
- package/lib/shared/components/Form/components/index.js +2 -0
- package/lib/shared/components/Form/context/Form.js +164 -0
- package/lib/shared/components/Form/context/index.js +1 -0
- package/lib/shared/components/Form/index.js +1 -0
- package/lib/shared/components/Form/types.d.js +1 -0
- package/lib/shared/components/Form/utils/index.js +31 -0
- package/lib/shared/components/GroupItems/GroupItems.js +17 -0
- package/lib/shared/components/GroupItems/index.js +1 -0
- package/lib/shared/components/Header/Header.js +26 -0
- package/lib/shared/components/Header/index.js +1 -0
- package/lib/shared/components/Heading/Heading.js +5 -0
- package/lib/shared/components/Heading/index.js +1 -0
- package/lib/shared/components/Icon/Icon.js +28 -0
- package/lib/shared/components/Icon/index.js +1 -0
- package/lib/shared/components/Identicons/Identicons.js +6 -0
- package/lib/shared/components/Identicons/index.d.js +0 -0
- package/lib/shared/components/Identicons/index.js +1 -0
- package/lib/shared/components/Image/Image.js +22 -0
- package/lib/shared/components/Image/index.js +1 -0
- package/lib/shared/components/Input/Input.js +201 -0
- package/lib/shared/components/Input/components/CheckBoxInput.js +81 -0
- package/lib/shared/components/Input/components/DateInput.js +89 -0
- package/lib/shared/components/Input/components/DefaultInput.js +102 -0
- package/lib/shared/components/Input/components/FileReaderInput.js +88 -0
- package/lib/shared/components/Input/components/NumberInput.js +141 -0
- package/lib/shared/components/Input/components/PickerInput.js +122 -0
- package/lib/shared/components/Input/components/RCInput.js +112 -0
- package/lib/shared/components/Input/components/Radiobox/RadioboxBasic.js +56 -0
- package/lib/shared/components/Input/components/Radiobox/RadioboxCard.js +27 -0
- package/lib/shared/components/Input/components/Radiobox/RadioboxFull.js +44 -0
- package/lib/shared/components/Input/components/Radiobox/index.js +3 -0
- package/lib/shared/components/Input/components/RadioboxInput.js +102 -0
- package/lib/shared/components/Input/components/SelectInput.js +70 -0
- package/lib/shared/components/Input/components/TextAreaInput.js +67 -0
- package/lib/shared/components/Input/components/TextInput.js +139 -0
- package/lib/shared/components/Input/components/TimeInput.js +37 -0
- package/lib/shared/components/Input/components/UploadFileInput.js +123 -0
- package/lib/shared/components/Input/components/index.js +13 -0
- package/lib/shared/components/Input/components/types.d.js +0 -0
- package/lib/shared/components/Input/index.js +1 -0
- package/lib/shared/components/Input/types.d.js +0 -0
- package/lib/shared/components/Layout/Layout.js +13 -0
- package/lib/shared/components/Layout/index.js +1 -0
- package/lib/shared/components/List/List.js +30 -0
- package/lib/shared/components/List/index.js +1 -0
- package/lib/shared/components/Loader/Loader.js +27 -0
- package/lib/shared/components/Loader/index.js +1 -0
- package/lib/shared/components/Modal/Modal.js +102 -0
- package/lib/shared/components/Modal/index.js +1 -0
- package/lib/shared/components/Notification/Notification.js +39 -0
- package/lib/shared/components/Notification/index.js +1 -0
- package/lib/shared/components/Person/Person.js +81 -0
- package/lib/shared/components/Person/index.js +1 -0
- package/lib/shared/components/Popover/Popover.js +39 -0
- package/lib/shared/components/Popover/index.js +1 -0
- package/lib/shared/components/QRCode/QRCode.js +329 -0
- package/lib/shared/components/QRCode/index.js +1 -0
- package/lib/shared/components/RadioGroup/RadioGroup.js +35 -0
- package/lib/shared/components/RadioGroup/components/DefaultGroup.js +71 -0
- package/lib/shared/components/RadioGroup/components/VerticalGroup.js +83 -0
- package/lib/shared/components/RadioGroup/components/index.js +2 -0
- package/lib/shared/components/RadioGroup/index.js +1 -0
- package/lib/shared/components/Search/Search.js +12 -0
- package/lib/shared/components/Search/index.js +1 -0
- package/lib/shared/components/Select/Select.js +90 -0
- package/lib/shared/components/Select/index.js +1 -0
- package/lib/shared/components/Sidebar/Sidebar.js +42 -0
- package/lib/shared/components/Sidebar/index.js +1 -0
- package/lib/shared/components/SlideOver/SlideOver.js +81 -0
- package/lib/shared/components/SlideOver/index.js +1 -0
- package/lib/shared/components/Slider/Slider.js +80 -0
- package/lib/shared/components/Slider/index.js +1 -0
- package/lib/shared/components/Stepper/Stepper.js +32 -0
- package/lib/shared/components/Stepper/index.js +1 -0
- package/lib/shared/components/Steps/Steps.js +53 -0
- package/lib/shared/components/Steps/index.js +1 -0
- package/lib/shared/components/Switch/Switch.js +26 -0
- package/lib/shared/components/Switch/index.js +1 -0
- package/lib/shared/components/Tab/Tab.js +59 -0
- package/lib/shared/components/Tab/index.js +1 -0
- package/lib/shared/components/Table/Table.js +47 -0
- package/lib/shared/components/Table/index.js +1 -0
- package/lib/shared/components/Text/Text.js +11 -0
- package/lib/shared/components/Text/index.js +1 -0
- package/lib/shared/components/TextList/TextList.js +15 -0
- package/lib/shared/components/TextList/index.js +1 -0
- package/lib/shared/components/TimePicker/TimePicker.js +161 -0
- package/lib/shared/components/TimePicker/index.js +1 -0
- package/lib/shared/components/Tooltip/Tooltip.js +13 -0
- package/lib/shared/components/Tooltip/index.js +1 -0
- package/lib/shared/components/Uploader/Uploader.js +63 -0
- package/lib/shared/components/Uploader/index.js +1 -0
- package/lib/shared/components/Video/Video.js +20 -0
- package/lib/shared/components/Video/index.js +1 -0
- package/lib/shared/components/index.d.js +0 -0
- package/lib/shared/components/index.js +50 -0
- package/lib/shared/elements/Color/ColorPallet.js +20 -0
- package/lib/shared/elements/Color/index.js +1 -0
- package/lib/shared/elements/Text.js +37 -0
- package/lib/shared/elements/index.js +1 -0
- package/lib/shared/helpers/FakeLink.js +8 -0
- package/lib/shared/helpers/constants.js +359 -0
- package/lib/shared/helpers/index.js +2 -0
- package/lib/shared/helpers/isEqual.js +56 -0
- package/lib/shared/index.d.js +0 -0
- package/lib/shared/index.js +1 -0
- package/lib/shared/stories/components/Avatar.stories.js +17 -0
- package/lib/shared/stories/components/Badge.stories.dev.js +37 -0
- package/lib/shared/stories/components/Button.stories.js +553 -0
- package/lib/shared/stories/components/Calendar.stories.js +62 -0
- package/lib/shared/stories/components/Cartel.stories.js +32 -0
- package/lib/shared/stories/components/Checkbox.stories.js +15 -0
- package/lib/shared/stories/components/ColorChecker.stories.dev.js +16 -0
- package/lib/shared/stories/components/DateTime.stories.js +27 -0
- package/lib/shared/stories/components/Disclosure.stories.js +30 -0
- package/lib/shared/stories/components/Dropdown.stories.js +39 -0
- package/lib/shared/stories/components/Form/Default.stories.js +201 -0
- package/lib/shared/stories/components/Form/DummyForm.stories.js +48 -0
- package/lib/shared/stories/components/Form/DynamicForm.stories.js +155 -0
- package/lib/shared/stories/components/Form/StepperForm.stories.js +138 -0
- package/lib/shared/stories/components/Form/ValidateForm.stories.js +70 -0
- package/lib/shared/stories/components/Form/Validation.stories.js +184 -0
- package/lib/shared/stories/components/GroupItems.stories.js +23 -0
- package/lib/shared/stories/components/Header.stories.js +29 -0
- package/lib/shared/stories/components/Heading.stories.js +27 -0
- package/lib/shared/stories/components/Icon.stories.js +22 -0
- package/lib/shared/stories/components/Image.stories.js +23 -0
- package/lib/shared/stories/components/Input/Checkbox.stories.js +45 -0
- package/lib/shared/stories/components/Input/DatePicker.stories.js +23 -0
- package/lib/shared/stories/components/Input/Defaut.stories.js +24 -0
- package/lib/shared/stories/components/Input/Number.stories.js +24 -0
- package/lib/shared/stories/components/Input/RCI.stories.js +59 -0
- package/lib/shared/stories/components/Input/Radiobox.stories.dev.js +28 -0
- package/lib/shared/stories/components/Input/Select.stories.dev.js +27 -0
- package/lib/shared/stories/components/Input/SelectMultiple.stories.dev.js +510 -0
- package/lib/shared/stories/components/Input/Textarea.stories.js +24 -0
- package/lib/shared/stories/components/List.stories.js +34 -0
- package/lib/shared/stories/components/Loader.stories.js +15 -0
- package/lib/shared/stories/components/Modal.stories.js +50 -0
- package/lib/shared/stories/components/Notification.stories.js +22 -0
- package/lib/shared/stories/components/Person.stories.js +41 -0
- package/lib/shared/stories/components/Picker.stories.js +15 -0
- package/lib/shared/stories/components/Popover.stories.js +36 -0
- package/lib/shared/stories/components/QRCode.stories.js +20 -0
- package/lib/shared/stories/components/RadioGroup.stories.js +56 -0
- package/lib/shared/stories/components/Select.stories.js +50 -0
- package/lib/shared/stories/components/Sidebar.stories.js +35 -0
- package/lib/shared/stories/components/Slider.stories.dev.js +48 -0
- package/lib/shared/stories/components/Stepper/Stepper.stories.js +38 -0
- package/lib/shared/stories/components/Steps.stories.js +15 -0
- package/lib/shared/stories/components/Switch.stories.js +15 -0
- package/lib/shared/stories/components/Tab.stories.js +15 -0
- package/lib/shared/stories/components/Table.stories.js +95 -0
- package/lib/shared/stories/components/TextList.stories.js +23 -0
- package/lib/shared/stories/components/Tooltip.stories.dev.js +40 -0
- package/lib/shared/stories/elements/Color.stories.js +269 -0
- package/lib/shared/stories/elements/Text.stories.js +45 -0
- package/lib/shared/types/index.js +1 -0
- package/lib/stories/Foundation/BrandIdentity.prod.stories.js +510 -0
- package/lib/stories/Foundation/Logo.stories.js +19 -0
- package/lib/stories/Foundation/RisingSun.stories.js +16 -0
- package/lib/stories/Foundation/Shadows.stories.js +601 -0
- package/lib/stories/Foundation/Symbol.stories.js +18 -0
- package/lib/stories/HeroContainer.stories.js +18 -0
- package/lib/styles/accessibilityTokens.js +72 -0
- package/lib/styles/borderWidth.js +10 -0
- package/lib/styles/colors.js +303 -0
- package/lib/styles/elevation.js +240 -0
- package/lib/styles/icons.js +218 -0
- package/lib/styles/index.js +29 -0
- package/lib/styles/motion.js +668 -0
- package/lib/styles/opacity.js +10 -0
- package/lib/styles/radius.js +11 -0
- package/lib/styles/sizing.js +35 -0
- package/lib/styles/space.js +24 -0
- package/lib/styles/theme/darkTheme.js +471 -0
- package/lib/styles/theme/index.js +44 -0
- package/lib/styles/theme/lightTheme.js +480 -0
- package/lib/styles/theme/themeTypes.js +1 -0
- package/lib/styles/theme/themeUtils.js +63 -0
- package/lib/styles/typography-advanced.js +510 -0
- package/lib/styles/typography.js +1419 -0
- package/lib/styles/zIndex.js +19 -0
- package/lib/tokens/borders.js +161 -0
- package/lib/tokens/colors.js +426 -0
- package/lib/tokens/components.js +499 -0
- package/lib/tokens/index.js +84 -0
- package/lib/tokens/lighting.js +384 -0
- package/lib/tokens/motion.js +284 -0
- package/lib/tokens/semantic.js +367 -0
- package/lib/tokens/shadows.js +114 -0
- package/lib/tokens/spacing.js +189 -0
- package/lib/tokens/typography.js +268 -0
- package/package.json +176 -0
- package/styles/generated-tokens.css +677 -0
- package/styles/index.css +2 -0
- package/styles/main.css +610 -0
- package/tailwind.config.js +64 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
import React from 'react';
|
|
3
|
+
// import clsx from 'clsx';
|
|
4
|
+
import { Avatar } from "../Avatar";
|
|
5
|
+
export var Person = function Person(_ref) {
|
|
6
|
+
var Component = _ref.component,
|
|
7
|
+
imageUrl = _ref.imageUrl,
|
|
8
|
+
fullname = _ref.fullname,
|
|
9
|
+
details = _ref.details,
|
|
10
|
+
_ref$variant = _ref.variant,
|
|
11
|
+
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
12
|
+
to = _ref.to,
|
|
13
|
+
customCss = _ref.customCss;
|
|
14
|
+
var variantAssert = function variantAssert() {
|
|
15
|
+
switch (variant) {
|
|
16
|
+
case 'landscape':
|
|
17
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
className: "flex flex-col space-y-[8px] m-[8px] w-fit"
|
|
19
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
className: "mx-auto"
|
|
21
|
+
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
22
|
+
imageUrl: imageUrl,
|
|
23
|
+
size: "tiny"
|
|
24
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
25
|
+
className: "text-p3-bold text-neutral-800"
|
|
26
|
+
}, fullname)));
|
|
27
|
+
case 'lab':
|
|
28
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: "flex space-x-[16px] m-[8px] w-fit"
|
|
30
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Avatar, {
|
|
31
|
+
imageUrl: imageUrl,
|
|
32
|
+
size: "medium"
|
|
33
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: "flex flex-col-reverse"
|
|
35
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
className: "text-p2-bold text-neutral-800"
|
|
37
|
+
}, fullname), /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: "text-caption-bold text-primary-500"
|
|
39
|
+
}, details))));
|
|
40
|
+
case 'profile':
|
|
41
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: "flex space-x-[16px] m-[8px] h-fit w-fit"
|
|
43
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Avatar, {
|
|
44
|
+
imageUrl: imageUrl,
|
|
45
|
+
size: "medium"
|
|
46
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
className: "grid content-center"
|
|
48
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: "text-p2-bold text-neutral-800"
|
|
50
|
+
}, fullname), /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: "text-caption-bold text-primary-500"
|
|
52
|
+
}, details)));
|
|
53
|
+
case 'card':
|
|
54
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: "flex space-x-[8px] w-fit"
|
|
56
|
+
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
57
|
+
imageUrl: imageUrl,
|
|
58
|
+
size: "xtiny"
|
|
59
|
+
}), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
className: "mt-[2px] text-p3-bold text-neutral-800 align-middle"
|
|
61
|
+
}, fullname)));
|
|
62
|
+
default:
|
|
63
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: "flex space-x-4 w-fit"
|
|
65
|
+
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
66
|
+
imageUrl: imageUrl,
|
|
67
|
+
size: "tiny"
|
|
68
|
+
}), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
className: "mt-[5px] text-p3-bold text-neutral-800 align-middle"
|
|
70
|
+
}, fullname)));
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
switch (_typeof(to)) {
|
|
74
|
+
case 'string':
|
|
75
|
+
if (!!Component) return /*#__PURE__*/React.createElement(Component, {
|
|
76
|
+
to: "/".concat(to)
|
|
77
|
+
}, variantAssert());
|
|
78
|
+
default:
|
|
79
|
+
return variantAssert();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Person } from "./Person";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import { Popover as PopoverComponent, PopoverPanel, Transition } from '@headlessui/react';
|
|
3
|
+
import React, { Fragment } from 'react';
|
|
4
|
+
import { Button } from '..';
|
|
5
|
+
export var Popover = function Popover(_ref) {
|
|
6
|
+
var children = _ref.children,
|
|
7
|
+
button = _ref.button;
|
|
8
|
+
var icon = button.icon,
|
|
9
|
+
size = button.size,
|
|
10
|
+
name = button.name;
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
className: ""
|
|
13
|
+
}, /*#__PURE__*/React.createElement(PopoverComponent, {
|
|
14
|
+
className: "relative"
|
|
15
|
+
}, function (_ref2) {
|
|
16
|
+
var open = _ref2.open;
|
|
17
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, _extends({
|
|
18
|
+
type: "popover"
|
|
19
|
+
}, button, {
|
|
20
|
+
size: size,
|
|
21
|
+
text: name,
|
|
22
|
+
icon: icon
|
|
23
|
+
}))), /*#__PURE__*/React.createElement(Transition, {
|
|
24
|
+
as: Fragment,
|
|
25
|
+
enter: "transition ease-out duration-200",
|
|
26
|
+
enterFrom: "opacity-0 translate-y-1",
|
|
27
|
+
enterTo: "opacity-100 translate-y-0",
|
|
28
|
+
leave: "transition ease-in duration-150",
|
|
29
|
+
leaveFrom: "opacity-100 translate-y-0",
|
|
30
|
+
leaveTo: "opacity-0 translate-y-1"
|
|
31
|
+
}, /*#__PURE__*/React.createElement(PopoverPanel, {
|
|
32
|
+
className: "absolute right-0 w-[300px] mt-2 origin-top-right border border-neutral-200 rounded-[10px] z-50"
|
|
33
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: "overflow-hidden rounded-[10px] shadow-lg"
|
|
35
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
className: "relative bg-neutral-100"
|
|
37
|
+
}, children)))));
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Popover } from "./Popover";
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
3
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
4
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
5
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
6
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
7
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
8
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
10
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
11
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
import { isEqual } from "../../helpers";
|
|
16
|
+
import qrGenerator from 'qrcode-generator';
|
|
17
|
+
import * as React from 'react';
|
|
18
|
+
import * as ReactDOM from 'react-dom';
|
|
19
|
+
var QRCode = /*#__PURE__*/function (_React$Component) {
|
|
20
|
+
function QRCode(props) {
|
|
21
|
+
var _this;
|
|
22
|
+
_classCallCheck(this, QRCode);
|
|
23
|
+
_this = _callSuper(this, QRCode, [props]);
|
|
24
|
+
_this.canvas = /*#__PURE__*/React.createRef();
|
|
25
|
+
return _this;
|
|
26
|
+
}
|
|
27
|
+
_inherits(QRCode, _React$Component);
|
|
28
|
+
return _createClass(QRCode, [{
|
|
29
|
+
key: "drawRoundedSquare",
|
|
30
|
+
value:
|
|
31
|
+
/**
|
|
32
|
+
* Draw a rounded square in the canvas
|
|
33
|
+
*/
|
|
34
|
+
function drawRoundedSquare(lineWidth, x, y, size, color, radii, fill, ctx) {
|
|
35
|
+
ctx.lineWidth = lineWidth;
|
|
36
|
+
ctx.fillStyle = color;
|
|
37
|
+
ctx.strokeStyle = color;
|
|
38
|
+
|
|
39
|
+
// Adjust coordinates so that the outside of the stroke is aligned to the edges
|
|
40
|
+
y += lineWidth / 2;
|
|
41
|
+
x += lineWidth / 2;
|
|
42
|
+
size -= lineWidth;
|
|
43
|
+
if (!Array.isArray(radii)) {
|
|
44
|
+
radii = [radii, radii, radii, radii];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Radius should not be greater than half the size or less than zero
|
|
48
|
+
radii = radii.map(function (r) {
|
|
49
|
+
r = Math.min(r, size / 2);
|
|
50
|
+
return r < 0 ? 0 : r;
|
|
51
|
+
});
|
|
52
|
+
var rTopLeft = radii[0] || 0;
|
|
53
|
+
var rTopRight = radii[1] || 0;
|
|
54
|
+
var rBottomRight = radii[2] || 0;
|
|
55
|
+
var rBottomLeft = radii[3] || 0;
|
|
56
|
+
ctx.beginPath();
|
|
57
|
+
ctx.moveTo(x + rTopLeft, y);
|
|
58
|
+
ctx.lineTo(x + size - rTopRight, y);
|
|
59
|
+
if (rTopRight) ctx.quadraticCurveTo(x + size, y, x + size, y + rTopRight);
|
|
60
|
+
ctx.lineTo(x + size, y + size - rBottomRight);
|
|
61
|
+
if (rBottomRight) ctx.quadraticCurveTo(x + size, y + size, x + size - rBottomRight, y + size);
|
|
62
|
+
ctx.lineTo(x + rBottomLeft, y + size);
|
|
63
|
+
if (rBottomLeft) ctx.quadraticCurveTo(x, y + size, x, y + size - rBottomLeft);
|
|
64
|
+
ctx.lineTo(x, y + rTopLeft);
|
|
65
|
+
if (rTopLeft) ctx.quadraticCurveTo(x, y, x + rTopLeft, y);
|
|
66
|
+
ctx.closePath();
|
|
67
|
+
ctx.stroke();
|
|
68
|
+
if (fill) {
|
|
69
|
+
ctx.fill();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Draw a single positional pattern eye.
|
|
75
|
+
*/
|
|
76
|
+
}, {
|
|
77
|
+
key: "drawPositioningPattern",
|
|
78
|
+
value: function drawPositioningPattern(ctx, cellSize, offset, row, col, color) {
|
|
79
|
+
var radii = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [0, 0, 0, 0];
|
|
80
|
+
var lineWidth = Math.ceil(cellSize);
|
|
81
|
+
var radiiOuter;
|
|
82
|
+
var radiiInner;
|
|
83
|
+
if (typeof radii !== 'number' && !Array.isArray(radii)) {
|
|
84
|
+
radiiOuter = radii.outer || 0;
|
|
85
|
+
radiiInner = radii.inner || 0;
|
|
86
|
+
} else {
|
|
87
|
+
radiiOuter = radii;
|
|
88
|
+
radiiInner = radiiOuter;
|
|
89
|
+
}
|
|
90
|
+
var colorOuter;
|
|
91
|
+
var colorInner;
|
|
92
|
+
if (typeof color !== 'string') {
|
|
93
|
+
colorOuter = color.outer;
|
|
94
|
+
colorInner = color.inner;
|
|
95
|
+
} else {
|
|
96
|
+
colorOuter = color;
|
|
97
|
+
colorInner = color;
|
|
98
|
+
}
|
|
99
|
+
var y = row * cellSize + offset;
|
|
100
|
+
var x = col * cellSize + offset;
|
|
101
|
+
var size = cellSize * 7;
|
|
102
|
+
if (!Array.isArray(radiiOuter)) return;
|
|
103
|
+
// Outer box
|
|
104
|
+
this.drawRoundedSquare(lineWidth, x, y, size, colorOuter, radiiOuter, false, ctx);
|
|
105
|
+
if (!Array.isArray(radiiInner)) return;
|
|
106
|
+
// Inner box
|
|
107
|
+
size = cellSize * 3;
|
|
108
|
+
y += cellSize * 2;
|
|
109
|
+
x += cellSize * 2;
|
|
110
|
+
this.drawRoundedSquare(lineWidth, x, y, size, colorInner, radiiInner, true, ctx);
|
|
111
|
+
}
|
|
112
|
+
}, {
|
|
113
|
+
key: "isInPositioninZone",
|
|
114
|
+
value:
|
|
115
|
+
/**
|
|
116
|
+
* Is this dot inside a positional pattern zone.
|
|
117
|
+
*/
|
|
118
|
+
function isInPositioninZone(col, row, zones) {
|
|
119
|
+
return zones.some(function (zone) {
|
|
120
|
+
return row >= zone.row && row <= zone.row + 7 && col >= zone.col && col <= zone.col + 7;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
key: "transformPixelLengthIntoNumberOfCells",
|
|
125
|
+
value: function transformPixelLengthIntoNumberOfCells(pixelLength, cellSize) {
|
|
126
|
+
return pixelLength / cellSize;
|
|
127
|
+
}
|
|
128
|
+
}, {
|
|
129
|
+
key: "isCoordinateInImage",
|
|
130
|
+
value: function isCoordinateInImage(col, row, dWidthLogo, dHeightLogo, dxLogo, dyLogo, cellSize, logoImage) {
|
|
131
|
+
if (logoImage) {
|
|
132
|
+
var numberOfCellsMargin = 2;
|
|
133
|
+
var firstRowOfLogo = this.transformPixelLengthIntoNumberOfCells(dxLogo, cellSize);
|
|
134
|
+
var firstColumnOfLogo = this.transformPixelLengthIntoNumberOfCells(dyLogo, cellSize);
|
|
135
|
+
var logoWidthInCells = this.transformPixelLengthIntoNumberOfCells(dWidthLogo, cellSize) - 1;
|
|
136
|
+
var logoHeightInCells = this.transformPixelLengthIntoNumberOfCells(dHeightLogo, cellSize) - 1;
|
|
137
|
+
return row >= firstRowOfLogo - numberOfCellsMargin && row <= firstRowOfLogo + logoWidthInCells + numberOfCellsMargin // check rows
|
|
138
|
+
&& col >= firstColumnOfLogo - numberOfCellsMargin && col <= firstColumnOfLogo + logoHeightInCells + numberOfCellsMargin; // check cols
|
|
139
|
+
} else {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}, {
|
|
144
|
+
key: "shouldComponentUpdate",
|
|
145
|
+
value: function shouldComponentUpdate(nextProps) {
|
|
146
|
+
return !isEqual(this.props, nextProps);
|
|
147
|
+
}
|
|
148
|
+
}, {
|
|
149
|
+
key: "componentDidMount",
|
|
150
|
+
value: function componentDidMount() {
|
|
151
|
+
this.update();
|
|
152
|
+
}
|
|
153
|
+
}, {
|
|
154
|
+
key: "componentDidUpdate",
|
|
155
|
+
value: function componentDidUpdate() {
|
|
156
|
+
this.update();
|
|
157
|
+
}
|
|
158
|
+
}, {
|
|
159
|
+
key: "update",
|
|
160
|
+
value: function update() {
|
|
161
|
+
var _this$props = this.props,
|
|
162
|
+
value = _this$props.value,
|
|
163
|
+
ecLevel = _this$props.ecLevel,
|
|
164
|
+
enableCORS = _this$props.enableCORS,
|
|
165
|
+
size = _this$props.size,
|
|
166
|
+
quietZone = _this$props.quietZone,
|
|
167
|
+
bgColor = _this$props.bgColor,
|
|
168
|
+
fgColor = _this$props.fgColor,
|
|
169
|
+
logoImage = _this$props.logoImage,
|
|
170
|
+
logoWidth = _this$props.logoWidth,
|
|
171
|
+
logoHeight = _this$props.logoHeight,
|
|
172
|
+
logoOpacity = _this$props.logoOpacity,
|
|
173
|
+
removeQrCodeBehindLogo = _this$props.removeQrCodeBehindLogo,
|
|
174
|
+
qrStyle = _this$props.qrStyle,
|
|
175
|
+
eyeRadius = _this$props.eyeRadius,
|
|
176
|
+
eyeColor = _this$props.eyeColor;
|
|
177
|
+
var qrCode = qrGenerator(0, ecLevel);
|
|
178
|
+
qrCode.addData(QRCode.utf16to8(value));
|
|
179
|
+
qrCode.make();
|
|
180
|
+
var canvas = ReactDOM.findDOMNode(this.canvas.current);
|
|
181
|
+
var ctx = canvas.getContext('2d');
|
|
182
|
+
if (!ctx) return;
|
|
183
|
+
var canvasSize = +size + 2 * +quietZone;
|
|
184
|
+
var length = qrCode.getModuleCount();
|
|
185
|
+
var cellSize = size / length;
|
|
186
|
+
var scale = window.devicePixelRatio || 1;
|
|
187
|
+
canvas.height = canvas.width = canvasSize * scale;
|
|
188
|
+
ctx.scale(scale, scale);
|
|
189
|
+
ctx.fillStyle = bgColor;
|
|
190
|
+
ctx.fillRect(0, 0, canvasSize, canvasSize);
|
|
191
|
+
var offset = +quietZone;
|
|
192
|
+
var dWidthLogo = logoWidth || size * 0.2;
|
|
193
|
+
var dHeightLogo = logoHeight || dWidthLogo;
|
|
194
|
+
var dxLogo = (size - dWidthLogo) / 2;
|
|
195
|
+
var dyLogo = (size - dHeightLogo) / 2;
|
|
196
|
+
var positioningZones = [{
|
|
197
|
+
row: 0,
|
|
198
|
+
col: 0
|
|
199
|
+
}, {
|
|
200
|
+
row: 0,
|
|
201
|
+
col: length - 7
|
|
202
|
+
}, {
|
|
203
|
+
row: length - 7,
|
|
204
|
+
col: 0
|
|
205
|
+
}];
|
|
206
|
+
ctx.strokeStyle = fgColor;
|
|
207
|
+
if (qrStyle === 'dots') {
|
|
208
|
+
ctx.fillStyle = fgColor;
|
|
209
|
+
var radius = cellSize / 2;
|
|
210
|
+
for (var row = 0; row < length; row++) {
|
|
211
|
+
for (var col = 0; col < length; col++) {
|
|
212
|
+
if (qrCode.isDark(row, col) && !this.isInPositioninZone(row, col, positioningZones) && !(removeQrCodeBehindLogo && logoImage && this.isCoordinateInImage(row, col, dWidthLogo, dHeightLogo, dxLogo, dyLogo, cellSize, logoImage))) {
|
|
213
|
+
ctx.beginPath();
|
|
214
|
+
ctx.arc(Math.round(col * cellSize) + radius + offset, Math.round(row * cellSize) + radius + offset, radius / 100 * 75, 0, 2 * Math.PI, false);
|
|
215
|
+
ctx.closePath();
|
|
216
|
+
ctx.fill();
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
} else {
|
|
221
|
+
for (var _row = 0; _row < length; _row++) {
|
|
222
|
+
for (var _col = 0; _col < length; _col++) {
|
|
223
|
+
if (qrCode.isDark(_row, _col) && !this.isInPositioninZone(_row, _col, positioningZones) && !(removeQrCodeBehindLogo && logoImage && this.isCoordinateInImage(_row, _col, dWidthLogo, dHeightLogo, dxLogo, dyLogo, cellSize, logoImage))) {
|
|
224
|
+
ctx.fillStyle = fgColor;
|
|
225
|
+
var w = Math.ceil((_col + 1) * cellSize) - Math.floor(_col * cellSize);
|
|
226
|
+
var h = Math.ceil((_row + 1) * cellSize) - Math.floor(_row * cellSize);
|
|
227
|
+
ctx.fillRect(Math.round(_col * cellSize) + offset, Math.round(_row * cellSize) + offset, w, h);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Draw positioning patterns
|
|
234
|
+
for (var i = 0; i < 3; i++) {
|
|
235
|
+
var _positioningZones$i = positioningZones[i],
|
|
236
|
+
_row2 = _positioningZones$i.row,
|
|
237
|
+
_col2 = _positioningZones$i.col;
|
|
238
|
+
var radii = eyeRadius;
|
|
239
|
+
var color = void 0;
|
|
240
|
+
if (Array.isArray(radii)) {
|
|
241
|
+
radii = radii[i];
|
|
242
|
+
}
|
|
243
|
+
if (typeof radii == 'number') {
|
|
244
|
+
radii = [radii, radii, radii, radii];
|
|
245
|
+
}
|
|
246
|
+
if (!eyeColor) {
|
|
247
|
+
// if not specified, eye color is the same as foreground,
|
|
248
|
+
color = fgColor;
|
|
249
|
+
} else {
|
|
250
|
+
if (Array.isArray(eyeColor)) {
|
|
251
|
+
// if array, we pass the single color
|
|
252
|
+
color = eyeColor[i];
|
|
253
|
+
} else {
|
|
254
|
+
color = eyeColor;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
this.drawPositioningPattern(ctx, cellSize, offset, _row2, _col2, color, radii);
|
|
258
|
+
}
|
|
259
|
+
if (logoImage) {
|
|
260
|
+
var image = new Image();
|
|
261
|
+
if (enableCORS) {
|
|
262
|
+
image.crossOrigin = 'Anonymous';
|
|
263
|
+
}
|
|
264
|
+
image.onload = function () {
|
|
265
|
+
ctx.save();
|
|
266
|
+
ctx.globalAlpha = logoOpacity;
|
|
267
|
+
ctx.drawImage(image, dxLogo + offset, dyLogo + offset, dWidthLogo, dHeightLogo);
|
|
268
|
+
ctx.restore();
|
|
269
|
+
};
|
|
270
|
+
image.src = logoImage;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}, {
|
|
274
|
+
key: "render",
|
|
275
|
+
value: function render() {
|
|
276
|
+
var _this$props$id;
|
|
277
|
+
var size = +this.props.size + 2 * +this.props.quietZone;
|
|
278
|
+
return /*#__PURE__*/React.createElement('canvas', {
|
|
279
|
+
id: (_this$props$id = this.props.id) !== null && _this$props$id !== void 0 ? _this$props$id : 'react-qrcode-logo',
|
|
280
|
+
height: size,
|
|
281
|
+
width: size,
|
|
282
|
+
style: {
|
|
283
|
+
height: size + 'px',
|
|
284
|
+
width: size + 'px',
|
|
285
|
+
borderRadius: this.props.borderRadius
|
|
286
|
+
},
|
|
287
|
+
ref: this.canvas
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}], [{
|
|
291
|
+
key: "utf16to8",
|
|
292
|
+
value: function utf16to8(str) {
|
|
293
|
+
var out = '',
|
|
294
|
+
i,
|
|
295
|
+
c;
|
|
296
|
+
var len = str.length;
|
|
297
|
+
for (i = 0; i < len; i++) {
|
|
298
|
+
c = str.charCodeAt(i);
|
|
299
|
+
if (c >= 0x0001 && c <= 0x007F) {
|
|
300
|
+
out += str.charAt(i);
|
|
301
|
+
} else if (c > 0x07FF) {
|
|
302
|
+
out += String.fromCharCode(0xE0 | c >> 12 & 0x0F);
|
|
303
|
+
out += String.fromCharCode(0x80 | c >> 6 & 0x3F);
|
|
304
|
+
out += String.fromCharCode(0x80 | c >> 0 & 0x3F);
|
|
305
|
+
} else {
|
|
306
|
+
out += String.fromCharCode(0xC0 | c >> 6 & 0x1F);
|
|
307
|
+
out += String.fromCharCode(0x80 | c >> 0 & 0x3F);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return out;
|
|
311
|
+
}
|
|
312
|
+
}]);
|
|
313
|
+
}(React.Component);
|
|
314
|
+
_defineProperty(QRCode, "defaultProps", {
|
|
315
|
+
value: 'https://reactjs.org/',
|
|
316
|
+
ecLevel: 'M',
|
|
317
|
+
enableCORS: false,
|
|
318
|
+
size: 300,
|
|
319
|
+
quietZone: 10,
|
|
320
|
+
bgColor: 'black',
|
|
321
|
+
fgColor: 'white',
|
|
322
|
+
logoOpacity: 1,
|
|
323
|
+
removeQrCodeBehindLogo: true,
|
|
324
|
+
qrStyle: 'dots',
|
|
325
|
+
eyeColor: 'white',
|
|
326
|
+
eyeRadius: [10, 10, 10],
|
|
327
|
+
borderRadius: 20
|
|
328
|
+
});
|
|
329
|
+
export { QRCode };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { QRCode } from "./QRCode";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { useState } from 'react';
|
|
9
|
+
import { DefaultGroup, VerticalGroup } from "./components";
|
|
10
|
+
|
|
11
|
+
// import { iconAssert } from 'components/Icon/Icon';
|
|
12
|
+
|
|
13
|
+
export var RadioGroup = function RadioGroup(_ref) {
|
|
14
|
+
var options = _ref.options,
|
|
15
|
+
_ref$variant = _ref.variant,
|
|
16
|
+
variant = _ref$variant === void 0 ? 'horizontal' : _ref$variant,
|
|
17
|
+
setValue = _ref.setValue;
|
|
18
|
+
var _useState = useState(options[0]),
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
selected = _useState2[0],
|
|
21
|
+
setSelected = _useState2[1];
|
|
22
|
+
var handleSelection = function handleSelection(value) {
|
|
23
|
+
setValue && setValue(value);
|
|
24
|
+
setSelected(value);
|
|
25
|
+
};
|
|
26
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(React.Fragment, null, variant === 'horizontal' && /*#__PURE__*/React.createElement(DefaultGroup, {
|
|
27
|
+
handleSelection: handleSelection,
|
|
28
|
+
options: options,
|
|
29
|
+
selected: selected
|
|
30
|
+
}), variant === 'vertical' && /*#__PURE__*/React.createElement(VerticalGroup, {
|
|
31
|
+
handleSelection: handleSelection,
|
|
32
|
+
options: options,
|
|
33
|
+
selected: selected
|
|
34
|
+
})));
|
|
35
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Icon } from "../..";
|
|
4
|
+
import { RadioGroup as RadioGroupComponent } from '@headlessui/react';
|
|
5
|
+
export var DefaultGroup = function DefaultGroup(_ref) {
|
|
6
|
+
var handleSelection = _ref.handleSelection,
|
|
7
|
+
selected = _ref.selected,
|
|
8
|
+
options = _ref.options;
|
|
9
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
10
|
+
className: "w-full py-[16px]"
|
|
11
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
className: "w-full mx-auto"
|
|
13
|
+
}, /*#__PURE__*/React.createElement(RadioGroupComponent, {
|
|
14
|
+
value: selected,
|
|
15
|
+
onChange: function onChange(e) {
|
|
16
|
+
return handleSelection(e);
|
|
17
|
+
}
|
|
18
|
+
}, /*#__PURE__*/React.createElement(RadioGroupComponent.Label, {
|
|
19
|
+
className: "sr-only"
|
|
20
|
+
}, "Label"), /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: "space-y-[12px]"
|
|
22
|
+
}, options.map(function (option) {
|
|
23
|
+
return /*#__PURE__*/React.createElement(RadioGroupComponent.Option, {
|
|
24
|
+
key: option.name,
|
|
25
|
+
value: option,
|
|
26
|
+
disabled: option.disabled,
|
|
27
|
+
className: function className(_ref2) {
|
|
28
|
+
var active = _ref2.active,
|
|
29
|
+
checked = _ref2.checked;
|
|
30
|
+
return "".concat(active ? 'ring-[2px] ring-secondary-1000' : "\n hover:border-[1px] hover:border-secondary-800\n hover:ring-[2px] hover:ring-secondary-1000 hover:ring-offset-neutral-50\n focus:border-[2px] focus:border-secondary-800\n focus:ring-[2px] focus:ring-primary-1000 focus:ring-offset-neutral-50\n ", "\n ").concat(checked ? 'bg-neutral-100 border-secondary-400' : 'bg-neutral-50 text-neutral-800', "\n relative rounded-[16px] shadow-md px-5 py-4 cursor-pointer flex outline-none\n border-[1px]\n ");
|
|
31
|
+
}
|
|
32
|
+
}, function (_ref3) {
|
|
33
|
+
var active = _ref3.active,
|
|
34
|
+
checked = _ref3.checked;
|
|
35
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
className: "flex items-center justify-between w-full"
|
|
37
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: "flex items-center"
|
|
39
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: "text-p3-bold"
|
|
41
|
+
}, /*#__PURE__*/React.createElement(RadioGroupComponent.Label, {
|
|
42
|
+
as: "div"
|
|
43
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
className: "".concat(active ? 'text-secondary-1000' : checked ? 'text-secondary-800' : 'text-neutral-1200')
|
|
45
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
46
|
+
name: option.icon
|
|
47
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: "".concat(active ? 'text-secondary-1000' : checked ? 'text-secondary-800' : 'text-neutral-1200')
|
|
49
|
+
}, option.name)), /*#__PURE__*/React.createElement(RadioGroupComponent.Description, {
|
|
50
|
+
as: "span",
|
|
51
|
+
className: "inline ".concat(checked ? 'text-secondary-1400' : 'text-neutral-1400')
|
|
52
|
+
}))), checked && /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: "flex-shrink-0 text-neutral-800 bg-gradient-to-tr from-primary-1100 via-secondary-1100 to-secondary-1300 rounded-full"
|
|
54
|
+
}, /*#__PURE__*/React.createElement(CheckIcon, {
|
|
55
|
+
className: "w-6 h-6"
|
|
56
|
+
}))));
|
|
57
|
+
});
|
|
58
|
+
}))))));
|
|
59
|
+
};
|
|
60
|
+
function CheckIcon(props) {
|
|
61
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
62
|
+
viewBox: "0 0 24 24",
|
|
63
|
+
fill: "none"
|
|
64
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
65
|
+
d: "M7 13l3 3 7-7",
|
|
66
|
+
stroke: "#fff",
|
|
67
|
+
strokeWidth: 1.5,
|
|
68
|
+
strokeLinecap: "round",
|
|
69
|
+
strokeLinejoin: "round"
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Image, Badge } from "../..";
|
|
4
|
+
import { RadioGroup as RadioGroupComponent } from '@headlessui/react';
|
|
5
|
+
import { motion } from "framer-motion";
|
|
6
|
+
export var VerticalGroup = function VerticalGroup(_ref) {
|
|
7
|
+
var handleSelection = _ref.handleSelection,
|
|
8
|
+
selected = _ref.selected,
|
|
9
|
+
options = _ref.options;
|
|
10
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(RadioGroupComponent, {
|
|
11
|
+
value: selected,
|
|
12
|
+
onChange: function onChange(e) {
|
|
13
|
+
return handleSelection(e);
|
|
14
|
+
}
|
|
15
|
+
}, /*#__PURE__*/React.createElement(RadioGroupComponent.Label, {
|
|
16
|
+
className: "sr-only"
|
|
17
|
+
}, "Label"), /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
className: "flex flex-row space-x-[20px]"
|
|
19
|
+
}, options.map(function (option) {
|
|
20
|
+
return /*#__PURE__*/React.createElement(RadioGroupComponent.Option, {
|
|
21
|
+
key: option.name,
|
|
22
|
+
value: option,
|
|
23
|
+
disabled: option.disabled,
|
|
24
|
+
className: function className(_ref2) {
|
|
25
|
+
var active = _ref2.active,
|
|
26
|
+
checked = _ref2.checked;
|
|
27
|
+
return "".concat(active ? 'ring-2 ring-offset-2 ring-offset-sky-300 ring-white ring-opacity-60' : '', "\n ").concat(checked ? 'bg-neutral-100 text-neutral-800' : 'bg-neutral-50 text-neutral-800', "\n bg-primary-400 relative rounded-lg shadow-md ").concat(option.disabled ? 'cursor-not-allowed' : 'cursor-pointer', " flex focus:outline-none w-[200px] overflow-hidden");
|
|
28
|
+
}
|
|
29
|
+
}, function (_ref3) {
|
|
30
|
+
var active = _ref3.active,
|
|
31
|
+
checked = _ref3.checked;
|
|
32
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: "flex items-center justify-between w-full"
|
|
34
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: "flex items-center"
|
|
36
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(RadioGroupComponent.Label, {
|
|
37
|
+
as: "p",
|
|
38
|
+
className: "font-medium ".concat(checked ? 'text-neutral-800' : 'text-neutral-900')
|
|
39
|
+
}, /*#__PURE__*/React.createElement(motion.div, {
|
|
40
|
+
className: "absolute",
|
|
41
|
+
initial: {
|
|
42
|
+
scale: 1
|
|
43
|
+
},
|
|
44
|
+
whileHover: {
|
|
45
|
+
scale: option.disabled ? 1 : 1.2
|
|
46
|
+
}
|
|
47
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
48
|
+
fullHeight: true,
|
|
49
|
+
imageUrl: option.image_url,
|
|
50
|
+
customCss: "z-[1] ".concat(option.disabled && 'filter grayscale')
|
|
51
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
className: "relative h-[300px]"
|
|
53
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: "flex flex-col justify-end w-[200px] px-[16px] py-[20px]"
|
|
55
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
56
|
+
className: "flex flex-row justify-between h-6"
|
|
57
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
className: ""
|
|
59
|
+
}, option.name), checked && /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
className: "flex-shrink-0 text-neutral-800 bg-gradient-to-tr from-primary-500 via-secondary-500 to-secondary-400 rounded-full"
|
|
61
|
+
}, /*#__PURE__*/React.createElement(CheckIcon, {
|
|
62
|
+
className: "w-6 h-6"
|
|
63
|
+
})), !!option.badge && /*#__PURE__*/React.createElement(Badge, {
|
|
64
|
+
title: option.badge
|
|
65
|
+
}))))), /*#__PURE__*/React.createElement(RadioGroupComponent.Description, {
|
|
66
|
+
as: "span",
|
|
67
|
+
className: "inline ".concat(checked ? 'text-neutral-300' : 'text-neutral-600')
|
|
68
|
+
})))));
|
|
69
|
+
});
|
|
70
|
+
}))));
|
|
71
|
+
};
|
|
72
|
+
function CheckIcon(props) {
|
|
73
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
74
|
+
viewBox: "0 0 24 24",
|
|
75
|
+
fill: "none"
|
|
76
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
77
|
+
d: "M7 13l3 3 7-7",
|
|
78
|
+
stroke: "#fff",
|
|
79
|
+
strokeWidth: 1.5,
|
|
80
|
+
strokeLinecap: "round",
|
|
81
|
+
strokeLinejoin: "round"
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RadioGroup } from "./RadioGroup";
|