@descope/web-components-ui 1.0.367 → 1.0.368

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/dist/index.esm.js CHANGED
@@ -11877,6 +11877,383 @@ const RadioGroupClass = compose(
11877
11877
  customElements.define(componentName$4, RadioGroupClass);
11878
11878
  customElements.define(componentName$5, RadioButtonClass);
11879
11879
 
11880
+ const activeableMixin = (superclass) =>
11881
+ class ActiveableMixinClass extends superclass {
11882
+ init() {
11883
+ super.init?.();
11884
+
11885
+ this.baseElement.addEventListener('mousedown', (e) => {
11886
+ e.preventDefault();
11887
+ this.setAttribute('active', 'true');
11888
+ window.addEventListener('mouseup', () => this.removeAttribute('active'), {
11889
+ once: true,
11890
+ });
11891
+ });
11892
+ }
11893
+ };
11894
+
11895
+ const componentName$3 = getComponentName('list-item');
11896
+
11897
+ const customMixin$1 = (superclass) =>
11898
+ class ListItemMixinClass extends superclass {
11899
+ constructor() {
11900
+ super();
11901
+
11902
+ this.attachShadow({ mode: 'open' }).innerHTML = `
11903
+ <style>
11904
+ /*css*/
11905
+ slot {
11906
+ width: 100%;
11907
+ display: flex;
11908
+ overflow: hidden;
11909
+ box-sizing: border-box;
11910
+ }
11911
+ :host {
11912
+ display: block;
11913
+ }
11914
+
11915
+ /*!css*/
11916
+ </style>
11917
+ <slot></slot>
11918
+ `;
11919
+ }
11920
+ };
11921
+
11922
+ const ListItemClass = compose(
11923
+ createStyleMixin({
11924
+ mappings: {
11925
+ padding: {},
11926
+ backgroundColor: {},
11927
+ borderColor: {},
11928
+ borderStyle: {},
11929
+ borderWidth: {},
11930
+ borderRadius: {},
11931
+ outline: {},
11932
+ cursor: {},
11933
+ gap: {},
11934
+ maxWidth: { selector: () => ':host' },
11935
+ alignItems: {},
11936
+ flexDirection: {},
11937
+ transition: {},
11938
+ },
11939
+ }),
11940
+ draggableMixin,
11941
+ componentNameValidationMixin,
11942
+ customMixin$1,
11943
+ activeableMixin
11944
+ )(createBaseClass({ componentName: componentName$3, baseSelector: 'slot' }));
11945
+
11946
+ const componentName$2 = getComponentName('list');
11947
+
11948
+ class RawList extends createBaseClass({ componentName: componentName$2, baseSelector: '.wrapper' }) {
11949
+ static get observedAttributes() {
11950
+ return ['variant'];
11951
+ }
11952
+
11953
+ constructor() {
11954
+ super();
11955
+
11956
+ this.attachShadow({ mode: 'open' }).innerHTML = `
11957
+ <style>
11958
+ /*css*/
11959
+ .wrapper {
11960
+ overflow: auto;
11961
+ display: grid;
11962
+ max-height: 100%;
11963
+ width: 100%;
11964
+ }
11965
+
11966
+ :host {
11967
+ display: inline-flex;
11968
+ width: 100%;
11969
+ }
11970
+ slot[name="empty-state"] {
11971
+ justify-content: center;
11972
+ align-items: center;
11973
+ display: flex;
11974
+ flex-grow: 1;
11975
+ }
11976
+
11977
+ :host slot[name="empty-state"] {
11978
+ display: none;
11979
+ }
11980
+ :host([empty]) slot[name="empty-state"] {
11981
+ display: flex;
11982
+ }
11983
+ ::slotted(:not([slot])) {
11984
+ width: 100%;
11985
+ }
11986
+ /*!css*/
11987
+ </style>
11988
+
11989
+ <div class="wrapper">
11990
+ <slot></slot>
11991
+ <slot name="empty-state">
11992
+ No item...
11993
+ </slot>
11994
+ </div>
11995
+ `;
11996
+ }
11997
+
11998
+ get items() {
11999
+ return this.shadowRoot.querySelector('slot').assignedElements();
12000
+ }
12001
+
12002
+ #handleEmptyState() {
12003
+ if (this.items.length === 0) {
12004
+ this.setAttribute('empty', 'true');
12005
+ } else {
12006
+ this.removeAttribute('empty');
12007
+ }
12008
+ }
12009
+
12010
+ get variant() {
12011
+ return this.getAttribute('variant') || 'list';
12012
+ }
12013
+
12014
+ #handleItemsVariant() {
12015
+ this.items.forEach((item) => {
12016
+ let listItem = item;
12017
+ if (listItem.localName !== ListItemClass.componentName) {
12018
+ listItem = item.querySelector(ListItemClass.componentName);
12019
+ }
12020
+
12021
+ const listItemVariant = this.variant === 'tiles' ? 'tile' : 'row';
12022
+ listItem.setAttribute('variant', listItemVariant);
12023
+ });
12024
+ }
12025
+
12026
+ init() {
12027
+ super.init?.();
12028
+
12029
+ // we want new items to get the size
12030
+ observeChildren(this, () => {
12031
+ this.#handleEmptyState();
12032
+ this.#handleItemsVariant();
12033
+ });
12034
+ }
12035
+
12036
+ attributeChangedCallback(name, oldValue, newValue) {
12037
+ super.attributeChangedCallback?.(name, oldValue, newValue);
12038
+
12039
+ if (newValue === oldValue) return;
12040
+
12041
+ if (name === 'variant') {
12042
+ this.#handleItemsVariant();
12043
+ }
12044
+ }
12045
+ }
12046
+
12047
+ const ListClass = compose(
12048
+ createStyleMixin({
12049
+ mappings: {
12050
+ hostWidth: { selector: () => ':host', property: 'width' },
12051
+ maxHeight: { selector: () => ':host' },
12052
+ minHeight: {},
12053
+ verticalPadding: [{ property: 'padding-top' }, { property: 'padding-bottom' }],
12054
+ horizontalPadding: [{ property: 'padding-left' }, { property: 'padding-right' }],
12055
+ hostDirection: { selector: () => ':host', property: 'direction' },
12056
+ fontFamily: {},
12057
+ gap: {},
12058
+
12059
+ backgroundColor: {},
12060
+ borderRadius: {},
12061
+ borderColor: {},
12062
+ borderStyle: {},
12063
+ borderWidth: {},
12064
+
12065
+ boxShadow: {},
12066
+ gridTemplateColumns: {},
12067
+ maxItemsWidth: { selector: () => '::slotted(:not([slot]))', property: 'max-width' },
12068
+ minItemsWidth: { selector: () => '::slotted(:not([slot]))', property: 'min-width' },
12069
+ itemsHorizontalAlign: { selector: () => '::slotted(*)', property: 'justify-self' },
12070
+ emptyStateTextColor: { selector: () => 'slot[name="empty-state"]', property: 'color' },
12071
+ emptyStateTextFontFamily: {
12072
+ selector: () => 'slot[name="empty-state"]',
12073
+ property: 'font-family',
12074
+ },
12075
+ },
12076
+ }),
12077
+ draggableMixin,
12078
+ componentNameValidationMixin
12079
+ )(RawList);
12080
+
12081
+ customElements.define(componentName$2, ListClass);
12082
+ customElements.define(componentName$3, ListItemClass);
12083
+
12084
+ const defaultValidateSchema = () => true;
12085
+ const defaultItemRenderer = (item) => `<pre>${JSON.stringify(item, null, 4)}</pre>`;
12086
+
12087
+ const createTemplate = (templateString) => {
12088
+ const template = document.createElement('template');
12089
+ template.innerHTML = templateString;
12090
+
12091
+ return template;
12092
+ };
12093
+
12094
+ const getTemplateContent = (templateOrString) => {
12095
+ if (typeof templateOrString === 'string') {
12096
+ return createTemplate(templateOrString).content;
12097
+ }
12098
+
12099
+ if (templateOrString instanceof HTMLTemplateElement) {
12100
+ return templateOrString.content;
12101
+ }
12102
+
12103
+ // eslint-disable-next-line no-console
12104
+ console.error('Invalid template', templateOrString);
12105
+ return null;
12106
+ };
12107
+
12108
+ const createDynamicDataMixin =
12109
+ ({
12110
+ itemRenderer = defaultItemRenderer,
12111
+ validateSchema = defaultValidateSchema,
12112
+ slotName,
12113
+ rerenderAttrsList = [],
12114
+ }) =>
12115
+ (superclass) =>
12116
+ class DynamicDataMixinClass extends superclass {
12117
+ #data = [];
12118
+
12119
+ // eslint-disable-next-line class-methods-use-this
12120
+ #validateSchema(data) {
12121
+ if (!validateSchema) return true;
12122
+
12123
+ const validation = validateSchema(data);
12124
+ if (validation === true) return true;
12125
+
12126
+ // eslint-disable-next-line no-console
12127
+ console.error('Data schema validation failed', validation || '');
12128
+
12129
+ return false;
12130
+ }
12131
+
12132
+ #removeOldItems() {
12133
+ const selector = slotName ? `*[slot="${slotName}"]` : ':not([slot])';
12134
+ this.baseElement.querySelectorAll(selector).forEach((item) => item.remove());
12135
+ }
12136
+
12137
+ #renderItems() {
12138
+ this.#removeOldItems();
12139
+ this.data.forEach((item, index) => {
12140
+ const content = getTemplateContent(itemRenderer(item, index, this));
12141
+ this.baseElement.appendChild(content?.cloneNode(true));
12142
+ });
12143
+ }
12144
+
12145
+ set data(value) {
12146
+ if (this.#validateSchema(value)) {
12147
+ this.#data = value;
12148
+ this.#renderItems();
12149
+ }
12150
+ }
12151
+
12152
+ get data() {
12153
+ return this.#data;
12154
+ }
12155
+
12156
+ init() {
12157
+ super.init?.();
12158
+
12159
+ if (rerenderAttrsList.length) {
12160
+ observeAttributes(this, () => this.#renderItems(), { includeAttrs: rerenderAttrsList });
12161
+ } else {
12162
+ this.#renderItems();
12163
+ }
12164
+ }
12165
+ };
12166
+
12167
+ const componentName$1 = getComponentName('apps-list');
12168
+
12169
+ const limitAbbreviation = (str, limit = 3) =>
12170
+ str
12171
+ .trim()
12172
+ .split(' ')
12173
+ .splice(0, limit)
12174
+ .map((s) => s[0]?.toUpperCase())
12175
+ .join('');
12176
+
12177
+ const itemRenderer = ({ name, icon, url }, _, ref) => `
12178
+ <a href="${url}" target="_blank" title="${url}">
12179
+ <descope-list-item>
12180
+ <descope-avatar
12181
+ img="${icon}"
12182
+ display-name="${name}"
12183
+ abbr=${limitAbbreviation(name)}
12184
+ size=${ref.size}
12185
+ ></descope-avatar>
12186
+ <descope-text
12187
+ variant="body1"
12188
+ mode="primary"
12189
+ >${name}</descope-text>
12190
+ </descope-list-item>
12191
+ </a>
12192
+ `;
12193
+
12194
+ const customMixin = (superclass) =>
12195
+ class AppsListMixinClass extends superclass {
12196
+ get size() {
12197
+ return this.getAttribute('size') || 'sm';
12198
+ }
12199
+ };
12200
+
12201
+ const AppsListClass = compose(
12202
+ createStyleMixin({
12203
+ mappings: {
12204
+ maxHeight: { selector: () => ':host' },
12205
+ minHeight: { selector: () => ':host' },
12206
+ hostDirection: { selector: () => ':host', property: 'direction' },
12207
+ itemsFontWeight: {
12208
+ selector: TextClass.componentName,
12209
+ property: TextClass.cssVarList.fontWeight,
12210
+ },
12211
+ itemsFontSize: {
12212
+ selector: TextClass.componentName,
12213
+ property: TextClass.cssVarList.fontSize,
12214
+ },
12215
+ itemsTextAlign: {
12216
+ selector: TextClass.componentName,
12217
+ property: TextClass.cssVarList.textAlign,
12218
+ },
12219
+ },
12220
+ }),
12221
+ createDynamicDataMixin({ itemRenderer, rerenderAttrsList: ['size'] }),
12222
+ draggableMixin,
12223
+ componentNameValidationMixin,
12224
+ customMixin
12225
+ )(
12226
+ createProxy({
12227
+ slots: ['empty-state'],
12228
+ wrappedEleName: 'descope-list',
12229
+ excludeAttrsSync: ['tabindex', 'class'],
12230
+ componentName: componentName$1,
12231
+ style: () => `
12232
+ :host {
12233
+ width: 100%;
12234
+ display: inline-flex;
12235
+ }
12236
+
12237
+ descope-text::part(text-wrapper) {
12238
+ display: -webkit-box;
12239
+ -webkit-line-clamp: 2;
12240
+ -webkit-box-orient: vertical;
12241
+ overflow: hidden;
12242
+ }
12243
+
12244
+ a {
12245
+ text-decoration: none;
12246
+ }
12247
+
12248
+ descope-text {
12249
+ ${TextClass.cssVarList.hostDirection}: var(${AppsListClass.cssVarList.hostDirection});
12250
+ }
12251
+ `,
12252
+ })
12253
+ );
12254
+
12255
+ customElements.define(componentName$1, AppsListClass);
12256
+
11880
12257
  const getVarName = (path) => getCssVarName(DESCOPE_PREFIX, ...path);
11881
12258
 
11882
12259
  // lodash.set alternative
@@ -12444,7 +12821,7 @@ var button$1 = /*#__PURE__*/Object.freeze({
12444
12821
  vars: vars$L
12445
12822
  });
12446
12823
 
12447
- const componentName$3 = getComponentName('input-wrapper');
12824
+ const componentName = getComponentName('input-wrapper');
12448
12825
  const globalRefs$u = getThemeRefs(globals);
12449
12826
 
12450
12827
  const [theme$1, refs, vars$K] = createHelperVars(
@@ -12553,7 +12930,7 @@ const [theme$1, refs, vars$K] = createHelperVars(
12553
12930
  backgroundColor: globalRefs$u.colors.surface.main,
12554
12931
  },
12555
12932
  },
12556
- componentName$3
12933
+ componentName
12557
12934
  );
12558
12935
 
12559
12936
  var inputWrapper = /*#__PURE__*/Object.freeze({
@@ -14358,262 +14735,61 @@ const radioGroup = {
14358
14735
  [vars$5.buttonsSpacing]: 'space-between',
14359
14736
  },
14360
14737
 
14361
- _disabled: {
14362
- [vars$5.itemsLabelColor]: globalRefs$4.colors.surface.light,
14363
- },
14364
- };
14365
-
14366
- var radioGroup$1 = /*#__PURE__*/Object.freeze({
14367
- __proto__: null,
14368
- default: radioGroup,
14369
- radioGroup: radioGroup,
14370
- vars: vars$5
14371
- });
14372
-
14373
- const vars$4 = RadioButtonClass.cssVarList;
14374
- const globalRefs$3 = getThemeRefs(globals);
14375
-
14376
- const radioButton = {
14377
- [vars$4.fontFamily]: refs.fontFamily,
14378
- [vars$4.radioSize]: 'calc(1em + 6px)',
14379
- [vars$4.radioMargin]: 'auto 4px',
14380
- [vars$4.radioCheckedSize]: `calc(var(${vars$4.radioSize})/5)`,
14381
- [vars$4.radioCheckedColor]: globalRefs$3.colors.surface.light,
14382
- [vars$4.radioBackgroundColor]: globalRefs$3.colors.surface.light,
14383
- [vars$4.radioBorderColor]: 'none',
14384
- [vars$4.radioBorderWidth]: 0,
14385
-
14386
- _checked: {
14387
- [vars$4.radioBackgroundColor]: globalRefs$3.colors.surface.contrast,
14388
- },
14389
-
14390
- _hover: {
14391
- cursor: 'pointer',
14392
- },
14393
-
14394
- size: {
14395
- xs: {
14396
- [vars$4.fontSize]: '12px',
14397
- },
14398
- sm: {
14399
- [vars$4.fontSize]: '14px',
14400
- },
14401
- md: {
14402
- [vars$4.fontSize]: '16px',
14403
- },
14404
- lg: {
14405
- [vars$4.fontSize]: '18px',
14406
- },
14407
- },
14408
- };
14409
-
14410
- var radioButton$1 = /*#__PURE__*/Object.freeze({
14411
- __proto__: null,
14412
- default: radioButton,
14413
- radioButton: radioButton,
14414
- vars: vars$4
14415
- });
14416
-
14417
- const activeableMixin = (superclass) =>
14418
- class ActiveableMixinClass extends superclass {
14419
- init() {
14420
- super.init?.();
14421
-
14422
- this.baseElement.addEventListener('mousedown', (e) => {
14423
- e.preventDefault();
14424
- this.setAttribute('active', 'true');
14425
- window.addEventListener('mouseup', () => this.removeAttribute('active'), {
14426
- once: true,
14427
- });
14428
- });
14429
- }
14430
- };
14431
-
14432
- const componentName$2 = getComponentName('list-item');
14433
-
14434
- const customMixin$1 = (superclass) =>
14435
- class ListItemMixinClass extends superclass {
14436
- constructor() {
14437
- super();
14438
-
14439
- this.attachShadow({ mode: 'open' }).innerHTML = `
14440
- <style>
14441
- /*css*/
14442
- slot {
14443
- width: 100%;
14444
- display: flex;
14445
- overflow: hidden;
14446
- box-sizing: border-box;
14447
- }
14448
- :host {
14449
- display: block;
14450
- }
14451
-
14452
- /*!css*/
14453
- </style>
14454
- <slot></slot>
14455
- `;
14456
- }
14457
- };
14458
-
14459
- const ListItemClass = compose(
14460
- createStyleMixin({
14461
- mappings: {
14462
- padding: {},
14463
- backgroundColor: {},
14464
- borderColor: {},
14465
- borderStyle: {},
14466
- borderWidth: {},
14467
- borderRadius: {},
14468
- outline: {},
14469
- cursor: {},
14470
- gap: {},
14471
- maxWidth: { selector: () => ':host' },
14472
- alignItems: {},
14473
- flexDirection: {},
14474
- transition: {},
14475
- },
14476
- }),
14477
- draggableMixin,
14478
- componentNameValidationMixin,
14479
- customMixin$1,
14480
- activeableMixin
14481
- )(createBaseClass({ componentName: componentName$2, baseSelector: 'slot' }));
14482
-
14483
- const componentName$1 = getComponentName('list');
14484
-
14485
- class RawList extends createBaseClass({ componentName: componentName$1, baseSelector: '.wrapper' }) {
14486
- static get observedAttributes() {
14487
- return ['variant'];
14488
- }
14489
-
14490
- constructor() {
14491
- super();
14492
-
14493
- this.attachShadow({ mode: 'open' }).innerHTML = `
14494
- <style>
14495
- /*css*/
14496
- .wrapper {
14497
- overflow: auto;
14498
- display: grid;
14499
- max-height: 100%;
14500
- width: 100%;
14501
- }
14502
-
14503
- :host {
14504
- display: inline-flex;
14505
- width: 100%;
14506
- }
14507
- slot[name="empty-state"] {
14508
- justify-content: center;
14509
- align-items: center;
14510
- display: flex;
14511
- flex-grow: 1;
14512
- }
14513
-
14514
- :host slot[name="empty-state"] {
14515
- display: none;
14516
- }
14517
- :host([empty]) slot[name="empty-state"] {
14518
- display: flex;
14519
- }
14520
- ::slotted(:not([slot])) {
14521
- width: 100%;
14522
- }
14523
- /*!css*/
14524
- </style>
14525
-
14526
- <div class="wrapper">
14527
- <slot></slot>
14528
- <slot name="empty-state">
14529
- No item...
14530
- </slot>
14531
- </div>
14532
- `;
14533
- }
14534
-
14535
- get items() {
14536
- return this.shadowRoot.querySelector('slot').assignedElements();
14537
- }
14538
-
14539
- #handleEmptyState() {
14540
- if (this.items.length === 0) {
14541
- this.setAttribute('empty', 'true');
14542
- } else {
14543
- this.removeAttribute('empty');
14544
- }
14545
- }
14546
-
14547
- get variant() {
14548
- return this.getAttribute('variant') || 'list';
14549
- }
14550
-
14551
- #handleItemsVariant() {
14552
- this.items.forEach((item) => {
14553
- let listItem = item;
14554
- if (listItem.localName !== ListItemClass.componentName) {
14555
- listItem = item.querySelector(ListItemClass.componentName);
14556
- }
14557
-
14558
- const listItemVariant = this.variant === 'tiles' ? 'tile' : 'row';
14559
- listItem.setAttribute('variant', listItemVariant);
14560
- });
14561
- }
14562
-
14563
- init() {
14564
- super.init?.();
14565
-
14566
- // we want new items to get the size
14567
- observeChildren(this, () => {
14568
- this.#handleEmptyState();
14569
- this.#handleItemsVariant();
14570
- });
14571
- }
14738
+ _disabled: {
14739
+ [vars$5.itemsLabelColor]: globalRefs$4.colors.surface.light,
14740
+ },
14741
+ };
14572
14742
 
14573
- attributeChangedCallback(name, oldValue, newValue) {
14574
- super.attributeChangedCallback?.(name, oldValue, newValue);
14743
+ var radioGroup$1 = /*#__PURE__*/Object.freeze({
14744
+ __proto__: null,
14745
+ default: radioGroup,
14746
+ radioGroup: radioGroup,
14747
+ vars: vars$5
14748
+ });
14575
14749
 
14576
- if (newValue === oldValue) return;
14750
+ const vars$4 = RadioButtonClass.cssVarList;
14751
+ const globalRefs$3 = getThemeRefs(globals);
14577
14752
 
14578
- if (name === 'variant') {
14579
- this.#handleItemsVariant();
14580
- }
14581
- }
14582
- }
14753
+ const radioButton = {
14754
+ [vars$4.fontFamily]: refs.fontFamily,
14755
+ [vars$4.radioSize]: 'calc(1em + 6px)',
14756
+ [vars$4.radioMargin]: 'auto 4px',
14757
+ [vars$4.radioCheckedSize]: `calc(var(${vars$4.radioSize})/5)`,
14758
+ [vars$4.radioCheckedColor]: globalRefs$3.colors.surface.light,
14759
+ [vars$4.radioBackgroundColor]: globalRefs$3.colors.surface.light,
14760
+ [vars$4.radioBorderColor]: 'none',
14761
+ [vars$4.radioBorderWidth]: 0,
14583
14762
 
14584
- const ListClass = compose(
14585
- createStyleMixin({
14586
- mappings: {
14587
- hostWidth: { selector: () => ':host', property: 'width' },
14588
- maxHeight: { selector: () => ':host' },
14589
- minHeight: {},
14590
- verticalPadding: [{ property: 'padding-top' }, { property: 'padding-bottom' }],
14591
- horizontalPadding: [{ property: 'padding-left' }, { property: 'padding-right' }],
14592
- hostDirection: { selector: () => ':host', property: 'direction' },
14593
- fontFamily: {},
14594
- gap: {},
14763
+ _checked: {
14764
+ [vars$4.radioBackgroundColor]: globalRefs$3.colors.surface.contrast,
14765
+ },
14595
14766
 
14596
- backgroundColor: {},
14597
- borderRadius: {},
14598
- borderColor: {},
14599
- borderStyle: {},
14600
- borderWidth: {},
14767
+ _hover: {
14768
+ cursor: 'pointer',
14769
+ },
14601
14770
 
14602
- boxShadow: {},
14603
- gridTemplateColumns: {},
14604
- maxItemsWidth: { selector: () => '::slotted(:not([slot]))', property: 'max-width' },
14605
- minItemsWidth: { selector: () => '::slotted(:not([slot]))', property: 'min-width' },
14606
- itemsHorizontalAlign: { selector: () => '::slotted(*)', property: 'justify-self' },
14607
- emptyStateTextColor: { selector: () => 'slot[name="empty-state"]', property: 'color' },
14608
- emptyStateTextFontFamily: {
14609
- selector: () => 'slot[name="empty-state"]',
14610
- property: 'font-family',
14611
- },
14771
+ size: {
14772
+ xs: {
14773
+ [vars$4.fontSize]: '12px',
14612
14774
  },
14613
- }),
14614
- draggableMixin,
14615
- componentNameValidationMixin
14616
- )(RawList);
14775
+ sm: {
14776
+ [vars$4.fontSize]: '14px',
14777
+ },
14778
+ md: {
14779
+ [vars$4.fontSize]: '16px',
14780
+ },
14781
+ lg: {
14782
+ [vars$4.fontSize]: '18px',
14783
+ },
14784
+ },
14785
+ };
14786
+
14787
+ var radioButton$1 = /*#__PURE__*/Object.freeze({
14788
+ __proto__: null,
14789
+ default: radioButton,
14790
+ radioButton: radioButton,
14791
+ vars: vars$4
14792
+ });
14617
14793
 
14618
14794
  const globalRefs$2 = getThemeRefs(globals);
14619
14795
 
@@ -14621,7 +14797,7 @@ const compVars = ListClass.cssVarList;
14621
14797
 
14622
14798
  const [helperTheme, helperRefs, helperVars] = createHelperVars(
14623
14799
  { shadowColor: '#00000020' },
14624
- componentName$1
14800
+ componentName$2
14625
14801
  );
14626
14802
 
14627
14803
  const { shadowColor } = helperRefs;
@@ -14714,177 +14890,6 @@ var listItem = /*#__PURE__*/Object.freeze({
14714
14890
  vars: vars$2
14715
14891
  });
14716
14892
 
14717
- const defaultValidateSchema = () => true;
14718
- const defaultItemRenderer = (item) => `<pre>${JSON.stringify(item, null, 4)}</pre>`;
14719
-
14720
- const createTemplate = (templateString) => {
14721
- const template = document.createElement('template');
14722
- template.innerHTML = templateString;
14723
-
14724
- return template;
14725
- };
14726
-
14727
- const getTemplateContent = (templateOrString) => {
14728
- if (typeof templateOrString === 'string') {
14729
- return createTemplate(templateOrString).content;
14730
- }
14731
-
14732
- if (templateOrString instanceof HTMLTemplateElement) {
14733
- return templateOrString.content;
14734
- }
14735
-
14736
- // eslint-disable-next-line no-console
14737
- console.error('Invalid template', templateOrString);
14738
- return null;
14739
- };
14740
-
14741
- const createDynamicDataMixin =
14742
- ({
14743
- itemRenderer = defaultItemRenderer,
14744
- validateSchema = defaultValidateSchema,
14745
- slotName,
14746
- rerenderAttrsList = [],
14747
- }) =>
14748
- (superclass) =>
14749
- class DynamicDataMixinClass extends superclass {
14750
- #data = [];
14751
-
14752
- // eslint-disable-next-line class-methods-use-this
14753
- #validateSchema(data) {
14754
- if (!validateSchema) return true;
14755
-
14756
- const validation = validateSchema(data);
14757
- if (validation === true) return true;
14758
-
14759
- // eslint-disable-next-line no-console
14760
- console.error('Data schema validation failed', validation || '');
14761
-
14762
- return false;
14763
- }
14764
-
14765
- #removeOldItems() {
14766
- const selector = slotName ? `*[slot="${slotName}"]` : ':not([slot])';
14767
- this.baseElement.querySelectorAll(selector).forEach((item) => item.remove());
14768
- }
14769
-
14770
- #renderItems() {
14771
- this.#removeOldItems();
14772
- this.data.forEach((item, index) => {
14773
- const content = getTemplateContent(itemRenderer(item, index, this));
14774
- this.baseElement.appendChild(content?.cloneNode(true));
14775
- });
14776
- }
14777
-
14778
- set data(value) {
14779
- if (this.#validateSchema(value)) {
14780
- this.#data = value;
14781
- this.#renderItems();
14782
- }
14783
- }
14784
-
14785
- get data() {
14786
- return this.#data;
14787
- }
14788
-
14789
- init() {
14790
- super.init?.();
14791
-
14792
- if (rerenderAttrsList.length) {
14793
- observeAttributes(this, () => this.#renderItems(), { includeAttrs: rerenderAttrsList });
14794
- } else {
14795
- this.#renderItems();
14796
- }
14797
- }
14798
- };
14799
-
14800
- const componentName = getComponentName('apps-list');
14801
-
14802
- const limitAbbreviation = (str, limit = 3) =>
14803
- str
14804
- .trim()
14805
- .split(' ')
14806
- .splice(0, limit)
14807
- .map((s) => s[0]?.toUpperCase())
14808
- .join('');
14809
-
14810
- const itemRenderer = ({ name, icon, url }, _, ref) => `
14811
- <a href="${url}" target="_blank" title="${url}">
14812
- <descope-list-item>
14813
- <descope-avatar
14814
- img="${icon}"
14815
- display-name="${name}"
14816
- abbr=${limitAbbreviation(name)}
14817
- size=${ref.size}
14818
- ></descope-avatar>
14819
- <descope-text
14820
- variant="body1"
14821
- mode="primary"
14822
- >${name}</descope-text>
14823
- </descope-list-item>
14824
- </a>
14825
- `;
14826
-
14827
- const customMixin = (superclass) =>
14828
- class AppsListMixinClass extends superclass {
14829
- get size() {
14830
- return this.getAttribute('size') || 'sm';
14831
- }
14832
- };
14833
-
14834
- const AppsListClass = compose(
14835
- createStyleMixin({
14836
- mappings: {
14837
- maxHeight: { selector: () => ':host' },
14838
- minHeight: { selector: () => ':host' },
14839
- hostDirection: { selector: () => ':host', property: 'direction' },
14840
- itemsFontWeight: {
14841
- selector: TextClass.componentName,
14842
- property: TextClass.cssVarList.fontWeight,
14843
- },
14844
- itemsFontSize: {
14845
- selector: TextClass.componentName,
14846
- property: TextClass.cssVarList.fontSize,
14847
- },
14848
- itemsTextAlign: {
14849
- selector: TextClass.componentName,
14850
- property: TextClass.cssVarList.textAlign,
14851
- },
14852
- },
14853
- }),
14854
- createDynamicDataMixin({ itemRenderer, rerenderAttrsList: ['size'] }),
14855
- draggableMixin,
14856
- componentNameValidationMixin,
14857
- customMixin
14858
- )(
14859
- createProxy({
14860
- slots: ['empty-state'],
14861
- wrappedEleName: 'descope-list',
14862
- excludeAttrsSync: ['tabindex', 'class'],
14863
- componentName,
14864
- style: () => `
14865
- :host {
14866
- width: 100%;
14867
- display: inline-flex;
14868
- }
14869
-
14870
- descope-text::part(text-wrapper) {
14871
- display: -webkit-box;
14872
- -webkit-line-clamp: 2;
14873
- -webkit-box-orient: vertical;
14874
- overflow: hidden;
14875
- }
14876
-
14877
- a {
14878
- text-decoration: none;
14879
- }
14880
-
14881
- descope-text {
14882
- ${TextClass.cssVarList.hostDirection}: var(${AppsListClass.cssVarList.hostDirection});
14883
- }
14884
- `,
14885
- })
14886
- );
14887
-
14888
14893
  const vars$1 = AppsListClass.cssVarList;
14889
14894
  const globalRefs = getThemeRefs(globals);
14890
14895
 
@@ -15031,5 +15036,5 @@ const darkTheme = merge({}, defaultTheme, {
15031
15036
  },
15032
15037
  });
15033
15038
 
15034
- export { AvatarClass, BadgeClass, ButtonClass, ButtonMultiSelectionGroupClass, ButtonSelectionGroupClass, CheckboxClass, CodeSnippetClass, ComboBoxClass, ContainerClass, DividerClass, EmailFieldClass, EnrichedTextClass, GridClass, IconClass, ImageClass, LinkClass, LoaderLinearClass, LoaderRadialClass, LogoClass, MappingsFieldClass, ModalClass, MultiSelectComboBoxClass, NewPasswordClass, NotificationClass, NotpImageClass, NumberFieldClass, PasscodeClass, PasswordClass, PhoneFieldClass, PhoneFieldInputBoxClass, PolicyValidationClass, RadioGroupClass, RecaptchaClass, SamlGroupMappingsClass, SwitchToggleClass, TextAreaClass, TextClass, TextFieldClass, TotpImageClass, UploadFileClass, UserAttributeClass, UserAuthMethodClass, componentsThemeManager, createComponentsTheme, darkTheme, defaultTheme, genColor, globalsThemeToStyle, themeToStyle, themeVars };
15039
+ export { AppsListClass, AvatarClass, BadgeClass, ButtonClass, ButtonMultiSelectionGroupClass, ButtonSelectionGroupClass, CheckboxClass, CodeSnippetClass, ComboBoxClass, ContainerClass, DividerClass, EmailFieldClass, EnrichedTextClass, GridClass, IconClass, ImageClass, LinkClass, ListClass, LoaderLinearClass, LoaderRadialClass, LogoClass, MappingsFieldClass, ModalClass, MultiSelectComboBoxClass, NewPasswordClass, NotificationClass, NotpImageClass, NumberFieldClass, PasscodeClass, PasswordClass, PhoneFieldClass, PhoneFieldInputBoxClass, PolicyValidationClass, RadioGroupClass, RecaptchaClass, SamlGroupMappingsClass, SwitchToggleClass, TextAreaClass, TextClass, TextFieldClass, TotpImageClass, UploadFileClass, UserAttributeClass, UserAuthMethodClass, componentsThemeManager, createComponentsTheme, darkTheme, defaultTheme, genColor, globalsThemeToStyle, themeToStyle, themeVars };
15035
15040
  //# sourceMappingURL=index.esm.js.map