@stamcat/craftsman 0.0.27-alpha.9 → 0.0.28
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 +21 -403
- package/Components.esm.js +62 -11
- package/README.md +63 -12
- package/Styles.esm.js +7 -7
- package/Utilities.esm.js +2 -2
- package/_virtual/_rolldown/runtime.esm.js +18 -6
- package/package.json +51 -3
- package/src/components/Button/AGENTS.md +65 -0
- package/src/components/Button/Button.d.ts +1 -1
- package/src/components/Button/Button.esm.js +11 -17
- package/src/components/Carousel/AGENTS.md +41 -0
- package/src/components/Carousel/Carousel.css +1 -0
- package/src/components/Carousel/Carousel.d.ts +11 -0
- package/src/components/Carousel/Carousel.scss +34 -0
- package/src/components/Carousel/Carousel2.esm.js +75 -0
- package/src/components/Checkbox/AGENTS.md +34 -0
- package/src/components/Checkbox/Checkbox.d.ts +8 -0
- package/src/components/Checkbox/Checkbox.esm.js +18 -0
- package/src/components/DatePicker/AGENTS.md +36 -0
- package/src/components/DatePicker/DatePicker.css +1 -0
- package/src/components/DatePicker/DatePicker.d.ts +8 -0
- package/src/components/DatePicker/DatePicker.scss +61 -0
- package/src/components/DatePicker/DatePicker2.esm.js +29 -0
- package/src/components/DatePicker/ReactCalendar.css +1 -0
- package/src/components/DatePicker/ReactCalendar.scss +158 -0
- package/src/components/DatePicker/_DatePicker.scss +73 -0
- package/src/components/DateRangePicker/AGENTS.md +38 -0
- package/src/components/DateRangePicker/DateRangePicker.css +1 -0
- package/src/components/DateRangePicker/DateRangePicker.d.ts +8 -0
- package/src/components/DateRangePicker/DateRangePicker.scss +62 -0
- package/src/components/DateRangePicker/DateRangePicker2.esm.js +29 -0
- package/src/components/DateTimePicker/AGENTS.md +41 -0
- package/src/components/DateTimePicker/DateTimePicker.css +1 -0
- package/src/components/DateTimePicker/DateTimePicker.d.ts +13 -0
- package/src/components/DateTimePicker/DateTimePicker.scss +86 -0
- package/src/components/DateTimePicker/DateTimePicker2.esm.js +82 -0
- package/src/components/Icons/IconAmazonPay.d.ts +2 -0
- package/src/components/Icons/IconAmazonPay.esm.js +76 -0
- package/src/components/Icons/IconAmex.d.ts +2 -0
- package/src/components/Icons/IconAmex.esm.js +87 -0
- package/src/components/Icons/IconApplePay.d.ts +2 -0
- package/src/components/Icons/IconApplePay.esm.js +26 -0
- package/src/components/Icons/IconDiscover.d.ts +2 -0
- package/src/components/Icons/IconDiscover.esm.js +129 -0
- package/src/components/Icons/IconGooglePay.d.ts +2 -0
- package/src/components/Icons/IconGooglePay.esm.js +64 -0
- package/src/components/Icons/IconMaestro.d.ts +2 -0
- package/src/components/Icons/IconMaestro.esm.js +38 -0
- package/src/components/Icons/IconMastercard.d.ts +2 -0
- package/src/components/Icons/IconMastercard.esm.js +27 -0
- package/src/components/Icons/IconPayPal.d.ts +2 -0
- package/src/components/Icons/IconPayPal.esm.js +52 -0
- package/src/components/Icons/IconSepa.d.ts +2 -0
- package/src/components/Icons/IconSepa.esm.js +272 -0
- package/src/components/Icons/IconShopPay.d.ts +2 -0
- package/src/components/Icons/IconShopPay.esm.js +35 -0
- package/src/components/Icons/IconSquare.d.ts +2 -0
- package/src/components/Icons/IconSquare.esm.js +11 -0
- package/src/components/Icons/IconStripe.d.ts +2 -0
- package/src/components/Icons/IconStripe.esm.js +57 -0
- package/src/components/Icons/IconUnionPay.d.ts +2 -0
- package/src/components/Icons/IconUnionPay.esm.js +28 -0
- package/src/components/Icons/IconVenmo.d.ts +2 -0
- package/src/components/Icons/IconVenmo.esm.js +21 -0
- package/src/components/Icons/IconVisa.d.ts +2 -0
- package/src/components/Icons/IconVisa.esm.js +14 -0
- package/src/components/Icons/index.d.ts +15 -0
- package/src/components/Icons/index.esm.js +16 -0
- package/src/components/Icons/types.d.ts +4 -0
- package/src/components/Input/AGENTS.md +30 -0
- package/src/components/Input/Input.css +1 -1
- package/src/components/Input/Input.scss +108 -95
- package/src/components/Input/Input2.esm.js +27 -18
- package/src/components/Input/InputWrapper.d.ts +1 -0
- package/src/components/InputNumber/AGENTS.md +37 -0
- package/src/components/InputNumber/InputNumber.css +1 -0
- package/src/components/InputNumber/InputNumber.d.ts +10 -0
- package/src/components/InputNumber/InputNumber.scss +29 -0
- package/src/components/InputNumber/InputNumber2.esm.js +36 -0
- package/src/components/InputPassword/AGENTS.md +29 -0
- package/src/components/{Input → InputPassword}/InputPassword.d.ts +1 -1
- package/src/components/InputPassword/InputPassword.esm.js +30 -0
- package/src/components/InputPhone/AGENTS.md +35 -0
- package/src/components/InputPhone/InputPhone.css +1 -0
- package/src/components/{Input → InputPhone}/InputPhone.d.ts +1 -1
- package/src/components/InputPhone/InputPhone.scss +266 -0
- package/src/components/{Input/InputPhone.esm.js → InputPhone/InputPhone2.esm.js} +4 -4
- package/src/components/Loader/AGENTS.md +31 -0
- package/src/components/Loader/Loader.esm.js +1 -1
- package/src/components/Loader/types.d.ts +1 -1
- package/src/components/Modal/AGENTS.md +47 -0
- package/src/components/Modal/Modal.css +1 -0
- package/src/components/Modal/Modal.scss +150 -0
- package/src/components/Modal/Modal2.esm.js +53 -0
- package/src/components/Notice/AGENTS.md +42 -0
- package/src/components/Notice/Notice.css +1 -0
- package/src/components/Notice/Notice.d.ts +13 -0
- package/src/components/Notice/Notice.scss +76 -0
- package/src/components/Notice/Notice2.esm.js +56 -0
- package/src/components/Pagination/AGENTS.md +38 -0
- package/src/components/Pagination/Pagination.css +1 -0
- package/src/components/Pagination/Pagination.d.ts +10 -0
- package/src/components/Pagination/Pagination.scss +22 -0
- package/src/components/Pagination/Pagination2.esm.js +64 -0
- package/src/components/RadioButton/AGENTS.md +44 -0
- package/src/components/RadioButton/RadioButton.d.ts +9 -0
- package/src/components/RadioButton/RadioButton.esm.js +18 -0
- package/src/components/Select/AGENTS.md +36 -0
- package/src/components/SortableList/AGENTS.md +45 -0
- package/src/components/SortableList/ListItem.d.ts +10 -0
- package/src/components/SortableList/ListItem.esm.js +67 -0
- package/src/components/SortableList/SortableList.css +1 -0
- package/src/components/SortableList/SortableList.d.ts +23 -0
- package/src/components/SortableList/SortableList.scss +41 -0
- package/src/components/SortableList/SortableList2.esm.js +54 -0
- package/src/components/SortableList/utilities.d.ts +7 -0
- package/src/components/SortableList/utilities.esm.js +4 -0
- package/src/components/Text/AGENTS.md +32 -0
- package/src/components/Text/Text.css +1 -1
- package/src/components/Text/Text.scss +2 -2
- package/src/components/Textarea/AGENTS.md +32 -0
- package/src/components/{Input → Textarea}/Textarea.d.ts +1 -1
- package/src/components/Textarea/Textarea.esm.js +23 -0
- package/src/components/TimePicker/AGENTS.md +42 -0
- package/src/components/TimePicker/TimePicker.css +1 -0
- package/src/components/TimePicker/TimePicker.d.ts +13 -0
- package/src/components/TimePicker/TimePicker.scss +226 -0
- package/src/components/TimePicker/TimePicker2.esm.js +98 -0
- package/src/components/TimePicker/TimePickerDisplay.d.ts +16 -0
- package/src/components/TimePicker/TimePickerDisplay.esm.js +54 -0
- package/src/components/TimePicker/TimePickerWheel.d.ts +13 -0
- package/src/components/TimePicker/TimePickerWheel.esm.js +61 -0
- package/src/components/TimePicker/constants.d.ts +7 -0
- package/src/components/TimePicker/constants.esm.js +3 -0
- package/src/components/TimePicker/utilities.d.ts +15 -0
- package/src/components/TimePicker/utilities.esm.js +20 -0
- package/src/components/Toggle/AGENTS.md +33 -0
- package/src/components/Toggle/Toggle.css +1 -0
- package/src/components/Toggle/Toggle.d.ts +5 -0
- package/src/components/Toggle/Toggle.scss +64 -0
- package/src/components/Toggle/Toggle2.esm.js +19 -0
- package/src/components/Tooltip/AGENTS.md +41 -0
- package/src/components/Tooltip/Tooltip.css +1 -0
- package/src/components/Tooltip/Tooltip.d.ts +12 -0
- package/src/components/Tooltip/Tooltip.scss +29 -0
- package/src/components/Tooltip/Tooltip2.esm.js +65 -0
- package/src/components/index.d.ts +17 -6
- package/src/styles/global/components/_button.scss +24 -21
- package/src/styles/global/components/_checkbox.scss +5 -4
- package/src/styles/global/components/_input.scss +1 -1
- package/src/styles/global/components/_radioButton.scss +5 -4
- package/src/styles/global/components/_typography.scss +6 -1
- package/src/styles/global/globalStyles.scss +9 -5
- package/src/styles/theme/components.esm.js +5 -6
- package/src/styles/utilities/_functions.scss +2 -2
- package/src/styles/utilities/_placeholders.scss +6 -0
- package/src/styles/utilities/layout.esm.js +3 -3
- package/src/utilities/types.d.ts +28 -3
- package/src/utilities/types.esm.js +11 -5
- package/src/utilities/validations.d.ts +5 -0
- package/src/utilities/validations.esm.js +19 -1
- package/src/components/Input/Checkbox.d.ts +0 -7
- package/src/components/Input/Checkbox.esm.js +0 -11
- package/src/components/Input/DatePicker.d.ts +0 -8
- package/src/components/Input/DatePicker.esm.js +0 -24
- package/src/components/Input/InputPassword.esm.js +0 -28
- package/src/components/Input/RadioButton.d.ts +0 -7
- package/src/components/Input/RadioButton.esm.js +0 -11
- package/src/components/Input/Textarea.esm.js +0 -24
- package/src/components/Modal/Modal.esm.js +0 -53
- package/src/components/Modal/Modal.module.css +0 -1
- package/src/components/Modal/Modal.module.esm.js +0 -16
- package/src/components/Modal/Modal.module.scss +0 -147
- package/src/styles/global/components/_reactCalendar.css +0 -1
- package/src/styles/global/components/_reactCalendar.scss +0 -237
- package/src/styles/global/components/_reactDatePicker.css +0 -1
- package/src/styles/global/components/_reactDatePicker.scss +0 -152
- package/src/styles/global/components/_reactPhone.css +0 -1
- package/src/styles/global/components/_reactPhone.scss +0 -265
- /package/src/components/{Progress.d.ts → Progress/Progress.d.ts} +0 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
@use "../../styles/utilities/_functions" as u;
|
|
2
|
+
@use "../../styles/utilities/_placeholders";
|
|
3
|
+
|
|
4
|
+
@layer craftsman-base {
|
|
5
|
+
.react-calendar,
|
|
6
|
+
.react-calendar *,
|
|
7
|
+
.react-calendar *:before,
|
|
8
|
+
.react-calendar *:after {
|
|
9
|
+
@extend %border-box;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.react-calendar {
|
|
13
|
+
width: 350px;
|
|
14
|
+
max-width: 100%;
|
|
15
|
+
background: white;
|
|
16
|
+
border: 1px solid #a0a096;
|
|
17
|
+
line-height: 1.125em;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.react-calendar--doubleView {
|
|
21
|
+
width: 700px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.react-calendar--doubleView .react-calendar__viewContainer {
|
|
25
|
+
display: flex;
|
|
26
|
+
margin: -0.5em;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.react-calendar--doubleView .react-calendar__viewContainer > * {
|
|
30
|
+
width: 50%;
|
|
31
|
+
margin: 0.5em;
|
|
32
|
+
}
|
|
33
|
+
.react-calendar button {
|
|
34
|
+
margin: 0;
|
|
35
|
+
border: 0;
|
|
36
|
+
outline: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.react-calendar button:enabled:hover {
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.react-calendar__navigation {
|
|
44
|
+
display: flex;
|
|
45
|
+
height: 44px;
|
|
46
|
+
margin-bottom: 1em;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.react-calendar__navigation button {
|
|
50
|
+
min-width: 44px;
|
|
51
|
+
background: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.react-calendar__navigation button:disabled {
|
|
55
|
+
background-color: #f0f0f0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.react-calendar__navigation button:enabled:hover,
|
|
59
|
+
.react-calendar__navigation button:enabled:focus {
|
|
60
|
+
background-color: #e6e6e6;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.react-calendar__month-view__weekdays {
|
|
64
|
+
text-align: center;
|
|
65
|
+
text-transform: uppercase;
|
|
66
|
+
font: inherit;
|
|
67
|
+
font-size: 0.75em;
|
|
68
|
+
font-weight: bold;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.react-calendar__month-view__weekdays__weekday {
|
|
72
|
+
padding: 0.5em;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.react-calendar__month-view__weekNumbers .react-calendar__tile {
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
justify-content: center;
|
|
79
|
+
font: inherit;
|
|
80
|
+
font-size: 0.75em;
|
|
81
|
+
font-weight: bold;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.react-calendar__month-view__days__day--weekend {
|
|
85
|
+
color: #d10000;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.react-calendar__month-view__days__day--neighboringMonth,
|
|
89
|
+
.react-calendar__decade-view__years__year--neighboringDecade,
|
|
90
|
+
.react-calendar__century-view__decades__decade--neighboringCentury {
|
|
91
|
+
color: #757575;
|
|
92
|
+
}
|
|
93
|
+
.react-calendar__tile:disabled {
|
|
94
|
+
background-color: #f0f0f0;
|
|
95
|
+
color: #ababab;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.react-calendar__month-view__days__day--neighboringMonth:disabled,
|
|
99
|
+
.react-calendar__decade-view__years__year--neighboringDecade:disabled,
|
|
100
|
+
.react-calendar__century-view__decades__decade--neighboringCentury:disabled {
|
|
101
|
+
color: #cdcdcd;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.react-calendar__tile:enabled:hover,
|
|
105
|
+
.react-calendar__tile:enabled:focus {
|
|
106
|
+
background-color: #e6e6e6;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.react-calendar__tile--now {
|
|
110
|
+
background: #ffff76;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.react-calendar__tile--now:enabled:hover,
|
|
114
|
+
.react-calendar__tile--now:enabled:focus {
|
|
115
|
+
background: #ffffa9;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.react-calendar__tile--hasActive {
|
|
119
|
+
background: #76baff;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.react-calendar__tile--hasActive:enabled:hover,
|
|
123
|
+
.react-calendar__tile--hasActive:enabled:focus {
|
|
124
|
+
background: #a9d4ff;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.react-calendar__tile--active {
|
|
128
|
+
background: #006edc;
|
|
129
|
+
color: white;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.react-calendar__tile--active:enabled:hover,
|
|
133
|
+
.react-calendar__tile--active:enabled:focus {
|
|
134
|
+
background: #1087ff;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.react-calendar--selectRange .react-calendar__tile--hover {
|
|
138
|
+
background-color: #e6e6e6;
|
|
139
|
+
}
|
|
140
|
+
.react-calendar {
|
|
141
|
+
border-color: #{u.color("gray400")};
|
|
142
|
+
}
|
|
143
|
+
.react-calendar button {
|
|
144
|
+
justify-content: center;
|
|
145
|
+
}
|
|
146
|
+
.react-calendar {
|
|
147
|
+
button {
|
|
148
|
+
border-radius: unset;
|
|
149
|
+
padding: 12px 0px;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
.react-calendar__year-view, .react-calendar__decade-view, .react-calendar__century-view {
|
|
153
|
+
button {
|
|
154
|
+
padding: 18px 0px;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
@use "../../styles/global/components/input";
|
|
2
|
+
@use "../../styles/utilities/_functions" as u;
|
|
3
|
+
@use "../../styles/utilities/_placeholders";
|
|
4
|
+
|
|
5
|
+
@layer craftsman-component {
|
|
6
|
+
%date-picker-styles {
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
position: relative;
|
|
9
|
+
}
|
|
10
|
+
%date-picker-disabled {
|
|
11
|
+
background-color: #f0f0f0;
|
|
12
|
+
color: #6d6d6d;
|
|
13
|
+
}
|
|
14
|
+
%date-picker-wrapper {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-grow: 1;
|
|
17
|
+
flex-shrink: 0;
|
|
18
|
+
@extend %input-base;
|
|
19
|
+
padding: 6px 8px;
|
|
20
|
+
}
|
|
21
|
+
%date-picker-input-group {
|
|
22
|
+
// min-width: calc((4px * 3) + 0.54em * 8 + 0.217em * 2);
|
|
23
|
+
flex-grow: 1;
|
|
24
|
+
padding: 0 2px;
|
|
25
|
+
box-sizing: content-box;
|
|
26
|
+
}
|
|
27
|
+
%date-picker-divider {
|
|
28
|
+
padding: 1px 0;
|
|
29
|
+
white-space: pre;
|
|
30
|
+
}
|
|
31
|
+
%date-picker-leading-zero-divider {
|
|
32
|
+
display: inline-block;
|
|
33
|
+
font: inherit;
|
|
34
|
+
}
|
|
35
|
+
%date-picker-group-input {
|
|
36
|
+
min-width: calc(2ch + 1px);
|
|
37
|
+
text-align: center;
|
|
38
|
+
height: calc(100% - 2px);
|
|
39
|
+
position: relative;
|
|
40
|
+
padding: 1px;
|
|
41
|
+
border: 0;
|
|
42
|
+
background: none;
|
|
43
|
+
color: currentColor;
|
|
44
|
+
font: inherit;
|
|
45
|
+
box-sizing: content-box;
|
|
46
|
+
-webkit-appearance: textfield;
|
|
47
|
+
-moz-appearance: textfield;
|
|
48
|
+
appearance: textfield;
|
|
49
|
+
&[name="year"] {
|
|
50
|
+
min-width: calc(4ch + 2px);
|
|
51
|
+
}
|
|
52
|
+
&:disabled {
|
|
53
|
+
background-color: unset;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
%date-picker-input-spinner {
|
|
57
|
+
-webkit-appearance: none;
|
|
58
|
+
-moz-appearance: none;
|
|
59
|
+
appearance: none;
|
|
60
|
+
margin: 0;
|
|
61
|
+
}
|
|
62
|
+
%date-picker-input-leading-zero {
|
|
63
|
+
margin-left: -0.54em;
|
|
64
|
+
padding-left: calc(1px + 0.54em);
|
|
65
|
+
}
|
|
66
|
+
%date-picker-button {
|
|
67
|
+
border: 0;
|
|
68
|
+
padding: 4px 4px 4px 7px;
|
|
69
|
+
&:hover {
|
|
70
|
+
background: transparent;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# DateRangePicker — Agent Usage Notes
|
|
2
|
+
|
|
3
|
+
Import:
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { DateRangePicker } from "@stamcat/craftsman/DateRangePicker";
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Props:
|
|
10
|
+
|
|
11
|
+
- Extends `DateRangePickerProps` from `@wojtekmaj/react-daterange-picker`.
|
|
12
|
+
- `label?: string | ReactNode`
|
|
13
|
+
- `labelPosition?: "top" | "left" | "bottom" | "right" | "inside" | "hidden"` (default: `"top"`)
|
|
14
|
+
- `error?: string | boolean | ReactNode`
|
|
15
|
+
- `required?: boolean`
|
|
16
|
+
- `id?: string`
|
|
17
|
+
- `style?: React.CSSProperties`
|
|
18
|
+
- `value?` / `onChange?` — from the underlying library; `value` is typically a `[Date, Date] | null` tuple.
|
|
19
|
+
|
|
20
|
+
Behavior notes:
|
|
21
|
+
|
|
22
|
+
- This component directly wraps `react-daterange-picker`; consult that library's docs for range-selection edge cases.
|
|
23
|
+
- `calendarIcon` and `clearIcon` default to `FaRegCalendar` / `FaX` but can be overridden since consumer props are spread after the defaults.
|
|
24
|
+
- Controlled component — parent owns `value` and `onChange`.
|
|
25
|
+
- Calendar flyout renders below the input; ensure the container has enough vertical space.
|
|
26
|
+
|
|
27
|
+
Example:
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
const [range, setRange] = useState<[Date, Date] | null>(null);
|
|
31
|
+
|
|
32
|
+
<DateRangePicker
|
|
33
|
+
label="Stay Dates"
|
|
34
|
+
value={range}
|
|
35
|
+
onChange={setRange}
|
|
36
|
+
required
|
|
37
|
+
/>
|
|
38
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer craftsman-base{.react-daterange-picker__wrapper:focus{box-shadow:none;outline:0}.react-daterange-picker__wrapper{color:var(--text);border:1px solid var(--gray400);padding:calc(var(--w-gutter) * .5);background-color:var(--white);border-radius:6px}[type=number].react-daterange-picker__wrapper::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}[type=number].react-daterange-picker__wrapper::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}[type=number].react-daterange-picker__wrapper{appearance:textfield}.react-daterange-picker__wrapper:disabled,.disabled.react-daterange-picker__wrapper{border-color:var(--gray200);background-color:var(--gray100)}}.react-daterange-picker,.react-daterange-picker *,.react-daterange-picker :before,.react-daterange-picker :after{box-sizing:border-box}@layer craftsman-component{.react-daterange-picker{display:inline-flex;position:relative}.react-daterange-picker--disabled{color:#6d6d6d;background-color:#f0f0f0}.react-daterange-picker__wrapper{flex-grow:1;flex-shrink:0;padding:6px 8px;display:flex}.react-daterange-picker__inputGroup{box-sizing:content-box;flex-grow:1;padding:0 2px}.react-daterange-picker__inputGroup__divider{white-space:pre;padding:1px 0}.react-daterange-picker__inputGroup__divider,.react-daterange-picker__inputGroup__leadingZero{font:inherit;display:inline-block}.react-daterange-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-daterange-picker__inputGroup__input{min-width:calc(4ch + 2px)}.react-daterange-picker__inputGroup__input:disabled{background-color:unset}.react-daterange-picker__inputGroup__input::-webkit-outer-spin-button{appearance:none;margin:0}.react-daterange-picker__inputGroup__input::-webkit-inner-spin-button{appearance:none;margin:0}.react-daterange-picker__inputGroup__input--hasLeadingZero{margin-left:-.54em;padding-left:calc(1px + .54em)}.react-daterange-picker__button{border:0;padding:4px 4px 4px 7px}.react-daterange-picker__button:hover{background:0 0}.react-daterange-picker__calendar{z-index:1;width:350px;max-width:100vw}.react-daterange-picker__calendar .react-calendar{border-width:thin}.react-daterange-picker__calendar--closed,.react-daterange-picker__clock--closed{display:none}.react-daterange-picker__calendar .react-daterange-picker__inputGroup__input:invalid{background:unset}}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { LabeledInput } from '../Input/InputWrapper';
|
|
3
|
+
import { DateRangePickerProps as ReactDateRangePickerProps } from '@wojtekmaj/react-daterange-picker';
|
|
4
|
+
export type DateRangePickerProps = ReactDateRangePickerProps & LabeledInput & {
|
|
5
|
+
id?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
};
|
|
8
|
+
export declare const DateRangePicker: React.FC<DateRangePickerProps>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
@use "../../styles/global/components/input";
|
|
2
|
+
@use "../../styles/utilities/_functions" as u;
|
|
3
|
+
@use "../../styles/utilities/_placeholders";
|
|
4
|
+
@use "../DatePicker/_DatePicker";
|
|
5
|
+
@layer craftsman-component {
|
|
6
|
+
.react-daterange-picker,
|
|
7
|
+
.react-daterange-picker *,
|
|
8
|
+
.react-daterange-picker *:before,
|
|
9
|
+
.react-daterange-picker *:after {
|
|
10
|
+
@extend %border-box;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.react-daterange-picker {
|
|
14
|
+
@extend %date-picker-styles;
|
|
15
|
+
&--disabled {
|
|
16
|
+
@extend %date-picker-disabled;
|
|
17
|
+
}
|
|
18
|
+
&__wrapper {
|
|
19
|
+
@extend %date-picker-wrapper;
|
|
20
|
+
}
|
|
21
|
+
&__inputGroup {
|
|
22
|
+
@extend %date-picker-input-group;
|
|
23
|
+
}
|
|
24
|
+
&__inputGroup__divider {
|
|
25
|
+
@extend %date-picker-divider;
|
|
26
|
+
}
|
|
27
|
+
&__inputGroup__divider,
|
|
28
|
+
&__inputGroup__leadingZero {
|
|
29
|
+
@extend %date-picker-leading-zero-divider;
|
|
30
|
+
}
|
|
31
|
+
&__inputGroup__input {
|
|
32
|
+
@extend %date-picker-group-input;
|
|
33
|
+
}
|
|
34
|
+
&__inputGroup__input::-webkit-outer-spin-button,
|
|
35
|
+
&__inputGroup__input::-webkit-inner-spin-button {
|
|
36
|
+
@extend %date-picker-input-spinner;
|
|
37
|
+
}
|
|
38
|
+
&__inputGroup__input--hasLeadingZero {
|
|
39
|
+
@extend %date-picker-input-leading-zero;
|
|
40
|
+
}
|
|
41
|
+
&__button {
|
|
42
|
+
@extend %date-picker-button;
|
|
43
|
+
}
|
|
44
|
+
&__calendar {
|
|
45
|
+
width: 350px;
|
|
46
|
+
max-width: 100vw;
|
|
47
|
+
z-index: 1;
|
|
48
|
+
.react-calendar {
|
|
49
|
+
border-width: thin;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
&__calendar--closed, &__clock--closed {
|
|
53
|
+
display: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
.react-daterange-picker__calendar
|
|
58
|
+
.react-daterange-picker__inputGroup__input:invalid {
|
|
59
|
+
background: unset;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { InputWrapper as e } from "../Input/InputWrapper.esm.js";
|
|
3
|
+
import './DateRangePicker.css';import '../DatePicker/ReactCalendar.css';/* empty css */
|
|
4
|
+
/* empty css */
|
|
5
|
+
import t from "../../../node_modules/@wojtekmaj/react-daterange-picker/dist/DateRangePicker.esm.js";
|
|
6
|
+
import n from "clsx";
|
|
7
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
8
|
+
import { useId as i } from "react";
|
|
9
|
+
import { FaRegCalendar as a, FaX as o } from "react-icons/fa6";
|
|
10
|
+
//#region src/components/DateRangePicker/DateRangePicker.tsx
|
|
11
|
+
var s = ({ label: s, id: c, labelPosition: l = "top", required: u = !1, error: d, style: f, className: p, ...m }) => {
|
|
12
|
+
let h = i();
|
|
13
|
+
return /* @__PURE__ */ r(e, {
|
|
14
|
+
id: c || h,
|
|
15
|
+
className: n("dateRangePicker", p),
|
|
16
|
+
label: s,
|
|
17
|
+
labelPosition: l,
|
|
18
|
+
error: d,
|
|
19
|
+
required: u,
|
|
20
|
+
style: f,
|
|
21
|
+
children: /* @__PURE__ */ r(t, {
|
|
22
|
+
calendarIcon: /* @__PURE__ */ r(a, { size: 16 }),
|
|
23
|
+
clearIcon: /* @__PURE__ */ r(o, { size: 14 }),
|
|
24
|
+
...m
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { s as DateRangePicker };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# DateTimePicker — Agent Usage Notes
|
|
2
|
+
|
|
3
|
+
> Not yet part of the documented public export surface (see `craftsman-component-usage` skill's Known Limitations). Source path only — do not assume `@stamcat/craftsman/DateTimePicker` is published until confirmed in `exports.ts`.
|
|
4
|
+
|
|
5
|
+
Import (source-relative, once exported):
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { DateTimePicker } from "@stamcat/craftsman/DateTimePicker";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Props:
|
|
12
|
+
|
|
13
|
+
- Extends `react-datetime-picker`'s `DateTimePickerProps` plus `LabeledInput` (`label`, `labelPosition`, `error`, `required`).
|
|
14
|
+
- `id?: string`
|
|
15
|
+
- `style?: React.CSSProperties`
|
|
16
|
+
- `format?: 24 | 12` — hour format used by the custom time wheel display.
|
|
17
|
+
- `labels?: { hour?: string; minute?: string }` — labels passed through to the time wheel.
|
|
18
|
+
- `value` / `onChange` — standard `Date` value and change callback.
|
|
19
|
+
|
|
20
|
+
Behavior notes:
|
|
21
|
+
|
|
22
|
+
- Directly wraps `react-datetime-picker`, but replaces its native clock UI with the custom `TimePickerDisplay` wheel (shared with `TimePicker`); `isClockOpen` is always forced `false` on the underlying component.
|
|
23
|
+
- Clicking/focusing a time sub-field opens the custom wheel only if `value` is already a valid `Date`. If no date is selected yet, focus is redirected to the date field so the calendar opens instead of the time wheel.
|
|
24
|
+
- Clicking outside the wrapper (`pointerdown`) closes the time wheel.
|
|
25
|
+
- Opening the calendar (`onCalendarOpen`) closes the time wheel so both widgets are never open simultaneously.
|
|
26
|
+
- `onChangeTime` builds the resulting `Date` from the existing `value` if present, otherwise from `new Date()` (today), then sets hours/minutes on it before calling `onChange`.
|
|
27
|
+
|
|
28
|
+
Example:
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
<DateTimePicker
|
|
32
|
+
label="Appointment"
|
|
33
|
+
value={value}
|
|
34
|
+
onChange={setValue}
|
|
35
|
+
format={12}
|
|
36
|
+
/>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Implementation caution:
|
|
40
|
+
|
|
41
|
+
- Relies on `react-datetime-picker`'s rendered sub-input `name` attributes (`day`/`month`/`year` vs `hour12`/`hour24`/`minute`/`second`/`amPm`) to distinguish date vs. time fields for the focus-redirect behavior. Upgrading `react-datetime-picker` may require re-verifying these names.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer craftsman-base{.react-datetime-picker__wrapper:focus{box-shadow:none;outline:0}.react-datetime-picker__wrapper{color:var(--text);border:1px solid var(--gray400);padding:calc(var(--w-gutter) * .5);background-color:var(--white);border-radius:6px}[type=number].react-datetime-picker__wrapper::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}[type=number].react-datetime-picker__wrapper::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}[type=number].react-datetime-picker__wrapper{appearance:textfield}.react-datetime-picker__wrapper:disabled,.disabled.react-datetime-picker__wrapper{border-color:var(--gray200);background-color:var(--gray100)}}.react-datetime-picker,.react-datetime-picker *,.react-datetime-picker :before,.react-datetime-picker :after{box-sizing:border-box}@layer craftsman-component{.react-datetime-picker{display:inline-flex;position:relative}.react-datetime-picker--disabled{color:#6d6d6d;background-color:#f0f0f0}.react-datetime-picker__wrapper{flex-grow:1;flex-shrink:0;padding:6px 8px;display:flex}.react-datetime-picker__inputGroup{box-sizing:content-box;flex-grow:1;padding:0 2px}.react-datetime-picker__inputGroup__divider{white-space:pre;padding:1px 0}.react-datetime-picker__inputGroup__divider,.react-datetime-picker__inputGroup__leadingZero{font:inherit;display:inline-block}.react-datetime-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-datetime-picker__inputGroup__input{min-width:calc(4ch + 2px)}.react-datetime-picker__inputGroup__input:disabled{background-color:unset}.react-datetime-picker__inputGroup__input::-webkit-outer-spin-button{appearance:none;margin:0}.react-datetime-picker__inputGroup__input::-webkit-inner-spin-button{appearance:none;margin:0}.react-datetime-picker__inputGroup__input--hasLeadingZero{margin-left:-.54em;padding-left:calc(1px + .54em)}.react-datetime-picker__button{border:0;padding:4px 4px 4px 7px}.react-datetime-picker__button:hover{background:0 0}.react-datetime-picker__calendar--closed,.react-datetime-picker__clock--closed{display:none}.react-datetime-picker__calendar,.react-datetime-picker__clock{z-index:1}.react-datetime-picker__inputGroup__input:invalid{background:#ff00001a}.react-datetime-picker__inputGroup__amPm{font:inherit;appearance:menulist}.react-datetime-picker__calendar{width:350px;max-width:100vw}.react-datetime-picker__calendar .react-calendar{border-width:thin}.react-date-picker__inputGroup__input:invalid,.react-datetime-picker__inputGroup__input:invalid{background:unset}.dateTimePicker__time-display{margin-top:8px;display:flex}.dateTimePicker__wrapper{display:inline-block}}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { LabeledInput } from '../Input/InputWrapper';
|
|
3
|
+
import { DateTimePickerProps as ReactDateTimePickerProps } from 'react-datetime-picker';
|
|
4
|
+
export type DateTimePickerProps = ReactDateTimePickerProps & LabeledInput & {
|
|
5
|
+
id?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
format?: 24 | 12;
|
|
8
|
+
labels?: {
|
|
9
|
+
hour?: string;
|
|
10
|
+
minute?: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const DateTimePicker: React.FC<DateTimePickerProps>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
@use "../../styles/global/components/input";
|
|
2
|
+
@use "../../styles/utilities/_functions" as u;
|
|
3
|
+
@use "../../styles/utilities/_placeholders";
|
|
4
|
+
@use "../DatePicker/_DatePicker";
|
|
5
|
+
@layer craftsman-component {
|
|
6
|
+
.react-datetime-picker,
|
|
7
|
+
.react-datetime-picker *,
|
|
8
|
+
.react-datetime-picker *:before,
|
|
9
|
+
.react-datetime-picker *:after {
|
|
10
|
+
@extend %border-box;
|
|
11
|
+
}
|
|
12
|
+
.react-datetime-picker {
|
|
13
|
+
@extend %date-picker-styles;
|
|
14
|
+
&--disabled {
|
|
15
|
+
@extend %date-picker-disabled;
|
|
16
|
+
}
|
|
17
|
+
&__wrapper {
|
|
18
|
+
@extend %date-picker-wrapper;
|
|
19
|
+
}
|
|
20
|
+
&__inputGroup {
|
|
21
|
+
@extend %date-picker-input-group;
|
|
22
|
+
}
|
|
23
|
+
&__inputGroup__divider {
|
|
24
|
+
@extend %date-picker-divider;
|
|
25
|
+
}
|
|
26
|
+
&__inputGroup__divider,
|
|
27
|
+
&__inputGroup__leadingZero {
|
|
28
|
+
@extend %date-picker-leading-zero-divider;
|
|
29
|
+
}
|
|
30
|
+
&__inputGroup__input {
|
|
31
|
+
@extend %date-picker-group-input;
|
|
32
|
+
}
|
|
33
|
+
&__inputGroup__input::-webkit-outer-spin-button,
|
|
34
|
+
&__inputGroup__input::-webkit-inner-spin-button {
|
|
35
|
+
@extend %date-picker-input-spinner;
|
|
36
|
+
}
|
|
37
|
+
&__inputGroup__input--hasLeadingZero {
|
|
38
|
+
@extend %date-picker-input-leading-zero;
|
|
39
|
+
}
|
|
40
|
+
&__button {
|
|
41
|
+
@extend %date-picker-button;
|
|
42
|
+
}
|
|
43
|
+
&__calendar--closed, &__clock--closed {
|
|
44
|
+
display: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
.react-datetime-picker__calendar,
|
|
49
|
+
.react-datetime-picker__clock {
|
|
50
|
+
z-index: 1;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.react-datetime-picker__inputGroup__input:invalid {
|
|
54
|
+
background: rgba(255, 0, 0, 0.1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.react-datetime-picker__inputGroup__amPm {
|
|
58
|
+
font: inherit;
|
|
59
|
+
-webkit-appearance: menulist;
|
|
60
|
+
-moz-appearance: menulist;
|
|
61
|
+
appearance: menulist;
|
|
62
|
+
}
|
|
63
|
+
.react-datetime-picker__calendar {
|
|
64
|
+
width: 350px;
|
|
65
|
+
max-width: 100vw;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.react-datetime-picker__calendar .react-calendar {
|
|
69
|
+
border-width: thin;
|
|
70
|
+
}
|
|
71
|
+
.react-date-picker__inputGroup__input:invalid, .react-datetime-picker__inputGroup__input:invalid {
|
|
72
|
+
background: unset;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.dateTimePicker {
|
|
76
|
+
|
|
77
|
+
&__time-display {
|
|
78
|
+
margin-top: 8px;
|
|
79
|
+
display: flex;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.dateTimePicker__wrapper {
|
|
84
|
+
display: inline-block;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { formatTime as e } from "../../utilities/validations.esm.js";
|
|
3
|
+
import { InputWrapper as t } from "../Input/InputWrapper.esm.js";
|
|
4
|
+
import './DateTimePicker.css';import '../DatePicker/ReactCalendar.css';/* empty css */
|
|
5
|
+
import { resolveLocale as n } from "../TimePicker/utilities.esm.js";
|
|
6
|
+
import { TimePickerDisplay as r } from "../TimePicker/TimePickerDisplay.esm.js";
|
|
7
|
+
import { require_lib as i } from "../../../node_modules/react-device-detect/dist/lib.esm.js";
|
|
8
|
+
/* empty css */
|
|
9
|
+
import a from "clsx";
|
|
10
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
11
|
+
import { useEffect as c, useId as l, useRef as u, useState as d } from "react";
|
|
12
|
+
import { FaRegCalendar as f, FaX as p } from "react-icons/fa6";
|
|
13
|
+
import { DateTimePicker as m } from "react-datetime-picker";
|
|
14
|
+
//#region src/components/DateTimePicker/DateTimePicker.tsx
|
|
15
|
+
var h = i(), g = ({ label: i, id: g, labelPosition: _ = "top", required: v = !1, error: y, style: b, className: x, locale: S, labels: C, format: w, value: T, onChange: E, ...D }) => {
|
|
16
|
+
let O = l(), k = g || O, A = u(null), [j, M] = d(!1), N = n(S);
|
|
17
|
+
c(() => {
|
|
18
|
+
if (!j) return;
|
|
19
|
+
let e = (e) => {
|
|
20
|
+
let t = e.target;
|
|
21
|
+
A.current?.contains(t) || M(!1);
|
|
22
|
+
};
|
|
23
|
+
return document.addEventListener("pointerdown", e, !0), () => {
|
|
24
|
+
document.removeEventListener("pointerdown", e, !0);
|
|
25
|
+
};
|
|
26
|
+
}, [j]);
|
|
27
|
+
let P = () => {
|
|
28
|
+
if (!h.isMobile && T instanceof Date) {
|
|
29
|
+
M(!0);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
(A.current?.querySelector("input[name=\"day\"]"))?.focus();
|
|
33
|
+
}, F = (e) => {
|
|
34
|
+
e.target instanceof HTMLInputElement && P();
|
|
35
|
+
}, I = (e) => {
|
|
36
|
+
h.isMobile && e.key === "Enter" && M(!1);
|
|
37
|
+
}, L = (e) => {
|
|
38
|
+
let [t, n] = e.split(":"), r = Number(t), i = Number(n);
|
|
39
|
+
if (Number.isNaN(r) || Number.isNaN(i)) return;
|
|
40
|
+
let a = T instanceof Date ? new Date(T) : /* @__PURE__ */ new Date();
|
|
41
|
+
a.setHours(r, i, 0, 0), E?.(a);
|
|
42
|
+
};
|
|
43
|
+
return /* @__PURE__ */ o("div", {
|
|
44
|
+
ref: A,
|
|
45
|
+
className: "dateTimePicker",
|
|
46
|
+
onKeyDown: I,
|
|
47
|
+
children: /* @__PURE__ */ s(t, {
|
|
48
|
+
id: k,
|
|
49
|
+
onFocus: F,
|
|
50
|
+
className: a(x, "dateTimePicker_wrapper"),
|
|
51
|
+
label: i,
|
|
52
|
+
labelPosition: _,
|
|
53
|
+
error: y,
|
|
54
|
+
required: v,
|
|
55
|
+
style: b,
|
|
56
|
+
value: T instanceof Date ? T.toISOString() : void 0,
|
|
57
|
+
children: [/* @__PURE__ */ o(m, {
|
|
58
|
+
isClockOpen: !1,
|
|
59
|
+
onClockOpen: P,
|
|
60
|
+
onClockClose: () => {},
|
|
61
|
+
onCalendarOpen: () => M(!1),
|
|
62
|
+
calendarIcon: /* @__PURE__ */ o(f, { size: 16 }),
|
|
63
|
+
clearIcon: /* @__PURE__ */ o(p, { size: 14 }),
|
|
64
|
+
value: T,
|
|
65
|
+
onChange: E,
|
|
66
|
+
...D
|
|
67
|
+
}), j && /* @__PURE__ */ o("div", {
|
|
68
|
+
className: "dateTimePicker__time-display",
|
|
69
|
+
children: /* @__PURE__ */ o(r, {
|
|
70
|
+
value: e(T, S),
|
|
71
|
+
onChange: L,
|
|
72
|
+
locale: N,
|
|
73
|
+
labels: C,
|
|
74
|
+
format: w,
|
|
75
|
+
visible: j
|
|
76
|
+
})
|
|
77
|
+
})]
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
//#endregion
|
|
82
|
+
export { g as DateTimePicker };
|