@warp-ds/elements 2.0.0-next.3 → 2.0.0-next.5

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 (45) hide show
  1. package/dist/index.js +345 -377
  2. package/dist/index.js.map +4 -4
  3. package/dist/packages/affix/index.d.ts +13 -6
  4. package/dist/packages/affix/index.js +32 -65
  5. package/dist/packages/affix/index.js.map +4 -4
  6. package/dist/packages/alert/index.js +10 -60
  7. package/dist/packages/alert/index.js.map +3 -3
  8. package/dist/packages/attention/index.js +39 -80
  9. package/dist/packages/attention/index.js.map +4 -4
  10. package/dist/packages/badge/index.js +26 -72
  11. package/dist/packages/badge/index.js.map +4 -4
  12. package/dist/packages/box/index.d.ts +1 -1
  13. package/dist/packages/box/index.js +25 -64
  14. package/dist/packages/box/index.js.map +4 -4
  15. package/dist/packages/breadcrumbs/index.js +8 -52
  16. package/dist/packages/breadcrumbs/index.js.map +3 -3
  17. package/dist/packages/button/index.d.ts +6 -0
  18. package/dist/packages/button/index.js +66 -103
  19. package/dist/packages/button/index.js.map +3 -3
  20. package/dist/packages/card/index.d.ts +5 -5
  21. package/dist/packages/card/index.js +1461 -91
  22. package/dist/packages/card/index.js.map +4 -4
  23. package/dist/packages/card/locales/da/messages.d.mts +1 -0
  24. package/dist/packages/card/locales/en/messages.d.mts +1 -0
  25. package/dist/packages/card/locales/fi/messages.d.mts +1 -0
  26. package/dist/packages/card/locales/nb/messages.d.mts +1 -0
  27. package/dist/packages/expandable/index.d.ts +1 -6
  28. package/dist/packages/expandable/index.js +70 -85
  29. package/dist/packages/expandable/index.js.map +4 -4
  30. package/dist/packages/modal/index.js +7 -51
  31. package/dist/packages/modal/index.js.map +3 -3
  32. package/dist/packages/pill/index.js +16 -64
  33. package/dist/packages/pill/index.js.map +3 -3
  34. package/dist/packages/select/index.d.ts +10 -0
  35. package/dist/packages/select/index.js +42 -72
  36. package/dist/packages/select/index.js.map +3 -3
  37. package/dist/packages/textfield/index.d.ts +9 -5
  38. package/dist/packages/textfield/index.js +49 -76
  39. package/dist/packages/textfield/index.js.map +4 -4
  40. package/dist/packages/toast/index.js +55 -90
  41. package/dist/packages/toast/index.js.map +4 -4
  42. package/dist/packages/toast/toast.d.ts +1 -2
  43. package/dist/packages/utils/index.d.ts +1 -1
  44. package/dist/packages/utils/unstyled-heading.d.ts +1 -1
  45. package/package.json +4 -4
@@ -1,9 +1,14 @@
1
- export class WarpAffix {
2
- static styles: any[];
1
+ declare const WarpAffix_base: {
2
+ new (): {
3
+ [x: string]: any;
4
+ };
5
+ [x: string]: any;
6
+ createProperty(name: any, options: any): void;
7
+ };
8
+ export class WarpAffix extends WarpAffix_base {
3
9
  static properties: {
4
10
  ariaLabel: {
5
11
  type: StringConstructor;
6
- attribute: string;
7
12
  };
8
13
  clear: {
9
14
  type: BooleanConstructor;
@@ -15,12 +20,14 @@ export class WarpAffix {
15
20
  type: StringConstructor;
16
21
  };
17
22
  };
18
- get _classBase(): typeof suffix;
19
- get _classes(): import(".pnpm/lit-html@3.1.4/node_modules/lit-html/directive").DirectiveResult<typeof import("lit/directives/class-map").ClassMapDirective>;
23
+ static styles: any[];
24
+ get _classBase(): typeof ccSuffix;
25
+ get _classes(): string;
20
26
  get _searchButton(): import("lit").TemplateResult<1>;
21
27
  get _clearButton(): import("lit").TemplateResult<1>;
22
28
  get _text(): import("lit").TemplateResult<1>;
23
29
  get _markup(): import("lit").TemplateResult<1>;
24
30
  render(): import("lit").TemplateResult<1>;
25
31
  }
26
- import { suffix } from '@warp-ds/css/component-classes';
32
+ import { suffix as ccSuffix } from '@warp-ds/css/component-classes';
33
+ export {};
@@ -1009,41 +1009,17 @@ var require_parser = __commonJS({
1009
1009
  // packages/affix/index.js
1010
1010
  import { html as html3 } from "lit";
1011
1011
 
1012
- // node_modules/.pnpm/@warp-ds+css@2.0.0-next.4_@warp-ds+uno@2.0.0_unocss@0.61.3_postcss@8.4.39_rollup@4.18.1_vite@_fn7nbuinwdlc4yeboswpxt5lie/node_modules/@warp-ds/css/component-classes/index.js
1013
- var box = {
1014
- box: "group block relative break-words last-child:mb-0 p-16 rounded-8",
1015
- // Relative here enables w-clickable
1016
- bleed: "-mx-16 sm:mx-0 rounded-l-0 rounded-r-0 sm:rounded-8",
1017
- // We target L and R to override the default rounded-8
1018
- info: "s-bg-info-subtle",
1019
- neutral: "s-surface-sunken",
1020
- bordered: "border-2 s-border s-bg"
1021
- };
1022
- var buttonReset = "focus:outline-none appearance-none cursor-pointer bg-transparent border-0 m-0 p-0 inline-block";
1023
- var expandable = {
1024
- expandable: "will-change-height",
1025
- expandableTitle: "font-bold s-text",
1026
- expandableBox: "s-surface-sunken hover:s-bg-hover active:s-bg-active py-0 px-0 " + box.box,
1027
- expandableInfo: "s-bg-info-subtle! hover:s-bg-info-subtle-hover!",
1028
- expandableBleed: box.bleed,
1029
- chevron: "inline-block align-middle s-icon",
1030
- chevronNonBox: "ml-8",
1031
- chevronBox: "",
1032
- chevronTransform: "transform transition-transform transform-gpu ease-in-out",
1033
- chevronExpand: "-rotate-180",
1034
- chevronCollapse: "rotate-180",
1035
- elementsTransformChevronDownPart: "part-[w-icon-chevron-down-16-part]:transform part-[w-icon-chevron-down-16-part]:transition-transform part-[w-icon-chevron-down-16-part]:transform-gpu part-[w-icon-chevron-down-16-part]:ease-in-out",
1036
- elementsChevronDownExpandPart: "part-[w-icon-chevron-down-16-part]:-rotate-180",
1037
- elementsTransformChevronUpPart: "part-[w-icon-chevron-up-16-part]:transform part-[w-icon-chevron-up-16-part]:transition-transform part-[w-icon-chevron-up-16-part]:transform-gpu part-[w-icon-chevron-up-16-part]:ease-in-out",
1038
- elementsChevronUpCollapsePart: "part-[w-icon-chevron-up-16-part]:rotate-180",
1039
- expansion: "overflow-hidden",
1040
- expansionNotExpanded: "h-0 invisible",
1041
- button: buttonReset + " hover:underline focus-visible:underline",
1042
- buttonBox: "w-full text-left relative inline-flex items-center justify-between " + box.box,
1043
- paddingTop: "pt-0",
1044
- title: "flex w-full justify-between items-center",
1045
- titleType: "h4"
1012
+ // node_modules/.pnpm/@chbphone55+classnames@2.0.0/node_modules/@chbphone55/classnames/dist/index.m.js
1013
+ var r = function() {
1014
+ for (var t = [], n = arguments.length; n--; ) t[n] = arguments[n];
1015
+ return t.reduce(function(t2, n2) {
1016
+ return t2.concat("string" == typeof n2 ? n2 : Array.isArray(n2) ? r.apply(void 0, n2) : "object" == typeof n2 && n2 ? Object.keys(n2).map(function(r2) {
1017
+ return n2[r2] ? r2 : "";
1018
+ }) : "");
1019
+ }, []).join(" ");
1046
1020
  };
1021
+
1022
+ // node_modules/.pnpm/@warp-ds+css@2.0.0_@warp-ds+uno@2.0.0_unocss@0.62.0_postcss@8.4.41_rollup@4.20.0_vite@5.3.3_@_vyiy5vwpqfzwy5hpmfkwp3zmle/node_modules/@warp-ds/css/component-classes/index.js
1047
1023
  var buttonDefaultStyling = "font-bold focusable justify-center transition-colors ease-in-out";
1048
1024
  var buttonColors = {
1049
1025
  primary: "s-text-inverted bg-[--w-color-button-primary-background] hover:bg-[--w-color-button-primary-background-hover] active:bg-[--w-color-button-primary-background-active]",
@@ -1161,7 +1137,7 @@ var button = {
1161
1137
  };
1162
1138
  var modal = {
1163
1139
  backdrop: "fixed inset-0 flex sm:place-content-center sm:place-items-center items-end z-30 [--w-modal-max-height:80%] [--w-modal-width:640px] bg-[--w-black/25]",
1164
- modal: "pb-safe-[32] shadow-m max-h-[--w-modal-max-height] min-h-[--w-modal-min-height] w-[--w-modal-width] h-[--w-modal-height] relative transition-300 ease-in-out backface-hidden will-change-height rounded-8 mx-0 sm:mx-16 bg-[--w-s-color-surface-elevated-100] flex flex-col overflow-hidden outline-none space-y-16 pt-8 sm:pt-32 sm:pb-32 rounded-b-0 sm:rounded-b-8",
1140
+ base: "pb-safe-[32] shadow-m max-h-[--w-modal-max-height] min-h-[--w-modal-min-height] w-[--w-modal-width] h-[--w-modal-height] relative transition-300 ease-in-out backface-hidden will-change-height rounded-8 mx-0 sm:mx-16 bg-[--w-s-color-surface-elevated-100] flex flex-col overflow-hidden outline-none space-y-16 pt-8 sm:pt-32 sm:pb-32 rounded-b-0 sm:rounded-b-8",
1165
1141
  content: "block overflow-y-auto overflow-x-hidden last-child:mb-0 grow shrink px-16 sm:px-32 relative",
1166
1142
  footer: "flex justify-end shrink-0 px-16 sm:px-32",
1167
1143
  transitionTitle: "transition-all duration-300",
@@ -1175,19 +1151,15 @@ var modal = {
1175
1151
  titleButtonIcon: "h-16 w-16 sm:h-24 sm:w-24",
1176
1152
  titleButtonIconRotated: "transform rotate-90"
1177
1153
  };
1178
- var label = {
1179
- label: "antialiased block relative text-s font-bold pb-4 cursor-pointer s-text",
1180
- optional: "pl-8 font-normal text-s s-text-subtle"
1181
- };
1182
- var prefixSuffixWrapperBase = "absolute top-0 bottom-0 flex justify-center items-center focusable rounded-4 focus:[--w-outline-offset:-2px] bg-transparent ";
1154
+ var prefixSuffixWrapper = "absolute top-0 bottom-0 flex justify-center items-center focusable rounded-4 focus:[--w-outline-offset:-2px] bg-transparent ";
1183
1155
  var suffix = {
1184
- wrapper: prefixSuffixWrapperBase + "right-0",
1156
+ wrapper: prefixSuffixWrapper + "right-0",
1185
1157
  wrapperWithLabel: "w-max pr-12",
1186
1158
  wrapperWithIcon: "w-40",
1187
1159
  label: "antialiased block relative cursor-default pb-0 font-bold text-xs s-text"
1188
1160
  };
1189
1161
  var prefix = {
1190
- wrapper: prefixSuffixWrapperBase + "left-0",
1162
+ wrapper: prefixSuffixWrapper + "left-0",
1191
1163
  wrapperWithLabel: "w-max pl-12",
1192
1164
  wrapperWithIcon: "w-40",
1193
1165
  label: "antialiased block relative cursor-default pb-0 font-bold text-xs s-text"
@@ -1244,15 +1216,9 @@ var deadToggle = {
1244
1216
  wrapper: `${toggle.wrapper} h-20 w-20 pointer-events-none`,
1245
1217
  input: `${toggle.input} hidden`,
1246
1218
  inputVue: "hidden",
1219
+ labelVue: "-mt-2",
1247
1220
  labelRadio: `${toggle.label} ${toggle.labelBefore} ${toggle.radio}`,
1248
- labelCheckbox: `${toggle.label} ${toggle.labelBefore} ${toggle.checkbox}`,
1249
- labelVue: "-mt-2"
1250
- };
1251
- var clickable = {
1252
- toggle: "absolute inset-0 h-full w-full appearance-none cursor-pointer focusable focusable-inset",
1253
- label: `px-12 ${label.label} py-8! cursor-pointer focusable focusable-inset`,
1254
- buttonOrLink: "bg-transparent focusable",
1255
- buttonOrLinkStretch: "inset-0 absolute"
1221
+ labelCheckbox: `${toggle.label} ${toggle.labelBefore} ${toggle.checkbox}`
1256
1222
  };
1257
1223
  var attention = {
1258
1224
  base: "border-2 relative flex items-start",
@@ -1838,27 +1804,28 @@ if (!customElements.get("w-icon-close-16")) {
1838
1804
 
1839
1805
  // packages/utils/index.js
1840
1806
  import { classMap } from "lit/directives/class-map.js";
1841
- function fclasses(definition) {
1842
- const defn = {};
1843
- for (const [key, value] of Object.entries(definition)) {
1844
- for (const className of key.split(" ")) {
1845
- defn[className] = value;
1807
+ var camelCaseToKebabCase = (str) => str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1808
+ function kebabCaseAttributes(constructor) {
1809
+ return class extends constructor {
1810
+ static createProperty(name, options) {
1811
+ let customOptions = options;
1812
+ if (typeof (options == null ? void 0 : options.attribute) === "undefined" || (options == null ? void 0 : options.attribute) === true) {
1813
+ customOptions = Object.assign({}, options, {
1814
+ attribute: camelCaseToKebabCase(name.toString())
1815
+ });
1816
+ }
1817
+ super.createProperty(name, customOptions);
1846
1818
  }
1847
- }
1848
- return classMap(defn);
1819
+ };
1849
1820
  }
1850
1821
 
1851
1822
  // packages/affix/index.js
1852
- var WarpAffix = class extends WarpElement {
1823
+ var WarpAffix = class extends kebabCaseAttributes(WarpElement) {
1853
1824
  get _classBase() {
1854
1825
  return this.slot === "suffix" ? suffix : prefix;
1855
1826
  }
1856
1827
  get _classes() {
1857
- return fclasses({
1858
- [this._classBase.wrapper]: true,
1859
- [this._classBase.wrapperWithLabel]: this.label,
1860
- [this._classBase.wrapperWithIcon]: !this.label
1861
- });
1828
+ return r([this._classBase.wrapper, this.label ? this._classBase.wrapperWithLabel : this._classBase.wrapperWithIcon]);
1862
1829
  }
1863
1830
  get _searchButton() {
1864
1831
  return html3`
@@ -1894,13 +1861,13 @@ var WarpAffix = class extends WarpElement {
1894
1861
  return html3`${this._markup}`;
1895
1862
  }
1896
1863
  };
1897
- __publicField(WarpAffix, "styles", [WarpElement.styles]);
1898
1864
  __publicField(WarpAffix, "properties", {
1899
- ariaLabel: { type: String, attribute: "aria-label" },
1865
+ ariaLabel: { type: String },
1900
1866
  clear: { type: Boolean },
1901
1867
  search: { type: Boolean },
1902
1868
  label: { type: String }
1903
1869
  });
1870
+ __publicField(WarpAffix, "styles", [WarpElement.styles]);
1904
1871
  if (!customElements.get("w-affix")) {
1905
1872
  customElements.define("w-affix", WarpAffix);
1906
1873
  }