marclayui 0.3.0 → 0.3.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.
@@ -1,58 +0,0 @@
1
- /* MarclayUI — Select (native <select>, styled for every engine) */
2
- .mcl-select-shell {
3
- position: relative;
4
- display: inline-block;
5
- max-width: 100%;
6
- }
7
- .mcl-select-shell::after {
8
- content: "";
9
- position: absolute;
10
- right: 19px;
11
- top: 50%;
12
- width: 9px;
13
- height: 9px;
14
- border-right: 2.5px solid var(--mcl-muted);
15
- border-bottom: 2.5px solid var(--mcl-muted);
16
- transform: translateY(-70%) rotate(45deg);
17
- pointer-events: none;
18
- }
19
- .mcl-select {
20
- appearance: none;
21
- -webkit-appearance: none;
22
- -moz-appearance: none;
23
- padding: 14px 46px 14px 20px;
24
- border: 0;
25
- outline: none;
26
- border-radius: var(--mcl-radius);
27
- background: var(--mcl-bg);
28
- box-shadow: var(--mcl-in-sm);
29
- font-family: inherit;
30
- font-size: 14.5px;
31
- font-weight: 600;
32
- color: var(--mcl-ink);
33
- cursor: pointer;
34
- transition: box-shadow 0.25s;
35
- max-width: 100%;
36
- }
37
- .mcl-select:focus {
38
- box-shadow: var(--mcl-in-sm), 0 0 0 2.5px var(--mcl-ring);
39
- }
40
- .mcl-select-invalid {
41
- box-shadow: var(--mcl-in-sm), 0 0 0 2.5px var(--mcl-ring-danger);
42
- }
43
- .mcl-select-sm {
44
- padding: 10px 40px 10px 16px;
45
- font-size: 13.5px;
46
- border-radius: var(--mcl-radius-sm);
47
- }
48
- .mcl-select-lg {
49
- padding: 17px 52px 17px 24px;
50
- font-size: 16px;
51
- border-radius: calc(var(--mcl-radius) + 4px);
52
- }
53
- /* dropdown list colors */
54
- .mcl-select option {
55
- background: var(--mcl-bg);
56
- color: var(--mcl-ink);
57
- font-family: inherit;
58
- }
@@ -1,72 +0,0 @@
1
- import React from "react";
2
-
3
- export interface SelectOption {
4
- value: string;
5
- label: string;
6
- }
7
-
8
- export interface SelectProps extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, "size"> {
9
- label?: React.ReactNode;
10
- hint?: React.ReactNode;
11
- error?: string;
12
- size?: "sm" | "md" | "lg";
13
- /** Convenience over children: [{ value, label }] */
14
- options?: SelectOption[];
15
- placeholder?: string;
16
- }
17
-
18
- export function Select({
19
- label,
20
- hint,
21
- error,
22
- size = "md",
23
- options,
24
- placeholder,
25
- className = "",
26
- id,
27
- children,
28
- ...rest
29
- }: SelectProps) {
30
- const autoId = React.useId();
31
- const selectId = id ?? autoId;
32
- const select = (
33
- <span className={`mcl-select-shell ${className}`.trim()}>
34
- <select
35
- id={selectId}
36
- className={`mcl-select mcl-select-${size}${error ? " mcl-select-invalid" : ""}`}
37
- aria-invalid={error ? true : undefined}
38
- {...rest}
39
- >
40
- {placeholder && (
41
- <option value="" disabled>
42
- {placeholder}
43
- </option>
44
- )}
45
- {options?.map((o) => (
46
- <option key={o.value} value={o.value}>
47
- {o.label}
48
- </option>
49
- ))}
50
- {children}
51
- </select>
52
- </span>
53
- );
54
- if (!label && !hint && !error) return select;
55
- return (
56
- <div className="mcl-field">
57
- {label && (
58
- <label className="mcl-label" htmlFor={selectId}>
59
- {label}
60
- </label>
61
- )}
62
- {select}
63
- {error ? (
64
- <div className="mcl-hint mcl-hint-error" role="alert">
65
- {error}
66
- </div>
67
- ) : hint ? (
68
- <div className="mcl-hint">{hint}</div>
69
- ) : null}
70
- </div>
71
- );
72
- }