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.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/components/Avatar/Avatar.jsx +96 -0
  3. data/components/Avatar/styles.scss +54 -0
  4. data/components/Avatar/styles.scss.flow +14 -0
  5. data/components/Badge/Badge.jsx +40 -0
  6. data/components/Badge/badges.scss +167 -0
  7. data/components/Badge/labels.scss +121 -0
  8. data/components/Badge/styles.scss +4 -0
  9. data/components/Badge/styles.scss.flow +38 -0
  10. data/components/Banner/Banner.jsx +54 -0
  11. data/components/Banner/styles.scss +75 -0
  12. data/components/Banner/styles.scss.flow +19 -0
  13. data/components/Button/Button.jsx +75 -0
  14. data/components/Card/Card.jsx +44 -0
  15. data/components/CircleButton/CircleButton.jsx +51 -0
  16. data/components/CircleButton/CircleButtonStory.jsx +25 -0
  17. data/components/CircleButton/styles.scss +33 -0
  18. data/components/CircleButton/styles.scss.flow +6 -0
  19. data/components/CollapsibleCard/CollapsibleCard.jsx +108 -0
  20. data/components/Color/Color.jsx +55 -0
  21. data/components/Color/styles.scss +6 -0
  22. data/components/Color/styles.scss.flow +5 -0
  23. data/components/ColorPickerInput/ColorPickerInput.jsx +99 -0
  24. data/components/ColorPickerInput/colorPickerInput.scss +10 -0
  25. data/components/ColorPickerInput/colorPickerInput.scss.flow +6 -0
  26. data/components/DOBInput/index.jsx +35 -0
  27. data/components/DOBInput/story.jsx +20 -0
  28. data/components/DOBInput/styles.scss +11 -0
  29. data/components/DOBInput/styles.scss.flow +7 -0
  30. data/components/DatePicker/DatePicker.jsx +156 -0
  31. data/components/DatePicker/styles.scss +6 -0
  32. data/components/DatePicker/styles.scss.flow +5 -0
  33. data/components/DateTimePicker/DateTimePicker.jsx +109 -0
  34. data/components/DateTimePicker/story-styles.scss +3 -0
  35. data/components/DateTimePicker/story-styles.scss.flow +5 -0
  36. data/components/DateTimePicker/styles.scss +1 -0
  37. data/components/DateTimePicker/styles.scss.flow +5 -0
  38. data/components/Errors/Errors.jsx +38 -0
  39. data/components/FileCard/FileCard.jsx +183 -0
  40. data/components/FileCard/styles.scss +81 -0
  41. data/components/FileCard/styles.scss.flow +12 -0
  42. data/components/Flip/Flip.jsx +50 -0
  43. data/components/Flip/styles.scss +41 -0
  44. data/components/Flip/styles.scss.flow +11 -0
  45. data/components/FlyoutPanel/FlyoutPanel.jsx +34 -0
  46. data/components/FlyoutPanel/flyout_panel.scss +33 -0
  47. data/components/FlyoutPanel/flyout_panel.scss.flow +11 -0
  48. data/components/Grade/Grade.jsx +55 -0
  49. data/components/Grade/grade.scss +39 -0
  50. data/components/Grade/grade.scss.flow +6 -0
  51. data/components/Highlight/Highlight.jsx +39 -0
  52. data/components/Highlight/styles.scss +24 -0
  53. data/components/Highlight/styles.scss.flow +17 -0
  54. data/components/Icon/Icon.jsx +54 -0
  55. data/components/IconToggle/IconToggle.jsx +56 -0
  56. data/components/Milestones/MilestoneItem.jsx +47 -0
  57. data/components/Milestones/Milestones.jsx +51 -0
  58. data/components/Milestones/milestones.scss +19 -0
  59. data/components/Milestones/milestones.scss.flow +7 -0
  60. data/components/Milestones/milestones_item.scss +157 -0
  61. data/components/Milestones/milestones_item.scss.flow +13 -0
  62. data/components/Milestones/milestones_variables.scss +11 -0
  63. data/components/MonogramAvatar/MonogramAvatar.jsx +91 -0
  64. data/components/MonogramAvatar/monogram_avatar.scss +54 -0
  65. data/components/MonogramAvatar/monogram_avatar.scss.flow +10 -0
  66. data/components/Panel/Panel.jsx +159 -0
  67. data/components/Panel/panel.scss +32 -0
  68. data/components/Panel/panel.scss.flow +12 -0
  69. data/components/PanelGroup/PanelGroup.jsx +121 -0
  70. data/components/PanelGroup/PanelGroup.scss +96 -0
  71. data/components/PanelGroup/PanelGroup.scss.flow +6 -0
  72. data/components/SearchCollectionSelect/SearchCollectionSelect.jsx +29 -0
  73. data/components/SearchCollectionSelect/searchCollectionSelect.scss +0 -0
  74. data/components/Spinner/Spinner.jsx +80 -0
  75. data/components/Spinner/spinner.scss +6 -0
  76. data/components/Spinner/spinner.scss.flow +5 -0
  77. data/components/StepMeter/StepMeter.jsx +75 -0
  78. data/components/StepMeter/step_meter.scss +120 -0
  79. data/components/StepMeter/step_meter.scss.flow +9 -0
  80. data/components/Survey/Survey.jsx +190 -0
  81. data/components/Survey/survey.scss +75 -0
  82. data/components/Survey/survey.scss.flow +11 -0
  83. data/components/Tab/Tab.jsx +70 -0
  84. data/components/Tab/tab.scss +25 -0
  85. data/components/Tab/tab.scss.flow +6 -0
  86. data/components/TabList/TabList.jsx +35 -0
  87. data/components/TabList/tabList.scss +5 -0
  88. data/components/TabList/tabList.scss.flow +5 -0
  89. data/components/Text/Text.jsx +53 -0
  90. data/components/Text/styles.scss +3 -0
  91. data/components/Text/styles.scss.flow +123 -0
  92. data/components/Text/text.scss +35 -0
  93. data/components/TextInput/TextInput.jsx +95 -0
  94. data/components/TextInput/form-control.scss +96 -0
  95. data/components/TextInput/styles.scss +3 -0
  96. data/components/TextInput/styles.scss.flow +7 -0
  97. data/components/TimePicker/TimePicker.jsx +218 -0
  98. data/components/TimePicker/styles.scss +1 -0
  99. data/components/TimePicker/styles.scss.flow +5 -0
  100. data/components/ToggleButton/ToggleButton.jsx +68 -0
  101. data/components/ToggleButton/toggleButton.scss +70 -0
  102. data/components/ToggleButton/toggleButton.scss.flow +14 -0
  103. data/components/UserStamp/UserStamp.jsx +40 -0
  104. data/components/UserStamp/styles.scss +6 -0
  105. data/components/UserStamp/styles.scss.flow +7 -0
  106. data/components/Wip/Wip.jsx +34 -0
  107. data/components/index.js +33 -0
  108. data/components/types.js +21 -0
  109. data/lib/nitro_sg/version.rb +1 -1
  110. metadata +108 -1
@@ -0,0 +1,3 @@
1
+ @import "base-mixins/_all.scss";
2
+ @import "base-variables/_all.scss";
3
+ @import "form-control.scss";
@@ -0,0 +1,7 @@
1
+ // @flow
2
+ /* This file is automatically generated by css-modules-flow-types */
3
+ declare module.exports: {|
4
+ +'form-control': string;
5
+ +'hidden-xxs': string;
6
+ +'visible-xxs': string;
7
+ |};
@@ -0,0 +1,218 @@
1
+ import React from 'react'
2
+ import classnames from 'classnames'
3
+
4
+ import moment from 'moment'
5
+
6
+ import styles from './styles.scss'
7
+
8
+ type Props = {
9
+ className: string,
10
+ clock: 24 | 12,
11
+ disabled: boolean | "disabled",
12
+ multiGroup: boolean,
13
+ labelInside: boolean,
14
+ defaultValue: string | Object,
15
+ onChange: () => mixed,
16
+ required: boolean,
17
+ minHour: number,
18
+ maxHour: number,
19
+ }
20
+
21
+ export default class TimePicker extends React.Component<Props> {
22
+
23
+ static defaultProps = {
24
+ clock: 12,
25
+ disabled: false,
26
+ multiGroup: true,
27
+ labelInside: true,
28
+ defaultValue: moment().hour(0).minute(0),
29
+ minHour: 0,
30
+ maxHour: 24,
31
+ onChange: () => {},
32
+ }
33
+
34
+ state = {
35
+ hour: '',
36
+ minute: '',
37
+ }
38
+
39
+ componentWillMount() {
40
+ const {defaultValue} = this.props
41
+ const t = moment(defaultValue)
42
+ const hour = t.format('HH')
43
+ const minute = t.format('mm')
44
+ if(t.isValid()) {
45
+ this.setState({
46
+ hour,
47
+ minute,
48
+ })
49
+ this.handleTimeChange(hour, minute)
50
+ }
51
+ }
52
+
53
+ props: Props
54
+
55
+ handleTimeChange(hour, minute) {
56
+ if (hour == '' && minute == '') {
57
+ this.props.onChange('')
58
+ } else {
59
+ this.props.onChange(`${hour}:${minute}`)
60
+ }
61
+ }
62
+
63
+ handleOnHourChange = (e) => {
64
+ const hour = e.target.value
65
+ let minute = this.state.minute
66
+ if (hour != '' && minute == '') {
67
+ minute = '00'
68
+ } else if (hour == '') {
69
+ minute = ''
70
+ }
71
+ this.setState({hour, minute})
72
+ this.handleTimeChange(hour, minute)
73
+ }
74
+
75
+ handleOnMinutesChange = (e) => {
76
+ let minute = e.target.value
77
+ const hour = this.state.hour
78
+ if (hour != '' && minute == '') {
79
+ minute = '00'
80
+ }
81
+ this.setState({minute})
82
+ this.handleTimeChange(hour, minute)
83
+ }
84
+
85
+ renderHoursSelect() {
86
+ let options;
87
+ const { minHour, maxHour } = this.props
88
+ options = [<option key="ts-hr-option-no"/>]
89
+
90
+ for(let i = minHour; i < maxHour; ++i) {
91
+ const h = moment().hour(i)
92
+ options.push(
93
+ <option
94
+ key={`ts-hr-option-${i}`}
95
+ value={h.format('HH')}
96
+ >
97
+ <Choose>
98
+ <When condition={this.props.clock == 12}>
99
+ {h.format('ha')}
100
+ </When>
101
+ <Otherwise>
102
+ {h.format('HH')}
103
+ </Otherwise>
104
+ </Choose>
105
+ </option>
106
+ )
107
+ }
108
+
109
+ let props = {
110
+ className: "form-control",
111
+ onChange: this.handleOnHourChange,
112
+ value: this.state.hour,
113
+ }
114
+
115
+ if(this.props.required) props.required = "required"
116
+ if(this.props.disabled) props.disabled = "disabled"
117
+
118
+ return (
119
+ <select
120
+ {...props}
121
+ >
122
+ {options}
123
+ </select>
124
+ )
125
+ }
126
+
127
+ renderMinsSelect() {
128
+ let minutes = [<option key="ts-min-option-no"/>]
129
+ for(let i = 0; i < 60; ++i) {
130
+ const m = moment().minutes(i)
131
+ const padMins = m.format('mm')
132
+ minutes.push(
133
+ <option
134
+ key={`ts-min-option-${i}`}
135
+ value={padMins}
136
+ >
137
+ {`:${padMins}`}
138
+ </option>)
139
+ }
140
+
141
+ let props = {
142
+ className: "form-control",
143
+ onChange: this.handleOnMinutesChange,
144
+ value: this.state.minute,
145
+ disabled: this.state.hour == ''
146
+ }
147
+ if(this.props.required) props.required = "required"
148
+ if(this.props.disabled) props.disabled = "disabled"
149
+
150
+ return (
151
+ <select
152
+ {...props}
153
+ >
154
+ {minutes}
155
+ </select>
156
+ )
157
+ }
158
+
159
+ render() {
160
+ const {
161
+ className,
162
+ multiGroup,
163
+ labelInside,
164
+ required
165
+ } = this.props;
166
+
167
+ const wrapperCSS = [
168
+ multiGroup ? "multi-input-group" : "form-group",
169
+ className,
170
+ styles.timePicker,
171
+ ]
172
+
173
+ const itemCSS = [
174
+ "multi-input-group-item",
175
+ labelInside ? "label-inside" : null
176
+ ]
177
+
178
+ return (
179
+ <div className={classnames(wrapperCSS)}>
180
+ <If condition={multiGroup}>
181
+ <div className={classnames(itemCSS)}>
182
+ <label>
183
+ <If condition={required}>{`* `}</If>
184
+ {`Hour`}
185
+ </label>
186
+ {this.renderHoursSelect()}
187
+ </div>
188
+ <div className={classnames(itemCSS)}>
189
+ <label>
190
+ <If condition={required}>{`* `}</If>
191
+ {`Minutes`}
192
+ </label>
193
+ {this.renderMinsSelect()}
194
+ </div>
195
+ <Else/>
196
+ <div className="col-md-6">
197
+ <div className="form-group">
198
+ <label>
199
+ <If condition={required}>{`* `}</If>
200
+ {`Hour`}
201
+ </label>
202
+ {this.renderHoursSelect()}
203
+ </div>
204
+ </div>
205
+ <div className="col-md-6">
206
+ <div className="form-group">
207
+ <label>
208
+ <If condition={required}>{`* `}</If>
209
+ {`Minutes`}
210
+ </label>
211
+ {this.renderMinsSelect()}
212
+ </div>
213
+ </div>
214
+ </If>
215
+ </div>
216
+ )
217
+ }
218
+ }
@@ -0,0 +1 @@
1
+ .timePicker {}
@@ -0,0 +1,5 @@
1
+ // @flow
2
+ /* This file is automatically generated by css-modules-flow-types */
3
+ declare module.exports: {|
4
+
5
+ |};
@@ -0,0 +1,68 @@
1
+ /* @flow */
2
+
3
+ import React, { Component } from 'react'
4
+ import classnames from 'classnames'
5
+
6
+ type Props = {
7
+ active: boolean,
8
+ className?: string,
9
+ offLabel?: string,
10
+ onLabel?: string,
11
+ onToggle: () => mixed,
12
+ size?: 'small' | 'med' | 'large',
13
+ }
14
+
15
+ import styles from './toggleButton.scss'
16
+
17
+ export default class ToggleButton extends Component<Props> {
18
+ static defaultProps = {
19
+ active: false,
20
+ size: 'med',
21
+ onToggle: () => {},
22
+ }
23
+
24
+ props: Props
25
+
26
+ handleToggle = () => {
27
+ this.props.onToggle(!this.props.active)
28
+ }
29
+
30
+ render() {
31
+ const {
32
+ active,
33
+ className,
34
+ offLabel,
35
+ onLabel,
36
+ size,
37
+ } = this.props
38
+
39
+ const css = [
40
+ styles[`toggle-button-${size}`],
41
+ active ? styles[`toggle-button-${size}-active`] : null,
42
+ ]
43
+
44
+ return (
45
+ <div className={classnames(className, "clearfix", styles.root)}>
46
+ <div
47
+ className={classnames(css)}
48
+ onClick={this.handleToggle}
49
+ />
50
+ <If condition={offLabel && onLabel}>
51
+ <label
52
+ className={classnames(styles[`toggle-button-${size}-label`], styles[`toggle-button-${size}-label-${active ? 'active' : 'inactive'}`])}
53
+ onClick={this.handleToggle}
54
+ >
55
+ <If condition={active}>
56
+ <strong>
57
+ {onLabel}
58
+ </strong>
59
+ <Else/>
60
+ {offLabel}
61
+ </If>
62
+ </label>
63
+ </If>
64
+ </div>
65
+
66
+ )
67
+ }
68
+ }
@@ -0,0 +1,70 @@
1
+ @import "base-variables/_colors.scss";
2
+ @import "base-variables/_spacing.sass";
3
+ @import "base-variables/_typography.sass";
4
+
5
+ .root {
6
+ cursor: pointer;
7
+ }
8
+
9
+ .toggle-button {
10
+
11
+ @mixin toggle-btn($radius) {
12
+ $inactive: $gray-2;
13
+ $active: $power-green;
14
+ $offset: $radius / ($radius / 2);
15
+ border: 1px solid $inactive;
16
+ border-radius: $radius;
17
+ background: $inactive;
18
+ float: left;
19
+ margin-right: $space-base;
20
+ padding: $radius / 2;
21
+ position: relative;
22
+ width: $radius * 2;
23
+ transition-property: background border;
24
+ transition-duration: 0.5s;
25
+ &::before {
26
+ content: ' ';
27
+ cursor: pointer;
28
+ border-radius: $radius;
29
+ background: $white;
30
+ padding: ($radius / 2) - $offset;
31
+ position: absolute;
32
+ left: $offset + 0px;
33
+ top: $offset + 0px;
34
+ transition-property: all;
35
+ transition-duration: 0.5s;
36
+ }
37
+ &-active {
38
+ background: $active;
39
+ border: 1px solid $active;
40
+ &::before {
41
+ left: $radius;
42
+ }
43
+ }
44
+ }
45
+
46
+ $radius: 30px;
47
+
48
+ &-small {
49
+ @include toggle-btn($radius / 2);
50
+ &-label {
51
+ cursor: pointer;
52
+ font-size: $font-smaller;
53
+ }
54
+ }
55
+ &-med {
56
+ @include toggle-btn($radius);
57
+ &-label {
58
+ cursor: pointer;
59
+ margin-top: 5px;
60
+ }
61
+ }
62
+ &-large {
63
+ @include toggle-btn($radius * 2);
64
+ &-label {
65
+ cursor: pointer;
66
+ margin-top: 5px;
67
+ font-size: $font-larger;
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,14 @@
1
+ // @flow
2
+ /* This file is automatically generated by css-modules-flow-types */
3
+ declare module.exports: {|
4
+ +'root': string;
5
+ +'toggle-button-large': string;
6
+ +'toggle-button-large-active': string;
7
+ +'toggle-button-large-label': string;
8
+ +'toggle-button-med': string;
9
+ +'toggle-button-med-active': string;
10
+ +'toggle-button-med-label': string;
11
+ +'toggle-button-small': string;
12
+ +'toggle-button-small-active': string;
13
+ +'toggle-button-small-label': string;
14
+ |};
@@ -0,0 +1,40 @@
1
+ /* @flow */
2
+
3
+ import React from 'react'
4
+
5
+ import moment from 'moment'
6
+ import classnames from 'classnames'
7
+
8
+ import Avatar from '../Avatar/Avatar'
9
+ import Text from '../Text/Text'
10
+
11
+ import styles from './styles.scss'
12
+
13
+ type UserStampProps = {|
14
+ action: string,
15
+ date: string,
16
+ name: string,
17
+ thumbUrl: string,
18
+ |}
19
+
20
+ const DateFormat = 'MMM Do, YYYY'
21
+
22
+ const UserStamp = ({ thumbUrl, name, action, date }: UserStampProps) => (
23
+ <div className={classnames(styles['user-stamp'], 'mt-2')}>
24
+ <Avatar
25
+ size="smaller"
26
+ thumb={thumbUrl}
27
+ url={thumbUrl}
28
+ />
29
+ <div>
30
+ <p className={'m-0 ml-2 text-smaller text-meta-bold'}>
31
+ <Text color={'ink'}>{action} {moment(date).format(DateFormat)}</Text>
32
+ </p>
33
+ <p className='m-0 ml-2 text-smaller'>
34
+ <Text color={'ink-lighter'}>{`by ${name}`}</Text>
35
+ </p>
36
+ </div>
37
+ </div>
38
+ )
39
+
40
+ export default UserStamp
@@ -0,0 +1,6 @@
1
+ @import "base-mixins/_all.scss";
2
+ @import "base-variables/_all.scss";
3
+
4
+ .user-stamp {
5
+ display: flex;
6
+ }
@@ -0,0 +1,7 @@
1
+ // @flow
2
+ /* This file is automatically generated by css-modules-flow-types */
3
+ declare module.exports: {|
4
+ +'hidden-xxs': string;
5
+ +'user-stamp': string;
6
+ +'visible-xxs': string;
7
+ |};