@hussmartinez/ui 0.5.0 → 0.7.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/README.md +3 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/react.d.ts +114 -0
- package/dist/react.js +173 -10
- package/dist/react.js.map +1 -1
- package/dist/styles.css +106 -0
- package/dist/ui.d.ts +114 -0
- package/package.json +3 -3
package/dist/styles.css
CHANGED
|
@@ -721,6 +721,54 @@
|
|
|
721
721
|
border-radius: var(--hm-toolbar-radius, var(--hm-radius-surface));
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
|
+
@layer hm.components {
|
|
725
|
+
/*
|
|
726
|
+
* A tooltip in the top layer (popover="manual"). It's placed with
|
|
727
|
+
* position: fixed, and Tooltip.tsx sets top and left; the offset from the
|
|
728
|
+
* trigger is a translation, so it never changes the measured box.
|
|
729
|
+
*/
|
|
730
|
+
.hm-tooltip {
|
|
731
|
+
box-sizing: border-box;
|
|
732
|
+
inset: auto;
|
|
733
|
+
margin: 0;
|
|
734
|
+
max-inline-size: var(--hm-tooltip-max-width, var(--hm-surface-width-small));
|
|
735
|
+
overflow: visible;
|
|
736
|
+
padding: var(--hm-tooltip-padding, var(--hm-inset-tight));
|
|
737
|
+
position: fixed;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
.hm-tooltip[data-hm-placement="top"] {
|
|
741
|
+
translate: 0 calc(var(--hm-tooltip-offset, var(--hm-gap-tight)) * -1);
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
.hm-tooltip[data-hm-placement="bottom"] {
|
|
745
|
+
translate: 0 var(--hm-tooltip-offset, var(--hm-gap-tight));
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
.hm-tooltip-shortcut {
|
|
749
|
+
margin-inline-start: var(--hm-tooltip-padding, var(--hm-inset-tight));
|
|
750
|
+
white-space: nowrap;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
/*
|
|
754
|
+
* Visual styles, dropped with unstyled. The border is transparent, so
|
|
755
|
+
* forced-colours mode draws it.
|
|
756
|
+
*/
|
|
757
|
+
.hm-tooltip:not([data-hm-unstyled]) {
|
|
758
|
+
background: var(--hm-tooltip-bg, var(--hm-color-text));
|
|
759
|
+
border: var(--hm-border-width) solid transparent;
|
|
760
|
+
border-radius: var(--hm-tooltip-radius, var(--hm-radius-control));
|
|
761
|
+
box-shadow: var(--hm-tooltip-shadow, var(--hm-shadow-raised));
|
|
762
|
+
color: var(--hm-tooltip-fg, var(--hm-color-bg));
|
|
763
|
+
font-family: var(--hm-font-family);
|
|
764
|
+
font-size: var(--hm-tooltip-font-size, var(--hm-font-size-small));
|
|
765
|
+
line-height: var(--hm-line-height-tight);
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
.hm-tooltip:not([data-hm-unstyled]) kbd {
|
|
769
|
+
font-family: inherit;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
724
772
|
@layer hm.components {
|
|
725
773
|
.hm-segmented-control {
|
|
726
774
|
box-sizing: border-box;
|
|
@@ -1113,6 +1161,64 @@
|
|
|
1113
1161
|
}
|
|
1114
1162
|
}
|
|
1115
1163
|
}
|
|
1164
|
+
@layer hm.components {
|
|
1165
|
+
/*
|
|
1166
|
+
* Layout, focus and target size: kept with unstyled, so the field stays
|
|
1167
|
+
* usable and accessible.
|
|
1168
|
+
*/
|
|
1169
|
+
.hm-text-field {
|
|
1170
|
+
box-sizing: border-box;
|
|
1171
|
+
min-block-size: max(
|
|
1172
|
+
var(--hm-text-field-height, var(--hm-control-height)),
|
|
1173
|
+
var(--hm-target-size)
|
|
1174
|
+
);
|
|
1175
|
+
min-inline-size: var(--hm-target-size);
|
|
1176
|
+
padding-block: 0;
|
|
1177
|
+
padding-inline: var(--hm-text-field-padding-x, var(--hm-control-padding-x));
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
.hm-text-field:focus-visible {
|
|
1181
|
+
outline: var(--hm-focus-ring);
|
|
1182
|
+
outline-offset: var(--hm-focus-ring-offset);
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
.hm-text-field:disabled {
|
|
1186
|
+
cursor: not-allowed;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
/* Visual styles, dropped with unstyled. */
|
|
1190
|
+
.hm-text-field:not([data-hm-unstyled]) {
|
|
1191
|
+
background: var(--hm-text-field-bg, var(--hm-color-surface));
|
|
1192
|
+
border: var(--hm-border-width) solid
|
|
1193
|
+
var(--hm-text-field-border-color, var(--hm-color-border-strong));
|
|
1194
|
+
border-radius: var(--hm-text-field-radius, var(--hm-radius-control));
|
|
1195
|
+
color: var(--hm-text-field-fg, var(--hm-color-text));
|
|
1196
|
+
font-family: var(--hm-font-family);
|
|
1197
|
+
font-size: var(--hm-font-size-body);
|
|
1198
|
+
letter-spacing: var(--hm-letter-spacing);
|
|
1199
|
+
line-height: var(--hm-line-height-tight);
|
|
1200
|
+
transition: border-color var(--hm-motion-duration-feedback) var(--hm-motion-easing-standard);
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
.hm-text-field:not([data-hm-unstyled])::placeholder {
|
|
1204
|
+
color: var(--hm-text-field-placeholder-fg, var(--hm-color-text-muted));
|
|
1205
|
+
opacity: 1;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
.hm-text-field[aria-invalid="true"]:not([data-hm-unstyled]) {
|
|
1209
|
+
border-color: var(--hm-text-field-invalid-border-color, var(--hm-color-danger-text));
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
.hm-text-field:not([data-hm-unstyled]):disabled {
|
|
1213
|
+
opacity: var(--hm-opacity-disabled);
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1217
|
+
.hm-text-field:not([data-hm-unstyled]) {
|
|
1218
|
+
transition-duration: 0s;
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1116
1222
|
@layer hm.components {
|
|
1117
1223
|
.hm-spinner {
|
|
1118
1224
|
block-size: var(--hm-spinner-size, var(--hm-icon-size));
|
package/dist/ui.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ import { ReactNode } from 'react';
|
|
|
22
22
|
import { Ref } from 'react';
|
|
23
23
|
import { RefAttributes } from 'react';
|
|
24
24
|
import { RefObject } from 'react';
|
|
25
|
+
import type { ShortcutPart } from '@hussmartinez/sdk-core';
|
|
25
26
|
import type { SVGProps } from 'react';
|
|
26
27
|
|
|
27
28
|
/**
|
|
@@ -993,6 +994,48 @@ export declare interface StyleProps<Part extends string> {
|
|
|
993
994
|
readonly unstyled?: boolean | undefined;
|
|
994
995
|
}
|
|
995
996
|
|
|
997
|
+
/**
|
|
998
|
+
* A single-line text input, styled like the family's other fields. Inside a
|
|
999
|
+
* `Field`, it takes the field's label, description and error.
|
|
1000
|
+
*
|
|
1001
|
+
* @example
|
|
1002
|
+
* ```tsx
|
|
1003
|
+
* <Field label={t("export.fileName")} error={nameError}>
|
|
1004
|
+
* <TextField value={name} onValueChange={setName} autoComplete="off" />
|
|
1005
|
+
* </Field>
|
|
1006
|
+
* ```
|
|
1007
|
+
*
|
|
1008
|
+
* @public
|
|
1009
|
+
*/
|
|
1010
|
+
export declare const TextField: ForwardRefExoticComponent<TextFieldProps & RefAttributes<HTMLInputElement>>;
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* Props of {@link TextField}. Native input props are passed through, so it
|
|
1014
|
+
* works controlled with `value` and `onChange`, or uncontrolled with
|
|
1015
|
+
* `defaultValue`.
|
|
1016
|
+
*
|
|
1017
|
+
* @public
|
|
1018
|
+
*/
|
|
1019
|
+
export declare interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "className" | "type">, StyleProps<"root"> {
|
|
1020
|
+
/** Defaults to `text`. */
|
|
1021
|
+
readonly type?: TextFieldType | undefined;
|
|
1022
|
+
/** Called with the new text as it changes, as well as `onChange`. */
|
|
1023
|
+
readonly onValueChange?: ((value: string) => void) | undefined;
|
|
1024
|
+
/**
|
|
1025
|
+
* The accessible name, such as "File name". Leave it out inside a
|
|
1026
|
+
* `Field`, or when a visible `<label>` points at the field's `id`, or
|
|
1027
|
+
* `aria-labelledby` names it.
|
|
1028
|
+
*/
|
|
1029
|
+
readonly label?: string | undefined;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* The kinds of single-line text a {@link TextField} takes.
|
|
1034
|
+
*
|
|
1035
|
+
* @public
|
|
1036
|
+
*/
|
|
1037
|
+
export declare type TextFieldType = "text" | "search" | "email" | "url" | "tel" | "password";
|
|
1038
|
+
|
|
996
1039
|
/**
|
|
997
1040
|
* A validated theme. Create it with `createTheme`; its values are
|
|
998
1041
|
* frozen and safe to write into CSS.
|
|
@@ -1253,6 +1296,77 @@ export declare const ToolbarSeparator: ForwardRefExoticComponent<ToolbarSeparato
|
|
|
1253
1296
|
*/
|
|
1254
1297
|
export declare type ToolbarSeparatorProps = Omit<HTMLAttributes<HTMLHRElement>, "children">;
|
|
1255
1298
|
|
|
1299
|
+
/**
|
|
1300
|
+
* A tooltip: short text about a control, shown while the pointer rests on it
|
|
1301
|
+
* or while it has keyboard focus (WAI-ARIA tooltip pattern, WCAG 1.4.13).
|
|
1302
|
+
*
|
|
1303
|
+
* - It shows after `delay` on hover, and at once on keyboard focus, never
|
|
1304
|
+
* on a mouse click's focus or on touch.
|
|
1305
|
+
* - The pointer can move onto it without it closing, and it stays until the
|
|
1306
|
+
* pointer and focus leave. Escape closes it without moving focus, and
|
|
1307
|
+
* doesn't close a surrounding dialog.
|
|
1308
|
+
* - **While it's open, the first Escape belongs to the tooltip.** It calls
|
|
1309
|
+
* `preventDefault()`, so an editor's own Escape action, such as cancelling
|
|
1310
|
+
* a crop, runs on the second press. sdk-core's shortcut registry already
|
|
1311
|
+
* skips handled events; a handler of your own should check
|
|
1312
|
+
* `event.defaultPrevented` too.
|
|
1313
|
+
* - It's in the top layer, through the Popover API, so no stacking context
|
|
1314
|
+
* can hide it, and it's placed above the trigger, or below when there's no
|
|
1315
|
+
* room, without a positioning library (docs/adr/0006).
|
|
1316
|
+
*
|
|
1317
|
+
* @example
|
|
1318
|
+
* ```tsx
|
|
1319
|
+
* <Tooltip type="label" content={t("toolbar.undo")} shortcut={shortcuts.describe("pdf.undo")[0]}>
|
|
1320
|
+
* <IconButton label={t("toolbar.undo")} icon={<UndoIcon />} onClick={undo} />
|
|
1321
|
+
* </Tooltip>
|
|
1322
|
+
* ```
|
|
1323
|
+
*
|
|
1324
|
+
* @public
|
|
1325
|
+
*/
|
|
1326
|
+
export declare const Tooltip: ForwardRefExoticComponent<TooltipProps & RefAttributes<HTMLDivElement>>;
|
|
1327
|
+
|
|
1328
|
+
/**
|
|
1329
|
+
* The parts of a tooltip that `classNames` can target.
|
|
1330
|
+
*
|
|
1331
|
+
* @public
|
|
1332
|
+
*/
|
|
1333
|
+
export declare type TooltipPart = "root" | "content" | "shortcut";
|
|
1334
|
+
|
|
1335
|
+
/**
|
|
1336
|
+
* Props of {@link Tooltip}.
|
|
1337
|
+
*
|
|
1338
|
+
* @public
|
|
1339
|
+
*/
|
|
1340
|
+
export declare interface TooltipProps extends StyleProps<TooltipPart> {
|
|
1341
|
+
/** The text. Use text from your message catalogue. */
|
|
1342
|
+
readonly content: ReactNode;
|
|
1343
|
+
/**
|
|
1344
|
+
* How the text reaches assistive technology. `description`, the default,
|
|
1345
|
+
* describes the trigger (`aria-describedby`). `label` names it
|
|
1346
|
+
* (`aria-labelledby`): use it for an icon-only button whose tooltip says
|
|
1347
|
+
* what its label would, so screen readers don't hear it twice.
|
|
1348
|
+
*/
|
|
1349
|
+
readonly type?: "description" | "label" | undefined;
|
|
1350
|
+
/**
|
|
1351
|
+
* The trigger's keyboard shortcut, as sdk-core's shortcut registry
|
|
1352
|
+
* describes it: `registry.describe(toolId)[0]`. The tooltip shows it in the
|
|
1353
|
+
* platform's notation, such as ⌘⇧Z or Ctrl+Shift+Z, and the trigger gets
|
|
1354
|
+
* `aria-keyshortcuts`.
|
|
1355
|
+
*/
|
|
1356
|
+
readonly shortcut?: readonly ShortcutPart[] | undefined;
|
|
1357
|
+
/** Where it shows, when there's room: `top` (the default) or `bottom`. */
|
|
1358
|
+
readonly placement?: "top" | "bottom" | undefined;
|
|
1359
|
+
/** How long the pointer rests on the trigger before it shows, in milliseconds. Defaults to 500. */
|
|
1360
|
+
readonly delay?: number | undefined;
|
|
1361
|
+
/**
|
|
1362
|
+
* The trigger: one element that forwards its ref, such as `IconButton`.
|
|
1363
|
+
* A disabled trigger should use `focusableWhenDisabled`: a natively
|
|
1364
|
+
* disabled button gets neither focus nor pointer events, so its tooltip
|
|
1365
|
+
* can't show.
|
|
1366
|
+
*/
|
|
1367
|
+
readonly children: ReactElement;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1256
1370
|
/**
|
|
1257
1371
|
* The `trim-end` icon: Lucide's `arrow-left-from-line`.
|
|
1258
1372
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hussmartinez/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Design system of the @hussmartinez SDK family: tokens, themes, base styles and accessible React components.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"THIRD_PARTY_NOTICES.md"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@hussmartinez/sdk-core": "^0.
|
|
36
|
+
"@hussmartinez/sdk-core": "^0.4.1"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": ">=18.3",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
52
|
-
"@hussmartinez/sdk-config": "^0.
|
|
52
|
+
"@hussmartinez/sdk-config": "^0.5.0",
|
|
53
53
|
"@microsoft/api-extractor": "^7.60.1",
|
|
54
54
|
"@size-limit/file": "^14.3.0",
|
|
55
55
|
"@types/node": "^24.19.2",
|