@seedgrid/fe-components 2026.7.7 → 2026.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/inputs/SgInputDate.d.ts.map +1 -1
- package/dist/inputs/SgInputDate.js +13 -1
- package/dist/sandbox.cjs +46 -40
- package/dist/validators.d.ts.map +1 -1
- package/dist/validators.js +3 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgInputDate.d.ts","sourceRoot":"","sources":["../../src/inputs/SgInputDate.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"SgInputDate.d.ts","sourceRoot":"","sources":["../../src/inputs/SgInputDate.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAKnE,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,GAAG;IAC9D,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAuBF,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CA0JlD"}
|
|
@@ -4,6 +4,7 @@ import React from "react";
|
|
|
4
4
|
import { SgInputText } from "./SgInputText";
|
|
5
5
|
import { resolveFieldError } from "../rhf";
|
|
6
6
|
import { t, useComponentsI18n } from "../i18n";
|
|
7
|
+
import { useDarkFlag } from "../gadgets/clock/themes/useDarkFlag";
|
|
7
8
|
function toDateValue(value) {
|
|
8
9
|
if (!value)
|
|
9
10
|
return undefined;
|
|
@@ -30,6 +31,7 @@ function parseDateValue(value) {
|
|
|
30
31
|
}
|
|
31
32
|
export function SgInputDate(props) {
|
|
32
33
|
const i18n = useComponentsI18n();
|
|
34
|
+
const isDark = useDarkFlag();
|
|
33
35
|
const { minDate, maxDate, inputProps, alwaysFloat, required, requiredMessage, validateOnBlur, validation, onValidation, error, ...rest } = props;
|
|
34
36
|
const showStaticLabel = true;
|
|
35
37
|
const labelText = rest.labelText ?? rest.label ?? "";
|
|
@@ -117,10 +119,20 @@ export function SgInputDate(props) {
|
|
|
117
119
|
: "border border-border focus:border-[hsl(var(--primary))] focus:ring-2 focus:ring-[hsl(var(--primary)/0.25)]";
|
|
118
120
|
return [baseClass, borderClass, elevationClass].filter(Boolean).join(" ");
|
|
119
121
|
})();
|
|
120
|
-
|
|
122
|
+
const wrapperClassName = [
|
|
123
|
+
showStaticLabel ? "relative" : "",
|
|
124
|
+
isDark ? "sg-date-dark" : "sg-date-light"
|
|
125
|
+
].filter(Boolean).join(" ");
|
|
126
|
+
return (_jsxs("div", { className: wrapperClassName, children: [_jsx("style", { children: `
|
|
121
127
|
input[type="date"]::-webkit-calendar-picker-indicator {
|
|
122
128
|
cursor: pointer;
|
|
123
129
|
}
|
|
130
|
+
.sg-date-dark input[type="date"] {
|
|
131
|
+
color-scheme: dark;
|
|
132
|
+
}
|
|
133
|
+
.sg-date-light input[type="date"] {
|
|
134
|
+
color-scheme: light;
|
|
135
|
+
}
|
|
124
136
|
` }), showStaticLabel && labelText ? (_jsx("label", { htmlFor: rest.id, className: [
|
|
125
137
|
"pointer-events-none absolute left-3 top-0 z-10 -translate-y-1/2 bg-[var(--sg-input-bg,hsl(var(--background)))] px-1 text-[11px] font-medium leading-none",
|
|
126
138
|
hasError ? "text-[hsl(var(--destructive))]" : "text-foreground/70"
|