@pareto-engineering/design-system 5.2.0 → 5.3.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.
Files changed (80) hide show
  1. package/dist/cjs/a/Charts/AreaChart/AreaChart.js +61 -5
  2. package/dist/cjs/a/Charts/AreaChart/styles.scss +22 -0
  3. package/dist/cjs/a/Charts/BarChart/BarChart.js +1 -0
  4. package/dist/cjs/a/Charts/Common/CustomLegend/CustomLegend.js +23 -5
  5. package/dist/cjs/a/Charts/Common/CustomLegend/styles.scss +10 -2
  6. package/dist/cjs/a/Charts/Common/CustomTooltipContent/CustomTooltipContent.js +139 -42
  7. package/dist/cjs/a/Charts/Common/CustomTooltipContent/styles.scss +4 -0
  8. package/dist/cjs/a/Charts/PieChart/PieChart.js +39 -8
  9. package/dist/cjs/a/Charts/PieChart/styles.scss +88 -0
  10. package/dist/cjs/a/HamburgerButton/styles.scss +151 -9
  11. package/dist/cjs/a/ThroughPutIndicator/ThroughPutIndicator.js +78 -0
  12. package/dist/cjs/a/ThroughPutIndicator/index.js +13 -0
  13. package/dist/cjs/a/ThroughPutIndicator/styles.scss +35 -0
  14. package/dist/cjs/a/ToggleSwitch/ToggleSwitch.js +2 -1
  15. package/dist/cjs/a/ToggleSwitch/styles.scss +9 -2
  16. package/dist/cjs/a/Tooltip/Tooltip.js +19 -2
  17. package/dist/cjs/a/Tooltip/styles.scss +32 -4
  18. package/dist/cjs/a/XMLEditor/XMLEditor.js +4 -1
  19. package/dist/cjs/a/index.js +8 -1
  20. package/dist/cjs/f/FormInput/FormInput.js +7 -1
  21. package/dist/cjs/f/fields/ToggleInput/ToggleInput.js +126 -0
  22. package/dist/cjs/f/fields/ToggleInput/index.js +13 -0
  23. package/dist/cjs/f/fields/ToggleInput/styles.scss +22 -0
  24. package/dist/cjs/f/fields/index.js +8 -1
  25. package/dist/cjs/utils/formatting.js +27 -18
  26. package/dist/cjs/utils/index.js +6 -0
  27. package/dist/es/a/Charts/AreaChart/AreaChart.js +62 -6
  28. package/dist/es/a/Charts/AreaChart/styles.scss +22 -0
  29. package/dist/es/a/Charts/BarChart/BarChart.js +1 -0
  30. package/dist/es/a/Charts/Common/CustomLegend/CustomLegend.js +23 -5
  31. package/dist/es/a/Charts/Common/CustomLegend/styles.scss +10 -2
  32. package/dist/es/a/Charts/Common/CustomTooltipContent/CustomTooltipContent.js +128 -40
  33. package/dist/es/a/Charts/Common/CustomTooltipContent/styles.scss +4 -0
  34. package/dist/es/a/Charts/PieChart/PieChart.js +39 -8
  35. package/dist/es/a/Charts/PieChart/styles.scss +88 -0
  36. package/dist/es/a/HamburgerButton/styles.scss +151 -9
  37. package/dist/es/a/ThroughPutIndicator/ThroughPutIndicator.js +66 -0
  38. package/dist/es/a/ThroughPutIndicator/index.js +2 -0
  39. package/dist/es/a/ThroughPutIndicator/styles.scss +35 -0
  40. package/dist/es/a/ToggleSwitch/ToggleSwitch.js +2 -1
  41. package/dist/es/a/ToggleSwitch/styles.scss +9 -2
  42. package/dist/es/a/Tooltip/Tooltip.js +31 -12
  43. package/dist/es/a/Tooltip/styles.scss +32 -4
  44. package/dist/es/a/XMLEditor/XMLEditor.js +6 -3
  45. package/dist/es/a/index.js +2 -1
  46. package/dist/es/f/FormInput/FormInput.js +8 -2
  47. package/dist/es/f/fields/ToggleInput/ToggleInput.js +116 -0
  48. package/dist/es/f/fields/ToggleInput/index.js +2 -0
  49. package/dist/es/f/fields/ToggleInput/styles.scss +22 -0
  50. package/dist/es/f/fields/index.js +2 -1
  51. package/dist/es/utils/formatting.js +25 -17
  52. package/dist/es/utils/index.js +1 -1
  53. package/package.json +7 -6
  54. package/src/ui/a/Charts/AreaChart/AreaChart.jsx +74 -9
  55. package/src/ui/a/Charts/AreaChart/styles.scss +22 -0
  56. package/src/ui/a/Charts/BarChart/BarChart.jsx +1 -0
  57. package/src/ui/a/Charts/Common/CustomLegend/CustomLegend.jsx +26 -3
  58. package/src/ui/a/Charts/Common/CustomLegend/styles.scss +10 -2
  59. package/src/ui/a/Charts/Common/CustomTooltipContent/CustomTooltipContent.jsx +132 -48
  60. package/src/ui/a/Charts/Common/CustomTooltipContent/styles.scss +4 -0
  61. package/src/ui/a/Charts/PieChart/PieChart.jsx +54 -16
  62. package/src/ui/a/Charts/PieChart/styles.scss +88 -0
  63. package/src/ui/a/HamburgerButton/styles.scss +151 -9
  64. package/src/ui/a/ThroughPutIndicator/ThroughPutIndicator.jsx +90 -0
  65. package/src/ui/a/ThroughPutIndicator/index.js +2 -0
  66. package/src/ui/a/ThroughPutIndicator/styles.scss +35 -0
  67. package/src/ui/a/ToggleSwitch/ToggleSwitch.jsx +1 -1
  68. package/src/ui/a/ToggleSwitch/styles.scss +9 -2
  69. package/src/ui/a/Tooltip/Tooltip.jsx +55 -26
  70. package/src/ui/a/Tooltip/styles.scss +32 -4
  71. package/src/ui/a/XMLEditor/XMLEditor.jsx +15 -2
  72. package/src/ui/a/index.js +1 -0
  73. package/src/ui/f/FormInput/FormInput.jsx +11 -0
  74. package/src/ui/f/fields/ToggleInput/ToggleInput.jsx +140 -0
  75. package/src/ui/f/fields/ToggleInput/index.js +2 -0
  76. package/src/ui/f/fields/ToggleInput/styles.scss +22 -0
  77. package/src/ui/f/fields/index.js +1 -0
  78. package/src/ui/utils/formatting.js +38 -29
  79. package/src/ui/utils/index.js +1 -1
  80. package/tests/__snapshots__/Storyshots.test.js.snap +433 -160
@@ -14,6 +14,64 @@ const baseClassName = styleNames.base
14
14
 
15
15
  const componentClassName = 'custom-tooltip-content'
16
16
 
17
+ const formatValue = (value, isTimeFormat) => {
18
+ if (isTimeFormat) {
19
+ return formatTime(value)
20
+ }
21
+
22
+ if (typeof value === 'number') {
23
+ return Number.isInteger(value) ? value : value.toFixed(2)
24
+ }
25
+
26
+ return value
27
+ }
28
+
29
+ const PayoutPieChartLabel = ({ entry, formatLabelValue }) => (
30
+ <div className="pie-chart-label">
31
+ <div className="status">
32
+ <span
33
+ className="dot"
34
+ style={{ backgroundColor: entry?.payload?.color }}
35
+ />
36
+ <p className="label" key={`${entry.name}`} style={{ color: entry.color, textTransform: 'capitalize' }}>
37
+ {`${snakeCaseToTitleCase(entry.name)} `}
38
+ </p>
39
+ </div>
40
+ <p className="value">
41
+ {`${formatLabelValue(entry.value)}`}
42
+ </p>
43
+ </div>
44
+ )
45
+
46
+ const StandardPieChartLabel = ({ entry, formatLabelValue }) => (
47
+ <>
48
+ <p>Submissions</p>
49
+ <div className="pie-chart-label">
50
+ <div className="status">
51
+ <span
52
+ className="dot"
53
+ style={{ backgroundColor: entry?.payload?.color }}
54
+ />
55
+ <p className="label" key={`${entry.name}`} style={{ color: entry.color, textTransform: 'capitalize' }}>
56
+ {`${snakeCaseToTitleCase(entry.name)} `}
57
+ </p>
58
+ </div>
59
+ <p className="value">
60
+ {`${formatLabelValue(entry.value)}`}
61
+ </p>
62
+ <p className="percentage-title">
63
+ {`${entry?.payload?.percentage}%`}
64
+ </p>
65
+ </div>
66
+ </>
67
+ )
68
+
69
+ const StandardChartLabel = ({ entry, formatLabelValue }) => (
70
+ <p className="label" key={`${entry.name}`} style={{ color: entry.color, textTransform: 'capitalize' }}>
71
+ {`${snakeCaseToTitleCase(entry.name)}: ${formatLabelValue(entry.value)}`}
72
+ </p>
73
+ )
74
+
17
75
  const CustomTooltipContent = ({
18
76
  id,
19
77
  className: userClassName,
@@ -23,95 +81,121 @@ const CustomTooltipContent = ({
23
81
  active,
24
82
  payload,
25
83
  label,
84
+ isPieChart,
85
+ isPayOutChart,
26
86
  }) => {
27
- const formatLabelValue = (value) => {
28
- if (isTimeFormat) {
29
- return formatTime(value)
87
+ const formatLabelValue = React.useCallback(
88
+ (value) => formatValue(value, isTimeFormat),
89
+ [isTimeFormat],
90
+ )
91
+
92
+ const renderContent = React.useCallback((entry) => {
93
+ if (isPieChart && isPayOutChart) {
94
+ return <PayoutPieChartLabel entry={entry} formatLabelValue={formatLabelValue} />
30
95
  }
31
96
 
32
- if (typeof value === 'number') {
33
- if (Number.isInteger(value)) return value
34
- return value.toFixed(2)
97
+ if (isPieChart) {
98
+ return <StandardPieChartLabel entry={entry} formatLabelValue={formatLabelValue} />
35
99
  }
36
100
 
37
- return value
38
- }
101
+ return <StandardChartLabel entry={entry} formatLabelValue={formatLabelValue} />
102
+ }, [isPieChart, isPayOutChart, formatLabelValue])
39
103
 
40
- if (active && payload && payload.length) {
41
- const newPayload = payload.filter((item) => item.name !== 'bounds')
42
- return (
43
- <div
44
- id={id}
45
- className={[
46
- baseClassName,
47
- componentClassName,
48
- userClassName,
49
- ]
50
- .filter((e) => e)
51
- .join(' ')}
52
- >
53
- <p className="label">
54
- {isDateValue ? formatDate(label, dateFormat) : label}
55
- </p>
56
- {newPayload.map((entry) => (
57
- <p className="label" key={`${entry.name}`} style={{ color: entry.color, textTransform: 'capitalize' }}>
58
- {`${snakeCaseToTitleCase(entry.name)}: ${formatLabelValue(entry.value)}`}
59
- </p>
60
- ))}
61
- </div>
62
- )
104
+ if (!active || !payload || !payload.length) {
105
+ return null
63
106
  }
64
- return null
107
+
108
+ const filteredPayload = payload.filter((item) => item?.name !== 'bounds')
109
+
110
+ return (
111
+ <div
112
+ id={id}
113
+ className={[
114
+ baseClassName,
115
+ componentClassName,
116
+ userClassName,
117
+ ]
118
+ .filter(Boolean)
119
+ .join(' ')}
120
+ >
121
+ <p className="label">
122
+ {isDateValue ? formatDate(label, dateFormat) : label}
123
+ </p>
124
+ {filteredPayload.map((entry) => (
125
+ <React.Fragment key={entry.name || entry.dataKey}>
126
+ {renderContent(entry)}
127
+ </React.Fragment>
128
+ ))}
129
+ </div>
130
+ )
65
131
  }
66
132
 
67
133
  CustomTooltipContent.propTypes = {
68
134
  /**
69
- * The id of the dropdown component.
70
- */
135
+ * The id of the tooltip component
136
+ */
71
137
  id:PropTypes.string,
72
138
 
73
139
  /**
74
- * Additional class names for the dropdown component.
140
+ * Additional class names for the tooltip component
75
141
  */
76
142
  className:PropTypes.string,
77
143
 
78
144
  /**
79
- * Flag on whether it is a timeformat or not
145
+ * Flag indicating whether values should be formatted as time
80
146
  */
81
147
  isTimeFormat:PropTypes.bool,
82
148
 
83
149
  /**
84
- * The type of format for the datetime value
150
+ * The format to use for date values
85
151
  */
86
152
  dateFormat:PropTypes.oneOf(Object.values(DATE_FORMATS)),
87
153
 
88
154
  /**
89
- * Flag on whether the label is a date value or not
155
+ * Flag indicating whether the label is a date value
90
156
  */
91
157
  isDateValue:PropTypes.bool,
92
158
 
93
159
  /**
94
- * If set true, the tooltip is displayed.
95
- * If set false, the tooltip is hidden, usually calculated internally.
160
+ * If true, the tooltip is displayed
96
161
  */
97
162
  active:PropTypes.bool.isRequired,
98
163
 
99
164
  /**
100
- * The source data of the content to be displayed in the tooltip,
101
- * always calculated internally and cannot be user set.
165
+ * The source data to be displayed in the tooltip
102
166
  */
103
- payload:PropTypes.arrayOf(PropTypes.string).isRequired,
167
+ payload:PropTypes.arrayOf(PropTypes.shape({
168
+ name :PropTypes.string,
169
+ value :PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
170
+ payload:PropTypes.shape({}),
171
+ dataKey:PropTypes.string,
172
+ color :PropTypes.string,
173
+ })).isRequired,
104
174
 
105
175
  /**
106
- *The label value which is active now, usually calculated internally.
176
+ * The label value which is active
107
177
  */
108
178
  label:PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
179
+
180
+ /**
181
+ * Flag indicating whether the chart is a pie chart
182
+ */
183
+ isPieChart:PropTypes.bool,
184
+
185
+ /**
186
+ * Flag indicating whether the chart is a payout chart
187
+ */
188
+ isPayOutChart:PropTypes.bool,
109
189
  }
110
190
 
111
191
  CustomTooltipContent.defaultProps = {
112
- isTimeFormat:false,
113
- isDateValue :true,
114
- dateFormat :DATE_FORMATS.HUMAN_READABLE,
192
+ id :undefined,
193
+ className :undefined,
194
+ isTimeFormat :false,
195
+ isDateValue :true,
196
+ dateFormat :DATE_FORMATS.HUMAN_READABLE,
197
+ isPieChart :false,
198
+ isPayOutChart:false,
115
199
  }
116
200
 
117
- export default CustomTooltipContent
201
+ export default React.memo(CustomTooltipContent)
@@ -5,6 +5,9 @@ $default-padding: 1rem;
5
5
  $default-text-font-size: calc(var(--s-1) * 1rem);
6
6
  $default-border-radius: .25rem;
7
7
  $default-border-line-width: .0625rem;
8
+ $default-legend-dot-width: .5rem;
9
+ $default-legend-dot-height: .5rem;
10
+ $default-legend-dot-margin-right: .3125rem;
8
11
 
9
12
  .#{bem.$base} {
10
13
  &.custom-tooltip-content {
@@ -20,3 +23,4 @@ $default-border-line-width: .0625rem;
20
23
  }
21
24
  }
22
25
  }
26
+
@@ -32,14 +32,19 @@ const PieChart = ({
32
32
  width,
33
33
  innerRadius,
34
34
  outerRadius,
35
+ formatTotal,
36
+ subtitleToCurrency,
37
+ isPayOutChart,
35
38
  }) => {
36
39
  const total = data.reduce((sum, item) => sum + item[valueKey], 0)
37
40
 
41
+ const displayTotal = formatTotal ? formatTotal(total) : `${total}`
42
+
38
43
  const formattedData = data.map((item) => ({
39
44
  ...item,
40
45
  label :item[labelKey],
41
46
  color :colors[data.indexOf(item)],
42
- percentage:((item[valueKey] / total) * 100).toFixed(0),
47
+ percentage:total === 0 ? 0.0 : ((item[valueKey] / total) * 100).toFixed(0),
43
48
  }))
44
49
 
45
50
  return (
@@ -78,16 +83,43 @@ const PieChart = ({
78
83
  />
79
84
  ))}
80
85
  </Pie>
81
- <Tooltip content={<CustomTooltipContent isDateValue={false} />} />
86
+ <Tooltip
87
+ content={(
88
+ <CustomTooltipContent
89
+ isDateValue={false}
90
+ isPieChart
91
+ isPayOutChart={isPayOutChart}
92
+ />
93
+ )}
94
+ />
95
+
96
+ <text
97
+ x="50%"
98
+ y="50%"
99
+ textAnchor="middle"
100
+ dominantBaseline="middle"
101
+ style={{
102
+ }}
103
+ >
104
+ <tspan x="50%" dy="-1.2em" fontSize="14" fill="grey">
105
+ Total
106
+ </tspan>
107
+ <tspan x="50%" dy="1.2em" fill="var(--heading)" fontSize="22">
108
+ {displayTotal}
109
+ </tspan>
110
+ </text>
82
111
  </RechartsPieChart>
83
112
  </ResponsiveContainer>
84
113
  <CustomLegend
114
+ key={id}
85
115
  colorsArray={colors}
86
116
  yKeysArray={formattedData}
87
117
  capitalizedLegend
88
118
  orientation="vertical"
89
119
  getLegendItemTitle={(entry) => entry[labelKey]}
90
120
  getLegendItemSubtitle={(entry) => entry[valueKey]}
121
+ subtitleToCurrency={subtitleToCurrency}
122
+ isPayOutChart={isPayOutChart}
91
123
  />
92
124
  </div>
93
125
  </div>
@@ -103,23 +135,29 @@ PieChart.propTypes = {
103
135
  PropTypes.number,
104
136
  ]),
105
137
  })).isRequired,
106
- title :PropTypes.string.isRequired,
107
- valueKey :PropTypes.string.isRequired,
108
- labelKey :PropTypes.string.isRequired,
109
- colors :PropTypes.arrayOf(PropTypes.string).isRequired,
110
- height :PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
111
- width :PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
112
- innerRadius:PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
113
- outerRadius:PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
138
+ title :PropTypes.string.isRequired,
139
+ valueKey :PropTypes.string.isRequired,
140
+ labelKey :PropTypes.string.isRequired,
141
+ colors :PropTypes.arrayOf(PropTypes.string).isRequired,
142
+ height :PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
143
+ width :PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
144
+ innerRadius :PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
145
+ outerRadius :PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
146
+ formatTotal :PropTypes.func,
147
+ subtitleToCurrency:PropTypes.bool,
148
+ isPayOutChart :PropTypes.bool,
114
149
  }
115
150
 
116
151
  PieChart.defaultProps = {
117
- id :undefined,
118
- className :undefined,
119
- width :'100%',
120
- height :300,
121
- innerRadius:'0%',
122
- outerRadius:'100%',
152
+ id :undefined,
153
+ className :undefined,
154
+ width :'100%',
155
+ height :300,
156
+ innerRadius :'50%',
157
+ outerRadius :'100%',
158
+ formatTotal :null,
159
+ subtitleToCurrency:false,
160
+ isPayOutChart :false,
123
161
  }
124
162
 
125
163
  export default PieChart
@@ -3,7 +3,11 @@
3
3
  $default-margin: 1rem;
4
4
  $default-padding: 1rem;
5
5
  $default-box-shadow: 0 .25rem .75rem var(--ui-lines);
6
+ $soft-box-shadow: 0 .25rem 1rem var(--soft-shadow);
6
7
  $default-text-font-size: calc(var(--s-1) * 1rem);
8
+ $default-legend-dot-width: .75rem;
9
+ $default-legend-dot-height: .75rem;
10
+ $default-legend-dot-margin-right: .3125rem;
7
11
 
8
12
  .#{bem.$base} {
9
13
  &.pie-chart {
@@ -13,6 +17,90 @@ $default-text-font-size: calc(var(--s-1) * 1rem);
13
17
  margin: $default-margin 0;
14
18
  padding: $default-padding;
15
19
 
20
+ .custom-legend {
21
+ .item {
22
+ padding-top: 0;
23
+ }
24
+
25
+ .title .dot {
26
+ height: $default-legend-dot-height;
27
+ width: $default-legend-dot-width;
28
+ }
29
+
30
+ .title .text {
31
+ font-size: calc($default-text-font-size * 1.5);
32
+ }
33
+
34
+ .sub-title-percentage-container {
35
+ align-items: center;
36
+ display: flex;
37
+ gap: .8rem;
38
+ margin-left: .5rem;
39
+ width: fit-content;
40
+ }
41
+
42
+ .sub-title-percentage-container .sub-title {
43
+ font-size: calc($default-text-font-size * 1.25);
44
+ }
45
+
46
+ .sub-title-percentage-container .percentage-title {
47
+ font-size: calc($default-text-font-size * 1);
48
+ }
49
+ }
50
+
51
+ .custom-tooltip-content {
52
+ box-shadow: $soft-box-shadow;
53
+
54
+ p {
55
+ color: var(--hard-paragraph);
56
+ font-size: calc($default-text-font-size * .8);
57
+ font-weight: 600;
58
+ margin: 0;
59
+ }
60
+
61
+ .pie-chart-label {
62
+ align-items: center;
63
+ display: flex;
64
+ gap: 1.25rem;
65
+ justify-content: flex-start;
66
+
67
+ .status {
68
+ align-items: center;
69
+ display: flex;
70
+ gap: .1rem;
71
+ }
72
+
73
+ .label {
74
+ color: var(--hard-paragraph);
75
+ font-size: calc($default-text-font-size * 1);
76
+ font-weight: 600;
77
+ text-transform: capitalize;
78
+ }
79
+
80
+ .dot {
81
+ border-radius: 50%;
82
+ display: inline-block;
83
+ height: $default-legend-dot-height;
84
+ margin-right: $default-legend-dot-margin-right;
85
+ width: $default-legend-dot-width;
86
+ }
87
+
88
+ .value {
89
+ color: var(--hard-paragraph);
90
+ font-size: calc($default-text-font-size * 1);
91
+ font-weight: 600;
92
+ text-transform: capitalize;
93
+ }
94
+
95
+ .percentage-title {
96
+ color: var(--soft-paragraph);
97
+ font-size: calc($default-text-font-size * 1);
98
+ font-weight: 300;
99
+ text-transform: capitalize;
100
+ }
101
+ }
102
+ }
103
+
16
104
  .chart-header {
17
105
  align-items: center;
18
106
  display: flex;
@@ -1,6 +1,8 @@
1
1
  /* @pareto-engineering/generator-front 1.0.12 */
2
2
 
3
3
  @use "@pareto-engineering/bem";
4
+ @use "sass:math";
5
+ @use "sass:list";
4
6
 
5
7
  /*
6
8
  $hamburger-padding-x : 15px !default;
@@ -22,17 +24,157 @@ $hamburger-hover-filter : opacity(50%) !default;
22
24
  $hamburger-active-hover-filter: $hamburger-hover-filter !default;
23
25
  */
24
26
 
25
- $hamburgers-types:(
26
- squeeze
27
- );
28
- $hamburger-layer-color : var(--x);
29
- $hamburger-padding-x : .5em;
30
- $hamburger-padding-y : .5em;
27
+ // Define the variables to be used with the hamburgers library
28
+ $hamburger-types: (squeeze);
29
+ $hamburger-layer-color: var(--x);
30
+ $hamburger-padding-x: .5em;
31
+ $hamburger-padding-y: .5em;
31
32
 
32
- // Open the following file for the template
33
+ // Additional hamburger variables with defaults
34
+ $hamburger-layer-width: 40px !default;
35
+ $hamburger-layer-height: 4px !default;
36
+ $hamburger-layer-spacing: 6px !default;
37
+ $hamburger-layer-border-radius: 4px !default;
38
+ $hamburger-hover-opacity: .7 !default;
39
+ $hamburger-hover-use-filter: false !default;
40
+ $hamburger-hover-filter: opacity(50%) !default;
41
+ $hamburger-active-layer-color: $hamburger-layer-color !default;
42
+ $hamburger-active-hover-opacity: $hamburger-hover-opacity !default;
43
+ $hamburger-active-hover-filter: $hamburger-hover-filter !default;
44
+
45
+ // Base Hamburger Styles
46
+ // ==================================================
47
+ .hamburger {
48
+ background-color: transparent;
49
+ border: 0;
50
+ color: inherit;
51
+ cursor: pointer;
52
+ display: inline-block;
53
+
54
+ // Normalize (<button>)
55
+ font: inherit;
56
+ margin: 0;
57
+ overflow: visible;
58
+ padding: $hamburger-padding-y $hamburger-padding-x;
59
+ text-transform: none;
60
+ transition-duration: .15s;
61
+
62
+ transition-property: opacity, filter;
63
+ transition-timing-function: linear;
64
+
65
+ &:hover {
66
+ @if $hamburger-hover-use-filter == true {
67
+ filter: $hamburger-hover-filter;
68
+ }
69
+ @else {
70
+ opacity: $hamburger-hover-opacity;
71
+ }
72
+ }
73
+
74
+ &.is-active {
75
+ &:hover {
76
+ @if $hamburger-hover-use-filter == true {
77
+ filter: $hamburger-active-hover-filter;
78
+ }
79
+ @else {
80
+ opacity: $hamburger-active-hover-opacity;
81
+ }
82
+ }
83
+
84
+ .hamburger-inner,
85
+ .hamburger-inner::before,
86
+ .hamburger-inner::after {
87
+ background-color: $hamburger-active-layer-color;
88
+ }
89
+ }
90
+ }
91
+
92
+ .hamburger-box {
93
+ display: inline-block;
94
+ height: $hamburger-layer-height * 3 + $hamburger-layer-spacing * 2;
95
+ position: relative;
96
+ width: $hamburger-layer-width;
97
+ }
98
+
99
+ .hamburger-inner {
100
+ display: block;
101
+ margin-top: math.div($hamburger-layer-height, -2);
102
+ top: 50%;
103
+
104
+ &,
105
+ &::before,
106
+ &::after {
107
+ background-color: $hamburger-layer-color;
108
+ border-radius: $hamburger-layer-border-radius;
109
+ height: $hamburger-layer-height;
110
+ position: absolute;
111
+ transition-duration: .15s;
112
+ transition-property: transform;
113
+ transition-timing-function: ease;
114
+ width: $hamburger-layer-width;
115
+ }
116
+
117
+ &::before,
118
+ &::after {
119
+ content: "";
120
+ display: block;
121
+ }
122
+
123
+ &::before {
124
+ top: ($hamburger-layer-spacing + $hamburger-layer-height) * -1;
125
+ }
126
+
127
+ &::after {
128
+ bottom: ($hamburger-layer-spacing + $hamburger-layer-height) * -1;
129
+ }
130
+ }
131
+
132
+ // Squeeze Type
133
+ // ==================================================
134
+
135
+ @if list.index($hamburger-types, squeeze) {
136
+ /*
137
+ * Squeeze
138
+ */
139
+ .hamburger-squeeze {
140
+ .hamburger-inner {
141
+ transition-duration: .1s;
142
+ transition-timing-function: cubic-bezier(.55, .055, .675, .19);
143
+
144
+ &::before {
145
+ transition: top .1s .12s ease,
146
+ opacity .1s ease;
147
+ }
148
+
149
+ &::after {
150
+ transition: bottom .1s .12s ease,
151
+ transform .1s cubic-bezier(.55, .055, .675, .19);
152
+ }
153
+ }
154
+
155
+ &.is-active {
156
+ .hamburger-inner {
157
+ transform: rotate(45deg);
158
+ transition-delay: .12s;
159
+ transition-timing-function: cubic-bezier(.215, .61, .355, 1);
160
+
161
+ &::before {
162
+ opacity: 0;
163
+ top: 0;
164
+ transition: top .1s ease,
165
+ opacity .1s .12s ease;
166
+ }
33
167
 
34
- @import "hamburgers/_sass/hamburgers/hamburgers";
35
- @import "hamburgers/_sass/hamburgers/types/squeeze";
168
+ &::after {
169
+ bottom: 0;
170
+ transform: rotate(-90deg);
171
+ transition: bottom .1s ease,
172
+ transform .1s .12s cubic-bezier(.215, .61, .355, 1);
173
+ }
174
+ }
175
+ }
176
+ }
177
+ }
36
178
 
37
179
  /*
38
180
  .#{bem.$base}.hamburger-button{