@semcore/pills 17.2.1 → 18.0.0-prerelease.0

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.
@@ -1,156 +1,164 @@
1
1
  SPills {
2
+ position: relative;
2
3
  display: inline-flex;
3
- align-items: center;
4
- justify-content: center;
5
- isolation: isolate;
6
- border-radius: var(--intergalactic-control-rounded, 6px);
4
+ padding: var(--intergalactic-spacing-content-padding-xxsmall, 2px);
5
+ min-height: var(--intergalactic-form-control-m, 32px);
6
+ border-radius: var(--intergalactic-pills-rounded, 6px);
7
+ background: var(--intergalactic-control-pills-bg-normal, oklch(0.166 0.031 175.8 / 0.097));
8
+ box-sizing: border-box;
7
9
 
8
- SPill[selected] {
9
- background: var(--intergalactic-control-secondary-info, oklch(0.527 0.264 262.9 / 0.039));
10
- border-color: var(--intergalactic-border-info-active, oklch(0.7 0.131 275.2));
11
- z-index: 3;
12
- }
13
- SPill:focus-visible, SPill[selected] {
14
- z-index: 3;
10
+ &[size='l'] {
11
+ min-height: var(--intergalactic-form-control-l, 44px);
15
12
  }
16
13
 
17
- SPill:hover, SPill:active {
18
- z-index: 2;
14
+ /*
15
+ TODO: switch to anchor realisation when layout changes will be supported by FF and Safari.
16
+ As of now JS fallback is used.
17
+ */
18
+ /* &:has(SPill[aria-checked='true'], SPill[aria-selected='true']) {
19
+ SPill[aria-checked='true'], SPill[aria-selected='true'] {
20
+ anchor-name: --active-segment;
21
+ }
22
+ } */
23
+
24
+ SPillContainer {
25
+ &:last-of-type {
26
+ SPillSeparator {
27
+ display: none;
28
+ }
29
+ }
19
30
  }
31
+
32
+ --transition-fast:
33
+ left calc(var(--intergalactic-duration-fast, 200) * 1ms) var(--intergalactic-easings-fast, cubic-bezier(0.5, 0, 0, 1.12)),
34
+ width calc(var(--intergalactic-duration-fast, 200) * 1ms) var(--intergalactic-easings-fast, cubic-bezier(0.5, 0, 0, 1.12)),
35
+ top calc(var(--intergalactic-duration-fast, 200) * 1ms) var(--intergalactic-easings-fast, cubic-bezier(0.5, 0, 0, 1.12)),
36
+ height calc(var(--intergalactic-duration-fast, 200) * 1ms) var(--intergalactic-easings-fast, cubic-bezier(0.5, 0, 0, 1.12));
37
+
38
+ --transition-slow:
39
+ left calc(var(--intergalactic-duration-medium, 300) * 1ms) var(--intergalactic-easings-medium, cubic-bezier(0.5, 0, 0, 1.09)),
40
+ width calc(var(--intergalactic-duration-medium, 300) * 1ms) var(--intergalactic-easings-medium, cubic-bezier(0.5, 0, 0, 1.09)),
41
+ top calc(var(--intergalactic-duration-medium, 300) * 1ms) var(--intergalactic-easings-medium, cubic-bezier(0.5, 0, 0, 1.09)),
42
+ height calc(var(--intergalactic-duration-medium, 300) * 1ms) var(--intergalactic-easings-medium, cubic-bezier(0.5, 0, 0, 1.09));
20
43
  }
21
44
 
22
45
  SPill {
23
- display: inline-flex;
24
- align-items: center;
25
- justify-content: center;
26
- line-height: normal;
27
46
  position: relative;
28
- touch-action: manipulation;
29
- white-space: nowrap;
30
- user-select: none;
31
- box-sizing: border-box;
32
- padding: 0;
33
- margin: 0;
34
- box-shadow: none;
35
- text-decoration: none;
36
- -webkit-tap-highlight-color: transparent;
37
- overflow: visible;
38
- text-align: center;
39
- vertical-align: middle;
40
- font-family: inherit;
47
+
41
48
  cursor: pointer;
42
- background: var(--intergalactic-bg-primary-neutral, oklch(1 0 0));
43
- border: 1px solid var(--intergalactic-border-primary, oklch(0.137 0.026 175.7 / 0.161));
44
- border-radius: var(--intergalactic-control-rounded, 6px);
45
49
 
46
- &::-moz-focus-inner {
47
- border: none;
48
- padding: 0;
49
- }
50
+ display: inline-flex;
51
+ justify-content: center;
52
+ align-items: center;
53
+ gap: var(--intergalactic-spacing-content-gap-medium, 6px);
54
+ padding: 0 var(--intergalactic-spacing-content-padding-medium, 12px);
55
+
56
+ border-style: solid;
57
+ border-color: transparent;
58
+ border-radius: var(--intergalactic-rounded-small, 4px);
50
59
 
51
- &:active {
52
- outline: 0;
53
- text-decoration: none;
54
- }
60
+ background-color: transparent;
55
61
 
56
62
  &:hover {
57
- background: var(--intergalactic-bg-primary-neutral-hover, oklch(0.98 0.001 180));
63
+ &[aria-checked='false'],
64
+ &[aria-selected='false'] {
65
+ &::after {
66
+ content: '';
67
+ display: block;
68
+ position: absolute;
69
+ top: 0;
70
+ left: 0;
71
+ width: 100%;
72
+ height: 100%;
73
+ border-radius: var(--intergalactic-rounded-small, 4px);
74
+ background: var(--intergalactic-control-pills-bg-hover, oklch(0.151 0.028 176.1 / 0.123));
75
+ }
76
+ }
58
77
  }
59
- }
60
78
 
61
- SPill[disabled] {
62
- cursor: default;
63
- /* Disable link interactions */
64
- pointer-events: none;
79
+ &[disabled] {
80
+ cursor: default;
81
+ pointer-events: none;
65
82
 
66
- &>* {
67
- opacity: var(--intergalactic-disabled-opacity, 0.4);
83
+ &>* {
84
+ opacity: var(--intergalactic-disabled-opacity, 0.4);
85
+ }
68
86
  }
69
- }
70
-
71
- SText {
72
- color: var(--intergalactic-text-primary, oklch(0.1 0.03 137 / 0.899));
73
- display: inline-flex;
74
- }
75
-
76
- SAddon {
77
- color: var(--intergalactic-text-secondary, oklch(0.088 0.026 147.7 / 0.583));
78
- display: inline-flex;
79
- align-items: center;
80
- justify-content: center;
81
- }
82
87
 
83
- SPill[size='m'] {
84
- height: var(--intergalactic-form-control-m, 28px);
85
- min-width: var(--intergalactic-form-control-m, 28px);
86
- font-size: var(--intergalactic-fs-200, 14px);
87
-
88
- & SText {
89
- margin-left: var(--intergalactic-spacing-2x, 8px);
90
- margin-right: var(--intergalactic-spacing-2x, 8px);
88
+ &[size='m'] {
89
+ min-width: calc(var(--intergalactic-form-control-m, 32px) - var(--intergalactic-spacing-content-padding-xsmall, 4px));
90
+ border-width: 2px 3px;
91
91
  }
92
92
 
93
- & SAddon {
94
- &:not(:only-child):first-child {
95
- margin-left: var(--intergalactic-spacing-2x, 8px);
96
- }
97
-
98
- &:not(:only-child):last-child {
99
- margin-right: var(--intergalactic-spacing-2x, 8px);
100
- }
101
-
102
- &:only-child {
103
- margin-left: var(--intergalactic-spacing-2x, 8px);
104
- margin-right: var(--intergalactic-spacing-2x, 8px);
105
- }
93
+ &[size='l'] {
94
+ min-width: calc(var(--intergalactic-form-control-l, 44px) - var(--intergalactic-spacing-content-padding-xsmall, 4px));
95
+ border-width: 3px 3px;
106
96
  }
107
97
  }
108
98
 
109
- SPill[size='l'] {
110
- height: var(--intergalactic-form-control-l, 40px);
111
- min-width: var(--intergalactic-form-control-l, 40px);
112
- font-size: var(--intergalactic-fs-300, 16px);
113
-
114
- & SText {
115
- margin-left: var(--intergalactic-spacing-2x, 8px);
116
- margin-right: var(--intergalactic-spacing-2x, 8px);
99
+ SPillContainer {
100
+ display: inline-flex;
117
101
 
118
- &:only-child {
119
- margin-left: var(--intergalactic-spacing-3x, 12px);
120
- margin-right: var(--intergalactic-spacing-3x, 12px);
102
+ &:has(SPill[aria-checked='true'], SPill[aria-selected='true']) {
103
+ SPillSeparator {
104
+ background-color: transparent;
121
105
  }
122
106
  }
123
107
 
124
- & SAddon {
125
- &:not(:only-child):first-child {
126
- margin-left: var(--intergalactic-spacing-3x, 12px);
108
+ &:has(+ SPillContainer SPill[aria-checked='true'], +SPillContainer SPill[aria-selected='true']) {
109
+ SPillSeparator {
110
+ background-color: transparent;
127
111
  }
112
+ }
113
+ }
128
114
 
129
- &:not(:only-child):last-child {
130
- margin-right: var(--intergalactic-spacing-3x, 12px);
131
- }
115
+ SPillSeparator {
116
+ align-self: center;
132
117
 
133
- &:only-child {
134
- margin-left: var(--intergalactic-spacing-3x, 12px);
135
- margin-right: var(--intergalactic-spacing-3x, 12px);
136
- }
118
+ width: 1px;
119
+ height: calc(100% - var(--intergalactic-spacing-content-padding-xsmall-extended, 6px) * 2);
120
+ background-color: var(--intergalactic-control-pills-border, oklch(0.137 0.026 175.7 / 0.161));
121
+
122
+ &[size='l'] {
123
+ height: calc(100% - var(--intergalactic-spacing-content-padding-small, 8px) * 2);
137
124
  }
138
125
  }
139
126
 
140
- SPill[neighborLocation='right'] {
141
- border-top-right-radius: 0;
142
- border-bottom-right-radius: 0;
127
+ SSegmentIndicator {
128
+ position: absolute;
129
+
130
+ /*
131
+ TODO: switch to anchor realisation when layout changes will be supported by FF and Safari.
132
+ As of now JS fallback is used.
133
+ */
134
+ /* position-anchor:--active-segment; */
135
+ /*left:anchor(left);*/
136
+ /*width:anchor-size(width);*/
137
+ /*height:anchor-size(height);*/
138
+ left: var(--global-left);
139
+ width: var(--global-width);
140
+ height: var(--global-height);
141
+ transition: var(--global-speed);
142
+
143
+ background: var(--intergalactic-control-pills-bg-selected, oklch(1 0 0));
144
+ box-shadow: var(--intergalactic-box-shadow-control-elevated, 0px 0px 1px 0px oklch(0.176 0.033 175.7 / 0.07), 0px 1px 3px 0px oklch(0.176 0.033 175.7 / 0.07));
145
+ border-radius: var(--intergalactic-rounded-small, 4px);
143
146
  }
144
147
 
145
- SPill[neighborLocation='both'] {
146
- border-radius: 0;
147
- /* disable-tokens-validator */
148
- margin-left: -1px;
148
+ SText {
149
+ color: var(--intergalactic-text-primary, oklch(0.1 0.03 137 / 0.899));
150
+ min-width: 0.8em;
149
151
  }
150
152
 
151
- SPill[neighborLocation='left'] {
152
- border-top-left-radius: 0;
153
- border-bottom-left-radius: 0;
154
- /* disable-tokens-validator */
155
- margin-left: -1px;
153
+ SAddon {
154
+ color: var(--intergalactic-text-secondary, oklch(0.097 0.023 156.5 / 0.468));
155
+ display: inline-flex;
156
+ align-items: center;
157
+ justify-content: center;
156
158
  }
159
+
160
+ @media (prefers-reduced-motion) {
161
+ SSegmentIndicator {
162
+ transition: none;
163
+ }
164
+ }
@@ -9,3 +9,4 @@ export declare const wrapPills: <PropsExtending extends {}>(wrapper: (props: Int
9
9
  */
10
10
  declare const Pills: NSPills.Component;
11
11
  export default Pills;
12
+ //# sourceMappingURL=Pills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pills.d.ts","sourceRoot":"","sources":["../../src/Pills.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAOnD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAuP5C,eAAO,MAAM,SAAS,GAAI,cAAc,SAAS,EAAE,EAAE,SAAS,CAC5D,KAAK,EAAE,aAAa,CAAC,eAAe,CAAC,eAAe,CAClD,aAAa,CAAC,eAAe,CAAC,qBAAqB,CAAC,OAAO,CAAC,aAAa,CAAC,CAC3E,GACD,cAAc,KACX,KAAK,CAAC,SAAS,KAAgB,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;AAE1E;;;;GAIG;AACH,QAAA,MAAM,KAAK,mBAKT,CAAC;AAEH,eAAe,KAAK,CAAC"}
@@ -1,9 +1,10 @@
1
- import type { Box, BoxProps, NeighborItemProps, NeighborLocationProps } from '@semcore/base-components';
1
+ import type { NSBox, NSNeighborLocation } from '@semcore/base-components';
2
2
  import type { PropGetterFn, Intergalactic } from '@semcore/core';
3
+ import type { NSText } from '@semcore/typography';
3
4
  import type React from 'react';
4
5
  declare namespace NSPills {
5
6
  type Value = string | number | boolean | null;
6
- type Props<T extends NSPills.Value = NSPills.Value> = NeighborLocationProps & BoxProps & {
7
+ type Props<T extends NSPills.Value = NSPills.Value> = NSBox.Props & {
7
8
  /** Pills size */
8
9
  size?: 'l' | 'm';
9
10
  /** Disabled state */
@@ -36,7 +37,7 @@ declare namespace NSPills {
36
37
  behavior: Props['behavior'];
37
38
  };
38
39
  namespace Pill {
39
- type Props = BoxProps & NeighborItemProps & {
40
+ type Props = NSBox.Props & NSNeighborLocation.Detect.Props & {
40
41
  /** Pill value */
41
42
  value?: NSPills.Value;
42
43
  /** Disabled state */
@@ -49,10 +50,10 @@ declare namespace NSPills {
49
50
  addonRight?: React.ElementType;
50
51
  };
51
52
  namespace Text {
52
- type Component = typeof Box;
53
+ type Component = NSText.Component;
53
54
  }
54
55
  namespace Addon {
55
- type Component = typeof Box;
56
+ type Component = NSBox.Component;
56
57
  }
57
58
  type Component = Intergalactic.Component<'button', Props, [handlers: Handlers]>;
58
59
  }
@@ -66,14 +67,15 @@ declare namespace NSPills {
66
67
  };
67
68
  };
68
69
  }
69
- /** @deprecated It will be removed in v18. */
70
+ /** @deprecated It will be removed in v19. */
70
71
  export type PillsValue = NSPills.Value;
71
- /** @deprecated It will be removed in v18. */
72
+ /** @deprecated It will be removed in v19. */
72
73
  export type PillsProps<T extends PillsValue = PillsValue> = NSPills.Props<T>;
73
- /** @deprecated It will be removed in v18. */
74
+ /** @deprecated It will be removed in v19. */
74
75
  export type PillProps = NSPills.Pill.Props;
75
- /** @deprecated It will be removed in v18. */
76
+ /** @deprecated It will be removed in v19. */
76
77
  export type PillsContext = NSPills.Ctx;
77
- /** @deprecated It will be removed in v18. */
78
+ /** @deprecated It will be removed in v19. */
78
79
  export type PillsHandlers = NSPills.Handlers;
79
80
  export type { NSPills };
81
+ //# sourceMappingURL=Pills.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pills.type.d.ts","sourceRoot":"","sources":["../../src/Pills.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,WAAW,OAAO,CAAC;IAExB,KAAK,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IAC9C,KAAK,KAAK,CAAC,CAAC,SAAS,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,GAAG;QAClE,iBAAiB;QACjB,IAAI,CAAC,EA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M,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC;AAE7C,YAAY,EAAE,OAAO,EAAE,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export { default, wrapPills } from './Pills';
2
2
  export * from './Pills.type';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7C,cAAc,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/pills",
3
3
  "description": "Semrush Pills Component",
4
- "version": "17.2.1",
4
+ "version": "18.0.0-prerelease.0",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -13,8 +13,11 @@
13
13
  "import": "./lib/esm/index.mjs",
14
14
  "require": "./lib/cjs/index.js"
15
15
  },
16
+ "dependencies": {
17
+ "@semcore/typography": "^18.0.0-prerelease.0"
18
+ },
16
19
  "peerDependencies": {
17
- "@semcore/base-components": "^17.2.1"
20
+ "@semcore/base-components": "^18.0.0-prerelease.0"
18
21
  },
19
22
  "repository": {
20
23
  "type": "git",
@@ -22,11 +25,11 @@
22
25
  "directory": "semcore/pills"
23
26
  },
24
27
  "devDependencies": {
25
- "@semcore/core": "17.2.1",
28
+ "@semcore/core": "18.0.0-prerelease.0",
29
+ "@semcore/base-components": "18.0.0-prerelease.0",
30
+ "@semcore/badge": "18.0.0-prerelease.0",
26
31
  "@semcore/testing-utils": "1.0.0",
27
- "@semcore/badge": "17.2.1",
28
- "@semcore/base-components": "17.2.1",
29
- "@semcore/icon": "17.2.0"
32
+ "@semcore/icon": "18.0.0-prerelease.0"
30
33
  },
31
34
  "scripts": {
32
35
  "build": "pnpm semcore-builder && pnpm vite build"