@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,30 @@
|
|
|
1
|
+
import { Disclosure } from "../../components/Disclosure";
|
|
2
|
+
import "../../../../styles/index.css";
|
|
3
|
+
var items = [{
|
|
4
|
+
title: 'About us',
|
|
5
|
+
text: 'We are ...'
|
|
6
|
+
}, {
|
|
7
|
+
title: 'How we work',
|
|
8
|
+
text: 'Learn more ...'
|
|
9
|
+
}];
|
|
10
|
+
export default {
|
|
11
|
+
component: Disclosure,
|
|
12
|
+
title: 'Components / Disclosure',
|
|
13
|
+
argsTypes: {
|
|
14
|
+
items: {
|
|
15
|
+
control: 'array'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
args: {
|
|
19
|
+
items: items
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export var Default = function Default(args) {
|
|
23
|
+
return /*#__PURE__*/React.createElement(Disclosure, args);
|
|
24
|
+
};
|
|
25
|
+
Default.parameters = {
|
|
26
|
+
design: {
|
|
27
|
+
type: 'figma',
|
|
28
|
+
url: 'https://www.figma.com/file/vkIFRuwbONhF3qrGI7bHvL/App?node-id=2%3A129'
|
|
29
|
+
}
|
|
30
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Dropdown } from "../../components/Dropdown";
|
|
2
|
+
import "../../../../styles/index.css";
|
|
3
|
+
var items = [{
|
|
4
|
+
text: 'Edit',
|
|
5
|
+
type: 'button'
|
|
6
|
+
}, {
|
|
7
|
+
text: 'Duplicate',
|
|
8
|
+
type: 'button'
|
|
9
|
+
}];
|
|
10
|
+
export default {
|
|
11
|
+
component: Dropdown,
|
|
12
|
+
title: 'Development / Dropdown',
|
|
13
|
+
argsTypes: {
|
|
14
|
+
items: {
|
|
15
|
+
control: 'array'
|
|
16
|
+
},
|
|
17
|
+
button: {
|
|
18
|
+
control: 'string'
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
args: {
|
|
22
|
+
items: items,
|
|
23
|
+
direction: "center-bottom",
|
|
24
|
+
button: {
|
|
25
|
+
text: 'user'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export var Default = function Default(args) {
|
|
30
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
className: "flex justify-center"
|
|
32
|
+
}, /*#__PURE__*/React.createElement(Dropdown, args));
|
|
33
|
+
};
|
|
34
|
+
Default.parameters = {
|
|
35
|
+
design: {
|
|
36
|
+
type: 'figma',
|
|
37
|
+
url: 'https://www.figma.com/file/vkIFRuwbONhF3qrGI7bHvL/App?node-id=2%3A129'
|
|
38
|
+
}
|
|
39
|
+
};
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Form } from "../../../components/Form";
|
|
3
|
+
import "../../../../../styles/index.css";
|
|
4
|
+
var loadPayload = function loadPayload() {
|
|
5
|
+
return console.log('Loading Payload');
|
|
6
|
+
};
|
|
7
|
+
var validateEmail = function validateEmail(mail) {
|
|
8
|
+
return /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail) ? true : false;
|
|
9
|
+
};
|
|
10
|
+
var validateText = function validateText(e) {
|
|
11
|
+
if (e.length > 3) {
|
|
12
|
+
return new Promise(function (resolve, reject) {
|
|
13
|
+
setTimeout(function () {
|
|
14
|
+
resolve(true);
|
|
15
|
+
}, 800);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export default {
|
|
20
|
+
component: Form,
|
|
21
|
+
title: 'Data Handle / Form',
|
|
22
|
+
args: {
|
|
23
|
+
debug: true,
|
|
24
|
+
fields: [{
|
|
25
|
+
field: {
|
|
26
|
+
type: 'text',
|
|
27
|
+
id: 'id',
|
|
28
|
+
label: 'ID',
|
|
29
|
+
hidden: true
|
|
30
|
+
}
|
|
31
|
+
}, [{
|
|
32
|
+
field: {
|
|
33
|
+
type: 'text',
|
|
34
|
+
id: 'name',
|
|
35
|
+
label: 'Name',
|
|
36
|
+
placeholder: 'Name',
|
|
37
|
+
required: true
|
|
38
|
+
}
|
|
39
|
+
}, {
|
|
40
|
+
field: {
|
|
41
|
+
type: 'textarea',
|
|
42
|
+
id: 'description',
|
|
43
|
+
label: 'Description',
|
|
44
|
+
placeholder: 'Description',
|
|
45
|
+
required: true
|
|
46
|
+
}
|
|
47
|
+
}], {
|
|
48
|
+
field: {
|
|
49
|
+
type: 'time',
|
|
50
|
+
id: 'duration',
|
|
51
|
+
label: 'Duration',
|
|
52
|
+
placeholder: 'Duration',
|
|
53
|
+
required: true
|
|
54
|
+
}
|
|
55
|
+
}, {
|
|
56
|
+
field: {
|
|
57
|
+
type: 'number',
|
|
58
|
+
id: 'price',
|
|
59
|
+
label: 'Price',
|
|
60
|
+
placeholder: 'Price',
|
|
61
|
+
required: true
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
field: {
|
|
65
|
+
type: 'select',
|
|
66
|
+
id: 'contracts_id',
|
|
67
|
+
label: 'Smart Contracts',
|
|
68
|
+
placeholder: 'Smart Contracts',
|
|
69
|
+
required: true,
|
|
70
|
+
defaultValue: '',
|
|
71
|
+
options: [{
|
|
72
|
+
name: 'XDR Direct Payment',
|
|
73
|
+
value: '7e524b86-418a-4459-9fb7-ef85de7279b4'
|
|
74
|
+
}]
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
field: {
|
|
78
|
+
type: 'text',
|
|
79
|
+
id: 'text',
|
|
80
|
+
label: 'Text',
|
|
81
|
+
icon: 'user',
|
|
82
|
+
placeholder: 'write some words',
|
|
83
|
+
validation: {
|
|
84
|
+
fn: validateText
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
field: {
|
|
89
|
+
type: 'email',
|
|
90
|
+
id: 'email',
|
|
91
|
+
label: 'Email',
|
|
92
|
+
placeholder: 'example@email.com'
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
field: {
|
|
96
|
+
type: 'password',
|
|
97
|
+
id: 'password',
|
|
98
|
+
label: 'Password',
|
|
99
|
+
placeholder: 'Set you password'
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
field: {
|
|
103
|
+
type: 'textarea',
|
|
104
|
+
id: 'textarea',
|
|
105
|
+
label: 'Text Area',
|
|
106
|
+
placeholder: 'Set a description'
|
|
107
|
+
}
|
|
108
|
+
}, {
|
|
109
|
+
field: {
|
|
110
|
+
type: 'select',
|
|
111
|
+
id: 'select',
|
|
112
|
+
label: 'Select',
|
|
113
|
+
placeholder: 'select',
|
|
114
|
+
options: [{
|
|
115
|
+
name: 'Option 1',
|
|
116
|
+
value: 1
|
|
117
|
+
}, {
|
|
118
|
+
name: 'Option 2',
|
|
119
|
+
value: 2
|
|
120
|
+
}]
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
field: {
|
|
124
|
+
type: 'datepicker',
|
|
125
|
+
id: 'datepicker',
|
|
126
|
+
icon: 'calendar',
|
|
127
|
+
label: 'Date Picker'
|
|
128
|
+
}
|
|
129
|
+
}, {
|
|
130
|
+
field: {
|
|
131
|
+
type: 'time',
|
|
132
|
+
id: 'duration',
|
|
133
|
+
label: 'Time Picker',
|
|
134
|
+
// defaultValue: '2022-07-07',
|
|
135
|
+
icon: 'user'
|
|
136
|
+
}
|
|
137
|
+
}, {
|
|
138
|
+
field: {
|
|
139
|
+
type: 'radiobox',
|
|
140
|
+
id: 'radio',
|
|
141
|
+
label: 'Radio',
|
|
142
|
+
placeholder: 'Radio',
|
|
143
|
+
defaultValue: '2',
|
|
144
|
+
options: [{
|
|
145
|
+
name: 'Option 1',
|
|
146
|
+
value: '1'
|
|
147
|
+
}, {
|
|
148
|
+
name: 'Option 2',
|
|
149
|
+
value: '2'
|
|
150
|
+
}]
|
|
151
|
+
}
|
|
152
|
+
}, {
|
|
153
|
+
field: {
|
|
154
|
+
type: 'radiobox',
|
|
155
|
+
id: 'radio2',
|
|
156
|
+
label: 'Radio',
|
|
157
|
+
placeholder: 'Radio',
|
|
158
|
+
variant: 'full',
|
|
159
|
+
defaultValue: '2',
|
|
160
|
+
options: [{
|
|
161
|
+
name: 'Option 1',
|
|
162
|
+
value: '1',
|
|
163
|
+
description: 'You are the only one able to access this project'
|
|
164
|
+
}, {
|
|
165
|
+
name: 'Option 2',
|
|
166
|
+
value: '2',
|
|
167
|
+
description: 'You are the only one able to access this project'
|
|
168
|
+
}]
|
|
169
|
+
}
|
|
170
|
+
}, {
|
|
171
|
+
field: {
|
|
172
|
+
type: 'radiobox',
|
|
173
|
+
id: 'radio',
|
|
174
|
+
label: 'Radio',
|
|
175
|
+
placeholder: 'Radio',
|
|
176
|
+
defaultValue: '2',
|
|
177
|
+
variant: 'card',
|
|
178
|
+
options: [{
|
|
179
|
+
name: 'Option 1',
|
|
180
|
+
value: '1'
|
|
181
|
+
}, {
|
|
182
|
+
name: 'Option 2',
|
|
183
|
+
value: '2'
|
|
184
|
+
}]
|
|
185
|
+
}
|
|
186
|
+
}],
|
|
187
|
+
button: {
|
|
188
|
+
text: 'Submit',
|
|
189
|
+
variant: 'primary'
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
export var Default = function Default(args) {
|
|
194
|
+
return /*#__PURE__*/React.createElement(Form, args);
|
|
195
|
+
};
|
|
196
|
+
Default.parameters = {
|
|
197
|
+
design: {
|
|
198
|
+
type: 'figma',
|
|
199
|
+
url: 'https://www.figma.com/file/vkIFRuwbONhF3qrGI7bHvL/App?node-id=2%3A129'
|
|
200
|
+
}
|
|
201
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
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 { Form } from "../../../components/Form";
|
|
3
|
+
import "../../../../../styles/index.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
var loadPayload = function loadPayload() {
|
|
6
|
+
return console.log('Loading Payload');
|
|
7
|
+
};
|
|
8
|
+
export default {
|
|
9
|
+
component: Form,
|
|
10
|
+
title: 'Data Handle / Form',
|
|
11
|
+
argTypes: {
|
|
12
|
+
type: {
|
|
13
|
+
options: ['stepper', 'dynamic'],
|
|
14
|
+
control: {
|
|
15
|
+
type: 'radio'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
args: {
|
|
20
|
+
type: 'dynamic',
|
|
21
|
+
debug: true,
|
|
22
|
+
button: {
|
|
23
|
+
text: 'Submit',
|
|
24
|
+
variant: 'primary'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// decorators: [withDesign]
|
|
28
|
+
};
|
|
29
|
+
export var DummyForm = function DummyForm(args) {
|
|
30
|
+
var fields = [{
|
|
31
|
+
field: {
|
|
32
|
+
type: 'text',
|
|
33
|
+
id: 'description',
|
|
34
|
+
placeholder: 'Description',
|
|
35
|
+
label: 'Description',
|
|
36
|
+
required: true
|
|
37
|
+
}
|
|
38
|
+
}];
|
|
39
|
+
return /*#__PURE__*/React.createElement(Form, _extends({}, args, {
|
|
40
|
+
fields: fields
|
|
41
|
+
}));
|
|
42
|
+
};
|
|
43
|
+
DummyForm.parameters = {
|
|
44
|
+
design: {
|
|
45
|
+
type: 'figma',
|
|
46
|
+
url: 'https://www.figma.com/file/vkIFRuwbONhF3qrGI7bHvL/App?node-id=2%3A129'
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
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 { Form } from "../../../components/Form";
|
|
3
|
+
import "../../../../../styles/index.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
var loadPayload = function loadPayload() {
|
|
6
|
+
return console.log('Loading Payload');
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// const validateEmail: any = (mail: string) => /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail) ? true : false
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
component: Form,
|
|
13
|
+
title: 'Data Handle / Form',
|
|
14
|
+
argTypes: {
|
|
15
|
+
type: {
|
|
16
|
+
options: ['stepper', 'dynamic'],
|
|
17
|
+
control: {
|
|
18
|
+
type: 'radio'
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
args: {
|
|
23
|
+
type: 'dynamic',
|
|
24
|
+
debug: true,
|
|
25
|
+
button: {
|
|
26
|
+
text: 'Submit',
|
|
27
|
+
variant: 'primary'
|
|
28
|
+
},
|
|
29
|
+
preventDefault: true,
|
|
30
|
+
afterSubmit: function afterSubmit() {
|
|
31
|
+
return console.log('Hello Submit');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
export var DynamicForm1 = function DynamicForm1(args) {
|
|
36
|
+
// const getChild: any = async (e: any) => {
|
|
37
|
+
// console.log('E', e)
|
|
38
|
+
// if (e.value === "1") {
|
|
39
|
+
// return [{ name: 'Option A', value: 1 },{ name: 'Option B', value: 2 }]
|
|
40
|
+
// } else if (e.value === "2") {
|
|
41
|
+
// return [{ name: 'Option C', value: 3 },{ name: 'Option D', value: 4 }]
|
|
42
|
+
// }
|
|
43
|
+
// }
|
|
44
|
+
|
|
45
|
+
// const updateGrandchild: any = async (e: any) => {
|
|
46
|
+
// if (e.value === "1") {
|
|
47
|
+
// return [{ name: 'Option A 1', value: 5 },{ name: 'Option A 2', value: 6 }]
|
|
48
|
+
// } else if (e.value === "2") {
|
|
49
|
+
// return [{ name: 'Option B 1', value: 7 },{ name: 'Option B 2', value: 8 }]
|
|
50
|
+
// } else if (e.value === "3") {
|
|
51
|
+
// return [{ name: 'Option C 1', value: 9 },{ name: 'Option C 2', value: 10 }]
|
|
52
|
+
// } else if (e.value === "4") {
|
|
53
|
+
// return [{ name: 'Option D 1', value: 11 },{ name: 'Option D 2', value: 12 }]
|
|
54
|
+
// }
|
|
55
|
+
// }
|
|
56
|
+
|
|
57
|
+
var fields = [{
|
|
58
|
+
field: {
|
|
59
|
+
type: 'text',
|
|
60
|
+
id: 'description',
|
|
61
|
+
placeholder: 'Description',
|
|
62
|
+
label: 'Description',
|
|
63
|
+
required: true
|
|
64
|
+
},
|
|
65
|
+
title: 'Experience Info',
|
|
66
|
+
description: 'Describe in a few words whats about.'
|
|
67
|
+
}, {
|
|
68
|
+
field: {
|
|
69
|
+
type: 'textarea',
|
|
70
|
+
id: 'description',
|
|
71
|
+
placeholder: 'Description',
|
|
72
|
+
label: 'Description',
|
|
73
|
+
required: true
|
|
74
|
+
},
|
|
75
|
+
title: 'Experience Info',
|
|
76
|
+
description: 'Describe in a few words whats about.'
|
|
77
|
+
}, {
|
|
78
|
+
field: {
|
|
79
|
+
type: 'select',
|
|
80
|
+
id: 'parent',
|
|
81
|
+
label: 'Parent',
|
|
82
|
+
placeholder: 'select',
|
|
83
|
+
options: [{
|
|
84
|
+
name: 'Option 1',
|
|
85
|
+
value: 1
|
|
86
|
+
}, {
|
|
87
|
+
name: 'Option 2',
|
|
88
|
+
value: 2
|
|
89
|
+
}]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// {
|
|
93
|
+
// field: {
|
|
94
|
+
// type: 'select',
|
|
95
|
+
// id: 'child',
|
|
96
|
+
// label: 'Child',
|
|
97
|
+
// placeholder: 'select',
|
|
98
|
+
// belongs_to: 'parent',
|
|
99
|
+
// populateOptions: getChild
|
|
100
|
+
// },
|
|
101
|
+
// },
|
|
102
|
+
// {
|
|
103
|
+
// field: {
|
|
104
|
+
// type: 'select',
|
|
105
|
+
// id: 'child2',
|
|
106
|
+
// label: 'Child 2',
|
|
107
|
+
// placeholder: 'select',
|
|
108
|
+
// belongs_to: 'child',
|
|
109
|
+
// populateOptions: updateGrandchild
|
|
110
|
+
// },
|
|
111
|
+
// },
|
|
112
|
+
// { field: {
|
|
113
|
+
// type: 'time',
|
|
114
|
+
// id: 'duration',
|
|
115
|
+
// placeholder: 'Duration',
|
|
116
|
+
// label: 'Duration',
|
|
117
|
+
// icon: 'clock',
|
|
118
|
+
// required: true,
|
|
119
|
+
// },
|
|
120
|
+
// title: 'Experience Info',
|
|
121
|
+
// description: 'Choose the duration of your experience',
|
|
122
|
+
// },
|
|
123
|
+
];
|
|
124
|
+
return /*#__PURE__*/React.createElement(Form, _extends({}, args, {
|
|
125
|
+
fields: fields
|
|
126
|
+
}));
|
|
127
|
+
};
|
|
128
|
+
DynamicForm1.parameters = {
|
|
129
|
+
design: {
|
|
130
|
+
type: 'figma',
|
|
131
|
+
url: 'https://www.figma.com/file/vkIFRuwbONhF3qrGI7bHvL/App?node-id=2%3A129'
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
export var DynamicForm2 = function DynamicForm2(args) {
|
|
135
|
+
var fields = [{
|
|
136
|
+
field: {
|
|
137
|
+
type: 'text',
|
|
138
|
+
id: 'description',
|
|
139
|
+
placeholder: 'Description',
|
|
140
|
+
label: 'Description',
|
|
141
|
+
required: true
|
|
142
|
+
},
|
|
143
|
+
title: 'Experience Info',
|
|
144
|
+
description: 'Describe in a few words whats about.'
|
|
145
|
+
}];
|
|
146
|
+
return /*#__PURE__*/React.createElement(Form, _extends({}, args, {
|
|
147
|
+
fields: fields
|
|
148
|
+
}));
|
|
149
|
+
};
|
|
150
|
+
DynamicForm2.parameters = {
|
|
151
|
+
design: {
|
|
152
|
+
type: 'figma',
|
|
153
|
+
url: 'https://www.figma.com/file/vkIFRuwbONhF3qrGI7bHvL/App?node-id=2%3A129'
|
|
154
|
+
}
|
|
155
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
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 _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); }
|
|
3
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
|
|
4
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
5
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { Form } from "../../../components/Form";
|
|
8
|
+
import "../../../../../styles/index.css";
|
|
9
|
+
export default {
|
|
10
|
+
component: Form,
|
|
11
|
+
title: 'Data Handle / Form',
|
|
12
|
+
args: {
|
|
13
|
+
button: {
|
|
14
|
+
text: 'Create',
|
|
15
|
+
variant: 'primary'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var validateText = function validateText(e) {
|
|
20
|
+
if ((e === null || e === void 0 ? void 0 : e.length) > 3) {
|
|
21
|
+
return new Promise(function (resolve, reject) {
|
|
22
|
+
setTimeout(function () {
|
|
23
|
+
resolve(true);
|
|
24
|
+
}, 800);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export var StepperForm = function StepperForm(args) {
|
|
29
|
+
var getChild = /*#__PURE__*/function () {
|
|
30
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
|
|
31
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
32
|
+
while (1) switch (_context.prev = _context.next) {
|
|
33
|
+
case 0:
|
|
34
|
+
if (!(e.value === "1")) {
|
|
35
|
+
_context.next = 4;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
return _context.abrupt("return", [{
|
|
39
|
+
name: 'Option A',
|
|
40
|
+
value: '1'
|
|
41
|
+
}, {
|
|
42
|
+
name: 'Option B',
|
|
43
|
+
value: '2'
|
|
44
|
+
}]);
|
|
45
|
+
case 4:
|
|
46
|
+
if (!(e.value === "2")) {
|
|
47
|
+
_context.next = 6;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
return _context.abrupt("return", [{
|
|
51
|
+
name: 'Option C',
|
|
52
|
+
value: '3'
|
|
53
|
+
}, {
|
|
54
|
+
name: 'Option D',
|
|
55
|
+
value: '4'
|
|
56
|
+
}]);
|
|
57
|
+
case 6:
|
|
58
|
+
case "end":
|
|
59
|
+
return _context.stop();
|
|
60
|
+
}
|
|
61
|
+
}, _callee);
|
|
62
|
+
}));
|
|
63
|
+
return function getChild(_x) {
|
|
64
|
+
return _ref.apply(this, arguments);
|
|
65
|
+
};
|
|
66
|
+
}();
|
|
67
|
+
var fields = [{
|
|
68
|
+
field: {
|
|
69
|
+
type: 'id',
|
|
70
|
+
id: 'id',
|
|
71
|
+
hidden: true
|
|
72
|
+
}
|
|
73
|
+
}, [{
|
|
74
|
+
field: {
|
|
75
|
+
type: 'text',
|
|
76
|
+
id: 'id-1',
|
|
77
|
+
label: 'ID 1',
|
|
78
|
+
validation: {
|
|
79
|
+
fn: validateText
|
|
80
|
+
},
|
|
81
|
+
placeholder: 'example@email.com'
|
|
82
|
+
}
|
|
83
|
+
}, {
|
|
84
|
+
field: {
|
|
85
|
+
type: 'text',
|
|
86
|
+
id: 'id-2',
|
|
87
|
+
label: 'ID 2',
|
|
88
|
+
validation: {
|
|
89
|
+
fn: validateText
|
|
90
|
+
},
|
|
91
|
+
placeholder: 'example@email.com'
|
|
92
|
+
}
|
|
93
|
+
}], {
|
|
94
|
+
field: {
|
|
95
|
+
type: 'select',
|
|
96
|
+
id: 'category',
|
|
97
|
+
label: 'Category',
|
|
98
|
+
options: [{
|
|
99
|
+
name: 'Option 1',
|
|
100
|
+
value: '1'
|
|
101
|
+
}, {
|
|
102
|
+
name: 'Option 2',
|
|
103
|
+
value: '2'
|
|
104
|
+
}]
|
|
105
|
+
}
|
|
106
|
+
}, {
|
|
107
|
+
field: {
|
|
108
|
+
type: 'select',
|
|
109
|
+
id: 'subcategory',
|
|
110
|
+
label: 'Sub Category',
|
|
111
|
+
belongs_to: 'category',
|
|
112
|
+
populateOptions: getChild
|
|
113
|
+
}
|
|
114
|
+
}, {
|
|
115
|
+
field: {
|
|
116
|
+
type: 'textarea',
|
|
117
|
+
id: 'textarea',
|
|
118
|
+
label: 'Text Area',
|
|
119
|
+
placeholder: 'Set a description'
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// {
|
|
123
|
+
// field: {type: 'datepicker',
|
|
124
|
+
// id: 'datepicker',
|
|
125
|
+
// label: 'Date Picker'}
|
|
126
|
+
// }
|
|
127
|
+
];
|
|
128
|
+
return /*#__PURE__*/React.createElement(Form, _extends({}, args, {
|
|
129
|
+
type: "stepper",
|
|
130
|
+
fields: fields
|
|
131
|
+
}));
|
|
132
|
+
};
|
|
133
|
+
StepperForm.parameters = {
|
|
134
|
+
design: {
|
|
135
|
+
type: 'figma',
|
|
136
|
+
url: 'https://www.figma.com/file/vkIFRuwbONhF3qrGI7bHvL/App?node-id=2%3A129'
|
|
137
|
+
}
|
|
138
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Form } from "../../../components/Form";
|
|
3
|
+
import "../../../../../styles/index.css";
|
|
4
|
+
var loadPayload = function loadPayload() {
|
|
5
|
+
return console.log('Loading Payload');
|
|
6
|
+
};
|
|
7
|
+
var validateEmail = function validateEmail(mail) {
|
|
8
|
+
return /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail) ? true : false;
|
|
9
|
+
};
|
|
10
|
+
export default {
|
|
11
|
+
component: Form,
|
|
12
|
+
title: 'Data Handle / Form',
|
|
13
|
+
args: {
|
|
14
|
+
fields: [{
|
|
15
|
+
field: {
|
|
16
|
+
type: 'email',
|
|
17
|
+
id: 'email',
|
|
18
|
+
label: 'Email',
|
|
19
|
+
placeholder: 'example@email.com'
|
|
20
|
+
}
|
|
21
|
+
}, {
|
|
22
|
+
field: {
|
|
23
|
+
type: 'password',
|
|
24
|
+
id: 'password',
|
|
25
|
+
label: 'Password',
|
|
26
|
+
placeholder: 'Set you password'
|
|
27
|
+
}
|
|
28
|
+
}, {
|
|
29
|
+
field: {
|
|
30
|
+
type: 'textarea',
|
|
31
|
+
id: 'textarea',
|
|
32
|
+
label: 'Text Area',
|
|
33
|
+
placeholder: 'Set a description'
|
|
34
|
+
}
|
|
35
|
+
}, {
|
|
36
|
+
field: {
|
|
37
|
+
type: 'select',
|
|
38
|
+
id: 'select',
|
|
39
|
+
label: 'Select',
|
|
40
|
+
placeholder: 'select',
|
|
41
|
+
options: [{
|
|
42
|
+
name: 'Option 1',
|
|
43
|
+
id: 1
|
|
44
|
+
}, {
|
|
45
|
+
name: 'Option 2',
|
|
46
|
+
id: 2
|
|
47
|
+
}]
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
field: {
|
|
51
|
+
type: 'datepicker',
|
|
52
|
+
id: 'datepicker',
|
|
53
|
+
label: 'Date Picker'
|
|
54
|
+
}
|
|
55
|
+
}],
|
|
56
|
+
button: {
|
|
57
|
+
text: 'Submit',
|
|
58
|
+
variant: 'primary'
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
export var ValidateForm = function ValidateForm(args) {
|
|
63
|
+
return /*#__PURE__*/React.createElement(Form, args);
|
|
64
|
+
};
|
|
65
|
+
ValidateForm.parameters = {
|
|
66
|
+
design: {
|
|
67
|
+
type: 'figma',
|
|
68
|
+
url: 'https://www.figma.com/file/vkIFRuwbONhF3qrGI7bHvL/App?node-id=2%3A129'
|
|
69
|
+
}
|
|
70
|
+
};
|