@vygruppen/spor-react 6.1.0 → 6.2.1

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.d.mts CHANGED
@@ -265,7 +265,9 @@ type ButtonProps = Exclude<ButtonProps$1, "colorScheme" | "loadingText" | "size"
265
265
  size?: "xs" | "sm" | "md" | "lg";
266
266
  /** The different variants of a button
267
267
  *
268
- * Defaults to "primary"
268
+ * Defaults to "primary".
269
+ *
270
+ * "control" is deprecated, and will be removed in a future version
269
271
  */
270
272
  variant?: "control" | "primary" | "secondary" | "tertiary" | "ghost" | "floating";
271
273
  };
@@ -274,7 +276,6 @@ type ButtonProps = Exclude<ButtonProps$1, "colorScheme" | "loadingText" | "size"
274
276
  *
275
277
  * There are several button variants. You can specify which one you want with the `variant` prop. The available variants are:
276
278
  *
277
- * - `control`: This button is used for ticket controls only.
278
279
  * - `primary`: This is our main button. It's used for the main actions in a view, like a call to action. There should only be a single primary button in each view.
279
280
  * - `secondary`: Used for secondary actions in a view, and when you need to make several actions available at the same time.
280
281
  * - `tertiary`: Used for additional choices, like a less important secondary action.
@@ -335,6 +336,10 @@ type ButtonGroupProps = ButtonGroupProps$1;
335
336
  declare const ButtonGroup: _chakra_ui_system_dist_system_types.ComponentWithAs<"div", ButtonGroupProps$1>;
336
337
 
337
338
  type IconButtonProps = Omit<IconButtonProps$1, "variant"> & {
339
+ /** The button variant.
340
+ *
341
+ * "control" is deprecated
342
+ */
338
343
  variant: "control" | "primary" | "secondary" | "tertiary" | "ghost" | "floating";
339
344
  };
340
345
  /**
@@ -1329,13 +1334,28 @@ type Variant =
1329
1334
 
1330
1335
  type Size = "sm" | "md" | "lg";
1331
1336
 
1332
- type TagProps = {
1333
- variant: Variant;
1337
+ type TagProps = VariantProps$1 & {
1334
1338
  size: Size;
1335
1339
  title: string;
1336
1340
  description?: string;
1337
1341
  };
1338
1342
 
1343
+ type DefaultVariantProps$1 = {
1344
+ variant: Variant;
1345
+ };
1346
+ type CustomVariantProps$1 = {
1347
+ variant: "custom";
1348
+ /** When variant="custom", the foreground color of the tag */
1349
+ foregroundColor: string;
1350
+ /** When variant="custom", the background color of the tag */
1351
+ backgroundColor: string;
1352
+ /** When variant="custom", this is the icon you want to display.
1353
+ * It should be one of the other variants
1354
+ */
1355
+ customIconVariant: Variant;
1356
+ };
1357
+ type VariantProps$1 = DefaultVariantProps$1 | CustomVariantProps$1;
1358
+
1339
1359
  type InfoTagProps = TagProps;
1340
1360
  /**
1341
1361
  * An info tag component.
@@ -1356,12 +1376,33 @@ type InfoTagProps = TagProps;
1356
1376
  * />
1357
1377
  * ```
1358
1378
  *
1379
+ * If required, you can also override the colors and icons in these line tags:
1380
+ *
1381
+ * ```tsx
1382
+ * <InfoTag
1383
+ * variant="custom"
1384
+ * customIconVariant="ferry"
1385
+ * foregroundColor="#b4da55"
1386
+ * backgroundColor="#c0ffee"
1387
+ * />
1388
+ * ```
1389
+ *
1359
1390
  * @see https://spor.vy.no/components/line-tags
1360
1391
  */
1361
- declare const InfoTag: ({ variant, size, title, description, }: InfoTagProps) => React__default.JSX.Element;
1392
+ declare const InfoTag: ({ variant, size, title, description, ...customProps }: InfoTagProps) => React__default.JSX.Element;
1362
1393
 
1363
- type LineIconProps = BoxProps & {
1364
- variant: TagProps["variant"];
1394
+ type DefaultVariants = Exclude<TagProps["variant"], "custom">;
1395
+ type DefaultVariantProps = {
1396
+ variant: DefaultVariants;
1397
+ };
1398
+ type CustomVariantProps = {
1399
+ variant: "custom";
1400
+ customIconVariant: DefaultVariants;
1401
+ foregroundColor: string;
1402
+ backgroundColor: string;
1403
+ };
1404
+ type VariantProps = DefaultVariantProps | CustomVariantProps;
1405
+ type LineIconProps = Exclude<BoxProps, "variant"> & VariantProps & {
1365
1406
  size: TagProps["size"];
1366
1407
  };
1367
1408
  /**
@@ -1379,6 +1420,18 @@ type LineIconProps = BoxProps & {
1379
1420
  * <LineIcon variant="subway" size="lg" />
1380
1421
  * ```
1381
1422
  *
1423
+ * If you require some one-off colors, but still want to use the line tag component,
1424
+ * you can do so like this:
1425
+ *
1426
+ * ```tsx
1427
+ * <LineIcon
1428
+ * variant="custom"
1429
+ * customIconVariant="ferry"
1430
+ * foregroundColor="#b4da55"
1431
+ * backgroundColor="#c0ffee"
1432
+ * />
1433
+ * ```
1434
+ *
1382
1435
  * @see https://spor.vy.no/components/line-tags
1383
1436
  */
1384
1437
  declare const LineIcon: ({ variant, size, sx, ...rest }: LineIconProps) => React__default.JSX.Element | null;
@@ -1422,6 +1475,19 @@ type TravelTagProps = TagProps & BoxProps & {
1422
1475
  * />
1423
1476
  * ```
1424
1477
  *
1478
+ * If required, you can also override the colors and icons in these travel tags:
1479
+ *
1480
+ * ```tsx
1481
+ * <TravelTag
1482
+ * variant="custom"
1483
+ * customIconVariant="ferry"
1484
+ * foregroundColor="#b4da55"
1485
+ * backgroundColor="#c0ffee"
1486
+ * title="3"
1487
+ * description="Ringen"
1488
+ * />
1489
+ * ```
1490
+ *
1425
1491
  * @see https://spor.vy.no/components/line-tags
1426
1492
  */
1427
1493
  declare const TravelTag: _chakra_ui_system_dist_system_types.ComponentWithAs<As, TravelTagProps>;
@@ -2270,7 +2336,6 @@ declare const theme: {
2270
2336
  baseStyle?: {
2271
2337
  border: number;
2272
2338
  borderRadius: string;
2273
- fontWeight: string;
2274
2339
  transitionProperty: string;
2275
2340
  transitionDuration: string;
2276
2341
  textWrap: string;
@@ -2297,56 +2362,69 @@ declare const theme: {
2297
2362
  minHeight: number;
2298
2363
  minWidth: number;
2299
2364
  fontSize: string;
2365
+ fontWeight: string;
2300
2366
  };
2301
2367
  md: {
2302
2368
  minHeight: number;
2303
2369
  minWidth: number;
2304
2370
  fontSize: string;
2371
+ fontWeight: string;
2305
2372
  };
2306
2373
  sm: {
2307
2374
  minHeight: number;
2308
2375
  minWidth: number;
2309
2376
  fontSize: string;
2377
+ fontWeight: string;
2310
2378
  };
2311
2379
  xs: {
2312
2380
  minHeight: number;
2313
2381
  minWidth: number;
2314
2382
  fontSize: string;
2315
2383
  paddingX: number;
2384
+ fontWeight: string;
2316
2385
  };
2317
2386
  } | undefined;
2318
2387
  variants?: {
2319
2388
  primary: (props: _chakra_ui_styled_system.StyleFunctionProps) => {
2389
+ backgroundColor: string;
2390
+ color: string;
2391
+ _focusVisible: {
2392
+ boxShadow: string;
2393
+ };
2320
2394
  _hover: {
2321
2395
  backgroundColor: string;
2322
2396
  };
2323
2397
  _active: {
2324
2398
  backgroundColor: string;
2325
2399
  };
2326
- _focus: _chakra_ui_styled_system.SystemStyleObject;
2327
- _focusVisible: _chakra_ui_styled_system.SystemStyleObject;
2328
- "&[data-focus]:not([data-focus-visible])": _chakra_ui_styled_system.SystemStyleObject;
2329
- backgroundColor: string;
2330
- color: string;
2331
2400
  };
2332
2401
  secondary: (props: _chakra_ui_styled_system.StyleFunctionProps) => {
2333
- _active: {
2402
+ backgroundColor: string;
2403
+ color: string;
2404
+ _hover: {
2334
2405
  backgroundColor: string;
2406
+ };
2407
+ _focusVisible: {
2335
2408
  boxShadow: string;
2336
2409
  _hover: {
2337
2410
  boxShadow: string;
2338
2411
  };
2339
2412
  };
2340
- _focus: _chakra_ui_styled_system.SystemStyleObject;
2341
- _focusVisible: _chakra_ui_styled_system.SystemStyleObject;
2342
- "&[data-focus]:not([data-focus-visible])": _chakra_ui_styled_system.SystemStyleObject;
2343
- backgroundColor: string;
2344
- color: string;
2345
- _hover: {
2413
+ _active: {
2346
2414
  backgroundColor: string;
2415
+ boxShadow: string;
2416
+ _hover: {
2417
+ boxShadow: string;
2418
+ };
2347
2419
  };
2348
2420
  };
2349
2421
  tertiary: (props: _chakra_ui_styled_system.StyleFunctionProps) => {
2422
+ backgroundColor: string;
2423
+ color: string;
2424
+ boxShadow: string;
2425
+ _focusVisible: {
2426
+ boxShadow: string;
2427
+ };
2350
2428
  _hover: {
2351
2429
  boxShadow: string;
2352
2430
  };
@@ -2354,15 +2432,13 @@ declare const theme: {
2354
2432
  boxShadow: string;
2355
2433
  backgroundColor: string;
2356
2434
  };
2357
- _focus: _chakra_ui_styled_system.SystemStyleObject;
2358
- _focusVisible: _chakra_ui_styled_system.SystemStyleObject;
2359
- "&[data-focus]:not([data-focus-visible])": _chakra_ui_styled_system.SystemStyleObject;
2360
- backgroundColor: string;
2361
- color: string;
2362
- fontWeight: string;
2363
- boxShadow: string;
2364
2435
  };
2365
2436
  ghost: (props: _chakra_ui_styled_system.StyleFunctionProps) => {
2437
+ backgroundColor: string;
2438
+ color: string;
2439
+ _focusVisible: {
2440
+ boxShadow: string;
2441
+ };
2366
2442
  _hover: {
2367
2443
  backgroundColor: string;
2368
2444
  _disabled: {
@@ -2372,17 +2448,8 @@ declare const theme: {
2372
2448
  _active: {
2373
2449
  backgroundColor: string;
2374
2450
  };
2375
- _focus: _chakra_ui_styled_system.SystemStyleObject;
2376
- _focusVisible: _chakra_ui_styled_system.SystemStyleObject;
2377
- "&[data-focus]:not([data-focus-visible])": _chakra_ui_styled_system.SystemStyleObject;
2378
- backgroundColor: string;
2379
- color: string;
2380
- fontWeight: string;
2381
2451
  };
2382
2452
  floating: (props: _chakra_ui_styled_system.StyleFunctionProps) => {
2383
- _focus: _chakra_ui_styled_system.SystemStyleObject;
2384
- _focusVisible: _chakra_ui_styled_system.SystemStyleObject;
2385
- "&[data-focus]:not([data-focus-visible])": _chakra_ui_styled_system.SystemStyleObject;
2386
2453
  backgroundColor: string;
2387
2454
  boxShadow: string;
2388
2455
  _active: {
@@ -2392,6 +2459,12 @@ declare const theme: {
2392
2459
  backgroundColor: string;
2393
2460
  boxShadow: string;
2394
2461
  };
2462
+ _focusVisible: {
2463
+ boxShadow: string;
2464
+ _hover: {
2465
+ boxShadow: string;
2466
+ };
2467
+ };
2395
2468
  };
2396
2469
  } | undefined;
2397
2470
  defaultProps?: {
@@ -2403,15 +2476,6 @@ declare const theme: {
2403
2476
  Card: {
2404
2477
  baseStyle?: ((props: any) => {
2405
2478
  "button&, a&, label&, &.is-clickable": {
2406
- _disabled: {
2407
- backgroundColor: string;
2408
- boxShadow: string;
2409
- color: string;
2410
- pointerEvents: string;
2411
- };
2412
- _focus: _chakra_ui_styled_system.SystemStyleObject;
2413
- _focusVisible: _chakra_ui_styled_system.SystemStyleObject;
2414
- "&[data-focus]:not([data-focus-visible])": _chakra_ui_styled_system.SystemStyleObject;
2415
2479
  _hover: {
2416
2480
  backgroundColor: string;
2417
2481
  boxShadow: string;
@@ -2423,18 +2487,23 @@ declare const theme: {
2423
2487
  backgroundColor: string;
2424
2488
  boxShadow: string;
2425
2489
  };
2426
- boxShadow: string;
2427
- backgroundColor?: undefined;
2428
- } | {
2490
+ _focusVisible: {
2491
+ boxShadow: string;
2492
+ outline: string;
2493
+ _active: {
2494
+ backgroundColor: string;
2495
+ boxShadow: string;
2496
+ };
2497
+ };
2429
2498
  _disabled: {
2430
2499
  backgroundColor: string;
2431
2500
  boxShadow: string;
2432
2501
  color: string;
2433
2502
  pointerEvents: string;
2434
2503
  };
2435
- _focus: _chakra_ui_styled_system.SystemStyleObject;
2436
- _focusVisible: _chakra_ui_styled_system.SystemStyleObject;
2437
- "&[data-focus]:not([data-focus-visible])": _chakra_ui_styled_system.SystemStyleObject;
2504
+ boxShadow: string;
2505
+ backgroundColor?: undefined;
2506
+ } | {
2438
2507
  _hover: {
2439
2508
  backgroundColor: string;
2440
2509
  boxShadow: string;
@@ -2446,6 +2515,20 @@ declare const theme: {
2446
2515
  backgroundColor: string;
2447
2516
  boxShadow: string;
2448
2517
  };
2518
+ _focusVisible: {
2519
+ boxShadow: string;
2520
+ outline: string;
2521
+ _active: {
2522
+ backgroundColor: string;
2523
+ boxShadow: string;
2524
+ };
2525
+ };
2526
+ _disabled: {
2527
+ backgroundColor: string;
2528
+ boxShadow: string;
2529
+ color: string;
2530
+ pointerEvents: string;
2531
+ };
2449
2532
  backgroundColor: string;
2450
2533
  boxShadow: string;
2451
2534
  };
@@ -2461,15 +2544,6 @@ declare const theme: {
2461
2544
  borderRadius: string;
2462
2545
  } | {
2463
2546
  "button&, a&, label&, &.is-clickable": {
2464
- _disabled: {
2465
- backgroundColor: string;
2466
- boxShadow: string;
2467
- color: string;
2468
- pointerEvents: string;
2469
- };
2470
- _focus: _chakra_ui_styled_system.SystemStyleObject;
2471
- _focusVisible: _chakra_ui_styled_system.SystemStyleObject;
2472
- "&[data-focus]:not([data-focus-visible])": _chakra_ui_styled_system.SystemStyleObject;
2473
2547
  _hover: {
2474
2548
  backgroundColor: string;
2475
2549
  boxShadow: string;
@@ -2481,18 +2555,23 @@ declare const theme: {
2481
2555
  backgroundColor: string;
2482
2556
  boxShadow: string;
2483
2557
  };
2484
- boxShadow: string;
2485
- backgroundColor?: undefined;
2486
- } | {
2558
+ _focusVisible: {
2559
+ boxShadow: string;
2560
+ outline: string;
2561
+ _active: {
2562
+ backgroundColor: string;
2563
+ boxShadow: string;
2564
+ };
2565
+ };
2487
2566
  _disabled: {
2488
2567
  backgroundColor: string;
2489
2568
  boxShadow: string;
2490
2569
  color: string;
2491
2570
  pointerEvents: string;
2492
2571
  };
2493
- _focus: _chakra_ui_styled_system.SystemStyleObject;
2494
- _focusVisible: _chakra_ui_styled_system.SystemStyleObject;
2495
- "&[data-focus]:not([data-focus-visible])": _chakra_ui_styled_system.SystemStyleObject;
2572
+ boxShadow: string;
2573
+ backgroundColor?: undefined;
2574
+ } | {
2496
2575
  _hover: {
2497
2576
  backgroundColor: string;
2498
2577
  boxShadow: string;
@@ -2504,6 +2583,20 @@ declare const theme: {
2504
2583
  backgroundColor: string;
2505
2584
  boxShadow: string;
2506
2585
  };
2586
+ _focusVisible: {
2587
+ boxShadow: string;
2588
+ outline: string;
2589
+ _active: {
2590
+ backgroundColor: string;
2591
+ boxShadow: string;
2592
+ };
2593
+ };
2594
+ _disabled: {
2595
+ backgroundColor: string;
2596
+ boxShadow: string;
2597
+ color: string;
2598
+ pointerEvents: string;
2599
+ };
2507
2600
  backgroundColor: string;
2508
2601
  boxShadow: string;
2509
2602
  };
@@ -3955,10 +4048,15 @@ declare const theme: {
3955
4048
  };
3956
4049
  };
3957
4050
  };
4051
+ custom: (props: _chakra_ui_styled_system.StyleFunctionProps) => {
4052
+ iconContainer: {
4053
+ backgroundColor: any;
4054
+ };
4055
+ };
3958
4056
  } | undefined;
3959
4057
  defaultProps?: {
3960
4058
  size?: "sm" | "md" | "lg" | undefined;
3961
- variant?: "alt-transport" | "local-train" | "region-train" | "region-express-train" | "long-distance-train" | "airport-express-train" | "vy-bus" | "local-bus" | "ferry" | "subway" | "tram" | "walk" | undefined;
4059
+ variant?: "custom" | "alt-transport" | "local-train" | "region-train" | "region-express-train" | "long-distance-train" | "airport-express-train" | "vy-bus" | "local-bus" | "ferry" | "subway" | "tram" | "walk" | undefined;
3962
4060
  colorScheme?: string | undefined;
3963
4061
  } | undefined;
3964
4062
  parts: ("icon" | "iconContainer")[];
@@ -5544,10 +5642,15 @@ declare const theme: {
5544
5642
  display: string;
5545
5643
  };
5546
5644
  };
5645
+ custom: (props: _chakra_ui_styled_system.StyleFunctionProps) => {
5646
+ container: {
5647
+ backgroundColor: any;
5648
+ };
5649
+ };
5547
5650
  } | undefined;
5548
5651
  defaultProps?: {
5549
5652
  size?: "sm" | "md" | "lg" | undefined;
5550
- variant?: "alt-transport" | "local-train" | "region-train" | "region-express-train" | "long-distance-train" | "airport-express-train" | "vy-bus" | "local-bus" | "ferry" | "subway" | "tram" | "walk" | undefined;
5653
+ variant?: "custom" | "alt-transport" | "local-train" | "region-train" | "region-express-train" | "long-distance-train" | "airport-express-train" | "vy-bus" | "local-bus" | "ferry" | "subway" | "tram" | "walk" | undefined;
5551
5654
  colorScheme?: string | undefined;
5552
5655
  } | undefined;
5553
5656
  parts: ("title" | "container" | "icon" | "description" | "iconContainer" | "textContainer" | "deviationIcon")[];