@descope/web-components-ui 1.0.386 → 1.0.388
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/cjs/index.cjs.js +1361 -1238
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1326 -1202
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/8980.js +5 -2
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/boolean-fields-descope-checkbox-index-js.js +1 -1
- package/dist/umd/boolean-fields-descope-switch-toggle-index-js.js +1 -1
- package/dist/umd/descope-apps-list-index-js.js +1 -1
- package/dist/umd/descope-date-field-descope-calendar-index-js.js +1 -1
- package/dist/umd/descope-date-field-index-js.js +1 -1
- package/dist/umd/descope-grid-descope-grid-selection-column-index-js.js +1 -1
- package/dist/umd/descope-grid-index-js.js +1 -1
- package/dist/umd/descope-scopes-list-index-js.js +2 -0
- package/dist/umd/descope-scopes-list-index-js.js.LICENSE.txt +5 -0
- package/dist/umd/index.js +1 -1
- package/package.json +2 -2
- package/src/components/boolean-fields/commonStyles.js +1 -2
- package/src/components/boolean-fields/descope-checkbox/CheckboxClass.js +6 -0
- package/src/components/descope-date-field/DateFieldClass.js +66 -44
- package/src/components/descope-date-field/descope-calendar/CalendarClass.js +2 -2
- package/src/components/descope-scopes-list/ScopesListClass.js +111 -0
- package/src/components/descope-scopes-list/index.js +7 -0
- package/src/index.cjs.js +1 -0
- package/src/index.js +1 -0
- package/src/mixins/createDynamicDataMixin.js +9 -28
- package/src/theme/components/checkbox.js +1 -8
- package/src/theme/components/dateField.js +0 -1
- package/src/theme/components/index.js +2 -0
- package/src/theme/components/scopesList.js +15 -0
| @@ -0,0 +1,111 @@ | |
| 1 | 
            +
            import { createBaseClass } from '../../baseClasses/createBaseClass';
         | 
| 2 | 
            +
            import { compose } from '../../helpers';
         | 
| 3 | 
            +
            import { getComponentName } from '../../helpers/componentHelpers';
         | 
| 4 | 
            +
            import { componentNameValidationMixin, createStyleMixin, draggableMixin } from '../../mixins';
         | 
| 5 | 
            +
            import { createDynamicDataMixin } from '../../mixins/createDynamicDataMixin';
         | 
| 6 | 
            +
            import { CheckboxClass } from '../boolean-fields/descope-checkbox/CheckboxClass';
         | 
| 7 | 
            +
            import { SwitchToggleClass } from '../boolean-fields/descope-switch-toggle/SwitchToggleClass';
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            export const componentName = getComponentName('scopes-list');
         | 
| 10 | 
            +
            const variants = ['checkbox', 'switch'];
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            const itemRenderer = ({ id, desc, required = false }, _, ref) => {
         | 
| 13 | 
            +
              const ComponentClass = ref.variant === 'checkbox' ? CheckboxClass : SwitchToggleClass;
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              return `
         | 
| 16 | 
            +
                <${ComponentClass.componentName}
         | 
| 17 | 
            +
                  bordered="true"
         | 
| 18 | 
            +
                  size=${ref.size}
         | 
| 19 | 
            +
                  label="${desc}"
         | 
| 20 | 
            +
                  data-id="${id}"
         | 
| 21 | 
            +
                  readonly="${required || ref.isReadOnly}"
         | 
| 22 | 
            +
                  required="${required}"
         | 
| 23 | 
            +
                  checked="true"
         | 
| 24 | 
            +
                ></${ComponentClass.componentName}>
         | 
| 25 | 
            +
            `;
         | 
| 26 | 
            +
            };
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            class RawScopesList extends createBaseClass({ componentName, baseSelector: 'div' }) {
         | 
| 29 | 
            +
              constructor() {
         | 
| 30 | 
            +
                super();
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                this.attachShadow({ mode: 'open' }).innerHTML = `
         | 
| 33 | 
            +
            		<style>
         | 
| 34 | 
            +
                  :host {
         | 
| 35 | 
            +
                    display: inline-flex;
         | 
| 36 | 
            +
                  }
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                  div {
         | 
| 39 | 
            +
                    display: flex;
         | 
| 40 | 
            +
                    flex-direction: column;
         | 
| 41 | 
            +
                  }
         | 
| 42 | 
            +
             | 
| 43 | 
            +
            		</style>
         | 
| 44 | 
            +
                <div></div>
         | 
| 45 | 
            +
            		`;
         | 
| 46 | 
            +
              }
         | 
| 47 | 
            +
             | 
| 48 | 
            +
              get isReadOnly() {
         | 
| 49 | 
            +
                return this.getAttribute('readonly') === 'true';
         | 
| 50 | 
            +
              }
         | 
| 51 | 
            +
             | 
| 52 | 
            +
              get size() {
         | 
| 53 | 
            +
                return this.getAttribute('size') || 'sm';
         | 
| 54 | 
            +
              }
         | 
| 55 | 
            +
             | 
| 56 | 
            +
              get value() {
         | 
| 57 | 
            +
                return Array.from(this.shadowRoot.querySelector('div').children).reduce(
         | 
| 58 | 
            +
                  (acc, el) => ({ ...acc, [el.getAttribute('data-id')]: el.checked }),
         | 
| 59 | 
            +
                  {}
         | 
| 60 | 
            +
                );
         | 
| 61 | 
            +
              }
         | 
| 62 | 
            +
             | 
| 63 | 
            +
              get variant() {
         | 
| 64 | 
            +
                const variant = this.getAttribute('variant');
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                return variants.includes(variant) ? variant : variants[0];
         | 
| 67 | 
            +
              }
         | 
| 68 | 
            +
            }
         | 
| 69 | 
            +
             | 
| 70 | 
            +
            export const ScopesListClass = compose(
         | 
| 71 | 
            +
              createStyleMixin({
         | 
| 72 | 
            +
                mappings: {
         | 
| 73 | 
            +
                  hostWidth: { selector: () => ':host', property: 'width' },
         | 
| 74 | 
            +
                  hostDirection: [
         | 
| 75 | 
            +
                    { selector: () => ':host', property: 'direction' },
         | 
| 76 | 
            +
                    {
         | 
| 77 | 
            +
                      selector: () => CheckboxClass.componentName,
         | 
| 78 | 
            +
                      property: CheckboxClass.cssVarList.hostDirection,
         | 
| 79 | 
            +
                    },
         | 
| 80 | 
            +
                    {
         | 
| 81 | 
            +
                      selector: () => SwitchToggleClass.componentName,
         | 
| 82 | 
            +
                      property: SwitchToggleClass.cssVarList.hostDirection,
         | 
| 83 | 
            +
                    },
         | 
| 84 | 
            +
                  ],
         | 
| 85 | 
            +
                  gap: { selector: () => 'div', property: 'gap' },
         | 
| 86 | 
            +
                  requiredInputBorderColor: [
         | 
| 87 | 
            +
                    {
         | 
| 88 | 
            +
                      selector: `${CheckboxClass.componentName}[required="true"]`,
         | 
| 89 | 
            +
                      property: CheckboxClass.cssVarList.inputBorderColor,
         | 
| 90 | 
            +
                    },
         | 
| 91 | 
            +
                    {
         | 
| 92 | 
            +
                      selector: `${SwitchToggleClass.componentName}[required="true"]`,
         | 
| 93 | 
            +
                      property: SwitchToggleClass.cssVarList.inputBorderColor,
         | 
| 94 | 
            +
                    },
         | 
| 95 | 
            +
                  ],
         | 
| 96 | 
            +
                  requiredInputValueTextColor: [
         | 
| 97 | 
            +
                    {
         | 
| 98 | 
            +
                      selector: `${CheckboxClass.componentName}[required="true"]`,
         | 
| 99 | 
            +
                      property: CheckboxClass.cssVarList.inputValueTextColor,
         | 
| 100 | 
            +
                    },
         | 
| 101 | 
            +
                    {
         | 
| 102 | 
            +
                      selector: `${SwitchToggleClass.componentName}[required="true"]`,
         | 
| 103 | 
            +
                      property: SwitchToggleClass.cssVarList.knobColor,
         | 
| 104 | 
            +
                    },
         | 
| 105 | 
            +
                  ],
         | 
| 106 | 
            +
                },
         | 
| 107 | 
            +
              }),
         | 
| 108 | 
            +
              createDynamicDataMixin({ itemRenderer, rerenderAttrsList: ['size', 'variant'] }),
         | 
| 109 | 
            +
              draggableMixin,
         | 
| 110 | 
            +
              componentNameValidationMixin
         | 
| 111 | 
            +
            )(RawScopesList);
         | 
    
        package/src/index.cjs.js
    CHANGED
    
    | @@ -52,3 +52,4 @@ export { CalendarClass } from './components/descope-date-field/descope-calendar/ | |
| 52 52 | 
             
            export { ListClass } from './components/descope-list/ListClass';
         | 
| 53 53 | 
             
            export { ListItemClass } from './components/descope-list/ListItemClass';
         | 
| 54 54 | 
             
            export { AppsListClass } from './components/descope-apps-list/AppsListClass';
         | 
| 55 | 
            +
            export { ScopesListClass } from './components/descope-scopes-list/ScopesListClass';
         | 
    
        package/src/index.js
    CHANGED
    
    | @@ -44,6 +44,7 @@ export * from './components/descope-code-snippet'; | |
| 44 44 | 
             
            export * from './components/descope-radio-group';
         | 
| 45 45 | 
             
            export * from './components/descope-list';
         | 
| 46 46 | 
             
            export * from './components/descope-apps-list';
         | 
| 47 | 
            +
            export * from './components/descope-scopes-list';
         | 
| 47 48 |  | 
| 48 49 | 
             
            export {
         | 
| 49 50 | 
             
              globalsThemeToStyle,
         | 
| @@ -75,18 +75,14 @@ export const createDynamicDataMixin = | |
| 75 75 | 
             
                  init() {
         | 
| 76 76 | 
             
                    super.init?.();
         | 
| 77 77 |  | 
| 78 | 
            -
                     | 
| 79 | 
            -
                       | 
| 80 | 
            -
             | 
| 81 | 
            -
                        (attrs)  | 
| 82 | 
            -
             | 
| 83 | 
            -
             | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 86 | 
            -
                      );
         | 
| 87 | 
            -
                    } else {
         | 
| 88 | 
            -
                      this.#renderItems();
         | 
| 89 | 
            -
                    }
         | 
| 78 | 
            +
                    observeAttributes(
         | 
| 79 | 
            +
                      this,
         | 
| 80 | 
            +
                      (attrs) => {
         | 
| 81 | 
            +
                        if (attrs.includes('data')) this.#handleDataAttr();
         | 
| 82 | 
            +
                        else this.#renderItems();
         | 
| 83 | 
            +
                      },
         | 
| 84 | 
            +
                      { includeAttrs: [...rerenderAttrsList, 'data'] }
         | 
| 85 | 
            +
                    );
         | 
| 90 86 | 
             
                  }
         | 
| 91 87 |  | 
| 92 88 | 
             
                  #handleDataAttr() {
         | 
| @@ -95,25 +91,10 @@ export const createDynamicDataMixin = | |
| 95 91 | 
             
                    if (!dataAttr) return;
         | 
| 96 92 |  | 
| 97 93 | 
             
                    try {
         | 
| 98 | 
            -
                      this | 
| 94 | 
            +
                      this.data = JSON.parse(dataAttr);
         | 
| 99 95 | 
             
                    } catch (e) {
         | 
| 100 96 | 
             
                      // eslint-disable-next-line no-console
         | 
| 101 97 | 
             
                      console.warn('Invalid JSON data', dataAttr);
         | 
| 102 98 | 
             
                    }
         | 
| 103 99 | 
             
                  }
         | 
| 104 | 
            -
             | 
| 105 | 
            -
                  attributeChangedCallback(name, oldValue, newValue) {
         | 
| 106 | 
            -
                    super.attributeChangedCallback?.(name, oldValue, newValue);
         | 
| 107 | 
            -
             | 
| 108 | 
            -
                    if (newValue === oldValue) return;
         | 
| 109 | 
            -
             | 
| 110 | 
            -
                    if (name === 'data') {
         | 
| 111 | 
            -
                      try {
         | 
| 112 | 
            -
                        this.data = JSON.parse(newValue);
         | 
| 113 | 
            -
                      } catch (e) {
         | 
| 114 | 
            -
                        // eslint-disable-next-line no-console
         | 
| 115 | 
            -
                        console.warn('Invalid JSON data', newValue);
         | 
| 116 | 
            -
                      }
         | 
| 117 | 
            -
                    }
         | 
| 118 | 
            -
                  }
         | 
| 119 100 | 
             
                };
         | 
| @@ -25,14 +25,7 @@ const checkbox = { | |
| 25 25 | 
             
              [vars.inputBorderStyle]: refs.borderStyle,
         | 
| 26 26 | 
             
              [vars.inputBackgroundColor]: refs.backgroundColor,
         | 
| 27 27 | 
             
              [vars.inputSize]: checkboxSize,
         | 
| 28 | 
            -
             | 
| 29 | 
            -
              _checked: {
         | 
| 30 | 
            -
                [vars.inputValueTextColor]: refs.valueTextColor,
         | 
| 31 | 
            -
              },
         | 
| 32 | 
            -
             | 
| 33 | 
            -
              _disabled: {
         | 
| 34 | 
            -
                [vars.labelTextColor]: refs.labelTextColor,
         | 
| 35 | 
            -
              },
         | 
| 28 | 
            +
              [vars.inputValueTextColor]: refs.valueTextColor,
         | 
| 36 29 | 
             
            };
         | 
| 37 30 |  | 
| 38 31 | 
             
            export default checkbox;
         | 
| @@ -46,6 +46,7 @@ import * as dateField from './dateField'; | |
| 46 46 | 
             
            import * as list from './list/list';
         | 
| 47 47 | 
             
            import * as listItem from './list/listItem';
         | 
| 48 48 | 
             
            import * as appsList from './appsList';
         | 
| 49 | 
            +
            import * as scopesList from './scopesList';
         | 
| 49 50 |  | 
| 50 51 | 
             
            const components = {
         | 
| 51 52 | 
             
              button,
         | 
| @@ -97,6 +98,7 @@ const components = { | |
| 97 98 | 
             
              list,
         | 
| 98 99 | 
             
              listItem,
         | 
| 99 100 | 
             
              appsList,
         | 
| 101 | 
            +
              scopesList,
         | 
| 100 102 | 
             
            };
         | 
| 101 103 |  | 
| 102 104 | 
             
            const theme = Object.keys(components).reduce(
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            import { ScopesListClass } from '../../components/descope-scopes-list/ScopesListClass';
         | 
| 2 | 
            +
            import theme, { vars as inputVars } from './inputWrapper';
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            export const vars = ScopesListClass.cssVarList;
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            const scopesList = {
         | 
| 7 | 
            +
              [vars.requiredInputBorderColor]: theme._disabled[inputVars.borderColor],
         | 
| 8 | 
            +
              [vars.requiredInputValueTextColor]: theme._disabled[inputVars.valueTextColor],
         | 
| 9 | 
            +
              [vars.hostWidth]: '280px',
         | 
| 10 | 
            +
              _fullWidth: {
         | 
| 11 | 
            +
                [vars.hostWidth]: '100%',
         | 
| 12 | 
            +
              },
         | 
| 13 | 
            +
            };
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            export default scopesList;
         |