@adobe-commerce/elsie 1.4.1-alpha100 → 1.4.1-alpha101

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe-commerce/elsie",
3
- "version": "1.4.1-alpha100",
3
+ "version": "1.4.1-alpha101",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "description": "Domain Package SDK",
6
6
  "engines": {
@@ -8,12 +8,13 @@
8
8
  *******************************************************************/
9
9
 
10
10
  import { Icon } from '@adobe-commerce/elsie/components';
11
- import '@adobe-commerce/elsie/components/Picker/Picker.css';
12
11
  import { ChevronDown } from '@adobe-commerce/elsie/icons';
13
12
  import { classes } from '@adobe-commerce/elsie/lib';
14
13
  import { FunctionComponent, VNode } from 'preact';
15
14
  import { HTMLAttributes, useEffect, useState } from 'preact/compat';
16
15
 
16
+ import '@adobe-commerce/elsie/components/Picker/Picker.css';
17
+
17
18
  type PickerValue = string | null;
18
19
 
19
20
  export interface PickerOption {
@@ -68,9 +69,10 @@ export const Picker: FunctionComponent<PickerProps> = ({
68
69
  defaultOption,
69
70
  icon,
70
71
  className,
72
+ id,
71
73
  ...props
72
74
  }) => {
73
- const id = props?.id || name || `dropin-picker-${Math.random().toString(36)}`;
75
+ const uniqueId = id ?? name ?? `dropin-picker-${Math.random().toString(36)}`;
74
76
  const isRequired = !!props?.required;
75
77
 
76
78
  // find the first option that is not disabled
@@ -154,7 +156,7 @@ export const Picker: FunctionComponent<PickerProps> = ({
154
156
  )}
155
157
 
156
158
  <select
157
- id={id}
159
+ id={uniqueId}
158
160
  className={classes([
159
161
  'dropin-picker__select',
160
162
  `dropin-picker__select--${variant}`,
@@ -94,7 +94,7 @@ export const TextSwatch: FunctionComponent<TextSwatchProps> = ({
94
94
  }
95
95
  }, [label]);
96
96
 
97
- const key = useMemo(() => `${name}_${id}_${Math.random().toString(36)}`, [name, id]);
97
+ const uniqueId = useMemo(() => id ?? `${name}_${id}_${Math.random().toString(36)}`, [name, id]);
98
98
 
99
99
  return (
100
100
  <div
@@ -104,7 +104,7 @@ export const TextSwatch: FunctionComponent<TextSwatchProps> = ({
104
104
  <input
105
105
  type={multi ? 'checkbox' : 'radio'}
106
106
  name={name}
107
- id={key}
107
+ id={uniqueId}
108
108
  value={value}
109
109
  aria-label={handleAriaLabel()}
110
110
  checked={selected}
@@ -119,7 +119,7 @@ export const TextSwatch: FunctionComponent<TextSwatchProps> = ({
119
119
  ])}
120
120
  />
121
121
  <label
122
- htmlFor={key}
122
+ htmlFor={uniqueId}
123
123
  ref={spanRef}
124
124
  className={classes([
125
125
  'dropin-text-swatch__label',