@folkehelseinstituttet/designsystem 0.12.0 → 0.13.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.
package/fhi-flex.js ADDED
@@ -0,0 +1,80 @@
1
+ import { i as g, n as l, a as m, x as d, t as h } from "./property-DYwjZ69W.js";
2
+ var u = Object.defineProperty, c = Object.getOwnPropertyDescriptor, p = (r, i, a, s) => {
3
+ for (var e = s > 1 ? void 0 : s ? c(i, a) : i, o = r.length - 1, n; o >= 0; o--)
4
+ (n = r[o]) && (e = (s ? n(i, a, e) : n(e)) || e);
5
+ return s && e && u(i, a, e), e;
6
+ };
7
+ const f = "fhi-flex";
8
+ let t = class extends m {
9
+ constructor() {
10
+ super(...arguments), this.direction = "row", this.gap = "medium", this.wrap = !1;
11
+ }
12
+ updated(r) {
13
+ if (super.updated(r), r.has("gap")) {
14
+ if (["small", "medium", "large"].includes(
15
+ String(this.gap)
16
+ )) {
17
+ this.style.gap = "";
18
+ return;
19
+ }
20
+ const a = Number(this.gap) ? `${this.gap}px` : this.gap;
21
+ this.style.gap = a;
22
+ }
23
+ }
24
+ render() {
25
+ return d`<slot></slot>`;
26
+ }
27
+ };
28
+ t.styles = g`
29
+ :host {
30
+ --dimension-gap-small: var(--fhi-spacing-100);
31
+ --dimension-gap-medium: var(--fhi-spacing-200);
32
+ --dimension-gap-large: var(--fhi-spacing-300);
33
+ }
34
+
35
+ :host {
36
+ display: flex;
37
+ gap: var(--dimension-gap-medium);
38
+ }
39
+
40
+ :host([wrap]) {
41
+ flex-wrap: wrap;
42
+ }
43
+
44
+ :host([direction='row']) {
45
+ flex-direction: row;
46
+ }
47
+
48
+ :host([direction='column']) {
49
+ flex-direction: column;
50
+ }
51
+
52
+ :host([gap='small']) {
53
+ gap: var(--dimension-gap-small);
54
+ }
55
+
56
+ :host([gap='medium']) {
57
+ gap: var(--dimension-gap-medium);
58
+ }
59
+
60
+ :host([gap='large']) {
61
+ gap: var(--dimension-gap-large);
62
+ }
63
+ `;
64
+ p([
65
+ l({ type: String, reflect: !0 })
66
+ ], t.prototype, "direction", 2);
67
+ p([
68
+ l({ type: String, reflect: !0 })
69
+ ], t.prototype, "gap", 2);
70
+ p([
71
+ l({ type: Boolean, reflect: !0 })
72
+ ], t.prototype, "wrap", 2);
73
+ t = p([
74
+ h(f)
75
+ ], t);
76
+ export {
77
+ t as FhiFlex,
78
+ f as FhiFlexSelector
79
+ };
80
+ //# sourceMappingURL=fhi-flex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fhi-flex.js","sources":["../../src/components/fhi-flex/fhi-flex.component.ts"],"sourcesContent":["import { html, css, LitElement, PropertyValues } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nexport const FhiFlexSelector = 'fhi-flex';\ntype FhiUnitType = 'px' | 'rem';\ntype FhiGapWidthUnit = `${number}${FhiUnitType}` | number;\n\n@customElement(FhiFlexSelector)\nexport class FhiFlex extends LitElement {\n @property({ type: String, reflect: true }) direction: 'row' | 'column' =\n 'row';\n @property({ type: String, reflect: true }) gap:\n | 'small'\n | 'medium'\n | 'large'\n | FhiGapWidthUnit = 'medium';\n @property({ type: Boolean, reflect: true }) wrap = false;\n\n updated(changedProperties: PropertyValues<this>) {\n super.updated(changedProperties);\n\n if (changedProperties.has('gap')) {\n const isPresetGap = ['small', 'medium', 'large'].includes(\n String(this.gap),\n );\n\n if (isPresetGap) {\n this.style.gap = '';\n return;\n }\n const gapValue = Number(this.gap) ? `${this.gap}px` : this.gap;\n this.style.gap = gapValue as string;\n }\n }\n\n render() {\n return html`<slot></slot>`;\n }\n\n static styles = css`\n :host {\n --dimension-gap-small: var(--fhi-spacing-100);\n --dimension-gap-medium: var(--fhi-spacing-200);\n --dimension-gap-large: var(--fhi-spacing-300);\n }\n\n :host {\n display: flex;\n gap: var(--dimension-gap-medium);\n }\n\n :host([wrap]) {\n flex-wrap: wrap;\n }\n\n :host([direction='row']) {\n flex-direction: row;\n }\n\n :host([direction='column']) {\n flex-direction: column;\n }\n\n :host([gap='small']) {\n gap: var(--dimension-gap-small);\n }\n\n :host([gap='medium']) {\n gap: var(--dimension-gap-medium);\n }\n\n :host([gap='large']) {\n gap: var(--dimension-gap-large);\n }\n `;\n}\n"],"names":["FhiFlexSelector","FhiFlex","LitElement","changedProperties","gapValue","html","css","__decorateClass","property","customElement"],"mappings":";;;;;;AAGO,MAAMA,IAAkB;AAKxB,IAAMC,IAAN,cAAsBC,EAAW;AAAA,EAAjC,cAAA;AAAA,UAAA,GAAA,SAAA,GACsC,KAAA,YACzC,OACyC,KAAA,MAIrB,UACsB,KAAA,OAAO;AAAA,EAAA;AAAA,EAEnD,QAAQC,GAAyC;AAG/C,QAFA,MAAM,QAAQA,CAAiB,GAE3BA,EAAkB,IAAI,KAAK,GAAG;AAKhC,UAJoB,CAAC,SAAS,UAAU,OAAO,EAAE;AAAA,QAC/C,OAAO,KAAK,GAAG;AAAA,MAAA,GAGA;AACf,aAAK,MAAM,MAAM;AACjB;AAAA,MACF;AACA,YAAMC,IAAW,OAAO,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,OAAO,KAAK;AAC3D,WAAK,MAAM,MAAMA;AAAA,IACnB;AAAA,EACF;AAAA,EAEA,SAAS;AACP,WAAOC;AAAAA,EACT;AAsCF;AAnEaJ,EA+BJ,SAASK;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AA9B2BC,EAAA;AAAA,EAA1CC,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM;AAAA,GAD9BP,EACgC,WAAA,aAAA,CAAA;AAEAM,EAAA;AAAA,EAA1CC,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM;AAAA,GAH9BP,EAGgC,WAAA,OAAA,CAAA;AAKCM,EAAA;AAAA,EAA3CC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GAR/BP,EAQiC,WAAA,QAAA,CAAA;AARjCA,IAANM,EAAA;AAAA,EADNE,EAAcT,CAAe;AAAA,GACjBC,CAAA;"}
package/fhi-tooltip.js CHANGED
@@ -294,36 +294,36 @@ const ie = function(t) {
294
294
  return {};
295
295
  const m = $(o), w = k(l), x = $(l) === l, b = await (c.isRTL == null ? void 0 : c.isRTL(a.floating)), v = d || (x || !g ? [Z(l)] : Ut(l)), X = p !== "none";
296
296
  !d && X && v.push(...Zt(l, g, p, b));
297
- const B = [l, ...v], lt = await Pt(e, y), U = [];
298
- let N = ((i = r.flip) == null ? void 0 : i.overflows) || [];
297
+ const N = [l, ...v], lt = await Pt(e, y), U = [];
298
+ let B = ((i = r.flip) == null ? void 0 : i.overflows) || [];
299
299
  if (h && U.push(lt[m]), f) {
300
300
  const D = qt(o, s, b);
301
301
  U.push(lt[D[0]], lt[D[1]]);
302
302
  }
303
- if (N = [...N, {
303
+ if (B = [...B, {
304
304
  placement: o,
305
305
  overflows: U
306
306
  }], !U.every((D) => D <= 0)) {
307
307
  var gt, yt;
308
- const D = (((gt = r.flip) == null ? void 0 : gt.index) || 0) + 1, ct = B[D];
308
+ const D = (((gt = r.flip) == null ? void 0 : gt.index) || 0) + 1, ct = N[D];
309
309
  if (ct && (!(f === "alignment" ? w !== k(ct) : !1) || // We leave the current main axis only if every placement on that axis
310
310
  // overflows the main axis.
311
- N.every((A) => k(A.placement) === w ? A.overflows[0] > 0 : !0)))
311
+ B.every((A) => k(A.placement) === w ? A.overflows[0] > 0 : !0)))
312
312
  return {
313
313
  data: {
314
314
  index: D,
315
- overflows: N
315
+ overflows: B
316
316
  },
317
317
  reset: {
318
318
  placement: ct
319
319
  }
320
320
  };
321
- let K = (yt = N.filter((M) => M.overflows[0] <= 0).sort((M, A) => M.overflows[1] - A.overflows[1])[0]) == null ? void 0 : yt.placement;
321
+ let K = (yt = B.filter((M) => M.overflows[0] <= 0).sort((M, A) => M.overflows[1] - A.overflows[1])[0]) == null ? void 0 : yt.placement;
322
322
  if (!K)
323
323
  switch (u) {
324
324
  case "bestFit": {
325
325
  var wt;
326
- const M = (wt = N.filter((A) => {
326
+ const M = (wt = B.filter((A) => {
327
327
  if (X) {
328
328
  const P = k(A.placement);
329
329
  return P === w || // Create a bias to the `y` side axis due to horizontal
@@ -331,7 +331,7 @@ const ie = function(t) {
331
331
  P === "y";
332
332
  }
333
333
  return !0;
334
- }).map((A) => [A.placement, A.overflows.filter((P) => P > 0).reduce((P, Nt) => P + Nt, 0)]).sort((A, P) => A[1] - P[1])[0]) == null ? void 0 : wt[0];
334
+ }).map((A) => [A.placement, A.overflows.filter((P) => P > 0).reduce((P, Bt) => P + Bt, 0)]).sort((A, P) => A[1] - P[1])[0]) == null ? void 0 : wt[0];
335
335
  M && (K = M);
336
336
  break;
337
337
  }
@@ -858,7 +858,7 @@ const Pe = {
858
858
  isElement: C,
859
859
  isRTL: Ee
860
860
  };
861
- function Bt(t, e) {
861
+ function Nt(t, e) {
862
862
  return t.x === e.x && t.y === e.y && t.width === e.width && t.height === e.height;
863
863
  }
864
864
  function ke(t, e) {
@@ -884,15 +884,15 @@ function ke(t, e) {
884
884
  };
885
885
  let b = !0;
886
886
  function v(X) {
887
- const B = X[0].intersectionRatio;
888
- if (B !== c) {
887
+ const N = X[0].intersectionRatio;
888
+ if (N !== c) {
889
889
  if (!b)
890
890
  return s();
891
- B ? s(!1, B) : i = setTimeout(() => {
891
+ N ? s(!1, N) : i = setTimeout(() => {
892
892
  s(!1, 1e-7);
893
893
  }, 1e3);
894
894
  }
895
- B === 1 && !Bt(a, t.getBoundingClientRect()) && s(), b = !1;
895
+ N === 1 && !Nt(a, t.getBoundingClientRect()) && s(), b = !1;
896
896
  }
897
897
  try {
898
898
  n = new IntersectionObserver(v, {
@@ -934,7 +934,7 @@ function Fe(t, e, n, i) {
934
934
  c && y();
935
935
  function y() {
936
936
  const m = W(t);
937
- g && !Bt(g, m) && n(), g = m, p = requestAnimationFrame(y);
937
+ g && !Nt(g, m) && n(), g = m, p = requestAnimationFrame(y);
938
938
  }
939
939
  return n(), () => {
940
940
  var m;
@@ -956,12 +956,12 @@ const De = re, Me = le, Ve = ie, $e = (t, e, n) => {
956
956
  platform: r
957
957
  });
958
958
  };
959
- var We = Object.defineProperty, Be = Object.getOwnPropertyDescriptor, S = (t, e, n, i) => {
960
- for (var o = i > 1 ? void 0 : i ? Be(e, n) : e, r = t.length - 1, s; r >= 0; r--)
959
+ var We = Object.defineProperty, Ne = Object.getOwnPropertyDescriptor, S = (t, e, n, i) => {
960
+ for (var o = i > 1 ? void 0 : i ? Ne(e, n) : e, r = t.length - 1, s; r >= 0; r--)
961
961
  (s = t[r]) && (o = (i ? s(e, n, o) : s(o)) || o);
962
962
  return i && o && We(e, n, o), o;
963
963
  };
964
- const Ne = "fhi-tooltip";
964
+ const Be = "fhi-tooltip";
965
965
  let O = class extends Ht {
966
966
  constructor() {
967
967
  super(...arguments), this.message = "", this.placement = "top", this.delay = 500, this.trigger = "hover", this.maxWidth = "18.75rem", this._timeoutId = void 0, this._autoPositioningCleanup = () => {
@@ -1122,7 +1122,7 @@ S([
1122
1122
  I({ type: String })
1123
1123
  ], O.prototype, "placement", 2);
1124
1124
  S([
1125
- I({ type: String })
1125
+ I({ type: Number })
1126
1126
  ], O.prototype, "delay", 2);
1127
1127
  S([
1128
1128
  I({ type: String })
@@ -1146,10 +1146,10 @@ S([
1146
1146
  ht()
1147
1147
  ], O.prototype, "_position", 2);
1148
1148
  O = S([
1149
- jt(Ne)
1149
+ jt(Be)
1150
1150
  ], O);
1151
1151
  export {
1152
1152
  O as FhiTooltip,
1153
- Ne as FhiTooltipSelector
1153
+ Be as FhiTooltipSelector
1154
1154
  };
1155
1155
  //# sourceMappingURL=fhi-tooltip.js.map