@manakind/ui-core 0.10.0 → 0.11.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.
@@ -18,6 +18,7 @@
18
18
  */
19
19
  border: 1px solid var(--_alert-border);
20
20
  border-radius: var(--ds-alert-radius);
21
+ overflow-wrap: anywhere;
21
22
  background-color: var(--_alert-bg);
22
23
  color: var(--_alert-text);
23
24
  font-size: var(--ds-alert-font-size);
@@ -52,8 +53,6 @@
52
53
  flex-direction: column;
53
54
  gap: var(--ds-alert-body-gap);
54
55
  min-width: 0;
55
- /* A word longer than the alert is wide (a URL, a quoted title) breaks instead of spilling out. */
56
- overflow-wrap: anywhere;
57
56
  }
58
57
 
59
58
  & .ds-alert__title {
@@ -13,11 +13,12 @@
13
13
  /*
14
14
  * A badge is almost always placed inside a flex row (a tab trigger, a card
15
15
  * header). The default `flex-shrink: 1` let it collapse below its own
16
- * content, and because the text is `nowrap` that showed up as clipped
17
- * digits rather than as a wrap — a three-digit count lost its last digit.
18
- * A badge is a small label; it should never be the thing that gives.
16
+ * content — a three-digit count lost its last digit. A badge is a small
17
+ * label; it should never be the thing that gives. It wraps only when its
18
+ * label is wider than the whole container.
19
19
  */
20
20
  flex-shrink: 0;
21
+ max-width: 100%;
21
22
  gap: var(--ds-badge-gap);
22
23
  /*
23
24
  * An explicit min-height rather than letting the box fall out of the
@@ -45,7 +46,7 @@
45
46
  font-size: var(--ds-badge-font-size);
46
47
  font-weight: var(--ds-badge-font-weight);
47
48
  line-height: inherit;
48
- white-space: nowrap;
49
+ overflow-wrap: anywhere;
49
50
 
50
51
  /*
51
52
  * A circle at one and two digits — the counts this shape is for — and a
@@ -9,6 +9,8 @@
9
9
  line-height: inherit;
10
10
  cursor: pointer;
11
11
  border: 1px solid transparent;
12
+ max-width: 100%;
13
+ overflow-wrap: anywhere;
12
14
 
13
15
  /*
14
16
  * For `asChild` on a link. A `<button>` is border-box and undecorated by
@@ -8,6 +8,7 @@
8
8
  background-color: var(--ds-card-bg);
9
9
  color: var(--ds-card-text);
10
10
  border: 1px solid var(--ds-card-border);
11
+ overflow-wrap: anywhere;
11
12
 
12
13
  & .ds-card__header {
13
14
  display: flex;
@@ -35,6 +36,7 @@
35
36
 
36
37
  & .ds-card__footer {
37
38
  display: flex;
39
+ flex-wrap: wrap;
38
40
  align-items: center;
39
41
  gap: var(--ds-card-gap);
40
42
  }
@@ -54,6 +54,7 @@
54
54
  background-color: var(--ds-dialog-bg);
55
55
  box-shadow: var(--ds-dialog-shadow);
56
56
  color: var(--ds-dialog-text);
57
+ overflow-wrap: anywhere;
57
58
 
58
59
  /*
59
60
  * The panel takes focus only as the focus trap's fallback, when nothing
@@ -4,6 +4,7 @@
4
4
  flex-direction: column;
5
5
  align-items: stretch;
6
6
  gap: var(--ds-field-gap);
7
+ overflow-wrap: anywhere;
7
8
 
8
9
  & .ds-field__label {
9
10
  display: inline-flex;
@@ -38,6 +39,12 @@
38
39
  }
39
40
 
40
41
  .ds-input {
42
+ /*
43
+ * Block, not inline: an inline-level input sits on its line's baseline
44
+ * and leaves a font-metric gap below it that differs between renderers,
45
+ * so screenshots of the same control disagreed by a pixel.
46
+ */
47
+ display: block;
41
48
  box-sizing: border-box;
42
49
  width: 100%;
43
50
  border: 1px solid var(--ds-input-border);
@@ -97,26 +104,44 @@
97
104
  cursor: default;
98
105
  }
99
106
 
107
+ /*
108
+ * A single-line input centres its text in its height, so it takes no
109
+ * block padding: with it, text plus padding plus border outgrew the
110
+ * control height and the input stood taller than the Select beside it.
111
+ * The textarea is sized by its rows and takes the block padding below.
112
+ */
100
113
  &.ds-input--sm {
101
114
  min-height: var(--ds-input-size-sm-height);
102
- padding: var(--ds-input-size-sm-padding-block) var(--ds-input-size-sm-padding-inline);
115
+ padding-inline: var(--ds-input-size-sm-padding-inline);
103
116
  font-size: var(--ds-input-size-sm-font-size);
104
117
  }
105
118
 
106
119
  &.ds-input--md {
107
120
  min-height: var(--ds-input-size-md-height);
108
- padding: var(--ds-input-size-md-padding-block) var(--ds-input-size-md-padding-inline);
121
+ padding-inline: var(--ds-input-size-md-padding-inline);
109
122
  font-size: var(--ds-input-size-md-font-size);
110
123
  }
111
124
 
112
125
  &.ds-input--lg {
113
126
  min-height: var(--ds-input-size-lg-height);
114
- padding: var(--ds-input-size-lg-padding-block) var(--ds-input-size-lg-padding-inline);
127
+ padding-inline: var(--ds-input-size-lg-padding-inline);
115
128
  font-size: var(--ds-input-size-lg-font-size);
116
129
  }
117
130
  }
118
131
 
119
132
  .ds-textarea {
120
133
  resize: vertical;
134
+
135
+ &.ds-input--sm {
136
+ padding-block: var(--ds-input-size-sm-padding-block);
137
+ }
138
+
139
+ &.ds-input--md {
140
+ padding-block: var(--ds-input-size-md-padding-block);
141
+ }
142
+
143
+ &.ds-input--lg {
144
+ padding-block: var(--ds-input-size-lg-padding-block);
145
+ }
121
146
  }
122
147
  }
@@ -1 +1 @@
1
- {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../src/field/field.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,aAAa,CAAC;AAGrB,MAAM,MAAM,UAAU,GAAG;IACvB,4EAA4E;IAC5E,KAAK,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB,wEAAwE;IACxE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gFAAgF;IAChF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,EAAE,EACF,SAAS,GACV,EAAE,UAAU,2CAqBZ"}
1
+ {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../src/field/field.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,aAAa,CAAC;AAGrB,MAAM,MAAM,UAAU,GAAG;IACvB,4EAA4E;IAC5E,KAAK,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB,wEAAwE;IACxE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gFAAgF;IAChF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAsBF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,EAAE,EACF,SAAS,GACV,EAAE,UAAU,2CAkBZ"}
@@ -1,7 +1,22 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Field as ArkField } from '@ark-ui/react/field';
2
+ import { Field as ArkField, useFieldContext } from '@ark-ui/react/field';
3
3
  import './field.css';
4
4
  import { cx } from '../cx';
5
+ /**
6
+ * A `<label for>` activates only a labelable element. A control a product
7
+ * composes itself (a rich-text editor, see `useFieldControl`) is a `div`,
8
+ * so a click on its label would do nothing. This gives such a control the
9
+ * focus the label promises; a native control keeps the browser's behaviour.
10
+ */
11
+ function FieldLabel({ children }) {
12
+ const field = useFieldContext();
13
+ const focusCustomControl = () => {
14
+ const control = document.getElementById(field.ids.control);
15
+ if (control instanceof HTMLElement && !('labels' in control))
16
+ control.focus();
17
+ };
18
+ return (_jsxs(ArkField.Label, { className: "ds-field__label", onClick: focusCustomControl, children: [children, _jsx(ArkField.RequiredIndicator, { className: "ds-field__indicator" })] }));
19
+ }
5
20
  /**
6
21
  * A labelled form control with optional hint and error, built on Ark UI.
7
22
  *
@@ -20,6 +35,6 @@ import { cx } from '../cx';
20
35
  export function Field({ label, children, hint, error, invalid, required, disabled, readOnly, id, className, }) {
21
36
  const hasHint = Boolean(hint);
22
37
  const hasError = Boolean(error);
23
- return (_jsxs(ArkField.Root, { id: id, invalid: invalid ?? hasError, required: required, disabled: disabled, readOnly: readOnly, className: cx('ds-field', className), children: [_jsxs(ArkField.Label, { className: "ds-field__label", children: [label, _jsx(ArkField.RequiredIndicator, { className: "ds-field__indicator" })] }), children, hasHint && _jsx(ArkField.HelperText, { className: "ds-field__hint", children: hint }), hasError && _jsx(ArkField.ErrorText, { className: "ds-field__message", children: error })] }));
38
+ return (_jsxs(ArkField.Root, { id: id, invalid: invalid ?? hasError, required: required, disabled: disabled, readOnly: readOnly, className: cx('ds-field', className), children: [_jsx(FieldLabel, { children: label }), children, hasHint && _jsx(ArkField.HelperText, { className: "ds-field__hint", children: hint }), hasError && _jsx(ArkField.ErrorText, { className: "ds-field__message", children: error })] }));
24
39
  }
25
40
  //# sourceMappingURL=field.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"field.js","sourceRoot":"","sources":["../../src/field/field.tsx"],"names":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,YAAE,IAAI,GAAuB,EACvF,QAAQ,IAAI,KAAC,QAAQ,CAAC,SAAS,IAAC,SAAS,EAAC,mBAAmB,YAAE,KAAK,GAAsB,IAC7E,CACjB,CAAC;AACJ,CAAC"}
@@ -8,6 +8,15 @@
8
8
  border: 1px solid var(--ds-menu-content-border);
9
9
  border-radius: var(--ds-menu-content-radius);
10
10
  background-color: var(--ds-menu-content-bg);
11
+ /*
12
+ * As wide as its longest item, so a short label never wraps early, but no
13
+ * wider than the room Zag measures beside the trigger: past that an item
14
+ * wraps instead of pushing the menu off screen.
15
+ */
16
+ box-sizing: border-box;
17
+ inline-size: max-content;
18
+ max-inline-size: var(--available-width);
19
+ overflow-wrap: anywhere;
11
20
  /*
12
21
  * The `popup` stacking layer (ds-config/scripts/stacking.ts), as Select's
13
22
  * listbox: Zag copies this onto the positioner, a sibling of the page in
@@ -51,7 +60,6 @@
51
60
  calc(var(--ds-menu-content-radius) - var(--ds-menu-content-padding) - 1px)
52
61
  );
53
62
  color: var(--ds-menu-item-text);
54
- white-space: nowrap;
55
63
  cursor: pointer;
56
64
 
57
65
  &[data-highlighted] {
@@ -4,9 +4,12 @@
4
4
  flex-direction: column;
5
5
  gap: var(--ds-progress-gap);
6
6
  width: 100%;
7
+ overflow-wrap: anywhere;
7
8
 
9
+ /* Wraps, so a long label takes a line of its own instead of squeezing the value. */
8
10
  & .ds-progress__header {
9
11
  display: flex;
12
+ flex-wrap: wrap;
10
13
  align-items: center;
11
14
  justify-content: space-between;
12
15
  gap: var(--ds-progress-gap);
@@ -27,6 +27,7 @@
27
27
  background-color: var(--ds-select-content-bg);
28
28
  max-height: 20rem;
29
29
  overflow-y: auto;
30
+ overflow-wrap: anywhere;
30
31
  /*
31
32
  * Zag copies this onto the positioner, which is a sibling of the page in
32
33
  * `<body>`. Without it the listbox ranks as `auto` and any positioned page
@@ -109,10 +110,12 @@
109
110
  display: flex;
110
111
  flex-direction: column;
111
112
  gap: var(--ds-select-content-padding);
113
+ overflow-wrap: anywhere;
112
114
 
113
115
  & .ds-select__label {
114
- color: var(--ds-select-trigger-text);
115
- font-size: var(--ds-select-size-md-font-size);
116
+ color: var(--ds-select-label-text);
117
+ font-size: var(--ds-select-label-font-size);
118
+ font-weight: var(--ds-select-label-font-weight);
116
119
  }
117
120
 
118
121
  & .ds-select__trigger {
@@ -26,6 +26,8 @@
26
26
  gap: var(--ds-switch-label-gap);
27
27
  color: var(--ds-switch-label-text);
28
28
  font-size: var(--_switch-font-size);
29
+ max-width: 100%;
30
+ overflow-wrap: anywhere;
29
31
  cursor: pointer;
30
32
 
31
33
  &[data-disabled] {
@@ -9,6 +9,7 @@
9
9
  * the chance to scroll.
10
10
  */
11
11
  min-inline-size: 0;
12
+ overflow-wrap: anywhere;
12
13
 
13
14
  /*
14
15
  * Derived so an inset child never curves more than its container.
@@ -106,8 +107,10 @@
106
107
  * list by the ring's overhang, and takes that back with a negative margin
107
108
  * to leave the list exactly where it was.
108
109
  */
110
+ /* Sideways only, which is also what tells the long-words test it scrolls. */
109
111
  & .ds-tabs__scroller {
110
112
  overflow-x: auto;
113
+ overflow-y: hidden;
111
114
  margin: calc(-1 * var(--_tabs-ring-overhang));
112
115
  padding: var(--_tabs-ring-overhang);
113
116
  scroll-padding-inline: var(--_tabs-ring-reach);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manakind/ui-core",
3
- "version": "0.10.0",
3
+ "version": "0.11.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -146,7 +146,7 @@
146
146
  },
147
147
  "devDependencies": {
148
148
  "@manakind/ds-config": "*",
149
- "@manakind/manuia-tokens": "0.9.0",
149
+ "@manakind/manuia-tokens": "0.10.0",
150
150
  "@testing-library/jest-dom": "^6.9.1",
151
151
  "@testing-library/react": "^16.3.2",
152
152
  "@testing-library/user-event": "^14.6.1",