@apify/ui-library 1.127.10 → 1.128.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.
Files changed (45) hide show
  1. package/dist/src/components/code/code_block/code_block.styled.d.ts.map +1 -1
  2. package/dist/src/components/code/code_block/code_block.styled.js +1 -0
  3. package/dist/src/components/code/code_block/code_block.styled.js.map +1 -1
  4. package/dist/src/components/collapsible_card/collapsible_card.d.ts +1 -0
  5. package/dist/src/components/collapsible_card/collapsible_card.d.ts.map +1 -1
  6. package/dist/src/components/collapsible_card/collapsible_card.js +3 -3
  7. package/dist/src/components/collapsible_card/collapsible_card.js.map +1 -1
  8. package/dist/src/components/index.d.ts +2 -0
  9. package/dist/src/components/index.d.ts.map +1 -1
  10. package/dist/src/components/index.js +2 -0
  11. package/dist/src/components/index.js.map +1 -1
  12. package/dist/src/components/select/index.d.ts +2 -0
  13. package/dist/src/components/select/index.d.ts.map +1 -0
  14. package/dist/src/components/select/index.js +2 -0
  15. package/dist/src/components/select/index.js.map +1 -0
  16. package/dist/src/components/select/select.d.ts +57 -0
  17. package/dist/src/components/select/select.d.ts.map +1 -0
  18. package/dist/src/components/select/select.js +234 -0
  19. package/dist/src/components/select/select.js.map +1 -0
  20. package/dist/src/components/switch/index.d.ts +2 -0
  21. package/dist/src/components/switch/index.d.ts.map +1 -0
  22. package/dist/src/components/switch/index.js +2 -0
  23. package/dist/src/components/switch/index.js.map +1 -0
  24. package/dist/src/components/switch/switch.d.ts +11 -0
  25. package/dist/src/components/switch/switch.d.ts.map +1 -0
  26. package/dist/src/components/switch/switch.js +25 -0
  27. package/dist/src/components/switch/switch.js.map +1 -0
  28. package/dist/src/components/switch/switch.style.d.ts +2 -0
  29. package/dist/src/components/switch/switch.style.d.ts.map +1 -0
  30. package/dist/src/components/switch/switch.style.js +53 -0
  31. package/dist/src/components/switch/switch.style.js.map +1 -0
  32. package/dist/tsconfig.build.tsbuildinfo +1 -1
  33. package/package.json +5 -3
  34. package/src/components/checkbox/checkbox.stories.tsx +1 -1
  35. package/src/components/code/code_block/code_block.styled.tsx +1 -0
  36. package/src/components/collapsible_card/collapsible_card.stories.tsx +16 -0
  37. package/src/components/collapsible_card/collapsible_card.tsx +5 -3
  38. package/src/components/index.ts +2 -0
  39. package/src/components/select/index.ts +1 -0
  40. package/src/components/select/select.stories.tsx +76 -0
  41. package/src/components/select/select.tsx +402 -0
  42. package/src/components/switch/index.ts +1 -0
  43. package/src/components/switch/switch.stories.jsx +38 -0
  44. package/src/components/switch/switch.style.ts +54 -0
  45. package/src/components/switch/switch.tsx +54 -0
@@ -0,0 +1,54 @@
1
+ import { css } from 'styled-components';
2
+
3
+ import { theme } from '../../design_system/theme.js';
4
+
5
+ export const switchStyle = css`
6
+ width: 32px;
7
+ height: 16px;
8
+ background-color: ${theme.color.neutral.actionSecondary};
9
+ border-radius: 100px;
10
+ position: relative;
11
+ transition: border-color 120ms ease-out, background-color 120ms ease-out !important;
12
+ vertical-align: middle;
13
+
14
+ &:focus-visible {
15
+ outline: 2px solid ${theme.color.primary.fieldBorderActive}!important;
16
+ }
17
+
18
+ &:hover {
19
+ background-color: ${theme.color.neutral.actionSecondaryHover};
20
+ cursor: pointer;
21
+ }
22
+
23
+ &.disabled {
24
+ background-color: ${theme.color.neutral.disabled};
25
+ }
26
+
27
+ &.error {
28
+ background-color: ${theme.color.danger.action};
29
+
30
+ &:hover {
31
+ background-color: ${theme.color.danger.actionHover};
32
+ }
33
+ }
34
+
35
+ &[data-state="checked"] {
36
+ background-color: ${theme.color.success.action};
37
+
38
+ &:hover {
39
+ background-color: ${theme.color.success.actionHover};
40
+ }
41
+
42
+ &.disabled {
43
+ background-color: ${theme.color.success.chipBackground};
44
+ }
45
+
46
+ &.error {
47
+ background-color: ${theme.color.danger.action};
48
+
49
+ &:hover {
50
+ background-color: ${theme.color.danger.actionHover};
51
+ }
52
+ }
53
+ }
54
+ `;
@@ -0,0 +1,54 @@
1
+ import * as SwitchPrimitiveReact from '@radix-ui/react-switch';
2
+ import clsx from 'clsx';
3
+ import styled from 'styled-components';
4
+
5
+ import { theme } from '../../design_system/theme.js';
6
+ import { switchStyle } from './switch.style';
7
+
8
+ const StyledSwitch = styled(SwitchPrimitiveReact.Root)`
9
+ all: unset;
10
+ ${switchStyle}
11
+ `;
12
+
13
+ const StyledThumb = styled(SwitchPrimitiveReact.Thumb)`
14
+ display: block;
15
+ background-color: ${theme.color.neutral.backgroundWhite};
16
+ width: 12px;
17
+ height: 12px;
18
+ border-radius: 100px;
19
+ transition: transform 100ms;
20
+ transform: translateX(2px);
21
+ will-change: transform;
22
+ &[data-state="checked"] {
23
+ transform: translateX(18px);
24
+ }
25
+ `;
26
+ type SwitchPrimitiveProps = {
27
+ value: boolean;
28
+ setValue: (checked: boolean) => void;
29
+ error?: string;
30
+ disabled?: boolean;
31
+ readOnly?: boolean;
32
+ } & Omit<React.ComponentPropsWithoutRef<typeof SwitchPrimitiveReact.Root>, 'checked' | 'onCheckedChange' | 'value'>;
33
+
34
+ export const SwitchPrimitive = ({
35
+ value,
36
+ setValue,
37
+ error,
38
+ disabled,
39
+ readOnly,
40
+ ...rest
41
+ }: SwitchPrimitiveProps) => (
42
+ <StyledSwitch
43
+ {...rest}
44
+ checked={value}
45
+ onCheckedChange={setValue}
46
+ disabled={disabled || readOnly}
47
+ className={clsx(
48
+ error && 'error',
49
+ (disabled || readOnly) && 'disabled',
50
+ )}
51
+ >
52
+ <StyledThumb />
53
+ </StyledSwitch>
54
+ );