@stamcat/craftsman 0.1.4 → 0.1.8
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/AGENTS.md +1 -0
- package/Components.esm.js +38 -36
- package/README.md +1 -0
- package/package.json +5 -1
- package/skills/craftsman-component-usage/SKILL.md +63 -6
- package/skills/craftsman-style-utilities/SKILL.md +1 -0
- package/src/components/DatePicker/AGENTS.md +1 -0
- package/src/components/DatePicker/DatePicker.css +1 -1
- package/src/components/DatePicker/DatePicker.esm.js +6 -5
- package/src/components/DatePicker/_DatePicker.scss +2 -0
- package/src/components/DateRangePicker/AGENTS.md +1 -0
- package/src/components/DateRangePicker/DateRangePicker.css +1 -1
- package/src/components/DateRangePicker/DateRangePicker.esm.js +6 -5
- package/src/components/DateTimePicker/AGENTS.md +1 -0
- package/src/components/DateTimePicker/DateTimePicker.css +1 -1
- package/src/components/DateTimePicker/DateTimePicker.esm.js +23 -22
- package/src/components/Input/AGENTS.md +8 -0
- package/src/components/Input/Input.css +1 -1
- package/src/components/Input/Input.esm.js +7 -4
- package/src/components/Input/Input.scss +15 -0
- package/src/components/Input/InputWrapper.d.ts +4 -0
- package/src/components/Input/InputWrapper.esm.js +13 -8
- package/src/components/InputPhone/AGENTS.md +1 -0
- package/src/components/InputPhone/InputPhone.css +1 -1
- package/src/components/InputPhone/InputPhone.esm.js +7 -6
- package/src/components/InputPhone/InputPhone.scss +3 -0
- package/src/components/Popover/AGENTS.md +62 -0
- package/src/components/Popover/Popover.css +1 -0
- package/src/components/Popover/Popover.d.ts +14 -0
- package/src/components/Popover/Popover.esm.js +80 -0
- package/src/components/Popover/Popover.scss +16 -0
- package/src/components/Select/AGENTS.md +1 -0
- package/src/components/Select/Select.esm.js +6 -5
- package/src/components/Textarea/AGENTS.md +8 -0
- package/src/components/Textarea/Textarea.esm.js +24 -20
- package/src/components/TimePicker/AGENTS.md +1 -0
- package/src/components/TimePicker/TimePicker.css +1 -1
- package/src/components/TimePicker/TimePicker.esm.js +23 -22
- package/src/components/TimePicker/TimePicker.scss +6 -1
- package/src/components/Toggle/Toggle.d.ts +1 -1
- package/src/components/index.d.ts +1 -0
- package/src/styles/global/components/_input.scss +1 -0
- package/src/styles/global/globalStyles.scss +7 -0
|
@@ -5,22 +5,27 @@ import { useState as t } from "react";
|
|
|
5
5
|
import n from "clsx";
|
|
6
6
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/Input/InputWrapper.tsx
|
|
8
|
-
var a = ({ label: a, labelPosition: o = "top", required: s = !1, error: c, className: l, style: u, children: d, value: f, defaultValue: p, onLabelClick: m }) => {
|
|
9
|
-
let
|
|
10
|
-
if (
|
|
8
|
+
var a = ({ label: a, labelPosition: o = "top", required: s = !1, error: c, className: l, style: u, children: d, value: f, defaultValue: p, onLabelClick: m, labelStyle: h, labelClassName: g, width: _ }) => {
|
|
9
|
+
let v = f !== void 0, [y, b] = t(!e(p)), x = v ? !e(f) : y, S = (t) => {
|
|
10
|
+
if (v) return;
|
|
11
11
|
let n = t.target;
|
|
12
|
-
|
|
12
|
+
b(!e(n.value));
|
|
13
13
|
};
|
|
14
14
|
return /* @__PURE__ */ i("div", {
|
|
15
15
|
"data-label-position": o,
|
|
16
16
|
"data-required": s,
|
|
17
|
-
"data-has-input":
|
|
17
|
+
"data-has-input": x,
|
|
18
18
|
className: n("input-wrapper", l),
|
|
19
|
-
style:
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
style: {
|
|
20
|
+
...u,
|
|
21
|
+
..._ ? { "--input-width": _ } : void 0
|
|
22
|
+
},
|
|
23
|
+
onInput: S,
|
|
24
|
+
onChange: S,
|
|
22
25
|
children: [/* @__PURE__ */ i("label", {
|
|
23
26
|
onClick: m,
|
|
27
|
+
className: g,
|
|
28
|
+
style: h,
|
|
24
29
|
children: [!e(a) && o !== "hidden" && /* @__PURE__ */ r("div", {
|
|
25
30
|
className: "input-label",
|
|
26
31
|
children: a
|
|
@@ -19,6 +19,7 @@ Props:
|
|
|
19
19
|
- `endAdornment?: ReactNode`
|
|
20
20
|
- `style?: React.CSSProperties` — targets the wrapper element.
|
|
21
21
|
- `inputStyle?: React.CSSProperties` — targets the underlying phone `<input>` field directly.
|
|
22
|
+
- `width?: string` — sets the field's width, accepts any CSS length e.g. `"50%"` or `"320px"`. Sets it via the `--input-width` CSS variable; omit for the default intrinsic/auto width.
|
|
22
23
|
|
|
23
24
|
Behavior notes:
|
|
24
25
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer cf-base;@layer cf-component{.inputPhone[data-label-position=inside] .input-label{top:15px;left:50px}.inputPhone .react-international-phone-country-selector{position:relative}.inputPhone .react-international-phone-flag-emoji{width:var(--react-international-phone-flag-width,24px);height:var(--react-international-phone-flag-height,24px);box-sizing:border-box}.inputPhone .react-international-phone-country-selector-button{height:var(--react-international-phone-height,36px);box-sizing:border-box;border:1px solid var(--react-international-phone-country-selector-border-color,var(--react-international-phone-border-color,gainsboro));appearance:button;background-color:var(--react-international-phone-country-selector-background-color,var(--react-international-phone-background-color,white));cursor:pointer;text-transform:none;-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;margin:0;padding:0;display:flex}.inputPhone .react-international-phone-country-selector-button:hover{background-color:unset}.inputPhone .react-international-phone-country-selector-button--hide-dropdown{cursor:auto}.inputPhone .react-international-phone-country-selector-button--hide-dropdown:hover{background-color:#0000}.inputPhone .react-international-phone-country-selector-button--disabled{background-color:var(--react-international-phone-disabled-country-selector-background-color,var(--react-international-phone-disabled-background-color,whitesmoke));cursor:auto}.inputPhone .react-international-phone-country-selector-button--disabled:hover{background-color:var(--react-international-phone-disabled-country-selector-background-color,var(--react-international-phone-disabled-background-color,whitesmoke))}.inputPhone .react-international-phone-country-selector-button__button-content{justify-content:center;align-items:center;display:flex}.inputPhone .react-international-phone-country-selector-button__flag-emoji{margin:0 4px}.inputPhone .react-international-phone-country-selector-button__flag-emoji--disabled{opacity:.75}.inputPhone .react-international-phone-country-selector-button__dropdown-arrow{border-top:var(--react-international-phone-country-selector-arrow-size,4px) solid var(--react-international-phone-country-selector-arrow-color,#777);border-right:var(--react-international-phone-country-selector-arrow-size,4px) solid transparent;border-left:var(--react-international-phone-country-selector-arrow-size,4px) solid transparent;margin-right:4px;transition:all .1s ease-out}.inputPhone .react-international-phone-country-selector-button__dropdown-arrow--active{transform:rotateX(180deg)}.inputPhone .react-international-phone-country-selector-button__dropdown-arrow--disabled{border-top-color:var(--react-international-phone-disabled-country-selector-arrow-color,#999)}.inputPhone .react-international-phone-country-selector-dropdown{z-index:1000;top:var(--react-international-phone-dropdown-top,44px);left:var(--react-international-phone-dropdown-left,0);background-color:var(--react-international-phone-dropdown-item-background-color,var(--react-international-phone-background-color,white));width:300px;max-height:200px;box-shadow:var(--react-international-phone-dropdown-shadow,2px 2px 16px #00000040);color:var(--react-international-phone-dropdown-item-text-color,var(--react-international-phone-text-color,#222));flex-direction:column;margin:0;padding:4px 0;list-style:none;display:flex;position:absolute;overflow-y:scroll}.inputPhone .react-international-phone-country-selector-dropdown__preferred-list-divider{height:1px;margin:var(--react-international-phone-dropdown-preferred-list-divider-margin,0);background:var(--react-international-phone-dropdown-preferred-list-divider-color,var(--react-international-phone-border-color,gainsboro));border:none}.inputPhone .react-international-phone-country-selector-dropdown__list-item{min-height:var(--react-international-phone-dropdown-item-height,28px);box-sizing:border-box;align-items:center;padding:2px 8px;display:flex}.inputPhone .react-international-phone-country-selector-dropdown__list-item:hover{background-color:var(--react-international-phone-selected-dropdown-item-background-color,var(--react-international-phone-selected-dropdown-item-background-color,whitesmoke));cursor:pointer}.inputPhone .react-international-phone-country-selector-dropdown__list-item--selected,.inputPhone .react-international-phone-country-selector-dropdown__list-item--focused{background-color:var(--react-international-phone-selected-dropdown-item-background-color,whitesmoke);color:var(--react-international-phone-selected-dropdown-item-text-color,var(--react-international-phone-text-color,#222))}.inputPhone .react-international-phone-country-selector-dropdown__list-item--selected .react-international-phone-country-selector-dropdown__list-item-dial-code,.inputPhone .react-international-phone-country-selector-dropdown__list-item--focused .react-international-phone-country-selector-dropdown__list-item-dial-code{color:var(--react-international-phone-selected-dropdown-item-dial-code-color,var(--react-international-phone-dropdown-item-dial-code-color,gray))}.inputPhone .react-international-phone-country-selector-dropdown__list-item--focused{background-color:var(--react-international-phone-selected-dropdown-item-background-color,var(--react-international-phone-selected-dropdown-item-background-color,whitesmoke))}.inputPhone .react-international-phone-country-selector-dropdown__list-item-flag-emoji{margin-right:8px}.inputPhone .react-international-phone-country-selector-dropdown__list-item-country-name{font-size:var(--react-international-phone-dropdown-item-font-size,14px);text-overflow:ellipsis;white-space:nowrap;margin-right:8px;overflow:hidden}.inputPhone .react-international-phone-country-selector-dropdown__list-item-dial-code{color:var(--react-international-phone-dropdown-item-dial-code-color,gray);font-size:var(--react-international-phone-dropdown-item-font-size,14px)}.inputPhone .react-international-phone-dial-code-preview{border:1px solid var(--react-international-phone-dial-code-preview-border-color,var(--react-international-phone-border-color,gainsboro));background-color:var(--react-international-phone-dial-code-preview-background-color,var(--react-international-phone-background-color,white));color:var(--react-international-phone-dial-code-preview-text-color,var(--react-international-phone-text-color,#222));font-size:var(--react-international-phone-dial-code-preview-font-size,var(--react-international-phone-font-size,13px));justify-content:center;align-items:center;margin-right:-1px;padding:0 8px;display:flex}.inputPhone .react-international-phone-dial-code-preview--disabled{background-color:var(--react-international-phone-dial-code-preview-disabled-background-color,var(--react-international-phone-disabled-background-color,whitesmoke));color:var(--react-international-phone-dial-code-preview-disabled-text-color,var(--react-international-phone-disabled-text-color,#666))}.inputPhone .react-international-phone-input-container{display:flex}.inputPhone .react-international-phone-input-container .react-international-phone-country-selector-button{border-radius:var(--react-international-phone-border-radius,4px);border-top-right-radius:0;border-bottom-right-radius:0;margin-right:-1px}.inputPhone .react-international-phone-input-container .react-international-phone-input{height:var(--react-international-phone-height,36px);box-sizing:border-box;border:1px solid var(--react-international-phone-border-color,gainsboro);border-radius:var(--react-international-phone-border-radius,4px);background-color:var(--react-international-phone-background-color,white);color:var(--react-international-phone-text-color,#222);font-family:inherit;font-size:var(--react-international-phone-font-size,13px);border-top-left-radius:0;border-bottom-left-radius:0;margin:0;padding:0 8px;overflow:visible}.inputPhone .react-international-phone-input-container .react-international-phone-input:focus{outline:none}.inputPhone .react-international-phone-input-container .react-international-phone-input--disabled{background-color:var(--react-international-phone-disabled-background-color,whitesmoke);color:var(--react-international-phone-disabled-text-color,#666)}}
|
|
1
|
+
@layer cf-base;@layer cf-component{.inputPhone[data-label-position=inside] .input-label{top:15px;left:50px}.inputPhone .react-international-phone-country-selector{position:relative}.inputPhone .react-international-phone-flag-emoji{width:var(--react-international-phone-flag-width,24px);height:var(--react-international-phone-flag-height,24px);box-sizing:border-box}.inputPhone .react-international-phone-country-selector-button{height:var(--react-international-phone-height,36px);box-sizing:border-box;border:1px solid var(--react-international-phone-country-selector-border-color,var(--react-international-phone-border-color,gainsboro));appearance:button;background-color:var(--react-international-phone-country-selector-background-color,var(--react-international-phone-background-color,white));cursor:pointer;text-transform:none;-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;margin:0;padding:0;display:flex}.inputPhone .react-international-phone-country-selector-button:hover{background-color:unset}.inputPhone .react-international-phone-country-selector-button--hide-dropdown{cursor:auto}.inputPhone .react-international-phone-country-selector-button--hide-dropdown:hover{background-color:#0000}.inputPhone .react-international-phone-country-selector-button--disabled{background-color:var(--react-international-phone-disabled-country-selector-background-color,var(--react-international-phone-disabled-background-color,whitesmoke));cursor:auto}.inputPhone .react-international-phone-country-selector-button--disabled:hover{background-color:var(--react-international-phone-disabled-country-selector-background-color,var(--react-international-phone-disabled-background-color,whitesmoke))}.inputPhone .react-international-phone-country-selector-button__button-content{justify-content:center;align-items:center;display:flex}.inputPhone .react-international-phone-country-selector-button__flag-emoji{margin:0 4px}.inputPhone .react-international-phone-country-selector-button__flag-emoji--disabled{opacity:.75}.inputPhone .react-international-phone-country-selector-button__dropdown-arrow{border-top:var(--react-international-phone-country-selector-arrow-size,4px) solid var(--react-international-phone-country-selector-arrow-color,#777);border-right:var(--react-international-phone-country-selector-arrow-size,4px) solid transparent;border-left:var(--react-international-phone-country-selector-arrow-size,4px) solid transparent;margin-right:4px;transition:all .1s ease-out}.inputPhone .react-international-phone-country-selector-button__dropdown-arrow--active{transform:rotateX(180deg)}.inputPhone .react-international-phone-country-selector-button__dropdown-arrow--disabled{border-top-color:var(--react-international-phone-disabled-country-selector-arrow-color,#999)}.inputPhone .react-international-phone-country-selector-dropdown{z-index:1000;top:var(--react-international-phone-dropdown-top,44px);left:var(--react-international-phone-dropdown-left,0);background-color:var(--react-international-phone-dropdown-item-background-color,var(--react-international-phone-background-color,white));width:300px;max-height:200px;box-shadow:var(--react-international-phone-dropdown-shadow,2px 2px 16px #00000040);color:var(--react-international-phone-dropdown-item-text-color,var(--react-international-phone-text-color,#222));flex-direction:column;margin:0;padding:4px 0;list-style:none;display:flex;position:absolute;overflow-y:scroll}.inputPhone .react-international-phone-country-selector-dropdown__preferred-list-divider{height:1px;margin:var(--react-international-phone-dropdown-preferred-list-divider-margin,0);background:var(--react-international-phone-dropdown-preferred-list-divider-color,var(--react-international-phone-border-color,gainsboro));border:none}.inputPhone .react-international-phone-country-selector-dropdown__list-item{min-height:var(--react-international-phone-dropdown-item-height,28px);box-sizing:border-box;align-items:center;padding:2px 8px;display:flex}.inputPhone .react-international-phone-country-selector-dropdown__list-item:hover{background-color:var(--react-international-phone-selected-dropdown-item-background-color,var(--react-international-phone-selected-dropdown-item-background-color,whitesmoke));cursor:pointer}.inputPhone .react-international-phone-country-selector-dropdown__list-item--selected,.inputPhone .react-international-phone-country-selector-dropdown__list-item--focused{background-color:var(--react-international-phone-selected-dropdown-item-background-color,whitesmoke);color:var(--react-international-phone-selected-dropdown-item-text-color,var(--react-international-phone-text-color,#222))}.inputPhone .react-international-phone-country-selector-dropdown__list-item--selected .react-international-phone-country-selector-dropdown__list-item-dial-code,.inputPhone .react-international-phone-country-selector-dropdown__list-item--focused .react-international-phone-country-selector-dropdown__list-item-dial-code{color:var(--react-international-phone-selected-dropdown-item-dial-code-color,var(--react-international-phone-dropdown-item-dial-code-color,gray))}.inputPhone .react-international-phone-country-selector-dropdown__list-item--focused{background-color:var(--react-international-phone-selected-dropdown-item-background-color,var(--react-international-phone-selected-dropdown-item-background-color,whitesmoke))}.inputPhone .react-international-phone-country-selector-dropdown__list-item-flag-emoji{margin-right:8px}.inputPhone .react-international-phone-country-selector-dropdown__list-item-country-name{font-size:var(--react-international-phone-dropdown-item-font-size,14px);text-overflow:ellipsis;white-space:nowrap;margin-right:8px;overflow:hidden}.inputPhone .react-international-phone-country-selector-dropdown__list-item-dial-code{color:var(--react-international-phone-dropdown-item-dial-code-color,gray);font-size:var(--react-international-phone-dropdown-item-font-size,14px)}.inputPhone .react-international-phone-dial-code-preview{border:1px solid var(--react-international-phone-dial-code-preview-border-color,var(--react-international-phone-border-color,gainsboro));background-color:var(--react-international-phone-dial-code-preview-background-color,var(--react-international-phone-background-color,white));color:var(--react-international-phone-dial-code-preview-text-color,var(--react-international-phone-text-color,#222));font-size:var(--react-international-phone-dial-code-preview-font-size,var(--react-international-phone-font-size,13px));justify-content:center;align-items:center;margin-right:-1px;padding:0 8px;display:flex}.inputPhone .react-international-phone-dial-code-preview--disabled{background-color:var(--react-international-phone-dial-code-preview-disabled-background-color,var(--react-international-phone-disabled-background-color,whitesmoke));color:var(--react-international-phone-dial-code-preview-disabled-text-color,var(--react-international-phone-disabled-text-color,#666))}.inputPhone .react-international-phone-input-container{width:var(--input-width,auto);display:flex}.inputPhone .react-international-phone-input-container .react-international-phone-country-selector-button{border-radius:var(--react-international-phone-border-radius,4px);border-top-right-radius:0;border-bottom-right-radius:0;margin-right:-1px}.inputPhone .react-international-phone-input-container .react-international-phone-input{min-width:0;height:var(--react-international-phone-height,36px);box-sizing:border-box;border:1px solid var(--react-international-phone-border-color,gainsboro);border-radius:var(--react-international-phone-border-radius,4px);background-color:var(--react-international-phone-background-color,white);color:var(--react-international-phone-text-color,#222);font-family:inherit;font-size:var(--react-international-phone-font-size,13px);border-top-left-radius:0;border-bottom-left-radius:0;flex:1;margin:0;padding:0 8px;overflow:visible}.inputPhone .react-international-phone-input-container .react-international-phone-input:focus{outline:none}.inputPhone .react-international-phone-input-container .react-international-phone-input--disabled{background-color:var(--react-international-phone-disabled-background-color,whitesmoke);color:var(--react-international-phone-disabled-text-color,#666)}}
|
|
@@ -6,25 +6,26 @@ import r from "clsx";
|
|
|
6
6
|
import { jsx as i } from "react/jsx-runtime";
|
|
7
7
|
import { PhoneInput as a } from "react-international-phone";
|
|
8
8
|
//#region src/components/InputPhone/InputPhone.tsx
|
|
9
|
-
var o = ({ label: o, id: s, labelPosition: c = "top", required: l = !1, defaultCountry: u = "us", error: d, style: f, className: p, inputStyle: m,
|
|
10
|
-
let
|
|
9
|
+
var o = ({ label: o, id: s, labelPosition: c = "top", required: l = !1, defaultCountry: u = "us", error: d, style: f, className: p, inputStyle: m, width: h, ...g }) => {
|
|
10
|
+
let _ = n(), v = s || _, y = t.useRef(null);
|
|
11
11
|
return /* @__PURE__ */ i(e, {
|
|
12
|
-
id:
|
|
12
|
+
id: v,
|
|
13
13
|
className: r("inputPhone", p),
|
|
14
14
|
label: o,
|
|
15
15
|
labelPosition: c,
|
|
16
16
|
error: d,
|
|
17
17
|
required: l,
|
|
18
18
|
style: f,
|
|
19
|
+
width: h,
|
|
19
20
|
onLabelClick: (e) => {
|
|
20
|
-
let t =
|
|
21
|
+
let t = y.current, n = e.target;
|
|
21
22
|
!t || n === t || n.closest("button") || (e.preventDefault(), t.focus());
|
|
22
23
|
},
|
|
23
24
|
children: /* @__PURE__ */ i(a, {
|
|
24
25
|
defaultCountry: u,
|
|
25
26
|
inputStyle: m,
|
|
26
|
-
...
|
|
27
|
-
ref:
|
|
27
|
+
...g,
|
|
28
|
+
ref: y
|
|
28
29
|
})
|
|
29
30
|
});
|
|
30
31
|
};
|
|
@@ -229,6 +229,7 @@
|
|
|
229
229
|
|
|
230
230
|
.react-international-phone-input-container {
|
|
231
231
|
display: flex;
|
|
232
|
+
width: var(--input-width, auto);
|
|
232
233
|
|
|
233
234
|
.react-international-phone-country-selector-button {
|
|
234
235
|
border-radius: var(--react-international-phone-border-radius, 4px);
|
|
@@ -239,6 +240,8 @@
|
|
|
239
240
|
|
|
240
241
|
.react-international-phone-input {
|
|
241
242
|
overflow: visible;
|
|
243
|
+
flex: 1 1 0%;
|
|
244
|
+
min-width: 0;
|
|
242
245
|
height: var(--react-international-phone-height, 36px);
|
|
243
246
|
box-sizing: border-box;
|
|
244
247
|
padding: 0 8px;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Popover — Agent Usage Notes
|
|
2
|
+
|
|
3
|
+
Import:
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { Popover } from "@stamcat/craftsman/Popover";
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Popover vs Tooltip — pick the right one:
|
|
10
|
+
|
|
11
|
+
- Use **Tooltip** for short hint text that appears on hover and needs no interaction.
|
|
12
|
+
- Use **Popover** for richer, interactive floating content (forms, menus, multi-line explanations) that the user opens deliberately. It defaults to click-to-open (not hover), supports controlled open state, and dismisses on outside click or `Escape`.
|
|
13
|
+
|
|
14
|
+
Props:
|
|
15
|
+
|
|
16
|
+
- `anchor: React.ReactNode` — the element the popover is attached to.
|
|
17
|
+
- `content: React.ReactNode` — the floating content shown.
|
|
18
|
+
- `placement?: Placement` (from `@floating-ui/react-dom`, default: `"bottom-start"`)
|
|
19
|
+
- `strategy?: Strategy` (from `@floating-ui/react-dom`, default: `"absolute"`)
|
|
20
|
+
- `trigger?: "click" | "hover"` (default: `"click"`)
|
|
21
|
+
- `open?: boolean` — pass to fully control open state (omit for uncontrolled behavior).
|
|
22
|
+
- `onOpenChange?: (open: boolean) => void` — called whenever open state would change, controlled or not.
|
|
23
|
+
- `anchorStyles?: React.CSSProperties`
|
|
24
|
+
- `contentStyles?: React.CSSProperties`
|
|
25
|
+
|
|
26
|
+
Behavior notes:
|
|
27
|
+
|
|
28
|
+
- Built on `@floating-ui/react-dom`'s `useFloating` with `autoUpdate` and `offset(12)`, `flip()`, `shift()` middleware — same positioning engine as Tooltip.
|
|
29
|
+
- Uncontrolled by default: pass no `open` prop and the component manages its own visibility state.
|
|
30
|
+
- Controlled mode: pass `open` and handle `onOpenChange` to drive visibility from parent state.
|
|
31
|
+
- Closes on outside `pointerdown` and on `Escape` key while open.
|
|
32
|
+
- Keyboard-operable: the anchor responds to `Enter`/`Space` in addition to click, and carries `aria-haspopup="dialog"`, `aria-expanded`, `aria-controls`.
|
|
33
|
+
- Floating content has `role="dialog"` with `aria-modal="false"` (non-modal — background stays interactive) and is only rendered in the DOM while open (not just hidden via CSS).
|
|
34
|
+
- Focus moves into the floating content when it opens and returns to whatever was focused beforehand when it closes.
|
|
35
|
+
- Current `placement` is exposed via `data-placement` on the floating element for style targeting.
|
|
36
|
+
|
|
37
|
+
Example (uncontrolled):
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
<Popover
|
|
41
|
+
anchor={<Button variant="default">More info</Button>}
|
|
42
|
+
content={<div>Rich, interactive content goes here.</div>}
|
|
43
|
+
placement="bottom-start"
|
|
44
|
+
/>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Example (controlled):
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
const [open, setOpen] = useState(false);
|
|
51
|
+
|
|
52
|
+
<Popover
|
|
53
|
+
anchor={<Button variant="default">Settings</Button>}
|
|
54
|
+
content={<SettingsForm onSave={() => setOpen(false)} />}
|
|
55
|
+
open={open}
|
|
56
|
+
onOpenChange={setOpen}
|
|
57
|
+
/>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Implementation caution:
|
|
61
|
+
|
|
62
|
+
- No dedicated theme entry currently in `theme.components`; style via `anchorStyles`/`contentStyles` or global selectors targeting `.popover__anchor` / `.popover__floating`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer cf-component{.popover{--popover-bg:var(--white)}.popover__floating{background-color:var(--popover-bg);color:var(--gray800);padding:calc(var(--w-gutter) * .75);z-index:1;border-radius:8px;box-shadow:0 4px 16px #00000026}}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Placement, Strategy } from '@floating-ui/react-dom';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
export type PopoverProps = {
|
|
4
|
+
anchor: React.ReactNode;
|
|
5
|
+
content: React.ReactNode;
|
|
6
|
+
placement?: Placement;
|
|
7
|
+
strategy?: Strategy;
|
|
8
|
+
trigger?: "click" | "hover";
|
|
9
|
+
open?: boolean;
|
|
10
|
+
onOpenChange?: (open: boolean) => void;
|
|
11
|
+
anchorStyles?: React.CSSProperties;
|
|
12
|
+
contentStyles?: React.CSSProperties;
|
|
13
|
+
};
|
|
14
|
+
export declare const Popover: React.FC<PopoverProps>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import './Popover.css';/* empty css */
|
|
3
|
+
import { useEffect as e, useId as t, useRef as n, useState as r } from "react";
|
|
4
|
+
import i from "clsx";
|
|
5
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
import { autoUpdate as s, flip as c, offset as l, shift as u, useFloating as d } from "@floating-ui/react-dom";
|
|
7
|
+
//#region src/components/Popover/Popover.tsx
|
|
8
|
+
var f = (f) => {
|
|
9
|
+
let { trigger: p = "click" } = f, m = t(), [h, g] = r(null), [_, v] = r(null), { floatingStyles: y, placement: b } = d({
|
|
10
|
+
placement: f.placement ?? "bottom-start",
|
|
11
|
+
strategy: f.strategy ?? "absolute",
|
|
12
|
+
whileElementsMounted: s,
|
|
13
|
+
middleware: [
|
|
14
|
+
l(12),
|
|
15
|
+
c(),
|
|
16
|
+
u()
|
|
17
|
+
],
|
|
18
|
+
elements: {
|
|
19
|
+
reference: h,
|
|
20
|
+
floating: _
|
|
21
|
+
}
|
|
22
|
+
}), [x, S] = r(!1), C = f.open !== void 0, w = C ? f.open : x, T = n(null), E = (e) => {
|
|
23
|
+
C || S(e), f.onOpenChange?.(e);
|
|
24
|
+
};
|
|
25
|
+
return e(() => {
|
|
26
|
+
if (!w) return;
|
|
27
|
+
let e = (e) => {
|
|
28
|
+
h?.contains(e.target) || _?.contains(e.target) || E(!1);
|
|
29
|
+
}, t = (e) => {
|
|
30
|
+
e.key === "Escape" && E(!1);
|
|
31
|
+
};
|
|
32
|
+
return document.addEventListener("pointerdown", e), document.addEventListener("keydown", t), () => {
|
|
33
|
+
document.removeEventListener("pointerdown", e), document.removeEventListener("keydown", t);
|
|
34
|
+
};
|
|
35
|
+
}, [
|
|
36
|
+
w,
|
|
37
|
+
h,
|
|
38
|
+
_
|
|
39
|
+
]), e(() => {
|
|
40
|
+
w ? (T.current = document.activeElement, _?.focus()) : T.current?.focus();
|
|
41
|
+
}, [w, _]), /* @__PURE__ */ o("div", {
|
|
42
|
+
className: i("popover"),
|
|
43
|
+
children: [/* @__PURE__ */ a("div", {
|
|
44
|
+
className: i("popover__anchor"),
|
|
45
|
+
ref: g,
|
|
46
|
+
onMouseEnter: () => {
|
|
47
|
+
p === "hover" && E(!0);
|
|
48
|
+
},
|
|
49
|
+
onMouseLeave: () => {
|
|
50
|
+
p === "hover" && E(!1);
|
|
51
|
+
},
|
|
52
|
+
onClick: () => {
|
|
53
|
+
p === "click" && E(!w);
|
|
54
|
+
},
|
|
55
|
+
onKeyDown: (e) => {
|
|
56
|
+
p === "click" && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), E(!w));
|
|
57
|
+
},
|
|
58
|
+
"aria-haspopup": "dialog",
|
|
59
|
+
"aria-expanded": w,
|
|
60
|
+
"aria-controls": w ? m : void 0,
|
|
61
|
+
style: f.anchorStyles,
|
|
62
|
+
children: f.anchor
|
|
63
|
+
}), w && /* @__PURE__ */ a("div", {
|
|
64
|
+
id: m,
|
|
65
|
+
className: i("popover__floating"),
|
|
66
|
+
role: "dialog",
|
|
67
|
+
"aria-modal": "false",
|
|
68
|
+
tabIndex: -1,
|
|
69
|
+
ref: v,
|
|
70
|
+
"data-placement": b,
|
|
71
|
+
style: {
|
|
72
|
+
...y,
|
|
73
|
+
...f.contentStyles
|
|
74
|
+
},
|
|
75
|
+
children: f.content
|
|
76
|
+
})]
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
//#endregion
|
|
80
|
+
export { f as Popover };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@use "../../styles/utilities/_functions" as u;
|
|
2
|
+
|
|
3
|
+
@layer cf-component {
|
|
4
|
+
.popover {
|
|
5
|
+
--popover-bg: #{u.color("white")};
|
|
6
|
+
|
|
7
|
+
&__floating {
|
|
8
|
+
background-color: var(--popover-bg);
|
|
9
|
+
color: #{u.color("gray800")};
|
|
10
|
+
padding: #{u.width("gutter", 0.75)};
|
|
11
|
+
border-radius: 8px;
|
|
12
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
|
|
13
|
+
z-index: 1;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -15,6 +15,7 @@ Props:
|
|
|
15
15
|
- `required?: boolean`
|
|
16
16
|
- `style?: React.CSSProperties` — targets the wrapper element.
|
|
17
17
|
- `inputStyle?: React.CSSProperties` — targets the `<select>` field directly.
|
|
18
|
+
- `width?: string` — sets the field's width, accepts any CSS length e.g. `"50%"` or `"320px"`. Sets it via the `--input-width` CSS variable; omit for the default intrinsic/auto width.
|
|
18
19
|
- `options?: Array<{ label: string; value: string }>`
|
|
19
20
|
|
|
20
21
|
Behavior notes:
|
|
@@ -5,8 +5,8 @@ import { useId as n } from "react";
|
|
|
5
5
|
import r from "clsx";
|
|
6
6
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/Select/Select.tsx
|
|
8
|
-
var o = ({ label: o, id: s, labelPosition: c = "top", required: l = !1, error: u, options: d = [], className: f, style: p, inputStyle: m, preAdornment: h,
|
|
9
|
-
let
|
|
8
|
+
var o = ({ label: o, id: s, labelPosition: c = "top", required: l = !1, error: u, options: d = [], className: f, style: p, inputStyle: m, preAdornment: h, width: g, ..._ }) => {
|
|
9
|
+
let v = n(), y = s || v;
|
|
10
10
|
return /* @__PURE__ */ i(t, {
|
|
11
11
|
label: o,
|
|
12
12
|
labelPosition: c,
|
|
@@ -14,6 +14,7 @@ var o = ({ label: o, id: s, labelPosition: c = "top", required: l = !1, error: u
|
|
|
14
14
|
required: l,
|
|
15
15
|
className: r("select", f),
|
|
16
16
|
style: p,
|
|
17
|
+
width: g,
|
|
17
18
|
children: /* @__PURE__ */ a("span", {
|
|
18
19
|
className: "input-field",
|
|
19
20
|
"data-has-pre-adornment": !e(h),
|
|
@@ -21,14 +22,14 @@ var o = ({ label: o, id: s, labelPosition: c = "top", required: l = !1, error: u
|
|
|
21
22
|
className: "input-pre-adornment",
|
|
22
23
|
children: h
|
|
23
24
|
}), /* @__PURE__ */ i("select", {
|
|
24
|
-
id:
|
|
25
|
+
id: y,
|
|
25
26
|
className: "input",
|
|
26
27
|
style: m,
|
|
27
|
-
...
|
|
28
|
+
..._,
|
|
28
29
|
children: d.map((e, t) => /* @__PURE__ */ i("option", {
|
|
29
30
|
value: e.value,
|
|
30
31
|
children: e.label
|
|
31
|
-
}, `${
|
|
32
|
+
}, `${y}-opt-${t}`))
|
|
32
33
|
})]
|
|
33
34
|
})
|
|
34
35
|
});
|
|
@@ -15,6 +15,10 @@ Props:
|
|
|
15
15
|
- `required?: boolean`
|
|
16
16
|
- `style?: React.CSSProperties` — targets the wrapper element.
|
|
17
17
|
- `inputStyle?: React.CSSProperties` — targets the `<textarea>` field directly.
|
|
18
|
+
- `inputClassName?: string` — adds a className to the `<textarea>` field directly (alongside the base `"input"` class).
|
|
19
|
+
- `labelStyle?: React.CSSProperties` — targets the wrapping `<label>` element.
|
|
20
|
+
- `labelClassName?: string` — adds a className to the wrapping `<label>` element.
|
|
21
|
+
- `width?: string` — sets the field's width, accepts any CSS length e.g. `"50%"` or `"320px"`. Sets it via the `--input-width` CSS variable; omit for the default intrinsic/auto width.
|
|
18
22
|
- `rows?: number`
|
|
19
23
|
|
|
20
24
|
Behavior notes:
|
|
@@ -32,3 +36,7 @@ Example:
|
|
|
32
36
|
required
|
|
33
37
|
/>
|
|
34
38
|
```
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
<Textarea label="Notes" width="100%" />
|
|
42
|
+
```
|
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { InputWrapper as e } from "../Input/InputWrapper.esm.js";
|
|
3
3
|
import { useId as t } from "react";
|
|
4
|
-
import
|
|
4
|
+
import n from "clsx";
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
6
|
//#region src/components/Textarea/Textarea.tsx
|
|
6
|
-
var
|
|
7
|
-
let
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
label:
|
|
10
|
-
className:
|
|
11
|
-
labelPosition:
|
|
12
|
-
error:
|
|
13
|
-
required:
|
|
14
|
-
style:
|
|
15
|
-
value:
|
|
16
|
-
defaultValue:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
var i = ({ labelPosition: i = "top", id: a, label: o, error: s, required: c, className: l, style: u, value: d, defaultValue: f, inputStyle: p, inputClassName: m, labelStyle: h, labelClassName: g, width: _, ...v }) => {
|
|
8
|
+
let y = t();
|
|
9
|
+
return /* @__PURE__ */ r(e, {
|
|
10
|
+
label: o,
|
|
11
|
+
className: l,
|
|
12
|
+
labelPosition: i,
|
|
13
|
+
error: s,
|
|
14
|
+
required: c,
|
|
15
|
+
style: u,
|
|
16
|
+
value: d,
|
|
17
|
+
defaultValue: f,
|
|
18
|
+
labelStyle: h,
|
|
19
|
+
labelClassName: g,
|
|
20
|
+
width: _,
|
|
21
|
+
children: /* @__PURE__ */ r("textarea", {
|
|
22
|
+
id: a || y,
|
|
23
|
+
className: n("input", m),
|
|
24
|
+
value: d,
|
|
25
|
+
defaultValue: f,
|
|
26
|
+
style: p,
|
|
27
|
+
...v
|
|
24
28
|
})
|
|
25
29
|
});
|
|
26
30
|
};
|
|
27
31
|
//#endregion
|
|
28
|
-
export {
|
|
32
|
+
export { i as Textarea };
|
|
@@ -16,6 +16,7 @@ Props:
|
|
|
16
16
|
- `locale?: Intl.LocalesArgument`
|
|
17
17
|
- `format?: 24 | 12`
|
|
18
18
|
- `labels?: { hour?: string; minute?: string }`
|
|
19
|
+
- `width?: string` — sets the field's width, accepts any CSS length e.g. `"50%"` or `"320px"`. Sets it via the `--input-width` CSS variable; omit for the default intrinsic/auto width.
|
|
19
20
|
|
|
20
21
|
Behavior notes:
|
|
21
22
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer cf-base{.react-time-picker__wrapper{color:var(--text);border:1px solid var(--gray400);padding:calc(var(--w-gutter) * .5);background-color:var(--white);border-radius:6px}.react-time-picker__wrapper:focus{box-shadow:none;outline:0}.react-time-picker__wrapper:hover{border-color:var(--gray500)}[type=number].react-time-picker__wrapper::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}[type=number].react-time-picker__wrapper::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}[type=number].react-time-picker__wrapper{appearance:textfield}.react-time-picker__wrapper:disabled,.disabled.react-time-picker__wrapper{border-color:var(--gray400);background-color:var(--gray100)}}.react-time-picker,.react-time-picker *,.react-time-picker :before,.react-time-picker :after{box-sizing:border-box}@layer cf-component{.react-time-picker{display:inline-flex;position:relative}.react-time-picker--disabled{color:#6d6d6d;background-color:#f0f0f0}.react-time-picker__wrapper{flex-grow:1;flex-shrink:0;padding:6px 8px;display:flex}.react-time-picker__inputGroup{box-sizing:content-box;flex-grow:1;padding:0 2px}.react-time-picker__inputGroup__divider{white-space:pre;padding:1px 0}.react-time-picker__inputGroup__divider,.react-time-picker__inputGroup__leadingZero{font:inherit;display:inline-block}.react-time-picker__inputGroup__input{text-align:center;color:currentColor;min-width:calc(2ch + 1px);height:calc(100% - 2px);font:inherit;box-sizing:content-box;appearance:textfield;background:0 0;border:0;padding:1px;position:relative}[name=year].react-time-picker__inputGroup__input{min-width:calc(4ch + 2px)}.react-time-picker__inputGroup__input:disabled{background-color:unset}.react-time-picker__inputGroup__input::-webkit-outer-spin-button{appearance:none;margin:0}.react-time-picker__inputGroup__input::-webkit-inner-spin-button{appearance:none;margin:0}.react-time-picker__inputGroup__input--hasLeadingZero{margin-left:-.54em;padding-left:calc(1px + .54em)}.react-time-picker__button{border:0;padding:4px 4px 4px 7px}.react-time-picker__button:hover{background:0 0}.react-time-picker__wrapper{padding:6px 8px}.react-time-picker__inputGroup__input:invalid{background:#ff00001a}.react-time-picker__inputGroup__amPm{font:inherit;appearance:menulist}.react-time-picker__button:enabled{cursor:pointer}.react-time-picker__button:enabled:hover .react-time-picker__button__icon,.react-time-picker__button:enabled:focus .react-time-picker__button__icon{stroke:#0078d7}.react-time-picker__button:disabled .react-time-picker__button__icon{stroke:#6d6d6d}.react-time-picker__button svg{display:inherit}.react-time-picker__clock{z-index:1;background-color:#fff;border:thin solid #a0a096;width:200px;max-width:100vw;height:200px;padding:25px}.react-time-picker__clock--closed,.timePicker .react-time-picker__clock{display:none}.timePicker .timePicker__field{width:fit-content;position:relative}.timePicker .timePicker__field:has(.input-view-toggle) .react-time-picker__wrapper{padding-right:34px}.timePicker .timePicker__field .input-view-toggle{padding:4px;line-height:1;position:absolute;top:50%;right:10px;transform:translateY(-50%)}.timePicker__display{background-color:var(--white);border:1px solid var(--gray400);z-index:1;border-radius:8px;height:160px;display:inline-flex;position:relative}.timePicker__display:before,.timePicker__display:after{content:"";z-index:1;pointer-events:none;height:calc(50% - 16px);display:block;position:absolute;left:0;right:0}.timePicker__display:before{border-bottom:.5px solid rgba(var(--text-high-contrast-rgb-value), .3);background:linear-gradient(to top, rgba(var(--background-site-rgb-value), .65) 0%, rgba(var(--background-site-rgb-value), 1) 100%);top:-.5px}.timePicker__display:after{border-top:.5px solid rgba(var(--text-high-contrast-rgb-value), .3);background:linear-gradient(to bottom, rgba(var(--background-site-rgb-value), .65) 0%, rgba(var(--background-site-rgb-value), 1) 100%);bottom:-.5px}.timePicker__display .ios-picker{flex-direction:row;align-items:center;gap:6px;height:100%;padding:0 12px;font-size:16px;line-height:1;display:flex}.timePicker__display .ios-picker--disabled{pointer-events:none;opacity:.5}.timePicker__display .ios-picker__scene{touch-action:pan-x;align-items:center;min-width:30px;height:100%;display:flex;overflow:hidden}.timePicker__display .ios-picker__viewport{perspective:1000px;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-khtml-user-select:none;-webkit-tap-highlight-color:transparent;width:100%;height:32px}.timePicker__display .ios-picker__viewport--perspective-left{perspective-origin:calc(50% + 130px);transform:translate(27px)}.timePicker__display .ios-picker__viewport--perspective-right{perspective-origin:calc(50% - 130px);transform:translate(-27px)}.timePicker__display .ios-picker__viewport--perspective-center{perspective-origin:50%}.timePicker__display .ios-picker__container{width:100%;height:100%;transform-style:preserve-3d;will-change:transform}.timePicker__display .ios-picker__slide{text-align:center;backface-visibility:hidden;opacity:0;justify-content:center;align-items:center;width:100%;height:100%;display:flex}.timePicker__display .ios-picker__label{white-space:nowrap;pointer-events:none;font-weight:700}}
|
|
1
|
+
@layer cf-base{.react-time-picker__wrapper{color:var(--text);border:1px solid var(--gray400);padding:calc(var(--w-gutter) * .5);background-color:var(--white);width:var(--input-width,auto);border-radius:6px}.react-time-picker__wrapper:focus{box-shadow:none;outline:0}.react-time-picker__wrapper:hover{border-color:var(--gray500)}[type=number].react-time-picker__wrapper::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}[type=number].react-time-picker__wrapper::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}[type=number].react-time-picker__wrapper{appearance:textfield}.react-time-picker__wrapper:disabled,.disabled.react-time-picker__wrapper{border-color:var(--gray400);background-color:var(--gray100)}}.react-time-picker,.react-time-picker *,.react-time-picker :before,.react-time-picker :after{box-sizing:border-box}@layer cf-component{.react-time-picker{width:var(--input-width,auto);display:inline-flex;position:relative}.react-time-picker--disabled{color:#6d6d6d;background-color:#f0f0f0}.react-time-picker__wrapper{flex-grow:1;flex-shrink:0;width:auto;padding:6px 8px;display:flex}.react-time-picker__inputGroup{box-sizing:content-box;flex-grow:1;padding:0 2px}.react-time-picker__inputGroup__divider{white-space:pre;padding:1px 0}.react-time-picker__inputGroup__divider,.react-time-picker__inputGroup__leadingZero{font:inherit;display:inline-block}.react-time-picker__inputGroup__input{text-align:center;color:currentColor;min-width:calc(2ch + 1px);height:calc(100% - 2px);font:inherit;box-sizing:content-box;appearance:textfield;background:0 0;border:0;padding:1px;position:relative}[name=year].react-time-picker__inputGroup__input{min-width:calc(4ch + 2px)}.react-time-picker__inputGroup__input:disabled{background-color:unset}.react-time-picker__inputGroup__input::-webkit-outer-spin-button{appearance:none;margin:0}.react-time-picker__inputGroup__input::-webkit-inner-spin-button{appearance:none;margin:0}.react-time-picker__inputGroup__input--hasLeadingZero{margin-left:-.54em;padding-left:calc(1px + .54em)}.react-time-picker__button{border:0;padding:4px 4px 4px 7px}.react-time-picker__button:hover{background:0 0}.react-time-picker__wrapper{padding:6px 8px}.react-time-picker__inputGroup__input:invalid{background:#ff00001a}.react-time-picker__inputGroup__amPm{font:inherit;appearance:menulist}.react-time-picker__button:enabled{cursor:pointer}.react-time-picker__button:enabled:hover .react-time-picker__button__icon,.react-time-picker__button:enabled:focus .react-time-picker__button__icon{stroke:#0078d7}.react-time-picker__button:disabled .react-time-picker__button__icon{stroke:#6d6d6d}.react-time-picker__button svg{display:inherit}.react-time-picker__clock{z-index:1;background-color:#fff;border:thin solid #a0a096;width:200px;max-width:100vw;height:200px;padding:25px}.react-time-picker__clock--closed,.timePicker .react-time-picker__clock{display:none}.timePicker .timePicker__field{width:var(--input-width,fit-content);position:relative}.timePicker .timePicker__field .react-time-picker{width:100%}.timePicker .timePicker__field:has(.input-view-toggle) .react-time-picker__wrapper{padding-right:34px}.timePicker .timePicker__field .input-view-toggle{padding:4px;line-height:1;position:absolute;top:50%;right:10px;transform:translateY(-50%)}.timePicker__display{background-color:var(--white);border:1px solid var(--gray400);z-index:1;border-radius:8px;height:160px;display:inline-flex;position:relative}.timePicker__display:before,.timePicker__display:after{content:"";z-index:1;pointer-events:none;height:calc(50% - 16px);display:block;position:absolute;left:0;right:0}.timePicker__display:before{border-bottom:.5px solid rgba(var(--text-high-contrast-rgb-value), .3);background:linear-gradient(to top, rgba(var(--background-site-rgb-value), .65) 0%, rgba(var(--background-site-rgb-value), 1) 100%);top:-.5px}.timePicker__display:after{border-top:.5px solid rgba(var(--text-high-contrast-rgb-value), .3);background:linear-gradient(to bottom, rgba(var(--background-site-rgb-value), .65) 0%, rgba(var(--background-site-rgb-value), 1) 100%);bottom:-.5px}.timePicker__display .ios-picker{flex-direction:row;align-items:center;gap:6px;height:100%;padding:0 12px;font-size:16px;line-height:1;display:flex}.timePicker__display .ios-picker--disabled{pointer-events:none;opacity:.5}.timePicker__display .ios-picker__scene{touch-action:pan-x;align-items:center;min-width:30px;height:100%;display:flex;overflow:hidden}.timePicker__display .ios-picker__viewport{perspective:1000px;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-khtml-user-select:none;-webkit-tap-highlight-color:transparent;width:100%;height:32px}.timePicker__display .ios-picker__viewport--perspective-left{perspective-origin:calc(50% + 130px);transform:translate(27px)}.timePicker__display .ios-picker__viewport--perspective-right{perspective-origin:calc(50% - 130px);transform:translate(-27px)}.timePicker__display .ios-picker__viewport--perspective-center{perspective-origin:50%}.timePicker__display .ios-picker__container{width:100%;height:100%;transform-style:preserve-3d;will-change:transform}.timePicker__display .ios-picker__slide{text-align:center;backface-visibility:hidden;opacity:0;justify-content:center;align-items:center;width:100%;height:100%;display:flex}.timePicker__display .ios-picker__label{white-space:nowrap;pointer-events:none;font-weight:700}}
|
|
@@ -12,7 +12,7 @@ import { TimePicker as g } from "react-time-picker";
|
|
|
12
12
|
import { isMobile as _ } from "react-device-detect";
|
|
13
13
|
//#region src/components/TimePicker/TimePicker.tsx
|
|
14
14
|
var v = (v) => {
|
|
15
|
-
let { labels: y, locale: b, format: x, value: S, onChange: C, label: w, labelPosition: T, error: E, required: D, name: O, disableClock: k,
|
|
15
|
+
let { labels: y, locale: b, format: x, value: S, onChange: C, label: w, labelPosition: T, error: E, required: D, name: O, disableClock: k, width: A, ...j } = v, [M, N] = a(null), [P, F] = a(null), { floatingStyles: I } = h({
|
|
16
16
|
placement: "bottom-start",
|
|
17
17
|
strategy: "absolute",
|
|
18
18
|
whileElementsMounted: d,
|
|
@@ -22,30 +22,30 @@ var v = (v) => {
|
|
|
22
22
|
m()
|
|
23
23
|
],
|
|
24
24
|
elements: {
|
|
25
|
-
reference:
|
|
26
|
-
floating:
|
|
25
|
+
reference: M,
|
|
26
|
+
floating: P
|
|
27
27
|
}
|
|
28
|
-
}), [
|
|
28
|
+
}), [L, R] = a(!1), z = n(b);
|
|
29
29
|
return i(() => {
|
|
30
|
-
if (!
|
|
30
|
+
if (!L) return;
|
|
31
31
|
let e = (e) => {
|
|
32
|
-
|
|
32
|
+
M?.contains(e.target) || P?.contains(e.target) || R(!1);
|
|
33
33
|
};
|
|
34
34
|
return document.addEventListener("pointerdown", e), () => {
|
|
35
35
|
document.removeEventListener("pointerdown", e);
|
|
36
36
|
};
|
|
37
37
|
}, [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
L,
|
|
39
|
+
M,
|
|
40
|
+
P
|
|
41
41
|
]), /* @__PURE__ */ u("div", {
|
|
42
42
|
className: "timePicker",
|
|
43
|
-
ref:
|
|
43
|
+
ref: N,
|
|
44
44
|
onFocus: (e) => {
|
|
45
|
-
_ || e.target instanceof HTMLInputElement &&
|
|
45
|
+
_ || e.target instanceof HTMLInputElement && R(!0);
|
|
46
46
|
},
|
|
47
47
|
onKeyDown: (e) => {
|
|
48
|
-
e.key === "Enter" &&
|
|
48
|
+
e.key === "Enter" && R(!1);
|
|
49
49
|
},
|
|
50
50
|
children: [
|
|
51
51
|
O && /* @__PURE__ */ l("input", {
|
|
@@ -59,37 +59,38 @@ var v = (v) => {
|
|
|
59
59
|
labelPosition: T,
|
|
60
60
|
error: E,
|
|
61
61
|
required: D,
|
|
62
|
+
width: A,
|
|
62
63
|
children: /* @__PURE__ */ u("div", {
|
|
63
64
|
className: "timePicker__field",
|
|
64
65
|
children: [/* @__PURE__ */ l(g, {
|
|
65
66
|
value: S,
|
|
66
67
|
onChange: C,
|
|
67
|
-
locale:
|
|
68
|
+
locale: z,
|
|
68
69
|
required: D,
|
|
69
70
|
clearIcon: /* @__PURE__ */ l(c, { size: 14 }),
|
|
70
71
|
disableClock: !0,
|
|
71
|
-
...
|
|
72
|
+
...j
|
|
72
73
|
}), !_ && !k && /* @__PURE__ */ l(e, {
|
|
73
74
|
type: "button",
|
|
74
75
|
variant: "text",
|
|
75
|
-
onClick: () =>
|
|
76
|
-
"aria-label":
|
|
77
|
-
"aria-pressed":
|
|
76
|
+
onClick: () => R((e) => !e),
|
|
77
|
+
"aria-label": L ? "Hide time picker" : "Show time picker",
|
|
78
|
+
"aria-pressed": L,
|
|
78
79
|
disabled: v.disabled,
|
|
79
80
|
className: "input-view-toggle",
|
|
80
|
-
children: l(
|
|
81
|
+
children: l(L ? o : s, { size: 16 })
|
|
81
82
|
})]
|
|
82
83
|
})
|
|
83
84
|
}),
|
|
84
85
|
!_ && !k && /* @__PURE__ */ l(r, {
|
|
85
86
|
value: S,
|
|
86
87
|
onChange: (e) => C?.(e),
|
|
87
|
-
locale:
|
|
88
|
+
locale: z,
|
|
88
89
|
labels: y,
|
|
89
90
|
format: x,
|
|
90
|
-
visible:
|
|
91
|
-
floatingRef:
|
|
92
|
-
style:
|
|
91
|
+
visible: L,
|
|
92
|
+
floatingRef: F,
|
|
93
|
+
style: I
|
|
93
94
|
})
|
|
94
95
|
]
|
|
95
96
|
});
|
|
@@ -95,7 +95,12 @@
|
|
|
95
95
|
|
|
96
96
|
.timePicker__field {
|
|
97
97
|
position: relative;
|
|
98
|
-
width: fit-content;
|
|
98
|
+
width: var(--input-width, fit-content);
|
|
99
|
+
|
|
100
|
+
// .react-time-picker reads --input-width itself via %date-picker-styles; force it to fill this already-sized wrapper instead of re-resolving the variable
|
|
101
|
+
.react-time-picker {
|
|
102
|
+
width: 100%;
|
|
103
|
+
}
|
|
99
104
|
|
|
100
105
|
&:has(.input-view-toggle) {
|
|
101
106
|
.react-time-picker__wrapper {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InputProps } from '../Input/Input';
|
|
2
|
-
export type ToggleProps = Omit<InputProps, "type" | "preAdornment" | "endAdornment"> & {
|
|
2
|
+
export type ToggleProps = Omit<InputProps, "type" | "preAdornment" | "endAdornment" | "width"> & {
|
|
3
3
|
width?: number;
|
|
4
4
|
};
|
|
5
5
|
export declare const Toggle: React.FC<ToggleProps>;
|
|
@@ -19,6 +19,7 @@ export { Carousel } from './Carousel/Carousel';
|
|
|
19
19
|
export { TimePicker } from './TimePicker/TimePicker';
|
|
20
20
|
export { DateTimePicker } from './DateTimePicker/DateTimePicker';
|
|
21
21
|
export { Tooltip } from './Tooltip/Tooltip';
|
|
22
|
+
export { Popover } from './Popover/Popover';
|
|
22
23
|
export { Notice } from './Notice/Notice';
|
|
23
24
|
export { SortableList } from './SortableList/SortableList';
|
|
24
25
|
export * from './Icons';
|
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
@layer cf-base, cf-component, cf-theme;
|
|
12
12
|
|
|
13
13
|
@layer cf-base {
|
|
14
|
+
*,
|
|
15
|
+
*::before,
|
|
16
|
+
*::after {
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
}
|
|
19
|
+
|
|
14
20
|
:root {
|
|
15
21
|
color-scheme: light dark;
|
|
16
22
|
font-synthesis: none;
|
|
@@ -36,6 +42,7 @@
|
|
|
36
42
|
::-webkit-scrollbar-thumb:hover {
|
|
37
43
|
background: #555;
|
|
38
44
|
}
|
|
45
|
+
|
|
39
46
|
body,
|
|
40
47
|
ul {
|
|
41
48
|
margin: 0;
|