@phcdevworks/spectre-components 1.12.0 → 1.14.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 (100) hide show
  1. package/README.md +75 -58
  2. package/dist/alert.cjs.map +1 -1
  3. package/dist/alert.d.cts +2 -2
  4. package/dist/alert.d.ts +2 -2
  5. package/dist/alert.js.map +1 -1
  6. package/dist/avatar.cjs.map +1 -1
  7. package/dist/avatar.d.cts +2 -2
  8. package/dist/avatar.d.ts +2 -2
  9. package/dist/avatar.js.map +1 -1
  10. package/dist/badge.cjs.map +1 -1
  11. package/dist/badge.d.cts +2 -2
  12. package/dist/badge.d.ts +2 -2
  13. package/dist/badge.js.map +1 -1
  14. package/dist/button.cjs +24 -0
  15. package/dist/button.cjs.map +1 -1
  16. package/dist/button.d.cts +21 -3
  17. package/dist/button.d.ts +21 -3
  18. package/dist/button.js +24 -0
  19. package/dist/button.js.map +1 -1
  20. package/dist/card.cjs.map +1 -1
  21. package/dist/card.d.cts +2 -2
  22. package/dist/card.d.ts +2 -2
  23. package/dist/card.js.map +1 -1
  24. package/dist/container.cjs.map +1 -1
  25. package/dist/container.d.cts +2 -2
  26. package/dist/container.d.ts +2 -2
  27. package/dist/container.js.map +1 -1
  28. package/dist/dropdown.cjs.map +1 -1
  29. package/dist/dropdown.d.cts +2 -2
  30. package/dist/dropdown.d.ts +2 -2
  31. package/dist/dropdown.js.map +1 -1
  32. package/dist/{form-JrKDonG4.d.cts → form-BGQjgJrL.d.cts} +10 -1
  33. package/dist/{form-JrKDonG4.d.ts → form-BGQjgJrL.d.ts} +10 -1
  34. package/dist/grid.cjs +36 -2
  35. package/dist/grid.cjs.map +1 -1
  36. package/dist/grid.d.cts +7 -2
  37. package/dist/grid.d.ts +7 -2
  38. package/dist/grid.js +36 -2
  39. package/dist/grid.js.map +1 -1
  40. package/dist/icon-box.cjs.map +1 -1
  41. package/dist/icon-box.d.cts +2 -2
  42. package/dist/icon-box.d.ts +2 -2
  43. package/dist/icon-box.js.map +1 -1
  44. package/dist/index.cjs +76 -2
  45. package/dist/index.cjs.map +1 -1
  46. package/dist/index.d.cts +2 -2
  47. package/dist/index.d.ts +2 -2
  48. package/dist/index.js +76 -2
  49. package/dist/index.js.map +1 -1
  50. package/dist/input.cjs.map +1 -1
  51. package/dist/input.d.cts +2 -2
  52. package/dist/input.d.ts +2 -2
  53. package/dist/input.js.map +1 -1
  54. package/dist/nav-item.cjs.map +1 -1
  55. package/dist/nav-item.d.cts +1 -1
  56. package/dist/nav-item.d.ts +1 -1
  57. package/dist/nav-item.js.map +1 -1
  58. package/dist/rating.cjs.map +1 -1
  59. package/dist/rating.d.cts +2 -2
  60. package/dist/rating.d.ts +2 -2
  61. package/dist/rating.js.map +1 -1
  62. package/dist/select.cjs.map +1 -1
  63. package/dist/select.d.cts +1 -1
  64. package/dist/select.d.ts +1 -1
  65. package/dist/select.js.map +1 -1
  66. package/dist/spinner.cjs.map +1 -1
  67. package/dist/spinner.d.cts +2 -2
  68. package/dist/spinner.d.ts +2 -2
  69. package/dist/spinner.js.map +1 -1
  70. package/dist/stack.cjs.map +1 -1
  71. package/dist/stack.d.cts +2 -2
  72. package/dist/stack.d.ts +2 -2
  73. package/dist/stack.js.map +1 -1
  74. package/dist/tag.cjs.map +1 -1
  75. package/dist/tag.d.cts +2 -2
  76. package/dist/tag.d.ts +2 -2
  77. package/dist/tag.js.map +1 -1
  78. package/dist/testimonial.cjs.map +1 -1
  79. package/dist/testimonial.d.cts +2 -2
  80. package/dist/testimonial.d.ts +2 -2
  81. package/dist/testimonial.js.map +1 -1
  82. package/dist/text.cjs +16 -0
  83. package/dist/text.cjs.map +1 -1
  84. package/dist/text.d.cts +8 -2
  85. package/dist/text.d.ts +8 -2
  86. package/dist/text.js +16 -0
  87. package/dist/text.js.map +1 -1
  88. package/dist/textarea.cjs.map +1 -1
  89. package/dist/textarea.d.cts +1 -1
  90. package/dist/textarea.d.ts +1 -1
  91. package/dist/textarea.js.map +1 -1
  92. package/dist/toast.cjs.map +1 -1
  93. package/dist/toast.d.cts +2 -2
  94. package/dist/toast.d.ts +2 -2
  95. package/dist/toast.js.map +1 -1
  96. package/dist/tooltip.cjs.map +1 -1
  97. package/dist/tooltip.d.cts +2 -2
  98. package/dist/tooltip.d.ts +2 -2
  99. package/dist/tooltip.js.map +1 -1
  100. package/package.json +11 -11
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- export { S as SpectreAlertSize, a as SpectreAlertVariant, b as SpectreAvatarShape, c as SpectreAvatarSize, S as SpectreBadgeSize, d as SpectreBadgeVariant, S as SpectreButtonSize, e as SpectreButtonType, f as SpectreButtonVariant, g as SpectreCardVariant, h as SpectreContainerMaxWidth, i as SpectreDropdownPlacement, j as SpectreGridColumns, k as SpectreGridGap, S as SpectreIconBoxSize, l as SpectreIconBoxVariant, S as SpectreInputSize, m as SpectreInputType, S as SpectreRatingSize, S as SpectreSpinnerSize, n as SpectreSpinnerVariant, o as SpectreStackAlign, p as SpectreStackBasis, q as SpectreStackDirection, S as SpectreTagSize, r as SpectreTagVariant, s as SpectreTestimonialVariant, t as SpectreTextFamily, u as SpectreTextLevel, v as SpectreTextSize, w as SpectreTextVariant, x as SpectreToastVariant, y as SpectreTooltipPlacement, z as spectreAlertSizes, A as spectreAlertVariants, B as spectreAvatarShapes, C as spectreAvatarSizes, z as spectreBadgeSizes, D as spectreBadgeVariants, z as spectreButtonSizes, E as spectreButtonTypes, F as spectreButtonVariants, G as spectreCardVariants, H as spectreContainerMaxWidths, I as spectreDropdownPlacements, J as spectreGridColumns, K as spectreGridGaps, z as spectreIconBoxSizes, L as spectreIconBoxVariants, z as spectreInputSizes, M as spectreInputTypes, z as spectreRatingSizes, z as spectreSpinnerSizes, N as spectreSpinnerVariants, O as spectreStackAligns, P as spectreStackBases, Q as spectreStackDirections, z as spectreTagSizes, R as spectreTagVariants, T as spectreTestimonialVariants, U as spectreTextFamilies, V as spectreTextLevels, W as spectreTextSizes, X as spectreTextVariants, Y as spectreToastVariants, Z as spectreTooltipPlacements } from './form-JrKDonG4.cjs';
2
- export { SpectreButtonElement, SpectreButtonProps, defineSpectreButton } from './button.cjs';
1
+ export { S as SpectreAlertSize, a as SpectreAlertVariant, b as SpectreAvatarShape, c as SpectreAvatarSize, S as SpectreBadgeSize, d as SpectreBadgeVariant, S as SpectreButtonSize, e as SpectreButtonType, f as SpectreButtonVariant, g as SpectreCardVariant, h as SpectreContainerMaxWidth, i as SpectreDropdownPlacement, j as SpectreGridColumns, k as SpectreGridGap, S as SpectreIconBoxSize, l as SpectreIconBoxVariant, S as SpectreInputSize, m as SpectreInputType, S as SpectreRatingSize, S as SpectreSpinnerSize, n as SpectreSpinnerVariant, o as SpectreStackAlign, p as SpectreStackBasis, q as SpectreStackDirection, S as SpectreTagSize, r as SpectreTagVariant, s as SpectreTestimonialVariant, t as SpectreTextFamily, u as SpectreTextLevel, v as SpectreTextSize, w as SpectreTextVariant, x as SpectreToastVariant, y as SpectreTooltipPlacement, z as spectreAlertSizes, A as spectreAlertVariants, B as spectreAvatarShapes, C as spectreAvatarSizes, z as spectreBadgeSizes, D as spectreBadgeVariants, z as spectreButtonSizes, E as spectreButtonTypes, F as spectreButtonVariants, G as spectreCardVariants, H as spectreContainerMaxWidths, I as spectreDropdownPlacements, J as spectreGridColumns, K as spectreGridGaps, z as spectreIconBoxSizes, L as spectreIconBoxVariants, z as spectreInputSizes, M as spectreInputTypes, z as spectreRatingSizes, z as spectreSpinnerSizes, N as spectreSpinnerVariants, O as spectreStackAligns, P as spectreStackBases, Q as spectreStackDirections, z as spectreTagSizes, R as spectreTagVariants, T as spectreTestimonialVariants, U as spectreTextFamilies, V as spectreTextLevels, W as spectreTextSizes, X as spectreTextVariants, Y as spectreToastVariants, Z as spectreTooltipPlacements } from './form-BGQjgJrL.cjs';
2
+ export { SpectreButtonElement, SpectreButtonProps, SpectreButtonTarget, defineSpectreButton } from './button.cjs';
3
3
  export { SpectreInputElement, SpectreInputProps, defineSpectreInput } from './input.cjs';
4
4
  export { SpectreTextareaElement, SpectreTextareaProps, defineSpectreTextarea } from './textarea.cjs';
5
5
  export { SpectreSelectElement, SpectreSelectProps, defineSpectreSelect } from './select.cjs';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { S as SpectreAlertSize, a as SpectreAlertVariant, b as SpectreAvatarShape, c as SpectreAvatarSize, S as SpectreBadgeSize, d as SpectreBadgeVariant, S as SpectreButtonSize, e as SpectreButtonType, f as SpectreButtonVariant, g as SpectreCardVariant, h as SpectreContainerMaxWidth, i as SpectreDropdownPlacement, j as SpectreGridColumns, k as SpectreGridGap, S as SpectreIconBoxSize, l as SpectreIconBoxVariant, S as SpectreInputSize, m as SpectreInputType, S as SpectreRatingSize, S as SpectreSpinnerSize, n as SpectreSpinnerVariant, o as SpectreStackAlign, p as SpectreStackBasis, q as SpectreStackDirection, S as SpectreTagSize, r as SpectreTagVariant, s as SpectreTestimonialVariant, t as SpectreTextFamily, u as SpectreTextLevel, v as SpectreTextSize, w as SpectreTextVariant, x as SpectreToastVariant, y as SpectreTooltipPlacement, z as spectreAlertSizes, A as spectreAlertVariants, B as spectreAvatarShapes, C as spectreAvatarSizes, z as spectreBadgeSizes, D as spectreBadgeVariants, z as spectreButtonSizes, E as spectreButtonTypes, F as spectreButtonVariants, G as spectreCardVariants, H as spectreContainerMaxWidths, I as spectreDropdownPlacements, J as spectreGridColumns, K as spectreGridGaps, z as spectreIconBoxSizes, L as spectreIconBoxVariants, z as spectreInputSizes, M as spectreInputTypes, z as spectreRatingSizes, z as spectreSpinnerSizes, N as spectreSpinnerVariants, O as spectreStackAligns, P as spectreStackBases, Q as spectreStackDirections, z as spectreTagSizes, R as spectreTagVariants, T as spectreTestimonialVariants, U as spectreTextFamilies, V as spectreTextLevels, W as spectreTextSizes, X as spectreTextVariants, Y as spectreToastVariants, Z as spectreTooltipPlacements } from './form-JrKDonG4.js';
2
- export { SpectreButtonElement, SpectreButtonProps, defineSpectreButton } from './button.js';
1
+ export { S as SpectreAlertSize, a as SpectreAlertVariant, b as SpectreAvatarShape, c as SpectreAvatarSize, S as SpectreBadgeSize, d as SpectreBadgeVariant, S as SpectreButtonSize, e as SpectreButtonType, f as SpectreButtonVariant, g as SpectreCardVariant, h as SpectreContainerMaxWidth, i as SpectreDropdownPlacement, j as SpectreGridColumns, k as SpectreGridGap, S as SpectreIconBoxSize, l as SpectreIconBoxVariant, S as SpectreInputSize, m as SpectreInputType, S as SpectreRatingSize, S as SpectreSpinnerSize, n as SpectreSpinnerVariant, o as SpectreStackAlign, p as SpectreStackBasis, q as SpectreStackDirection, S as SpectreTagSize, r as SpectreTagVariant, s as SpectreTestimonialVariant, t as SpectreTextFamily, u as SpectreTextLevel, v as SpectreTextSize, w as SpectreTextVariant, x as SpectreToastVariant, y as SpectreTooltipPlacement, z as spectreAlertSizes, A as spectreAlertVariants, B as spectreAvatarShapes, C as spectreAvatarSizes, z as spectreBadgeSizes, D as spectreBadgeVariants, z as spectreButtonSizes, E as spectreButtonTypes, F as spectreButtonVariants, G as spectreCardVariants, H as spectreContainerMaxWidths, I as spectreDropdownPlacements, J as spectreGridColumns, K as spectreGridGaps, z as spectreIconBoxSizes, L as spectreIconBoxVariants, z as spectreInputSizes, M as spectreInputTypes, z as spectreRatingSizes, z as spectreSpinnerSizes, N as spectreSpinnerVariants, O as spectreStackAligns, P as spectreStackBases, Q as spectreStackDirections, z as spectreTagSizes, R as spectreTagVariants, T as spectreTestimonialVariants, U as spectreTextFamilies, V as spectreTextLevels, W as spectreTextSizes, X as spectreTextVariants, Y as spectreToastVariants, Z as spectreTooltipPlacements } from './form-BGQjgJrL.js';
2
+ export { SpectreButtonElement, SpectreButtonProps, SpectreButtonTarget, defineSpectreButton } from './button.js';
3
3
  export { SpectreInputElement, SpectreInputProps, defineSpectreInput } from './input.js';
4
4
  export { SpectreTextareaElement, SpectreTextareaProps, defineSpectreTextarea } from './textarea.js';
5
5
  export { SpectreSelectElement, SpectreSelectProps, defineSpectreSelect } from './select.js';
package/dist/index.js CHANGED
@@ -157,6 +157,33 @@ var spectreGridGaps = ["sm", "md", "lg"];
157
157
  function isGridGap(value) {
158
158
  return spectreGridGaps.includes(value);
159
159
  }
160
+ var spectreGridSpans = [
161
+ 1,
162
+ 2,
163
+ 3,
164
+ 4,
165
+ 5,
166
+ 6,
167
+ 7,
168
+ 8,
169
+ 9,
170
+ 10,
171
+ 11,
172
+ 12,
173
+ "full"
174
+ ];
175
+ function isGridSpan(value) {
176
+ return spectreGridSpans.includes(
177
+ value
178
+ );
179
+ }
180
+ function isGridSpanOptions(value) {
181
+ if (typeof value !== "object" || value === null) {
182
+ return false;
183
+ }
184
+ const candidate = value;
185
+ return (candidate.base === void 0 || isGridSpan(candidate.base)) && (candidate.md === void 0 || isGridSpan(candidate.md)) && (candidate.lg === void 0 || isGridSpan(candidate.lg));
186
+ }
160
187
  var spectreStackDirections = ["vertical", "horizontal"];
161
188
  function isStackDirection(value) {
162
189
  return spectreStackDirections.includes(
@@ -244,6 +271,17 @@ var spectreTextLevels = [
244
271
  function isTextLevel(value) {
245
272
  return spectreTextLevels.includes(value);
246
273
  }
274
+ var spectreTextTransforms = [
275
+ "none",
276
+ "uppercase",
277
+ "lowercase",
278
+ "capitalize"
279
+ ];
280
+ function isTextTransform(value) {
281
+ return spectreTextTransforms.includes(
282
+ value
283
+ );
284
+ }
247
285
  function normalizeInt(value, fallback, min = 0) {
248
286
  if (value == null || typeof value !== "number" || !Number.isInteger(value) || value < min) {
249
287
  return fallback;
@@ -622,6 +660,9 @@ var SpectreButtonElement = class extends SpectreProjectableElement {
622
660
  set autofocus(value) {
623
661
  super.autofocus = value;
624
662
  }
663
+ get isLink() {
664
+ return Boolean(this.href) && !this.isDisabled;
665
+ }
625
666
  getContentContainer() {
626
667
  return this.querySelector("[data-sp-button-native]");
627
668
  }
@@ -705,12 +746,30 @@ var SpectreButtonElement = class extends SpectreProjectableElement {
705
746
  >` : nothing;
706
747
  }
707
748
  render() {
749
+ if (this.isLink) {
750
+ return html`<a
751
+ aria-busy="${this.loading ? "true" : "false"}"
752
+ aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
753
+ aria-label="${ifDefined(this.forwardedAriaLabel)}"
754
+ aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
755
+ class="${this.buttonClasses}"
756
+ data-sp-button-native
757
+ href="${ifDefined(this.href)}"
758
+ id="${ifDefined(this.id || void 0)}"
759
+ rel="${ifDefined(this.rel || void 0)}"
760
+ target="${ifDefined(this.target || void 0)}"
761
+ title="${ifDefined(this.title || void 0)}"
762
+ >
763
+ ${this.renderButtonContent()}
764
+ </a>`;
765
+ }
708
766
  return html`<button
709
767
  aria-busy="${this.loading ? "true" : "false"}"
710
768
  aria-describedby="${ifDefined(this.forwardedAriaDescribedBy)}"
711
769
  aria-label="${ifDefined(this.forwardedAriaLabel)}"
712
770
  aria-labelledby="${ifDefined(this.forwardedAriaLabelledBy)}"
713
771
  ?autofocus="${this.autofocus}"
772
+ aria-disabled="${ifDefined(this.href && this.isDisabled ? "true" : void 0)}"
714
773
  class="${this.buttonClasses}"
715
774
  data-sp-button-native
716
775
  ?disabled="${this.isDisabled}"
@@ -729,13 +788,16 @@ SpectreButtonElement.properties = {
729
788
  disabled: { type: Boolean, reflect: true },
730
789
  form: { type: String },
731
790
  fullWidth: { attribute: "full-width", type: Boolean, reflect: true },
791
+ href: { type: String, reflect: true },
732
792
  iconOnly: { attribute: "icon-only", type: Boolean, reflect: true },
733
793
  label: { type: String, reflect: true },
734
794
  loading: { type: Boolean, reflect: true },
735
795
  loadingLabel: { attribute: "loading-label", type: String, reflect: true },
736
796
  name: { type: String, reflect: true },
737
797
  pill: { type: Boolean, reflect: true },
798
+ rel: { type: String },
738
799
  size: { type: String, reflect: true },
800
+ target: { type: String },
739
801
  type: { type: String, reflect: true },
740
802
  variant: { type: String, reflect: true },
741
803
  value: { type: String }
@@ -2803,11 +2865,17 @@ var SpectreGridElement = class extends SpectreProjectableElement {
2803
2865
  if (changedProperties.has("gap") && (this.gap == null || !isGridGap(this.gap))) {
2804
2866
  this.gap = "md";
2805
2867
  }
2868
+ if (changedProperties.has("span") && this.span !== void 0 && !isGridSpan(this.span) && !isGridSpanOptions(this.span)) {
2869
+ this.span = void 0;
2870
+ }
2806
2871
  }
2807
2872
  get gridClasses() {
2808
2873
  return getGridClasses({
2809
2874
  columns: this.columns,
2810
- gap: this.gap
2875
+ gap: this.gap,
2876
+ ...this.span !== void 0 && {
2877
+ span: this.span
2878
+ }
2811
2879
  });
2812
2880
  }
2813
2881
  render() {
@@ -2826,7 +2894,8 @@ var SpectreGridElement = class extends SpectreProjectableElement {
2826
2894
  };
2827
2895
  SpectreGridElement.properties = {
2828
2896
  columns: { type: Number, reflect: true },
2829
- gap: { type: String, reflect: true }
2897
+ gap: { type: String, reflect: true },
2898
+ span: { type: Object }
2830
2899
  };
2831
2900
  function defineSpectreGrid(tagName = "sp-grid") {
2832
2901
  const existingElement = customElements.get(tagName);
@@ -4128,6 +4197,9 @@ var SpectreTextElement = class extends SpectreProjectableElement {
4128
4197
  if (changedProperties.has("variant") && !isTextVariant(this.variant)) {
4129
4198
  this.variant = "default";
4130
4199
  }
4200
+ if (changedProperties.has("transform") && this.transform !== void 0 && !isTextTransform(this.transform)) {
4201
+ this.transform = void 0;
4202
+ }
4131
4203
  }
4132
4204
  get id() {
4133
4205
  return super.id;
@@ -4156,6 +4228,7 @@ var SpectreTextElement = class extends SpectreProjectableElement {
4156
4228
  const textClasses = getTextClasses({
4157
4229
  ...this.family !== void 0 && { family: this.family },
4158
4230
  size: this.size ?? "md",
4231
+ ...this.transform !== void 0 && { transform: this.transform },
4159
4232
  variant: this.variant ?? "default"
4160
4233
  });
4161
4234
  return html$1`<${tag}
@@ -4173,6 +4246,7 @@ SpectreTextElement.properties = {
4173
4246
  family: { type: String, reflect: true },
4174
4247
  level: { type: String, reflect: true },
4175
4248
  size: { type: String, reflect: true },
4249
+ transform: { type: String, reflect: true },
4176
4250
  variant: { type: String, reflect: true }
4177
4251
  };
4178
4252
  function defineSpectreText(tagName = "sp-text") {