@haiilo/catalyst 0.15.2 → 0.15.3

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.
Files changed (29) hide show
  1. package/dist/catalyst/catalyst.esm.js +1 -1
  2. package/dist/catalyst/catalyst.esm.js.map +1 -1
  3. package/dist/catalyst/{p-7fff102c.entry.js → p-048192b1.entry.js} +5 -5
  4. package/dist/catalyst/p-048192b1.entry.js.map +1 -0
  5. package/dist/cjs/cat-alert_24.cjs.entry.js +70 -7
  6. package/dist/cjs/cat-alert_24.cjs.entry.js.map +1 -1
  7. package/dist/cjs/catalyst.cjs.js +1 -1
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/collection/components/cat-select-remote/cat-select-remote.css +20 -7
  10. package/dist/collection/components/cat-select-remote/cat-select-remote.js +12 -6
  11. package/dist/collection/components/cat-select-remote/cat-select-remote.js.map +1 -1
  12. package/dist/collection/components/cat-select-remote-test/cat-select-remote-test.js +67 -3
  13. package/dist/collection/components/cat-select-remote-test/cat-select-remote-test.js.map +1 -1
  14. package/dist/components/cat-avatar.js +1 -118
  15. package/dist/components/cat-avatar.js.map +1 -1
  16. package/dist/components/cat-avatar2.js +122 -0
  17. package/dist/components/cat-avatar2.js.map +1 -0
  18. package/dist/components/cat-select-remote-test.js +72 -4
  19. package/dist/components/cat-select-remote-test.js.map +1 -1
  20. package/dist/components/cat-select-remote2.js +12 -5
  21. package/dist/components/cat-select-remote2.js.map +1 -1
  22. package/dist/esm/cat-alert_24.entry.js +70 -7
  23. package/dist/esm/cat-alert_24.entry.js.map +1 -1
  24. package/dist/esm/catalyst.js +1 -1
  25. package/dist/esm/loader.js +1 -1
  26. package/dist/types/components/cat-select-remote/cat-select-remote.d.ts +6 -2
  27. package/dist/types/components/cat-select-remote-test/cat-select-remote-test.d.ts +2 -0
  28. package/package.json +2 -2
  29. package/dist/catalyst/p-7fff102c.entry.js.map +0 -1
@@ -12922,7 +12922,7 @@ var autosizeInput = function (element, options) {
12922
12922
  }
12923
12923
  };
12924
12924
 
12925
- const catSelectRemoteCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);margin:0}:host{display:flex;flex-direction:column;gap:0.5rem;position:relative;margin-bottom:1rem}:host([hidden]){display:none}label{align-self:flex-start}label.hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.input-optional{margin-left:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 105, 118, 135))}.select-wrapper{display:flex;align-items:flex-start;background:white;border-radius:0.25rem;box-shadow:0 0 0 1px #d7dbe0;transition:box-shadow 0.13s linear;padding:4px}.select-wrapper:not(.select-disabled):hover{box-shadow:0 0 0 2px #d7dbe0}.select-wrapper:not(.select-disabled):focus-within{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255))}.select-disabled{background:#f8f8fb;cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}.select-wrapper-inner{display:flex;flex:1 1 auto;flex-wrap:wrap;align-items:center;gap:4px;min-width:0}.select-input{font:inherit;background:none;border:none;outline:none;padding:6px 8px;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.select-disabled .select-input{cursor:inherit}.select-pills{display:contents}.pill{display:inline-flex;align-items:center;gap:4px;padding:4px 8px;background:#ebecf0;border-radius:0.125rem;white-space:nowrap;min-width:0}.pill>span{overflow:hidden;text-overflow:ellipsis}.pill>cat-button{margin-right:-4px}.select-btn{transition:transform 0.13s linear}.select-btn::part(button){outline:none}cat-spinner{padding:6px}.select-btn-open{transform:rotate(180deg)}.select-dropdown{position:absolute;right:0;background:white;display:none;overflow:auto;box-shadow:0 1px 4px 0 rgba(16, 29, 48, 0.2);border-radius:0.25rem;z-index:100}.select-options-wrapper{max-height:16rem;width:100%}.select-empty{margin:1rem 0;padding:0 1.25rem}.select-options{list-style-type:none;margin:0;padding:0.5rem 0}.select-options cat-checkbox,.select-options .select-option-single{margin:0;padding:0.5rem 1rem}.select-option-single{cursor:pointer}.select-input-transparent-caret{caret-color:transparent}.select-option-empty,.select-option-loading{padding:0.5rem 1rem}.select-option:hover{background-color:rgba(105, 118, 135, 0.05)}.select-option-active{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:-2px}.select-option-label{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}.select-option-description{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}";
12925
+ const catSelectRemoteCss = ".hint-section{display:flex;gap:0.5rem;flex-direction:column}.hint-section .input-hint,.hint-section ::slotted([slot=hint]){font-size:0.875rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);margin:0}:host{display:flex;flex-direction:column;gap:0.5rem;position:relative;margin-bottom:1rem}:host([hidden]){display:none}label{align-self:flex-start}label.hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.input-optional{margin-left:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 105, 118, 135))}.select-wrapper{display:flex;align-items:flex-start;background:white;border-radius:0.25rem;box-shadow:0 0 0 1px #d7dbe0;transition:box-shadow 0.13s linear;padding:0.25rem}.select-wrapper:not(.select-disabled):hover{box-shadow:0 0 0 2px #d7dbe0}.select-wrapper:not(.select-disabled):focus-within{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255))}.select-disabled{background:#f8f8fb;cursor:not-allowed;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}.select-wrapper-inner{display:flex;flex:1 1 auto;flex-wrap:wrap;align-items:center;gap:0.25rem;min-width:0}.select-wrapper-inner>cat-avatar{padding-left:0.25rem}.select-wrapper-inner cat-avatar{--cat-avatar-size:1.25rem}.select-input{font:inherit;background:none;border:none;outline:none;padding:0.375rem 0.5rem;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.select-disabled .select-input{cursor:inherit}.select-pills{display:contents}.pill{display:inline-flex;align-items:center;gap:0.5rem;padding:0.25rem 0.5rem;background:#ebecf0;border-radius:0.125rem;white-space:nowrap;min-width:0}.pill>span{overflow:hidden;text-overflow:ellipsis}.pill>cat-button{margin-right:-0.25rem;margin-left:-0.25rem}.select-btn{transition:transform 0.13s linear}.select-btn::part(button){outline:none}cat-spinner{padding:0.375rem}.select-btn-open{transform:rotate(180deg)}.select-dropdown{position:absolute;right:0;background:white;display:none;overflow:auto;box-shadow:0 1px 4px 0 rgba(16, 29, 48, 0.2);border-radius:0.25rem;z-index:100}.select-options-wrapper{max-height:16rem;width:100%}.select-empty{margin:1rem 0;padding:0 1.25rem}.select-options{list-style-type:none;margin:0;padding:0.5rem 0}.select-options cat-checkbox,.select-options .select-option-single{margin:0;padding:0.5rem 1rem}.select-option-inner{display:flex;gap:0.5rem;--cat-avatar-size:1.25rem}.select-option-single{cursor:pointer}.select-input-transparent-caret{caret-color:transparent}.select-option-empty,.select-option-loading{padding:0.5rem 1rem}.select-option:hover{background-color:rgba(105, 118, 135, 0.05)}.select-option-active{outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:-2px}.select-option-label{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}.select-option-description{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;color:rgb(var(--cat-font-color-muted, 105, 118, 135))}";
12926
12926
 
12927
12927
  const INIT_STATE = {
12928
12928
  term: '',
@@ -13123,16 +13123,17 @@ const CatSelectRemote = class {
13123
13123
  pill: true,
13124
13124
  'select-no-open': true,
13125
13125
  'select-option-active': this.state.activeSelectionIndex === i
13126
- }, role: "option", "aria-selected": "true", id: `select-${this.id}-selection-${i}` }, index.h("span", null, item.render.label), !this.disabled && (index.h("cat-button", { size: "xs", variant: "text", icon: "16-cross", iconOnly: true, a11yLabel: this.i18n.t('select.deselect'), onClick: () => this.deselect(item.item.id), tabIndex: -1 }))))))) : null, index.h("input", { class: "select-input", ref: el => (this.input = el), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-activedescendant": this.activeDescendant, onInput: () => this.onInput(), value: !this.multiple ? this.state.term : undefined, placeholder: this.placeholder, disabled: this.disabled || this.state.isResolving })), this.state.isResolving && index.h("cat-spinner", null), (this.state.selection.length || this.state.term.length) &&
13126
+ }, role: "option", "aria-selected": "true", id: `select-${this.id}-selection-${i}` }, item.render.avatar ? (index.h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, initials: '' })) : null, index.h("span", null, item.render.label), !this.disabled && (index.h("cat-button", { size: "xs", variant: "text", icon: "16-cross", iconOnly: true, a11yLabel: this.i18n.t('select.deselect'), onClick: () => this.deselect(item.item.id), tabIndex: -1 }))))))) : this.state.selection.length && this.state.selection[0].render.avatar ? (index.h("cat-avatar", { label: this.state.selection[0].render.label, round: this.state.selection[0].render.avatar.round, src: this.state.selection[0].render.avatar.src, initials: '' })) : null, index.h("input", { class: "select-input", ref: el => (this.input = el), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-activedescendant": this.activeDescendant, onInput: () => this.onInput(), value: !this.multiple ? this.state.term : undefined, placeholder: this.placeholder, disabled: this.disabled || this.state.isResolving })), this.state.isResolving && index.h("cat-spinner", null), (this.state.selection.length || this.state.term.length) &&
13127
13127
  !this.disabled &&
13128
13128
  !this.state.isResolving &&
13129
13129
  this.clearable ? (index.h("cat-button", { id: `select-clear-btn-${this.id}`, iconOnly: true, icon: "cross-circle-outlined", variant: "text", size: "s", a11yLabel: this.i18n.t('select.clear'), onClick: () => this.clear() })) : null, !this.state.isResolving && (index.h("cat-button", { iconOnly: true, icon: "chevron-down-outlined", class: { 'select-btn': true, 'select-btn-open': this.state.isOpen }, variant: "text", size: "s", a11yLabel: this.state.isOpen ? this.i18n.t('select.close') : this.i18n.t('select.open'), "aria-controls": `select-listbox-${this.id}`, "aria-expanded": this.state.isOpen, tabIndex: -1, disabled: this.disabled || this.state.isResolving }))), this.hintSection, index.h("div", { class: "select-dropdown", ref: el => (this.dropdown = el), style: { display: this.state.isOpen ? 'block' : undefined } }, this.state.isOpen && (index.h("cat-scrollable", { class: "select-options-wrapper", scrolledBuffer: 56, noOverflowX: true, noOverscroll: true, noScrolledInit: true, onScrolledBottom: () => this.more$.next() }, index.h("ul", { class: "select-options", role: "listbox", "aria-multiselectable": this.multiple, "aria-setsize": this.state.totalElements, id: `select-listbox-${this.id}` }, this.state.options.map((item, i) => (index.h("li", { role: "option", class: "select-option", id: `select-${this.id}-option-${i}`, "aria-selected": this.isSelected(item.item.id) ? 'true' : 'false' }, this.multiple ? (index.h("cat-checkbox", { class: { 'select-option-active': this.state.activeOptionIndex === i }, checked: this.isSelected(item.item.id), tabIndex: -1, labelLeft: true, onFocus: () => { var _a; return (_a = this.input) === null || _a === void 0 ? void 0 : _a.focus(); }, onCatChange: e => {
13130
13130
  this.toggle(item);
13131
13131
  e.stopPropagation();
13132
- } }, index.h("span", { slot: "label", class: "select-option" }, index.h("span", { class: "select-option-label" }, item.render.label), index.h("span", { class: "select-option-description" }, item.render.description)))) : (index.h("div", { class: {
13132
+ } }, index.h("span", { slot: "label", class: "select-option-inner" }, item.render.avatar ? (index.h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, initials: '' })) : null, index.h("span", { class: "select-option-text" }, index.h("span", { class: "select-option-label" }, item.render.label), index.h("span", { class: "select-option-description" }, item.render.description))))) : (index.h("div", { class: {
13133
+ 'select-option-inner': true,
13133
13134
  'select-option-single': true,
13134
13135
  'select-option-active': this.state.activeOptionIndex === i
13135
- }, onFocus: () => { var _a; return (_a = this.input) === null || _a === void 0 ? void 0 : _a.focus(); }, onClick: () => this.select(item), tabIndex: -1 }, index.h("span", { class: "select-option-label" }, item.render.label), index.h("span", { class: "select-option-description" }, item.render.description)))))), this.state.isLoading
13136
+ }, onFocus: () => { var _a; return (_a = this.input) === null || _a === void 0 ? void 0 : _a.focus(); }, onClick: () => this.select(item), tabIndex: -1 }, item.render.avatar ? (index.h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, initials: '' })) : null, index.h("span", { class: "select-option-text" }, index.h("span", { class: "select-option-label" }, item.render.label), index.h("span", { class: "select-option-description" }, item.render.description))))))), this.state.isLoading
13136
13137
  ? Array.from(Array(CatSelectRemote.SKELETON_COUNT)).map(() => (index.h("li", { class: "select-option-loading" }, index.h("cat-skeleton", { variant: "body", lines: 1 }), index.h("cat-skeleton", { variant: "body", lines: 1 }))))
13137
13138
  : !this.state.options.length && index.h("li", { class: "select-option-empty" }, this.i18n.t('select.empty'))))))));
13138
13139
  }
@@ -13344,7 +13345,7 @@ const CatSelectRemoteTest = class {
13344
13345
  index.registerInstance(this, hostRef);
13345
13346
  }
13346
13347
  componentDidLoad() {
13347
- var _a, _b;
13348
+ var _a, _b, _c, _d;
13348
13349
  (_a = this.multipleSelect) === null || _a === void 0 ? void 0 : _a.connect({
13349
13350
  resolve: (ids) => {
13350
13351
  console.info(`Resolving data... (${ids.join(', ')})`);
@@ -13375,7 +13376,41 @@ const CatSelectRemoteTest = class {
13375
13376
  description: user.desc
13376
13377
  })
13377
13378
  });
13378
- (_b = this.singleSelect) === null || _b === void 0 ? void 0 : _b.connect({
13379
+ (_b = this.multipleSelectAvatar) === null || _b === void 0 ? void 0 : _b.connect({
13380
+ resolve: (ids) => {
13381
+ console.info(`Resolving data... (${ids.join(', ')})`);
13382
+ return of(ids.map(id => ({
13383
+ id,
13384
+ firstName: 'John',
13385
+ lastName: `Doe (${id})`,
13386
+ desc: 'resolved'
13387
+ }))).pipe(delay(500));
13388
+ },
13389
+ retrieve: (term, page) => {
13390
+ console.info(`Retrieving data... ("${term}", ${page})`);
13391
+ return term === 'no'
13392
+ ? of({ last: true, content: [], totalElements: 0 })
13393
+ : of({
13394
+ last: false,
13395
+ totalElements: 10000,
13396
+ content: Array.from({ length: 10 }, (_, i) => ({
13397
+ id: '' + (i + page * 10),
13398
+ firstName: 'John',
13399
+ lastName: `Doe (${i + page * 10})`,
13400
+ desc: `"${term}": page ${page}`
13401
+ }))
13402
+ }).pipe(delay(500));
13403
+ },
13404
+ render: (user) => ({
13405
+ label: `${user.firstName} ${user.lastName}`,
13406
+ description: user.desc,
13407
+ avatar: {
13408
+ src: `https://picsum.photos/id/${Math.floor(Math.random() * 100)}/200`,
13409
+ round: true
13410
+ }
13411
+ })
13412
+ });
13413
+ (_c = this.singleSelect) === null || _c === void 0 ? void 0 : _c.connect({
13379
13414
  resolve: (ids) => {
13380
13415
  console.info(`Resolving data... (${ids.join(', ')})`);
13381
13416
  return of(ids.map(id => countries.find(value => value.id === id))).pipe(delay(500));
@@ -13399,9 +13434,37 @@ const CatSelectRemoteTest = class {
13399
13434
  description: country.capital || 'No capital'
13400
13435
  })
13401
13436
  });
13437
+ (_d = this.singleSelectAvatar) === null || _d === void 0 ? void 0 : _d.connect({
13438
+ resolve: (ids) => {
13439
+ console.info(`Resolving data... (${ids.join(', ')})`);
13440
+ return of(ids.map(id => countries.find(value => value.id === id))).pipe(delay(500));
13441
+ },
13442
+ retrieve: (term, page) => {
13443
+ console.info(`Retrieving data... ("${term}", ${page})`);
13444
+ const filter = countries.filter(value => {
13445
+ var _a;
13446
+ return value.country.toLowerCase().indexOf(term.toLowerCase()) === 0 ||
13447
+ ((_a = value.capital) === null || _a === void 0 ? void 0 : _a.toLowerCase().indexOf(term.toLowerCase())) === 0;
13448
+ });
13449
+ const slice = filter.slice(page * 10, page * 10 + 10);
13450
+ return of({
13451
+ last: slice.length < 10,
13452
+ totalElements: filter.length,
13453
+ content: slice
13454
+ }).pipe(delay(500));
13455
+ },
13456
+ render: (country) => ({
13457
+ label: country.country,
13458
+ description: country.capital || 'No capital',
13459
+ avatar: {
13460
+ src: `https://picsum.photos/id/${Math.floor(Math.random() * 100)}/200`,
13461
+ round: true
13462
+ }
13463
+ })
13464
+ });
13402
13465
  }
13403
13466
  render() {
13404
- return (index.h(index.Host, { style: { display: 'flex', flexDirection: 'column' } }, index.h("cat-select-remote", { label: "Multiple Select", hint: "This is a hint!", ref: el => (this.multipleSelect = el), value: ['1'], placeholder: "Hello World", onCatChange: e => console.log('Multiple', e), onCatBlur: e => console.log('Multiple blur', e), multiple: true, clearable: true }, index.h("span", { slot: "hint" }, "Searching for \"no\" -", '>', " no options are returned!")), index.h("cat-select-remote", { label: "Single Select", hint: "This is a hint!", ref: el => (this.singleSelect = el), value: '1', placeholder: "Search for a country or capital", onCatChange: e => console.log('Single', e), onCatBlur: e => console.log('Single blur', e), clearable: true })));
13467
+ return (index.h(index.Host, { style: { display: 'flex', flexDirection: 'column' } }, index.h("cat-select-remote", { label: "Multiple Select", hint: "This is a hint!", ref: el => (this.multipleSelect = el), value: ['1'], placeholder: "Hello World", onCatChange: e => console.log('Multiple', e), onCatBlur: e => console.log('Multiple blur', e), multiple: true, clearable: true }, index.h("span", { slot: "hint" }, "Searching for \"no\" -", '>', " no options are returned!")), index.h("cat-select-remote", { label: "Multiple with img", ref: el => (this.multipleSelectAvatar = el), value: ['1'], placeholder: "Hello World", multiple: true, clearable: true }), index.h("cat-select-remote", { label: "Single Select", hint: "This is a hint!", ref: el => (this.singleSelect = el), value: '1', placeholder: "Search for a country or capital", onCatChange: e => console.log('Single', e), onCatBlur: e => console.log('Single blur', e), clearable: true }), index.h("cat-select-remote", { label: "Single with img", ref: el => (this.singleSelectAvatar = el), value: '1', placeholder: "Search for a country or capital", clearable: true })));
13405
13468
  }
13406
13469
  };
13407
13470
  const countries = [