bits-ui 0.13.4 → 0.13.6

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/README.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  The headless components for Svelte.
4
4
 
5
- [Read the docs](https://bits-ui.com) (still a work in progress)
5
+ [Read the docs](https://bits-ui.com)
6
6
 
7
- Powered by [Melt UI](https://melt-ui.com) builders.
7
+ ## Credits
8
+
9
+ - [Bitworks](https://bitworks.cz) - The design team behind the Bits UI documentation and example components.
10
+ - [Melt UI](https://melt-ui.com) - The underlying builder API that powers Bits.
11
+ - [Radix UI](https://radix-ui.com) - The incredible headless component APIs that we've taken heavy inspiration from.
12
+ - [React Spectrum](https://react-spectrum.adobe.com) - An incredible collection of headless components we've taken inspiration from.
@@ -22,7 +22,6 @@ export function getCalendarData() {
22
22
  export function setCtx(props) {
23
23
  const { NAME, PARTS } = getCalendarData();
24
24
  const getCalendarAttrs = createBitAttrs(NAME, PARTS);
25
- console.log(getCalendarAttrs);
26
25
  const calendar = { ...createCalendar(removeUndefined(props)), getCalendarAttrs };
27
26
  setContext(NAME, calendar);
28
27
  return {
@@ -33,6 +32,5 @@ export function setCtx(props) {
33
32
  export function getCtx() {
34
33
  const { NAME } = getCalendarData();
35
34
  const ctx = getContext(NAME);
36
- console.log(ctx);
37
35
  return ctx;
38
36
  }
@@ -20,7 +20,7 @@ export function setCtx(props) {
20
20
  const { NAME: POPOVER_NAME, PARTS: POPOVER_PARTS } = getPopoverData();
21
21
  const getPopoverAttrs = createBitAttrs(POPOVER_NAME, POPOVER_PARTS);
22
22
  const datePicker = {
23
- ...createDatePicker(removeUndefined(props)),
23
+ ...createDatePicker({ ...removeUndefined(props), forceVisible: true }),
24
24
  getCalendarAttrs,
25
25
  getFieldAttrs,
26
26
  getPopoverAttrs
@@ -20,7 +20,7 @@ export function setCtx(props) {
20
20
  const { NAME: POPOVER_NAME, PARTS: POPOVER_PARTS } = getPopoverData();
21
21
  const getPopoverAttrs = createBitAttrs(POPOVER_NAME, POPOVER_PARTS);
22
22
  const dateRangePicker = {
23
- ...createDateRangePicker(removeUndefined(props)),
23
+ ...createDateRangePicker({ ...removeUndefined(props), forceVisible: true }),
24
24
  getCalendarAttrs,
25
25
  getFieldAttrs,
26
26
  getPopoverAttrs
@@ -20,7 +20,10 @@ export function getDialogData() {
20
20
  export function setCtx(props) {
21
21
  const { NAME, PARTS } = getDialogData();
22
22
  const getAttrs = createBitAttrs(NAME, PARTS);
23
- const dialog = { ...createDialog({ ...removeUndefined(props), role: "dialog" }), getAttrs };
23
+ const dialog = {
24
+ ...createDialog({ ...removeUndefined(props), role: "dialog", forceVisible: true }),
25
+ getAttrs
26
+ };
24
27
  setContext(NAME, dialog);
25
28
  return {
26
29
  ...dialog,
@@ -20,10 +20,11 @@ export function updatePositioning(store, props) {
20
20
  ...prev,
21
21
  placement: joinPlacement(withDefaults.side, withDefaults.align),
22
22
  offset: {
23
+ ...prev.offset,
23
24
  mainAxis: withDefaults.sideOffset,
24
25
  crossAxis: withDefaults.alignOffset
25
26
  },
26
- gutter: undefined,
27
+ gutter: 0,
27
28
  sameWidth: withDefaults.sameWidth,
28
29
  flip: withDefaults.avoidCollisions,
29
30
  overflowPadding: withDefaults.collisionPadding,
@@ -1 +1 @@
1
- export { ContentProps, ContentProps as SubContentProps };
1
+ export {};
@@ -33,7 +33,10 @@ export function setCtx(
33
33
  props) {
34
34
  const { NAME, PARTS } = getSelectData();
35
35
  const getAttrs = createBitAttrs(NAME, PARTS);
36
- const select = { ...createSelect(removeUndefined(props)), getAttrs };
36
+ const select = {
37
+ ...createSelect({ ...removeUndefined(props), forceVisible: true }),
38
+ getAttrs
39
+ };
37
40
  setContext(NAME, select);
38
41
  return {
39
42
  ...select,
@@ -26,7 +26,7 @@ const {
26
26
  states: { open },
27
27
  ids,
28
28
  getAttrs
29
- } = getCtx(sideOffset);
29
+ } = getCtx();
30
30
  const dispatch = createDispatcher();
31
31
  const attrs = getAttrs("content");
32
32
  $:
@@ -38,19 +38,21 @@ $:
38
38
  $:
39
39
  Object.assign(builder, attrs);
40
40
  $:
41
- updatePositioning({
42
- side,
43
- align,
44
- sideOffset,
45
- alignOffset,
46
- collisionPadding,
47
- avoidCollisions,
48
- collisionBoundary,
49
- sameWidth,
50
- fitViewport,
51
- strategy,
52
- overlap
53
- });
41
+ if ($open) {
42
+ updatePositioning({
43
+ side,
44
+ align,
45
+ sideOffset,
46
+ alignOffset,
47
+ collisionPadding,
48
+ avoidCollisions,
49
+ collisionBoundary,
50
+ sameWidth,
51
+ fitViewport,
52
+ strategy,
53
+ overlap
54
+ });
55
+ }
54
56
  </script>
55
57
 
56
58
  {#if asChild && $open}
@@ -29,6 +29,12 @@ const {
29
29
  open = next;
30
30
  }
31
31
  return next;
32
+ },
33
+ positioning: {
34
+ gutter: 0,
35
+ offset: {
36
+ mainAxis: 1
37
+ }
32
38
  }
33
39
  });
34
40
  const idValues = derived(
@@ -57,7 +57,7 @@ export declare function setCtx(props: CreateTooltipProps): {
57
57
  }> | undefined;
58
58
  }, "open" | "ids">>;
59
59
  };
60
- export declare function getCtx(sideOffset?: number): GetReturn;
60
+ export declare function getCtx(): GetReturn;
61
61
  export declare function setArrow(size?: number): GetReturn;
62
62
  export declare function updatePositioning(props: FloatingProps): void;
63
63
  export {};
@@ -16,10 +16,12 @@ export function setCtx(props) {
16
16
  const tooltip = {
17
17
  ...createTooltip({
18
18
  positioning: {
19
- placement: "top"
19
+ placement: "top",
20
+ gutter: 0
20
21
  },
21
22
  openDelay: 700,
22
- ...removeUndefined(props)
23
+ ...removeUndefined(props),
24
+ forceVisible: true
23
25
  }),
24
26
  getAttrs
25
27
  };
@@ -29,12 +31,9 @@ export function setCtx(props) {
29
31
  updateOption: getOptionUpdater(tooltip.options)
30
32
  };
31
33
  }
32
- export function getCtx(sideOffset = 0) {
34
+ export function getCtx() {
33
35
  const { NAME } = getTooltipData();
34
- const tooltip = getContext(NAME);
35
- const { options: { positioning } } = tooltip;
36
- positioning.update((prev) => ({ ...prev, gutter: sideOffset }));
37
- return tooltip;
36
+ return getContext(NAME);
38
37
  }
39
38
  export function setArrow(size = 8) {
40
39
  const tooltip = getCtx();
@@ -44,10 +43,11 @@ export function setArrow(size = 8) {
44
43
  export function updatePositioning(props) {
45
44
  const defaultPlacement = {
46
45
  side: "top",
47
- align: "center"
46
+ align: "center",
47
+ sideOffset: 1
48
48
  };
49
49
  const withDefaults = { ...defaultPlacement, ...props };
50
50
  const { options: { positioning } } = getCtx();
51
51
  const updater = getPositioningUpdater(positioning);
52
- updater(withDefaults);
52
+ updater({ ...withDefaults });
53
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bits-ui",
3
- "version": "0.13.4",
3
+ "version": "0.13.6",
4
4
  "license": "MIT",
5
5
  "repository": "github:huntabyte/bits-ui",
6
6
  "exports": {
@@ -17,53 +17,53 @@
17
17
  "devDependencies": {
18
18
  "@changesets/cli": "^2.27.1",
19
19
  "@huntabyte/mdsvex": "0.16.5",
20
- "@melt-ui/pp": "^0.1.4",
20
+ "@melt-ui/pp": "^0.3.0",
21
21
  "@playwright/test": "^1.28.1",
22
22
  "@sveltejs/adapter-vercel": "^3.1.0",
23
23
  "@sveltejs/kit": "^1.27.6",
24
- "@sveltejs/package": "^2.2.3",
24
+ "@sveltejs/package": "^2.2.5",
25
25
  "@svitejs/changesets-changelog-github-compact": "^1.1.0",
26
26
  "@tailwindcss/typography": "^0.5.10",
27
- "@testing-library/dom": "^9.3.1",
27
+ "@testing-library/dom": "^9.3.3",
28
28
  "@testing-library/jest-dom": "^5.17.0",
29
29
  "@testing-library/svelte": "^4.0.5",
30
30
  "@testing-library/user-event": "^14.4.3",
31
- "@types/jest-axe": "^3.5.8",
31
+ "@types/jest-axe": "^3.5.9",
32
32
  "@types/testing-library__jest-dom": "^5.14.9",
33
- "@typescript-eslint/eslint-plugin": "^6.10.0",
34
- "@typescript-eslint/parser": "^6.10.0",
33
+ "@typescript-eslint/eslint-plugin": "^6.18.0",
34
+ "@typescript-eslint/parser": "^6.18.0",
35
35
  "autoprefixer": "^10.4.16",
36
- "clsx": "^2.0.0",
36
+ "clsx": "^2.1.0",
37
37
  "concurrently": "^8.2.2",
38
38
  "contentlayer": "^0.3.4",
39
- "eslint": "^8.53.0",
39
+ "eslint": "^8.56.0",
40
40
  "eslint-config-prettier": "^8.5.0",
41
- "eslint-plugin-svelte": "^2.35.0",
41
+ "eslint-plugin-svelte": "^2.35.1",
42
42
  "esm-env": "^1.0.0",
43
43
  "hast-util-to-html": "^9.0.0",
44
44
  "jest-axe": "^8.0.0",
45
45
  "jsdom": "^22.1.0",
46
- "mode-watcher": "^0.1.1",
47
- "phosphor-svelte": "^1.3.0",
48
- "postcss": "^8.4.31",
46
+ "mode-watcher": "^0.1.2",
47
+ "phosphor-svelte": "^1.4.2",
48
+ "postcss": "^8.4.33",
49
49
  "postcss-load-config": "^4.0.1",
50
50
  "prettier": "^2.8.8",
51
51
  "prettier-plugin-svelte": "^2.10.1",
52
52
  "prettier-plugin-tailwindcss": "0.2.7",
53
- "publint": "^0.2.5",
53
+ "publint": "^0.2.7",
54
54
  "rehype-pretty-code": "^0.10.0",
55
55
  "remark-gfm": "^4.0.0",
56
56
  "resize-observer-polyfill": "^1.5.1",
57
57
  "shiki": "^0.14.5",
58
- "svelte": "^4.2.3",
59
- "svelte-check": "^3.6.0",
58
+ "svelte": "^4.2.8",
59
+ "svelte-check": "^3.6.2",
60
60
  "svelte-sequential-preprocessor": "^2.0.1",
61
61
  "svelte-wrap-balancer": "^0.0.4",
62
- "tailwind-merge": "^1.14.0",
63
- "tailwind-variants": "^0.1.14",
64
- "tailwindcss": "^3.3.5",
62
+ "tailwind-merge": "^2.2.0",
63
+ "tailwind-variants": "^0.1.20",
64
+ "tailwindcss": "^3.4.1",
65
65
  "tslib": "^2.6.2",
66
- "typescript": "^5.2.2",
66
+ "typescript": "^5.3.3",
67
67
  "unist-builder": "^4.0.0",
68
68
  "unist-util-visit": "^5.0.0",
69
69
  "vite": "^4.5.0",