@omniumretail/component-library 1.0.20 → 1.0.22

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/dist/main.css CHANGED
@@ -522,3 +522,163 @@
522
522
  .gER2xKwlnobsIz4BLhGJ[aria-checked=true] {
523
523
  background: var(--color-orange) !important;
524
524
  }
525
+ /*!*****************************************************************************************************************************************************************!*\
526
+ !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./node_modules/sass-loader/dist/cjs.js!./src/components/Category/styles.module.scss ***!
527
+ \*****************************************************************************************************************************************************************/
528
+ .lOKzfPUFf3ukLT2wGZaY {
529
+ display: grid;
530
+ grid-template-columns: 300px auto;
531
+ gap: 16px;
532
+ }
533
+
534
+ .OIrZOBn2f036M5MGzc61,
535
+ .adDQP_uvIYgNFVC4VdHj {
536
+ background: white;
537
+ padding: 20px;
538
+ }
539
+ /*!*********************************************************************************************************************************************************************************!*\
540
+ !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./node_modules/sass-loader/dist/cjs.js!./src/components/Category/CategorySidebar/styles.module.scss ***!
541
+ \*********************************************************************************************************************************************************************************/
542
+ .yBjbWkudwA_AOwhHrnlc .ant-tree-title {
543
+ font-weight: var(--font-weight-semibold);
544
+ }
545
+
546
+ .je000VEfsPqZupGr8ymu {
547
+ font-size: var(--font-size-body-4);
548
+ font-weight: 600;
549
+ line-height: 100%;
550
+ color: var(--color-blue);
551
+ text-transform: uppercase;
552
+ }
553
+
554
+ button {
555
+ margin-top: 32px;
556
+ width: 100%;
557
+ }
558
+
559
+ .tUDGWNXopUejF6zWJloy {
560
+ margin-top: 20px;
561
+ }
562
+ /*!*********************************************************************************************************************************************************************************!*\
563
+ !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./node_modules/sass-loader/dist/cjs.js!./src/components/Questions/SingleQuestion/styles.module.scss ***!
564
+ \*********************************************************************************************************************************************************************************/
565
+ .O0Juh2loT1HHb612gOA4 .ant-form-item {
566
+ margin-bottom: 0;
567
+ }
568
+ .O0Juh2loT1HHb612gOA4 .ant-space {
569
+ display: flex;
570
+ flex-direction: column;
571
+ gap: 12px;
572
+ border-bottom: 1px solid var(--color-blue);
573
+ padding: 16px 10px;
574
+ }
575
+ .O0Juh2loT1HHb612gOA4 .ant-space-item {
576
+ width: 100%;
577
+ }
578
+
579
+ .hg7oiINfKCZSUt6dEq4A {
580
+ display: none;
581
+ }
582
+
583
+ .BAso_dbeoowN7VtxWiKx {
584
+ display: grid;
585
+ grid-template-columns: minmax(18px, auto) 1fr 90px;
586
+ gap: 20px;
587
+ color: var(--color-black);
588
+ font-size: var(--font-size-body-4);
589
+ line-height: 100%;
590
+ font-weight: var(--font-weight-medium);
591
+ align-items: center;
592
+ }
593
+
594
+ .qg_bZXG9dQdJvLBRGuqw {
595
+ display: grid;
596
+ grid-template-columns: minmax(18px, auto) 1fr 90px;
597
+ gap: 20px;
598
+ color: var(--color-grey-dark);
599
+ font-size: var(--font-size-body-3);
600
+ align-items: center;
601
+ }
602
+
603
+ .y8UJFmCyGQzEQk4XjnI9 {
604
+ display: none;
605
+ }
606
+
607
+ .kknDal3CIbUXI7Lu2wPV {
608
+ display: flex;
609
+ align-items: center;
610
+ justify-content: flex-start;
611
+ gap: 20px;
612
+ }
613
+
614
+ .upuPapYjj1uGowukEEIi {
615
+ display: none;
616
+ align-items: center;
617
+ justify-content: center;
618
+ }
619
+
620
+ .KfrJPVKxY4b6bmXeJL5U {
621
+ display: flex;
622
+ align-items: center;
623
+ justify-content: center;
624
+ gap: 16px;
625
+ }
626
+
627
+ .zRPlv7rfSSACHPLZLs16,
628
+ .EHyxN8DmDHOLkQDROSV5,
629
+ .NLIlnBPfo09cpWYzpZ_J {
630
+ font-size: var(--font-size-body-5);
631
+ cursor: pointer;
632
+ }
633
+
634
+ .AHIc83P7PkYUr3no83sO {
635
+ margin-top: 24px;
636
+ }
637
+ /*!*********************************************************************************************************************************************************************************!*\
638
+ !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./node_modules/sass-loader/dist/cjs.js!./src/components/Category/CategoryContent/styles.module.scss ***!
639
+ \*********************************************************************************************************************************************************************************/
640
+ .vw302ajYc4_7bIROncyM {
641
+ font-size: var(--font-size-body-4);
642
+ font-weight: 600;
643
+ line-height: 100%;
644
+ color: var(--color-blue);
645
+ text-transform: uppercase;
646
+ margin-bottom: 32px;
647
+ }
648
+
649
+ .DrsaZTs1Ny6wZ76RwDR9 {
650
+ font-size: var(--font-size-body-2);
651
+ color: var(--color-black);
652
+ font-weight: 700;
653
+ text-transform: uppercase;
654
+ }
655
+
656
+ .HVSssNqaNxLcYT_1lxBL {
657
+ display: grid;
658
+ grid-template-columns: minmax(200px, 1fr) auto 1fr auto;
659
+ gap: 46px;
660
+ }
661
+
662
+ .ACPbYsV0wNkissVLHcFh {
663
+ margin-top: 16px;
664
+ }
665
+
666
+ Label {
667
+ margin-bottom: 8px;
668
+ }
669
+
670
+ .g19LZsD26yzPPjBtV31w .ant-select {
671
+ width: 100%;
672
+ }
673
+ .g19LZsD26yzPPjBtV31w .ant-select-selector {
674
+ border-color: rgba(var(--color-black-rgb), 0.5) !important;
675
+ height: 50px !important;
676
+ display: flex;
677
+ align-items: center;
678
+ }
679
+ .g19LZsD26yzPPjBtV31w .ant-select-arrow {
680
+ color: var(--color-black);
681
+ }
682
+ .g19LZsD26yzPPjBtV31w .ant-switch {
683
+ width: 30px;
684
+ }
@@ -0,0 +1,4 @@
1
+ import { Meta, Story } from "@storybook/react";
2
+ declare const _default: Meta<import("@storybook/react").Args>;
3
+ export default _default;
4
+ export declare const Primary: Story<any>;
@@ -0,0 +1,7 @@
1
+ interface categoryContent {
2
+ categoryContentShow: boolean;
3
+ categoryContentInfo: any;
4
+ categorySidebarData: any;
5
+ }
6
+ export declare const CategoryContent: (props: categoryContent) => JSX.Element;
7
+ export {};
@@ -0,0 +1,25 @@
1
+ export interface Questions {
2
+ grade: string;
3
+ questions: string;
4
+ info: string;
5
+ }
6
+ export interface Data {
7
+ categoryName: string;
8
+ generalEvaluationLevel: string;
9
+ grade: string;
10
+ openAnswer: boolean;
11
+ questions: Questions[];
12
+ }
13
+ export interface DataNode {
14
+ title: string;
15
+ key: string;
16
+ data?: Data;
17
+ children?: DataNode[];
18
+ }
19
+ interface SidebarProps {
20
+ categoryContentData: any;
21
+ categorySidebarInfo: any;
22
+ data: DataNode[];
23
+ }
24
+ export declare const CategorySidebar: (props: SidebarProps) => JSX.Element;
25
+ export {};
@@ -0,0 +1,6 @@
1
+ import { DataNode } from './CategorySidebar';
2
+ interface Category {
3
+ data: DataNode;
4
+ }
5
+ export declare const Category: (props: Category) => JSX.Element;
6
+ export {};
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SingleQuestion: ({ key, provided, snapshot, remove, name, ...restField }: any) => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const Questions: () => JSX.Element;
@@ -15,3 +15,4 @@ export * from './ModalConfirmation';
15
15
  export * from './ModalWithTable';
16
16
  export * from './Sidebar';
17
17
  export * from './Switch';
18
+ export * from './Category';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/component-library",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "private": false,
5
5
  "main": "dist/bundle.js",
6
6
  "typings": "./dist/types/index",
@@ -0,0 +1,14 @@
1
+ import { Meta, Story } from "@storybook/react";
2
+ import { Category } from '.';
3
+
4
+ export default {
5
+ title: 'Category',
6
+ component: Category,
7
+ } as Meta;
8
+
9
+ const Template: Story<any> = (args) => <Category {...args}></Category>;
10
+
11
+ export const Primary = Template.bind({});
12
+ Primary.args = {
13
+ };
14
+
@@ -0,0 +1,159 @@
1
+ import { Form, Select } from 'antd';
2
+ import { useForm } from 'antd/es/form/Form';
3
+ import { Button } from '../../Button';
4
+ import { InputField } from '../../Input';
5
+ import { Label } from '../../Label';
6
+ import { Questions } from '../../Questions';
7
+ import { Switch } from '../../Switch';
8
+ import { useEffect, useState } from 'react';
9
+ import styles from './styles.module.scss';
10
+
11
+ interface categoryContent {
12
+ categoryContentShow: boolean;
13
+ categoryContentInfo: any;
14
+ categorySidebarData: any;
15
+ }
16
+
17
+ const defaultInitialValues = {
18
+ generalEvaluationLevel: "0",
19
+ questions: []
20
+ };
21
+
22
+ export const CategoryContent = (props: categoryContent) => {
23
+ const {
24
+ categoryContentShow,
25
+ categorySidebarData
26
+ } = props;
27
+
28
+ const [contentInfo, setContentInfo] = useState<any>();
29
+ const [switchStatus, setSwitchStatus] = useState<boolean>(false);
30
+ const [initialValues, setInitialValues] = useState<any>(categorySidebarData?.data || defaultInitialValues)
31
+ const [form] = useForm();
32
+
33
+ const onFinish = (values: any) => {
34
+ setContentInfo(values);
35
+ };
36
+
37
+ const switchHandler = (enabled: boolean) => {
38
+ setSwitchStatus(enabled);
39
+ }
40
+
41
+ useEffect(() => {
42
+ props.categoryContentInfo(contentInfo);
43
+ }, [contentInfo]);
44
+
45
+ useEffect(() => {
46
+ setInitialValues(categorySidebarData?.data?.data);
47
+ }, [categorySidebarData]);
48
+
49
+ useEffect(() => {
50
+ form.setFieldsValue(initialValues);
51
+ }, [form, initialValues]);
52
+
53
+ return (
54
+ <div className={styles.categoryContent}>
55
+ <div className={styles.title}>Editar Categoria</div>
56
+
57
+ {
58
+ !categoryContentShow
59
+ ? <div className={styles.uncheckedCategory}>
60
+ Please Select a Category on the sidebar
61
+ </div>
62
+
63
+ : <>
64
+ <Form
65
+ initialValues={initialValues}
66
+ name="dynamic_form_nest_item"
67
+ onFinish={onFinish}
68
+ autoComplete="off"
69
+ form={form}
70
+ >
71
+ <div className={styles.formHeader}>
72
+ <div className={styles.category}>
73
+ <Label isUppercase>
74
+ Nome Categoria
75
+ </Label>
76
+ <Form.Item
77
+ name={['categoryName']}
78
+ rules={[{ required: true, message: 'Category Name is Missing' }]}
79
+ >
80
+ <InputField placeholder={'Category Name'} />
81
+ </Form.Item>
82
+ </div>
83
+
84
+ {!categorySidebarData?.data?.children?.length &&
85
+ <>
86
+ <div className={styles.openAnswer}>
87
+ <Label isUppercase>
88
+ Resposta aberta
89
+ </Label>
90
+ <Form.Item
91
+ name={['openAnswer']}
92
+ >
93
+ <Switch onChange={(enabled: boolean) => switchHandler(enabled)} />
94
+ </Form.Item>
95
+ </div>
96
+
97
+ {
98
+ !switchStatus &&
99
+ <>
100
+ <div className={styles.generalEvaluationLevel}>
101
+ <Label isUppercase>
102
+ Nivel de avaliação Geral
103
+ </Label>
104
+ <Form.Item
105
+ name={['generalEvaluationLevel']}
106
+ >
107
+ <Select options={[
108
+ {
109
+ value: '0',
110
+ label: '1 a 5',
111
+ },
112
+ {
113
+ value: '1',
114
+ label: '1 a 4',
115
+ },
116
+ {
117
+ value: '2',
118
+ label: '1 a 5 ou “Não Aplicável”',
119
+ },
120
+ ]}
121
+ />
122
+ </Form.Item>
123
+ </div>
124
+
125
+ <div className={styles.grade}>
126
+ <Label isUppercase>
127
+ Ponderação
128
+ </Label>
129
+ <Form.Item
130
+ name={['grade']}
131
+ rules={[{ required: true, message: 'Grade is Missing' }]}
132
+ >
133
+ <InputField placeholder={'EX: 15%'} />
134
+ </Form.Item>
135
+ </div>
136
+ </>
137
+ }
138
+ </>
139
+ }
140
+ </div>
141
+
142
+ {!categorySidebarData?.data?.children?.length &&
143
+ <div className={styles.questionsWrapper}>
144
+ <Label isUppercase>
145
+ Questões
146
+ </Label>
147
+ <Form.Item>
148
+ <Questions></Questions>
149
+ </Form.Item>
150
+ </div>
151
+ }
152
+ </Form>
153
+
154
+ <Button onClick={() => form.submit()}>Submit</Button>
155
+ </>
156
+ }
157
+ </div>
158
+ );
159
+ };
@@ -0,0 +1,51 @@
1
+ .title {
2
+ font-size: var(--font-size-body-4);
3
+ font-weight: 600;
4
+ line-height: 100%;
5
+ color: var(--color-blue);
6
+ text-transform: uppercase;
7
+ margin-bottom: 32px;
8
+ }
9
+
10
+ .uncheckedCategory {
11
+ font-size: var(--font-size-body-2);
12
+ color: var(--color-black);
13
+ font-weight: 700;
14
+ text-transform: uppercase;
15
+ }
16
+
17
+ .formHeader {
18
+ display: grid;
19
+ grid-template-columns: minmax(200px, 1fr) auto 1fr auto;
20
+ gap: 46px;
21
+ }
22
+
23
+ .questionsWrapper {
24
+ margin-top: 16px;
25
+ }
26
+
27
+ Label {
28
+ margin-bottom: 8px;
29
+ }
30
+
31
+ .categoryContent {
32
+ :global {
33
+ .ant-select {
34
+ width: 100%;
35
+ }
36
+
37
+ .ant-select-selector {
38
+ border-color: rgba(var(--color-black-rgb), .5) !important;
39
+ height: 50px !important;
40
+ display: flex;
41
+ align-items: center;
42
+ }
43
+ .ant-select-arrow {
44
+ color: var(--color-black);
45
+ }
46
+
47
+ .ant-switch {
48
+ width: 30px;
49
+ }
50
+ }
51
+ }