@crowdstrike/glide-core 0.29.2 → 0.30.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.
Files changed (122) hide show
  1. package/dist/accordion.js +240 -1
  2. package/dist/accordion.styles.js +13 -7
  3. package/dist/button-group.button.js +143 -1
  4. package/dist/button-group.button.styles.js +43 -15
  5. package/dist/button-group.js +249 -1
  6. package/dist/button-group.styles.js +10 -5
  7. package/dist/button.js +206 -1
  8. package/dist/button.styles.js +12 -7
  9. package/dist/checkbox-group.js +479 -14
  10. package/dist/checkbox-group.styles.js +5 -2
  11. package/dist/checkbox.js +519 -32
  12. package/dist/checkbox.styles.js +10 -5
  13. package/dist/drawer.js +168 -1
  14. package/dist/drawer.styles.js +5 -2
  15. package/dist/dropdown.js +2423 -123
  16. package/dist/dropdown.option.js +536 -1
  17. package/dist/dropdown.option.styles.js +5 -2
  18. package/dist/dropdown.styles.js +14 -7
  19. package/dist/form-controls-layout.js +102 -1
  20. package/dist/form-controls-layout.styles.js +5 -2
  21. package/dist/icon-button.js +139 -1
  22. package/dist/icon-button.styles.js +19 -7
  23. package/dist/icons/checked.js +28 -1
  24. package/dist/icons/chevron.js +21 -1
  25. package/dist/icons/magnifying-glass.js +23 -1
  26. package/dist/icons/pencil.js +21 -1
  27. package/dist/icons/severity-critical.js +20 -1
  28. package/dist/icons/severity-informational.js +20 -1
  29. package/dist/icons/severity-medium.js +20 -1
  30. package/dist/icons/x.js +21 -1
  31. package/dist/inline-alert.js +118 -1
  32. package/dist/inline-alert.styles.js +5 -2
  33. package/dist/input.d.ts +8 -2
  34. package/dist/input.js +505 -41
  35. package/dist/input.styles.js +25 -4
  36. package/dist/label.js +303 -1
  37. package/dist/label.styles.js +11 -5
  38. package/dist/library/assert-slot.js +136 -1
  39. package/dist/library/expect-unhandled-rejection.js +14 -1
  40. package/dist/library/expect-window-error.js +26 -1
  41. package/dist/library/final.js +18 -1
  42. package/dist/library/form-control.js +1 -1
  43. package/dist/library/localize.js +10 -1
  44. package/dist/library/mouse.js +35 -1
  45. package/dist/library/on-resize.js +24 -1
  46. package/dist/library/required.js +35 -1
  47. package/dist/library/shadow-root-mode.js +4 -1
  48. package/dist/library/unique-id.js +3 -1
  49. package/dist/link.js +92 -1
  50. package/dist/link.styles.js +10 -5
  51. package/dist/menu.d.ts +3 -2
  52. package/dist/menu.js +1259 -1
  53. package/dist/menu.styles.js +34 -17
  54. package/dist/modal.d.ts +4 -0
  55. package/dist/modal.icon-button.js +60 -1
  56. package/dist/modal.icon-button.styles.js +5 -2
  57. package/dist/modal.js +473 -1
  58. package/dist/modal.styles.js +71 -22
  59. package/dist/option.d.ts +74 -0
  60. package/dist/option.js +498 -0
  61. package/dist/option.styles.js +140 -0
  62. package/dist/{menu.options.d.ts → options.d.ts} +5 -6
  63. package/dist/options.js +130 -0
  64. package/dist/options.styles.js +21 -0
  65. package/dist/popover.js +620 -1
  66. package/dist/popover.styles.js +11 -5
  67. package/dist/radio-group.js +624 -17
  68. package/dist/radio-group.radio.js +211 -1
  69. package/dist/radio-group.radio.styles.js +9 -4
  70. package/dist/radio-group.styles.js +5 -2
  71. package/dist/slider.js +1040 -61
  72. package/dist/slider.styles.js +9 -4
  73. package/dist/spinner.js +60 -1
  74. package/dist/spinner.styles.js +5 -2
  75. package/dist/split-button.js +116 -1
  76. package/dist/split-button.primary-button.js +100 -1
  77. package/dist/split-button.primary-button.styles.js +13 -6
  78. package/dist/split-button.primary-link.js +102 -1
  79. package/dist/split-button.secondary-button.d.ts +2 -3
  80. package/dist/split-button.secondary-button.js +121 -1
  81. package/dist/split-button.secondary-button.styles.js +12 -7
  82. package/dist/split-button.styles.js +9 -4
  83. package/dist/styles/focus-outline.js +9 -3
  84. package/dist/styles/fonts.css +6 -1
  85. package/dist/styles/opacity-and-scale-animation.js +6 -3
  86. package/dist/styles/skeleton.js +6 -3
  87. package/dist/styles/variables.css +410 -1
  88. package/dist/styles/visually-hidden.js +6 -3
  89. package/dist/tab.group.js +386 -1
  90. package/dist/tab.group.styles.js +5 -2
  91. package/dist/tab.js +133 -1
  92. package/dist/tab.panel.js +93 -1
  93. package/dist/tab.panel.styles.js +11 -5
  94. package/dist/tab.styles.js +9 -4
  95. package/dist/tag.js +207 -1
  96. package/dist/tag.styles.js +10 -5
  97. package/dist/textarea.js +353 -19
  98. package/dist/textarea.styles.js +23 -4
  99. package/dist/toast.js +130 -1
  100. package/dist/toast.toasts.js +248 -25
  101. package/dist/toast.toasts.styles.js +9 -4
  102. package/dist/toggle.js +178 -1
  103. package/dist/toggle.styles.js +25 -5
  104. package/dist/tooltip.container.js +130 -1
  105. package/dist/tooltip.container.styles.js +5 -2
  106. package/dist/tooltip.js +484 -1
  107. package/dist/tooltip.styles.js +21 -5
  108. package/dist/translations/en.js +36 -1
  109. package/dist/translations/fr.js +37 -1
  110. package/dist/translations/ja.js +37 -1
  111. package/package.json +8 -12
  112. package/dist/menu.button.d.ts +0 -42
  113. package/dist/menu.button.js +0 -1
  114. package/dist/menu.button.styles.js +0 -32
  115. package/dist/menu.link.d.ts +0 -44
  116. package/dist/menu.link.js +0 -1
  117. package/dist/menu.link.styles.js +0 -35
  118. package/dist/menu.options.js +0 -1
  119. package/dist/menu.options.styles.d.ts +0 -2
  120. package/dist/menu.options.styles.js +0 -20
  121. /package/dist/{menu.button.styles.d.ts → option.styles.d.ts} +0 -0
  122. /package/dist/{menu.link.styles.d.ts → options.styles.d.ts} +0 -0
@@ -1 +1,24 @@
1
- import{LitElement,noChange}from"lit";import{Directive,directive}from"lit/directive.js";class OnResize extends Directive{render(e,t){return noChange}update(e,[t,r]){return e.options?.host instanceof LitElement&&!e.options.host.hasUpdated&&(this.#e=new ResizeObserver(t),this.#e.observe(e.element,r)),this.render(t,r)}#e}export default directive(OnResize);
1
+ import { LitElement, noChange } from 'lit';
2
+ import { Directive, directive } from 'lit/directive.js';
3
+ class OnResize extends Directive {
4
+ render(
5
+ // This method is required, both by `Directive` and so the directive's
6
+ // options are typed at `onResize()` callsite.
7
+ //
8
+ /* eslint-disable @typescript-eslint/no-unused-vars */
9
+ callback, options) {
10
+ return noChange;
11
+ }
12
+ update(part, [callback, options]) {
13
+ if (part.options?.host instanceof LitElement &&
14
+ !part.options.host.hasUpdated) {
15
+ this.#observer = new ResizeObserver(callback);
16
+ this.#observer.observe(part.element, options);
17
+ }
18
+ // Purely for test coverage purposes. If `update()` doesn't call `render()`,
19
+ // nothing will because `update()` exists.
20
+ return this.render(callback, options);
21
+ }
22
+ #observer;
23
+ }
24
+ export default directive(OnResize);
@@ -1 +1,35 @@
1
- import{ReactiveElement}from"lit";const isThrow=["localhost","127.0.0.1"].some((t=>window.location.host.includes(t)));class RequiredController{hostUpdate(){if((void 0===this.#t[this.#o]||null===this.#t[this.#o])&&isThrow)throw new TypeError(`Expected ${this.#e} to have a \`${this.#o}\` property.`)}constructor(t,o,e){t.addController(this),this.#t=t,this.#o=o,this.#e=e}#t;#o;#e}export default function(t,o){if(Object.prototype.isPrototypeOf.call(ReactiveElement,t.constructor)){t.constructor.addInitializer((e=>{new RequiredController(e,o,t.constructor.name)}))}}
1
+ import { ReactiveElement, } from 'lit';
2
+ const isThrow = ['localhost', '127.0.0.1'].some((host) => {
3
+ return window.location.host.includes(host);
4
+ });
5
+ class RequiredController {
6
+ hostUpdate() {
7
+ const isNullOrUndefined =
8
+ // @ts-expect-error `ReactiveControllerHost` doesn't have an index type.
9
+ this.#host[this.#key] === undefined || this.#host[this.#key] === null;
10
+ if (isNullOrUndefined && isThrow) {
11
+ // We throw in `hostUpdate()` instead of `hostUpdated()`, which is called
12
+ // after render, so it's obvious something has gone wrong. Sometimes a log
13
+ // gets lost in the noise. A component that has failed to render has a better
14
+ // chance of catching developers' attention.
15
+ throw new TypeError(`Expected ${this.#name} to have a \`${this.#key}\` property.`);
16
+ }
17
+ }
18
+ constructor(host, key, name) {
19
+ host.addController(this);
20
+ this.#host = host;
21
+ this.#key = key;
22
+ this.#name = name;
23
+ }
24
+ #host;
25
+ #key;
26
+ #name;
27
+ }
28
+ export default function (prototype, key) {
29
+ if (Object.prototype.isPrototypeOf.call(ReactiveElement, prototype.constructor)) {
30
+ const constructor = prototype.constructor;
31
+ constructor.addInitializer((instance) => {
32
+ new RequiredController(instance, key, prototype.constructor.name);
33
+ });
34
+ }
35
+ }
@@ -1 +1,4 @@
1
- export default window.navigator.webdriver?"open":"closed";
1
+ // This one-liner exists for code coverage purposes. Components
2
+ // can't inline the ternary because the alternate branch is
3
+ // untestable.
4
+ export default window.navigator.webdriver ? 'open' : 'closed';
@@ -1 +1,3 @@
1
- export default()=>`${Math.random().toString(36).slice(2)}${Math.random().toString(36).slice(2)}`;
1
+ export default () => {
2
+ return `${Math.random().toString(36).slice(2)}${Math.random().toString(36).slice(2)}`;
3
+ };
package/dist/link.js CHANGED
@@ -1 +1,92 @@
1
- var __decorate=this&&this.__decorate||function(e,t,o,r){var i,s=arguments.length,l=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,r);else for(var n=e.length-1;n>=0;n--)(i=e[n])&&(l=(s<3?i(l):s>3?i(t,o,l):i(t,o))||l);return s>3&&l&&Object.defineProperty(t,o,l),l};import{html,LitElement}from"lit";import{classMap}from"lit/directives/class-map.js";import{customElement,property}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import{createRef,ref}from"lit/directives/ref.js";import packageJson from"../package.json"with{type:"json"};import styles from"./link.styles.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import required from"./library/required.js";let Link=class Link extends LitElement{constructor(){super(...arguments),this.disabled=!1,this.version=packageJson.version,this.#e=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0,mode:shadowRootMode}}static{this.styles=styles}click(){this.#e.value?.click()}render(){return html`<a aria-disabled="${this.disabled}" class="${classMap({component:!0,disabled:this.disabled,href:Boolean(this.href)})}" data-test="component" download="${ifDefined(this.download)}" href="${ifDefined(this.href)}" target="${ifDefined(this.target)}" @click="${this.#t}" ${ref(this.#e)}>${this.label}</a>`}#e;#t(e){this.disabled&&(e.preventDefault(),e.stopPropagation())}};__decorate([property({reflect:!0}),required],Link.prototype,"label",void 0),__decorate([property({reflect:!0,type:Boolean})],Link.prototype,"disabled",void 0),__decorate([property({reflect:!0})],Link.prototype,"download",void 0),__decorate([property({reflect:!0})],Link.prototype,"href",void 0),__decorate([property({reflect:!0})],Link.prototype,"target",void 0),__decorate([property({reflect:!0})],Link.prototype,"version",void 0),Link=__decorate([customElement("glide-core-link"),final],Link);export default Link;
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { html, LitElement } from 'lit';
8
+ import { classMap } from 'lit/directives/class-map.js';
9
+ import { customElement, property } from 'lit/decorators.js';
10
+ import { ifDefined } from 'lit/directives/if-defined.js';
11
+ import { createRef, ref } from 'lit/directives/ref.js';
12
+ import packageJson from '../package.json' with { type: 'json' };
13
+ import styles from './link.styles.js';
14
+ import shadowRootMode from './library/shadow-root-mode.js';
15
+ import final from './library/final.js';
16
+ import required from './library/required.js';
17
+ /**
18
+ * @attr {string} label
19
+ * @attr {boolean} [disabled=false]
20
+ * @attr {string} [download]
21
+ * @attr {string} [href]
22
+ * @attr {'_blank'|'_parent'|'_self'|'_top'} [target]
23
+ *
24
+ * @readonly
25
+ * @attr {string} [version]
26
+ */
27
+ let Link = class Link extends LitElement {
28
+ constructor() {
29
+ super(...arguments);
30
+ this.disabled = false;
31
+ this.version = packageJson.version;
32
+ this.#componentElementRef = createRef();
33
+ }
34
+ static { this.shadowRootOptions = {
35
+ ...LitElement.shadowRootOptions,
36
+ delegatesFocus: true,
37
+ mode: shadowRootMode,
38
+ }; }
39
+ static { this.styles = styles; }
40
+ click() {
41
+ this.#componentElementRef.value?.click();
42
+ }
43
+ render() {
44
+ return html `<a
45
+ aria-disabled=${this.disabled}
46
+ class=${classMap({
47
+ component: true,
48
+ disabled: this.disabled,
49
+ href: Boolean(this.href),
50
+ })}
51
+ data-test="component"
52
+ download=${ifDefined(this.download)}
53
+ href=${ifDefined(this.href)}
54
+ target=${ifDefined(this.target)}
55
+ @click=${this.#onClick}
56
+ ${ref(this.#componentElementRef)}
57
+ >
58
+ ${this.label}
59
+ </a>`;
60
+ }
61
+ #componentElementRef;
62
+ #onClick(event) {
63
+ if (this.disabled) {
64
+ event.preventDefault();
65
+ event.stopPropagation();
66
+ }
67
+ }
68
+ };
69
+ __decorate([
70
+ property({ reflect: true }),
71
+ required
72
+ ], Link.prototype, "label", void 0);
73
+ __decorate([
74
+ property({ reflect: true, type: Boolean })
75
+ ], Link.prototype, "disabled", void 0);
76
+ __decorate([
77
+ property({ reflect: true })
78
+ ], Link.prototype, "download", void 0);
79
+ __decorate([
80
+ property({ reflect: true })
81
+ ], Link.prototype, "href", void 0);
82
+ __decorate([
83
+ property({ reflect: true })
84
+ ], Link.prototype, "target", void 0);
85
+ __decorate([
86
+ property({ reflect: true })
87
+ ], Link.prototype, "version", void 0);
88
+ Link = __decorate([
89
+ customElement('glide-core-link'),
90
+ final
91
+ ], Link);
92
+ export default Link;
@@ -1,11 +1,15 @@
1
- import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export default[css`
2
- ${focusOutline(".component:focus-visible")}
3
- `,css`
1
+ import { css } from 'lit';
2
+ import focusOutline from './styles/focus-outline.js';
3
+ export default [
4
+ css `
5
+ ${focusOutline('.component:focus-visible')}
6
+ `,
7
+ css `
4
8
  .component {
5
9
  border-radius: var(--glide-core-rounding-base-radius-xxs);
6
10
  color: var(--glide-core-color-interactive-text-link);
7
11
  font-family: var(--glide-core-typography-family-primary);
8
- font-size: var(--glide-core-typography-size-body-small);
12
+ font-size: var(--glide-core-typography-size-body-default);
9
13
  font-weight: var(--glide-core-typography-weight-regular);
10
14
  text-decoration: none;
11
15
 
@@ -24,4 +28,5 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";export
24
28
  }
25
29
  }
26
30
  }
27
- `];
31
+ `,
32
+ ];
package/dist/menu.d.ts CHANGED
@@ -13,8 +13,8 @@ declare global {
13
13
  * @readonly
14
14
  * @attr {string} [version]
15
15
  *
16
- * @slot {MenuOptions}
17
- * @slot {Element} [target] - The element to which the popover will anchor. Can be any focusable element.
16
+ * @slot {Element}
17
+ * @slot {Element} target - The element to which Menu will anchor. Can be any focusable element unless it's the target of a sub-Menu, in which case the element shouldn't be focusable. If you want Menu to be filterable, put an Input in this slot. Listen for Input's "input" event, then add and remove Option(s) from Menu's default slot based on Input's value.
18
18
  *
19
19
  * @fires {Event} toggle
20
20
  */
@@ -38,6 +38,7 @@ export default class Menu extends LitElement {
38
38
  get open(): boolean;
39
39
  set open(isOpen: boolean);
40
40
  placement: 'bottom' | 'left' | 'right' | 'top' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end' | 'top-start' | 'top-end';
41
+ privateOpenedViaKeyboard: boolean;
41
42
  readonly version: string;
42
43
  connectedCallback(): void;
43
44
  createRenderRoot(): ShadowRoot;