@med-o/ui 0.3.0 → 0.4.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@med-o/ui",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "React components of the med.o Design System. Styles are plain CSS on top of @med-o/design-tokens and can be reused by other frameworks.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -25,7 +25,7 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@internationalized/date": "^3.12.4",
28
- "@med-o/design-tokens": "0.3.0",
28
+ "@med-o/design-tokens": "0.4.1",
29
29
  "lucide-react": "^1.59.0",
30
30
  "react-aria-components": "^1.22.1"
31
31
  },
@@ -85,6 +85,7 @@
85
85
  .medo-alert__actions {
86
86
  display: flex;
87
87
  flex-wrap: wrap;
88
+ /* Exception to the rule inline (8): the actions are text buttons without padding, 8 px would join them. */
88
89
  gap: var(--medo-space-4);
89
90
  margin-block-start: var(--medo-space-2);
90
91
  }
@@ -289,7 +289,7 @@
289
289
  display: flex;
290
290
  flex-wrap: wrap;
291
291
  align-items: center;
292
- gap: var(--medo-space-2);
292
+ gap: var(--medo-layout-gap-inline); /* spacing rule: side by side in one group */
293
293
  }
294
294
 
295
295
  .medo-button-group--footer,
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Layout – med.o Design System
3
+ *
4
+ * Spacing rules: every gap between elements comes from one of six rules (tokens layout/gap/*, they grow with
5
+ * the layout mode mobile · tablet · desktop):
6
+ * inline side by side in one group (buttons, tags, filters) 8
7
+ * content inside one block (heading, text, actions) 16
8
+ * fields form fields below each other 16 · 24 · 24
9
+ * items cards and tiles in a grid or list (= layout gutter) 16 · 24 · 24
10
+ * group groups inside a section (sub-sections, fieldsets) 32 · 40 · 48
11
+ * section sections of a page (= layout section) 48 · 64 · 96
12
+ *
13
+ * <div class="medo-stack">…</div> vertical, gap content
14
+ * <div class="medo-stack medo-stack--horizontal">…</div> horizontal, gap inline
15
+ * <div class="medo-grid">…</div> as many columns as fit, gap items
16
+ * <div class="medo-grid medo-grid--layout"><div class="medo-grid__item" style="--medo-grid-span: 6">…</div></div>
17
+ * <div class="medo-container medo-container--lg">…</div>
18
+ * Another rule: add medo-gap-{rule}, e.g. medo-gap-section. It works on any flex or grid container.
19
+ */
20
+
21
+ /* ---------- Stack ---------- */
22
+
23
+ .medo-stack {
24
+ display: flex;
25
+ flex-direction: column;
26
+ gap: var(--medo-layout-gap-content);
27
+ min-inline-size: 0;
28
+ }
29
+
30
+ .medo-stack--horizontal {
31
+ flex-direction: row;
32
+ gap: var(--medo-layout-gap-inline);
33
+ }
34
+
35
+ .medo-stack--wrap {
36
+ flex-wrap: wrap;
37
+ }
38
+
39
+ .medo-stack--align-start {
40
+ align-items: flex-start;
41
+ }
42
+ .medo-stack--align-center {
43
+ align-items: center;
44
+ }
45
+ .medo-stack--align-end {
46
+ align-items: flex-end;
47
+ }
48
+ .medo-stack--align-stretch {
49
+ align-items: stretch;
50
+ }
51
+ .medo-stack--align-baseline {
52
+ align-items: baseline;
53
+ }
54
+
55
+ .medo-stack--justify-start {
56
+ justify-content: flex-start;
57
+ }
58
+ .medo-stack--justify-center {
59
+ justify-content: center;
60
+ }
61
+ .medo-stack--justify-end {
62
+ justify-content: flex-end;
63
+ }
64
+ .medo-stack--justify-between {
65
+ justify-content: space-between;
66
+ }
67
+
68
+ /* ---------- Grid ---------- */
69
+
70
+ /* Default: as many columns as fit, each at least --medo-grid-min wide. auto-fill keeps empty tracks, so one or
71
+ two cards keep the size they have in a full row. min(…, 100%) stops a single column from overflowing. */
72
+ .medo-grid {
73
+ --medo-grid-min: 16rem;
74
+ display: grid;
75
+ grid-template-columns: repeat(auto-fill, minmax(min(var(--medo-grid-min), 100%), 1fr));
76
+ gap: var(--medo-layout-gap-items);
77
+ min-inline-size: 0;
78
+ }
79
+
80
+ /* A fixed number of equal columns. */
81
+ .medo-grid--columns {
82
+ grid-template-columns: repeat(var(--medo-grid-columns, 2), minmax(0, 1fr));
83
+ }
84
+
85
+ /* The layout grid: 4 · 8 · 12 columns with the gutter of the layout mode. */
86
+ .medo-grid--layout {
87
+ grid-template-columns: repeat(var(--medo-layout-columns), minmax(0, 1fr));
88
+ }
89
+
90
+ /* A span never exceeds the columns there are: span 6 is full width on a phone with 4 columns. */
91
+ .medo-grid__item {
92
+ grid-column: span var(--medo-grid-span, 1);
93
+ grid-column: span min(var(--medo-grid-span, 1), var(--medo-layout-columns));
94
+ min-inline-size: 0;
95
+ }
96
+
97
+ .medo-grid--columns > .medo-grid__item {
98
+ grid-column: span min(var(--medo-grid-span, 1), var(--medo-grid-columns, 2));
99
+ }
100
+
101
+ .medo-grid__item.medo-grid__item--full {
102
+ grid-column: 1 / -1;
103
+ }
104
+
105
+ /* ---------- Container ---------- */
106
+
107
+ /* Centred content with the page margin of the layout mode. The width limit applies to the content, the margin
108
+ comes on top (content-box), so text lines keep their measure on every screen. */
109
+ .medo-container {
110
+ box-sizing: content-box;
111
+ max-inline-size: var(--medo-container-xl);
112
+ margin-inline: auto;
113
+ padding-inline: var(--medo-layout-margin);
114
+ }
115
+
116
+ .medo-container--prose {
117
+ max-inline-size: var(--medo-container-prose);
118
+ }
119
+ .medo-container--md {
120
+ max-inline-size: var(--medo-container-md);
121
+ }
122
+ .medo-container--lg {
123
+ max-inline-size: var(--medo-container-lg);
124
+ }
125
+ .medo-container--full {
126
+ max-inline-size: none;
127
+ }
128
+
129
+ /* ---------- Spacing rules as classes (last, so they win over the defaults above) ---------- */
130
+
131
+ .medo-gap-inline {
132
+ gap: var(--medo-layout-gap-inline);
133
+ }
134
+ .medo-gap-content {
135
+ gap: var(--medo-layout-gap-content);
136
+ }
137
+ .medo-gap-fields {
138
+ gap: var(--medo-layout-gap-fields);
139
+ }
140
+ .medo-gap-items {
141
+ gap: var(--medo-layout-gap-items);
142
+ }
143
+ .medo-gap-group {
144
+ gap: var(--medo-layout-gap-group);
145
+ }
146
+ .medo-gap-section {
147
+ gap: var(--medo-layout-gap-section);
148
+ }
@@ -244,7 +244,7 @@
244
244
  /* ---------- Cards ---------- */
245
245
 
246
246
  .medo-list-view--cards {
247
- gap: var(--medo-space-3);
247
+ gap: var(--medo-layout-gap-items); /* spacing rule: cards in a list */
248
248
  }
249
249
 
250
250
  .medo-list-card {
@@ -276,7 +276,7 @@
276
276
  flex-wrap: wrap;
277
277
  align-items: center;
278
278
  justify-content: center;
279
- gap: var(--medo-space-2) var(--medo-space-4);
279
+ gap: var(--medo-layout-gap-inline); /* spacing rule: buttons side by side */
280
280
  }
281
281
 
282
282
  .medo-embed--loaded {
package/src/styles.css CHANGED
@@ -8,6 +8,7 @@
8
8
  @layer theme, base, components, utilities;
9
9
 
10
10
  @import './utils/utilities.css' layer(components);
11
+ @import './layout/layout.css' layer(components);
11
12
  @import './button/button.css' layer(components);
12
13
  @import './field/field.css' layer(components);
13
14
  @import './text-field/input.css' layer(components);