@sarunyu/system-one 4.9.3 → 4.9.5
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/index.cjs +93 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +94 -65
- package/dist/index.js.map +1 -1
- package/dist/src/components/date-input.d.ts.map +1 -1
- package/dist/src/components/tag.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1668,21 +1668,22 @@ const NAV_BTN_CLASS = cn(
|
|
|
1668
1668
|
"p-0 outline-none"
|
|
1669
1669
|
);
|
|
1670
1670
|
function CustomCaption({
|
|
1671
|
-
|
|
1671
|
+
calendarMonth,
|
|
1672
1672
|
displayIndex
|
|
1673
1673
|
}) {
|
|
1674
|
-
const { goToMonth, previousMonth, nextMonth,
|
|
1674
|
+
const { goToMonth, previousMonth, nextMonth, months } = reactDayPicker.useDayPicker();
|
|
1675
1675
|
const isDrawerRange = React.useContext(DrawerRangeCtx);
|
|
1676
1676
|
const { disabledYears = [] } = React.useContext(DisabledDatesCtx);
|
|
1677
1677
|
const [view, setView] = React.useState("days");
|
|
1678
|
+
const displayMonth = calendarMonth.date;
|
|
1678
1679
|
const [pickerYear, setPickerYear] = React.useState(
|
|
1679
1680
|
displayMonth.getFullYear()
|
|
1680
1681
|
);
|
|
1681
1682
|
const [yearRangeStart, setYearRangeStart] = React.useState(
|
|
1682
1683
|
Math.floor(displayMonth.getFullYear() / 12) * 12
|
|
1683
1684
|
);
|
|
1684
|
-
const isFirst =
|
|
1685
|
-
const isLast =
|
|
1685
|
+
const isFirst = months[0].date.getTime() === displayMonth.getTime();
|
|
1686
|
+
const isLast = months[months.length - 1].date.getTime() === displayMonth.getTime();
|
|
1686
1687
|
const idx = displayIndex ?? 0;
|
|
1687
1688
|
const handlePrevYear = () => {
|
|
1688
1689
|
const d = new Date(displayMonth);
|
|
@@ -1951,77 +1952,99 @@ function CustomCaption({
|
|
|
1951
1952
|
const DAY_PICKER_CLASSES = {
|
|
1952
1953
|
months: "flex flex-col sm:flex-row sm:gap-6",
|
|
1953
1954
|
month: "space-y-2 relative",
|
|
1954
|
-
|
|
1955
|
+
month_caption: "flex justify-center pt-1 relative items-center mb-2",
|
|
1955
1956
|
caption_label: "text-[14px] leading-[20px] text-foreground",
|
|
1956
1957
|
nav: "hidden",
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
head_cell: "w-[36px] h-[32px] inline-flex items-center justify-center text-[12px] text-disabled font-normal",
|
|
1968
|
-
row: "flex w-full mt-1",
|
|
1969
|
-
cell: cn(
|
|
1958
|
+
button_previous: "absolute left-1",
|
|
1959
|
+
button_next: "absolute right-1",
|
|
1960
|
+
month_grid: "w-full border-collapse",
|
|
1961
|
+
weekdays: "flex",
|
|
1962
|
+
weekday: "w-[36px] h-[32px] inline-flex items-center justify-center text-[12px] text-disabled font-normal",
|
|
1963
|
+
week: "flex w-full mt-1",
|
|
1964
|
+
// In v9 modifier classes (range_start, range_end, etc.) are placed on the
|
|
1965
|
+
// outer `day` wrapper element. We use semantic marker class names so both
|
|
1966
|
+
// the wrapper and button can reference them.
|
|
1967
|
+
day: cn(
|
|
1970
1968
|
"h-[36px] w-[36px] text-center p-0 relative overflow-hidden",
|
|
1971
|
-
|
|
1972
|
-
"[
|
|
1973
|
-
"[
|
|
1974
|
-
"[
|
|
1975
|
-
"[
|
|
1976
|
-
"[
|
|
1977
|
-
"[&:
|
|
1978
|
-
"[&:
|
|
1979
|
-
"[&:
|
|
1969
|
+
// Range band background on the wrapper
|
|
1970
|
+
"[&.is-range-middle]:bg-range-bg",
|
|
1971
|
+
"[&.is-range-start]:bg-range-bg",
|
|
1972
|
+
"[&.is-range-end]:bg-range-bg",
|
|
1973
|
+
"[&.is-range-start]:rounded-l-[6px]",
|
|
1974
|
+
"[&.is-range-end]:rounded-r-[6px]",
|
|
1975
|
+
"[&:first-child.is-range-middle]:rounded-l-[6px]",
|
|
1976
|
+
"[&:last-child.is-range-middle]:rounded-r-[6px]",
|
|
1977
|
+
"[&:first-child.is-range-end]:rounded-l-[6px]",
|
|
1978
|
+
"[&:last-child.is-range-start]:rounded-r-[6px]",
|
|
1980
1979
|
"focus-within:relative focus-within:z-20"
|
|
1981
1980
|
),
|
|
1982
|
-
|
|
1981
|
+
day_button: cn(
|
|
1983
1982
|
"h-[36px] w-[36px] inline-flex items-center justify-center",
|
|
1984
1983
|
"text-[14px] text-foreground rounded-[6px]",
|
|
1985
1984
|
"border-0 bg-transparent cursor-pointer",
|
|
1986
1985
|
"hover:bg-disabled-bg transition-colors duration-100",
|
|
1987
|
-
"outline-none
|
|
1986
|
+
"outline-none p-0",
|
|
1987
|
+
// Selected (single mode)
|
|
1988
|
+
"[.is-selected_&]:!bg-primary-action [.is-selected_&]:!text-on-primary-action [.is-selected_&]:!rounded-[6px]",
|
|
1989
|
+
// Range start button styling
|
|
1990
|
+
"[.is-range-start_&]:!bg-primary-action [.is-range-start_&]:!text-on-primary-action [.is-range-start_&]:!rounded-l-[6px] [.is-range-start_&]:!rounded-r-none",
|
|
1991
|
+
// Range end button styling
|
|
1992
|
+
"[.is-range-end_&]:!bg-primary-action [.is-range-end_&]:!text-on-primary-action [.is-range-end_&]:!rounded-r-[6px] [.is-range-end_&]:!rounded-l-none",
|
|
1993
|
+
// Range middle button styling
|
|
1994
|
+
"[.is-range-middle_&]:!bg-range-bg [.is-range-middle_&]:!text-range-text [.is-range-middle_&]:!rounded-none",
|
|
1995
|
+
// Today (when not selected)
|
|
1996
|
+
"[.is-today:not(.is-selected):not(.is-range-start):not(.is-range-end)_&]:!bg-primary-action-light [.is-today:not(.is-selected):not(.is-range-start):not(.is-range-end)_&]:!text-foreground",
|
|
1997
|
+
// Outside days
|
|
1998
|
+
"[.is-outside_&]:text-disabled [.is-outside_&]:opacity-50",
|
|
1999
|
+
"[.is-outside.is-selected_&]:!bg-transparent [.is-outside.is-selected_&]:!opacity-30",
|
|
2000
|
+
// Disabled days
|
|
2001
|
+
"[.is-disabled_&]:text-disabled [.is-disabled_&]:opacity-50 [.is-disabled_&]:cursor-not-allowed"
|
|
1988
2002
|
),
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
2003
|
+
// Modifier classes applied to the `day` wrapper in v9
|
|
2004
|
+
selected: "is-selected",
|
|
2005
|
+
range_start: "is-range-start",
|
|
2006
|
+
range_end: "is-range-end",
|
|
2007
|
+
range_middle: "is-range-middle",
|
|
2008
|
+
today: "is-today",
|
|
2009
|
+
outside: "is-outside",
|
|
2010
|
+
disabled: "is-disabled",
|
|
2011
|
+
hidden: "invisible"
|
|
1997
2012
|
};
|
|
1998
2013
|
const DRAWER_DAY_PICKER_CLASSES = {
|
|
1999
2014
|
...DAY_PICKER_CLASSES,
|
|
2000
2015
|
months: "flex flex-col gap-6 w-full",
|
|
2001
2016
|
month: "space-y-2 relative w-full",
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2017
|
+
month_grid: "w-full border-collapse table-fixed",
|
|
2018
|
+
weekdays: "flex w-full",
|
|
2019
|
+
weekday: "flex-1 h-[40px] inline-flex items-center justify-center text-[13px] text-disabled font-normal",
|
|
2020
|
+
week: "flex w-full mt-1",
|
|
2021
|
+
day: cn(
|
|
2007
2022
|
"h-[44px] flex-1 text-center p-0 relative overflow-hidden",
|
|
2008
|
-
"[
|
|
2009
|
-
"[
|
|
2010
|
-
"[
|
|
2011
|
-
"[
|
|
2012
|
-
"[
|
|
2013
|
-
"[&:first-child
|
|
2014
|
-
"[&:last-child
|
|
2015
|
-
"[&:first-child
|
|
2016
|
-
"[&:last-child
|
|
2023
|
+
"[&.is-range-middle]:bg-range-bg",
|
|
2024
|
+
"[&.is-range-start]:bg-range-bg",
|
|
2025
|
+
"[&.is-range-end]:bg-range-bg",
|
|
2026
|
+
"[&.is-range-start]:rounded-l-[8px]",
|
|
2027
|
+
"[&.is-range-end]:rounded-r-[8px]",
|
|
2028
|
+
"[&:first-child.is-range-middle]:rounded-l-[8px]",
|
|
2029
|
+
"[&:last-child.is-range-middle]:rounded-r-[8px]",
|
|
2030
|
+
"[&:first-child.is-range-end]:rounded-l-[8px]",
|
|
2031
|
+
"[&:last-child.is-range-start]:rounded-r-[8px]",
|
|
2017
2032
|
"focus-within:relative focus-within:z-20"
|
|
2018
2033
|
),
|
|
2019
|
-
|
|
2034
|
+
day_button: cn(
|
|
2020
2035
|
"h-[44px] w-full inline-flex items-center justify-center",
|
|
2021
2036
|
"text-[16px] text-foreground rounded-[8px]",
|
|
2022
2037
|
"border-0 bg-transparent cursor-pointer",
|
|
2023
2038
|
"hover:bg-disabled-bg transition-colors duration-100",
|
|
2024
|
-
"outline-none
|
|
2039
|
+
"outline-none p-0",
|
|
2040
|
+
"[.is-selected_&]:!bg-primary-action [.is-selected_&]:!text-on-primary-action [.is-selected_&]:!rounded-[8px]",
|
|
2041
|
+
"[.is-range-start_&]:!bg-primary-action [.is-range-start_&]:!text-on-primary-action [.is-range-start_&]:!rounded-l-[8px] [.is-range-start_&]:!rounded-r-none",
|
|
2042
|
+
"[.is-range-end_&]:!bg-primary-action [.is-range-end_&]:!text-on-primary-action [.is-range-end_&]:!rounded-r-[8px] [.is-range-end_&]:!rounded-l-none",
|
|
2043
|
+
"[.is-range-middle_&]:!bg-range-bg [.is-range-middle_&]:!text-range-text [.is-range-middle_&]:!rounded-none",
|
|
2044
|
+
"[.is-today:not(.is-selected):not(.is-range-start):not(.is-range-end)_&]:!bg-primary-action-light [.is-today:not(.is-selected):not(.is-range-start):not(.is-range-end)_&]:!text-foreground",
|
|
2045
|
+
"[.is-outside_&]:text-disabled [.is-outside_&]:opacity-50",
|
|
2046
|
+
"[.is-outside.is-selected_&]:!bg-transparent [.is-outside.is-selected_&]:!opacity-30",
|
|
2047
|
+
"[.is-disabled_&]:text-disabled [.is-disabled_&]:opacity-50 [.is-disabled_&]:cursor-not-allowed"
|
|
2025
2048
|
)
|
|
2026
2049
|
};
|
|
2027
2050
|
const DATE_ITEM_H = 40;
|
|
@@ -2489,7 +2512,7 @@ const DateInput = React.forwardRef(
|
|
|
2489
2512
|
formatters: {
|
|
2490
2513
|
formatWeekdayName: (date) => THAI_WEEKDAYS[date.getDay()]
|
|
2491
2514
|
},
|
|
2492
|
-
components: {
|
|
2515
|
+
components: { MonthCaption: CustomCaption }
|
|
2493
2516
|
}
|
|
2494
2517
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2495
2518
|
reactDayPicker.DayPicker,
|
|
@@ -2503,7 +2526,7 @@ const DateInput = React.forwardRef(
|
|
|
2503
2526
|
formatters: {
|
|
2504
2527
|
formatWeekdayName: (date) => THAI_WEEKDAYS[date.getDay()]
|
|
2505
2528
|
},
|
|
2506
|
-
components: {
|
|
2529
|
+
components: { MonthCaption: CustomCaption }
|
|
2507
2530
|
}
|
|
2508
2531
|
);
|
|
2509
2532
|
const calendarContent = /* @__PURE__ */ jsxRuntime.jsx(DisabledDatesCtx.Provider, { value: { disabledYears }, children: pickerInner });
|
|
@@ -4615,37 +4638,43 @@ const sizeStyles = {
|
|
|
4615
4638
|
const variantStyles = {
|
|
4616
4639
|
blue: {
|
|
4617
4640
|
bg: "bg-[var(--fill-blue-50)]",
|
|
4618
|
-
text: "text-[var(--fill-blue-700)]"
|
|
4641
|
+
text: "text-[var(--fill-blue-700)]",
|
|
4642
|
+
color: "var(--fill-blue-700)"
|
|
4619
4643
|
},
|
|
4620
4644
|
green: {
|
|
4621
4645
|
bg: "bg-[var(--fill-green-100)]",
|
|
4622
|
-
text: "text-[var(--fill-green-600)]"
|
|
4646
|
+
text: "text-[var(--fill-green-600)]",
|
|
4647
|
+
color: "var(--fill-green-600)"
|
|
4623
4648
|
},
|
|
4624
4649
|
yellow: {
|
|
4625
4650
|
bg: "bg-[var(--fill-yellow-100)]",
|
|
4626
|
-
text: "text-[var(--fill-yellow-600)]"
|
|
4651
|
+
text: "text-[var(--fill-yellow-600)]",
|
|
4652
|
+
color: "var(--fill-yellow-600)"
|
|
4627
4653
|
},
|
|
4628
4654
|
red: {
|
|
4629
4655
|
bg: "bg-[var(--fill-red-100)]",
|
|
4630
|
-
text: "text-[var(--fill-red-600)]"
|
|
4656
|
+
text: "text-[var(--fill-red-600)]",
|
|
4657
|
+
color: "var(--fill-red-600)"
|
|
4631
4658
|
},
|
|
4632
4659
|
gray: {
|
|
4633
4660
|
bg: "bg-[var(--fill-gray-100)]",
|
|
4634
|
-
text: "text-subtle-text"
|
|
4661
|
+
text: "text-subtle-text",
|
|
4662
|
+
color: "var(--subtle-text)"
|
|
4635
4663
|
},
|
|
4636
4664
|
lime: {
|
|
4637
4665
|
bg: "bg-[var(--fill-lime-100)]",
|
|
4638
|
-
text: "text-[var(--fill-lime-600)]"
|
|
4666
|
+
text: "text-[var(--fill-lime-600)]",
|
|
4667
|
+
color: "var(--fill-lime-600)"
|
|
4639
4668
|
}
|
|
4640
4669
|
};
|
|
4641
|
-
function CircleIcon({ disabled }) {
|
|
4670
|
+
function CircleIcon({ disabled, color }) {
|
|
4642
4671
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4643
4672
|
react.Circle,
|
|
4644
4673
|
{
|
|
4645
4674
|
"aria-hidden": "true",
|
|
4646
4675
|
weight: "regular",
|
|
4647
4676
|
className: "h-3.5 w-3.5 shrink-0",
|
|
4648
|
-
color: disabled ? "var(--disabled)" :
|
|
4677
|
+
color: disabled ? "var(--disabled)" : color
|
|
4649
4678
|
}
|
|
4650
4679
|
);
|
|
4651
4680
|
}
|
|
@@ -4686,7 +4715,7 @@ const Tag = React.forwardRef(function Tag2({
|
|
|
4686
4715
|
className
|
|
4687
4716
|
),
|
|
4688
4717
|
children: [
|
|
4689
|
-
icon && /* @__PURE__ */ jsxRuntime.jsx(CircleIcon, { disabled: isDisabled }),
|
|
4718
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx(CircleIcon, { disabled: isDisabled, color: v.color }),
|
|
4690
4719
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("whitespace-nowrap font-normal", s.text, textClass), children: text }),
|
|
4691
4720
|
close && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4692
4721
|
"span",
|