@nypl/design-system-react-components 4.1.4 → 4.1.5

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.
@@ -6811,7 +6811,9 @@ const { defineMultiStyleConfig: UD, definePartsStyle: ID } = U2([
6811
6811
  ...ch[r.size]
6812
6812
  };
6813
6813
  return {
6814
- ...a,
6814
+ // Apply styles to the root element if a custom svg is not passed
6815
+ ...r.hasChildSVG ? {} : a,
6816
+ // Apply styles to a child svg element
6815
6817
  svg: {
6816
6818
  ...a
6817
6819
  }
@@ -7202,6 +7204,19 @@ const { defineMultiStyleConfig: UD, definePartsStyle: ID } = U2([
7202
7204
  select: CZ(r),
7203
7205
  "div[data-testid='ds-helperErrorText']": {
7204
7206
  marginLeft: !o && r === "inline" ? "0" : `${a}px`
7207
+ },
7208
+ /**
7209
+ * Overriding Chakra default styles with styles that are RTL-aware to
7210
+ * properly position the dropdown icon.
7211
+ *
7212
+ * To work properly, the `right` attribute needs to be unset before the
7213
+ * `inset-inline-end` attribute is set. Additionally, `insetInlineEnd`
7214
+ * which should map to `inset-inline-end` actually maps to `right`,
7215
+ * which does not solve the problem. Maybe these are bugs in Chakra.
7216
+ * */
7217
+ ".chakra-select__icon-wrapper": {
7218
+ right: "unset",
7219
+ "inset-inline-end": "var(--nypl-space-2)"
7205
7220
  }
7206
7221
  })
7207
7222
  ),
@@ -10224,7 +10239,6 @@ const {
10224
10239
  utilitySearch: wL
10225
10240
  }, S3 = P1(
10226
10241
  u2((r, a) => {
10227
- var Z;
10228
10242
  const {
10229
10243
  align: o = "none",
10230
10244
  children: s,
@@ -10237,38 +10251,41 @@ const {
10237
10251
  title: V = `${y} icon`,
10238
10252
  variant: k = "default",
10239
10253
  ...S
10240
- } = r, _ = re("ReservoirIcon", {
10254
+ } = r, _ = s && s.type === "svg", R = re("ReservoirIcon", {
10241
10255
  align: o,
10242
10256
  color: i,
10257
+ hasChildSVG: _,
10243
10258
  iconRotation: C,
10244
10259
  size: L,
10245
10260
  variant: k
10246
- }), R = {
10261
+ }), N = {
10247
10262
  "aria-hidden": p,
10248
10263
  id: v,
10249
10264
  role: "img",
10250
10265
  title: V,
10251
10266
  ...S
10252
10267
  };
10253
- let N = null;
10254
- if (y && s)
10268
+ if (y && _)
10255
10269
  return console.warn(
10256
10270
  "NYPL Reservoir Icon: Pass in either a `name` prop or an `svg` element child. Do not pass both."
10257
10271
  ), null;
10258
- if (!y && !s)
10272
+ if (s && !_)
10273
+ return console.warn(
10274
+ "NYPL Reservoir Icon: Only an `svg` element can be passed to the `Icon` component as its child."
10275
+ ), null;
10276
+ if (!y && !_)
10259
10277
  return console.warn(
10260
10278
  "NYPL Reservoir Icon: Pass an icon `name` prop or an SVG child to ensure an icon appears."
10261
10279
  ), null;
10262
10280
  if (y) {
10263
10281
  const z = dB[y];
10264
- return /* @__PURE__ */ x.jsx(gb, { as: z, ref: a, ...R, __css: _ });
10282
+ return /* @__PURE__ */ x.jsx(gb, { as: z, ref: a, ...N, __css: R });
10265
10283
  }
10266
- return s.type === "svg" || ((Z = s.props) == null ? void 0 : Z.type) === "svg" ? N = r1.cloneElement(s, {
10267
- ...R,
10284
+ const Z = r1.cloneElement(s, {
10285
+ ...N,
10268
10286
  ref: a
10269
- }) : console.warn(
10270
- "NYPL Reservoir Icon: An `svg` element must be passed to the `Icon` component as its child."
10271
- ), /* @__PURE__ */ x.jsx(p1, { ref: a, __css: _, children: N });
10287
+ });
10288
+ return /* @__PURE__ */ x.jsx(p1, { ref: a, __css: R, children: Z });
10272
10289
  }),
10273
10290
  // Pass all custom props to Chakra and override, e.g. we want the
10274
10291
  // DS color value set and not color strings.
@@ -10,6 +10,7 @@ declare const iconRotation: Record<string, {
10
10
  interface IconBaseStyle extends StyleFunctionProps {
11
11
  align: keyof typeof align;
12
12
  color: string;
13
+ hasChildSVG: boolean;
13
14
  iconRotation: keyof typeof iconRotation;
14
15
  size: keyof typeof iconSizeStyles;
15
16
  }
@@ -24,13 +25,13 @@ declare const Icon: {
24
25
  marginStart?: string;
25
26
  display: string;
26
27
  };
27
- height: string;
28
- width: string;
29
- transform: string;
30
- fill: string;
28
+ height?: string;
29
+ width?: string;
30
+ transform?: string;
31
+ fill?: string;
31
32
  marginEnd?: string;
32
33
  marginStart?: string;
33
- display: string;
34
+ display?: string;
34
35
  };
35
36
  sizes?: {
36
37
  [key: string]: import("@chakra-ui/styled-system").SystemStyleInterpolation;
@@ -108,6 +108,19 @@ declare const Select: {
108
108
  "div[data-testid='ds-helperErrorText']": {
109
109
  marginLeft: string;
110
110
  };
111
+ /**
112
+ * Overriding Chakra default styles with styles that are RTL-aware to
113
+ * properly position the dropdown icon.
114
+ *
115
+ * To work properly, the `right` attribute needs to be unset before the
116
+ * `inset-inline-end` attribute is set. Additionally, `insetInlineEnd`
117
+ * which should map to `inset-inline-end` actually maps to `right`,
118
+ * which does not solve the problem. Maybe these are bugs in Chakra.
119
+ * */
120
+ ".chakra-select__icon-wrapper": {
121
+ right: string;
122
+ "inset-inline-end": string;
123
+ };
111
124
  };
112
125
  sizes?: {
113
126
  [key: string]: import("@chakra-ui/styled-system").PartsStyleInterpolation<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nypl/design-system-react-components",
3
- "version": "4.1.4",
3
+ "version": "4.1.5",
4
4
  "description": "NYPL Reservoir Design System React Components",
5
5
  "repository": {
6
6
  "type": "git",