@uncinc/uncinc-react-kitchen-sink 2.21.4 → 2.23.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.
@@ -5,6 +5,7 @@
5
5
  // https://marella.me/material-design-icons/demo/svg/
6
6
 
7
7
  $custom-icon-path: '' !default;
8
+ $custom-icon-names: () !default;
8
9
 
9
10
  $material-icon-names: (
10
11
  arrow_forward,
@@ -32,7 +33,10 @@ $material-icon-styles: (
32
33
  background-color: none;
33
34
  }
34
35
 
35
- @mixin generateMaterialIconClasses() {
36
+ @mixin generateMaterialIconClasses(
37
+ $material-icon-names: $material-icon-names,
38
+ $material-icon-styles: $material-icon-styles,
39
+ ) {
36
40
  @for $styleIndex from 1 through length($material-icon-styles) {
37
41
  $style: list.nth($material-icon-styles, $styleIndex);
38
42
 
@@ -55,7 +59,10 @@ $material-icon-styles: (
55
59
  }
56
60
  }
57
61
 
58
- @mixin generateCustomIconClasses() {
62
+ @mixin generateCustomIconClasses(
63
+ $custom-icon-names: $custom-icon-names,
64
+ $custom-icon-path: $custom-icon-path,
65
+ ) {
59
66
  @for $nameIndex from 1 through length($custom-icon-names) {
60
67
  $name: list.nth($custom-icon-names, $nameIndex);
61
68
 
@@ -94,6 +101,9 @@ $material-icon-styles: (
94
101
  /// @param {Boolean} $custom - Are we overwwriting with a
95
102
  /// custom icon?
96
103
  ///
104
+ /// @param {String} $custom-path - Needed when using @import
105
+ /// instead of @use, because $custom-icon-path isn't available globally.
106
+ ///
97
107
  /// @example scss
98
108
  /// .icon-arrow {
99
109
  /// @include gridIconToMaterialIcon('download');
@@ -108,14 +118,17 @@ $material-icon-styles: (
108
118
  $icon-name: null,
109
119
  $style: 'outlined',
110
120
  $custom: false,
121
+ $custom-path: null,
111
122
  $color: #000000,
112
123
  ) {
113
124
  @if not $icon-name {
114
- @error 'an icon name is required'
125
+ @error 'an icon name is required';
115
126
  }
116
127
 
117
128
  @if not $custom {
118
129
  mask-image: url('~@material-design-icons/svg/#{$style}/#{$icon-name}.svg');
130
+ } @else if $custom-path {
131
+ mask-image: url('#{$custom-path}/#{$icon-name}.svg');
119
132
  } @else {
120
133
  mask-image: url('#{$custom-icon-path}/#{$icon-name}.svg');
121
134
  }
@@ -137,12 +150,14 @@ $material-icon-styles: (
137
150
  $icon-name: null,
138
151
  $style: 'outlined',
139
152
  $custom: false,
153
+ $custom-path: null,
140
154
  $color: #000000,
141
155
  ) {
142
156
  @include gridIconToMaterialIcon(
143
157
  $icon-name,
144
158
  $style,
145
159
  $custom,
160
+ $custom-path,
146
161
  $color,
147
- )
162
+ );
148
163
  }
@@ -1,5 +1,13 @@
1
1
  import React from 'react';
2
2
  import type { LottieProps } from '../types';
3
3
  import './style.scss';
4
+ /**
5
+ * LottieAnimation renders an interactive or static Lottie animation.
6
+ *
7
+ * Accessibility note:
8
+ * - The ariaLabel prop will only be effective if the animation is interactive
9
+ * (pauseOnClick or activateOnHover is true) because it adds role="button" and tabIndex=0.
10
+ * - On non-interactive divs, aria-label is ignored by screen readers.
11
+ */
4
12
  declare const LottieAnimation: React.ForwardRefExoticComponent<Omit<LottieProps, "delay"> & React.RefAttributes<import("lottie-web").AnimationItem>>;
5
13
  export default LottieAnimation;
@@ -11,11 +11,22 @@ import lottie from 'lottie-web';
11
11
  import './style.scss';
12
12
  var DIRECTION_FORWARD = 1;
13
13
  var DIRECTION_BACKWARDS = -1;
14
+
15
+ /**
16
+ * LottieAnimation renders an interactive or static Lottie animation.
17
+ *
18
+ * Accessibility note:
19
+ * - The ariaLabel prop will only be effective if the animation is interactive
20
+ * (pauseOnClick or activateOnHover is true) because it adds role="button" and tabIndex=0.
21
+ * - On non-interactive divs, aria-label is ignored by screen readers.
22
+ */
23
+
14
24
  var LottieAnimation = /*#__PURE__*/React.forwardRef(function (props, ref) {
15
25
  var id = props.id,
16
26
  className = props.className,
17
- _props$ariaLabel = props.ariaLabel,
18
- ariaLabel = _props$ariaLabel === void 0 ? 'animation' : _props$ariaLabel,
27
+ ariaLabel = props.ariaLabel,
28
+ _props$ariaHidden = props.ariaHidden,
29
+ ariaHidden = _props$ariaHidden === void 0 ? false : _props$ariaHidden,
19
30
  data = props.data,
20
31
  path = props.path,
21
32
  _props$renderer = props.renderer,
@@ -176,7 +187,7 @@ var LottieAnimation = /*#__PURE__*/React.forwardRef(function (props, ref) {
176
187
  return /*#__PURE__*/React.createElement("div", _extends({
177
188
  className: lottieClasses,
178
189
  id: "lottie--".concat(lottieId),
179
- "aria-label": ariaLabel
190
+ "aria-hidden": ariaHidden
180
191
  // Only make the Lottie interactable if we provide the necessary props,
181
192
  // otherwise it's just a plain div.
182
193
  }, pauseOnClick || activateOnHover ? {
@@ -184,6 +195,7 @@ var LottieAnimation = /*#__PURE__*/React.forwardRef(function (props, ref) {
184
195
  tabIndex: 0,
185
196
  onMouseEnter: onMouseEnter,
186
197
  onMouseLeave: onMouseLeave,
198
+ ariaLabel: ariaLabel,
187
199
  onClick: onClick,
188
200
  onKeyDown: onKeyDown
189
201
  } : {}));
@@ -11,7 +11,8 @@ export interface LottieConfig<T extends RendererType = 'svg'> extends Omit<Anima
11
11
  export interface LottieProps extends Omit<Partial<LottieConfig>, 'animationData' | 'autoplay'> {
12
12
  id?: string;
13
13
  className?: string;
14
- ariaLabel?: string;
14
+ ariaLabel: string;
15
+ ariaHidden?: boolean;
15
16
  data?: unknown;
16
17
  autoPlay?: AnimationConfig['autoplay'];
17
18
  delay?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uncinc/uncinc-react-kitchen-sink",
3
- "version": "2.21.4",
3
+ "version": "2.23.0",
4
4
  "description": "Default React components that are easily extended.",
5
5
  "author": "uncinc",
6
6
  "license": "MIT",