@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
package/dist/drawer.js CHANGED
@@ -1 +1,168 @@
1
- var __decorate=this&&this.__decorate||function(e,t,o,i){var n,r=arguments.length,s=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r<3?n(s):r>3?n(t,o,s):n(t,o))||s);return r>3&&s&&Object.defineProperty(t,o,s),s};import{html,LitElement}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import packageJson from"../package.json"with{type:"json"};import styles from"./drawer.styles.js";import assertSlot from"./library/assert-slot.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import required from"./library/required.js";let Drawer=class Drawer extends LitElement{constructor(){super(...arguments),this.pinned=!1,this.version=packageJson.version,this.#e=createRef(),this.#t=createRef(),this.#o=!1}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:shadowRootMode}}static{this.styles=styles}get open(){return this.#o}set open(e){const t=e!==this.#o;this.#o=e;const o=window.matchMedia("(prefers-reduced-motion: reduce)").matches?0:300;this.#o&&t?(this.#i?.cancel(),this.#e?.value?.classList?.add("open"),this.#n=this.#e?.value?.animate({transform:["translateX(100%)","translateX(0)"]},{duration:o,fill:"forwards",easing:"cubic-bezier(0.33, 1, 0.68, 1)"}),this.#e?.value?.animate({opacity:[0,1]},{duration:o,fill:"forwards",easing:"ease-in",composite:"add"}),this.#n?.finished.then((()=>{this.#e?.value?.focus(),this.dispatchEvent(new Event("toggle",{bubbles:!0,composed:!0}))}))):t&&(this.#n?.cancel(),this.#i=this.#e?.value?.animate({transform:["translateX(0)","translateX(100%)"]},{duration:o,fill:"forwards",easing:"cubic-bezier(0.33, 1, 0.68, 1)"}),this.#e?.value?.animate({opacity:[1,0]},{duration:o,fill:"forwards",composite:"add"}),this.#i?.finished.then((()=>{this.#e.value?.classList?.remove("open"),this.dispatchEvent(new Event("toggle",{bubbles:!0,composed:!0}))})))}firstUpdated(){this.#o&&(this.#e?.value?.classList?.add("open"),this.#n=this.#e?.value?.animate({transform:"translateX(0)"},{duration:0,fill:"forwards"}),this.#e?.value?.animate({opacity:1},{duration:0,fill:"forwards",composite:"add"}))}render(){return html`<aside aria-label="${ifDefined(this.label)}" class="${classMap({component:!0,pinned:this.pinned})}" data-test="component" tabindex="-1" ${ref(this.#e)}><slot ${assertSlot()} ${ref(this.#t)}></slot></aside>`}#i;#e;#t;#o;#n};__decorate([property({reflect:!0}),required],Drawer.prototype,"label",void 0),__decorate([property({reflect:!0,type:Boolean})],Drawer.prototype,"pinned",void 0),__decorate([property({reflect:!0,type:Boolean})],Drawer.prototype,"open",null),__decorate([property({reflect:!0})],Drawer.prototype,"version",void 0),Drawer=__decorate([customElement("glide-core-drawer"),final],Drawer);export default Drawer;
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 { createRef, ref } from 'lit/directives/ref.js';
10
+ import { customElement, property } from 'lit/decorators.js';
11
+ import { ifDefined } from 'lit/directives/if-defined.js';
12
+ import packageJson from '../package.json' with { type: 'json' };
13
+ import styles from './drawer.styles.js';
14
+ import assertSlot from './library/assert-slot.js';
15
+ import shadowRootMode from './library/shadow-root-mode.js';
16
+ import final from './library/final.js';
17
+ import required from './library/required.js';
18
+ /**
19
+ * @attr {string} label - For screenreaders
20
+ * @attr {boolean} [open=false]
21
+ * @attr {boolean} [pinned=false]
22
+ *
23
+ * @readonly
24
+ * @attr {string} [version]
25
+ *
26
+ * @slot {Element | string} - The content of the drawer
27
+ *
28
+ * @cssprop [--width=27.375rem] - The width the drawer
29
+ *
30
+ * @fires {Event} toggle
31
+ */
32
+ let Drawer = class Drawer extends LitElement {
33
+ constructor() {
34
+ super(...arguments);
35
+ this.pinned = false;
36
+ this.version = packageJson.version;
37
+ this.#componentElementRef = createRef();
38
+ this.#defaultSlotElementRef = createRef();
39
+ this.#isOpen = false;
40
+ }
41
+ static { this.shadowRootOptions = {
42
+ ...LitElement.shadowRootOptions,
43
+ mode: shadowRootMode,
44
+ }; }
45
+ static { this.styles = styles; }
46
+ /**
47
+ * @default false
48
+ */
49
+ get open() {
50
+ return this.#isOpen;
51
+ }
52
+ set open(isOpen) {
53
+ const hasChanged = isOpen !== this.#isOpen;
54
+ this.#isOpen = isOpen;
55
+ const duration = window.matchMedia('(prefers-reduced-motion: reduce)')
56
+ .matches
57
+ ? 0
58
+ : 300;
59
+ if (this.#isOpen && hasChanged) {
60
+ this.#closeAnimation?.cancel();
61
+ this.#componentElementRef?.value?.classList?.add('open');
62
+ this.#openAnimation = this.#componentElementRef?.value?.animate({ transform: ['translateX(100%)', 'translateX(0)'] }, {
63
+ duration,
64
+ fill: 'forwards',
65
+ easing: 'cubic-bezier(0.33, 1, 0.68, 1)',
66
+ });
67
+ this.#componentElementRef?.value?.animate({
68
+ opacity: [0, 1],
69
+ }, {
70
+ duration,
71
+ fill: 'forwards',
72
+ easing: 'ease-in',
73
+ composite: 'add',
74
+ });
75
+ this.#openAnimation?.finished.then(() => {
76
+ // We set `tabindex="-1"` and call focus directly based on:
77
+ // https://adrianroselli.com/2020/10/dialog-focus-in-screen-readers.html
78
+ this.#componentElementRef?.value?.focus();
79
+ this.dispatchEvent(new Event('toggle', { bubbles: true, composed: true }));
80
+ });
81
+ }
82
+ else if (hasChanged) {
83
+ this.#openAnimation?.cancel();
84
+ this.#closeAnimation = this.#componentElementRef?.value?.animate({ transform: ['translateX(0)', 'translateX(100%)'] }, {
85
+ duration,
86
+ fill: 'forwards',
87
+ easing: 'cubic-bezier(0.33, 1, 0.68, 1)',
88
+ });
89
+ this.#componentElementRef?.value?.animate({
90
+ opacity: [1, 0],
91
+ }, {
92
+ duration,
93
+ fill: 'forwards',
94
+ composite: 'add',
95
+ });
96
+ this.#closeAnimation?.finished.then(() => {
97
+ this.#componentElementRef.value?.classList?.remove('open');
98
+ this.dispatchEvent(new Event('toggle', { bubbles: true, composed: true }));
99
+ });
100
+ }
101
+ }
102
+ firstUpdated() {
103
+ if (this.#isOpen) {
104
+ this.#componentElementRef?.value?.classList?.add('open');
105
+ // The open state of Drawer relies on styles for transform
106
+ // and opacity. In this case, we don't want an animation to
107
+ // play, but we do need those post-animation styles.
108
+ // Rather than relying on a CSS class to apply the
109
+ // transform and opacity changes, we use JavaScript animations
110
+ // with the duration properties set to 0 so that they apply
111
+ // immediately.
112
+ this.#openAnimation = this.#componentElementRef?.value?.animate({ transform: 'translateX(0)' }, {
113
+ duration: 0,
114
+ fill: 'forwards',
115
+ });
116
+ this.#componentElementRef?.value?.animate({
117
+ opacity: 1,
118
+ }, {
119
+ duration: 0,
120
+ fill: 'forwards',
121
+ composite: 'add',
122
+ });
123
+ }
124
+ }
125
+ render() {
126
+ return html `
127
+ <aside
128
+ aria-label=${ifDefined(this.label)}
129
+ class=${classMap({ component: true, pinned: this.pinned })}
130
+ data-test="component"
131
+ tabindex="-1"
132
+ ${ref(this.#componentElementRef)}
133
+ >
134
+ <slot ${assertSlot()} ${ref(this.#defaultSlotElementRef)}>
135
+ <!--
136
+ The content of the drawer
137
+
138
+ @required
139
+ @type {Element | string}
140
+ -->
141
+ </slot>
142
+ </aside>
143
+ `;
144
+ }
145
+ #closeAnimation;
146
+ #componentElementRef;
147
+ #defaultSlotElementRef;
148
+ #isOpen;
149
+ #openAnimation;
150
+ };
151
+ __decorate([
152
+ property({ reflect: true }),
153
+ required
154
+ ], Drawer.prototype, "label", void 0);
155
+ __decorate([
156
+ property({ reflect: true, type: Boolean })
157
+ ], Drawer.prototype, "pinned", void 0);
158
+ __decorate([
159
+ property({ reflect: true, type: Boolean })
160
+ ], Drawer.prototype, "open", null);
161
+ __decorate([
162
+ property({ reflect: true })
163
+ ], Drawer.prototype, "version", void 0);
164
+ Drawer = __decorate([
165
+ customElement('glide-core-drawer'),
166
+ final
167
+ ], Drawer);
168
+ export default Drawer;
@@ -1,4 +1,6 @@
1
- import{css}from"lit";export default[css`
1
+ import { css } from 'lit';
2
+ export default [
3
+ css `
2
4
  :host {
3
5
  /* The width the drawer */
4
6
  --width: 27.375rem;
@@ -38,4 +40,5 @@ import{css}from"lit";export default[css`
38
40
  inset: 0 0 0 auto;
39
41
  visibility: visible;
40
42
  }
41
- `];
43
+ `,
44
+ ];