@takaro/lib-components 0.0.13 → 0.0.15

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 (39) hide show
  1. package/Dockerfile.dev +1 -1
  2. package/package.json +21 -20
  3. package/src/components/actions/ToggleButton/ToggleButton.stories.tsx +1 -0
  4. package/src/components/actions/ToggleButton/ToggleButton.tsx +3 -1
  5. package/src/components/actions/ToggleButton/ToggleButtonGroup.tsx +16 -2
  6. package/src/components/charts/AreaChart/AreaChart.stories.tsx +15 -20
  7. package/src/components/charts/GeoMercator/GeoMercator.stories.tsx +24 -18
  8. package/src/components/charts/GeoMercator/index.tsx +160 -58
  9. package/src/components/charts/GeoMercator/iso3166-alpha2-to-alpha3.ts +250 -0
  10. package/src/components/charts/GeoMercator/world.json +333 -0
  11. package/src/components/charts/ZoomControls.tsx +47 -0
  12. package/src/components/charts/index.tsx +3 -0
  13. package/src/components/data/Drawer/Drawer.stories.tsx +19 -10
  14. package/src/components/data/Drawer/DrawerContent.tsx +56 -1
  15. package/src/components/data/Drawer/useDrawer.tsx +16 -2
  16. package/src/components/data/Table/index.tsx +94 -33
  17. package/src/components/data/Table/style.ts +21 -0
  18. package/src/components/data/Table/subcomponents/Pagination/PageSizeSelect.tsx +1 -0
  19. package/src/components/dialogs/Dialog/DialogContent.tsx +1 -5
  20. package/src/components/feedback/Alert/Alert.stories.tsx +1 -10
  21. package/src/components/feedback/Alert/index.tsx +11 -15
  22. package/src/components/feedback/Alert/style.ts +9 -11
  23. package/src/components/feedback/ErrorPage/index.tsx +2 -2
  24. package/src/components/feedback/snacks/Drawer/Drawer.stories.tsx +1 -1
  25. package/src/components/feedback/snacks/Drawer/index.tsx +4 -0
  26. package/src/components/inputs/Date/DatePicker/Controlled.tsx +2 -0
  27. package/src/components/inputs/Date/DatePicker/DatePicker.stories.tsx +1 -1
  28. package/src/components/inputs/Date/DatePicker/Generic.tsx +20 -4
  29. package/src/components/inputs/Date/DatePicker/style.ts +3 -4
  30. package/src/components/inputs/index.ts +7 -0
  31. package/src/components/inputs/selects/SelectQueryField/Controlled.tsx +10 -0
  32. package/src/components/inputs/selects/SelectQueryField/Generic/index.tsx +39 -16
  33. package/src/components/inputs/selects/SelectQueryField/SelectQueryField.stories.tsx +20 -0
  34. package/src/components/inputs/selects/SubComponents/OptionGroup.tsx +4 -2
  35. package/src/components/other/CollapseList/index.tsx +26 -31
  36. package/src/components/visual/Card/Card.stories.tsx +4 -1
  37. package/src/components/visual/Card/CardBody.tsx +11 -0
  38. package/src/components/visual/Card/CardTitle.tsx +23 -0
  39. package/src/components/visual/Card/index.tsx +21 -14
@@ -0,0 +1,250 @@
1
+ export const alpha2ToAlpha3: Record<string, string> = {
2
+ AF: 'AFG',
3
+ AX: 'ALA',
4
+ AL: 'ALB',
5
+ DZ: 'DZA',
6
+ AS: 'ASM',
7
+ AD: 'AND',
8
+ AO: 'AGO',
9
+ AI: 'AIA',
10
+ AQ: 'ATA',
11
+ AG: 'ATG',
12
+ AR: 'ARG',
13
+ AM: 'ARM',
14
+ AW: 'ABW',
15
+ AU: 'AUS',
16
+ AT: 'AUT',
17
+ AZ: 'AZE',
18
+ BS: 'BHS',
19
+ BH: 'BHR',
20
+ BD: 'BGD',
21
+ BB: 'BRB',
22
+ BY: 'BLR',
23
+ BE: 'BEL',
24
+ BZ: 'BLZ',
25
+ BJ: 'BEN',
26
+ BM: 'BMU',
27
+ BT: 'BTN',
28
+ BO: 'BOL',
29
+ BA: 'BIH',
30
+ BW: 'BWA',
31
+ BV: 'BVT',
32
+ BR: 'BRA',
33
+ VG: 'VGB',
34
+ IO: 'IOT',
35
+ BN: 'BRN',
36
+ BG: 'BGR',
37
+ BF: 'BFA',
38
+ BI: 'BDI',
39
+ KH: 'KHM',
40
+ CM: 'CMR',
41
+ CA: 'CAN',
42
+ CV: 'CPV',
43
+ KY: 'CYM',
44
+ CF: 'CAF',
45
+ TD: 'TCD',
46
+ CL: 'CHL',
47
+ CN: 'CHN',
48
+ HK: 'HKG',
49
+ MO: 'MAC',
50
+ CX: 'CXR',
51
+ CC: 'CCK',
52
+ CO: 'COL',
53
+ KM: 'COM',
54
+ CG: 'COG',
55
+ CD: 'COD',
56
+ CK: 'COK',
57
+ CR: 'CRI',
58
+ CI: 'CIV',
59
+ HR: 'HRV',
60
+ CU: 'CUB',
61
+ CY: 'CYP',
62
+ CZ: 'CZE',
63
+ DK: 'DNK',
64
+ DJ: 'DJI',
65
+ DM: 'DMA',
66
+ DO: 'DOM',
67
+ EC: 'ECU',
68
+ EG: 'EGY',
69
+ SV: 'SLV',
70
+ GQ: 'GNQ',
71
+ ER: 'ERI',
72
+ EE: 'EST',
73
+ ET: 'ETH',
74
+ FK: 'FLK',
75
+ FO: 'FRO',
76
+ FJ: 'FJI',
77
+ FI: 'FIN',
78
+ FR: 'FRA',
79
+ GF: 'GUF',
80
+ PF: 'PYF',
81
+ TF: 'ATF',
82
+ GA: 'GAB',
83
+ GM: 'GMB',
84
+ GE: 'GEO',
85
+ DE: 'DEU',
86
+ GH: 'GHA',
87
+ GI: 'GIB',
88
+ GR: 'GRC',
89
+ GL: 'GRL',
90
+ GD: 'GRD',
91
+ GP: 'GLP',
92
+ GU: 'GUM',
93
+ GT: 'GTM',
94
+ GG: 'GGY',
95
+ GN: 'GIN',
96
+ GW: 'GNB',
97
+ GY: 'GUY',
98
+ HT: 'HTI',
99
+ HM: 'HMD',
100
+ VA: 'VAT',
101
+ HN: 'HND',
102
+ HU: 'HUN',
103
+ IS: 'ISL',
104
+ IN: 'IND',
105
+ ID: 'IDN',
106
+ IR: 'IRN',
107
+ IQ: 'IRQ',
108
+ IE: 'IRL',
109
+ IM: 'IMN',
110
+ IL: 'ISR',
111
+ IT: 'ITA',
112
+ JM: 'JAM',
113
+ JP: 'JPN',
114
+ JE: 'JEY',
115
+ JO: 'JOR',
116
+ KZ: 'KAZ',
117
+ KE: 'KEN',
118
+ KI: 'KIR',
119
+ KP: 'PRK',
120
+ KR: 'KOR',
121
+ KW: 'KWT',
122
+ KG: 'KGZ',
123
+ LA: 'LAO',
124
+ LV: 'LVA',
125
+ LB: 'LBN',
126
+ LS: 'LSO',
127
+ LR: 'LBR',
128
+ LY: 'LBY',
129
+ LI: 'LIE',
130
+ LT: 'LTU',
131
+ LU: 'LUX',
132
+ MK: 'MKD',
133
+ MG: 'MDG',
134
+ MW: 'MWI',
135
+ MY: 'MYS',
136
+ MV: 'MDV',
137
+ ML: 'MLI',
138
+ MT: 'MLT',
139
+ MH: 'MHL',
140
+ MQ: 'MTQ',
141
+ MR: 'MRT',
142
+ MU: 'MUS',
143
+ YT: 'MYT',
144
+ MX: 'MEX',
145
+ FM: 'FSM',
146
+ MD: 'MDA',
147
+ MC: 'MCO',
148
+ MN: 'MNG',
149
+ ME: 'MNE',
150
+ MS: 'MSR',
151
+ MA: 'MAR',
152
+ MZ: 'MOZ',
153
+ MM: 'MMR',
154
+ NA: 'NAM',
155
+ NR: 'NRU',
156
+ NP: 'NPL',
157
+ NL: 'NLD',
158
+ AN: 'ANT',
159
+ NC: 'NCL',
160
+ NZ: 'NZL',
161
+ NI: 'NIC',
162
+ NE: 'NER',
163
+ NG: 'NGA',
164
+ NU: 'NIU',
165
+ NF: 'NFK',
166
+ MP: 'MNP',
167
+ NO: 'NOR',
168
+ OM: 'OMN',
169
+ PK: 'PAK',
170
+ PW: 'PLW',
171
+ PS: 'PSE',
172
+ PA: 'PAN',
173
+ PG: 'PNG',
174
+ PY: 'PRY',
175
+ PE: 'PER',
176
+ PH: 'PHL',
177
+ PN: 'PCN',
178
+ PL: 'POL',
179
+ PT: 'PRT',
180
+ PR: 'PRI',
181
+ QA: 'QAT',
182
+ RE: 'REU',
183
+ RO: 'ROU',
184
+ RU: 'RUS',
185
+ RW: 'RWA',
186
+ BL: 'BLM',
187
+ SH: 'SHN',
188
+ KN: 'KNA',
189
+ LC: 'LCA',
190
+ MF: 'MAF',
191
+ PM: 'SPM',
192
+ VC: 'VCT',
193
+ WS: 'WSM',
194
+ SM: 'SMR',
195
+ ST: 'STP',
196
+ SA: 'SAU',
197
+ SN: 'SEN',
198
+ RS: 'SRB',
199
+ SC: 'SYC',
200
+ SL: 'SLE',
201
+ SG: 'SGP',
202
+ SK: 'SVK',
203
+ SI: 'SVN',
204
+ SB: 'SLB',
205
+ SO: 'SOM',
206
+ ZA: 'ZAF',
207
+ GS: 'SGS',
208
+ SS: 'SSD',
209
+ ES: 'ESP',
210
+ LK: 'LKA',
211
+ SD: 'SDN',
212
+ SR: 'SUR',
213
+ SJ: 'SJM',
214
+ SZ: 'SWZ',
215
+ SE: 'SWE',
216
+ CH: 'CHE',
217
+ SY: 'SYR',
218
+ TW: 'TWN',
219
+ TJ: 'TJK',
220
+ TZ: 'TZA',
221
+ TH: 'THA',
222
+ TL: 'TLS',
223
+ TG: 'TGO',
224
+ TK: 'TKL',
225
+ TO: 'TON',
226
+ TT: 'TTO',
227
+ TN: 'TUN',
228
+ TR: 'TUR',
229
+ TM: 'TKM',
230
+ TC: 'TCA',
231
+ TV: 'TUV',
232
+ UG: 'UGA',
233
+ UA: 'UKR',
234
+ AE: 'ARE',
235
+ GB: 'GBR',
236
+ US: 'USA',
237
+ UM: 'UMI',
238
+ UY: 'URY',
239
+ UZ: 'UZB',
240
+ VU: 'VUT',
241
+ VE: 'VEN',
242
+ VN: 'VNM',
243
+ VI: 'VIR',
244
+ WF: 'WLF',
245
+ EH: 'ESH',
246
+ YE: 'YEM',
247
+ ZM: 'ZMB',
248
+ ZW: 'ZWE',
249
+ XK: 'XKX',
250
+ };
@@ -92338,6 +92338,339 @@
92338
92338
  "name": "Armenia"
92339
92339
  }
92340
92340
  },
92341
+ {
92342
+ "arcs": [
92343
+ [
92344
+ [
92345
+ 59
92346
+ ]
92347
+ ],
92348
+ [
92349
+ [
92350
+ 60
92351
+ ]
92352
+ ],
92353
+ [
92354
+ [
92355
+ 61
92356
+ ]
92357
+ ],
92358
+ [
92359
+ [
92360
+ 62
92361
+ ]
92362
+ ],
92363
+ [
92364
+ [
92365
+ 63
92366
+ ]
92367
+ ],
92368
+ [
92369
+ [
92370
+ 64
92371
+ ]
92372
+ ],
92373
+ [
92374
+ [
92375
+ 65
92376
+ ]
92377
+ ],
92378
+ [
92379
+ [
92380
+ 66
92381
+ ]
92382
+ ],
92383
+ [
92384
+ [
92385
+ 67
92386
+ ]
92387
+ ],
92388
+ [
92389
+ [
92390
+ 68
92391
+ ]
92392
+ ],
92393
+ [
92394
+ [
92395
+ 69
92396
+ ]
92397
+ ],
92398
+ [
92399
+ [
92400
+ 70
92401
+ ]
92402
+ ],
92403
+ [
92404
+ [
92405
+ 71
92406
+ ]
92407
+ ],
92408
+ [
92409
+ [
92410
+ 72
92411
+ ]
92412
+ ],
92413
+ [
92414
+ [
92415
+ 73
92416
+ ]
92417
+ ],
92418
+ [
92419
+ [
92420
+ 74
92421
+ ]
92422
+ ],
92423
+ [
92424
+ [
92425
+ 75
92426
+ ]
92427
+ ],
92428
+ [
92429
+ [
92430
+ 76
92431
+ ]
92432
+ ],
92433
+ [
92434
+ [
92435
+ 77
92436
+ ]
92437
+ ],
92438
+ [
92439
+ [
92440
+ 78
92441
+ ]
92442
+ ],
92443
+ [
92444
+ [
92445
+ 79
92446
+ ]
92447
+ ],
92448
+ [
92449
+ [
92450
+ 80
92451
+ ]
92452
+ ],
92453
+ [
92454
+ [
92455
+ 81
92456
+ ]
92457
+ ],
92458
+ [
92459
+ [
92460
+ 82
92461
+ ]
92462
+ ],
92463
+ [
92464
+ [
92465
+ 83
92466
+ ]
92467
+ ],
92468
+ [
92469
+ [
92470
+ 84
92471
+ ]
92472
+ ],
92473
+ [
92474
+ [
92475
+ 85
92476
+ ]
92477
+ ],
92478
+ [
92479
+ [
92480
+ 86
92481
+ ]
92482
+ ],
92483
+ [
92484
+ [
92485
+ 87
92486
+ ]
92487
+ ],
92488
+ [
92489
+ [
92490
+ 88
92491
+ ]
92492
+ ],
92493
+ [
92494
+ [
92495
+ 89
92496
+ ]
92497
+ ],
92498
+ [
92499
+ [
92500
+ 90
92501
+ ]
92502
+ ],
92503
+ [
92504
+ [
92505
+ 91
92506
+ ]
92507
+ ],
92508
+ [
92509
+ [
92510
+ 92
92511
+ ]
92512
+ ],
92513
+ [
92514
+ [
92515
+ 93
92516
+ ]
92517
+ ],
92518
+ [
92519
+ [
92520
+ 94
92521
+ ]
92522
+ ],
92523
+ [
92524
+ [
92525
+ 95
92526
+ ]
92527
+ ],
92528
+ [
92529
+ [
92530
+ 96
92531
+ ]
92532
+ ],
92533
+ [
92534
+ [
92535
+ 97
92536
+ ]
92537
+ ],
92538
+ [
92539
+ [
92540
+ 98
92541
+ ]
92542
+ ],
92543
+ [
92544
+ [
92545
+ 99
92546
+ ]
92547
+ ],
92548
+ [
92549
+ [
92550
+ 100
92551
+ ]
92552
+ ],
92553
+ [
92554
+ [
92555
+ 101
92556
+ ]
92557
+ ],
92558
+ [
92559
+ [
92560
+ 102
92561
+ ]
92562
+ ],
92563
+ [
92564
+ [
92565
+ 103
92566
+ ]
92567
+ ],
92568
+ [
92569
+ [
92570
+ 104
92571
+ ]
92572
+ ],
92573
+ [
92574
+ [
92575
+ 105
92576
+ ]
92577
+ ],
92578
+ [
92579
+ [
92580
+ 106
92581
+ ]
92582
+ ],
92583
+ [
92584
+ [
92585
+ 107
92586
+ ]
92587
+ ],
92588
+ [
92589
+ [
92590
+ 108
92591
+ ]
92592
+ ],
92593
+ [
92594
+ [
92595
+ 109
92596
+ ]
92597
+ ],
92598
+ [
92599
+ [
92600
+ 110
92601
+ ]
92602
+ ],
92603
+ [
92604
+ [
92605
+ 111
92606
+ ]
92607
+ ],
92608
+ [
92609
+ [
92610
+ 112
92611
+ ]
92612
+ ],
92613
+ [
92614
+ [
92615
+ 113
92616
+ ]
92617
+ ],
92618
+ [
92619
+ [
92620
+ 114
92621
+ ]
92622
+ ],
92623
+ [
92624
+ [
92625
+ 115
92626
+ ]
92627
+ ],
92628
+ [
92629
+ [
92630
+ 116
92631
+ ]
92632
+ ],
92633
+ [
92634
+ [
92635
+ 117
92636
+ ]
92637
+ ],
92638
+ [
92639
+ [
92640
+ 118
92641
+ ]
92642
+ ],
92643
+ [
92644
+ [
92645
+ 119
92646
+ ]
92647
+ ],
92648
+ [
92649
+ [
92650
+ 120
92651
+ ]
92652
+ ]
92653
+ ],
92654
+ "type": "MultiPolygon",
92655
+ "id": "ATA",
92656
+ "properties": {
92657
+ "name": "Antarctica"
92658
+ }
92659
+ },
92660
+ {
92661
+ "arcs": [
92662
+ [
92663
+ [
92664
+ 121
92665
+ ]
92666
+ ]
92667
+ ],
92668
+ "type": "MultiPolygon",
92669
+ "id": "ATF",
92670
+ "properties": {
92671
+ "name": "Fr. S. Antarctic Lands"
92672
+ }
92673
+ },
92341
92674
  {
92342
92675
  "arcs": [
92343
92676
  [
@@ -0,0 +1,47 @@
1
+ import { ProvidedZoom } from '@visx/zoom/lib/types';
2
+ import { FC } from 'react';
3
+ import { styled } from '../../styled';
4
+ import { Button, IconButton, Tooltip } from '../../components';
5
+ import { AiOutlinePlus as ZoomInIcon, AiOutlineMinus as ZoomOutIcon } from 'react-icons/ai';
6
+
7
+ const Controls = styled.div`
8
+ position: absolute;
9
+ bottom: 2rem;
10
+ right: 3rem;
11
+ display: flex;
12
+ flex-direction: column;
13
+ align-items: flex-end;
14
+ `;
15
+
16
+ interface ZoomControlsProps {
17
+ zoom: ProvidedZoom<SVGSVGElement>;
18
+ }
19
+
20
+ export const ZoomControls: FC<ZoomControlsProps> = ({ zoom }) => {
21
+ return (
22
+ <Controls>
23
+ <Tooltip placement="left">
24
+ <Tooltip.Trigger asChild>
25
+ <IconButton
26
+ icon={<ZoomInIcon />}
27
+ ariaLabel="zoom in"
28
+ onClick={() => zoom.scale({ scaleX: 1.2, scaleY: 1.2 })}
29
+ />
30
+ </Tooltip.Trigger>
31
+ <Tooltip.Content>Zoom in</Tooltip.Content>
32
+ </Tooltip>
33
+ <Tooltip placement="left">
34
+ <Tooltip.Trigger asChild>
35
+ <IconButton
36
+ icon={<ZoomOutIcon />}
37
+ ariaLabel="zoom in"
38
+ onClick={() => zoom.scale({ scaleX: 0.8, scaleY: 0.8 })}
39
+ />
40
+ </Tooltip.Trigger>
41
+ <Tooltip.Content>Zoom out</Tooltip.Content>
42
+ </Tooltip>
43
+ <Button size="tiny" onClick={zoom.reset} text="Reset" />
44
+ {/*<Button size="tiny" onClick={zoom.center} text="Center" />*/}
45
+ </Controls>
46
+ );
47
+ };
@@ -21,3 +21,6 @@ export type { LineChartProps } from './LineChart';
21
21
 
22
22
  export { RadialBarChart } from './RadialBarChart';
23
23
  export type { RadialBarChartProps } from './RadialBarChart';
24
+
25
+ export { GeoMercator } from './GeoMercator';
26
+ export type { GeoMercatorProps } from './GeoMercator';
@@ -5,6 +5,7 @@ import { styled } from '../../../styled';
5
5
  import { SubmitHandler, useForm } from 'react-hook-form';
6
6
  import { z } from 'zod';
7
7
  import { zodResolver } from '@hookform/resolvers/zod';
8
+ import { DrawerOptions } from './useDrawer';
8
9
 
9
10
  const ButtonContainer = styled.div`
10
11
  display: flex;
@@ -18,7 +19,10 @@ const Status = styled.div`
18
19
  export default {
19
20
  title: 'data/Drawer',
20
21
  component: Drawer,
21
- } as Meta;
22
+ args: {
23
+ promptCloseConfirmation: false,
24
+ },
25
+ } as Meta<DrawerOptions>;
22
26
 
23
27
  export const Loading: StoryFn = () => {
24
28
  return <DrawerSkeleton />;
@@ -33,7 +37,7 @@ interface FormFields {
33
37
  onStoreFront: boolean;
34
38
  }
35
39
 
36
- export const Default: StoryFn = () => {
40
+ export const Default: StoryFn<DrawerOptions> = ({ promptCloseConfirmation }) => {
37
41
  const [open, setOpen] = useState<boolean>(false);
38
42
 
39
43
  const validationSchema = useMemo(
@@ -57,7 +61,7 @@ export const Default: StoryFn = () => {
57
61
  return (
58
62
  <>
59
63
  <Button onClick={() => setOpen(true)} text="Open drawer" />
60
- <Drawer open={open} onOpenChange={setOpen}>
64
+ <Drawer open={open} onOpenChange={setOpen} promptCloseConfirmation={promptCloseConfirmation}>
61
65
  <Drawer.Content>
62
66
  <Drawer.Heading>Product Details</Drawer.Heading>
63
67
  <Drawer.Body>
@@ -85,11 +89,8 @@ export const Default: StoryFn = () => {
85
89
  />
86
90
  </CollapseList.Item>
87
91
  <CollapseList.Item title="Pricing">
88
- <RadioGroup
89
- control={control}
90
- label="Selection a price type"
91
- name="priceType"
92
- options={[
92
+ <RadioGroup control={control} label="Selection a price type" name="priceType">
93
+ {[
93
94
  {
94
95
  label: 'Fixed',
95
96
  labelPosition: 'left',
@@ -100,8 +101,16 @@ export const Default: StoryFn = () => {
100
101
  labelPosition: 'left',
101
102
  value: 'variable',
102
103
  },
103
- ]}
104
- />
104
+ ].map(({ value, label }) => (
105
+ <div
106
+ key={`gender-${value}`}
107
+ style={{ display: 'flex', alignItems: 'center', gap: '1rem', marginBottom: '1rem' }}
108
+ >
109
+ <RadioGroup.Item value={value} id={value} />
110
+ <label htmlFor={value}>{label}</label>
111
+ </div>
112
+ ))}
113
+ </RadioGroup>
105
114
  </CollapseList.Item>
106
115
  </CollapseList>
107
116
  <CollapseList.Item title="Settings">