@porsche-design-system/components-react 3.15.1 → 3.15.2

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.
package/CHANGELOG.md CHANGED
@@ -14,6 +14,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0),
14
14
 
15
15
  ### [Unreleased]
16
16
 
17
+ ### [3.15.2] - 2024-05-29
18
+
19
+ #### Fixed
20
+
21
+ - `aria`: Refactor `parseJSONAttribute` to support Safari < 16.4
22
+ ([#3314](https://github.com/porsche-design-system/porsche-design-system/pull/3314))
23
+
17
24
  ### [3.15.1] - 2024-05-23
18
25
 
19
26
  #### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@porsche-design-system/components-react",
3
- "version": "3.15.1",
3
+ "version": "3.15.2",
4
4
  "description": "Porsche Design System is a component library designed to help developers create the best experience for software or services distributed by Dr. Ing. h.c. F. Porsche AG.",
5
5
  "keywords": [
6
6
  "porsche",
@@ -17,7 +17,7 @@
17
17
  "license": "SEE LICENSE IN LICENSE",
18
18
  "homepage": "https://designsystem.porsche.com",
19
19
  "dependencies": {
20
- "@porsche-design-system/components-js": "3.15.1"
20
+ "@porsche-design-system/components-js": "3.15.2"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "react": ">=18.0.0 <19.0.0",
@@ -3192,15 +3192,19 @@ const isDisabledOrLoading = (disabled, loading) => {
3192
3192
  };
3193
3193
 
3194
3194
  const parseJSONAttribute = (attribute) => {
3195
- return typeof attribute === 'string'
3196
- ? // input is potentially JSON parsable string, e.g. "{ 'aria-label': 'Some label' }"
3197
- JSON.parse(attribute
3198
- .replace(/(?<!\\)'/g, '"') // convert single quotes to double quotes except the ones which are escaped by backslash
3199
- .replace(/\\(?!u0027)/g, '') // remove string escapes except the ones followed by unicode u0027
3200
- .replace(/[\s"]?([\w-]+)[\s"]?:/g, '"$1":') // wrap keys in double quotes
3201
- )
3202
- : // input is object, e.g. { 'aria-label': 'Some label' }
3203
- attribute;
3195
+ // Input is object, e.g. { 'aria-label': 'Some label' }
3196
+ if (typeof attribute !== 'string') {
3197
+ return attribute;
3198
+ }
3199
+ return JSON.parse(attribute
3200
+ // Convert single quotes to double quotes except the ones which are escaped by backslash
3201
+ .replace(/\\'/g, '__escaped_single_quote__')
3202
+ .replace(/'/g, '"')
3203
+ .replace(/__escaped_single_quote__/g, '\\\'')
3204
+ // Remove string escapes except the ones followed by unicode u0027
3205
+ .replace(/([^\\])\\(?!u0027)/g, '$1')
3206
+ // Wrap keys in double quotes
3207
+ .replace(/[\s"]?([\w-]+)[\s"]?:/g, '"$1":'));
3204
3208
  };
3205
3209
 
3206
3210
  const hasWindow = typeof window !== 'undefined';
@@ -3190,15 +3190,19 @@ const isDisabledOrLoading = (disabled, loading) => {
3190
3190
  };
3191
3191
 
3192
3192
  const parseJSONAttribute = (attribute) => {
3193
- return typeof attribute === 'string'
3194
- ? // input is potentially JSON parsable string, e.g. "{ 'aria-label': 'Some label' }"
3195
- JSON.parse(attribute
3196
- .replace(/(?<!\\)'/g, '"') // convert single quotes to double quotes except the ones which are escaped by backslash
3197
- .replace(/\\(?!u0027)/g, '') // remove string escapes except the ones followed by unicode u0027
3198
- .replace(/[\s"]?([\w-]+)[\s"]?:/g, '"$1":') // wrap keys in double quotes
3199
- )
3200
- : // input is object, e.g. { 'aria-label': 'Some label' }
3201
- attribute;
3193
+ // Input is object, e.g. { 'aria-label': 'Some label' }
3194
+ if (typeof attribute !== 'string') {
3195
+ return attribute;
3196
+ }
3197
+ return JSON.parse(attribute
3198
+ // Convert single quotes to double quotes except the ones which are escaped by backslash
3199
+ .replace(/\\'/g, '__escaped_single_quote__')
3200
+ .replace(/'/g, '"')
3201
+ .replace(/__escaped_single_quote__/g, '\\\'')
3202
+ // Remove string escapes except the ones followed by unicode u0027
3203
+ .replace(/([^\\])\\(?!u0027)/g, '$1')
3204
+ // Wrap keys in double quotes
3205
+ .replace(/[\s"]?([\w-]+)[\s"]?:/g, '"$1":'));
3202
3206
  };
3203
3207
 
3204
3208
  const hasWindow = typeof window !== 'undefined';