@sharadox/graphical-user-interface-web-library 0.2.0-development.11 → 0.2.0-development.21

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 (96) hide show
  1. package/README.md +9 -0
  2. package/distribution/avatar/index.d.ts +20 -0
  3. package/distribution/avatar/index.d.ts.map +1 -0
  4. package/distribution/avatar/index.js +35 -0
  5. package/distribution/avatar/index.js.map +1 -0
  6. package/distribution/avatar/index.module.css +1 -0
  7. package/distribution/avatar/index.module.scss +16 -0
  8. package/distribution/avatar/type.d.ts +9 -0
  9. package/distribution/avatar/type.d.ts.map +1 -0
  10. package/distribution/avatar/type.js +2 -0
  11. package/distribution/avatar/type.js.map +1 -0
  12. package/distribution/badge/index.d.ts +10 -0
  13. package/distribution/badge/index.d.ts.map +1 -0
  14. package/distribution/badge/index.js +15 -0
  15. package/distribution/badge/index.js.map +1 -0
  16. package/distribution/badge/index.module.css +1 -0
  17. package/distribution/badge/index.module.scss +7 -0
  18. package/distribution/badge/type.d.ts +4 -0
  19. package/distribution/badge/type.d.ts.map +1 -0
  20. package/distribution/badge/type.js +2 -0
  21. package/distribution/badge/type.js.map +1 -0
  22. package/distribution/card/index.d.ts +11 -0
  23. package/distribution/card/index.d.ts.map +1 -0
  24. package/distribution/card/index.js +18 -0
  25. package/distribution/card/index.js.map +1 -0
  26. package/distribution/card/index.module.css +1 -0
  27. package/distribution/card/index.module.scss +22 -0
  28. package/distribution/card/type.d.ts +15 -0
  29. package/distribution/card/type.d.ts.map +1 -0
  30. package/distribution/card/type.js +2 -0
  31. package/distribution/card/type.js.map +1 -0
  32. package/distribution/combobox/index.d.ts +18 -0
  33. package/distribution/combobox/index.d.ts.map +1 -0
  34. package/distribution/combobox/index.js +105 -0
  35. package/distribution/combobox/index.js.map +1 -0
  36. package/distribution/combobox/index.module.css +1 -0
  37. package/distribution/combobox/index.module.scss +25 -0
  38. package/distribution/combobox/type.d.ts +8 -0
  39. package/distribution/combobox/type.d.ts.map +1 -0
  40. package/distribution/combobox/type.js +2 -0
  41. package/distribution/combobox/type.js.map +1 -0
  42. package/distribution/field/index.d.ts +1 -1
  43. package/distribution/field/index.d.ts.map +1 -1
  44. package/distribution/field/index.js +2 -2
  45. package/distribution/field/index.js.map +1 -1
  46. package/distribution/listbox/index.d.ts +11 -0
  47. package/distribution/listbox/index.d.ts.map +1 -0
  48. package/distribution/listbox/index.js +21 -0
  49. package/distribution/listbox/index.js.map +1 -0
  50. package/distribution/listbox/index.module.css +1 -0
  51. package/distribution/listbox/index.module.scss +38 -0
  52. package/distribution/listbox/type.d.ts +22 -0
  53. package/distribution/listbox/type.d.ts.map +1 -0
  54. package/distribution/listbox/type.js +2 -0
  55. package/distribution/listbox/type.js.map +1 -0
  56. package/distribution/number-field/index.d.ts +10 -0
  57. package/distribution/number-field/index.d.ts.map +1 -0
  58. package/distribution/number-field/index.js +46 -0
  59. package/distribution/number-field/index.js.map +1 -0
  60. package/distribution/number-field/index.module.css +1 -0
  61. package/distribution/number-field/index.module.scss +29 -0
  62. package/distribution/number-field/type.d.ts +29 -0
  63. package/distribution/number-field/type.d.ts.map +1 -0
  64. package/distribution/number-field/type.js +2 -0
  65. package/distribution/number-field/type.js.map +1 -0
  66. package/distribution/select/index.d.ts +13 -0
  67. package/distribution/select/index.d.ts.map +1 -0
  68. package/distribution/select/index.js +102 -0
  69. package/distribution/select/index.js.map +1 -0
  70. package/distribution/select/index.module.css +1 -0
  71. package/distribution/select/index.module.scss +42 -0
  72. package/distribution/select/type.d.ts +25 -0
  73. package/distribution/select/type.d.ts.map +1 -0
  74. package/distribution/select/type.js +2 -0
  75. package/distribution/select/type.js.map +1 -0
  76. package/distribution/separator/index.d.ts +11 -0
  77. package/distribution/separator/index.d.ts.map +1 -0
  78. package/distribution/separator/index.js +16 -0
  79. package/distribution/separator/index.js.map +1 -0
  80. package/distribution/separator/index.module.css +1 -0
  81. package/distribution/separator/index.module.scss +12 -0
  82. package/distribution/separator/type.d.ts +7 -0
  83. package/distribution/separator/type.d.ts.map +1 -0
  84. package/distribution/separator/type.js +2 -0
  85. package/distribution/separator/type.js.map +1 -0
  86. package/distribution/wrapper/index.d.ts +10 -0
  87. package/distribution/wrapper/index.d.ts.map +1 -0
  88. package/distribution/wrapper/index.js +15 -0
  89. package/distribution/wrapper/index.js.map +1 -0
  90. package/distribution/wrapper/index.module.css +1 -0
  91. package/distribution/wrapper/index.module.scss +8 -0
  92. package/distribution/wrapper/type.d.ts +4 -0
  93. package/distribution/wrapper/type.d.ts.map +1 -0
  94. package/distribution/wrapper/type.js +2 -0
  95. package/distribution/wrapper/type.js.map +1 -0
  96. package/package.json +2 -2
@@ -0,0 +1,38 @@
1
+ // Under its field, above everything after it; a nearly opaque background behind the glass so options read.
2
+ .list {
3
+ position: absolute;
4
+ z-index: 20;
5
+ inset-block-start: calc(100% + var(--scale-4));
6
+ inset-inline: 0;
7
+ max-block-size: 280px;
8
+ margin: 0;
9
+ overflow-y: auto;
10
+ list-style: none;
11
+ background: rgb(var(--background-color-rgb) / 85%);
12
+ scrollbar-width: thin;
13
+ scrollbar-color: var(--foreground-border-color) transparent;
14
+ overscroll-behavior: contain;
15
+ }
16
+
17
+ :where(.option) {
18
+ display: flex;
19
+ justify-content: space-between;
20
+ align-items: center;
21
+ gap: var(--scale-8);
22
+ min-block-size: var(--current-minimum-size);
23
+ padding-inline: var(--current-section-padding);
24
+ border-radius: var(--corner-radius);
25
+ cursor: pointer;
26
+ text-align: start;
27
+ transition: background-color var(--quick-duration) var(--easing);
28
+ }
29
+
30
+ :where(.option[data-active]) {
31
+ background: var(--current-transparent-hover-color);
32
+ }
33
+
34
+ :where(.empty) {
35
+ padding: var(--scale-8);
36
+ color: var(--middleground-color);
37
+ text-align: start;
38
+ }
@@ -0,0 +1,22 @@
1
+ import type { ReactNode } from "react";
2
+ /** One option of a list: what it stores and the words it shows. */
3
+ export interface ListboxOption {
4
+ value: string;
5
+ label: string;
6
+ }
7
+ export interface ListboxProperties {
8
+ /** The list's id; each option's is the list's plus `-<index>`, for `aria-activedescendant`. */
9
+ id: string;
10
+ /** The id of what names the list (its field's label). */
11
+ labelledBy: string;
12
+ options: readonly ListboxOption[];
13
+ /** The chosen option's value, marked selected with a check. */
14
+ chosen: string;
15
+ /** The index of the option the keyboard is on. */
16
+ active: number;
17
+ onActive: (index: number) => void;
18
+ onChoose: (index: number) => void;
19
+ /** Shown when there is no option (nothing matches what was typed). */
20
+ empty?: ReactNode;
21
+ }
22
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/listbox/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,mEAAmE;AACnE,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,+FAA+F;IAC/F,EAAE,EAAE,MAAM,CAAC;IACX,yDAAyD;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;IAClC,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,sEAAsE;IACtE,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/listbox/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { NumberFieldProperties } from "@sharadox/graphical-user-interface-web-library/number-field/type";
2
+ /**
3
+ * A number field: a number input between a minus and a plus button, each its own section. The buttons add or take
4
+ * away `step` and stop at `min` and `max`; typing sets any number, brought within the limits on leaving the field.
5
+ *
6
+ * @example
7
+ * <NumberField label="Guests" name="guests" defaultValue={2} min={1} max={12} decreaseLabel="Fewer" increaseLabel="More" />
8
+ */
9
+ export declare function NumberField(properties: NumberFieldProperties): import("react").JSX.Element;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/number-field/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kEAAkE,CAAC;AAM9G;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,qBAAqB,+BAuF5D"}
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { Box } from "@sharadox/graphical-user-interface-web-library/box";
5
+ import { Button } from "@sharadox/graphical-user-interface-web-library/button";
6
+ import { Field } from "@sharadox/graphical-user-interface-web-library/field";
7
+ import styles from "./index.module.css";
8
+ /** How many decimals a step has, so 0.1 + 0.2 shows 0.3. */
9
+ const decimals = (step) => (String(step).split(".")[1] ?? "").length;
10
+ /**
11
+ * A number field: a number input between a minus and a plus button, each its own section. The buttons add or take
12
+ * away `step` and stop at `min` and `max`; typing sets any number, brought within the limits on leaving the field.
13
+ *
14
+ * @example
15
+ * <NumberField label="Guests" name="guests" defaultValue={2} min={1} max={12} decreaseLabel="Fewer" increaseLabel="More" />
16
+ */
17
+ export function NumberField(properties) {
18
+ const { label, hideLabel, hint, error, value, defaultValue, onChange, min, max, step = 1, name, disabled, decreaseLabel, increaseLabel, state, id, className, color, variant = "outlined", ...look } = properties;
19
+ const [own, setOwn] = useState(defaultValue === undefined ? "" : String(defaultValue));
20
+ const text = value === undefined ? own : String(value);
21
+ const number = text === "" ? undefined : Number(text);
22
+ const within = (candidate) => Number(Math.min(max ?? Infinity, Math.max(min ?? -Infinity, candidate)).toFixed(decimals(step)));
23
+ const set = (next) => {
24
+ if (value === undefined)
25
+ setOwn(String(next));
26
+ onChange?.(next);
27
+ };
28
+ // From empty, plus starts one step above the minimum (or zero) and minus at it.
29
+ const by = (direction) => set(within(number === undefined ? (min ?? 0) + Math.max(0, direction) * step : number + direction * step));
30
+ const button = (direction) => (_jsx(Button
31
+ // On a filled field the buttons are filled too, so their icons take the color's text color.
32
+ , {
33
+ // On a filled field the buttons are filled too, so their icons take the color's text color.
34
+ variant: variant === "filled" ? "filled" : "transparent", color: color ?? (error === undefined ? "middleground" : "error"), square: true, icon: direction === 1 ? "plus" : "minus", "aria-label": direction === 1 ? increaseLabel : decreaseLabel, disabled: disabled ||
35
+ (number !== undefined && (direction === 1 ? number >= (max ?? Infinity) : number <= (min ?? -Infinity))), onClick: () => by(direction), className: styles.button }));
36
+ return (_jsx(Field, { label: label, hideLabel: hideLabel, hint: hint, error: error, id: id, className: className, children: (control) => (_jsx(Box, { field: true, variant: variant, color: color ?? (error === undefined ? "middleground" : "error"), state: state ?? (disabled ? "disabled" : "enabled"), prefix: button(-1), suffix: button(1), ...look, children: _jsx("input", { ...control, type: "number", inputMode: "decimal", name: name, min: min, max: max, step: step, value: text, disabled: disabled, onChange: (event) => {
37
+ const typed = event.target.value;
38
+ if (value === undefined)
39
+ setOwn(typed);
40
+ onChange?.(typed === "" ? undefined : Number(typed));
41
+ }, onBlur: () => {
42
+ if (number !== undefined && within(number) !== number)
43
+ set(within(number));
44
+ }, className: styles.input }) })) }));
45
+ }
46
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/number-field/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,MAAM,oDAAoD,CAAC;AACzE,OAAO,EAAE,MAAM,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E;oBACX,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,MAAM;wBAAE,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;gBAC7E,CAAC,EACD,SAAS,EAAE,MAAM,CAAC,KAAK,GACvB,GACE,CACP,GACK,CACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1 @@
1
+ :where(.input){box-sizing:border-box;inline-size:100%;min-inline-size:0;min-block-size:var(--section-minimum-size);margin:0;padding:0;border:0;outline:0;background:rgba(0,0,0,0);color:inherit;font:inherit;font-variant-numeric:tabular-nums;text-align:center;appearance:textfield}:where(.input)::-webkit-inner-spin-button,:where(.input)::-webkit-outer-spin-button{margin:0;appearance:none}.button{align-self:stretch;border-radius:0}
@@ -0,0 +1,29 @@
1
+ :where(.input) {
2
+ box-sizing: border-box;
3
+ inline-size: 100%;
4
+ min-inline-size: 0;
5
+ min-block-size: var(--section-minimum-size);
6
+ margin: 0;
7
+ padding: 0;
8
+ border: 0;
9
+ outline: 0;
10
+ background: transparent;
11
+ color: inherit;
12
+ font: inherit;
13
+ font-variant-numeric: tabular-nums;
14
+ text-align: center;
15
+ appearance: textfield;
16
+
17
+ // The browser's own arrows go: the minus and plus sections replace them.
18
+ &::-webkit-inner-spin-button,
19
+ &::-webkit-outer-spin-button {
20
+ margin: 0;
21
+ appearance: none;
22
+ }
23
+ }
24
+
25
+ // The buttons fill their sections edge to edge, without corners of their own (a plain class, to beat the box's).
26
+ .button {
27
+ align-self: stretch;
28
+ border-radius: 0;
29
+ }
@@ -0,0 +1,29 @@
1
+ import type { ReactNode } from "react";
2
+ import type { BoxLook, BoxState } from "@sharadox/graphical-user-interface-web-library/box/type";
3
+ export interface NumberFieldProperties extends Pick<BoxLook, "variant" | "color" | "colorStyle" | "corner" | "line" | "size"> {
4
+ label: ReactNode;
5
+ hideLabel?: boolean;
6
+ hint?: ReactNode;
7
+ error?: ReactNode;
8
+ /** Controlled: the number (or `undefined` while empty). */
9
+ value?: number;
10
+ /** Uncontrolled: the number at first. */
11
+ defaultValue?: number;
12
+ /** The new number, or `undefined` once emptied. */
13
+ onChange?: (value: number | undefined) => void;
14
+ min?: number;
15
+ max?: number;
16
+ /** How much each button adds or takes away (1 by default). */
17
+ step?: number;
18
+ name?: string;
19
+ disabled?: boolean;
20
+ /** The minus button's name for assistive technology ("Fewer"). */
21
+ decreaseLabel: string;
22
+ /** The plus button's name ("More"). */
23
+ increaseLabel: string;
24
+ /** Forces a state (for the design system). */
25
+ state?: BoxState;
26
+ id?: string;
27
+ className?: string;
28
+ }
29
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/number-field/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,yDAAyD,CAAC;AAEjG,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CACjD,OAAO,EACP,SAAS,GAAG,OAAO,GAAG,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAChE;IACC,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kEAAkE;IAClE,aAAa,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/number-field/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import type { SelectProperties } from "@sharadox/graphical-user-interface-web-library/select/type";
2
+ /**
3
+ * A select drawn by the interface, never the browser: a field box showing the choice, with a chevron section,
4
+ * opening a `Listbox` under it. It works as a native select does (the select-only combobox of the ARIA practices):
5
+ * the arrows, Home and End move, Enter, Space or Tab choose, Escape closes, a letter jumps to the next option
6
+ * starting with it (and chooses it while closed), and a click outside closes. With a `name`, the value goes in a
7
+ * hidden field for forms.
8
+ *
9
+ * @example
10
+ * <Select label="Month" name="month" placeholder="Choose a month" options={[{ value: "1", label: "January" }]} />
11
+ */
12
+ export declare function Select(properties: SelectProperties): import("react").JSX.Element;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/select/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAC;AAGnG;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,UAAU,EAAE,gBAAgB,+BAwIlD"}
@@ -0,0 +1,102 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useRef, useState } from "react";
4
+ import { Icon } from "@sharadox/icon-web-library/icon";
5
+ import { classNames } from "@sharadox/web-library/class-name";
6
+ import { Box } from "@sharadox/graphical-user-interface-web-library/box";
7
+ import { Field } from "@sharadox/graphical-user-interface-web-library/field";
8
+ import { Listbox } from "@sharadox/graphical-user-interface-web-library/listbox";
9
+ import styles from "./index.module.css";
10
+ /**
11
+ * A select drawn by the interface, never the browser: a field box showing the choice, with a chevron section,
12
+ * opening a `Listbox` under it. It works as a native select does (the select-only combobox of the ARIA practices):
13
+ * the arrows, Home and End move, Enter, Space or Tab choose, Escape closes, a letter jumps to the next option
14
+ * starting with it (and chooses it while closed), and a click outside closes. With a `name`, the value goes in a
15
+ * hidden field for forms.
16
+ *
17
+ * @example
18
+ * <Select label="Month" name="month" placeholder="Choose a month" options={[{ value: "1", label: "January" }]} />
19
+ */
20
+ export function Select(properties) {
21
+ const { label, hideLabel, hint, error, options, value, defaultValue, onChange, name, placeholder, disabled, state, id, className, color, ...look } = properties;
22
+ const [own, setOwn] = useState(defaultValue ?? "");
23
+ const chosen = value ?? own;
24
+ const [open, setOpen] = useState(false);
25
+ const [active, setActive] = useState(0);
26
+ const root = useRef(null);
27
+ const chosenIndex = options.findIndex((option) => option.value === chosen);
28
+ const choose = (index) => {
29
+ const option = options[index];
30
+ if (value === undefined)
31
+ setOwn(option.value);
32
+ onChange?.(option.value);
33
+ setOpen(false);
34
+ };
35
+ const show = () => {
36
+ setActive(Math.max(0, chosenIndex));
37
+ setOpen(true);
38
+ };
39
+ /** The next option after `from` whose label starts with `letter`, from the top again at the end. */
40
+ const startingWith = (letter, from) => {
41
+ for (let step = 1; step <= options.length; step++) {
42
+ const index = (from + step) % options.length;
43
+ if (options[index].label.toLowerCase().startsWith(letter))
44
+ return index;
45
+ }
46
+ return -1;
47
+ };
48
+ useEffect(() => {
49
+ if (!open)
50
+ return;
51
+ const outside = (event) => {
52
+ if (!root.current.contains(event.target))
53
+ setOpen(false);
54
+ };
55
+ document.addEventListener("pointerdown", outside);
56
+ return () => document.removeEventListener("pointerdown", outside);
57
+ }, [open]);
58
+ const keyDown = (event) => {
59
+ if (disabled)
60
+ return;
61
+ const { key } = event;
62
+ if (key.length === 1 && key !== " ") {
63
+ const index = startingWith(key.toLowerCase(), open ? active : chosenIndex);
64
+ if (index < 0)
65
+ return;
66
+ if (open)
67
+ setActive(index);
68
+ else
69
+ choose(index);
70
+ return;
71
+ }
72
+ if (!open) {
73
+ if (["ArrowDown", "ArrowUp", "Enter", " "].includes(key)) {
74
+ event.preventDefault();
75
+ show();
76
+ }
77
+ return;
78
+ }
79
+ const moves = {
80
+ ArrowDown: Math.min(options.length - 1, active + 1),
81
+ ArrowUp: Math.max(0, active - 1),
82
+ Home: 0,
83
+ End: options.length - 1,
84
+ };
85
+ if (key in moves) {
86
+ event.preventDefault();
87
+ setActive(moves[key]);
88
+ }
89
+ else if (key === "Enter" || key === " ") {
90
+ event.preventDefault();
91
+ choose(active);
92
+ }
93
+ else if (key === "Tab")
94
+ choose(active);
95
+ else if (key === "Escape") {
96
+ event.preventDefault();
97
+ setOpen(false);
98
+ }
99
+ };
100
+ return (_jsx(Field, { label: label, hideLabel: hideLabel, hint: hint, error: error, id: id, className: className, children: (control) => (_jsxs("div", { ref: root, className: styles.anchor, children: [name && _jsx("input", { type: "hidden", name: name, value: chosen }), _jsx(Box, { field: true, variant: "outlined", color: color ?? (error === undefined ? "middleground" : "error"), state: state ?? (disabled ? "disabled" : "enabled"), suffix: _jsx(Icon, { name: "chevron-down", className: classNames(styles.chevron, open && styles.open) }), ...look, className: styles.field, children: _jsx("button", { ...control, type: "button", role: "combobox", "aria-haspopup": "listbox", "aria-expanded": open, "aria-controls": `${control.id}-list`, "aria-activedescendant": open ? `${control.id}-list-${active}` : undefined, disabled: disabled, onClick: () => (open ? setOpen(false) : show()), onKeyDown: keyDown, className: styles.button, children: _jsx("span", { className: classNames(styles.value, chosenIndex < 0 && styles.placeholder), children: chosenIndex < 0 ? placeholder : options[chosenIndex].label }) }) }), open && (_jsx(Listbox, { id: `${control.id}-list`, labelledBy: `${control.id}-label`, options: options, chosen: chosen, active: active, onActive: setActive, onChoose: choose }))] })) }));
101
+ }
102
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/select/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAsB,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,oDAAoD,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,sDAAsD,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,wDAAwD,CAAC;AAEjF,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC;;;;;;;;;GASG;AACH,MAAM,UAAU,MAAM,CAAC,UAA4B;IACjD,MAAM,EACJ,KAAK,EACL,SAAS,EACT,IAAI,EACJ,KAAK,EACL,OAAO,EACP,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,KAAK,EACL,EAAE,EACF,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,GAAG,UAAU,CAAC;IACf,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;IACnD,MAAM,MAAM,GAAG,KAAK,IAAI,GAAG,CAAC;IAC5B,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC1C,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,EA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I,MAAM,CAAC,IAAI,CAAC,GAAI,KAC5F,IAAI,EACR,SAAS,EAAE,MAAM,CAAC,KAAK,YAEvB,oBACM,OAAO,EACX,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,UAAU,mBACD,SAAS,mBACR,IAAI,mBACJ,GAAG,OAAO,CAAC,EAAE,OAAO,2BACZ,IAAI,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,EACxE,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAC/C,SAAS,EAAE,OAAO,EAClB,SAAS,EAAE,MAAM,CAAC,MAAM,YAExB,eAAM,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,CAAC,IAAI,MAAM,CAAC,WAAW,CAAC,YAC7E,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAE,CAAC,KAAK,GACvD,GACA,GACL,EACL,IAAI,IAAI,CACP,KAAC,OAAO,IACN,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,OAAO,EACxB,UAAU,EAAE,GAAG,OAAO,CAAC,EAAE,QAAQ,EACjC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,SAAS,EACnB,QAAQ,EAAE,MAAM,GAChB,CACH,IACG,CACP,GACK,CACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1 @@
1
+ :where(.anchor){position:relative;display:flex;flex-direction:column}:where(.anchor)>.field{cursor:pointer}:where(.button){display:flex;align-items:center;inline-size:100%;min-block-size:var(--section-minimum-size);margin:0;padding:0;border:0;outline:0;background:none;color:inherit;font:inherit;text-align:start;cursor:inherit}:where(.field:not([data-variant=filled])) :where(.button){color:var(--current-hover-color)}:where(.placeholder){opacity:.6}:where(.chevron){transition:transform var(--duration) var(--easing)}:where(.open){transform:rotate(180deg)}
@@ -0,0 +1,42 @@
1
+ :where(.anchor) {
2
+ position: relative;
3
+ display: flex;
4
+ flex-direction: column;
5
+ }
6
+
7
+ // A select is pressed, not typed into: a pointer, with weight over the field box's text cursor.
8
+ :where(.anchor) > .field {
9
+ cursor: pointer;
10
+ }
11
+
12
+ :where(.button) {
13
+ display: flex;
14
+ align-items: center;
15
+ inline-size: 100%;
16
+ min-block-size: var(--section-minimum-size);
17
+ margin: 0;
18
+ padding: 0;
19
+ border: 0;
20
+ outline: 0;
21
+ background: none;
22
+ color: inherit;
23
+ font: inherit;
24
+ text-align: start;
25
+ cursor: inherit;
26
+ }
27
+
28
+ :where(.field:not([data-variant="filled"])) :where(.button) {
29
+ color: var(--current-hover-color);
30
+ }
31
+
32
+ :where(.placeholder) {
33
+ opacity: 0.6;
34
+ }
35
+
36
+ :where(.chevron) {
37
+ transition: transform var(--duration) var(--easing);
38
+ }
39
+
40
+ :where(.open) {
41
+ transform: rotate(180deg);
42
+ }
@@ -0,0 +1,25 @@
1
+ import type { ReactNode } from "react";
2
+ import type { BoxLook, BoxState } from "@sharadox/graphical-user-interface-web-library/box/type";
3
+ import type { ListboxOption } from "@sharadox/graphical-user-interface-web-library/listbox/type";
4
+ export interface SelectProperties extends Pick<BoxLook, "variant" | "color" | "colorStyle" | "corner" | "line" | "size"> {
5
+ label: ReactNode;
6
+ hideLabel?: boolean;
7
+ hint?: ReactNode;
8
+ error?: ReactNode;
9
+ options: readonly ListboxOption[];
10
+ /** Controlled: the chosen value. */
11
+ value?: string;
12
+ /** Uncontrolled: the value chosen at first. */
13
+ defaultValue?: string;
14
+ onChange?: (value: string) => void;
15
+ /** With a name, the value goes in a hidden field for forms. */
16
+ name?: string;
17
+ /** Shown while nothing is chosen. */
18
+ placeholder?: ReactNode;
19
+ disabled?: boolean;
20
+ /** Forces a state (for the design system). */
21
+ state?: BoxState;
22
+ id?: string;
23
+ className?: string;
24
+ }
25
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/select/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,yDAAyD,CAAC;AACjG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6DAA6D,CAAC;AAEjG,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAC5C,OAAO,EACP,SAAS,GAAG,OAAO,GAAG,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAChE;IACC,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;IAClC,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/select/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import type { SeparatorProperties } from "@sharadox/graphical-user-interface-web-library/separator/type";
2
+ /**
3
+ * A line between things: a horizontal rule by default, or vertical between items in a row. It is the color's border
4
+ * color (foreground's by default), in the line style and thickness.
5
+ *
6
+ * @example
7
+ * <Separator />
8
+ * <Separator orientation="vertical" line="dashed" />
9
+ */
10
+ export declare function Separator({ orientation, color, line, className }: SeparatorProperties): import("react").JSX.Element;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/separator/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+DAA+D,CAAC;AAGzG;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,EAAE,WAA0B,EAAE,KAAoB,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,mBAAmB,+BASnH"}
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { classNames } from "@sharadox/web-library/class-name";
3
+ import { lookAttributes } from "@sharadox/graphical-user-interface-web-library/box";
4
+ import styles from "./index.module.css";
5
+ /**
6
+ * A line between things: a horizontal rule by default, or vertical between items in a row. It is the color's border
7
+ * color (foreground's by default), in the line style and thickness.
8
+ *
9
+ * @example
10
+ * <Separator />
11
+ * <Separator orientation="vertical" line="dashed" />
12
+ */
13
+ export function Separator({ orientation = "horizontal", color = "foreground", line, className }) {
14
+ return (_jsx("hr", { ...lookAttributes({ color, line }), ...(orientation === "vertical" && { "aria-orientation": "vertical" }), "data-orientation": orientation, className: classNames(styles.separator, className) }));
15
+ }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/separator/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAC;AAEpF,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,EAAE,WAAW,GAAG,YAAY,EAAE,KAAK,GAAG,YAAY,EAAE,IAAI,EAAE,SAAS,EAAuB;IAClH,OAAO,CACL,gBACM,cAAc,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,KAC/B,CAAC,WAAW,KAAK,UAAU,IAAI,EAAE,kBAAkB,EAAE,UAAU,EAAE,CAAC,sBACpD,WAAW,EAC7B,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,GAClD,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1 @@
1
+ :where(.separator){flex:none;align-self:stretch;margin:0;border:0;border-block-start:var(--line-thickness) var(--line-style) var(--current-border-color)}:where(.separator[data-orientation=vertical]){border-block-start:0;border-inline-start:var(--line-thickness) var(--line-style) var(--current-border-color)}
@@ -0,0 +1,12 @@
1
+ :where(.separator) {
2
+ flex: none;
3
+ align-self: stretch;
4
+ margin: 0;
5
+ border: 0;
6
+ border-block-start: var(--line-thickness) var(--line-style) var(--current-border-color);
7
+ }
8
+
9
+ :where(.separator[data-orientation="vertical"]) {
10
+ border-block-start: 0;
11
+ border-inline-start: var(--line-thickness) var(--line-style) var(--current-border-color);
12
+ }
@@ -0,0 +1,7 @@
1
+ import type { BoxLook } from "@sharadox/graphical-user-interface-web-library/box/type";
2
+ export interface SeparatorProperties extends Pick<BoxLook, "color" | "line"> {
3
+ /** Across a column (`horizontal`, by default) or between items in a row (`vertical`). */
4
+ orientation?: "horizontal" | "vertical";
5
+ className?: string;
6
+ }
7
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/separator/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yDAAyD,CAAC;AAEvF,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1E,yFAAyF;IACzF,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/separator/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { WrapperProperties } from "@sharadox/graphical-user-interface-web-library/wrapper/type";
2
+ /**
3
+ * The page's width: a box as wide as its container up to `--wrapper-width` (1280), centered, with
4
+ * `--wrapper-padding` (16) on each side, so content never touches the screen's edges. Any element and box look.
5
+ *
6
+ * @example
7
+ * <Wrapper as="main" direction="top-to-bottom" gap={64}>…</Wrapper>
8
+ */
9
+ export declare function Wrapper({ className, ...box }: WrapperProperties): import("react").JSX.Element;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/wrapper/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6DAA6D,CAAC;AAGrG;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,EAAE,SAAS,EAAE,GAAG,GAAG,EAAE,EAAE,iBAAiB,+BAE/D"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { classNames } from "@sharadox/web-library/class-name";
3
+ import { Box } from "@sharadox/graphical-user-interface-web-library/box";
4
+ import styles from "./index.module.css";
5
+ /**
6
+ * The page's width: a box as wide as its container up to `--wrapper-width` (1280), centered, with
7
+ * `--wrapper-padding` (16) on each side, so content never touches the screen's edges. Any element and box look.
8
+ *
9
+ * @example
10
+ * <Wrapper as="main" direction="top-to-bottom" gap={64}>…</Wrapper>
11
+ */
12
+ export function Wrapper({ className, ...box }) {
13
+ return _jsx(Box, { ...box, "data-wrapper": "", className: classNames(styles.wrapper, className) });
14
+ }
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/wrapper/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,oDAAoD,CAAC;AAEzE,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAC,EAAE,SAAS,EAAE,GAAG,GAAG,EAAqB;IAC9D,OAAO,KAAC,GAAG,OAAK,GAAG,kBAAe,EAAE,EAAC,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,GAAI,CAAC;AAC5F,CAAC"}
@@ -0,0 +1 @@
1
+ .wrapper{box-sizing:border-box;inline-size:100%;max-inline-size:calc(var(--wrapper-width) + 2*var(--wrapper-padding));margin-inline:auto;padding-inline:var(--wrapper-padding)}
@@ -0,0 +1,8 @@
1
+ // A plain class, so its width and padding beat the box's own (zero-weight) values.
2
+ .wrapper {
3
+ box-sizing: border-box;
4
+ inline-size: 100%;
5
+ max-inline-size: calc(var(--wrapper-width) + 2 * var(--wrapper-padding));
6
+ margin-inline: auto;
7
+ padding-inline: var(--wrapper-padding);
8
+ }
@@ -0,0 +1,4 @@
1
+ import type { BoxProperties } from "@sharadox/graphical-user-interface-web-library/box/type";
2
+ /** A wrapper takes everything a box does. */
3
+ export type WrapperProperties = BoxProperties;
4
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/wrapper/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yDAAyD,CAAC;AAE7F,6CAA6C;AAC7C,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/wrapper/type.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sharadox/graphical-user-interface-web-library",
3
- "version": "0.2.0-development.11",
3
+ "version": "0.2.0-development.21",
4
4
  "description": "One generic, accessible, fully configurable component library: every interface piece in every variant, color, corner, line, size and state, styled from a single source of truth that each brand configures.",
5
5
  "private": false,
6
6
  "license": "SEE LICENSE IN LICENCA.md",
@@ -52,7 +52,7 @@
52
52
  "*.{json,md,yml,yaml,scss}": "prettier --write"
53
53
  },
54
54
  "dependencies": {
55
- "@sharadox/icon-web-library": "0.7.0-development.36",
55
+ "@sharadox/icon-web-library": "0.7.0-development.39",
56
56
  "@sharadox/style-web-library": "^0.3.1",
57
57
  "@sharadox/web-library": "^0.11.1"
58
58
  },