@uncinc/uncinc-react-kitchen-sink 2.22.0 → 2.23.1

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,12 +11,20 @@ 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
27
  ariaLabel = props.ariaLabel,
18
- _props$ariaHidden = props.ariaHidden,
19
- ariaHidden = _props$ariaHidden === void 0 ? false : _props$ariaHidden,
20
28
  data = props.data,
21
29
  path = props.path,
22
30
  _props$renderer = props.renderer,
@@ -176,20 +184,18 @@ var LottieAnimation = /*#__PURE__*/React.forwardRef(function (props, ref) {
176
184
  }, [loadAnimation, lottieAnimation, onDestroy]);
177
185
  return /*#__PURE__*/React.createElement("div", _extends({
178
186
  className: lottieClasses,
179
- id: "lottie--".concat(lottieId),
180
- "aria-label": ariaLabel,
181
- "aria-hidden": ariaHidden
182
- // Only make the Lottie interactable if we provide the necessary props,
183
- // otherwise it's just a plain div.
184
- }, pauseOnClick || activateOnHover ? {
187
+ id: "lottie--".concat(lottieId)
188
+ }, ariaLabel && {
189
+ 'aria-label': ariaLabel
190
+ }, !ariaLabel && !pauseOnClick && !activateOnHover && {
191
+ role: 'presentation'
192
+ }, (pauseOnClick || activateOnHover) && {
185
193
  role: 'button',
186
194
  tabIndex: 0,
187
195
  onMouseEnter: onMouseEnter,
188
196
  onMouseLeave: onMouseLeave,
189
197
  onClick: onClick,
190
198
  onKeyDown: onKeyDown
191
- } : {
192
- role: 'img'
193
199
  }));
194
200
  });
195
201
  export default LottieAnimation;
@@ -11,8 +11,7 @@ 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;
15
- ariaHidden?: boolean;
14
+ ariaLabel?: string;
16
15
  data?: unknown;
17
16
  autoPlay?: AnimationConfig['autoplay'];
18
17
  delay?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uncinc/uncinc-react-kitchen-sink",
3
- "version": "2.22.0",
3
+ "version": "2.23.1",
4
4
  "description": "Default React components that are easily extended.",
5
5
  "author": "uncinc",
6
6
  "license": "MIT",