nitro_sg 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/components/Avatar/Avatar.jsx +96 -0
- data/components/Avatar/styles.scss +54 -0
- data/components/Avatar/styles.scss.flow +14 -0
- data/components/Badge/Badge.jsx +40 -0
- data/components/Badge/badges.scss +167 -0
- data/components/Badge/labels.scss +121 -0
- data/components/Badge/styles.scss +4 -0
- data/components/Badge/styles.scss.flow +38 -0
- data/components/Banner/Banner.jsx +54 -0
- data/components/Banner/styles.scss +75 -0
- data/components/Banner/styles.scss.flow +19 -0
- data/components/Button/Button.jsx +75 -0
- data/components/Card/Card.jsx +44 -0
- data/components/CircleButton/CircleButton.jsx +51 -0
- data/components/CircleButton/CircleButtonStory.jsx +25 -0
- data/components/CircleButton/styles.scss +33 -0
- data/components/CircleButton/styles.scss.flow +6 -0
- data/components/CollapsibleCard/CollapsibleCard.jsx +108 -0
- data/components/Color/Color.jsx +55 -0
- data/components/Color/styles.scss +6 -0
- data/components/Color/styles.scss.flow +5 -0
- data/components/ColorPickerInput/ColorPickerInput.jsx +99 -0
- data/components/ColorPickerInput/colorPickerInput.scss +10 -0
- data/components/ColorPickerInput/colorPickerInput.scss.flow +6 -0
- data/components/DOBInput/index.jsx +35 -0
- data/components/DOBInput/story.jsx +20 -0
- data/components/DOBInput/styles.scss +11 -0
- data/components/DOBInput/styles.scss.flow +7 -0
- data/components/DatePicker/DatePicker.jsx +156 -0
- data/components/DatePicker/styles.scss +6 -0
- data/components/DatePicker/styles.scss.flow +5 -0
- data/components/DateTimePicker/DateTimePicker.jsx +109 -0
- data/components/DateTimePicker/story-styles.scss +3 -0
- data/components/DateTimePicker/story-styles.scss.flow +5 -0
- data/components/DateTimePicker/styles.scss +1 -0
- data/components/DateTimePicker/styles.scss.flow +5 -0
- data/components/Errors/Errors.jsx +38 -0
- data/components/FileCard/FileCard.jsx +183 -0
- data/components/FileCard/styles.scss +81 -0
- data/components/FileCard/styles.scss.flow +12 -0
- data/components/Flip/Flip.jsx +50 -0
- data/components/Flip/styles.scss +41 -0
- data/components/Flip/styles.scss.flow +11 -0
- data/components/FlyoutPanel/FlyoutPanel.jsx +34 -0
- data/components/FlyoutPanel/flyout_panel.scss +33 -0
- data/components/FlyoutPanel/flyout_panel.scss.flow +11 -0
- data/components/Grade/Grade.jsx +55 -0
- data/components/Grade/grade.scss +39 -0
- data/components/Grade/grade.scss.flow +6 -0
- data/components/Highlight/Highlight.jsx +39 -0
- data/components/Highlight/styles.scss +24 -0
- data/components/Highlight/styles.scss.flow +17 -0
- data/components/Icon/Icon.jsx +54 -0
- data/components/IconToggle/IconToggle.jsx +56 -0
- data/components/Milestones/MilestoneItem.jsx +47 -0
- data/components/Milestones/Milestones.jsx +51 -0
- data/components/Milestones/milestones.scss +19 -0
- data/components/Milestones/milestones.scss.flow +7 -0
- data/components/Milestones/milestones_item.scss +157 -0
- data/components/Milestones/milestones_item.scss.flow +13 -0
- data/components/Milestones/milestones_variables.scss +11 -0
- data/components/MonogramAvatar/MonogramAvatar.jsx +91 -0
- data/components/MonogramAvatar/monogram_avatar.scss +54 -0
- data/components/MonogramAvatar/monogram_avatar.scss.flow +10 -0
- data/components/Panel/Panel.jsx +159 -0
- data/components/Panel/panel.scss +32 -0
- data/components/Panel/panel.scss.flow +12 -0
- data/components/PanelGroup/PanelGroup.jsx +121 -0
- data/components/PanelGroup/PanelGroup.scss +96 -0
- data/components/PanelGroup/PanelGroup.scss.flow +6 -0
- data/components/SearchCollectionSelect/SearchCollectionSelect.jsx +29 -0
- data/components/SearchCollectionSelect/searchCollectionSelect.scss +0 -0
- data/components/Spinner/Spinner.jsx +80 -0
- data/components/Spinner/spinner.scss +6 -0
- data/components/Spinner/spinner.scss.flow +5 -0
- data/components/StepMeter/StepMeter.jsx +75 -0
- data/components/StepMeter/step_meter.scss +120 -0
- data/components/StepMeter/step_meter.scss.flow +9 -0
- data/components/Survey/Survey.jsx +190 -0
- data/components/Survey/survey.scss +75 -0
- data/components/Survey/survey.scss.flow +11 -0
- data/components/Tab/Tab.jsx +70 -0
- data/components/Tab/tab.scss +25 -0
- data/components/Tab/tab.scss.flow +6 -0
- data/components/TabList/TabList.jsx +35 -0
- data/components/TabList/tabList.scss +5 -0
- data/components/TabList/tabList.scss.flow +5 -0
- data/components/Text/Text.jsx +53 -0
- data/components/Text/styles.scss +3 -0
- data/components/Text/styles.scss.flow +123 -0
- data/components/Text/text.scss +35 -0
- data/components/TextInput/TextInput.jsx +95 -0
- data/components/TextInput/form-control.scss +96 -0
- data/components/TextInput/styles.scss +3 -0
- data/components/TextInput/styles.scss.flow +7 -0
- data/components/TimePicker/TimePicker.jsx +218 -0
- data/components/TimePicker/styles.scss +1 -0
- data/components/TimePicker/styles.scss.flow +5 -0
- data/components/ToggleButton/ToggleButton.jsx +68 -0
- data/components/ToggleButton/toggleButton.scss +70 -0
- data/components/ToggleButton/toggleButton.scss.flow +14 -0
- data/components/UserStamp/UserStamp.jsx +40 -0
- data/components/UserStamp/styles.scss +6 -0
- data/components/UserStamp/styles.scss.flow +7 -0
- data/components/Wip/Wip.jsx +34 -0
- data/components/index.js +33 -0
- data/components/types.js +21 -0
- data/lib/nitro_sg/version.rb +1 -1
- metadata +108 -1
@@ -0,0 +1,120 @@
|
|
1
|
+
@import "base-variables/_colors.scss";
|
2
|
+
@import "base-variables/_spacing.sass";
|
3
|
+
@import "base-variables/_border-radius.sass";
|
4
|
+
@import "base-variables/_typography.sass";
|
5
|
+
|
6
|
+
$step-size-sm: 10px;
|
7
|
+
|
8
|
+
.step-meter {
|
9
|
+
list-style-type: none;
|
10
|
+
padding: 0 $space-base;
|
11
|
+
margin: 0;
|
12
|
+
|
13
|
+
li {
|
14
|
+
background: $sky;
|
15
|
+
border-radius: $border-rad-heavy*2;
|
16
|
+
color: $ink-light;
|
17
|
+
font-size: $font-smallest - 1;
|
18
|
+
font-weight: 400;
|
19
|
+
display: inline-block;
|
20
|
+
height: 18px;
|
21
|
+
line-height: 20px;
|
22
|
+
margin: 0 $space-small;
|
23
|
+
min-width: 75px;
|
24
|
+
padding: 0 $space-smallest;
|
25
|
+
position: relative;
|
26
|
+
text-align: center;
|
27
|
+
text-transform: uppercase;
|
28
|
+
|
29
|
+
&::before {
|
30
|
+
content: '';
|
31
|
+
background: $sky;
|
32
|
+
position: absolute;
|
33
|
+
height: 4px;
|
34
|
+
left: -14px;
|
35
|
+
right: 0;
|
36
|
+
top: calc(50% - 2px);
|
37
|
+
width: 14px;
|
38
|
+
}
|
39
|
+
|
40
|
+
&:first-child {
|
41
|
+
&::before {
|
42
|
+
display: none;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
&.done,
|
47
|
+
&.done::before {
|
48
|
+
background: $power-blue;
|
49
|
+
}
|
50
|
+
&.started,
|
51
|
+
&.started::before {
|
52
|
+
background: $power-blue;
|
53
|
+
}
|
54
|
+
&.error,
|
55
|
+
&.error::before {
|
56
|
+
background: $power-red;
|
57
|
+
}
|
58
|
+
|
59
|
+
&.done,
|
60
|
+
&.started,
|
61
|
+
&.error {
|
62
|
+
color: white;
|
63
|
+
}
|
64
|
+
|
65
|
+
span {
|
66
|
+
&:first-child {
|
67
|
+
margin-right: $space-smallest/2;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
&.type-simple {
|
73
|
+
width: 100%;
|
74
|
+
display: flex;
|
75
|
+
|
76
|
+
li {
|
77
|
+
min-width: auto;
|
78
|
+
height: 10px;
|
79
|
+
line-height: 10px;
|
80
|
+
flex-grow: 1;
|
81
|
+
margin: 0;
|
82
|
+
background: transparent !important;
|
83
|
+
|
84
|
+
span {
|
85
|
+
display: none;
|
86
|
+
}
|
87
|
+
|
88
|
+
&::before {
|
89
|
+
height: 2px;
|
90
|
+
top: calc(50% - 1px);
|
91
|
+
left: calc(-50% + 5px);
|
92
|
+
width: calc(100% - 10px);
|
93
|
+
}
|
94
|
+
&::after {
|
95
|
+
content: '';
|
96
|
+
position: absolute;
|
97
|
+
top: 0;
|
98
|
+
left: calc(50% - 5px);
|
99
|
+
width: $step-size-sm;
|
100
|
+
height: $step-size-sm;
|
101
|
+
border-radius: $step-size-sm/2;
|
102
|
+
background-color: $sky;
|
103
|
+
border: 2px solid $sky;
|
104
|
+
}
|
105
|
+
|
106
|
+
&.done::after, &.done::before {
|
107
|
+
background: $online-green;
|
108
|
+
border-color: $online-green;
|
109
|
+
}
|
110
|
+
&.error::after, &.error::before {
|
111
|
+
background: $power-red;
|
112
|
+
border-color: $power-red;
|
113
|
+
}
|
114
|
+
&.started::after {
|
115
|
+
background: transparent;
|
116
|
+
border-color: $power-blue;
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}
|
@@ -0,0 +1,190 @@
|
|
1
|
+
/* @flow */
|
2
|
+
|
3
|
+
import React from 'react'
|
4
|
+
|
5
|
+
import classnames from 'classnames'
|
6
|
+
import styles from './survey.scss'
|
7
|
+
|
8
|
+
import {
|
9
|
+
Errors,
|
10
|
+
Spinner,
|
11
|
+
} from '..'
|
12
|
+
|
13
|
+
import { SurveyQuestions } from '../types'
|
14
|
+
|
15
|
+
import {
|
16
|
+
Button,
|
17
|
+
Icon,
|
18
|
+
Panel,
|
19
|
+
} from '../index'
|
20
|
+
|
21
|
+
type Props = {
|
22
|
+
canSubmit?: boolean,
|
23
|
+
dismissable?: boolean,
|
24
|
+
errors: Array<string>,
|
25
|
+
loading?: boolean,
|
26
|
+
onChange: () => mixed,
|
27
|
+
onDismiss: () => mixed,
|
28
|
+
onSubmit: () => mixed,
|
29
|
+
questions: SurveyQuestions,
|
30
|
+
submitting: boolean,
|
31
|
+
}
|
32
|
+
|
33
|
+
export default class Survey extends React.Component<Props> {
|
34
|
+
static defaultProps = {
|
35
|
+
canSubmit: true,
|
36
|
+
dismissable: true,
|
37
|
+
errors: [],
|
38
|
+
loading: false,
|
39
|
+
modal: false,
|
40
|
+
onChange: function(){},
|
41
|
+
onDismiss: function(){},
|
42
|
+
onSubmit: function(){},
|
43
|
+
questions: [],
|
44
|
+
submitting: false,
|
45
|
+
}
|
46
|
+
props: Props
|
47
|
+
|
48
|
+
handleOnSubmit = (e) => {
|
49
|
+
e.preventDefault();
|
50
|
+
this.props.onSubmit();
|
51
|
+
}
|
52
|
+
|
53
|
+
handleOnChange(qaIdx) {
|
54
|
+
this.props.onChange(...qaIdx)
|
55
|
+
}
|
56
|
+
|
57
|
+
renderHeader() {
|
58
|
+
const {
|
59
|
+
errors,
|
60
|
+
} = this.props
|
61
|
+
return (
|
62
|
+
<div>
|
63
|
+
<If condition={errors && errors.length}>
|
64
|
+
<Errors messages={errors} />
|
65
|
+
</If>
|
66
|
+
</div>
|
67
|
+
)
|
68
|
+
}
|
69
|
+
renderBody() {
|
70
|
+
const {
|
71
|
+
questions,
|
72
|
+
submitting,
|
73
|
+
} = this.props
|
74
|
+
const css = classnames([
|
75
|
+
'panel-default',
|
76
|
+
styles.surveyQuestion,
|
77
|
+
])
|
78
|
+
|
79
|
+
if(!questions.length) return null
|
80
|
+
|
81
|
+
return (
|
82
|
+
<ol className={styles['survey-question-list']}>
|
83
|
+
{questions.map((q, i) =>
|
84
|
+
(
|
85
|
+
<li
|
86
|
+
className={styles['survey-question']}
|
87
|
+
key={`question-li-${i}`}
|
88
|
+
>
|
89
|
+
<Panel
|
90
|
+
className={css}
|
91
|
+
flush
|
92
|
+
key={`question-${i}`}
|
93
|
+
title={q.question}
|
94
|
+
>
|
95
|
+
<ul className={styles['survey-question-answer-list']}>
|
96
|
+
{q.answers.map((answer, x) => {
|
97
|
+
let otherProps = {
|
98
|
+
onChange: this.handleOnChange.bind(this, [i, x]),
|
99
|
+
}
|
100
|
+
if(submitting) otherProps.disabled = true
|
101
|
+
if(answer.selected) otherProps.checked = true
|
102
|
+
|
103
|
+
return (
|
104
|
+
<li
|
105
|
+
className={styles['survey-question-answer']}
|
106
|
+
key={`question-${i}-answer-${x}-li`}
|
107
|
+
>
|
108
|
+
<label>
|
109
|
+
<input
|
110
|
+
name={`question-${i}-answer`}
|
111
|
+
type="radio"
|
112
|
+
defaultValue={answer.value}
|
113
|
+
{...otherProps}
|
114
|
+
/>
|
115
|
+
<span>
|
116
|
+
{answer.label}
|
117
|
+
</span>
|
118
|
+
</label>
|
119
|
+
</li>
|
120
|
+
)
|
121
|
+
})}
|
122
|
+
</ul>
|
123
|
+
</Panel>
|
124
|
+
</li>
|
125
|
+
)
|
126
|
+
)}
|
127
|
+
</ol>
|
128
|
+
)
|
129
|
+
}
|
130
|
+
renderFooter() {
|
131
|
+
const {
|
132
|
+
canSubmit,
|
133
|
+
submitting,
|
134
|
+
} = this.props
|
135
|
+
|
136
|
+
let props = {
|
137
|
+
text: submitting ? "Submitting Answers" : "Submit Answers",
|
138
|
+
type: submitting ? "" : "submit",
|
139
|
+
}
|
140
|
+
if(!canSubmit || submitting) props.disabled = true
|
141
|
+
props.className = classnames([
|
142
|
+
"btn-primary",
|
143
|
+
styles.submit,
|
144
|
+
])
|
145
|
+
if(submitting) {
|
146
|
+
props.icon = (
|
147
|
+
<Icon
|
148
|
+
className="mr-3 fa-spin"
|
149
|
+
name="spinner"
|
150
|
+
spin
|
151
|
+
/>
|
152
|
+
)
|
153
|
+
}
|
154
|
+
|
155
|
+
return (
|
156
|
+
<Button {...props} />
|
157
|
+
)
|
158
|
+
}
|
159
|
+
renderLoading() {
|
160
|
+
return (
|
161
|
+
<div className={styles.overlay}>
|
162
|
+
<Spinner
|
163
|
+
position="centered"
|
164
|
+
/>
|
165
|
+
</div>
|
166
|
+
)
|
167
|
+
}
|
168
|
+
render() {
|
169
|
+
const {
|
170
|
+
loading,
|
171
|
+
questions,
|
172
|
+
} = this.props
|
173
|
+
|
174
|
+
return (
|
175
|
+
<form
|
176
|
+
className={styles.survey}
|
177
|
+
onSubmit={this.handleOnSubmit}
|
178
|
+
>
|
179
|
+
<div>
|
180
|
+
<If condition={loading}>{this.renderLoading()}</If>
|
181
|
+
{this.renderHeader()}
|
182
|
+
<If condition={questions.length > 0}>
|
183
|
+
{this.renderBody()}
|
184
|
+
{this.renderFooter()}
|
185
|
+
</If>
|
186
|
+
</div>
|
187
|
+
</form>
|
188
|
+
)
|
189
|
+
}
|
190
|
+
}
|
@@ -0,0 +1,75 @@
|
|
1
|
+
@import "base-variables/_spacing.sass";
|
2
|
+
@import "base-variables/_colors.scss";
|
3
|
+
@import "base-variables/_typography.sass";
|
4
|
+
|
5
|
+
.overlay {
|
6
|
+
background: transparent;
|
7
|
+
position: absolute;
|
8
|
+
left: 0;
|
9
|
+
right: 0;
|
10
|
+
bottom: 0;
|
11
|
+
top: 0;
|
12
|
+
z-index: 10;
|
13
|
+
& > div {
|
14
|
+
& > span {
|
15
|
+
background: transparent;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
.survey {
|
21
|
+
position: relative;
|
22
|
+
padding: $space-larger;
|
23
|
+
background: transparent;
|
24
|
+
&-question {
|
25
|
+
list-style: none;
|
26
|
+
counter-increment: step-counter;
|
27
|
+
display: flex;
|
28
|
+
flex: 5;
|
29
|
+
& > div {
|
30
|
+
flex: 20;
|
31
|
+
}
|
32
|
+
&::before {
|
33
|
+
content: counter(step-counter);
|
34
|
+
font-size: $font-largest;
|
35
|
+
flex: 1;
|
36
|
+
margin-top: $space-base;
|
37
|
+
}
|
38
|
+
&-answer {
|
39
|
+
list-style-type: none;
|
40
|
+
border-bottom: 1px solid $gray-2;
|
41
|
+
padding: $space-smaller $space-large 0 $space-large;
|
42
|
+
&:last-child {
|
43
|
+
border: none;
|
44
|
+
}
|
45
|
+
&-list {
|
46
|
+
margin: 0;
|
47
|
+
padding: 0;
|
48
|
+
}
|
49
|
+
label {
|
50
|
+
cursor: pointer;
|
51
|
+
}
|
52
|
+
input[type='radio'] {
|
53
|
+
& + span {
|
54
|
+
font-weight: $regular;
|
55
|
+
color: $ink-lightest;
|
56
|
+
}
|
57
|
+
&:checked {
|
58
|
+
& + span {
|
59
|
+
color: $ink;
|
60
|
+
font-weight: $bold;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
margin-right: $space-base;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
&-list {
|
67
|
+
margin: 0;
|
68
|
+
padding: 0;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
.submit {
|
74
|
+
margin-left: 5%;
|
75
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
// @flow
|
2
|
+
/* This file is automatically generated by css-modules-flow-types */
|
3
|
+
declare module.exports: {|
|
4
|
+
+'overlay': string;
|
5
|
+
+'submit': string;
|
6
|
+
+'survey': string;
|
7
|
+
+'survey-question': string;
|
8
|
+
+'survey-question-answer': string;
|
9
|
+
+'survey-question-answer-list': string;
|
10
|
+
+'survey-question-list': string;
|
11
|
+
|};
|
@@ -0,0 +1,70 @@
|
|
1
|
+
/* @flow */
|
2
|
+
|
3
|
+
import React, { Component } from 'react'
|
4
|
+
import classnames from 'classnames'
|
5
|
+
|
6
|
+
import Icon from '../Icon/Icon'
|
7
|
+
|
8
|
+
export type TabType = {
|
9
|
+
active: boolean,
|
10
|
+
className?: string,
|
11
|
+
href?: string,
|
12
|
+
icon?: string,
|
13
|
+
onClick?: () => mixed,
|
14
|
+
target?: '_blank' | '_top',
|
15
|
+
text: string,
|
16
|
+
}
|
17
|
+
|
18
|
+
import styles from './tab.scss'
|
19
|
+
|
20
|
+
export default class Tab extends Component<TabType> {
|
21
|
+
props: TabType
|
22
|
+
|
23
|
+
renderIcon() {
|
24
|
+
const { icon } = this.props
|
25
|
+
if (icon) return (<Icon name={icon} />)
|
26
|
+
return null
|
27
|
+
}
|
28
|
+
|
29
|
+
render() {
|
30
|
+
const {
|
31
|
+
active,
|
32
|
+
className,
|
33
|
+
href,
|
34
|
+
onClick,
|
35
|
+
target,
|
36
|
+
text,
|
37
|
+
} = this.props
|
38
|
+
|
39
|
+
const css = [
|
40
|
+
"tab",
|
41
|
+
styles.tab,
|
42
|
+
active ? styles[`tab-active`] : null,
|
43
|
+
className,
|
44
|
+
]
|
45
|
+
|
46
|
+
return (
|
47
|
+
<Choose>
|
48
|
+
<When condition={href}>
|
49
|
+
<a
|
50
|
+
className={classnames(css)}
|
51
|
+
href={href}
|
52
|
+
target={target}
|
53
|
+
>
|
54
|
+
{ this.renderIcon() }
|
55
|
+
{text}
|
56
|
+
</a>
|
57
|
+
</When>
|
58
|
+
<When condition={!href}>
|
59
|
+
<div
|
60
|
+
className={classnames(css)}
|
61
|
+
onClick={onClick}
|
62
|
+
>
|
63
|
+
{ this.renderIcon() }
|
64
|
+
{text}
|
65
|
+
</div>
|
66
|
+
</When>
|
67
|
+
</Choose>
|
68
|
+
)
|
69
|
+
}
|
70
|
+
}
|