@symbo.ls/datepicker 2.11.43 → 2.11.52

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.
Files changed (2) hide show
  1. package/index.js +54 -98
  2. package/package.json +6 -5
package/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  'use strict'
2
2
 
3
- import { Button } from '@symbo.ls/button'
4
3
  import { Flex, Grid } from '@symbo.ls/atoms'
4
+ import { Button } from '@symbo.ls/button'
5
+ import { Dialog } from '@symbo.ls/dialog'
5
6
 
6
7
  export const DatePickerYears = {
7
8
  tag: 'aside',
@@ -15,7 +16,7 @@ export const DatePickerYears = {
15
16
  position: 'absolute',
16
17
  top: '0',
17
18
  left: '0',
18
- background: 'linear-gradient(to bottom, rgba(20, 20, 22, 1) 0%, rgba(20, 20, 22, 0) 100%)',
19
+ background: 'linear-gradient(to bottom, var(--theme-tertiary-dark-background) 0%, transparent 100%)',
19
20
  zIndex: '10'
20
21
  },
21
22
  ':after': {
@@ -24,7 +25,7 @@ export const DatePickerYears = {
24
25
  position: 'absolute',
25
26
  bottom: '0',
26
27
  left: '0',
27
- background: 'linear-gradient(to top, rgba(20, 20, 22, 1) 0%, rgba(20, 20, 22, 0) 100%)'
28
+ background: 'linear-gradient(to top, var(--theme-tertiary-dark-background) 0%, transparent 100%)'
28
29
  }
29
30
  },
30
31
 
@@ -95,7 +96,7 @@ export const DatePickerYears = {
95
96
  }
96
97
  }
97
98
 
98
- const months = {
99
+ export const DatePickerMonthsSlider = {
99
100
  extend: Flex,
100
101
  props: {
101
102
  position: 'relative',
@@ -108,7 +109,7 @@ const months = {
108
109
  content: '""',
109
110
  position: 'absolute',
110
111
  boxSize: '100% 100px',
111
- background: 'linear-gradient(to right, rgba(20, 20, 22, 1) 0%, rgba(20, 20, 22, 0) 100%)',
112
+ background: 'linear-gradient(to right, var(--theme-tertiary-dark-background) 0%, transparent 100%)',
112
113
  left: '0',
113
114
  top: '0',
114
115
  zIndex: '30',
@@ -118,7 +119,7 @@ const months = {
118
119
  content: '""',
119
120
  position: 'absolute',
120
121
  boxSize: '100% 100px',
121
- background: 'linear-gradient(to left, rgba(20, 20, 22, 1) 0%, rgba(20, 20, 22, 0) 100%)',
122
+ background: 'linear-gradient(to left, var(--theme-tertiary-dark-background) 0%, transparent 100%)',
122
123
  right: '0',
123
124
  top: '0',
124
125
  zIndex: '30',
@@ -195,11 +196,24 @@ const months = {
195
196
  rightButton: { extend: Button, props: { icon: 'arrowRight' } }
196
197
  }
197
198
 
198
- const weekDays = {
199
+ export const DatePickerWeekDays = {
199
200
  extend: Grid,
201
+ props: {
202
+ overflow: 'hidden',
203
+ padding: '- Z Z',
204
+ width: '100%',
205
+ columns: 'repeat(7, 1fr)',
206
+ gap: 'W2'
207
+ },
200
208
  childExtend: {
201
209
  tag: 'span',
202
- extend: Flex
210
+ extend: Flex,
211
+ props: {
212
+ fontSize: 'Y1',
213
+ textTransform: 'capitalize',
214
+ align: 'center center',
215
+ ':nth-child(7n-1), &:nth-child(7n)': { opacity: '.5' }
216
+ }
203
217
  },
204
218
  ...[
205
219
  { text: 'Mo' },
@@ -212,28 +226,31 @@ const weekDays = {
212
226
  ]
213
227
  }
214
228
 
215
- const monthNumbers = {
229
+ export const DatePickerGrid = {
216
230
  extend: Grid,
217
231
  props: {
218
- columns: 'repeat(7, 32px)',
219
- gap: '4px',
220
- boxSizing: 'content-box',
221
- padding: `- ${12 / 16}em`
232
+ columns: 'repeat(7, 1fr)',
233
+ minWidth: '100%',
234
+ gap: 'W2',
235
+ padding: '- Z'
222
236
  },
223
237
  childExtend: {
224
238
  extend: Button,
225
239
  props: ({ state, key }) => ({
226
- color: 'white',
240
+ isActive: state.activeDay === parseInt(key) + 1,
227
241
  textAlign: 'center',
228
- background: 'transparent',
229
242
  fontSize: 'Z1',
230
243
  round: '100%',
231
- height: '32px',
232
- ':hover': { theme: 'secondary' },
233
- ':nth-child(7n-1)': { color: 'rgba(255, 255, 255, .5)' },
234
- ':nth-child(7n)': { color: 'rgba(255, 255, 255, .5)' },
235
- isActive: state.activeDay === parseInt(key) + 1,
236
- '.isActive': { theme: 'secondary' }
244
+ height: 'B1',
245
+ aspectRatio: '1/1',
246
+ lineHeight: '.9',
247
+ background: 'transparent',
248
+ theme: 'secondary @dark .color',
249
+ '.isActive': { theme: 'primary' },
250
+ '!isActive': {
251
+ ':hover': { theme: 'secondary' },
252
+ ':nth-child(7n-1), &:nth-child(7n)': { opacity: '.5' }
253
+ }
237
254
  }),
238
255
  on: {
239
256
  click: (event, element, state) => {
@@ -242,7 +259,7 @@ const monthNumbers = {
242
259
  }
243
260
  }
244
261
  },
245
- $setCollection: (el, s) => {
262
+ $setPropsCollection: (el, s) => {
246
263
  const daysInMonth = new Date(s.activeYear, s.activeMonth, 0).getDate()
247
264
  const days = (new Array(daysInMonth)).fill(undefined)
248
265
  .map((v, k) => ({ text: k + 1 }))
@@ -250,23 +267,6 @@ const monthNumbers = {
250
267
  }
251
268
  }
252
269
 
253
- const confirmButtons = {
254
- extend: Flex,
255
- childExtend: Button,
256
- ...[
257
- {
258
- text: 'cancel',
259
- on: {
260
- click: (event, element, state) => {
261
- }
262
- }
263
- },
264
- {
265
- text: 'ok'
266
- }
267
- ]
268
- }
269
-
270
270
  const monthNumbersContainer = {
271
271
  props: {
272
272
  maxWidth: `${272 / 16}em`,
@@ -275,7 +275,7 @@ const monthNumbersContainer = {
275
275
  content: '""',
276
276
  position: 'absolute',
277
277
  boxSize: '100% 12px',
278
- background: 'linear-gradient(to right, rgba(20, 20, 22, 1) 0%, rgba(20, 20, 22, 0) 100%)',
278
+ background: 'linear-gradient(to right, var(--theme-tertiary-dark-background) 0%, transparent 100%)',
279
279
  left: '0',
280
280
  top: '0',
281
281
  zIndex: '30'
@@ -284,80 +284,36 @@ const monthNumbersContainer = {
284
284
  content: '""',
285
285
  position: 'absolute',
286
286
  boxSize: '100% 12px',
287
- background: 'linear-gradient(to left, rgba(20, 20, 22, 1) 0%, rgba(20, 20, 22, 0) 100%)',
287
+ background: 'linear-gradient(to left, var(--theme-tertiary-dark-background) 0%, transparent 100%)',
288
288
  right: '0',
289
289
  top: '0',
290
290
  zIndex: '30'
291
291
  },
292
292
  content: {
293
- style: { overflowX: 'auto' }
293
+ overflow: 'auto hidden'
294
294
  }
295
295
  },
296
+
296
297
  content: {
297
298
  extend: Flex,
298
- childExtend: monthNumbers,
299
+ childExtend: DatePickerGrid,
299
300
  ...[{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}]
300
301
  }
301
302
  }
302
303
 
303
304
  const props = {
304
305
  yearRange: [1993, 2023],
305
- round: 'Z2',
306
- margin: 'E',
307
- overflow: 'hidden',
308
306
  maxHeight: '318px',
309
307
  boxSize: 'fit-content fit-content',
310
- background: '#141416',
311
- padding: '- Z - -',
312
308
  style: {
313
309
  button: {
314
310
  padding: '0'
315
311
  }
316
- },
317
-
318
- calendar: {
319
- flow: 'column',
320
- padding: '20px - - -',
321
- position: 'relative',
322
-
323
- weekDaysContainer: {
324
- overflow: 'hidden',
325
- padding: '- - Z1 -',
326
- boxSizing: 'content-box',
327
- maxWidth: `${272 / 16}em`,
328
- childProps: {
329
- maxWidth: 'fit-content',
330
- columns: 'repeat(7, 32px)',
331
- gap: '4px',
332
- boxSizing: 'content-box',
333
- padding: `- ${12 / 16}em`,
334
- childProps: {
335
- fontSize: 'Y1',
336
- textTransform: 'capitalize',
337
- ':nth-child(7n-1)': { color: 'rgba(255, 255, 255, .5)' },
338
- ':nth-child(7n)': { color: 'rgba(255, 255, 255, .5)' },
339
- align: 'center center'
340
- }
341
- }
342
- },
343
-
344
- confirmButtons: {
345
- align: 'center flex-end',
346
- gap: 'A1',
347
- padding: 'A A1 - -',
348
- childProps: {
349
- color: '#0079FD',
350
- fontSize: 'Y',
351
- textTransform: 'uppercase',
352
- background: 'transparent'
353
- }
354
- }
355
-
356
312
  }
357
313
  }
358
314
 
359
315
  export const DatePicker = {
360
- extend: Flex,
316
+ extend: [Dialog, Flex],
361
317
  state: {
362
318
  activeYear: 1993,
363
319
  activeMonth: 8,
@@ -368,20 +324,20 @@ export const DatePicker = {
368
324
 
369
325
  DatePickerYears: {},
370
326
 
371
- calendar: {
372
- extend: Flex,
327
+ Flex: {
328
+ props: {
329
+ flow: 'column',
330
+ padding: '20px - - -',
331
+ position: 'relative'
332
+ },
373
333
 
374
- months,
334
+ DatePickerMonthsSlider: {},
375
335
 
376
- weekDaysContainer: {
377
- extend: Flex,
378
- childExtend: weekDays,
379
- ...[{}, {}]
380
- },
336
+ DatePickerWeekDays: {},
381
337
 
382
338
  monthNumbersContainer,
383
339
 
384
- confirmButtons
340
+ DialogFooter: {}
385
341
  }
386
342
  }
387
343
 
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@symbo.ls/datepicker",
3
- "version": "2.11.43",
3
+ "version": "2.11.52",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
- "gitHead": "9fc7b25250ed06e3c759f7539edff7855b31ec21",
6
+ "gitHead": "2e71da7acbdccc01e180f37d76f4ce0889791bf5",
7
7
  "dependencies": {
8
- "@symbo.ls/block": "latest",
9
- "@symbo.ls/icon": "latest",
10
- "@symbo.ls/shape": "latest"
8
+ "@symbo.ls/atoms": "latest",
9
+ "@symbo.ls/button": "latest",
10
+ "@symbo.ls/dialog": "latest",
11
+ "@symbo.ls/icon": "latest"
11
12
  },
12
13
  "source": "src/index.js"
13
14
  }