@descope/flow-components 3.16.3 → 3.17.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,7 +5,7 @@
5
5
  "name": "flowComponents",
6
6
  "type": "app",
7
7
  "buildInfo": {
8
- "buildVersion": "3.16.3",
8
+ "buildVersion": "3.17.0",
9
9
  "buildName": "@descope/flow-components"
10
10
  },
11
11
  "remoteEntry": {
@@ -5,7 +5,7 @@
5
5
  "name": "flowComponents",
6
6
  "type": "app",
7
7
  "buildInfo": {
8
- "buildVersion": "3.16.3",
8
+ "buildVersion": "3.17.0",
9
9
  "buildName": "@descope/flow-components"
10
10
  },
11
11
  "remoteEntry": {
package/dist/index.cjs.js CHANGED
@@ -103692,6 +103692,10 @@ descope-enriched-text {
103692
103692
 
103693
103693
  var editIcon = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHZpZXdCb3g9IjAgMCAxNSAxNSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cGF0aCBkPSJNMTAuMDAwMiAwLjk5MjE0OUMxMC4wMDAyIDEuMDE2MTUgMTAuMDAwMiAxLjAxNjE1IDEwLjAwMDIgMS4wMTYxNUw4LjIyNDE5IDMuMDA4MTVIMi45OTIxOUMyLjQ2NDE5IDMuMDA4MTUgMi4wMDgxOSAzLjQ0MDE1IDIuMDA4MTkgMy45OTIxNVYxMi4wMDgyQzIuMDA4MTkgMTIuNTM2MiAyLjQ0MDE5IDEyLjk5MjIgMi45OTIxOSAxMi45OTIySDUuNTM2MTlDNS44NDgxOSAxMy4wNDAyIDYuMTYwMTkgMTMuMDQwMiA2LjQ3MjE5IDEyLjk5MjJIMTEuMDA4MkMxMS41MzYyIDEyLjk5MjIgMTEuOTkyMiAxMi41NjAyIDExLjk5MjIgMTIuMDA4MlY3Ljc4NDE2TDEzLjkzNjIgNS42MjQxNU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vc3ZnIj4KICA8cGF0aCBkPSJNMTYgMUg0Yy0xLjEgMC0yIC45LTIgMnYxNGgyVjNoMTJWMXptMyA0SDhjLTEuMSAwLTIgLjktMiAydjE0YzAgMS4xLjkgMiAyIDJoMTFjMS4xIDAgMi0uOSAyLTJWN2MwLTEuMS0uOS0yLTItMnptMCAxNkg4VjdoMTF2MTR6IiBmaWxsPSJjdXJyZW50Y29sb3IiLz4KPC9zdmc+Cg==";
103696
+
103697
+ var checkIcon = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cGF0aCBkPSJNOSAxNi4xNyA0LjgzIDEybC0xLjQyIDEuNDFMOSAxOSAyMSA3bC0xLjQxLTEuNDF6IiBmaWxsPSJjdXJyZW50Y29sb3IiLz4KPC9zdmc+Cg==";
103698
+
103695
103699
  const componentName$j = getComponentName$1('user-attribute');
103696
103700
  class RawUserAttribute extends createBaseClass({
103697
103701
  componentName: componentName$j,
@@ -103707,6 +103711,10 @@ descope-enriched-text {
103707
103711
  <descope-text st-text-align="auto" data-id="value-text" variant="body1" mode="primary" class="value"></descope-text>
103708
103712
  <div class="btn-wrapper">
103709
103713
  <descope-badge mode="default" bordered="true" size="xs"></descope-badge>
103714
+ <descope-button size="sm" data-id="copy-btn" variant="link" mode="primary">
103715
+ <slot name="copy-icon"></slot>
103716
+ <descope-icon class="check-icon" src="${checkIcon}" src-dark="${checkIcon}"></descope-icon>
103717
+ </descope-button>
103710
103718
  <descope-button size="sm" data-id="delete-btn" variant="link" mode="primary">
103711
103719
  <slot name="delete-icon"></slot>
103712
103720
  </descope-button>
@@ -103753,12 +103761,29 @@ descope-enriched-text {
103753
103761
  }
103754
103762
 
103755
103763
  slot[name="edit-icon"],
103756
- slot[name="delete-icon"] {
103764
+ slot[name="delete-icon"],
103765
+ slot[name="copy-icon"] {
103757
103766
  display: inline-flex;
103758
103767
  flex-shrink: 0;
103759
103768
  align-items: center;
103760
103769
  }
103761
103770
 
103771
+ descope-button[data-id="copy-btn"].hidden {
103772
+ display: none;
103773
+ }
103774
+
103775
+ descope-button[data-id="copy-btn"] .check-icon {
103776
+ display: none;
103777
+ }
103778
+
103779
+ descope-button[data-id="copy-btn"].copied slot[name="copy-icon"] {
103780
+ display: none;
103781
+ }
103782
+
103783
+ descope-button[data-id="copy-btn"].copied .check-icon {
103784
+ display: inline-flex;
103785
+ }
103786
+
103762
103787
  .content-wrapper {
103763
103788
  display: flex;
103764
103789
  flex-grow: 1;
@@ -103801,7 +103826,7 @@ descope-enriched-text {
103801
103826
  color: var(${TextClass.cssVarList.textColor});
103802
103827
  }
103803
103828
 
103804
- :host([readonly="true"]) descope-button {
103829
+ :host([readonly="true"]) descope-button:not([data-id="copy-btn"]) {
103805
103830
  visibility: hidden;
103806
103831
  width: 0;
103807
103832
  }
@@ -103809,6 +103834,7 @@ descope-enriched-text {
103809
103834
  this
103810
103835
  );
103811
103836
 
103837
+ this.copyButton = this.shadowRoot.querySelector('descope-button[data-id="copy-btn"]');
103812
103838
  this.deleteButton = this.shadowRoot.querySelector('descope-button[data-id="delete-btn"]');
103813
103839
  this.editButton = this.shadowRoot.querySelector('descope-button[data-id="edit-btn"]');
103814
103840
  this.badge = this.shadowRoot.querySelector('descope-badge');
@@ -103898,6 +103924,14 @@ descope-enriched-text {
103898
103924
  return this.getAttribute('hide-delete') === 'true';
103899
103925
  }
103900
103926
 
103927
+ get isCopyEnabled() {
103928
+ return this.getAttribute('show-copy') === 'true';
103929
+ }
103930
+
103931
+ get copyButtonLabel() {
103932
+ return this.getAttribute('copy-button-label') || '';
103933
+ }
103934
+
103901
103935
  init() {
103902
103936
  this.onLabelChange();
103903
103937
  this.onValueOrPlaceholderChange();
@@ -103906,7 +103940,9 @@ descope-enriched-text {
103906
103940
  this.onBadgeTooltipTextChange();
103907
103941
  this.updateButtonLabel(this.editButton, this.editButtonLabel);
103908
103942
  this.updateButtonLabel(this.deleteButton, this.deleteButtonLabel);
103943
+ this.updateButtonLabel(this.copyButton, this.copyButtonLabel);
103909
103944
  this.handleDeleteButtonVisibility();
103945
+ this.handleCopyButtonState();
103910
103946
 
103911
103947
  this.deleteButton.addEventListener('click', () =>
103912
103948
  this.dispatchEvent(new CustomEvent('delete-clicked', { bubbles: true, composed: true }))
@@ -103916,9 +103952,35 @@ descope-enriched-text {
103916
103952
  this.dispatchEvent(new CustomEvent('edit-clicked', { bubbles: true, composed: true }))
103917
103953
  );
103918
103954
 
103955
+ this.copyButton.addEventListener('click', () => this.#handleCopyClick());
103956
+
103919
103957
  this.setDefaultChildren();
103920
103958
  }
103921
103959
 
103960
+ #handleCopyClick() {
103961
+ // isDraggable is true only inside the page editor (craftjs sets draggable="true"
103962
+ // for drag-and-drop); there the copy action must not run.
103963
+ if (!this.value || this.isDraggable || !navigator.clipboard) return;
103964
+
103965
+ navigator.clipboard
103966
+ .writeText(this.value)
103967
+ .then(() => {
103968
+ this.copyButton.classList.add('copied');
103969
+ setTimeout(() => this.copyButton.classList.remove('copied'), 2000);
103970
+ })
103971
+ .catch(() => {});
103972
+ }
103973
+
103974
+ handleCopyButtonState() {
103975
+ this.copyButton.classList.toggle('hidden', !this.isCopyEnabled);
103976
+
103977
+ if (this.value) {
103978
+ this.copyButton.removeAttribute('disabled');
103979
+ } else {
103980
+ this.copyButton.setAttribute('disabled', 'true');
103981
+ }
103982
+ }
103983
+
103922
103984
  #addIcon(src, slotName) {
103923
103985
  const icon = document.createElement('descope-icon');
103924
103986
  icon.setAttribute('src', src);
@@ -103928,9 +103990,19 @@ descope-enriched-text {
103928
103990
  }
103929
103991
 
103930
103992
  setDefaultChildren() {
103931
- if (this.children.length) return;
103932
- this.#addIcon(deleteIcon, 'delete-icon');
103933
- this.#addIcon(editIcon, 'edit-icon');
103993
+ if (!this.querySelector('[slot="delete-icon"]')) {
103994
+ this.#addIcon(deleteIcon, 'delete-icon');
103995
+ }
103996
+ if (!this.querySelector('[slot="edit-icon"]')) {
103997
+ this.#addIcon(editIcon, 'edit-icon');
103998
+ }
103999
+ this.setDefaultCopyIcon();
104000
+ }
104001
+
104002
+ setDefaultCopyIcon() {
104003
+ if (this.isCopyEnabled && !this.querySelector('[slot="copy-icon"]')) {
104004
+ this.#addIcon(copyIcon, 'copy-icon');
104005
+ }
103934
104006
  }
103935
104007
 
103936
104008
  static get observedAttributes() {
@@ -103943,7 +104015,9 @@ descope-enriched-text {
103943
104015
  'badge-tooltip-text',
103944
104016
  'edit-button-label',
103945
104017
  'delete-button-label',
104018
+ 'copy-button-label',
103946
104019
  'hide-delete',
104020
+ 'show-copy',
103947
104021
  ].concat(super.observedAttributes);
103948
104022
  }
103949
104023
 
@@ -103975,11 +104049,19 @@ descope-enriched-text {
103975
104049
  this.updateButtonLabel(this.editButton, this.editButtonLabel);
103976
104050
  } else if (name === 'delete-button-label') {
103977
104051
  this.updateButtonLabel(this.deleteButton, this.deleteButtonLabel);
104052
+ } else if (name === 'copy-button-label') {
104053
+ this.updateButtonLabel(this.copyButton, this.copyButtonLabel);
104054
+ } else if (name === 'show-copy') {
104055
+ this.setDefaultCopyIcon();
103978
104056
  }
103979
104057
 
103980
104058
  if (name === 'value' || name === 'required' || name === 'hide-delete') {
103981
104059
  this.handleDeleteButtonVisibility();
103982
104060
  }
104061
+
104062
+ if (name === 'value' || name === 'show-copy') {
104063
+ this.handleCopyButtonState();
104064
+ }
103983
104065
  }
103984
104066
  }
103985
104067
 
@@ -104008,7 +104090,12 @@ descope-enriched-text {
104008
104090
  contentMinWidth: { ...contentWrapper, property: 'min-width' },
104009
104091
  badgeMaxWidth: { ...badge$1, property: 'max-width' },
104010
104092
  itemsGap: [{ property: 'gap' }, { ...contentWrapper, property: 'gap' }],
104011
- iconColor: [{ selector: () => '::slotted(*)', property: IconClass.cssVarList.fill }],
104093
+ iconColor: [
104094
+ { selector: () => '::slotted(*)', property: IconClass.cssVarList.fill },
104095
+ // the copied check-icon lives in the shadow DOM (not slotted), so it
104096
+ // needs its own mapping to follow the same icon color
104097
+ { selector: () => '.check-icon', property: IconClass.cssVarList.fill },
104098
+ ],
104012
104099
  },
104013
104100
  }),
104014
104101
  draggableMixin,
@@ -108670,8 +108757,17 @@ descope-enriched-text {
108670
108757
 
108671
108758
  setActiveInputSelectionStart() {
108672
108759
  setTimeout(() => {
108673
- this.activeInputEle.focus();
108674
- this.activeInputEle.setSelectionRange?.(this.#selectionStart, this.#selectionStart);
108760
+ const ele = this.activeInputEle;
108761
+ ele.focus();
108762
+ // setSelectionRange throws InvalidStateError on input types that do not
108763
+ // support selection (e.g. `email`). The focus handler usually switches
108764
+ // type to `text` first, but that can race with the blur timer or fail
108765
+ // to fire (e.g. background tab). Restoring the caret is best-effort.
108766
+ try {
108767
+ ele.setSelectionRange?.(this.#selectionStart, this.#selectionStart);
108768
+ } catch {
108769
+ /* noop */
108770
+ }
108675
108771
  });
108676
108772
  }
108677
108773
 
@@ -110799,9 +110895,10 @@ const UserAuthMethod = React__default.default.forwardRef(({ methodIcon, methodIc
110799
110895
  buttonIcon && buttonIconDark && React__default.default.createElement(Icon, { icon: buttonIcon, "src-dark": buttonIconDark, slot: "button-icon", noColor: true, width: "1em", height: "1em" }),
110800
110896
  fulfilledButtonIcon && fulfilledButtonIconDark && React__default.default.createElement(Icon, { icon: fulfilledButtonIcon, "src-dark": fulfilledButtonIconDark, slot: "fulfilled-button-icon", noColor: true, width: "1em", height: "1em" }))));
110801
110897
 
110802
- const UserAttribute = React__default.default.forwardRef(({ required = false, deleteIconLight, deleteIconDark, editIconLight, editIconDark, ...props }, ref) => (React__default.default.createElement("descope-user-attribute", { required: required, ...props, ref: ref },
110898
+ const UserAttribute = React__default.default.forwardRef(({ required = false, deleteIconLight, deleteIconDark, editIconLight, editIconDark, copyIconLight, copyIconDark, ...props }, ref) => (React__default.default.createElement("descope-user-attribute", { required: required, ...props, ref: ref },
110803
110899
  deleteIconLight && deleteIconDark && (React__default.default.createElement(Icon, { icon: deleteIconLight, "src-dark": deleteIconDark, slot: "delete-icon" })),
110804
- editIconLight && editIconDark && (React__default.default.createElement(Icon, { icon: editIconLight, "src-dark": editIconDark, slot: "edit-icon" })))));
110900
+ editIconLight && editIconDark && (React__default.default.createElement(Icon, { icon: editIconLight, "src-dark": editIconDark, slot: "edit-icon" })),
110901
+ copyIconLight && copyIconDark && (React__default.default.createElement(Icon, { icon: copyIconLight, "src-dark": copyIconDark, slot: "copy-icon" })))));
110805
110902
 
110806
110903
  const Avatar = React__default.default.forwardRef(({ size = 'md', editable = false, ...props }, ref) => (React__default.default.createElement("descope-avatar", { size: size, editable: editable, ...props, ref: ref })));
110807
110904
 
package/dist/index.d.ts CHANGED
@@ -902,10 +902,14 @@ type Props$m = {
902
902
  label?: string;
903
903
  'full-width'?: boolean;
904
904
  required?: boolean;
905
+ 'show-copy'?: boolean;
906
+ 'copy-button-label'?: string;
905
907
  deleteIconLight?: string;
906
908
  editIconLight?: string;
907
909
  deleteIconDark?: string;
908
910
  editIconDark?: string;
911
+ copyIconLight?: string;
912
+ copyIconDark?: string;
909
913
  };
910
914
  declare global {
911
915
  namespace React.JSX {
package/dist/index.esm.js CHANGED
@@ -599,9 +599,10 @@ const UserAuthMethod = React.forwardRef(({ methodIcon, methodIconDark, buttonIco
599
599
  buttonIcon && buttonIconDark && React.createElement(Icon, { icon: buttonIcon, "src-dark": buttonIconDark, slot: "button-icon", noColor: true, width: "1em", height: "1em" }),
600
600
  fulfilledButtonIcon && fulfilledButtonIconDark && React.createElement(Icon, { icon: fulfilledButtonIcon, "src-dark": fulfilledButtonIconDark, slot: "fulfilled-button-icon", noColor: true, width: "1em", height: "1em" }))));
601
601
 
602
- const UserAttribute = React.forwardRef(({ required = false, deleteIconLight, deleteIconDark, editIconLight, editIconDark, ...props }, ref) => (React.createElement("descope-user-attribute", { required: required, ...props, ref: ref },
602
+ const UserAttribute = React.forwardRef(({ required = false, deleteIconLight, deleteIconDark, editIconLight, editIconDark, copyIconLight, copyIconDark, ...props }, ref) => (React.createElement("descope-user-attribute", { required: required, ...props, ref: ref },
603
603
  deleteIconLight && deleteIconDark && (React.createElement(Icon, { icon: deleteIconLight, "src-dark": deleteIconDark, slot: "delete-icon" })),
604
- editIconLight && editIconDark && (React.createElement(Icon, { icon: editIconLight, "src-dark": editIconDark, slot: "edit-icon" })))));
604
+ editIconLight && editIconDark && (React.createElement(Icon, { icon: editIconLight, "src-dark": editIconDark, slot: "edit-icon" })),
605
+ copyIconLight && copyIconDark && (React.createElement(Icon, { icon: copyIconLight, "src-dark": copyIconDark, slot: "copy-icon" })))));
605
606
 
606
607
  const Avatar = React.forwardRef(({ size = 'md', editable = false, ...props }, ref) => (React.createElement("descope-avatar", { size: size, editable: editable, ...props, ref: ref })));
607
608
 
@@ -7,10 +7,14 @@ type Props = {
7
7
  label?: string;
8
8
  'full-width'?: boolean;
9
9
  required?: boolean;
10
+ 'show-copy'?: boolean;
11
+ 'copy-button-label'?: string;
10
12
  deleteIconLight?: string;
11
13
  editIconLight?: string;
12
14
  deleteIconDark?: string;
13
15
  editIconDark?: string;
16
+ copyIconLight?: string;
17
+ copyIconDark?: string;
14
18
  };
15
19
  declare global {
16
20
  namespace React.JSX {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/flow-components",
3
- "version": "3.16.3",
3
+ "version": "3.17.0",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -97,7 +97,7 @@
97
97
  "webpack-subresource-integrity": "5.2.0-rc.1"
98
98
  },
99
99
  "dependencies": {
100
- "@descope/web-components-ui": "3.16.3"
100
+ "@descope/web-components-ui": "3.17.0"
101
101
  },
102
102
  "peerDependencies": {
103
103
  "react": ">= 18"