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,19 @@
1
+ @import "./milestones_variables";
2
+
3
+ .milestones {
4
+ ul {
5
+ list-style: none;
6
+ position: relative;
7
+ padding: $space-small 0 0;
8
+ margin: $space-small 0 0;
9
+ text-align: center;
10
+
11
+ &::after {
12
+ content: '';
13
+ clear: both;
14
+ float: none;
15
+ display: block;
16
+ width: 100%;
17
+ }
18
+ }
19
+ }
@@ -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
+ +'milestones': string;
6
+ +'visible-xxs': string;
7
+ |};
@@ -0,0 +1,157 @@
1
+ @import "./milestones_variables";
2
+
3
+ .milestone-item {
4
+ position: relative;
5
+ vertical-align: top;
6
+ display: inline-block;
7
+ text-align: center;
8
+ padding: 0 $space-larger;
9
+ height: $step-progress-li-height;
10
+ line-height: $step-progress-bubble-height;
11
+
12
+
13
+ .milestone-item-label {
14
+ position: absolute;
15
+ bottom: 0;
16
+ left: 0;
17
+ width: 100%;
18
+ opacity: $opacity-5;
19
+ font-size: $font-small;
20
+ white-space: nowrap;
21
+ overflow: hidden;
22
+ text-overflow: ellipsis;
23
+ }
24
+
25
+ .icon {
26
+ position: absolute;
27
+ top: 10px;
28
+ left: 0;
29
+ width: 100%;
30
+ font-size: $font-small;
31
+ }
32
+
33
+
34
+ &::before {
35
+ content: '';
36
+ display: block;
37
+ text-align: center;
38
+ position: relative;
39
+ z-index: 1;
40
+ font-family: $icon-font;
41
+ font-size: $font-small;
42
+ width: $step-progress-bubble-height;
43
+ height: $step-progress-bubble-height;
44
+ border: $step-progress-line-height solid $ink-lightest;
45
+ border-radius: $step-progress-bubble-height/2;
46
+ line-height: calc(#{$step-progress-bubble-height} - (#{$step-progress-line-height} * 2));
47
+ font-weight: $bold;
48
+ margin: 0 auto $space-smaller;
49
+ }
50
+ &::after {
51
+ content: '';
52
+ position: absolute;
53
+ width: calc(100% - (#{$step-progress-bubble-height} - #{$step-progress-line-height}));
54
+ height: $step-progress-line-height;
55
+ top: calc((#{$step-progress-bubble-height}/2) - (#{$step-progress-line-height}/2));
56
+ left: calc(-50% + (#{$step-progress-bubble-height}/2));
57
+ z-index: 0;
58
+ }
59
+ &:first-child {
60
+ &::after {
61
+ display: none;
62
+ }
63
+ }
64
+
65
+ &::before {
66
+ background: transparent;
67
+ }
68
+
69
+ &.status-{
70
+ &done {
71
+ &::before {
72
+ border-color: $power-green !important;
73
+ }
74
+ .icon {
75
+ color: $power-green !important;
76
+ }
77
+ }
78
+ &started {
79
+ .milestone-item-label {
80
+ opacity: 1;
81
+ }
82
+ &::before {
83
+ border-color: $power-blue !important;
84
+ }
85
+ .icon {
86
+ color: $power-blue !important;
87
+ }
88
+ }
89
+ }
90
+
91
+ &.background-dark {
92
+ .milestone-item-label {
93
+ color: $bg-dark-text;
94
+ }
95
+
96
+ &::before {
97
+ background: $bg-dark-color;
98
+ color: $bg-dark-text;
99
+ }
100
+ &::after {
101
+ background: $bg-dark-color;
102
+ }
103
+
104
+ &.status-{
105
+ &done {
106
+ &::before {
107
+ background: transparent;
108
+ }
109
+ &::after {
110
+ background: $power-green;
111
+ }
112
+ }
113
+ &started {
114
+ &::before {
115
+ background: transparent;
116
+ }
117
+ &::after {
118
+ background: $power-blue;
119
+ }
120
+ }
121
+ }
122
+ }
123
+
124
+ &.background-light {
125
+ .milestone-item-label {
126
+ color: $bg-light-text;
127
+ }
128
+
129
+ &::before {
130
+ background: $bg-light-color;
131
+ border-color: $bg-light-color;
132
+ color: $bg-light-text;
133
+ }
134
+ &::after {
135
+ background: $bg-light-color;
136
+ }
137
+
138
+ &.status-{
139
+ &done {
140
+ &::before {
141
+ background: transparent;
142
+ }
143
+ &::after {
144
+ background: $power-green;
145
+ }
146
+ }
147
+ &started {
148
+ &::before {
149
+ background: transparent;
150
+ }
151
+ &::after {
152
+ background: $power-blue;
153
+ }
154
+ }
155
+ }
156
+ }
157
+ }
@@ -0,0 +1,13 @@
1
+ // @flow
2
+ /* This file is automatically generated by css-modules-flow-types */
3
+ declare module.exports: {|
4
+ +'background-dark': string;
5
+ +'background-light': string;
6
+ +'hidden-xxs': string;
7
+ +'icon': string;
8
+ +'milestone-item': string;
9
+ +'milestone-item-label': string;
10
+ +'status-done': string;
11
+ +'status-started': string;
12
+ +'visible-xxs': string;
13
+ |};
@@ -0,0 +1,11 @@
1
+ @import "base-mixins/_all.scss";
2
+ @import "base-variables/_all.scss";
3
+
4
+ $step-progress-li-height: 70px;
5
+ $step-progress-bubble-height: 34px;
6
+ $step-progress-line-height: 4px;
7
+
8
+ $bg-light-color: $sky;
9
+ $bg-light-text: $ink;
10
+ $bg-dark-color: $ink-lightest;
11
+ $bg-dark-text: $white;
@@ -0,0 +1,91 @@
1
+ /* @flow */
2
+
3
+ import React from 'react'
4
+ import classnames from 'classnames'
5
+ import { isEmpty, map } from 'lodash'
6
+
7
+ import styles from './monogram_avatar.scss'
8
+
9
+ import Avatar from '../Avatar/Avatar'
10
+ import type AvatarSize from '../Avatar/Avatar'
11
+
12
+ type Props = {
13
+ border: boolean,
14
+ className: string,
15
+ personName: string,
16
+ size: AvatarSize,
17
+ url: string,
18
+ }
19
+
20
+ type State = {
21
+ showInitials: boolean
22
+ }
23
+
24
+ const initials = function(name: string): string {
25
+ if (!name) {
26
+ return <i className="fa fa-user" />
27
+ }
28
+ return map(name.split(/\s/), name => name[0]).join('').substring(0,2)
29
+ }
30
+
31
+ class MonogramAvatar extends React.Component<Props, State> {
32
+ static defaultProps = {
33
+ border: true,
34
+ size: 'base'
35
+ }
36
+ constructor(props: Props) {
37
+ super(props)
38
+ this.state = { showInitials: false }
39
+ }
40
+
41
+ state: State
42
+
43
+ componentWillReceiveProps(nextProps) {
44
+ this.setState({ showInitials: isEmpty(nextProps.url) })
45
+ }
46
+
47
+ props: Props
48
+
49
+ handleImageLoadError = () => {
50
+ this.setState({ showInitials: true })
51
+ }
52
+
53
+ render() {
54
+ const {
55
+ url,
56
+ className,
57
+ personName,
58
+ size,
59
+ border,
60
+ } = this.props
61
+
62
+ const classes = [
63
+ className,
64
+ styles['monogram-avatar'],
65
+ (this.state.showInitials ? styles['initials'] : null),
66
+ (border ? styles['with-border'] : null),
67
+ ]
68
+
69
+ return (
70
+ <div className={classnames(classes, styles[`monogram-avatar-${size}`])}>
71
+ <Choose>
72
+ <When condition={!this.state.showInitials}>
73
+ <Avatar
74
+ alt={personName}
75
+ disableLink
76
+ onError={this.handleImageLoadError}
77
+ showPopover={false}
78
+ size={size}
79
+ thumb={url}
80
+ />
81
+ </When>
82
+ <Otherwise>
83
+ <p>{initials(personName)}</p>
84
+ </Otherwise>
85
+ </Choose>
86
+ </div>
87
+ )
88
+ }
89
+ }
90
+
91
+ export default MonogramAvatar
@@ -0,0 +1,54 @@
1
+ @import "base-variables/_colors.scss";
2
+ @import "base-variables/_typography.sass";
3
+
4
+ .monogram-avatar {
5
+
6
+ @mixin monogram-avatar($size, $border-width, $font-scale-factor) {
7
+ color: $white;
8
+ display: inline-block;
9
+ font-size: $size * $font-scale-factor;
10
+ height: $size;
11
+ line-height: $size;
12
+ overflow: hidden;
13
+ width: $size;
14
+ img, p {
15
+ background: $ink-lightest;
16
+ text-align: center;
17
+ border-radius: $border-width;
18
+ }
19
+ &.with-border {
20
+ border-color: $white;
21
+ border-radius: $border-width;
22
+ border-style: solid;
23
+ border-width: $border-width;
24
+ line-height: $size - (2 * $border-width);
25
+ img, p {
26
+ border-radius: 0;
27
+ }
28
+ img {
29
+ margin-left: -$border-width;
30
+ margin-top: -$border-width;
31
+ }
32
+ }
33
+ }
34
+
35
+ &-smaller {
36
+ @include monogram-avatar(30px, 2px, 0.4);
37
+ }
38
+
39
+ &-small {
40
+ @include monogram-avatar(60px, 2px, 0.32);
41
+ }
42
+
43
+ &-base {
44
+ @include monogram-avatar(90px, 4px, 0.32)
45
+ }
46
+
47
+ &-large {
48
+ @include monogram-avatar(115px, 4px, 0.32)
49
+ }
50
+
51
+ &-larger {
52
+ @include monogram-avatar(197px, 6px, 0.32)
53
+ }
54
+ }
@@ -0,0 +1,10 @@
1
+ // @flow
2
+ /* This file is automatically generated by css-modules-flow-types */
3
+ declare module.exports: {|
4
+ +'monogram-avatar-base': string;
5
+ +'monogram-avatar-large': string;
6
+ +'monogram-avatar-larger': string;
7
+ +'monogram-avatar-small': string;
8
+ +'monogram-avatar-smaller': string;
9
+ +'with-border': string;
10
+ |};
@@ -0,0 +1,159 @@
1
+ /* @flow */
2
+
3
+ import React, { Component } from 'react'
4
+ import classnames from 'classnames'
5
+ import { isEmpty } from 'lodash'
6
+ import FontAwesome from 'react-fontawesome'
7
+ import Text from '../Text/Text'
8
+
9
+ type Props = {
10
+ bodyClass?: string,
11
+ children: Array<Component>,
12
+ className?: string,
13
+ collapsed?: boolean,
14
+ collapsible?: boolean,
15
+ headingLinks?: Array<Component>,
16
+ title?: string,
17
+ titleIcon?: string,
18
+ subTitle?: string,
19
+ }
20
+
21
+ import styles from './panel.scss'
22
+
23
+ export default class Panel extends Component<Props> {
24
+ static defaultProps = {
25
+ className: "panel-default",
26
+ collapsed: false,
27
+ collapsible: false,
28
+ }
29
+
30
+ state = {
31
+ collapsed: false,
32
+ }
33
+
34
+ componentWillMount() {
35
+ this.setState({collapsed: this.props.collapsed})
36
+ }
37
+
38
+ props: Props
39
+
40
+ renderHeadingLinks() {
41
+ const {
42
+ headingLinks,
43
+ } = this.props
44
+ if(!headingLinks) return null
45
+ return (
46
+ <div className="panel-links">
47
+ {headingLinks.map()}
48
+ </div>
49
+ )
50
+ }
51
+
52
+ renderHeadingTitle() {
53
+ const {
54
+ title,
55
+ titleIcon,
56
+ subTitle,
57
+ } = this.props
58
+ return (
59
+ <h3 className={classnames("panel-title", styles["panel-title"])}>
60
+ <If condition={titleIcon}>
61
+ <FontAwesome
62
+ className={classnames("mr-3 ml-4", styles.icon)}
63
+ name={titleIcon}
64
+ />
65
+ </If>
66
+ <div>
67
+ <Text
68
+ bold
69
+ className={titleIcon ? styles[`${subTitle ? 'panel-title-main-subtitled' : 'panel-title-main'}`] : null}
70
+ size="large"
71
+ >
72
+ {title}
73
+ </Text>
74
+ <If condition={subTitle}>
75
+ <Text
76
+ className={classnames("clearfix", styles["panel-title-subtitle"])}
77
+ size="smallest"
78
+ >
79
+ {subTitle}
80
+ </Text>
81
+ </If>
82
+ </div>
83
+ </h3>
84
+ )
85
+ }
86
+
87
+ renderToggle() {
88
+ const {collapsed} = this.state
89
+ return (
90
+ <FontAwesome
91
+ className={styles.toggle}
92
+ name={`chevron-circle-${collapsed ? 'down' : 'up'}`}
93
+ />
94
+ )
95
+ }
96
+
97
+ renderBody() {
98
+ const {
99
+ children,
100
+ collapsible,
101
+ bodyClass,
102
+ } = this.props
103
+
104
+ if (collapsible && this.state.collapsed) return
105
+
106
+ return (
107
+ <div className={classnames("panel-body", bodyClass)}>
108
+ {children}
109
+ </div>
110
+ )
111
+ }
112
+
113
+ render() {
114
+ const {
115
+ className,
116
+ collapsible,
117
+ title,
118
+ headingLinks,
119
+ } = this.props
120
+
121
+ const {
122
+ collapsed,
123
+ } = this.state
124
+
125
+ const css = [
126
+ styles.panel,
127
+ "panel",
128
+ collapsed ? styles["panel-collapsed"] : null,
129
+ collapsible ? styles["panel-collapsible"] : null,
130
+ className,
131
+ ]
132
+
133
+ const toggleCollapsed = () => {
134
+ this.setState({collapsed: !this.state.collapsed})
135
+ }
136
+
137
+ return (
138
+ <div className={classnames(css)}>
139
+ <If condition={!isEmpty(title) || !isEmpty(headingLinks)}>
140
+ <div
141
+ className="panel-heading clearfix"
142
+ onClick={toggleCollapsed}
143
+ >
144
+ <div className={`p-0 ${collapsible ? 'col-xs-6 col-sm-6 col-md-6' : 'col-sm-12 col-md-12'}`}>
145
+ {this.renderHeadingLinks()}
146
+ {this.renderHeadingTitle()}
147
+ </div>
148
+ <If condition={collapsible}>
149
+ <div className="p-0 col-md-6 text-right">
150
+ {this.renderToggle()}
151
+ </div>
152
+ </If>
153
+ </div>
154
+ </If>
155
+ {this.renderBody()}
156
+ </div>
157
+ )
158
+ }
159
+ }